@mastra/mcp-docs-server 0.13.11-alpha.0 → 0.13.11-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.
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +15 -12
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +23 -23
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +34 -34
- package/.docs/organized/code-examples/a2a.md +52 -19
- package/.docs/organized/code-examples/weather-agent.md +14 -0
- package/.docs/raw/auth/jwt.mdx +3 -1
- package/.docs/raw/evals/overview.mdx +8 -0
- package/.docs/raw/getting-started/installation.mdx +45 -7
- package/.docs/raw/getting-started/mcp-docs-server.mdx +3 -3
- package/.docs/raw/memory/overview.mdx +11 -5
- package/.docs/raw/reference/agents/agent.mdx +6 -2
- package/.docs/raw/reference/agents/generate.mdx +48 -40
- package/.docs/raw/reference/agents/getAgent.mdx +10 -5
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +22 -17
- package/.docs/raw/reference/agents/getDescription.mdx +9 -5
- package/.docs/raw/reference/agents/getInstructions.mdx +22 -17
- package/.docs/raw/reference/agents/getLLM.mdx +23 -18
- package/.docs/raw/reference/agents/getMemory.mdx +22 -17
- package/.docs/raw/reference/agents/getModel.mdx +22 -17
- package/.docs/raw/reference/agents/getScorers.mdx +22 -17
- package/.docs/raw/reference/agents/getTools.mdx +22 -17
- package/.docs/raw/reference/agents/getVoice.mdx +22 -17
- package/.docs/raw/reference/agents/getWorkflows.mdx +22 -17
- package/.docs/raw/reference/agents/stream.mdx +24 -19
- package/.docs/raw/reference/agents/streamVNext.mdx +18 -19
- package/.docs/raw/reference/cli/build.mdx +1 -0
- package/.docs/raw/reference/storage/upstash.mdx +5 -0
- package/.docs/raw/reference/tools/create-tool.mdx +22 -29
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +2 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +3 -3
- package/.docs/raw/reference/workflows/branch.mdx +6 -6
- package/.docs/raw/reference/workflows/commit.mdx +5 -5
- package/.docs/raw/reference/workflows/create-run.mdx +28 -29
- package/.docs/raw/reference/workflows/dountil.mdx +5 -5
- package/.docs/raw/reference/workflows/dowhile.mdx +5 -5
- package/.docs/raw/reference/workflows/execute.mdx +83 -91
- package/.docs/raw/reference/workflows/foreach.mdx +5 -5
- package/.docs/raw/reference/workflows/map.mdx +8 -93
- package/.docs/raw/reference/workflows/parallel.mdx +5 -5
- package/.docs/raw/reference/workflows/resume.mdx +45 -47
- package/.docs/raw/reference/workflows/sendEvent.mdx +5 -5
- package/.docs/raw/reference/workflows/sleep.mdx +5 -5
- package/.docs/raw/reference/workflows/sleepUntil.mdx +16 -8
- package/.docs/raw/reference/workflows/start.mdx +42 -27
- package/.docs/raw/reference/workflows/step.mdx +15 -29
- package/.docs/raw/reference/workflows/stream.mdx +55 -205
- package/.docs/raw/reference/workflows/streamVNext.mdx +55 -174
- package/.docs/raw/reference/workflows/then.mdx +5 -5
- package/.docs/raw/reference/workflows/waitForEvent.mdx +5 -5
- package/.docs/raw/reference/workflows/watch.mdx +31 -13
- package/.docs/raw/reference/workflows/workflow.mdx +27 -100
- package/.docs/raw/scorers/overview.mdx +8 -0
- package/.docs/raw/server-db/local-dev-playground.mdx +16 -1
- package/dist/tools/__tests__/test-setup.d.ts +1 -1
- package/dist/tools/__tests__/test-setup.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,215 +1,96 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the
|
|
2
|
+
title: "Reference: WorkflowRun.streamVNext() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `WorkflowRun.streamVNext()` method in workflows, which enables real-time streaming of responses.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# WorkflowRun.streamVNext()
|
|
7
7
|
|
|
8
|
-
The
|
|
8
|
+
The `.streamVNext()` method enables real-time streaming of responses from a workflow.
|
|
9
9
|
|
|
10
|
-
## Usage
|
|
10
|
+
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
const run = await
|
|
14
|
-
|
|
15
|
-
// Add a stream to monitor execution
|
|
16
|
-
const stream = run.streamVNext({ inputData: {...} });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (const chunk of stream) {
|
|
20
|
-
// do something with the chunk
|
|
21
|
-
}
|
|
12
|
+
```typescript showLineNumbers copy
|
|
13
|
+
const run = await workflow.createRunAsync();
|
|
22
14
|
|
|
15
|
+
const stream = run.streamVNext({
|
|
16
|
+
inputData: {
|
|
17
|
+
value: "initial data",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
##
|
|
22
|
+
## Parameters
|
|
26
23
|
|
|
27
24
|
<PropertiesTable
|
|
28
25
|
content={[
|
|
29
26
|
{
|
|
30
|
-
name: "
|
|
31
|
-
type: "
|
|
32
|
-
description: "
|
|
33
|
-
isOptional:
|
|
34
|
-
properties: [
|
|
35
|
-
{
|
|
36
|
-
type: "object",
|
|
37
|
-
parameters: [
|
|
38
|
-
{
|
|
39
|
-
name: "example",
|
|
40
|
-
type: "{ type: 'start', runId: '1', from: 'WORKFLOW', payload: { runId: '1' } }",
|
|
41
|
-
description: "Example message structure",
|
|
42
|
-
isOptional: false,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "step-start",
|
|
50
|
-
type: "object",
|
|
51
|
-
description: "The start of a step",
|
|
52
|
-
isOptional: false,
|
|
53
|
-
properties: [
|
|
54
|
-
{
|
|
55
|
-
type: "object",
|
|
56
|
-
parameters: [
|
|
57
|
-
{
|
|
58
|
-
name: "example",
|
|
59
|
-
type: "{ type: 'step-start', runId: '1', from: 'WORKFLOW', payload: { id: 'fetch-weather' } }",
|
|
60
|
-
description: "Example message structure",
|
|
61
|
-
isOptional: false,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "step-output",
|
|
69
|
-
type: "object",
|
|
70
|
-
description: "Custom output from a step",
|
|
71
|
-
isOptional: false,
|
|
72
|
-
properties: [
|
|
73
|
-
{
|
|
74
|
-
type: "object",
|
|
75
|
-
parameters: [
|
|
76
|
-
{
|
|
77
|
-
name: "example",
|
|
78
|
-
type: "{ type: 'step-output', runId: '1', from: 'WORKFLOW', payload: { stepName: 'my step', args: { ... }, stepCallId: 'uuid', startedAt: 1717000000000, status: 'running' } }",
|
|
79
|
-
description: "Example message structure",
|
|
80
|
-
isOptional: false,
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "step-result",
|
|
88
|
-
type: "object",
|
|
89
|
-
description: "The result of a step",
|
|
90
|
-
isOptional: false,
|
|
91
|
-
properties: [
|
|
92
|
-
{
|
|
93
|
-
type: "object",
|
|
94
|
-
parameters: [
|
|
95
|
-
{
|
|
96
|
-
name: "example",
|
|
97
|
-
type: "{ type: 'step-result', runId: '1', from: 'WORKFLOW', payload: { stepName: 'my step', result: { ... }, stepCallId: 'uuid', endedAt: 1717000000000, status: 'success', output: [Object] } }",
|
|
98
|
-
description: "Example message structure",
|
|
99
|
-
isOptional: false,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
],
|
|
27
|
+
name: "inputData",
|
|
28
|
+
type: "z.infer<TInput>",
|
|
29
|
+
description: "Input data that matches the workflow's input schema",
|
|
30
|
+
isOptional: true,
|
|
104
31
|
},
|
|
105
32
|
{
|
|
106
|
-
name: "
|
|
107
|
-
type: "
|
|
108
|
-
description: "
|
|
109
|
-
isOptional:
|
|
110
|
-
properties: [
|
|
111
|
-
{
|
|
112
|
-
type: "object",
|
|
113
|
-
parameters: [
|
|
114
|
-
{
|
|
115
|
-
name: "example",
|
|
116
|
-
type: "{ type: 'finish', runId: '1', from: 'WORKFLOW', payload: { totalUsage: { promptTokens: 100, completionTokens: 100, totalTokens: 200 } } }",
|
|
117
|
-
description: "Example message structure",
|
|
118
|
-
isOptional: false,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
],
|
|
33
|
+
name: "runtimeContext",
|
|
34
|
+
type: "RuntimeContext",
|
|
35
|
+
description: "Runtime context data to use during workflow execution",
|
|
36
|
+
isOptional: true,
|
|
123
37
|
},
|
|
124
38
|
]}
|
|
125
39
|
/>
|
|
126
40
|
|
|
127
41
|
## Returns
|
|
128
42
|
|
|
129
|
-
### PropertiesTable for Return Values
|
|
130
|
-
|
|
131
43
|
<PropertiesTable
|
|
132
44
|
content={[
|
|
133
45
|
{
|
|
134
|
-
name: "
|
|
135
|
-
type: "
|
|
136
|
-
|
|
137
|
-
description:
|
|
138
|
-
"Total usage of the workflow, including sub agents/workflows as a step.",
|
|
139
|
-
properties: [
|
|
140
|
-
{
|
|
141
|
-
type: "number",
|
|
142
|
-
parameters: [
|
|
143
|
-
{
|
|
144
|
-
name: "promptTokens",
|
|
145
|
-
type: "number",
|
|
146
|
-
isOptional: true,
|
|
147
|
-
description: "The number of prompt tokens used by the agent.",
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
type: "number",
|
|
153
|
-
parameters: [
|
|
154
|
-
{
|
|
155
|
-
name: "completionTokens",
|
|
156
|
-
type: "number",
|
|
157
|
-
isOptional: true,
|
|
158
|
-
description: "The number of completion tokens used by the agent.",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
type: "number",
|
|
164
|
-
parameters: [
|
|
165
|
-
{
|
|
166
|
-
name: "totalTokens",
|
|
167
|
-
type: "number",
|
|
168
|
-
isOptional: true,
|
|
169
|
-
description: "The total number of tokens used by the agent.",
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
],
|
|
46
|
+
name: "stream",
|
|
47
|
+
type: "MastraWorkflowStream<ChunkType>",
|
|
48
|
+
description: "A custom stream that extends ReadableStream<ChunkType> with additional workflow-specific properties",
|
|
174
49
|
},
|
|
175
50
|
{
|
|
176
|
-
name: "status",
|
|
177
|
-
type: "Promise<
|
|
178
|
-
|
|
179
|
-
description:
|
|
180
|
-
"The status of the workflow run.",
|
|
51
|
+
name: "stream.status",
|
|
52
|
+
type: "Promise<WorkflowRunStatus>",
|
|
53
|
+
description: "A promise that resolves to the current workflow run status",
|
|
181
54
|
},
|
|
182
55
|
{
|
|
183
|
-
name: "result",
|
|
184
|
-
type: "Promise<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
56
|
+
name: "stream.result",
|
|
57
|
+
type: "Promise<WorkflowResult<TOutput, TSteps>>",
|
|
58
|
+
description: "A promise that resolves to the final workflow result",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "stream.usage",
|
|
62
|
+
type: "Promise<{ promptTokens: number; completionTokens: number; totalTokens: number }>",
|
|
63
|
+
description: "A promise that resolves to token usage statistics",
|
|
188
64
|
},
|
|
189
65
|
]}
|
|
190
66
|
/>
|
|
191
67
|
|
|
192
|
-
##
|
|
68
|
+
## Extended usage example
|
|
193
69
|
|
|
194
|
-
|
|
70
|
+
```typescript showLineNumbers copy
|
|
71
|
+
const run = await workflow.createRunAsync();
|
|
195
72
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
73
|
+
const stream = run.streamVNext({
|
|
74
|
+
inputData: {
|
|
75
|
+
value: "initial data",
|
|
76
|
+
},
|
|
77
|
+
});
|
|
199
78
|
|
|
200
|
-
|
|
201
|
-
process.stdout.write(chunk);
|
|
202
|
-
}
|
|
79
|
+
const result = await stream.result;
|
|
203
80
|
```
|
|
204
81
|
|
|
205
|
-
|
|
82
|
+
## Stream Events
|
|
83
|
+
|
|
84
|
+
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
85
|
+
|
|
86
|
+
- **`start`**: Workflow execution begins
|
|
87
|
+
- **`step-start`**: A step begins execution
|
|
88
|
+
- **`step-output`**: Custom output from a step
|
|
89
|
+
- **`step-result`**: A step completes with results
|
|
90
|
+
- **`finish`**: Workflow execution completes with usage statistics
|
|
91
|
+
|
|
92
|
+
|
|
206
93
|
|
|
207
|
-
```typescript
|
|
208
|
-
const run = await myWorkflow.createRunAsync();
|
|
209
|
-
const stream = run.streamVNext({ inputData: {...} });
|
|
210
94
|
|
|
211
95
|
|
|
212
|
-
const result = await stream.result;
|
|
213
|
-
console.log("Final structured result:", result);
|
|
214
|
-
```
|
|
215
96
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Workflow.then() |
|
|
3
|
-
description: Documentation for the
|
|
2
|
+
title: "Reference: Workflow.then() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Workflow.then()` method in workflows, which creates sequential dependencies between steps.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Workflow.then()
|
|
7
7
|
|
|
8
8
|
The `.then()` method creates a sequential dependency between workflow steps, ensuring steps execute in a specific order.
|
|
9
9
|
|
|
10
|
-
## Usage
|
|
10
|
+
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
workflow.then(
|
|
12
|
+
```typescript copy
|
|
13
|
+
workflow.then(step1).then(step2);
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Workflow.waitForEvent() |
|
|
3
|
-
description: Documentation for the
|
|
2
|
+
title: "Reference: Workflow.waitForEvent() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Workflow.waitForEvent()` method in workflows, which pauses execution until an event is received.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Workflow.waitForEvent()
|
|
7
7
|
|
|
8
8
|
The `.waitForEvent()` method pauses execution until an event is received.
|
|
9
9
|
|
|
10
|
-
## Usage
|
|
10
|
+
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
workflow.waitForEvent('
|
|
12
|
+
```typescript copy
|
|
13
|
+
workflow.waitForEvent('event-name', step1);
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Parameters
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference:
|
|
3
|
-
description: Documentation for the
|
|
2
|
+
title: "Reference: WorkflowRun.watch() | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `WorkflowRun.watch()` method in workflows, which allows you to monitor the execution of a workflow run.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# WorkflowRun.watch()
|
|
7
7
|
|
|
8
8
|
The `.watch()` 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
|
|
12
|
+
```typescript showLineNumbers copy
|
|
13
|
+
const run = await workflow.createRunAsync();
|
|
14
14
|
|
|
15
|
-
// Add a watcher to monitor execution
|
|
16
15
|
run.watch(event => {
|
|
17
|
-
console.log('Step completed:', event
|
|
16
|
+
console.log('Step completed:', event?.payload?.currentStep?.id);
|
|
18
17
|
});
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
const result = await run.start({ inputData: {...} });
|
|
19
|
+
const result = await run.start({ inputData: { value: "initial data" } });
|
|
22
20
|
```
|
|
23
21
|
|
|
24
22
|
## Parameters
|
|
@@ -26,15 +24,22 @@ const result = await run.start({ inputData: {...} });
|
|
|
26
24
|
<PropertiesTable
|
|
27
25
|
content={[
|
|
28
26
|
{
|
|
29
|
-
name: "
|
|
27
|
+
name: "callback",
|
|
30
28
|
type: "(event: WatchEvent) => void",
|
|
31
|
-
description:
|
|
32
|
-
"A callback function that is called whenever a step is completed or the workflow state changes",
|
|
29
|
+
description: "A callback function that is called whenever a step is completed or the workflow state changes. The event parameter contains: type ('watch'), payload (currentStep and workflowState), and eventTimestamp",
|
|
33
30
|
isOptional: false,
|
|
34
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: "type",
|
|
34
|
+
type: "'watch' | 'watch-v2'",
|
|
35
|
+
description: "The type of watch events to listen for. 'watch' for step completion events, 'watch-v2' for data stream events",
|
|
36
|
+
isOptional: true,
|
|
37
|
+
defaultValue: "'watch'",
|
|
38
|
+
},
|
|
35
39
|
]}
|
|
36
40
|
/>
|
|
37
41
|
|
|
42
|
+
|
|
38
43
|
## Returns
|
|
39
44
|
|
|
40
45
|
<PropertiesTable
|
|
@@ -48,6 +53,19 @@ const result = await run.start({ inputData: {...} });
|
|
|
48
53
|
]}
|
|
49
54
|
/>
|
|
50
55
|
|
|
56
|
+
## Extended usage example
|
|
57
|
+
|
|
58
|
+
```typescript showLineNumbers copy
|
|
59
|
+
const run = await workflow.createRunAsync();
|
|
60
|
+
|
|
61
|
+
run.watch((event) => {
|
|
62
|
+
console.log("Step completed:", event?.payload?.currentStep?.id);
|
|
63
|
+
}, 'watch');
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
const result = await run.start({ inputData: { value: "initial data" } });
|
|
67
|
+
```
|
|
68
|
+
|
|
51
69
|
## Related
|
|
52
70
|
|
|
53
71
|
- [Suspend and resume](../../docs/workflows/suspend-and-resume.mdx)
|
|
@@ -1,42 +1,30 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Workflow Class |
|
|
3
|
-
description: Documentation for the Workflow class in Mastra, which enables you to create state machines for complex sequences of operations with conditional branching and data validation.
|
|
2
|
+
title: "Reference: Workflow Class | Workflows | Mastra Docs"
|
|
3
|
+
description: Documentation for the `Workflow` class in Mastra, which enables you to create state machines for complex sequences of operations with conditional branching and data validation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Workflow Class
|
|
7
7
|
|
|
8
|
-
The Workflow class enables you to create state machines for complex sequences of operations with conditional branching and data validation.
|
|
8
|
+
The `Workflow` class enables you to create state machines for complex sequences of operations with conditional branching and data validation.
|
|
9
9
|
|
|
10
|
-
## Usage
|
|
10
|
+
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
```typescript filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
13
|
+
import { createWorkflow } from "@mastra/core/workflows";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
|
|
16
|
+
const workflow = createWorkflow({
|
|
17
|
+
id: "test-workflow",
|
|
15
18
|
inputSchema: z.object({
|
|
16
|
-
|
|
19
|
+
value: z.string(),
|
|
17
20
|
}),
|
|
18
21
|
outputSchema: z.object({
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
steps: [step1, step2, step3], // Declare steps used in this workflow
|
|
22
|
+
value: z.string(),
|
|
23
|
+
})
|
|
22
24
|
})
|
|
23
|
-
.then(step1)
|
|
24
|
-
.then(step2)
|
|
25
|
-
.then(step3)
|
|
26
|
-
.commit();
|
|
27
|
-
|
|
28
|
-
const mastra = new Mastra({
|
|
29
|
-
workflows: {
|
|
30
|
-
myWorkflow,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const run = await mastra.getWorkflow("myWorkflow").createRunAsync();
|
|
35
25
|
```
|
|
36
26
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
### Constructor
|
|
27
|
+
## Constructor parameters
|
|
40
28
|
|
|
41
29
|
<PropertiesTable
|
|
42
30
|
content={[
|
|
@@ -54,64 +42,13 @@ const run = await mastra.getWorkflow("myWorkflow").createRunAsync();
|
|
|
54
42
|
name: "outputSchema",
|
|
55
43
|
type: "z.ZodType<any>",
|
|
56
44
|
description: "Zod schema defining the output structure for the workflow",
|
|
57
|
-
}
|
|
58
|
-
{
|
|
59
|
-
name: "steps",
|
|
60
|
-
type: "Step[]",
|
|
61
|
-
description: "Array of steps to include in the workflow",
|
|
62
|
-
},
|
|
45
|
+
}
|
|
63
46
|
]}
|
|
64
47
|
/>
|
|
65
48
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#### `then()`
|
|
69
|
-
|
|
70
|
-
Adds a step to the workflow sequentially. Returns the workflow instance for chaining.
|
|
71
|
-
|
|
72
|
-
#### `parallel()`
|
|
73
|
-
|
|
74
|
-
Executes multiple steps concurrently. Takes an array of steps and returns the workflow instance.
|
|
75
|
-
|
|
76
|
-
#### `branch()`
|
|
77
|
-
|
|
78
|
-
Creates conditional branching logic. Takes an array of tuples containing condition functions and steps to execute when conditions are met.
|
|
79
|
-
|
|
80
|
-
#### `dowhile()`
|
|
81
|
-
|
|
82
|
-
Creates a loop that executes a step repeatedly while a condition remains true. The condition is checked after each execution.
|
|
83
|
-
|
|
84
|
-
#### `dountil()`
|
|
85
|
-
|
|
86
|
-
Creates a loop that executes a step repeatedly until a condition becomes true. The condition is checked after each execution.
|
|
87
|
-
|
|
88
|
-
#### `foreach()`
|
|
49
|
+
## Workflow status
|
|
89
50
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
#### `map()`
|
|
93
|
-
|
|
94
|
-
Maps data between steps using either a mapping configuration object or a mapping function. Useful for transforming data between steps.
|
|
95
|
-
|
|
96
|
-
#### `commit()`
|
|
97
|
-
|
|
98
|
-
Validates and finalizes the workflow configuration. Must be called after adding all steps.
|
|
99
|
-
|
|
100
|
-
#### `createRun()`
|
|
101
|
-
|
|
102
|
-
Deprecated. Creates a new workflow run instance, allowing you to execute the workflow with specific input data. Accepts optional run ID.
|
|
103
|
-
|
|
104
|
-
#### `createRunAsync()`
|
|
105
|
-
|
|
106
|
-
Creates a new workflow run instance, allowing you to execute the workflow with specific input data. Accepts optional run ID. Stores a pending workflow run snapshot into storage.
|
|
107
|
-
|
|
108
|
-
#### `execute()`
|
|
109
|
-
|
|
110
|
-
Executes the workflow with provided input data. Handles workflow suspension, resumption and emits events during execution.
|
|
111
|
-
|
|
112
|
-
## Workflow Status
|
|
113
|
-
|
|
114
|
-
A workflow's status indicates its current execution state. The possible values are:
|
|
51
|
+
A workflow's `status` indicates its current execution state. The possible values are:
|
|
115
52
|
|
|
116
53
|
<PropertiesTable
|
|
117
54
|
content={[
|
|
@@ -136,28 +73,18 @@ A workflow's status indicates its current execution state. The possible values a
|
|
|
136
73
|
]}
|
|
137
74
|
/>
|
|
138
75
|
|
|
139
|
-
##
|
|
76
|
+
## Extended usage example
|
|
140
77
|
|
|
141
|
-
|
|
78
|
+
```typescript filename="src/test-run.ts" showLineNumbers copy
|
|
79
|
+
import { mastra } from "./mastra";
|
|
142
80
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
})
|
|
153
|
-
.then({
|
|
154
|
-
id: "processData",
|
|
155
|
-
execute: async ({ inputData }) => {
|
|
156
|
-
// Access data from previous step through context.steps
|
|
157
|
-
const previousData = inputData.data;
|
|
158
|
-
// Process previousData.id and previousData.value
|
|
159
|
-
},
|
|
160
|
-
});
|
|
81
|
+
const run = await mastra.getWorkflow("workflow").createRunAsync();
|
|
82
|
+
|
|
83
|
+
const result = await run.start({...});
|
|
84
|
+
|
|
85
|
+
if (result.status === "suspended") {
|
|
86
|
+
const resumedResult = await run.resume({...});
|
|
87
|
+
}
|
|
161
88
|
```
|
|
162
89
|
|
|
163
90
|
## Related
|
|
@@ -48,6 +48,14 @@ This modular structure enables both simple single-step evaluations and complex m
|
|
|
48
48
|
|
|
49
49
|
To learn how to create your own Scorers, see [Creating Custom Scorers](/docs/scorers/custom-scorers).
|
|
50
50
|
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
To access Mastra's scorers feature install the `@mastra/evals` package.
|
|
54
|
+
|
|
55
|
+
```bash copy
|
|
56
|
+
npm install @mastra/evals@latest
|
|
57
|
+
```
|
|
58
|
+
|
|
51
59
|
## Live evaluations
|
|
52
60
|
|
|
53
61
|
**Live evaluations** allow you to automatically score AI outputs in real-time as your agents and workflows operate. Instead of running evaluations manually or in batches, scorers run asynchronously alongside your AI systems, providing continuous quality monitoring.
|
|
@@ -13,12 +13,27 @@ Mastra provides a local development environment where you can test your agents,
|
|
|
13
13
|
|
|
14
14
|
Start the local development server by running:
|
|
15
15
|
|
|
16
|
-
<Tabs items={["npm", "Mastra CLI"]}>
|
|
16
|
+
<Tabs items={["npm", "yarn", "pnpm", "bun", "Mastra CLI"]}>
|
|
17
17
|
<Tab>
|
|
18
18
|
```bash copy
|
|
19
19
|
npm run dev
|
|
20
20
|
```
|
|
21
21
|
</Tab>
|
|
22
|
+
<Tab>
|
|
23
|
+
```bash copy
|
|
24
|
+
yarn run dev
|
|
25
|
+
```
|
|
26
|
+
</Tab>
|
|
27
|
+
<Tab>
|
|
28
|
+
```bash copy
|
|
29
|
+
pnpm run dev
|
|
30
|
+
```
|
|
31
|
+
</Tab>
|
|
32
|
+
<Tab>
|
|
33
|
+
```bash copy
|
|
34
|
+
bun run dev
|
|
35
|
+
```
|
|
36
|
+
</Tab>
|
|
22
37
|
<Tab>
|
|
23
38
|
```bash copy
|
|
24
39
|
mastra dev
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MCPClient } from '@mastra/mcp';
|
|
2
2
|
export declare const server: import("@hono/node-server").ServerType;
|
|
3
3
|
export declare const mcp: MCPClient;
|
|
4
|
-
export declare function callTool(tool: any, args: any): Promise<
|
|
4
|
+
export declare function callTool(tool: any, args: any): Promise<any>;
|
|
5
5
|
//# sourceMappingURL=test-setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/test-setup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuCxC,eAAO,MAAM,MAAM,wCAGjB,CAAC;AAKH,eAAO,MAAM,GAAG,WAWd,CAAC;AAEH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/test-setup.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuCxC,eAAO,MAAM,MAAM,wCAGjB,CAAC;AAKH,eAAO,MAAM,GAAG,WAWd,CAAC;AAEH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,gBA2BlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "0.13.11-alpha.
|
|
3
|
+
"version": "0.13.11-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/core": "0.13.2-alpha.
|
|
36
|
-
"@mastra/mcp": "^0.10.
|
|
35
|
+
"@mastra/core": "0.13.2-alpha.2",
|
|
36
|
+
"@mastra/mcp": "^0.10.11-alpha.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@hono/node-server": "^1.17.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
51
|
"@internal/lint": "0.0.28",
|
|
52
|
-
"@mastra/core": "0.13.2-alpha.
|
|
52
|
+
"@mastra/core": "0.13.2-alpha.2"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",
|