@mastra/mcp-docs-server 0.13.17-alpha.3 → 0.13.17-alpha.5

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 (112) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +25 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +19 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +10 -10
  6. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
  7. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +26 -26
  8. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
  10. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
  11. package/.docs/organized/changelogs/%40mastra%2Fcore.md +46 -46
  12. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +19 -0
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +25 -25
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +11 -11
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +12 -12
  17. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +33 -33
  18. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +11 -11
  19. package/.docs/organized/changelogs/%40mastra%2Fevals.md +19 -19
  20. package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
  21. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +20 -20
  22. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +19 -19
  23. package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
  24. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +10 -10
  25. package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
  26. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +27 -27
  27. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +20 -20
  28. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +19 -19
  29. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +10 -10
  30. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +24 -24
  31. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +11 -11
  32. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -5
  33. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  34. package/.docs/organized/changelogs/%40mastra%2Fpg.md +19 -19
  35. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  36. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +34 -34
  37. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +13 -13
  38. package/.docs/organized/changelogs/%40mastra%2Frag.md +10 -10
  39. package/.docs/organized/changelogs/%40mastra%2Fragie.md +19 -19
  40. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +13 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fserver.md +25 -25
  42. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +11 -11
  43. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
  44. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +10 -10
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +19 -0
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
  52. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
  53. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +19 -19
  54. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
  55. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
  56. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
  57. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
  58. package/.docs/organized/changelogs/create-mastra.md +13 -13
  59. package/.docs/organized/changelogs/mastra.md +31 -31
  60. package/.docs/organized/code-examples/a2a.md +1 -1
  61. package/.docs/organized/code-examples/agent-network.md +1 -1
  62. package/.docs/organized/code-examples/agent.md +22 -1
  63. package/.docs/organized/code-examples/agui.md +1 -1
  64. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
  65. package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
  66. package/.docs/organized/code-examples/assistant-ui.md +3 -3
  67. package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
  68. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
  69. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
  70. package/.docs/organized/code-examples/client-side-tools.md +1 -1
  71. package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
  72. package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
  73. package/.docs/organized/code-examples/fireworks-r1.md +1 -1
  74. package/.docs/organized/code-examples/heads-up-game.md +32 -56
  75. package/.docs/organized/code-examples/mcp-configuration.md +2 -2
  76. package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
  77. package/.docs/organized/code-examples/memory-with-mem0.md +1 -1
  78. package/.docs/organized/code-examples/memory-with-processors.md +1 -1
  79. package/.docs/organized/code-examples/openapi-spec-writer.md +2 -2
  80. package/.docs/organized/code-examples/quick-start.md +1 -1
  81. package/.docs/organized/code-examples/stock-price-tool.md +1 -1
  82. package/.docs/organized/code-examples/weather-agent.md +1 -1
  83. package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
  84. package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
  85. package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
  86. package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
  87. package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
  88. package/.docs/raw/agents/overview.mdx +35 -4
  89. package/.docs/raw/deployment/monorepo.mdx +1 -1
  90. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +44 -14
  91. package/.docs/raw/getting-started/installation.mdx +52 -4
  92. package/.docs/raw/getting-started/templates.mdx +2 -22
  93. package/.docs/raw/reference/agents/generate.mdx +2 -2
  94. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -1
  95. package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +1 -1
  96. package/.docs/raw/reference/agents/stream.mdx +2 -2
  97. package/.docs/raw/reference/cli/build.mdx +0 -6
  98. package/.docs/raw/reference/cli/start.mdx +8 -1
  99. package/.docs/raw/reference/scorers/noise-sensitivity.mdx +237 -0
  100. package/.docs/raw/reference/scorers/prompt-alignment.mdx +369 -0
  101. package/.docs/raw/scorers/off-the-shelf-scorers.mdx +2 -2
  102. package/.docs/raw/streaming/overview.mdx +2 -2
  103. package/.docs/raw/streaming/tool-streaming.mdx +8 -2
  104. package/.docs/raw/streaming/workflow-streaming.mdx +8 -2
  105. package/.docs/raw/tools-mcp/overview.mdx +44 -0
  106. package/.docs/raw/workflows/overview.mdx +19 -17
  107. package/.docs/raw/workflows/suspend-and-resume.mdx +64 -7
  108. package/CHANGELOG.md +1813 -0
  109. package/dist/stdio.js +18 -1
  110. package/dist/tools/blog.d.ts.map +1 -1
  111. package/dist/tools/docs.d.ts.map +1 -1
  112. package/package.json +17 -7
