@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,16 +1,16 @@
1
1
  ---
2
- title: "Reference: stream() | Agents | Mastra Docs"
3
- description: "Documentation for the `.stream()` method in Mastra agents, which enables real-time streaming of responses."
2
+ title: "Reference: Agent.stream() | Agents | Mastra Docs"
3
+ description: "Documentation for the `Agent.stream()` method in Mastra agents, which enables real-time streaming of responses."
4
4
  ---
5
5
 
6
- # stream()
6
+ # Agent.stream()
7
7
 
8
8
  The `.stream()` method enables real-time streaming of responses from an agent. This method accepts messages and optional streaming options.
9
9
 
10
10
  ## Usage example
11
11
 
12
- ```typescript showLineNumbers copy
13
- const response = await agent.stream("message for agent");
12
+ ```typescript copy
13
+ await agent.stream("message for agent");
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -31,20 +31,6 @@ const response = await agent.stream("message for agent");
31
31
  ]}
32
32
  />
33
33
 
34
- ## Extended usage example
35
-
36
- ```typescript showLineNumbers copy
37
- const response = await agent.stream("message for agent", {
38
- temperature: 0.7,
39
- maxSteps: 3,
40
- memory: {
41
- thread: "user-123",
42
- resource: "test-app"
43
- },
44
- toolChoice: "auto"
45
- });
46
- ```
47
-
48
34
  ### Options parameters
49
35
 
50
36
  <PropertiesTable
@@ -472,3 +458,22 @@ const response = await agent.stream("message for agent", {
472
458
  },
473
459
  ]}
474
460
  />
461
+
462
+ ## Extended usage example
463
+
464
+ ```typescript showLineNumbers copy
465
+ await agent.stream("message for agent", {
466
+ temperature: 0.7,
467
+ maxSteps: 3,
468
+ memory: {
469
+ thread: "user-123",
470
+ resource: "test-app"
471
+ },
472
+ toolChoice: "auto"
473
+ });
474
+ ```
475
+
476
+ ## Related
477
+
478
+ - [Agent streaming](../../docs/agents/streaming.mdx)
479
+ - [Agent generation](../../docs/agents/overview.mdx#generate)
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: streamVNext() | Agents | Mastra Docs"
3
- description: "Documentation for the `.streamVNext()` method in Mastra agents, which enables real-time streaming of responses with enhanced capabilities."
2
+ title: "Reference: Agent.streamVNext() | Agents | Mastra Docs"
3
+ description: "Documentation for the `Agent.streamVNext()` method in Mastra agents, which enables real-time streaming of responses with enhanced capabilities."
4
4
  ---
5
5
 
6
- # streamVNext()
6
+ # Agent.streamVNext()
7
7
 
8
8
  The `.streamVNext()` method enables real-time streaming of responses from an agent with enhanced capabilities. This method accepts messages and optional streaming options, providing a next-generation streaming experience.
9
9
 
10
10
  ## Usage example
11
11
 
12
- ```typescript showLineNumbers copy
13
- const response = await agent.streamVNext("message for agent");
12
+ ```typescript copy
13
+ await agent.streamVNext("message for agent");
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -31,20 +31,6 @@ const response = await agent.streamVNext("message for agent");
31
31
  ]}
32
32
  />
33
33
 
34
- ## Extended usage example
35
-
36
- ```typescript showLineNumbers copy
37
- const response = await agent.streamVNext("message for agent", {
38
- temperature: 0.7,
39
- maxSteps: 3,
40
- memory: {
41
- thread: "user-123",
42
- resource: "test-app"
43
- },
44
- toolChoice: "auto"
45
- });
46
- ```
47
-
48
34
  ### Options parameters
49
35
 
50
36
  <PropertiesTable
@@ -402,3 +388,16 @@ const response = await agent.streamVNext("message for agent", {
402
388
  ]}
403
389
  />
404
390
 
391
+ ## Extended usage example
392
+
393
+ ```typescript showLineNumbers copy
394
+ await agent.streamVNext("message for agent", {
395
+ temperature: 0.7,
396
+ maxSteps: 3,
397
+ memory: {
398
+ thread: "user-123",
399
+ resource: "test-app"
400
+ },
401
+ toolChoice: "auto"
402
+ });
403
+ ```
@@ -2,11 +2,16 @@
2
2
  title: "Upstash Storage | Storage System | Mastra Core"
3
3
  description: Documentation for the Upstash storage implementation in Mastra.
4
4
  ---
5
+ import { Callout } from 'nextra/components'
5
6
 
6
7
  # Upstash Storage
7
8
 
