@mastra/mcp-docs-server 0.13.46-alpha.0 → 0.13.46-alpha.1

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 (42) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +9 -9
  2. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +11 -11
  3. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +79 -79
  4. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +52 -52
  5. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +11 -11
  6. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +11 -11
  7. package/.docs/organized/changelogs/%40mastra%2Fcore.md +49 -49
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +15 -15
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +18 -18
  10. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +12 -12
  11. package/.docs/organized/changelogs/%40mastra%2Flance.md +11 -11
  12. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +11 -11
  13. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
  14. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +9 -9
  15. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +11 -11
  16. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +12 -12
  17. package/.docs/organized/changelogs/%40mastra%2Fpg.md +11 -11
  18. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +17 -17
  19. package/.docs/organized/changelogs/%40mastra%2Freact.md +8 -8
  20. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  21. package/.docs/organized/changelogs/%40mastra%2Fserver.md +54 -54
  22. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +12 -12
  23. package/.docs/organized/changelogs/create-mastra.md +11 -11
  24. package/.docs/organized/changelogs/mastra.md +18 -18
  25. package/.docs/raw/observability/otel-tracing.mdx +17 -2
  26. package/.docs/raw/observability/overview.mdx +12 -2
  27. package/.docs/raw/rag/vector-databases.mdx +58 -0
  28. package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
  29. package/.docs/raw/reference/workflows/run-methods/restart.mdx +98 -0
  30. package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
  31. package/.docs/raw/reference/workflows/run.mdx +21 -0
  32. package/.docs/raw/reference/workflows/step.mdx +7 -0
  33. package/.docs/raw/reference/workflows/workflow.mdx +19 -0
  34. package/.docs/raw/server-db/mastra-server.mdx +1 -1
  35. package/.docs/raw/workflows/error-handling.mdx +1 -0
  36. package/.docs/raw/workflows/overview.mdx +56 -44
  37. package/.docs/raw/workflows/snapshots.mdx +1 -0
  38. package/.docs/raw/workflows/suspend-and-resume.mdx +2 -0
  39. package/.docs/raw/workflows/time-travel.mdx +313 -0
  40. package/.docs/raw/workflows/workflow-state.mdx +191 -0
  41. package/CHANGELOG.md +7 -0
  42. package/package.json +4 -4
