@mastra/mcp-docs-server 0.13.11-alpha.1 → 0.13.11-alpha.3

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 (72) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +22 -22
  2. package/.docs/organized/changelogs/%40mastra%2Fcore.md +20 -20
  3. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +22 -22
  4. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +29 -29
  5. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +13 -13
  6. package/.docs/organized/changelogs/%40mastra%2Flance.md +15 -12
  7. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +21 -21
  8. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +20 -20
  9. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +13 -13
  10. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
  11. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +13 -13
  12. package/.docs/organized/changelogs/%40mastra%2Fpg.md +17 -17
  13. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +18 -18
  14. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +14 -14
  15. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  16. package/.docs/organized/changelogs/%40mastra%2Fserver.md +22 -22
  17. package/.docs/organized/changelogs/create-mastra.md +11 -11
  18. package/.docs/organized/changelogs/mastra.md +24 -24
  19. package/.docs/organized/code-examples/a2a.md +52 -19
  20. package/.docs/organized/code-examples/weather-agent.md +14 -0
  21. package/.docs/raw/auth/jwt.mdx +3 -1
  22. package/.docs/raw/evals/overview.mdx +8 -0
  23. package/.docs/raw/getting-started/installation.mdx +45 -7
  24. package/.docs/raw/getting-started/mcp-docs-server.mdx +3 -3
  25. package/.docs/raw/memory/overview.mdx +11 -5
  26. package/.docs/raw/reference/agents/agent.mdx +6 -2
  27. package/.docs/raw/reference/agents/generate.mdx +48 -40
  28. package/.docs/raw/reference/agents/getAgent.mdx +10 -5
  29. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +22 -17
  30. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -17
  31. package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +22 -17
  32. package/.docs/raw/reference/agents/getDescription.mdx +9 -5
  33. package/.docs/raw/reference/agents/getInstructions.mdx +22 -17
  34. package/.docs/raw/reference/agents/getLLM.mdx +23 -18
  35. package/.docs/raw/reference/agents/getMemory.mdx +22 -17
  36. package/.docs/raw/reference/agents/getModel.mdx +22 -17
  37. package/.docs/raw/reference/agents/getScorers.mdx +22 -17
  38. package/.docs/raw/reference/agents/getTools.mdx +22 -17
  39. package/.docs/raw/reference/agents/getVoice.mdx +22 -17
  40. package/.docs/raw/reference/agents/getWorkflows.mdx +22 -17
  41. package/.docs/raw/reference/agents/stream.mdx +24 -19
  42. package/.docs/raw/reference/agents/streamVNext.mdx +18 -19
  43. package/.docs/raw/reference/storage/upstash.mdx +5 -0
  44. package/.docs/raw/reference/tools/create-tool.mdx +22 -29
  45. package/.docs/raw/reference/tools/graph-rag-tool.mdx +2 -2
  46. package/.docs/raw/reference/tools/vector-query-tool.mdx +3 -3
  47. package/.docs/raw/reference/workflows/branch.mdx +6 -6
  48. package/.docs/raw/reference/workflows/commit.mdx +5 -5
  49. package/.docs/raw/reference/workflows/create-run.mdx +28 -29
  50. package/.docs/raw/reference/workflows/dountil.mdx +5 -5
  51. package/.docs/raw/reference/workflows/dowhile.mdx +5 -5
  52. package/.docs/raw/reference/workflows/execute.mdx +83 -91
  53. package/.docs/raw/reference/workflows/foreach.mdx +5 -5
  54. package/.docs/raw/reference/workflows/map.mdx +8 -93
  55. package/.docs/raw/reference/workflows/parallel.mdx +5 -5
  56. package/.docs/raw/reference/workflows/resume.mdx +45 -47
  57. package/.docs/raw/reference/workflows/sendEvent.mdx +5 -5
  58. package/.docs/raw/reference/workflows/sleep.mdx +5 -5
  59. package/.docs/raw/reference/workflows/sleepUntil.mdx +16 -8
  60. package/.docs/raw/reference/workflows/start.mdx +42 -27
  61. package/.docs/raw/reference/workflows/step.mdx +15 -29
  62. package/.docs/raw/reference/workflows/stream.mdx +55 -205
  63. package/.docs/raw/reference/workflows/streamVNext.mdx +55 -174
  64. package/.docs/raw/reference/workflows/then.mdx +5 -5
  65. package/.docs/raw/reference/workflows/waitForEvent.mdx +5 -5
  66. package/.docs/raw/reference/workflows/watch.mdx +31 -13
  67. package/.docs/raw/reference/workflows/workflow.mdx +27 -100
  68. package/.docs/raw/scorers/overview.mdx +8 -0
  69. package/.docs/raw/server-db/local-dev-playground.mdx +16 -1
  70. package/dist/tools/__tests__/test-setup.d.ts +1 -1
  71. package/dist/tools/__tests__/test-setup.d.ts.map +1 -1
  72. package/package.json +5 -5