@@ -3,6 +3,8 @@ title: "Workflow Streaming | Streaming | Mastra"
3
3
  description: "Learn how to use workflow streaming in Mastra, including handling workflow execution events, step streaming, and workflow integration with agents and tools."
4
4
  ---
5
5
 
6
+ import { Callout } from "nextra/components";
7
+
6
8
  # Workflow streaming
7
9
 
8
10
  Workflow streaming in Mastra enables workflows to send incremental results while they execute, rather than waiting until completion. This allows you to surface partial progress, intermediate states, or progressive data directly to users or upstream agents and workflows.
@@ -18,6 +20,10 @@ By combining writable workflow streams with agent streaming, you gain fine-grain
18
20
 
19
21
  The `writer` argument is passed to a workflow step's `execute` function and can be used to emit custom events, data, or values into the active stream. This enables workflow steps to provide intermediate results or status updates while execution is still in progress.
20
22
 
23
+ <Callout type="warning">
24
+ You must `await` the call to `writer.write(...)` or else you will lock the stream and get a `WritableStream is locked` error.
25
+ </Callout>
26
+
21
27
  ```typescript {5,8,15} showLineNumbers copy
22
28
  import { createStep } from "@mastra/core/workflows";
23
29
 
@@ -26,14 +32,14 @@ export const testStep = createStep({
26
32
  execute: async ({ inputData, writer }) => {
27
33
  const { value } = inputData;
28
34
 
29
- writer?.write({
35
+ await writer?.write({
30
36
  type: "custom-event",
31
37
  status: "pending"
32
38
  });
33
39
 
34
40
  const response = await fetch(...);
35
41
 
36
- writer?.write({
42
+ await writer?.write({
37
43
  type: "custom-event",
38
44
  status: "success"
39
45
  });
@@ -3,6 +3,8 @@ title: "Tools Overview | Tools & MCP | Mastra Docs"
3
3
  description: Understand what tools are in Mastra, how to add them to agents, and best practices for designing effective tools.
4
4
  ---
5
5
 
6
+ import { Steps } from "nextra/components";
7
+
6
8
  # Tools Overview
7
9
 
8
10
  Tools are functions that agents can execute to perform specific tasks or access external information. They extend an agent's capabilities beyond simple text generation, allowing interaction with APIs, databases, or other systems.
@@ -65,3 +67,45 @@ Some providers that we include this layer for:
65
67
  - **DeepSeek & Meta:** Apply similar compatibility logic to ensure schema alignment and tool usability.
66
68
 
67
69
  This approach makes tool usage more reliable and model-agnostic for both custom and MCP tools.
70
+
71
+
72
+ ## Testing tools locally
73
+ There are two ways to run and test tools.
74
+
75
+ <Steps>
76
+
77
+ ### Mastra Playground
78
+
79
+ With the Mastra Dev Server running you can test a tool from the Mastra Playground by visiting [http://localhost:4111/tools](http://localhost:4111/tools) in your browser.
80
+
81
+ > For more information, see the [Local Dev Playground](/docs/server-db/local-dev-playground) documentation.
82
+
83
+ ### Command line
84
+
85
+ Invoke a tool using `.execute()`.
86
+
87
+ ```typescript filename="src/test-tool.ts" showLineNumbers copy
88
+ import { RuntimeContext } from "@mastra/core/runtime-context";
89
+ import { testTool } from "./mastra/tools/test-tool";
90
+
91
+ const runtimeContext = new RuntimeContext();
92
+
93
+ const result = await testTool.execute({
94
+ context: {
95
+ value: "foo"
96
+ },
97
+ runtimeContext
98
+ });
99
+
100
+ console.log(result);
101
+ ```
102
+
103
+ > See [createTool()](../../reference/tools/create-tool.mdx) for more information.
104
+
105
+ To test this tool, run the following:
106
+
107
+ ```bash copy
108
+ npx tsx src/test-tool.ts
109
+ ```
110
+
111
+ </Steps>
@@ -130,7 +130,7 @@ export const testWorkflow = createWorkflow({
130
130
  .commit();
131
131
  ```