8
9
  The Upstash storage implementation provides a serverless-friendly storage solution using Upstash's Redis-compatible key-value store.
9
10
 
11
+ <Callout type="warning">
12
+ **Important:** When using Mastra with Upstash, the pay-as-you-go model can result in unexpectedly high costs due to the high volume of Redis commands generated during agent conversations. We strongly recommend using a **fixed pricing plan** for predictable costs. See [Upstash pricing](https://upstash.com/pricing/redis) for details and [GitHub issue #5850](https://github.com/mastra-ai/mastra/issues/5850) for context.
13
+ </Callout>
14
+
10
15
  ## Installation
11
16
 
12
17
  ```bash copy
@@ -1,38 +1,40 @@
1
1
  ---
2
2
  title: "Reference: createTool() | Tools | Mastra Docs"
3
- description: Documentation for the createTool function in Mastra, used to define custom tools for agents.
3
+ description: Documentation for the `createTool()` function in Mastra, used to define custom tools for agents.
4
4
  ---
5
5
 
6
6
  # createTool()
7
7
 
8
8
  The `createTool()` function is used to define custom tools that your Mastra agents can execute. Tools extend an agent's capabilities by allowing it to interact with external systems, perform calculations, or access specific data.
9
9
 
10
- ## Basic Usage
10
+ ## Usage example
11
11
 
12
- Here is a basic example of creating a tool that fetches weather information:
13
-
14
- ```typescript filename="src/mastra/tools/weatherInfo.ts" copy
12
+ ```typescript filename="src/mastra/tools/reverse-tool.ts" showLineNumbers copy
15
13
  import { createTool } from "@mastra/core/tools";
16
14
  import { z } from "zod";
17
15
 
18
- export const weatherInfo = createTool({
19
- id: "Get Weather Information",
16
+ export const reverseTool = createTool({
17
+ id: "reverse-tool",
18
+ description: "Reverse the input string",
20
19
  inputSchema: z.object({
21
- city: z.string(),
20
+ input: z.string()
21
+ }),
22
+ outputSchema: z.object({
23
+ output: z.string()
22
24
  }),
23
- description: `Fetches the current weather information for a given city`,
24
- execute: async ({ context: { city } }) => {
25
- // Tool logic here (e.g., API call)
26
- console.log("Using tool to fetch weather information for", city);
27
- return { temperature: 20, conditions: "Sunny" }; // Example return
28
- },
25
+ execute: async ({ context }) => {
26
+ const { input } = context;
27
+ const reversed = input.split("").reverse().join("");
28
+
29
+ return {
30
+ output: reversed
31
+ };
32
+ }
29
33
  });
30
34
  ```
31
35
 
32
36
  ## Parameters
33
37
 
34
- The `createTool()` function accepts an object with the following parameters:
35
-
36
38
  <PropertiesTable
37
39
  content={[
38
40
  {
@@ -87,18 +89,9 @@ The `createTool()` function returns a `Tool` object.
87
89
  ]}
88
90
  />
89
91
 
90
- ## Tool Details
91
-
92
- The `Tool` object returned by `createTool()` has the following key properties:
93
-
94
- - **ID**: The unique identifier provided in the `id` parameter.
95
- - **Description**: The description provided in the `description` parameter.
96
- - **Parameters**: Derived from the `inputSchema`, defining the structure of inputs the tool expects.
97
- - **Execute Function**: The logic defined in the `execute` parameter, which is called when the agent decides to use the tool.
98
-
99
92
  ## Related
100
93
 
101
- - [Tools Overview](/docs/tools-mcp/overview)
102
- - [Using Tools with Agents](/docs/agents/using-tools-and-mcp)
103
- - [Dynamic Tool Context](/docs/tools-mcp/dynamic-context)
104
- - [Advanced Tool Usage](/docs/tools-mcp/advanced-usage)
94
+ - [Tools Overview](/docs/tools-mcp/overview.mdx)
95
+ - [Using Tools with Agents](/docs/agents/using-tools-and-mcp.mdx)
96
+ - [Dynamic Tool Context](/docs/tools-mcp/dynamic-context.mdx)
97
+ - [Advanced Tool Usage](/docs/tools-mcp/advanced-usage.mdx)
@@ -246,8 +246,8 @@ const response = await agent.generate(
246
246
 
247
247
  For more information on runtime context, please see:
248
248
 
249
- - [Runtime Variables](../../docs/agents/runtime-variables)
250
- - [Dynamic Context](../../docs/tools-mcp/dynamic-context)
249
+ - [Runtime Variables](../../docs/agents/runtime-variables.mdx)
250
+ - [Dynamic Context](../../docs/tools-mcp/dynamic-context.mdx)
251
251
 
252
252
  ## Related
253
253
 
@@ -314,7 +314,7 @@ This agent-driven approach:
314
314
 
315
315
  For detailed filter syntax and store-specific capabilities, see the [Metadata Filters](../rag/metadata-filters) documentation.
316
316
 
317
- For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](../../../examples/rag/usage/filter-rag) example.
317
+ For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](../../../examples/rag/usage/filter-rag.mdx) example.
318
318
 
319
319
  ## Example with Reranking
320
320
 
@@ -551,8 +551,8 @@ const response = await agent.generate(
551
551
 
552
552
  For more information on runtime context, please see:
553
553
 
554
- - [Runtime Variables](../../docs/agents/runtime-variables)
555
- - [Dynamic Context](../../docs/tools-mcp/dynamic-context)
554
+ - [Runtime Variables](../../docs/agents/runtime-variables.mdx)
555
+ - [Dynamic Context](../../docs/tools-mcp/dynamic-context.mdx)
556
556
 
557
557
  ## Usage Without a Mastra Server
558
558
 
@@ -1,18 +1,18 @@
1
1
  ---
2
- title: "Reference: Workflow.branch() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.branch()` method in workflows, which creates conditional branches between steps.
2
+ title: "Reference: Workflow.branch() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.branch()` method in workflows, which creates conditional branches between steps.
4
4
  ---
5
5
 
6
6
  # Workflow.branch()
7
7
 
8
8
  The `.branch()` method creates conditional branches between workflow steps, allowing for different paths to be taken based on the result of a previous step.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
12
+ ```typescript copy
13
13
  workflow.branch([
14
- [async ({ context }) => true, stepOne],
15
- [async ({ context }) => false, stepTwo],
14
+ [async ({ context }) => true, step1],
15
+ [async ({ context }) => false, step2],
16
16
  ]);
17
17
  ```
18
18
 
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.commit() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.commit()` method in workflows, which finalizes the workflow and returns the final result.
2
+ title: "Reference: Workflow.commit() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.commit()` method in workflows, which finalizes the workflow and returns the final result.
4
4
  ---
5
5
 
6
6
  # Workflow.commit()
7
7
 
8
8
  The `.commit()` method finalizes the workflow and returns the final result.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.then(stepOne).commit();
12
+ ```typescript copy
13
+ workflow.then(step1).commit();
14
14
  ```
15
15
 
16
16
  ## Returns
@@ -1,37 +1,22 @@
1
1
  ---
2
- title: "Reference: Workflow.createRunAsync() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.createRunAsync()` method in workflows, which creates a new workflow run instance.
2
+ title: "Reference: Workflow.createRunAsync() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.createRunAsync()` method in workflows, which creates a new workflow run instance.
4
4
  ---
5
5
 
6
+ import { Callout } from "nextra/components";
7
+
6
8
  # Workflow.createRunAsync()
7
9
 
8
- The `.createRunAsync()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data.
9
-
10
- ## Usage
11
-
12
- ```typescript
13
- const myWorkflow = createWorkflow({
14
- id: "my-workflow",
15
- inputSchema: z.object({
16
- startValue: z.string(),
17
- }),
18
- outputSchema: z.object({
19
- result: z.string(),
20
- }),
21
- steps: [step1, step2, step3], // Declare steps used in this workflow
22
- })
23
- .then(step1)
24
- .then(step2)
25
- .then(step3)
26
- .commit();
27
-
28
- const mastra = new Mastra({
29
- workflows: {
30
- myWorkflow,
31
- },
32
- });
10
+ The `.createRunAsync()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data. This is the current API that returns a `Run` instance.
33
11
 
34
- const run = await mastra.getWorkflow("myWorkflow").createRunAsync();
12
+ <Callout>
13
+ For the legacy `createRun()` method that returns an object with methods, see the [Legacy Workflows](../legacyWorkflows/createRun.mdx) section.
14
+ </Callout>
15
+
16
+ ## Usage example
17
+
18
+ ```typescript copy
19
+ await workflow.createRunAsync();
35
20
  ```
36
21
 
37
22
  ## Parameters
@@ -61,6 +46,20 @@ const run = await mastra.getWorkflow("myWorkflow").createRunAsync();
61
46
  ]}
62
47
  />
63
48
 
49
+ ## Extended usage example
50
+
51
+ ```typescript showLineNumbers copy
52
+ const workflow = mastra.getWorkflow("workflow");
53
+
54
+ const run = await workflow.createRunAsync();
55
+
56
+ const result = await run.start({
57
+ inputData: {
58
+ value: 10,
59
+ },
60
+ });
61
+ ```
62
+
64
63
  ## Related
65
64
 
66
- - [Running workflows](../../docs/workflows/overview.mdx#running-workflows)
65
+ - [Running workflows](../../examples/workflows/running-workflows.mdx)
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.dountil() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.dountil()` method in workflows, which creates a loop that executes a step until a condition is met.
2
+ title: "Reference: Workflow.dountil() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.dountil()` method in workflows, which creates a loop that executes a step until a condition is met.
4
4
  ---
5
5
 
6
6
  # Workflow.dountil()
7
7
 
8
8
  The `.dountil()` method creates a loop that executes a step until a condition is met.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.dountil(stepOne, async ({ inputData }) => true);
12
+ ```typescript copy
13
+ workflow.dountil(step1, async ({ inputData }) => true);
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.dowhile() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.dowhile()` method in workflows, which creates a loop that executes a step while a condition is met.
2
+ title: "Reference: Workflow.dowhile() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.dowhile()` method in workflows, which creates a loop that executes a step while a condition is met.
4
4
  ---
5
5
 
6
6
  # Workflow.dowhile()
7
7
 
8
8
  The `.dowhile()` method creates a loop that executes a step while a condition is met.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.dowhile(stepOne, async ({ inputData }) => true);
12
+ ```typescript copy
13
+ workflow.dowhile(step1, async ({ inputData }) => true);
14
14
  ```
15
15
 
16
16
  ## Parameters
@@ -1,45 +1,19 @@
1
1
  ---
2
- title: "Reference: Workflow.execute() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.execute()` method in workflows, which executes a step with input data and returns the output.
2
+ title: "Reference: Workflow.execute() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.execute()` method in workflows, which executes a workflow directly and returns the output.
4
4
  ---
5
5
 
6
6
  # Workflow.execute()
7
7
 
8
- The `.execute()` method executes a step with input data and returns the output, allowing you to process data within a workflow.
8
+ The `.execute()` method executes a workflow directly and returns the output, allowing you to run a workflow without creating a separate run instance.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- const inputSchema = z.object({
14
- inputValue: z.string(),
15
- });
16
-
17
- const myStep = createStep({
18
- id: "my-step",
19
- description: "Does something useful",
20
- inputSchema,
21
- outputSchema: z.object({
22
- outputValue: z.string(),
23
- }),
24
- resumeSchema: z.object({
25
- resumeValue: z.string(),
26
- }),
27
- suspendSchema: z.object({
28
- suspendValue: z.string(),
29
- }),
30
- execute: async ({
31
- inputData,
32
- mastra,
33
- getStepResult,
34
- getInitData,
35
- runtimeContext,
36
- }) => {
37
- const otherStepOutput = getStepResult(step2);
38
- const initData = getInitData<typeof inputSchema>(); // typed as the input schema variable (zod schema)
39
- return {
40
- outputValue: `Processed: ${inputData.inputValue}, ${initData.startValue} (runtimeContextValue: ${runtimeContext.get("runtimeContextValue")})`,
41
- };
42
- },
12
+ ```typescript showLineNumbers copy
13
+ await workflow.execute({
14
+ inputData: {
15
+ value: "hello world"
16
+ }
43
17
  });
44
18
  ```
45
19
 
@@ -48,77 +22,93 @@ const myStep = createStep({
48
22
  <PropertiesTable
49
23
  content={[
50
24
  {
51
- name: "params",
52
- type: "object",
53
- description: "Configuration object for executing the step",
25
+ name: "inputData",
26
+ type: "z.infer<TInput>",
27
+ description: "Input data that matches the workflow's input schema",
54
28
  isOptional: false,
29
+ },
30
+ {
31
+ name: "resumeData",
32
+ type: "any",
33
+ description: "Data for resuming a suspended workflow",
34
+ isOptional: true,
35
+ },
36
+ {
37
+ name: "suspend",
38
+ type: "(suspendPayload: any) => Promise<any>",
39
+ description: "Function to suspend workflow execution",
40
+ isOptional: false,
41
+ },
42
+ {
43
+ name: "resume",
44
+ type: "object",
45
+ description: "Configuration for resuming workflow execution",
46
+ isOptional: true,
55
47
  properties: [
56
48
  {
57
- name: "inputData",
58
- type: "z.infer<TInput>",
59
- description: "Input data matching the step's input schema",
49
+ name: "steps",
50
+ type: "string[]",
51
+ description: "Steps to resume",
60
52
  isOptional: false,
61
53
  },
62
54
  {
63
- name: "resumeData",
64
- type: "ResumeSchema",
65
- description: "Data for resuming a suspended step",
66
- isOptional: true,
67
- },
68
- {
69
- name: "suspend",
70
- type: "(suspendPayload: any) => Promise<void>",
71
- description: "Function to suspend step execution",
55
+ name: "resumePayload",
56
+ type: "any",
57
+ description: "Payload data for resuming",
72
58
  isOptional: false,
73
59
  },
74
60
  {
75
- name: "resume",
76
- type: "object",
77
- description: "Configuration for resuming execution",
61
+ name: "runId",
62
+ type: "string",
63
+ description: "ID of the run to resume",
78
64
  isOptional: true,
79
- properties: [
80
- {
81
- name: "steps",
82
- type: "string[]",
83
- description: "Steps to resume",
84
- isOptional: false,
85
- },
86
- {
87
- name: "resumePayload",
88
- type: "any",
89
- description: "Payload data for resuming",
90
- isOptional: false,
91
- },
92
- {
93
- name: "runId",
94
- type: "string",
95
- description: "ID of the run to resume",
96
- isOptional: true,
97
- },
98
- ],
99
- },
100
- {
101
- name: "emitter",
102
- type: "object",
103
- description: "Event emitter object",
104
- isOptional: false,
105
- properties: [
106
- {
107
- name: "emit",
108
- type: "(event: string, data: any) => void",
109
- description: "Function to emit events",
110
- isOptional: false,
111
- },
112
- ],
113
65
  },
66
+ ],
67
+ },
68
+ {
69
+ name: "emitter",
70
+ type: "object",
71
+ description: "Event emitter object for workflow events",
72
+ isOptional: false,
73
+ properties: [
114
74
  {
115
- name: "mastra",
116
- type: "Mastra",
117
- description: "Mastra instance",
75
+ name: "emit",
76
+ type: "(event: string, data: any) => void",
77
+ description: "Function to emit events",
118
78
  isOptional: false,
119
79
  },
120
80
  ],
121
81
  },
82
+ {
83
+ name: "mastra",
84
+ type: "Mastra",
85
+ description: "Mastra instance",
86
+ isOptional: false,
87
+ },
88
+ {
89
+ name: "runtimeContext",
90
+ type: "RuntimeContext",
91
+ description: "Runtime context data to use during workflow execution",
92
+ isOptional: true,
93
+ },
94
+ {
95
+ name: "abort",
96
+ type: "() => any",
97
+ description: "Function to abort workflow execution",
98
+ isOptional: false,
99
+ },
100
+ {
101
+ name: "abortSignal",
102
+ type: "AbortSignal",
103
+ description: "Abort signal for workflow execution",
104
+ isOptional: false,
105
+ },
106
+ {
107
+ name: "runCount",
108
+ type: "number",
109
+ description: "Number of times the workflow has been run",
110
+ isOptional: true,
111
+ },
122
112
  ]}
123
113
  />
124
114
 
@@ -129,11 +119,13 @@ const myStep = createStep({
129
119
  {
130
120
  name: "result",
131
121
  type: "Promise<z.infer<TOutput>>",
132
- description: "A promise that resolves to the output of the executed step",
122
+ description: "A promise that resolves to the output of the executed workflow",
133
123
  },
134
124
  ]}
135
125
  />
136
126
 
137
127
  ## Related
138
128
 
129
+ - [Workflow.createRunAsync()](./create-run.mdx) - Alternative method for creating workflow runs
130
+ - [WorkflowRun.start()](./start.mdx) - Starting workflow execution
139
131
  - [Running workflows](../../docs/workflows/overview.mdx#running-workflows)
@@ -1,16 +1,16 @@
1
1
  ---
2
- title: "Reference: Workflow.foreach() | Building Workflows | Mastra Docs"
3
- description: Documentation for the `.foreach()` method in workflows, which creates a loop that executes a step for each item in an array.
2
+ title: "Reference: Workflow.foreach() | Workflows | Mastra Docs"
3
+ description: Documentation for the `Workflow.foreach()` method in workflows, which creates a loop that executes a step for each item in an array.
4
4
  ---
5
5
 
6
6
  # Workflow.foreach()
7
7
 
8
8
  The `.foreach()` method creates a loop that executes a step for each item in an array.
9
9
 
10
- ## Usage
10
+ ## Usage example
11
11
 
12
- ```typescript
13
- workflow.foreach(stepOne, { concurrency: 2 });
12
+ ```typescript copy
13
+ workflow.foreach(step1, { concurrency: 2 });
14
14
  ```
15
15
 
16
16
  ## Parameters