@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.
Files changed (72) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
  2. package/.docs/organized/changelogs/%40mastra%2Fcore.md +14 -14
  3. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +22 -22
  4. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +21 -21
  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 +13 -13
  8. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +14 -14
  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 +15 -15
  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,62 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.map() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.map()` method in workflows, which maps output data from a previous step to the input of a subsequent step.
2
+ title: "Reference: Workflow.map() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.map()` method in workflows, which maps output data from a previous step to the input of a subsequent step.
4
4
  ---
5
5
 
6
6
  # Workflow.map()
7
7
 
8
8
  The `.map()` method maps output data from a previous step to the input of a subsequent step, allowing you to transform data between steps.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- const step1 = createStep({
14
- id: "step1",
15
- inputSchema: z.object({
16
- inputValue: z.string(),
17
- }),
18
- outputSchema: z.object({
19
- outputValue: z.string(),
20
- }),
21
- execute: async ({ inputData }) => {
22
- return { outputValue: inputData.inputValue };
23
- },
24
- });
25
-
26
- const step2 = createStep({
27
- id: "step2",
28
- inputSchema: z.object({
29
- unexpectedName: z.string(),
30
- }),
31
- outputSchema: z.object({
32
- result: z.string(),
33
- }),
34
- execute: async ({ inputData }) => {
35
- return { result: inputData.unexpectedName };
36
- },
37
- });
38
-
39
- const workflow = createWorkflow({
40
- id: "my-workflow",
41
- steps: [step1, step2],
42
- inputSchema: z.object({
43
- inputValue: z.string(),
44
- }),
45
- outputSchema: z.object({
46
- result: z.string(),
47
- }),
48
- });
49
-
50
- workflow
51
- .then(step1)
52
- .map({
53
- unexpectedName: {
54
- step: step1,
55
- path: "outputValue",
56
- },
57
- })
58
- .then(step2)
59
- .commit();
12
+ ```typescript copy
13
+ workflow.map(async ({ inputData }) => `${inputData.value} - map`
60
14
  ```
61
15
 
62
16
  ## Parameters
@@ -64,49 +18,10 @@ workflow
64
18
  <PropertiesTable
65
19
  content={[
66
20
  {
67
- name: "mappingConfig",
68
- type: "object",
69
- description:
70
- "Configuration object that defines how data should be mapped between workflow steps, either as a mapping object or a mapping function",
21
+ name: "mappingFunction",
22
+ type: "(params: { inputData: any }) => any",
23
+ description: "Function that transforms input data and returns the mapped result",
71
24
  isOptional: false,
72
- properties: [
73
- {
74
- name: "step",
75
- type: "Step | Step[]",
76
- description: "The step(s) to map output from",
77
- isOptional: true,
78
- },
79
- {
80
- name: "path",
81
- type: "string",
82
- description: "Path to the output value in the step result",
83
- isOptional: true,
84
- },
85
- {
86
- name: "value",
87
- type: "any",
88
- description: "Static value to map",
89
- isOptional: true,
90
- },
91
- {
92
- name: "schema",
93
- type: "ZodType",
94
- description: "Schema for validating the mapped value",
95
- isOptional: true,
96
- },
97
- {
98
- name: "initData",
99
- type: "Step",
100
- description: "Step containing initial workflow data to map from",
101
- isOptional: true,
102
- },
103
- {
104
- name: "runtimeContextPath",
105
- type: "string",
106
- description: "Path to value in runtime context",
107
- isOptional: true,
108
- },
109
- ],
110
25
  },
111
26
  ]}
112
27
  />
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.parallel() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.parallel()` method in workflows, which executes multiple steps in parallel.
2
+ title: "Reference: Workflow.parallel() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.parallel()` method in workflows, which executes multiple steps in parallel.
4
4
  ---
5
5
 
6
6
  # Workflow.parallel()
7
7
 
8
8
  The `.parallel()` method executes multiple steps in parallel.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.parallel([stepOne, stepTwo]);
12
+ ```typescript copy
13
+ workflow.parallel([step1, step2]);
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -1,65 +1,52 @@
1
1
  ---
2
- title: "Reference: Workflow.resume() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.resume()` method in workflows, which resumes a suspended workflow run with new data.
2
+ title: "Reference: WorkflowRun.resume() | Workflows | Mastra Docs"
3
+ description: Documentation for the `WorkflowRun.resume()` method in workflows, which resumes a suspended workflow run with new data.
4
4
  ---
5
5
 
6
- # Workflow.resume()
6
+ # WorkflowRun.resume()
7
7
 
8
8
  The `.resume()` method resumes a suspended workflow run with new data, allowing you to continue execution from a specific step.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- const run = await counterWorkflow.createRunAsync();
14
- const result = await run.start({ inputData: { startValue: 0 } });
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRunAsync();
14
+
15
+ const result = await run.start({ inputData: { value: "initial data" } });
15
16
 
16
17
  if (result.status === "suspended") {
17
18
  const resumedResults = await run.resume({
18
- resumeData: { newValue: 0 },
19
+ resumeData: { value: "resume data" }
19
20
  });
20
21
  }