132
132
 
133
- ### Register workflow
133
+ ## Register workflow
134
134
 
135
135
  Register a workflow using `workflows` in the main Mastra instance:
136
136
 
@@ -154,20 +154,24 @@ export const mastra = new Mastra({
154
154
  });
155
155
  ```
156
156
 
157
- ### Run workflow
157
+ ## Testing workflows locally
158
158
  There are two ways to run and test workflows.
159
159
 
160
160
  <Steps>
161
161
 
162
- #### Mastra Playground
162
+ ### Mastra Playground
163
163
 
164
164
  With the Mastra Dev Server running you can run the workflow from the Mastra Playground by visiting [http://localhost:4111/workflows](http://localhost:4111/workflows) in your browser.
165
165
 
166
- #### Command line
166
+ > For more information, see the [Local Dev Playground](/docs/server-db/local-dev-playground) documentation.
167
167
 
168
- Create a run instance of any Mastra workflow using `createRunAsync` and `start`:
168
+ ### Command line
169
+
170
+ Create a workflow run instance using `createRunAsync` and `start`:
169
171
 
170
172
  ```typescript {3,5} filename="src/test-workflow.ts" showLineNumbers copy
173
+ import "dotenv/config";
174
+
171
175
  import { mastra } from "./mastra";
172
176
 
173
177
  const run = await mastra.getWorkflow("testWorkflow").createRunAsync();
@@ -178,15 +182,13 @@ const result = await run.start({
178
182
  }
179
183
  });
180
184
 
181
- // Dump the complete workflow result (includes status, steps and result)
182
- console.log(JSON.stringify(result, null, 2));
185
+ console.log(result);
183
186
 
184
- // Get the workflow output value
185
187
  if (result.status === 'success') {
186
- console.log(`output value: ${result.result.output}`);
188
+ console.log(result.result.output);
187
189
  }
188
190
  ```
189
- > see [createRunAsync](/reference/workflows/create-run) and [start](/reference/workflows/run-methods/start) for more information.
191
+ > see [createRunAsync](../../reference/workflows/create-run.mdx) and [start](../../reference/workflows/run-methods/start.mdx) for more information.
190
192
 
191
193
  To trigger this workflow, run the following:
192
194
 
@@ -196,11 +198,11 @@ npx tsx src/test-workflow.ts
196
198
 
197
199
  </Steps>
198
200
 
199
- #### Run workflow results
201
+ ### Run workflow results
200
202
 
201
203
  The result of running a workflow using either `start()` or `resume()` will look like one of the following, depending on the outcome.
202
204
 
203
- ##### Status success
205
+ #### Status success
204
206
 
205
207
  ```json
