@mastra/mcp-docs-server 0.13.0 → 0.13.1-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 (104) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +7 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fagui.md +14 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +13 -13
  4. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +26 -26
  5. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +64 -64
  6. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +14 -14
  7. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +15 -15
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
  9. package/.docs/organized/changelogs/%40mastra%2Fcore.md +65 -65
  10. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +12 -0
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +82 -82
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +79 -79
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +77 -77
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +94 -94
  15. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +54 -0
  16. package/.docs/organized/changelogs/%40mastra%2Fevals.md +13 -13
  17. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +16 -16
  18. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +13 -13
  19. package/.docs/organized/changelogs/%40mastra%2Flance.md +12 -0
  20. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +13 -13
  21. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +47 -47
  22. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +37 -37
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +22 -22
  24. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +13 -13
  25. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +32 -32
  26. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +27 -27
  27. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +12 -0
  28. package/.docs/organized/changelogs/%40mastra%2Fpg.md +51 -51
  29. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +108 -108
  30. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +13 -13
  31. package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
  32. package/.docs/organized/changelogs/%40mastra%2Fragie.md +13 -13
  33. package/.docs/organized/changelogs/%40mastra%2Fserver.md +66 -66
  34. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +13 -13
  35. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +37 -37
  36. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +13 -13
  37. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +13 -13
  38. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +13 -13
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +13 -13
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +13 -13
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +14 -14
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +24 -24
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +13 -13
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +13 -13
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +13 -13
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +13 -13
  48. package/.docs/organized/changelogs/create-mastra.md +35 -35
  49. package/.docs/organized/changelogs/mastra.md +124 -124
  50. package/.docs/organized/code-examples/agent.md +5 -2
  51. package/.docs/organized/code-examples/agui.md +4 -1
  52. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
  53. package/.docs/organized/code-examples/fireworks-r1.md +1 -1
  54. package/.docs/organized/code-examples/memory-with-processors.md +2 -2
  55. package/.docs/organized/code-examples/openapi-spec-writer.md +1 -1
  56. package/.docs/organized/code-examples/quick-start.md +1 -1
  57. package/.docs/organized/code-examples/weather-agent.md +7 -1
  58. package/.docs/raw/course/01-first-agent/03-verifying-installation.md +4 -2
  59. package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +1 -1
  60. package/.docs/raw/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +1 -1
  61. package/.docs/raw/course/02-agent-tools-mcp/20-updating-mcp-config-hackernews.md +1 -1
  62. package/.docs/raw/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +1 -1
  63. package/.docs/raw/course/03-agent-memory/03-installing-memory.md +4 -2
  64. package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +1 -1
  65. package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +3 -3
  66. package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +27 -0
  67. package/.docs/raw/course/03-agent-memory/{13-what-is-semantic-recall.md → 14-what-is-semantic-recall.md} +1 -1
  68. package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +41 -0
  69. package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +28 -0
  70. package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +9 -9
  71. package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +10 -2
  72. package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +8 -1
  73. package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +8 -1
  74. package/.docs/raw/deployment/deployment.mdx +26 -97
  75. package/.docs/raw/deployment/overview.mdx +18 -3
  76. package/.docs/raw/deployment/web-framework.mdx +63 -0
  77. package/.docs/raw/frameworks/web-frameworks/astro.mdx +7 -1
  78. package/.docs/raw/frameworks/web-frameworks/next-js.mdx +1 -1
  79. package/.docs/raw/getting-started/installation.mdx +98 -558
  80. package/.docs/raw/getting-started/project-structure.mdx +3 -16
  81. package/.docs/raw/rag/vector-databases.mdx +4 -7
  82. package/.docs/raw/reference/agents/generate.mdx +35 -3
  83. package/.docs/raw/reference/agents/stream.mdx +35 -3
  84. package/.docs/raw/reference/client-js/memory.mdx +14 -0
  85. package/.docs/raw/reference/client-js/workflows.mdx +28 -0
  86. package/.docs/raw/reference/deployer/cloudflare.mdx +9 -3
  87. package/.docs/raw/reference/deployer/deployer.mdx +1 -1
  88. package/.docs/raw/reference/deployer/netlify.mdx +25 -4
  89. package/.docs/raw/reference/deployer/vercel.mdx +10 -4
  90. package/.docs/raw/workflows/control-flow.mdx +45 -171
  91. package/.docs/raw/workflows/input-data-mapping.mdx +21 -88
  92. package/.docs/raw/workflows/overview.mdx +24 -47
  93. package/.docs/raw/workflows/suspend-and-resume.mdx +46 -34
  94. package/.docs/raw/workflows/using-with-agents-and-tools.mdx +55 -191
  95. package/dist/_tsup-dts-rollup.d.ts +14 -0
  96. package/dist/{chunk-QWIXFGFR.js → chunk-P5AHYMUI.js} +126 -20
  97. package/dist/prepare-docs/prepare.js +1 -1
  98. package/dist/stdio.js +42 -17
  99. package/package.json +15 -15
  100. package/.docs/raw/course/03-agent-memory/15-configuring-semantic-recall.md +0 -46
  101. package/.docs/raw/course/03-agent-memory/16-vector-store-configuration.md +0 -37
  102. package/.docs/raw/course/03-agent-memory/18-disabling-semantic-recall.md +0 -24
  103. /package/.docs/raw/{deployment/client.mdx → client-js/overview.mdx} +0 -0
  104. /package/.docs/raw/course/03-agent-memory/{14-how-semantic-recall-works.md → 15-how-semantic-recall-works.md} +0 -0