@@ -0,0 +1,191 @@
1
+ ---
2
+ title: "Workflow state | Workflows"
3
+ description: "Share values across workflow steps using global state that persists through the entire workflow run."
4
+ ---
5
+
6
+ # Workflow State
7
+
8
+ Workflow state lets you share values across steps without passing them through every step's inputSchema and outputSchema. This is useful for tracking progress, accumulating results, or sharing configuration across the entire workflow.
9
+
10
+ ## State vs step input/output
11
+
12
+ It's important to understand the difference between **state** and **step input/output**:
13
+
14
+ - **Step input/output**: Data flows sequentially between steps. Each step receives the previous step's output as its `inputData`, and returns an output for the next step.
15
+ - **State**: A shared store that all steps can read and update via `state` and `setState`. State persists across the entire workflow run, including suspend/resume cycles.
16
+
17
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
18
+ const step1 = createStep({
19
+ id: "step-1",
20
+ inputSchema: z.object({ workflowInput: z.string() }),
21
+ outputSchema: z.object({ step1Output: z.string() }),
22
+ stateSchema: z.object({ sharedCounter: z.number() }),
23
+ execute: async ({ inputData, state, setState }) => {
24
+ // inputData comes from workflow input or previous step's output
25
+ console.log(inputData.workflowInput);
26
+
27
+ // state is the shared workflow state
28
+ console.log(state.sharedCounter);
29
+
30
+ // Update state for subsequent steps
31
+ setState({ ...state, sharedCounter: state.sharedCounter + 1 });
32
+
33
+ // Return output that flows to next step's inputData
34
+ return { step1Output: "processed" };
35
+ },
36
+ });
37
+ ```
38
+
39
+ ## Defining state schemas
40
+
41
+ Define a `stateSchema` on both the workflow and individual steps. The workflow's stateSchema is the master schema containing all possible state values, while each step declares only the subset it needs:
42
+
43
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
44
+ const step1 = createStep({
45
+ // ...
46
+ stateSchema: z.object({
47
+ processedItems: z.array(z.string()),
48
+ }),
49
+ execute: async ({ inputData, state, setState }) => {
50
+ const { message } = inputData;
51
+ const { processedItems } = state;
52
+
53
+ setState({
54
+ ...state,
55
+ processedItems: [...processedItems, "item-1", "item-2"],
56
+ });
57
+
58
+ return {
59
+ formatted: message.toUpperCase(),
60
+ };
61
+ },
62
+ });
63
+
64
+ const step2 = createStep({
65
+ // ...
66
+ stateSchema: z.object({
67
+ metadata: z.object({
68
+ processedBy: z.string(),
69
+ }),
70
+ }),
71
+ execute: async ({ inputData, state }) => {
72
+ const { formatted } = inputData;
73
+ const { metadata } = state;
74
+
75
+ return {
76
+ emphasized: `${formatted}!! ${metadata.processedBy}`,
77
+ };
78
+ },
79
+ });
80
+
81
+ export const testWorkflow = createWorkflow({
82
+ // ...
83
+ stateSchema: z.object({
84
+ processedItems: z.array(z.string()),
85
+ metadata: z.object({
86
+ processedBy: z.string(),
87
+ }),
88
+ }),
89
+ })
90
+ .then(step1)
91
+ .then(step2)
92
+ .commit();
93
+ ```
94
+
95
+ ## Setting initial state
96
+
97
+ Pass `initialState` when starting a workflow run to set the starting values:
98
+
99
+ ```typescript showLineNumbers copy
100
+ const run = await workflow.createRun();
101
+
102
+ const result = await run.start({
103
+ inputData: { message: "Hello" },
104
+ initialState: {
105
+ processedItems: [],
106
+ metadata: { processedBy: "system" },
107
+ },
108
+ });
109
+ ```
110
+
111
+ The `initialState` object should match the structure defined in the workflow's `stateSchema`.
112
+
113
+ ## State persistence across suspend/resume
114
+
115
+ State automatically persists across suspend and resume cycles. When a workflow suspends and later resumes, all state updates made before the suspension are preserved:
116
+
117
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
118
+ const step1 = createStep({
119
+ id: "step-1",
120
+ inputSchema: z.object({}),
121
+ outputSchema: z.object({}),
122
+ stateSchema: z.object({ count: z.number(), items: z.array(z.string()) }),
123
+ resumeSchema: z.object({ proceed: z.boolean() }),
124
+ execute: async ({ state, setState, suspend, resumeData }) => {
125
+ if (!resumeData) {
126
+ // First run: update state and suspend
127
+ setState({ ...state, count: state.count + 1, items: [...state.items, "item-1"] });
128
+ await suspend({});
129
+ return {};
130
+ }
131
+ // After resume: state changes are preserved (count: 1, items: ["item-1"])
132
+ return {};
133
+ },
134
+ });
135
+ ```
136
+
137
+ ## State in nested workflows
138
+
139
+ When using nested workflows, state propagates from parent to child. Changes made by the parent workflow before calling a nested workflow are visible to steps inside the nested workflow:
140
+
141
+ ```typescript title="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
142
+ const nestedStep = createStep({
143
+ id: "nested-step",
144
+ inputSchema: z.object({}),
145
+ outputSchema: z.object({ result: z.string() }),
146
+ stateSchema: z.object({ sharedValue: z.string() }),
147
+ execute: async ({ state }) => {
148
+ // Receives state modified by parent workflow
149
+ return { result: `Received: ${state.sharedValue}` };
150
+ },
151
+ });
152
+
153
+ const nestedWorkflow = createWorkflow({
154
+ id: "nested-workflow",
155
+ inputSchema: z.object({}),
156
+ outputSchema: z.object({ result: z.string() }),
157
+ stateSchema: z.object({ sharedValue: z.string() }),
158
+ })
159
+ .then(nestedStep)
160
+ .commit();
161
+
162
+ const parentStep = createStep({
163
+ id: "parent-step",
164
+ inputSchema: z.object({}),
165
+ outputSchema: z.object({}),
166
+ stateSchema: z.object({ sharedValue: z.string() }),
167
+ execute: async ({ state, setState }) => {
168
+ // Modify state before nested workflow runs
169
+ setState({ ...state, sharedValue: "modified-by-parent" });
170
+ return {};
171
+ },
172
+ });
173
+
174
+ const parentWorkflow = createWorkflow({
175
+ id: "parent-workflow",
176
+ inputSchema: z.object({}),
177
+ outputSchema: z.object({ result: z.string() }),
178
+ stateSchema: z.object({ sharedValue: z.string() }),
179
+ })
180
+ .then(parentStep)
181
+ .then(nestedWorkflow)
182
+ .commit();
183
+ ```
184
+
185
+ ## Related
186
+
187
+ - [Workflows overview](/docs/workflows/overview)
188
+ - [Suspend & Resume](/docs/workflows/suspend-and-resume)
189
+ - [Step Class](/reference/workflows/step)
190
+ - [Workflow Class](/reference/workflows/workflow)
191
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.46-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`5cc85aa`](https://github.com/mastra-ai/mastra/commit/5cc85aa4329773cac8314f3aa0146227b6b158e4), [`c53f8e6`](https://github.com/mastra-ai/mastra/commit/c53f8e68df42464935f9a63eb0fc765a65aacb83), [`386ab43`](https://github.com/mastra-ai/mastra/commit/386ab4350cf2a814fb4ac0a5fc6983ca93158ffe), [`2b62302`](https://github.com/mastra-ai/mastra/commit/2b623027a9d65c1dbc963bf651e9e6a9d09da1fa), [`7d85da4`](https://github.com/mastra-ai/mastra/commit/7d85da42a5fab56009a959a9c20328558d14f4b5), [`3d7c5bd`](https://github.com/mastra-ai/mastra/commit/3d7c5bdbee1b2693cd45bf207b960dd9b7277680), [`31b381e`](https://github.com/mastra-ai/mastra/commit/31b381efb48e031c0ecc46bc6e410ae6e67b88e5), [`e77a5f9`](https://github.com/mastra-ai/mastra/commit/e77a5f9718dc418e29e3c8a389299ed6dc0a6401), [`b069af5`](https://github.com/mastra-ai/mastra/commit/b069af514c4dcfc4fdcb164303569bfff1c26e3d), [`7dc8304`](https://github.com/mastra-ai/mastra/commit/7dc830420296db516b86dcec663e54d0309b8fb8), [`6942109`](https://github.com/mastra-ai/mastra/commit/694210903c70e3c26b5ce8ca4f4637ca2d9eb369), [`62d13f4`](https://github.com/mastra-ai/mastra/commit/62d13f4d1db1c16742831f210fe4c2caf8a26d57), [`358ab98`](https://github.com/mastra-ai/mastra/commit/358ab98024c388e383aca15616e8988bf4a5b66e)]:
8
+ - @mastra/core@0.24.7-alpha.1
9
+
3
10
  ## 0.13.46-alpha.0
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.46-alpha.0",
3
+ "version": "0.13.46-alpha.1",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,8 +33,8 @@
33
33
  "uuid": "^11.1.0",
34
34
  "zod": "^3.25.76",
35
35
  "zod-to-json-schema": "^3.24.6",
36
- "@mastra/mcp": "^0.14.4",
37
- "@mastra/core": "0.24.7-alpha.0"
36
+ "@mastra/core": "0.24.7-alpha.1",
37
+ "@mastra/mcp": "^0.14.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hono/node-server": "^1.19.5",
@@ -50,7 +50,7 @@
50
50
  "typescript": "^5.8.3",
51
51
  "vitest": "^3.2.4",
52
52
  "@internal/lint": "0.0.64",
53
- "@mastra/core": "0.24.7-alpha.0"
53
+ "@mastra/core": "0.24.7-alpha.1"
54
54
  },
55
55
  "homepage": "https://mastra.ai",
56
56
  "repository": {