@@ -1,21 +1,20 @@
1
1
  ---
2
- title: "Reference: Workflow.start() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.start()` method in workflows, which starts a workflow run with input data.
2
+ title: "Reference: WorkflowRun.start() | Workflows | Mastra Docs"
3
+ description: Documentation for the `WorkflowRun.start()` method in workflows, which starts a workflow run with input data.
4
4
  ---
5
5
 
6
- # Workflow.start()
6
+ # WorkflowRun.start()
7
7
 
8
8
  The `.start()` method starts a workflow run with input data, allowing you to execute the workflow from the beginning.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- const run = await myWorkflow.createRunAsync();
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRunAsync();
14
14
 
15
- // Start the workflow with input data
16
15
  const result = await run.start({
17
16
  inputData: {
18
- startValue: "initial data",
17
+ value: "initial data",
19
18
  },
20
19
  });
21
20
  ```
@@ -25,24 +24,22 @@ const result = await run.start({
25
24
  <PropertiesTable
26
25
  content={[
27
26
  {
28
- name: "params",
29
- type: "object",
30
- description: "Configuration object for starting the workflow run",
31
- isOptional: false,
32
- properties: [
33
- {
34
- name: "inputData",
35
- type: "z.infer<TInput>",
36
- description: "Input data matching the workflow's input schema",
37
- isOptional: true,
38
- },
39
- {
40
- name: "runtimeContext",
41
- type: "RuntimeContext",
42
- description: "Runtime context data to use when starting the workflow",
43
- isOptional: true,
44
- },
45
- ],
27
+ name: "inputData",
28
+ type: "z.infer<TInput>",
29
+ description: "Input data that matches the workflow's input schema",
30
+ isOptional: true,
31
+ },
32
+ {
33
+ name: "runtimeContext",
34
+ type: "RuntimeContext",
35
+ description: "Runtime context data to use during workflow execution",
36
+ isOptional: true,
37
+ },
38
+ {
39
+ name: "writableStream",
40
+ type: "WritableStream<ChunkType>",
41
+ description: "Optional writable stream for streaming workflow output",
42
+ isOptional: true,
46
43
  },
47
44
  ]}
48
45
  />
@@ -54,11 +51,29 @@ const result = await run.start({
54
51
  {
55
52
  name: "result",
56
53
  type: "Promise<WorkflowResult<TOutput, TSteps>>",
57
- description: "A promise that resolves to the result of the workflow run",
54
+ description: "A promise that resolves to the workflow execution result containing step outputs and status",
58
55
  },
59
56
  ]}
60
57
  />
61
58
 
59
+ ## Extended usage example
60
+
61
+ ```typescript showLineNumbers copy
62
+ import { RuntimeContext } from "@mastra/core/runtime-context";
63
+
64
+ const run = await workflow.createRunAsync();
65
+
66
+ const runtimeContext = new RuntimeContext();
67
+ runtimeContext.set("variable", false);
68
+
69
+ const result = await run.start({
70
+ inputData: {
71
+ value: "initial data"
72
+ },
73
+ runtimeContext
74
+ });
75
+ ```
76
+
62
77
  ## Related
63
78
 
64
79
  - [Running workflows](../../docs/workflows/overview.mdx#running-workflows)
@@ -1,48 +1,34 @@
1
1
  ---
2
- title: "Reference: Step | Building Workflows | Mastra Docs"
3
- description: Documentation for the Step class, which defines individual units of work within a workflow.
2
+ title: "Reference: Step Class | Workflows | Mastra Docs"
3
+ description: Documentation for the Step class in Mastra, which defines individual units of work within a workflow.
4
4
  ---
5
5
 
6
- # Step
6
+ # Step Class
7
7
 
8
8
  The Step class defines individual units of work within a workflow, encapsulating execution logic, data validation, and input/output handling.
9
9
  It can take either a tool or an agent as a parameter to automatically create a step from them.
10
10
 
11
- ## Usage
11
+ ## Usage example
12
12
 
13
- ```typescript
14
- import { createStep } from "@mastra/core/workflows";
13
+ ```typescript filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
14
+ import { createWorkflow, createStep } from "@mastra/core/workflows";
15
15
  import { z } from "zod";
16
16
 
17
- const processOrder = createStep({
18
- id: "processOrder",
17
+ const step1 = createStep({
18
+ id: "step-1",
19
+ description: "passes value from input to output",
19
20
  inputSchema: z.object({
20
- orderId: z.string(),
21
- userId: z.string(),
21
+ value: z.number()
22
22
  }),
23
23
  outputSchema: z.object({
24
- status: z.string(),
25
- orderId: z.string(),
24
+ value: z.number()
26
25
  }),
27
- resumeSchema: z.object({
28
- orderId: z.string(),
29
- }),
30
- suspendSchema: z.object({}),
31
- execute: async ({
32
- inputData,
33
- mastra,
34
- getStepResult,
35
- getInitData,
36
- suspend,
37
- runtimeContext,
38
- runCount
39
- runId,
40
- }) => {
26
+ execute: async ({ inputData }) => {
27
+ const { value } = inputData;
41
28
  return {
42
- status: "processed",
43
- orderId: inputData.orderId,
29
+ value
44
30
  };
45
- },
31
+ }
46
32
  });
47
33
  ```