@@ -29,19 +29,18 @@ When running a workflow, its `status` can be one of the following:
29
29
 
30
30
  When the state is `suspended`, you can identify any and all steps that have been suspended by looking at the `suspended` array of the workflow.
31
31
 
32
-
33
32
  ```typescript {17} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
34
- const cityCoordinatesStep = createStep({
35
- id: "city-step",
36
- description: "Gets details about a city",
33
+ const step1 = createStep({
34
+ id: "step-1",
35
+ description: "Test suspend",
37
36
  inputSchema: z.object({
38
- suggestions: z.array(z.string())
37
+ input: z.array(z.string())
39
38
  }),
40
39
  resumeSchema: z.object({
41
40
  city: z.string()
42
41
  }),
43
42
  outputSchema: z.object({
44
- outcome: z.string()
43
+ output: z.string()
45
44
  }),
46
45
  execute: async ({ resumeData, suspend }) => {
47
46
  const { city } = resumeData ?? {};
@@ -53,32 +52,19 @@ const cityCoordinatesStep = createStep({
53
52
  };
54
53
  }
55
54
 
56
- const geocodingResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}`);
57
- const geocodingData = await geocodingResponse.json();
58
-
59
- const { name, country, timezone } = geocodingData.results[0];
60
-
61
55
  return {
62
- outcome: `${name} | ${country} | ${timezone}`
56
+ output: ""
63
57
  };
64
58
  }
65
59
  });
66
60
 
67
- export const testWorkflow = createWorkflow({
68
- id: "test-workflow",
69
- description: 'Test workflow',
70
- inputSchema: z.object({
71
- suggestions: z.array(z.string()),
72
- }),
73
- outputSchema: z.object({
74
- outcome: z.string(),
75
- })
76
- })
77
- .then(cityCoordinatesStep)
61
+ export const testWorkflow = createWorkflow({})
62
+ .then(step1)
78
63
  .commit();
79
-
80
64
  ```
81
65
 
66
+ > See [Define Suspendable workflow](/examples/workflows/human-in-the-loop#define-suspendable-workflow) for more information.
67
+
82
68
  ## Resume
83
69
 
84
70
  A workflow can be resumed by calling `resume` and providing the required `resumeData`.
@@ -96,7 +82,7 @@ console.log(JSON.stringify(result, null, 2));
96
82
 
97
83
  if (result.status === "suspended") {
98
84
  const resumedResult = await run.resume({
99
- step: 'city-step',
85
+ step: 'step-1',
100
86
  resumeData: { city: "New York" }
101
87
  });
102
88
 
@@ -115,10 +101,40 @@ npx tsx src/test-workflow.ts
115
101
  To resume a suspended nested workflow pass the workflow instance to the `step` parameter of the `resume` function.
116
102
 
117
103
  ```typescript {3} filename="src/test-workflow.ts" showLineNumbers copy
