@mastra/mcp-docs-server 0.13.32 → 0.13.34-alpha.0

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 (30) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +2 -0
  3. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
  4. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  5. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +11 -11
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +22 -22
  7. package/.docs/organized/changelogs/%40mastra%2Fcore.md +11 -11
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +25 -25
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +25 -25
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +25 -25
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +25 -25
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +29 -29
  13. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +22 -22
  14. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +36 -36
  15. package/.docs/organized/changelogs/%40mastra%2Freact.md +21 -0
  16. package/.docs/organized/changelogs/%40mastra%2Fserver.md +26 -26
  17. package/.docs/organized/changelogs/create-mastra.md +7 -7
  18. package/.docs/organized/changelogs/mastra.md +29 -29
  19. package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +1 -1
  20. package/.docs/raw/getting-started/project-structure.mdx +48 -45
  21. package/.docs/raw/getting-started/studio.mdx +158 -0
  22. package/.docs/raw/reference/workflows/step.mdx +1 -1
  23. package/.docs/raw/tools-mcp/overview.mdx +2 -2
  24. package/.docs/raw/workflows/agents-and-tools.mdx +131 -0
  25. package/.docs/raw/workflows/overview.mdx +15 -13
  26. package/CHANGELOG.md +21 -0
  27. package/package.json +4 -4
  28. package/.docs/organized/code-examples/agent.md +0 -1387
  29. package/.docs/raw/server-db/local-dev-playground.mdx +0 -233
  30. package/.docs/raw/workflows/using-with-agents-and-tools.mdx +0 -350
