@mastra/mcp-docs-server 0.13.9-alpha.0 → 0.13.9-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +1 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fastra.md +14 -14
  3. package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +14 -14
  5. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +36 -36
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +25 -25
  7. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +14 -14
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +14 -14
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +14 -14
  10. package/.docs/organized/changelogs/%40mastra%2Fcore.md +27 -27
  11. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +14 -14
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +30 -30
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +28 -28
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +28 -28
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +31 -31
  16. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +28 -28
  17. package/.docs/organized/changelogs/%40mastra%2Fevals.md +30 -30
  18. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  19. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +28 -28
  20. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +14 -14
  21. package/.docs/organized/changelogs/%40mastra%2Flance.md +13 -0
  22. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +29 -29
  23. package/.docs/organized/changelogs/%40mastra%2Floggers.md +14 -14
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +24 -24
  25. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +14 -14
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +14 -14
  27. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +14 -14
  28. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +30 -30
  29. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +35 -35
  30. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +42 -1
  31. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +15 -15
  32. package/.docs/organized/changelogs/%40mastra%2Fpg.md +15 -15
  33. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +14 -14
  34. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +29 -29
  35. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +14 -14
  36. package/.docs/organized/changelogs/%40mastra%2Frag.md +26 -26
  37. package/.docs/organized/changelogs/%40mastra%2Fragie.md +14 -14
  38. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  39. package/.docs/organized/changelogs/%40mastra%2Fserver.md +24 -24
  40. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +14 -14
  41. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +31 -31
  42. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +14 -14
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +14 -14
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +15 -15
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +14 -14
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +14 -14
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +13 -0
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +14 -14
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +14 -14
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +14 -14
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +16 -16
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +14 -14
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +14 -14
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +14 -14
  55. package/.docs/organized/changelogs/create-mastra.md +5 -5
  56. package/.docs/organized/changelogs/mastra.md +32 -32
  57. package/.docs/organized/code-examples/workflow-with-separate-steps.md +83 -40
  58. package/.docs/raw/agents/overview.mdx +1 -0
  59. package/.docs/raw/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +27 -8
  60. package/.docs/raw/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +1 -1
  61. package/.docs/raw/memory/memory-processors.mdx +4 -3
  62. package/.docs/raw/memory/semantic-recall.mdx +2 -0
  63. package/.docs/raw/memory/working-memory.mdx +1 -1
  64. package/.docs/raw/rag/chunking-and-embedding.mdx +19 -3
  65. package/.docs/raw/reference/rag/chunk.mdx +169 -18
  66. package/.docs/raw/workflows/using-with-agents-and-tools.mdx +25 -0
  67. package/package.json +6 -6
@@ -20,15 +20,21 @@
20
20
  import { mastra } from './mastra';
21
21
 
