@mastra/mcp-docs-server 0.13.11-alpha.1 → 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 +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +21 -21
- 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 +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
- 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 +15 -15
- package/.docs/organized/changelogs/create-mastra.md +11 -11
- package/.docs/organized/changelogs/mastra.md +24 -24
- 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/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 +5 -5
|
@@ -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/
|
|
36
|
-
"@mastra/
|
|
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",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"tsx": "^4.19.4",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@internal/lint": "0.0.28",
|
|
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",
|