@@ -0,0 +1,131 @@
1
+ ---
2
+ title: "Agents and Tools | Workflows | Mastra Docs"
3
+ description: "Learn how to call agents and tools from workflow steps and choose between execute functions and step composition."
4
+ ---
5
+
6
+ # Agents and Tools
7
+
8
+ Workflow steps can call agents to leverage LLM reasoning or call tools for type-safe logic. You can either invoke them from within a step's `execute` function or compose them directly as steps using `createStep()`.
9
+
10
+ ## Using agents in workflows
11
+
12
+ Use agents in workflow steps when you need reasoning, language generation, or other LLM-based tasks. Call from a step's `execute` function for more control over the agent call (e.g., track conversation history or return structured output). Compose agents as steps when you don't need to modify how the agent is invoked.
13
+
14
+ ### Calling agents
15
+
16
+ Call agents inside a step's `execute` function using `.generate()` or `.stream()`. This lets you modify the agent call and handle the response before passing it to the next step.
17
+
18
+ ```typescript {7-12} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
19
+ const step1 = createStep({
20
+ // ...
21
+ execute: async ({ inputData, mastra }) => {
22
+ const { message } = inputData;
23
+
24
+ const testAgent = mastra.getAgent("testAgent");
25
+ const response = await testAgent.generate(`Convert this message into bullet points: ${message}`, {
26
+ memory: {
27
+ thread: "user-123",
28
+ resource: "test-123"
29
+ }
30
+ });
31
+
32
+ return {
33
+ list: response.text
34
+ };
35
+ }
36
+ });
37
+ ```
38
+
39
+ > See [Calling Agents](../../examples/agents/calling-agents.mdx) for more examples.
40
+
41
+ ### Agents as steps
42
+
43
+ Compose an agent as a step using `createStep()` when you don't need to modify the agent call. Use `.map()` to transform the previous step's output into a `prompt` the agent can use.
44
+
45
+ ![Agent as step](/image/workflows/workflows-agent-tools-agent-step.jpg)
46
+
47
+ ```typescript {1,3,8-13} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
48
+ import { testAgent } from "../agents/test-agent";
49
+
50
+ const step1 = createStep(testAgent);
51
+
52
+ export const testWorkflow = createWorkflow({
53
+ // ...
54
+ })
55
+ .map(async ({ inputData }) => {
56
+ const { message } = inputData;
57
+ return {
58
+ prompt: `Convert this message into bullet points: ${message}`
59
+ };
60
+ })
61
+ .then(step1)
62
+ .then(step2)
63
+ .commit();
64
+ ```
65
+
66
+ > See [Input Data Mapping](./input-data-mapping.mdx) for more information.
67
+
68
+ ## Using tools in workflows
69
+
70
+ Use tools in workflow steps to leverage existing tool logic. Call from a step's `execute` function when you need to prepare context or process responses. Compose tools as steps when you don't need to modify how the tool is used.
71
+
72
+ ### Calling tools
73
+
74
+ Call tools inside a step's `execute` function using `.execute()`. This gives you more control over the tool's input context, or process its response before passing it to the next step.
75
+
76
+ ```typescript {8-13,16} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
77
+ import { testTool } from "../tools/test-tool";
78
+
79
+ const step2 = createStep({
80
+ // ...
81
+ execute: async ({ inputData, runtimeContext }) => {
82
+ const { formatted } = inputData;
83
+
84
+ const response = await testTool.execute({
85
+ context: {
86
+ text: formatted
87
+ },
88
+ runtimeContext
89
+ });
90
+
91
+ return {
92
+ emphasized: response.emphasized
93
+ };
94
+ }
95
+ });
96
+ ```
97
+
98
+ > See [Calling Tools](../../examples/tools/calling-tools.mdx) for more examples.
99
+
100
+ ### Tools as steps
101
+
102
+ Compose a tool as a step using `createStep()` when the previous step's output matches the tool's input context. You can use `.map()` to transform the previous step's output if they don't.
103
+
104
+ ![Tool as step](/image/workflows/workflows-agent-tools-tool-step.jpg)
105
+
106
+ ```typescript {1,3,9-14} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
107
+ import { testTool } from "../tools/test-tool";
108
+
109
+ const step2 = createStep(testTool);
110
+
111
+ export const testWorkflow = createWorkflow({
112
+ // ...
113
+ })
114
+ .then(step1)
115
+ .map(async ({ inputData }) => {
116
+ const { formatted } = inputData;
117
+ return {
118
+ text: formatted
119
+ };
120
+ })
121
+ .then(step2)
122
+ .commit();
123
+ ```
124
+
125
+ > See [Input Data Mapping](./input-data-mapping.mdx) for more information.
126
+
127
+ ## Related
128
+
129
+ - [Using Agents](../agents/overview.mdx)
130
+ - [Using Tools](../tools-mcp/overview.mdx)
131
+
@@ -31,7 +31,9 @@ Mastra workflows operate using these principles:
31
31
 
32
32
  Steps are the building blocks of workflows. Create a step using `createStep()` with `inputSchema` and `outputSchema` to define the data it accepts and returns.
33
33
 
34
- ```typescript {6,9,14} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
34
+ The `execute` function defines what the step does. Use it to call functions in your codebase, external APIs, agents, or tools.
35
+
36
+ ```typescript {6,9,15} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
35
37
  import { createStep } from "@mastra/core/workflows";
36
38
 