104
+ const dowhileWorkflow = createWorkflow({
105
+ id: 'dowhile-workflow',
106
+ inputSchema: z.object({ value: z.number() }),
107
+ outputSchema: z.object({ value: z.number() }),
108
+ })
109
+ .dountil(
110
+ createWorkflow({
111
+ id: 'simple-resume-workflow',
112
+ inputSchema: z.object({ value: z.number() }),
113
+ outputSchema: z.object({ value: z.number() }),
114
+ steps: [incrementStep, resumeStep],
115
+ })
116
+ .then(incrementStep)
117
+ .then(resumeStep)
118
+ .commit(),
119
+ async ({ inputData }) => inputData.value >= 10,
120
+ )
121
+ .then(
122
+ createStep({
123
+ id: 'final',
124
+ inputSchema: z.object({ value: z.number() }),
125
+ outputSchema: z.object({ value: z.number() }),
126
+ execute: async ({ inputData }) => ({ value: inputData.value }),
127
+ }),
128
+ )
129
+ .commit();
130
+
131
+ const run = dowhileWorkflow.createRun();
132
+ const result = await run.start({ inputData: { value: 0 } });
133
+
118
134
  if (result.status === "suspended") {
119
- const resumedResult = await workflowRun.resume({
120
- step: [nestedWorkflow],
121
- resumeData: { city: "New York" }
135
+ const resumedResult = await run.resume({
136
+ resumeData: { value: 2 },
137
+ step: ['simple-resume-workflow', 'resume'],
122
138
  });
123
139
 
124
140
  console.log(JSON.stringify(resumedResult, null, 2));
@@ -130,7 +146,7 @@ if (result.status === "suspended") {
130
146
  When using suspend/resume with `RuntimeContext`, you can create the instance yourself, and pass it to the `start` and `resume` functions.
131
147
  `RuntimeContext` is not automatically shared on a workflow run.
132
148
 
133
- ```typescript {1,9,18} filename="src/test-workflow.ts" showLineNumbers copy
149
+ ```typescript {1,4,9,16} filename="src/test-workflow.ts" showLineNumbers copy
134
150
  import { RuntimeContext } from "@mastra/core/di";
135
151
  import { mastra } from "./mastra";
136
152
 
@@ -142,15 +158,11 @@ const result = await run.start({
142
158
  runtimeContext
143
159
  });
144
160
 
145
- console.log(JSON.stringify(result, null, 2));
146
-
147
161
  if (result.status === "suspended") {
148
162
  const resumedResult = await run.resume({
149
- step: 'city-step',
163
+ step: 'step-1',
150
164
  resumeData: { city: "New York" },
151
165
  runtimeContext
152
166
  });
153
-
154
- console.log(JSON.stringify(resumedResult, null, 2));
155
167
  }
156
168
  ```
@@ -28,144 +28,82 @@ import { Agent } from "@mastra/core/agent";
28
28
 
29
29
  export const testAgent = new Agent({
30
30
  name: "test-agent",
31
- description: "Create facts for input city, country and timezone",
32
- instructions: `
33
- You are a helpful and factual assistant.
34
-
35
- You will be given a city, country, and timezone. Return exactly one interesting fact about each of the three values.
36
-
37
- Your response must follow this exact format:
38
-
39
- City Fact: <a short paragraph about the city>
40
- Country Fact: <a short paragraph about the country>
41
- Timezone Fact: <a short paragraph about the timezone>
42
-
43
- Only return the three facts in plain text, with each label clearly marked. No additional commentary or formatting.
44
- Ensure all facts are accurate and sourced from reputable references.
45
- `,
31
+ description: "Create facts for a country based on the city",
32
+ instructions: `Return an interesting fact about the country based on the city provided`,
46
33
  model: openai("gpt-4o")
47
34
  });
48
35
  ```
49
36
 
50
37
  ### Agents As Step
51
38
 
52
- In this example the `cityCoordinatesStep` performs a geocoding lookup using the provided `city`, then returns the resolved `city`, `country`, and `timezone`.
39
+ In this example, `step1` uses the `testAgent` to generate an interesting fact about the country based on a given city.
53
40
 
54
- The `.map` function transforms the object output into a `prompt` string that can be used by the `testAgent`.
41
+ The `.map` method transforms the workflow input into a `prompt` string compatible with the `testAgent`.
55
42
 
56
- The step is composed into the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output.
43
+ The step is composed into the workflow using `.then()`, allowing it to receive the mapped input and return the agent's structured output. The workflow is finalized with `.commit()`.
57
44
 
58
- ```typescript {1,29,42,52} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
59
- import { testAgent } from "../agents/test-agent";
60
45
 
61
- const cityCoordinatesStep = createStep({
62
- id: "city-step",
63
- description: "Gets details about a city",
64
- inputSchema: z.object({
65
- city: z.string()
66
- }),
67
- outputSchema: z.object({
68
- city_name: z.string(),
69
- country_name: z.string(),
70
- country_timezone: z.string()
71
- }),
72
- execute: async ({ inputData }) => {
73
- const { city } = inputData;
74
- const geocodingResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}`);
75
- const geocodingData = await geocodingResponse.json();
76
-
77
- const { name, country, timezone } = geocodingData.results[0];
78
-
79
- return {
80
- city_name: name,
81
- country_name: country,
82
- country_timezone: timezone
83
- };
84
- }
85
- });
46
+ ```typescript {3} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
47
+ import { testAgent } from "../agents/test-agent";
86
48
 
87
- const cityFactsStep = createStep(testAgent);
49
+ const step1 = createStep(testAgent);
88
50
 
89
51
  export const testWorkflow = createWorkflow({
90
52
  id: "test-workflow",
91
53
  description: 'Test workflow',
92
54
  inputSchema: z.object({
93
- city: z.string()
55
+ input: z.string()
94
56
  }),
95
57
  outputSchema: z.object({
96
- outcome: z.string()
58
+ output: z.string()
97
59
  })
98
60
  })
99
- .then(cityCoordinatesStep)
100
61
  .map(({ inputData }) => {
101
- const { city_name, country_name, country_timezone } = inputData;
62
+ const { input } = inputData;
102
63
  return {
103
- prompt: `
104
- Provide facts about the city: ${city_name},
105
- country: ${country_name}
106
- and timezone: ${country_timezone}
107
- `
64
+ prompt: `Provide facts about the city: ${input}`
108
65
  };
109
66
  })
110
- .then(cityFactsStep)
67
+ .then(step1)
111
68
  .commit();
112
69
  ```