206
208
  {
@@ -224,7 +226,7 @@ The result of running a workflow using either `start()` or `resume()` will look
224
226
  - **result**: Includes the final output of the workflow, typed according to the `outputSchema`
225
227
 
226
228
 
227
- ##### Status suspended
229
+ #### Status suspended
228
230
 
229
231
  ```json
230
232
  {
@@ -246,7 +248,7 @@ The result of running a workflow using either `start()` or `resume()` will look
246
248
 
247
249
  - **suspended**: An optional array listing any steps currently awaiting input before continuing
248
250
 
249
- ##### Status failed
251
+ #### Status failed
250
252
 
251
253
  ```json
252
254
  {
@@ -264,7 +266,7 @@ The result of running a workflow using either `start()` or `resume()` will look
264
266
  ```
265
267
  - **error**: An optional field that includes the error message if the workflow fails
266
268
 
267
- ### Stream workflow
269
+ ## Stream workflow
268
270
 
269
271
  Similar to the run method shown above, workflows can also be streamed:
270
272
 
@@ -286,7 +288,7 @@ for await (const chunk of result.stream) {
286
288
 
287
289
  > See [stream](/reference/workflows/run-methods/stream) and [messages](/reference/workflows/run-methods/stream#messages) for more information.
288
290
 
289
- ### Watch Workflow
291
+ ## Watch Workflow
290
292
 
291
293
  A workflow can also be watched, allowing you to inspect each event that is emitted.
292
294
 
@@ -308,7 +310,7 @@ const result = await run.start({
308
310
 
309
311
  > See [watch](/reference/workflows/run-methods/watch) for more information.
310
312
 
311
- ## More resources
313
+ ## Related
312
314
 
313
315
  - The [Workflow Guide](../../guides/guide/ai-recruiter.mdx) in the Guides section is a tutorial that covers the main concepts.
314
316
  - [Parallel Steps workflow example](../../examples/workflows/parallel-steps.mdx)
@@ -30,17 +30,15 @@ To pause execution at a specific step until user input is received, use the `⁠
30
30
 
31
31
  ![Suspending a workflow with suspend()](/image/workflows/workflows-suspend-resume-suspend.jpg)
32
32
 
33
- ```typescript {18} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
33
+ ```typescript {16} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
34
34
  const step1 = createStep({
35
35
  id: "step-1",
36
- description: "Test suspend",
37
36
  inputSchema: z.object({
38
37
  input: z.string()
39
38
  }),
40
39
  outputSchema: z.object({
41
40
  output: z.string()
42
41
  }),
43
- suspendSchema: z.object({}),
44
42
  resumeSchema: z.object({
45
43
  city: z.string()
46
44
  }),
@@ -48,15 +46,16 @@ const step1 = createStep({
48
46
  const { city } = resumeData ?? {};
49
47
 
50
48
  if (!city) {
51
- await suspend({});
52
- return { output: "" };
49
+ return await suspend({});
53
50
  }
54
51
 
55
52
  return { output: "" };
56
53
  }
57
54
  });
58
55
 
59
- export const testWorkflow = createWorkflow({})
56
+ export const testWorkflow = createWorkflow({
57
+ // ...
58
+ })
60
59
  .then(step1)
61
60
  .commit();
62
61
  ```
@@ -88,9 +87,10 @@ if (result.status === "suspended") {
88
87
  }
89
88
  });
90
89
  }
91
-
92
90
  ```
93
91
 
92
+ > See [Run Workflow Results](/docs/workflows/overview#run-workflow-results) for more details.
93
+
94
94
  In this case, the logic resumes the first step listed in the `suspended` array. A `step` can also be defined using it's `id`, for example: 'step-1'.
95
95
 
96
96
  ```json
@@ -111,6 +111,63 @@ In this case, the logic resumes the first step listed in the `suspended` array.
111
111
  }
112
112
  ```
113
113
 
114
+ ## Providing user feedback with suspend
115
+
116
+ When a workflow is suspended, feedback can be surfaced to the user through the `suspendSchema`. Include a reason in the `suspend` payload to explain why the workflow paused.
117
+
118
+ ```typescript {13,23} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
119
+ import { createWorkflow, createStep } from "@mastra/core/workflows";
120
+ import { z } from "zod";
121
+
122
+ const step1 = createStep({
123
+ id: "step-1",
124
+ inputSchema: z.object({
125
+ value: z.string()
126
+ }),
127
+ resumeSchema: z.object({
128
+ confirm: z.boolean()
129
+ }),
130
+ suspendSchema: z.object({
131
+ reason: z.string()
132
+ }),
133
+ outputSchema: z.object({
134
+ value: z.string()
135
+ }),
136
+ execute: async ({ resumeData, suspend }) => {
137
+ const { confirm } = resumeData ?? {};
138
+
139
+ if (!confirm) {
140
+ return await suspend({
141
+ reason: "Confirm to continue"
142
+ });
143
+ }
144
+
145
+ return { value: "" };
146
+ }
147
+ });
148
+
149
+ export const testWorkflow = createWorkflow({
150
+ // ...
151
+ })
152
+ .then(step1)
153
+ .commit();
154
+
155
+ ```
156
+
157
+ In this case, the reason provided explains that the user must confirm to continue.
158
+
159
+ ```json
160
+ {
161
+ "step-1": {
162
+ // ...
163
+ "status": "suspended",
164
+ "suspendPayload": {
165
+ "reason": "Confirm to continue"
166
+ },
167
+ }
168
+ }
169
+ ```
170
+
114
171
  > See [Run Workflow Results](/docs/workflows/overview#run-workflow-results) for more details.
115
172
 
116
173
  ## Resuming a workflow with `resume()`