37
39
  const step1 = createStep({
@@ -44,6 +46,7 @@ const step1 = createStep({
44
46
  }),
45
47
  execute: async ({ inputData }) => {
46
48
  const { message } = inputData;
49
+
47
50
  return {
48
51
  formatted: message.toUpperCase()
49
52
  };
@@ -53,6 +56,10 @@ const step1 = createStep({
53
56
 
54
57
  > See the [Step Class](../../reference/workflows/step.mdx) for a full list of configuration options.
55
58
 
59
+ ### Using agents and tools
60
+
61
+ Workflow steps can also call registered agents or import and execute tools directly, visit the [Agents and Tools](./agents-and-tools.mdx) page for more information.
62
+
56
63
  ## Creating a workflow
57
64
 
58
65
  Create a workflow using `createWorkflow()` with `inputSchema` and `outputSchema` to define the data it accepts and returns. Add steps using `.then()` and complete the workflow with `.commit()`.
@@ -81,13 +88,11 @@ export const testWorkflow = createWorkflow({
81
88
 
82
89
  ### Understanding control flow
83
90
 
84
- Workflows can be composed using a number of different methods. The method you choose determines how each step's schema should be structured.
91
+ Workflows can be composed using a number of different methods. The method you choose determines how each step's schema should be structured. Visit the [Control Flow](./control-flow.mdx) page for more information.
85
92
 
86
- > See [Control Flow](./control-flow.mdx) for more information.
93
+ #### Composing workflow steps
87
94
 
88
- #### Composing steps
89
-
90
- When using `.then()`, steps run sequentially. The `inputSchema` of each step must match the `outputSchema` of the step before it. The final step’s `outputSchema` doesn’t need to match the workflow’s `outputSchema`, which can be defined independently.
95
+ When using `.then()`, steps run sequentially. Each step’s `inputSchema` must match the `outputSchema` of the previous step. The final step’s `outputSchema` should match the workflow’s `outputSchema` to ensure end-to-end type safety.
91
96
 
92
97
  ```typescript {4,7,14,17,24,27} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
93
98
  const step1 = createStep({
@@ -116,7 +121,7 @@ export const testWorkflow = createWorkflow({
116
121
  message: z.string()
117
122
  }),
118
123
  outputSchema: z.object({
119
- output: z.string()
124
+ emphasized: z.string()
120
125
  })
121
126
  })
122
127
  .then(step1)
@@ -200,23 +205,21 @@ The workflow output includes the full execution lifecycle, showing the input and
200
205
  {
201
206
  "status": "success",
202
207
  "steps": {
203
- "input": {
204
- "message": "Hello world"
205
- },
208
+ // ...
206
209
  "step-1": {
210
+ "status": "success",
207
211
  "payload": {
208
212
  "message": "Hello world"
209
213
  },
210
- "status": "success",
211
214
  "output": {
212
215
  "formatted": "HELLO WORLD"
213
216
  },
214
217
  },
215
218
  "step-2": {
219
+ "status": "success",
216
220
  "payload": {
217
221
  "formatted": "HELLO WORLD"
218
222
  },
219
- "status": "success",
220
223
  "output": {
221
224
  "emphasized": "HELLO WORLD!!!"
222
225
  },
@@ -260,7 +263,6 @@ const step1 = createStep({
260
263
 
261
264
  Use the Mastra [Playground](../server-db/local-dev-playground.mdx) to easily run workflows with different inputs, visualize the execution lifecycle, see the inputs and outputs for each step, and inspect each part of the workflow in more detail.
262
265
 
263
-
264
266
  ## Related
265
267
 
266
268
  For a closer look at workflows, see our [Workflow Guide](../../guides/guide/ai-recruiter.mdx), which walks through the core concepts with a practical example.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.34-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
8
+ - @mastra/core@0.22.2-alpha.0
9
+
10
+ ## 0.13.33
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies []:
15
+ - @mastra/core@0.22.1
16
+
17
+ ## 0.13.33-alpha.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies []:
22
+ - @mastra/core@0.22.1-alpha.0
23
+
3
24
  ## 0.13.32
4
25
 
5
26
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.32",
3
+ "version": "0.13.34-alpha.0",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "uuid": "^11.1.0",
34
34
  "zod": "^3.25.76",
35
35
  "zod-to-json-schema": "^3.24.6",
36
- "@mastra/core": "0.22.0",
36
+ "@mastra/core": "0.22.2-alpha.0",
37
37
  "@mastra/mcp": "^0.14.0"
38
38
  },
39
39
  "devDependencies": {
@@ -49,8 +49,8 @@
49
49
  "tsx": "^4.19.4",
50
50
  "typescript": "^5.8.3",
51
51
  "vitest": "^3.2.4",
52
- "@internal/lint": "0.0.51",
53
- "@mastra/core": "0.22.0"
52
+ "@internal/lint": "0.0.52",
53
+ "@mastra/core": "0.22.2-alpha.0"
54
54
  },
55
55
  "homepage": "https://mastra.ai",
56
56
  "repository": {