48
34
 
@@ -1,234 +1,84 @@
1
1
  ---
2
- title: "Reference: Workflow.stream() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.stream()` method in workflows, which allows you to monitor the execution of a workflow run as a stream.
2
+ title: "Reference: WorkflowRun.stream() | Workflows | Mastra Docs"
3
+ description: Documentation for the `WorkflowRun.stream()` method in workflows, which allows you to monitor the execution of a workflow run as a stream.
4
4
  ---
5
5
 
6
- # Run.stream()
6
+ # WorkflowRun.stream()
7
7
 
8
8
  The `.stream()` method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- const run = await myWorkflow.createRunAsync();
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRunAsync();
14
14
 
15
- // Add a stream to monitor execution
16
- const result = run.stream({ inputData: {...} });
17
-
18
-
19
- for (const chunk of stream) {
20
- // do something with the chunk
21
- }
15
+ const stream = await run.stream({
16
+ inputData: {
17
+ value: "initial data",
18
+ },
19
+ });
22
20
  ```
23
21
 
24
- ## Messages
22
+ ## Parameters
25
23
 
26
24
  <PropertiesTable
27
25
  content={[
28
26
  {
29
- name: "start",
30
- type: "object",
31
- description: "The workflow starts",
32
- isOptional: false,
33
- properties: [
34
- {
35
- type: "object",
36
- parameters: [
37
- {
38
- name: "example",
39
- type: "{ type: 'start', payload: { runId: '1' } }",
40
- description: "Example message structure",
41
- isOptional: false,
42
- },
43
- ],
44
- },
45
- ],
46
- },
47
- {
48
- name: "step-start",
49
- type: "object",
50
- description: "The start of a step",
51
- isOptional: false,
52
- properties: [
53
- {
54
- type: "object",
55
- parameters: [
56
- {
57
- name: "example",
58
- type: "{ type: 'step-start', payload: { id: 'fetch-weather' } }",
59
- description: "Example message structure",
60
- isOptional: false,
61
- },
62
- ],
63
- },
64
- ],
65
- },
66
- {
67
- name: "tool-call",
68
- type: "object",
69
- description: "A tool call has started",
70
- isOptional: false,
71
- properties: [
72
- {
73
- type: "object",
74
- parameters: [
75
- {
76
- name: "example",
77
- type: "{ type: 'tool-call', toolCallId: 'weatherAgent', toolName: 'Weather Agent', args: { prompt: 'Based on the following weather forecast for New York, suggest appropriate activities:...' } }",
78
- description: "Example message structure",
79
- isOptional: false,
80
- },
81
- ],
82
- },
83
- ],
84
- },
85
- {
86
- name: "tool-call-streaming-start",
87
- type: "object",
88
- description: "A tool call/agent has started",
89
- isOptional: false,
90
- properties: [
91
- {
92
- type: "object",
93
- parameters: [
94
- {
95
- name: "example",
96
- type: "{ type: 'tool-call-streaming-start', toolCallId: 'weatherAgent', toolName: 'Weather Agent', args: { prompt: 'Based on the following weather forecast for New York, suggest appropriate activities:...' } }",
97
- description: "Example message structure",
98
- isOptional: false,
99
- },
100
- ],
101
- },
102
- ],
27
+ name: "inputData",
28
+ type: "z.infer<TInput>",
29
+ description: "Input data that matches the workflow's input schema",
30
+ isOptional: true,
103
31
  },
104
32
  {
105
- name: "tool-call-delta",
106
- type: "object",
107
- description: "The delta of the tool output",
108
- isOptional: false,
109
- properties: [
110
- {
111
- type: "object",
112
- parameters: [
113
- {
114
- name: "example",
115
- type: "{ type: 'tool-call-delta', toolCallId: 'weatherAgent', toolName: 'Weather Agent', args: { prompt: 'Based on the following weather forecast for New York, suggest appropriate activities:\\n' + ' [\\n' + ' {\\n' + ' \"date\": \"2025-05-16\",\\n' + ' \"maxTemp\": 22.2,\\n' + ' \"minTemp\": 16,\\n' + ' \"precipitationChance\": 5,\\n' + ' \"condition\": \"Dense drizzle\",\\n' + ' \"location\": \"New York\"\\n' + ' },\\n' + ' ' }, argsTextDelta: '📅' }",
116
- description: "Example message structure",
117
- isOptional: false,
118
- },
119
- ],
120
- },
121
- ],
122
- },
123
- {
124
- name: "step-result",
125
- type: "object",
126
- description: "The result of a step",
127
- isOptional: false,
128
- properties: [
129
- {
130
- type: "object",
131
- parameters: [
132
- {
133
- name: "example",
134
- type: "{ type: 'step-result', payload: { id: 'Weather Agent', status: 'success', output: [Object] } }",
135
- description: "Example message structure",
136
- isOptional: false,
137
- },
138
- ],
139
- },
140
- ],
141
- },
142
- {
143
- name: "step-finish",
144
- type: "object",
145
- description: "The end of a step",
146
- isOptional: false,
147
- properties: [
148
- {
149
- type: "object",
150
- parameters: [
151
- {
152
- name: "example",
153
- type: "{ type: 'step-finish', payload: { id: 'Weather Agent', metadata: {} } }",
154
- description: "Example message structure",
155
- isOptional: false,
156
- },
157
- ],
158
- },
159
- ],
160
- },
161
- {
162
- name: "finish",
163
- type: "object",
164
- description: "The end of the workflow",
165
- isOptional: false,
166
- properties: [
167
- {
168
- type: "object",
169
- parameters: [
170
- {
171
- name: "example",
172
- type: "{ type: 'finish', payload: { runId: '1' } }",
173
- description: "Example message structure",
174
- isOptional: false,
175
- },
176
- ],
177
- },
178
- ],
33
+ name: "runtimeContext",
34
+ type: "RuntimeContext",
35
+ description: "Runtime context data to use during workflow execution",
36
+ isOptional: true,
179
37
  },
180
38
  ]}
181
39
  />
182
40
 
183
- ## Parameters
41
+ ## Returns
184
42
 
185
43
  <PropertiesTable
186
44
  content={[
187
45
  {
188
- name: "params",
189
- type: "object",
190
- description: "Configuration object for starting the workflow run",
191
- isOptional: false,
192
- properties: [
193
- {
194
- name: "inputData",
195
- type: "z.infer<TInput>",
196
- parameters: [
197
- {
198
- name: "z.infer<TInput>",
199
- type: "inputData",
200
- description:
201
- "Runtime context data to use when starting the workflow",
202
- isOptional: true,
203
- },
204
- ],
205
- },
206
- {
207
- name: "runtimeContext",
208
- type: "RuntimeContext",
209
- parameters: [
210
- {
211
- name: "runtimeContext",
212
- type: "RuntimeContext",
213
- description:
214
- "Runtime context data to use when starting the workflow",
215
- isOptional: true,
216
- },
217
- ],
218
- },
219
- ],
46
+ name: "stream",
47
+ type: "ReadableStream<StreamEvent>",
48
+ description: "A readable stream that emits workflow execution events in real-time",
220
49
  },
221
- ]}
222
- />
223
-
224
- ## Returns
225
-
226
- <PropertiesTable
227
- content={[
228
50
  {
229
- name: "result",
230
- type: "Promise<WorkflowResult<TOutput, TSteps>>",
231
- description: "A stream that pipes each step to the stream",
51
+ name: "getWorkflowState",
52
+ type: "() => Promise<WorkflowResult<TOutput, TSteps>>",
53
+ description: "A function that returns a promise resolving to the final workflow result",
232
54
  },
233
55
  ]}
234
56
  />
57
+
58
+ ## Extended usage example
59
+
60
+ ```typescript showLineNumbers copy
61
+ const { getWorkflowState } = await run.stream({
62
+ inputData: {
63
+ value: "initial data"
64
+ }
65
+ });
66
+
67
+ const result = await getWorkflowState();
68
+ ```
69
+
70
+ ## Stream Events
71
+
72
+ The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
73
+
74
+ - **`start`**: Workflow execution begins
75
+ - **`step-start`**: A step begins execution
76
+ - **`tool-call`**: A tool call is initiated
77
+ - **`tool-call-streaming-start`**: Tool call streaming begins
78
+ - **`tool-call-delta`**: Incremental tool output updates
79
+ - **`step-result`**: A step completes with results
80
+ - **`step-finish`**: A step finishes execution
81
+ - **`finish`**: Workflow execution completes
82
+
83
+
84
+