21
22
  ```
22
-
23
-
24
- For more advanced scenarios where you need to specify the exact step to resume:
25
-
26
- ```typescript
27
- await run.resume({
28
- step: result.suspended[0], // Explicitly choose which step to resume
29
- resumeData: { newValue: 0 },
30
- });
31
- ```
32
- > **Note**: When exactly one step is suspended, you can omit the `step` parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.
33
-
34
23
  ## Parameters
35
24
 
36
25
  <PropertiesTable
37
26
  content={[
38
27
  {
39
- name: "params",
40
- type: "object",
41
- description: "Configuration object for resuming the workflow run",
42
- isOptional: false,
43
- properties: [
44
- {
45
- name: "resumeData",
46
- type: "ResumeSchema",
47
- description: "Data for resuming the suspended step",
48
- isOptional: true,
49
- },
50
- {
51
- name: "step",
52
- type: "Step | Step[] | string | string[]",
53
- description: "The step(s) to resume execution from. When omitted, the workflow will automatically resume the suspended step if exactly one step is suspended. Throws an error if multiple steps are suspended and no step is specified.",
54
- isOptional: true,
55
- },
56
- {
57
- name: "runtimeContext",
58
- type: "RuntimeContext",
59
- description: "Runtime context data to use when resuming",
60
- isOptional: true,
61
- },
62
- ],
28
+ name: "resumeData",
29
+ type: "z.infer<TResumeSchema>",
30
+ description: "Data for resuming the suspended step",
31
+ isOptional: true,
32
+ },
33
+ {
34
+ name: "step",
35
+ type: "Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]",
36
+ description: "The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or array of step ID strings",
37
+ isOptional: true,
38
+ },
39
+ {
40
+ name: "runtimeContext",
41
+ type: "RuntimeContext",
42
+ description: "Runtime context data to use when resuming",
43
+ isOptional: true,
44
+ },
45
+ {
46
+ name: "runCount",
47
+ type: "number",
48
+ description: "Optional run count for nested workflow execution",
49
+ isOptional: true,
63
50
  },
64
51
  ]}
65
52
  />
@@ -69,14 +56,25 @@ await run.resume({
69
56
  <PropertiesTable
70
57
  content={[
71
58
  {
72
- name: "resumedResults",
59
+ name: "result",
73
60
  type: "Promise<WorkflowResult<TOutput, TSteps>>",
74
- description:
75
- "A promise that resolves to the result of the resumed workflow run",
61
+ description: "A promise that resolves to the workflow execution result containing step outputs and status",
76
62
  },
77
63
  ]}
78
64
  />
79
65
 
66
+ ## Extended usage example
67
+
68
+ ```typescript showLineNumbers copy
69
+ if (result.status === "suspended") {
70
+ const resumedResults = await run.resume({
71
+ step: result.suspended[0],
72
+ resumeData: { value: "resume data" }
73
+ });
74
+ }
75
+ ```
76
+ > **Note**: When exactly one step is suspended, you can omit the `step` parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.
77
+
80
78
  ## Related
81
79
 
82
80
  - [Suspend and resume](../../docs/workflows/suspend-and-resume.mdx)
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.sendEvent() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.sendEvent()` method in workflows, which resumes execution when an event is sent.
2
+ title: "Reference: Workflow.sendEvent() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.sendEvent()` method in workflows, which resumes execution when an event is sent.
4
4
  ---
5
5
 
6
6
  # Workflow.sendEvent()
7
7
 
8
8
  The `.sendEvent()` resumes execution when an event is sent.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.sendEvent('my-event-name', step1);
12
+ ```typescript copy
13
+ workflow.sendEvent('event-name', step1);
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.sleep() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.sleep()` method in workflows, which pauses execution for a specified number of milliseconds.
2
+ title: "Reference: Workflow.sleep() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.sleep()` method in workflows, which pauses execution for a specified number of milliseconds.
4
4
  ---
5
5
 
6
6
  # Workflow.sleep()
7
7
 
8
8
  The `.sleep()` method pauses execution for a specified number of milliseconds.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.sleep(1000);
12
+ ```typescript copy
13
+ workflow.sleep(5000);
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.sleepUntil() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.sleepUntil()` method in workflows, which pauses execution until a specified date.
2
+ title: "Reference: Workflow.sleepUntil() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.sleepUntil()` method in workflows, which pauses execution until a specified date.
4
4
  ---
5
5
 
6
6
  # Workflow.sleepUntil()
7
7
 
8
8
  The `.sleepUntil()` method pauses execution until a specified date.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.sleepUntil(new Date(Date.now() + 1000));
12
+ ```typescript copy
13
+ workflow.sleepUntil(new Date(Date.now() + 5000));
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -18,9 +18,9 @@ workflow.sleepUntil(new Date(Date.now() + 1000));
18
18
  <PropertiesTable
19
19
  content={[
20
20
  {
21
- name: "date",
22
- type: "Date",
23
- description: "The date until which to pause execution",
21
+ name: "dateOrCallback",
22
+ type: "Date | ((params: ExecuteFunctionParams) => Promise<Date>)",
23
+ description: "Either a Date object or a callback function that returns a Date. The callback receives execution context and can compute the target time dynamically based on input data.",
24
24
  isOptional: false,
25
25
  },
26
26
  ]}
@@ -38,6 +38,14 @@ workflow.sleepUntil(new Date(Date.now() + 1000));
38
38
  ]}
39
39
  />
40
40
 
41
+ ## Extended usage example
42
+
43
+ ```typescript showLineNumbers copy
44
+ workflow.sleepUntil(async ({ inputData }) => {
45
+ return new Date(Date.now() + inputData.value);
46
+ });
47
+ ```
48
+
41
49
  ## Related
42
50
 
43
51
  - [Sleep & Events](../../docs/workflows/pausing-execution.mdx)
@@ -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