113
70
 
114
71
  ### Agent Generate
115
72
 
116
- In this example, the `cityFactsStep` performs a geocoding lookup using the provided `city`, then builds a prompt combining the resolved `city`, `country`, and `timezone`.
117
-
118
- This prompt is passed to the `testAgent`, which generates a plain-text response with one fact for each.
73
+ In this example, the `step1` builds a prompt using the provided `input` and passes it to the `testAgent`, which returns a plain-text response containing facts about the city and its country.
119
74
 
120
- The step is composed into the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output.
75
+ The step is added to the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output. The workflow is finalized with `.commit()`.
121
76
 
122
- ```typescript {1,26,46} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
77
+ ```typescript {1,18, 29} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
123
78
  import { testAgent } from "../agents/test-agent";
124
79
 
125
- const cityFactsStep = createStep({
126
- id: "city-facts-step",
127
- description: "Returns facts about city, country and timezone from the agent",
80
+ const step1 = createStep({
81
+ id: "step-1",
82
+ description: "Create facts for a country based on the city",
128
83
  inputSchema: z.object({
129
- city: z.string()
84
+ input: z.string()
130
85
  }),
131
86
  outputSchema: z.object({
132
- outcome: z.string()
87
+ output: z.string()
133
88
  }),
134
89
 
135
90
  execute: async ({ inputData }) => {
136
- const { city } = inputData;
137
- const geocodingResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}`);
138
- const geocodingData = await geocodingResponse.json();
91
+ const { input } = inputData;
139
92
 
140
- const { name, country, timezone } = geocodingData.results[0];
141
-
142
- const prompt = `
143
- Provide facts about the city: ${city_name},
144
- country: ${country_name}
145
- and timezone: ${country_timezone}
146
- `;
93
+ const prompt = `Provide facts about the city: ${input}`
147
94
 
148
95
  const { text } = await testAgent.generate([
149
96
  { role: "user", content: prompt }
150
97
  ]);
151
98
 
152
99
  return {
153
- outcome: text
100
+ output: text
154
101
  };
155
102
  }
156
103
  });
157
104
 
158
- export const testWorkflow = createWorkflow({
159
- id: "test-workflow",
160
- description: 'Test workflow',
161
- inputSchema: z.object({
162
- city: z.string()
163
- }),
164
- outputSchema: z.object({
165
- outcome: z.string()
166
- })
167
- })
168
- .then(cityFactsStep)
105
+ export const testWorkflow = createWorkflow({...})
106
+ .then(step1)
169
107
  .commit();
170
108
  ```
171
109
 
@@ -182,158 +120,84 @@ import { createTool } from "@mastra/core";
182
120
  import { z } from "zod";
183
121
 
184
122
  export const testTool = createTool({
185
- id: "city-tool",
186
- description: "Gets coordinates for city",
123
+ id: "test-tool",
124
+ description: "Gets country for a city",
187
125
  inputSchema: z.object({
188
- city: z.string()
126
+ input: z.string()
189
127
  }),
190
128
  outputSchema: z.object({
191
- city_name: z.string(),
192
- country_name: z.string(),
193
- country_timezone: z.string()
129
+ country_name: z.string()
194
130
  }),
195
131
  execute: async ({ context }) => {
196
- const { city } = context;
197
- const geocodingResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}`);
132
+ const { input } = context;
133
+ const geocodingResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${input}`);
198
134
  const geocodingData = await geocodingResponse.json();
199
135
 
200
- const { name, country, timezone } = geocodingData.results[0];
136
+ const { country } = geocodingData.results[0];
201
137
 
202
138
  return {
203
- city_name: name,
204
- country_name: country,
205
- country_timezone: timezone
139
+ country_name: country
206
140
  };
207
141
  }
208
142
  });
209
143
  ```
210
144
 
211
145
 
212
- ### Tools As Step
213
-
214
- In this example, the `cityCoordinatesStep` uses the above example `testTool` which performs a geocoding lookup using the provided `city`, then returns the resolved `city`, `country`, and `timezone`.
146
+ ### Tools as Step
215
147
 
148
+ In this example, `step1` uses the `testTool`, which performs a geocoding lookup using the provided `city` and returns the resolved `country`.
216
149
 
217
- The `.map` function transforms the object output into a prompt string that can be used by the testAgent.
150
+ The step is added to the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output. The workflow is finalized with `.commit()`.
218
151
 
219
- The step is composed into the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output.
220
-
221
- ```typescript {2,4,40,51} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
222
- import { testAgent } from "../agents/test-agent";
152
+ ```typescript {1,3,6} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
223
153
  import { testTool } from "../tools/test-tool";
224
154
 
225
- const cityCoordinatesStep = createStep(testTool);
226
-
227
- const cityFactsStep = createStep({
228
- id: "city-facts-step",
229
- description: "Returns facts about city, country and timezone from the agent",
230
- inputSchema: z.object({
231
- prompt: z.string()
232
- }),
233
- outputSchema: z.object({
234
- outcome: z.string()
235
- }),
236
-
237
- execute: async ({ inputData }) => {
238
- const { prompt } = inputData;
155
+ const step1 = createStep(testTool);
239
156
 
240
- const { text } = await testAgent.generate([
241
- { role: "user", content: prompt }
242
- ]);
243
-
244
- return {
245
- outcome: text
246
- };
247
- }
248
- });
249
-
250
- export const testWorkflow = createWorkflow({
251
- id: "test-workflow",
252
- description: "Test workflow",
253
- inputSchema: z.object({
254
- city: z.string()
255
- }),
256
- outputSchema: z.object({
257
- outcome: z.string()
258
- })
259
- })
260
- .then(cityCoordinatesStep)
261
- .map(({ inputData }) => {
262
- const { city_name, country_name, country_timezone } = inputData;
263
-
264
- return {
265
- prompt: `
266
- Provide facts about the city: ${city_name},
267
- country: ${country_name}
268
- and timezone: ${country_timezone}
269
- `
270
- };
271
- })
272
- .then(cityFactsStep)
157
+ export const testWorkflow = createWorkflow({...})
158
+ .then(step1)
273
159
  .commit();
274
160
  ```
275
161
 
276
162
  ### Tool Execute
277
163
 
278
- In this example, the `cityFactsStep` uses the above example `testTool` which performs a geocoding lookup using the provided `city`, then builds a prompt combining the resolved `city`, `country`, and `timezone`.
279
-
280
- This prompt is passed to the `testAgent`, which generates a plain-text response with one fact for each.
164
+ In this example, `step1` directly invokes `testTool` using its `.execute()` method. The tool performs a geocoding lookup with the provided `city` and returns the corresponding `country`.
281
165
 
282
- The step is composed into the workflow using the sequential `.then()` method, allowing it to receive input from the workflow and return structured output.
166
+ The result is returned as structured output from the step. The step is composed into the workflow using `.then()`, enabling it to process workflow input and produce typed output. The workflow is finalized with `.commit()`
283
167
 
284
- ```typescript {4,21,33,52} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
168
+ ```typescript {3,20,32} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
285
169
  import { RuntimeContext } from "@mastra/core/di";
286
170
 
287
- import { testAgent } from "../agents/test-agent";
288
171
  import { testTool } from "../tools/test-tool";
289
172
 
290
173
  const runtimeContext = new RuntimeContext();
291
174
 
292
- const cityFactsStep = createStep({
293
- id: "city-facts-step",
294
- description: "Returns facts about city, country and timezone from the agent",
175
+ const step1 = createStep({
176
+ id: "step-1",
177
+ description: "Gets country for a city",
295
178
  inputSchema: z.object({
296
- city: z.string()
179
+ input: z.string()
297
180
  }),
298
181
  outputSchema: z.object({
299
- outcome: z.string()
182
+ output: z.string()
300
183
  }),
301
184
 
302
185
  execute: async ({ inputData }) => {
303
- const { city } = inputData;
186
+ const { input } = inputData;
304
187
 
305
- const { city_name, country_name, country_timezone } = await testTool.execute({
306
- context: { city },
188
+ const { country_name } = await testTool.execute({
189
+ context: { input },
307
190
  runtimeContext
308
191
  });
309
192
 
310
- const prompt = `
311
- Provide facts about the city: ${city_name},
312
- country: ${country_name}
313
- and timezone: ${country_timezone}
314
- `;
315
-
316
- const { text } = await testAgent.generate([
317
- { role: "user", content: prompt }
318
- ]);
319
-
320
193
  return {
321
- outcome: text
194
+ output: country_name
322
195
  };
323
196
  }
324
197
  });
325
198
 
326
- export const testWorkflow = createWorkflow({
327
- id: "test-workflow",
328
- description: 'Test workflow',
329
- inputSchema: z.object({
330
- city: z.string()
331
- }),
332
- outputSchema: z.object({
333
- outcome: z.string()
334
- })
335
- })
336
- .then(cityFactsStep)
199
+ export const testWorkflow = createWorkflow({...})
200
+ .then(step1)
337
201
  .commit();
338
202
  ```
339
203
 
@@ -100,10 +100,13 @@ export declare type DocsInput = z.infer<typeof docsInputSchema>;
100
100
 
101
101
  export declare const docsInputSchema: z.ZodObject<{
102
102
  paths: z.ZodArray<z.ZodString, "many">;
103
+ queryKeywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
103
104
  }, "strip", z.ZodTypeAny, {
104
105
  paths: string[];
106
+ queryKeywords?: string[] | undefined;
105
107
  }, {
106
108
  paths: string[];
109
+ queryKeywords?: string[] | undefined;
107
110
  }>;
108
111
 
109
112
  export declare const docsTool: {
@@ -111,10 +114,13 @@ export declare const docsTool: {
111
114
  description: string;
112
115
  parameters: z.ZodObject<{
113
116
  paths: z.ZodArray<z.ZodString, "many">;
117
+ queryKeywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
114
118
  }, "strip", z.ZodTypeAny, {
115
119
  paths: string[];
120
+ queryKeywords?: string[] | undefined;
116
121
  }, {
117
122
  paths: string[];
123
+ queryKeywords?: string[] | undefined;
118
124
  }>;
119
125
  execute: (args: DocsInput) => Promise<string>;
120
126
  };
@@ -123,9 +129,12 @@ export declare type ExamplesInput = z.infer<typeof examplesInputSchema>;
123
129
 
124
130
  export declare const examplesInputSchema: z.ZodObject<{
125
131
  example: z.ZodOptional<z.ZodString>;
132
+ queryKeywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
126
133
  }, "strip", z.ZodTypeAny, {
134
+ queryKeywords?: string[] | undefined;
127
135
  example?: string | undefined;
128
136
  }, {
137
+ queryKeywords?: string[] | undefined;
129
138
  example?: string | undefined;
130
139
  }>;
131
140
 
@@ -134,9 +143,12 @@ export declare const examplesTool: {
134
143
  description: string;
135
144
  parameters: z.ZodObject<{
136
145
  example: z.ZodOptional<z.ZodString>;
146
+ queryKeywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
137
147
  }, "strip", z.ZodTypeAny, {
148
+ queryKeywords?: string[] | undefined;
138
149
  example?: string | undefined;
139
150
  }, {
151
+ queryKeywords?: string[] | undefined;
140
152
  example?: string | undefined;
141
153
  }>;
142
154
  execute: (args: ExamplesInput) => Promise<string>;
@@ -153,6 +165,8 @@ export declare const getMastraCourseStatus: {
153
165
  execute: (_args: Record<string, never>) => Promise<string>;
154
166
  };
155
167
 
168
+ export declare function getMatchingPaths(path: string, queryKeywords: string[], baseDir: string): Promise<string>;
169
+
156
170
  export declare const log: {
157
171
  (...data: any[]): void;
158
172
  (message?: any, ...optionalParams: any[]): void;