22
22
  async function main() {
23
- const myWorkflow = mastra.getWorkflow('myWorkflow');
24
- const { start } = myWorkflow.createRun();
23
+ const run = await mastra.getWorkflow('myWorkflow').createRunAsync();
25
24
  try {
26
- const res = await start({
27
- triggerData: {
28
- inputValue: 30,
25
+ const res = await run.start({
26
+ inputData: {
27
+ inputValue: 12,
29
28
  },
30
29
  });
31
- console.log(res.results);
30
+
31
+ if (res.status === 'success') {
32
+ console.log(res.result);
33
+ } else if (res.status === 'failed') {
34
+ console.log('Workflow failed:', res.error);
35
+ } else {
36
+ console.log('Workflow suspended:', res.suspended);
37
+ }
32
38
  } catch (e) {
33
39
  console.log(e);
34
40
  }
@@ -54,64 +60,101 @@ export const mastra = new Mastra({
54
60
 
55
61
  ### mastra/workflows/index.ts
56
62
  ```typescript
57
- import { Step, Workflow } from '@mastra/core/workflows';
63
+ import { createStep, createWorkflow } from '@mastra/core/workflows';
58
64
  import { z } from 'zod';
59
65
 
60
- const stepOne = new Step({
66
+ const stepOne = createStep({
61
67
  id: 'stepOne',
62
- execute: async ({ context }) => {
63
- const triggerData = context?.triggerData;
64
- const doubledValue = triggerData.inputValue * 2;
65
- return { doubledValue };
68
+ inputSchema: z.object({
69
+ inputValue: z.number(),
70
+ }),
71
+ outputSchema: z.object({
72
+ doubledValue: z.number(),
73
+ isOriginalOdd: z.boolean(), // Track original parity
74
+ }),
75
+ execute: async ({ inputData }) => {
76
+ const doubledValue = inputData.inputValue * 2;
77
+ const isOriginalOdd = inputData.inputValue % 2 === 1;
78
+ return { doubledValue, isOriginalOdd };
66
79
  },
67
80
  });
68
81
 
69
- const stepTwo = new Step({
82
+ const stepTwo = createStep({
70
83
  id: 'stepTwo',
71
- execute: async ({ context }) => {
72
- if (context?.steps.stepOne.status !== 'success') {
73
- throw new Error('stepOne failed');
74
- }
75
- const stepOneResult = context?.steps.stepOne?.output;
76
- const incrementedValue = stepOneResult.doubledValue + 1;
84
+ inputSchema: z.object({
85
+ doubledValue: z.number(),
86
+ isOriginalOdd: z.boolean(),
87
+ }),
88
+ outputSchema: z.object({
89
+ incrementedValue: z.number(),
90
+ }),
91
+ execute: async ({ inputData }) => {
92
+ // Increment only if original input was odd
93
+ const incrementedValue = inputData.doubledValue + (inputData.isOriginalOdd ? 1 : 0);
77
94
  return { incrementedValue };
78
95
  },
79
96
  });
80
97
 
81
- const stepThree = new Step({
98
+ const stepThree = createStep({
82
99
  id: 'stepThree',
83
- execute: async ({ context }) => {
84
- const triggerData = context?.triggerData;
85
- const tripledValue = triggerData.inputValue * 3;
100
+ inputSchema: z.object({
101
+ incrementedValue: z.number(),
102
+ }),
103
+ outputSchema: z.object({
104
+ tripledValue: z.number(),
105
+ }),
106
+ execute: async ({ inputData, getStepResult }) => {
107
+ try {
108
+ const stepTwoResult = getStepResult(stepTwo);
109
+ if (!stepTwoResult || typeof stepTwoResult.incrementedValue !== 'number') {
110
+ throw new Error('stepTwo failed or returned invalid data');
111
+ }
112
+ } catch (error) {
113
+ throw new Error(`stepTwo failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
114
+ }
115
+
116
+ const tripledValue = inputData.incrementedValue * 3;
86
117
  return { tripledValue };
87
118
  },
88
119
  });
89
120
 
90
- const stepFour = new Step({
121
+ const stepFour = createStep({
91
122
  id: 'stepFour',
92
- execute: async ({ context }) => {
93
- if (context?.steps.stepThree.status !== 'success') {
94
- throw new Error('stepThree failed');
123
+ inputSchema: z.object({
124
+ tripledValue: z.number(),
125
+ }),
126
+ outputSchema: z.object({
127
+ isEven: z.boolean(),
128
+ }),
129
+ execute: async ({ inputData, getStepResult }) => {
130
+ try {
131
+ const stepThreeResult = getStepResult(stepThree);
132
+ if (!stepThreeResult || typeof stepThreeResult.tripledValue !== 'number') {
133
+ throw new Error('stepThree failed or returned invalid data');
134
+ }
135
+ } catch (error) {
136
+ throw new Error(`stepThree failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
95
137
  }
96
- const stepThreeResult = context?.steps.stepThree?.output;
97
- const isEven = stepThreeResult.tripledValue % 2 === 0;
138
+
139
+ const isEven = inputData.tripledValue % 2 === 0;
98
140
  return { isEven };
99
141
  },
100
142
  });
101
143
 
102
- export const myWorkflow = new Workflow({
103
- name: 'my-workflow',
104
- triggerSchema: z.object({
144
+ export const myWorkflow = createWorkflow({
145
+ id: 'my-workflow',
146
+ inputSchema: z.object({
105
147
  inputValue: z.number(),
106
148
  }),
107
- });
108
-
109
- myWorkflow.step(stepOne).then(stepTwo).step(stepThree).then(stepFour).commit();
110
-
111
- const { start } = myWorkflow.createRun();
112
-
113
- const result = await start({ triggerData: { inputValue: 3 } });
149
+ outputSchema: z.object({
150
+ isEven: z.boolean(),
151
+ }),
152
+ })
153
+ .then(stepOne)
154
+ .then(stepTwo)
155
+ .then(stepThree)
156
+ .then(stepFour);
114
157
 
115
- console.log(result);
158
+ myWorkflow.commit();
116
159
 
117
160
  ```
@@ -100,6 +100,7 @@ await testAgent.generate([
100
100
  {
101
101
  type: 'image',
102
102
  image: "https://example.com/images/test-image.jpg",
103
+ mimeType: "image/jpeg"
103
104
  },
104
105
  {
105
106
  type: 'text',
@@ -1,16 +1,35 @@
1
- # Getting a Composio GitHub MCP URL
1
+ # Getting a Smithery GitHub MCP URL
2
2
 
3
- First, you'll need to get a Composio GitHub MCP URL. This typically requires:
3
+ First, you'll need to get a Smithery GitHub MCP URL. This typically requires:
4
4
 
5
- 1. Setting up the Composio GitHub integration
6
- 2. Authenticating with your GitHub account
7
- 3. Getting your unique MCP URL
5
+ 1. Setting up a Smithery account
6
+ 2. Creating a personal access token with your GitHub account
7
+ 3. Getting your unique MCP URL via the Smithery packages
8
8
 
9
- For this example, we'll use an environment variable to store the URL:
9
+ For this example, we'll use an environment variable to store the Smithery API key and profile name which can be found in the Smithery interface.
10
10
 
11
11
  ```bash
12
12
  # Add this to your .env file
13
- COMPOSIO_MCP_GITHUB=https://your-composio-github-mcp-url.com
13
+ SMITHERY_API_KEY=your_smithery_api_key
14
+ SMITHERY_PROFILE=your_smithery_profile_name
14
15
  ```
15
16
 
16
- Using an environment variable keeps your configuration secure and flexible. This approach allows you to easily switch between different GitHub accounts or environments without modifying your code. It also prevents sensitive information from being committed to your repository.
17
+ Using an environment variable keeps your configuration secure and flexible. It also prevents sensitive information from being committed to your repository.
18
+
19
+ We will use the Smithery packages to authenticate and create a streamable HTTP URL for the MCP server configuration
20
+
21
+ ```bash
22
+ pnpm install @smithery/sdk
23
+ ```
24
+
25
+ ```ts
26
+ import { createSmitheryUrl } from "@smithery/sdk";
27
+
28
+ const smitheryGithubMCPServerUrl = createSmitheryUrl(
29
+ "https://server.smithery.ai/@smithery-ai/github",
30
+ {
31
+ apiKey: process.env.SMITHERY_API_KEY,
32
+ profile: process.env.SMITHERY_PROFILE,
33
+ },
34
+ );
35
+ ```
@@ -9,7 +9,7 @@ const mcp = new MCPClient({
9
9
  url: new URL(process.env.ZAPIER_MCP_URL || ""),
10
10
  },
11
11
  github: {
12
- url: new URL(process.env.COMPOSIO_MCP_GITHUB || ""),
12
+ url: smitheryGithubMCPServerUrl,
13
13
  },
14
14
  },
15
15
  });
@@ -97,9 +97,10 @@ const memoryWithMultipleProcessors = new Memory({
97
97
 
98
98
  You can create custom logic by extending the base `MemoryProcessor` class.
99
99
 
100
- ```typescript copy showLineNumbers {4-19,23-26}
101
- import { Memory, CoreMessage } from "@mastra/memory";
102
- import { MemoryProcessor, MemoryProcessorOpts } from "@mastra/core/memory";
100
+ ```typescript copy showLineNumbers {5-20,24-27}
101
+ import { Memory } from "@mastra/memory";
102
+ import { CoreMessage, MemoryProcessorOpts } from "@mastra/core";
103
+ import { MemoryProcessor } from "@mastra/core/memory";
103
104
 
104
105
  class ConversationOnlyFilter extends MemoryProcessor {
105
106
  constructor() {
@@ -2,6 +2,8 @@
2
2
 
3
3
  If you ask your friend what they did last weekend, they will search in their memory for events associated with "last weekend" and then tell you what they did. That's sort of like how semantic recall works in Mastra.
4
4
 
5
+ > **📹 Watch**: What semantic recall is, how it works, and how to configure it in Mastra → [YouTube (5 minutes)](https://youtu.be/UVZtK8cK8xQ)
6
+
5
7
  ## How Semantic Recall Works
6
8
 
7
9
  Semantic recall is RAG-based search that helps agents maintain context across longer interactions when messages are no longer within [recent conversation history](./overview.mdx#conversation-history).
@@ -43,7 +43,7 @@ const agent = new Agent({
43
43
 
44
44
  Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information:
45
45
 
46
- <YouTube id="ik-ld_XA96s" />
46
+ <YouTube id="UMy_JHLf1n8" />
47
47
 
48
48
  ## Memory Persistence Scopes
49
49
 
@@ -25,21 +25,37 @@ Use `chunk` to split documents into manageable pieces. Mastra supports multiple
25
25
  - `html`: HTML structure-aware splitting
26
26
  - `json`: JSON structure-aware splitting
27
27
  - `latex`: LaTeX structure-aware splitting
28
+ - `sentence`: Sentence-aware splitting
29
+
30
+ **Note:** Each strategy accepts different parameters optimized for its chunking approach.
28
31
 
29
32
  Here's an example of how to use the `recursive` strategy:
30
33
 
31
34
  ```ts showLineNumbers copy
32
35
  const chunks = await doc.chunk({
33
36
  strategy: "recursive",
34
- size: 512,
37
+ maxSize: 512,
35
38
  overlap: 50,
36
- separator: "\n",
39
+ separators: ["\n"],
37
40
  extract: {
38
41
  metadata: true, // Optionally extract metadata
39
42
  },
40
43
  });
41
44
  ```
42
45
 
46
+ For text where preserving sentence structure is important, here's an example of how to use the `sentence` strategy:
47
+
48
+ ```ts showLineNumbers copy
49
+ const chunks = await doc.chunk({
50
+ strategy: "sentence",
51
+ maxSize: 450,
52
+ minSize: 50,
53
+ overlap: 0,
54
+ sentenceEnders: ["."],
55
+ keepSeparator: true,
56
+ });
57
+ ```
58
+
43
59
  **Note:** Metadata extraction may use LLM calls, so ensure your API key is set.
44
60
 
45
61
  We go deeper into chunking strategies in our [chunk documentation](/reference/rag/chunk.mdx).
@@ -130,7 +146,7 @@ const doc = MDocument.fromText(`
130
146
  // Create chunks
131
147
  const chunks = await doc.chunk({
132
148
  strategy: "recursive",
133
- size: 256,
149
+ maxSize: 256,
134
150
  overlap: 50,
135
151
  });
136
152
 
@@ -42,21 +42,30 @@ const chunksWithMetadata = await doc.chunk({
42
42
 
43
43
  ## Parameters
44
44
 
45
+ The following parameters are available for all chunking strategies.
46
+ **Important:** Each strategy will only utilize a subset of these parameters relevant to its specific use case.
47
+
45
48
  <PropertiesTable
46
49
  content={[
47
50
  {
48
51
  name: "strategy",
49
- type: "'recursive' | 'character' | 'token' | 'markdown' | 'html' | 'json' | 'latex'",
52
+ type: "'recursive' | 'character' | 'token' | 'markdown' | 'html' | 'json' | 'latex' | 'sentence'",
50
53
  isOptional: true,
51
54
  description:
52
55
  "The chunking strategy to use. If not specified, defaults based on document type. Depending on the chunking strategy, there are additional optionals. Defaults: .md files → 'markdown', .html/.htm → 'html', .json → 'json', .tex → 'latex', others → 'recursive'",
53
56
  },
57
+ {
58
+ name: "maxSize",
59
+ type: "number",
60
+ isOptional: true,
61
+ defaultValue: "4000",
62
+ description: "Maximum size of each chunk. **Note:** Some strategy configurations (markdown with headers, HTML with headers) ignore this parameter.",
63
+ },
54
64
  {
55
65
  name: "size",
56
66
  type: "number",
57
67
  isOptional: true,
58
- defaultValue: "512",
59
- description: "Maximum size of each chunk",
68
+ description: "**Deprecated:** Use `maxSize` instead. This parameter will be removed in the next major version.",
60
69
  },
61
70
  {
62
71
  name: "overlap",
@@ -66,33 +75,38 @@ const chunksWithMetadata = await doc.chunk({
66
75
  description: "Number of characters/tokens that overlap between chunks.",
67
76
  },
68
77
  {
69
- name: "separator",
70
- type: "string",
78
+ name: "lengthFunction",
79
+ type: "(text: string) => number",
80
+ isOptional: true,
81
+ description: "Function to calculate text length. Defaults to character count.",
82
+ },
83
+ {
84
+ name: "keepSeparator",
85
+ type: "boolean | 'start' | 'end'",
71
86
  isOptional: true,
72
- defaultValue: "\\n\\n",
73
87
  description:
74
- "Character(s) to split on. Defaults to double newline for text content.",
88
+ "Whether to keep the separator at the start or end of chunks",
75
89
  },
76
90
  {
77
- name: "isSeparatorRegex",
91
+ name: "addStartIndex",
78
92
  type: "boolean",
79
93
  isOptional: true,
80
94
  defaultValue: "false",
81
- description: "Whether the separator is a regex pattern",
95
+ description: "Whether to add start index metadata to chunks.",
82
96
  },
83
97
  {
84
- name: "keepSeparator",
85
- type: "'start' | 'end'",
98
+ name: "stripWhitespace",
99
+ type: "boolean",
86
100
  isOptional: true,
87
- description:
88
- "Whether to keep the separator at the start or end of chunks",
101
+ defaultValue: "true",
102
+ description: "Whether to strip whitespace from chunks.",
89
103
  },
90
104
  {
91
105
  name: "extract",
92
106
  type: "ExtractParams",
93
107
  isOptional: true,
94
108
  description:
95
- "Metadata extraction configuration. See [ExtractParams reference](./extract-params) for details.",
109
+ "Metadata extraction configuration. See [ExtractParams reference](/reference/rag/extract-params) for details.",
96
110
  },
97
111
  ]}
98
112
  />
@@ -102,6 +116,32 @@ const chunksWithMetadata = await doc.chunk({
102
116
  Strategy-specific options are passed as top-level parameters alongside the strategy parameter. For example:
103
117
 
104
118
  ```typescript showLineNumbers copy
119
+ // Character strategy example
120
+ const chunks = await doc.chunk({
121
+ strategy: "character",
122
+ separator: ".", // Character-specific option
123
+ isSeparatorRegex: false, // Character-specific option
124
+ maxSize: 300, // general option
125
+ });
126
+
127
+ // Recursive strategy example
128
+ const chunks = await doc.chunk({
129
+ strategy: "recursive",
130
+ separators: ["\n\n", "\n", " "], // Recursive-specific option
131
+ language: "markdown", // Recursive-specific option
132
+ maxSize: 500, // general option
133
+ });
134
+
135
+ // Sentence strategy example
136
+ const chunks = await doc.chunk({
137
+ strategy: "sentence",
138
+ maxSize: 450, // Required for sentence strategy
139
+ minSize: 50, // Sentence-specific option
140
+ sentenceEnders: ["."], // Sentence-specific option
141
+ fallbackToCharacters: false, // Sentence-specific option
142
+ keepSeparator: true, // general option
143
+ });
144
+
105
145
  // HTML strategy example
106
146
  const chunks = await doc.chunk({
107
147
  strategy: "html",
@@ -109,8 +149,6 @@ const chunks = await doc.chunk({
109
149
  ["h1", "title"],
110
150
  ["h2", "subtitle"],
111
151
  ], // HTML-specific option
112
- sections: [["div.content", "main"]], // HTML-specific option
113
- size: 500, // general option
114
152
  });
115
153
 
116
154
  // Markdown strategy example
@@ -121,7 +159,6 @@ const chunks = await doc.chunk({
121
159
  ["##", "section"],
122
160
  ], // Markdown-specific option
123
161
  stripHeaders: true, // Markdown-specific option
124
- overlap: 50, // general option
125
162
  });
126
163
 
127
164
  // Token strategy example
@@ -129,12 +166,105 @@ const chunks = await doc.chunk({
129
166
  strategy: "token",
130
167
  encodingName: "gpt2", // Token-specific option
131
168
  modelName: "gpt-3.5-turbo", // Token-specific option
132
- size: 1000, // general option
169
+ maxSize: 1000, // general option
133
170
  });
134
171
  ```
135
172
 
136
173
  The options documented below are passed directly at the top level of the configuration object, not nested within a separate options object.
137
174
 
175
+ ### Character
176
+
177
+ <PropertiesTable
178
+ content={[
179
+ {
180
+ name: "separator",
181
+ type: "string",
182
+ isOptional: true,
183
+ defaultValue: "\\n\\n",
184
+ description: "Character(s) to split on. Defaults to double newline for text content.",
185
+ },
186
+ {
187
+ name: "isSeparatorRegex",
188
+ type: "boolean",
189
+ isOptional: true,
190
+ defaultValue: "false",
191
+ description: "Whether the separator is a regex pattern",
192
+ },
193
+ ]}
194
+ />
195
+
196
+ ### Recursive
197
+
198
+ <PropertiesTable
199
+ content={[
200
+ {
201
+ name: "separators",
202
+ type: "string[]",
203
+ isOptional: true,
204
+ description: "Array of separators to try in order of preference. The strategy will attempt to split on the first separator, then fall back to subsequent ones.",
205
+ },
206
+ {
207
+ name: "isSeparatorRegex",
208
+ type: "boolean",
209
+ isOptional: true,
210
+ defaultValue: "false",
211
+ description: "Whether the separators are regex patterns",
212
+ },
213
+ {
214
+ name: "language",
215
+ type: "Language",
216
+ isOptional: true,
217
+ description: "Programming or markup language for language-specific splitting behavior. See Language enum for supported values.",
218
+ },
219
+ ]}
220
+ />
221
+
222
+ ### Sentence
223
+
224
+ <PropertiesTable
225
+ content={[
226
+ {
227
+ name: "maxSize",
228
+ type: "number",
229
+ description: "Maximum size of each chunk (required for sentence strategy)",
230
+ },
231
+ {
232
+ name: "minSize",
233
+ type: "number",
234
+ isOptional: true,
235
+ defaultValue: "50",
236
+ description: "Minimum size of each chunk. Chunks smaller than this will be merged with adjacent chunks when possible.",
237
+ },
238
+ {
239
+ name: "targetSize",
240
+ type: "number",
241
+ isOptional: true,
242
+ description: "Preferred target size for chunks. Defaults to 80% of maxSize. The strategy will try to create chunks close to this size.",
243
+ },
244
+ {
245
+ name: "sentenceEnders",
246
+ type: "string[]",
247
+ isOptional: true,
248
+ defaultValue: "['.', '!', '?']",
249
+ description: "Array of characters that mark sentence endings for splitting boundaries.",
250
+ },
251
+ {
252
+ name: "fallbackToWords",
253
+ type: "boolean",
254
+ isOptional: true,
255
+ defaultValue: "true",
256
+ description: "Whether to fall back to word-level splitting for sentences that exceed maxSize.",
257
+ },
258
+ {
259
+ name: "fallbackToCharacters",
260
+ type: "boolean",
261
+ isOptional: true,
262
+ defaultValue: "true",
263
+ description: "Whether to fall back to character-level splitting for words that exceed maxSize. Only applies if fallbackToWords is enabled.",
264
+ },
265
+ ]}
266
+ />
267
+
138
268
  ### HTML
139
269
 
140
270
  <PropertiesTable
@@ -160,6 +290,8 @@ The options documented below are passed directly at the top level of the configu
160
290
  ]}
161
291
  />
162
292
 
293
+ **Important:** When using the HTML strategy, all general options are ignored. Use `headers` for header-based splitting or `sections` for section-based splitting. If used together, `sections` will be ignored.
294
+
163
295
  ### Markdown
164
296
 
165
297
  <PropertiesTable
@@ -167,6 +299,7 @@ The options documented below are passed directly at the top level of the configu
167
299
  {
168
300
  name: "headers",
169
301
  type: "Array<[string, string]>",
302
+ isOptional: true,
170
303
  description: "Array of [header level, metadata key] pairs",
171
304
  },
172
305
  {
@@ -184,6 +317,8 @@ The options documented below are passed directly at the top level of the configu
184
317
  ]}
185
318
  />
186
319
 
320
+ **Important:** When using the `headers` option, the markdown strategy ignores all general options and content is split based on the markdown header structure. To use size-based chunking with markdown, omit the `headers` parameter.
321
+
187
322
  ### Token
188
323
 
189
324
  <PropertiesTable
@@ -200,6 +335,18 @@ The options documented below are passed directly at the top level of the configu
200
335
  isOptional: true,
201
336
  description: "Name of the model for tokenization",
202
337
  },
338
+ {
339
+ name: "allowedSpecial",
340
+ type: "Set<string> | 'all'",
341
+ isOptional: true,
342
+ description: "Set of special tokens allowed during tokenization, or 'all' to allow all special tokens",
343
+ },
344
+ {
345
+ name: "disallowedSpecial",
346
+ type: "Set<string> | 'all'",
347
+ isOptional: true,
348
+ description: "Set of special tokens to disallow during tokenization, or 'all' to disallow all special tokens",
349
+ },
203
350
  ]}
204
351
  />
205
352
 
@@ -233,6 +380,10 @@ The options documented below are passed directly at the top level of the configu
233
380
  ]}
234
381
  />
235
382
 
383
+ ### Latex
384
+
385
+ The Latex strategy uses only the general chunking options listed above. It provides LaTeX-aware splitting optimized for mathematical and academic documents.
386
+
236
387
  ## Return Value
237
388
 
238
389
  Returns a `MDocument` instance containing the chunked documents. Each chunk includes:
@@ -258,6 +258,31 @@ export const cityCoordinatesTool = createTool({
258
258
  });
259
259
  ```
260
260
 
261
+ ## Using workflows in agents
262
+
263
+ You can also use Workflows in Agents. This agent is able to choose between using the test tool or the test workflow.
264
+
265
+ ```typescript
266
+ import { openai } from "@ai-sdk/openai";
267
+ import { Agent } from "@mastra/core/agent";
268
+ import { testTool } from "../tools/test-tool";
269
+ import { testWorkflow } from "../workflows/test-workflow";
270
+
271
+ export const testAgent = new Agent({
272
+ name: "test-agent",
273
+ description: "Create facts for a country based on the city",
274
+ instructions: `Return an interesting fact about the country based on the city provided`,
275
+ model: openai("gpt-4o"),
276
+ workflows: {
277
+ test_workflow: testWorkflow
278
+ },
279
+ tools: {
280
+ test_tool: testTool
281
+ },
282
+ });
283
+ ```
284
+
285
+
261
286
  ## Exposing workflows with `MCPServer`
262
287
 
263
288
  You can convert your workflows into tools by passing them into an instance of a Mastra `MCPServer`. This allows any MCP-compatible client to access your workflow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.9-alpha.0",
3
+ "version": "0.13.9-alpha.2",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,8 +32,8 @@
32
32
  "uuid": "^11.1.0",
33
33
  "zod": "^3.25.67",
34
34
  "zod-to-json-schema": "^3.24.5",
35
- "@mastra/mcp": "^0.10.9",
36
- "@mastra/core": "0.12.2-alpha.0"
35
+ "@mastra/core": "0.13.0-alpha.2",
36
+ "@mastra/mcp": "^0.10.10-alpha.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@hono/node-server": "^1.17.1",
@@ -43,13 +43,13 @@
43
43
  "@wong2/mcp-cli": "^1.10.0",
44
44
  "cross-env": "^7.0.3",
45
45
  "eslint": "^9.30.1",
46
- "hono": "^4.8.9",
46
+ "hono": "^4.8.11",
47
47
  "tsup": "^8.5.0",
48
48
  "tsx": "^4.19.4",
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4",
51
- "@internal/lint": "0.0.26",
52
- "@mastra/core": "0.12.2-alpha.0"
51
+ "@mastra/core": "0.13.0-alpha.2",
52
+ "@internal/lint": "0.0.26"
53
53
  },
54
54
  "scripts": {
55
55
  "prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",