@mastra/mcp-docs-server 0.0.1 → 0.0.2-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 (71) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fastra.md +25 -25
  2. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +25 -25
  3. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +27 -27
  4. package/.docs/organized/changelogs/%40mastra%2Fcomposio.md +25 -25
  5. package/.docs/organized/changelogs/%40mastra%2Fcore.md +24 -24
  6. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +37 -37
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +37 -37
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +37 -37
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +36 -36
  10. package/.docs/organized/changelogs/%40mastra%2Fevals.md +25 -25
  11. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +29 -29
  12. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +25 -25
  13. package/.docs/organized/changelogs/%40mastra%2Floggers.md +25 -25
  14. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +26 -0
  15. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +25 -25
  16. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +25 -25
  17. package/.docs/organized/changelogs/%40mastra%2Fpg.md +25 -25
  18. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +29 -29
  19. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +34 -34
  20. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +25 -25
  21. package/.docs/organized/changelogs/%40mastra%2Frag.md +27 -27
  22. package/.docs/organized/changelogs/%40mastra%2Fragie.md +25 -25
  23. package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +25 -25
  24. package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +25 -25
  25. package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +25 -25
  26. package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +25 -25
  27. package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +25 -25
  28. package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +25 -25
  29. package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +25 -25
  30. package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +25 -25
  31. package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +25 -25
  32. package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +25 -25
  33. package/.docs/organized/changelogs/%40mastra%2Fstabilityai.md +25 -25
  34. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +24 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +25 -25
  36. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +25 -25
  37. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +25 -25
  38. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +25 -25
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +25 -25
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +25 -25
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +26 -0
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +25 -25
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +25 -25
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +25 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +25 -25
  46. package/.docs/organized/changelogs/create-mastra.md +16 -16
  47. package/.docs/organized/changelogs/mastra.md +52 -52
  48. package/.docs/organized/code-examples/agent.md +8 -3
  49. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -0
  50. package/.docs/organized/code-examples/weather-agent.md +1 -0
  51. package/.docs/raw/deployment/client.mdx +120 -0
  52. package/.docs/raw/deployment/server.mdx +1 -1
  53. package/.docs/raw/evals/00-overview.mdx +58 -75
  54. package/.docs/raw/evals/01-textual-evals.mdx +53 -0
  55. package/.docs/raw/evals/02-custom-eval.mdx +6 -170
  56. package/.docs/raw/evals/03-running-in-ci.mdx +78 -0
  57. package/.docs/raw/getting-started/installation.mdx +24 -13
  58. package/.docs/raw/getting-started/mcp-docs-server.mdx +138 -0
  59. package/.docs/raw/index.mdx +2 -2
  60. package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
  61. package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
  62. package/.docs/raw/local-dev/mastra-dev.mdx +78 -35
  63. package/.docs/raw/reference/agents/createTool.mdx +128 -89
  64. package/.docs/raw/reference/agents/stream.mdx +19 -18
  65. package/.docs/raw/reference/cli/dev.mdx +58 -21
  66. package/.docs/raw/storage/overview.mdx +331 -0
  67. package/package.json +2 -2
  68. package/.docs/raw/evals/01-supported-evals.mdx +0 -31
  69. package/.docs/raw/local-dev/creating-projects.mdx +0 -74
  70. package/.docs/raw/reference/client-js/index.mdx +0 -127
  71. /package/.docs/raw/{local-dev/integrations.mdx → integrations/index.mdx} +0 -0
@@ -1,65 +1,108 @@
1
1
  ---
2
2
  title: "Inspecting Agents with `mastra dev` | Mastra Local Dev Docs"
3
- description: Documentation for the mastra dev command, which launches a local development server for Mastra applications.
3
+ description: Documentation for the Mastra local development environment for Mastra applications.
4
4
  ---
5
+ import YouTube from "../../../components/youtube";
5
6
 
6
- # Inspecting agents and workflows with `mastra Dev`
7
+ # Local Development Environment
7
8
 
8
- The `mastra dev` command launches a development server that serves your Mastra application locally.
9
+ Mastra provides a local development environment where you can test your agents, workflows, and tools while developing locally.
9
10
 
10
- ## REST API Endpoints
11
+ <YouTube id="spGlcTEjuXY" />
11
12
 
12
- `mastra dev` spins up REST API endpoints for your agents and workflows, such as:
13
+ ## Launch Development Server
13
14
 
14
- - `POST /api/agents/:agentId/generate`
15
- - `POST /api/agents/:agentId/stream`
16
- - `POST /api/workflows/:workflowId/start`
17
- - `POST /api/workflows/:workflowId/:instanceId/event`
18
- - `GET /api/workflows/:workflowId/:instanceId/status`
15
+ You can launch the Mastra development environment using the Mastra CLI by running:
16
+
17
+ ```bash
18
+ mastra dev
19
+ ```
19
20
 
20
21
  By default, the server runs at http://localhost:4111, but you can change the port with the `--port` flag.
21
22
 
22
- ## Using the Client SDK
23
+ ## Dev Playground
23
24
 
24
- The easiest way to interact with your local Mastra server is through our [TypeScript/JavaScript Client SDK](/docs/reference/client-js). Install it with:
25
+ `mastra dev` serves a playground UI for interacting with your agents, workflows, and tools. The playground provides dedicated interfaces for testing each component of your Mastra application during development.
25
26
 
26
- ```bash
27
- npm install @mastra/client-js
28
- ```
27
+ ### Agent Playground
29
28
 
30
- Then configure it to point to your local server:
29
+ The Agent playground provides an interactive chat interface where you can test and debug your agents during development. Key features include:
31
30
 
32
- ```typescript
33
- import { MastraClient } from "@mastra/client-js";
31
+ - **Chat Interface**: Directly interact with your agents to test their responses and behavior.
32
+ - **Prompt CMS**: Experiment with different system instructions for your agent:
33
+ - A/B test different prompt versions.
34
+ - Track performance metrics for each variant.
35
+ - Select and deploy the most effective prompt version.
36
+ - **Agent Traces**: View detailed execution traces to understand how your agent processes requests, including:
37
+ - Prompt construction.
38
+ - Tool usage.
39
+ - Decision-making steps.
40
+ - Response generation.
41
+ - **Agent Evals**: When you've set up [Agent evaluation metrics](/docs/evals/00-overview), you can:
42
+ - Run evaluations directly from the playground.
43
+ - View evaluation results and metrics.
44
+ - Compare agent performance across different test cases.
34
45
 
35
- const client = new MastraClient({
36
- baseUrl: "http://localhost:4111",
37
- });
46
+ ### Workflow Playground
38
47
 
39
- // Example: Interact with a local agent
40
- const agent = client.getAgent("my-agent");
41
- const response = await agent.generate({
42
- messages: [{ role: "user", content: "Hello!" }],
43
- });
44
- ```
48
+ The Workflow playground helps you visualize and test your workflow implementations:
49
+
50
+ - **Workflow Visualization**: Workflow graph visualization.
51
+
52
+ - **Run Workflows**:
53
+ - Trigger test workflow runs with custom input data.
54
+ - Debug workflow logic and conditions.
55
+ - Simulate different execution paths.
56
+ - View detailed execution logs for each step.
45
57
 
46
- The client SDK provides type-safe wrappers for all API endpoints, making it much easier to develop and test your Mastra applications locally.
58
+ - **Workflow Traces**: Examine detailed execution traces that show:
59
+ - Step-by-step workflow progression.
60
+ - State transitions and data flow.
61
+ - Tool invocations and their results.
62
+ - Decision points and branching logic.
63
+ - Error handling and recovery paths.
47
64
 
48
- ## UI Playground
65
+ ### Tools Playground
49
66
 
50
- `mastra dev` creates a UI with an agent chat interface, a workflow visualizer and a tool playground.
67
+ The Tools playground allows you to test your custom tools in isolation:
51
68
 
52
- {/* TODO: Record a quick tour video here */}
69
+ - Test individual tools without running a full agent or workflow.
70
+ - Input test data and view tool responses.
71
+ - Debug tool implementation and error handling.
72
+ - Verify tool input/output schemas.
73
+ - Monitor tool performance and execution time.
74
+
75
+ ## REST API Endpoints
76
+
77
+ `mastra dev` also spins up REST API routes for your agents and workflows via the local [Mastra Server](/docs/deployment/server). This allows you to test your API endpoints before deployment. See [Mastra Dev reference](http://localhost:3000/docs/reference/cli/dev#routes) for more details about all endpoints.
78
+
79
+ You can then leverage the [Mastra Client](/docs/deployment/client) SDK to interact with your served REST API routes seamlessly.
53
80
 
54
81
  ## OpenAPI Specification
55
82
 
56
- `mastra dev` provides an OpenAPI spec at:
83
+ `mastra dev` provides an OpenAPI spec at http://localhost:4111/openapi.json
84
+
85
+ ## Local Dev Architecture
86
+
87
+ The local development server is designed to run without any external dependencies or containerization. This is achieved through:
88
+
89
+ - **Dev Server**: Uses [Hono](https://hono.dev) as the underlying framework to power the [Mastra Server](/docs/deployment/server).
90
+
91
+ - **In-Memory Storage**: Uses [LibSQL](https://libsql.org/) memory adapters for:
92
+ - Agent memory management.
93
+ - Trace storage.
94
+ - Evals storage.
95
+ - Workflow snapshots.
96
+
97
+ - **Vector Storage**: Uses [FastEmbed](https://github.com/qdrant/fastembed) for:
98
+ - Default embedding generation.
99
+ - Vector storage and retrieval.
100
+ - Semantic search capabilities.
57
101
 
58
- - `GET /openapi.json`
102
+ This architecture allows you to start developing immediately without setting up databases or vector stores, while still maintaining production-like behavior in your local environment.
59
103
 
60
104
  ## Summary
61
105
 
62
106
  `mastra dev` makes it easy to develop, debug, and iterate on your AI logic in a self-contained environment before deploying to production.
63
107
 
64
- - [Mastra Dev reference](../reference/cli/dev.mdx)
65
- - [Client SDK documentation](/docs/reference/client-js)
108
+ - [Mastra Dev reference](../reference/cli/dev.mdx)
@@ -5,140 +5,162 @@ description: Documentation for the createTool function in Mastra, which creates
5
5
 
6
6
  # `createTool()`
7
7
 
8
- Tools are typed functions that can be executed by agents or workflows, with built-in integration access and parameter validation. Each tool has a schema that defines its inputs, an executor function that implements its logic, and access to configured integrations.
8
+ The `createTool()` function creates typed tools that can be executed by agents or workflows. Tools have built-in schema validation, execution context, and integration with the Mastra ecosystem.
9
9
 
10
- ```ts filename="src/mastra/tools/index.ts" showLineNumbers copy
11
- import { createTool } from "@mastra/core/logger";
10
+ ## Overview
11
+
12
+ Tools are a fundamental building block in Mastra that allow agents to interact with external systems, perform computations, and access data. Each tool has:
13
+
14
+ - A unique identifier
15
+ - A description that helps the AI understand when and how to use the tool
16
+ - Optional input and output schemas for validation
17
+ - An execution function that implements the tool's logic
18
+
19
+ ## Example Usage
20
+
21
+ ```ts filename="src/tools/stock-tools.ts" showLineNumbers copy
22
+ import { createTool } from "@mastra/core/tools";
12
23
  import { z } from "zod";
13
24
 
25
+ // Helper function to fetch stock data
14
26
  const getStockPrice = async (symbol: string) => {
15
- const data = await fetch(
16
- `https://mastra-stock-data.vercel.app/api/stock-data?symbol=${symbol}`,
17
- ).then((r) => r.json());
27
+ const response = await fetch(
28
+ `https://mastra-stock-data.vercel.app/api/stock-data?symbol=${symbol}`
29
+ );
30
+ const data = await response.json();
18
31
  return data.prices["4. close"];
19
32
  };
20
33
 
21
- export const stockPrices = createTool({
22
- id: "Get Stock Price",
34
+ // Create a tool to get stock prices
35
+ export const stockPriceTool = createTool({
36
+ id: "getStockPrice",
37
+ description: "Fetches the current stock price for a given ticker symbol",
23
38
  inputSchema: z.object({
39
+ symbol: z.string().describe("The stock ticker symbol (e.g., AAPL, MSFT)")
40
+ }),
41
+ outputSchema: z.object({
24
42
  symbol: z.string(),
43
+ price: z.number(),
44
+ currency: z.string(),
45
+ timestamp: z.string()
25
46
  }),
26
- description: `Fetches the last day's closing stock price for a given symbol`,
27
47
  execute: async ({ context }) => {
28
- console.log("Using tool to fetch stock price for", context.symbol);
48
+ const price = await getStockPrice(context.symbol);
49
+
29
50
  return {
30
51
  symbol: context.symbol,
31
- currentPrice: await getStockPrice(context.symbol),
52
+ price: parseFloat(price),
53
+ currency: "USD",
54
+ timestamp: new Date().toISOString()
32
55
  };
33
- },
56
+ }
34
57
  });
35
58
 
36
- export const threadInfo = createTool({
37
- id: "Get Thread Info",
59
+ // Create a tool that uses the thread context
60
+ export const threadInfoTool = createTool({
61
+ id: "getThreadInfo",
62
+ description: "Returns information about the current conversation thread",
38
63
  inputSchema: z.object({
39
- includeResource: z.boolean().optional(),
64
+ includeResource: z.boolean().optional().default(false)
40
65
  }),
41
- description: `Gets information about the current conversation thread`,
42
66
  execute: async ({ context, threadId, resourceId }) => {
43
- console.log("Current thread:", threadId);
44
- console.log("Current resource:", resourceId);
45
-
46
67
  return {
47
68
  threadId,
48
69
  resourceId: context.includeResource ? resourceId : undefined,
70
+ timestamp: new Date().toISOString()
49
71
  };
50
- },
72
+ }
51
73
  });
52
74
  ```
53
75
 
54
- ## API Signature
76
+ ## API Reference
55
77
 
56
78
  ### Parameters
57
79
 
80
+ `createTool()` accepts a single object with the following properties:
81
+
58
82
  <PropertiesTable
59
83
  content={[
60
84
  {
61
- name: "label",
85
+ name: "id",
62
86
  type: "string",
63
87
  required: true,
64
- description: 'Name of the tool (e.g., "Get Stock Prices")',
65
- },
66
- {
67
- name: "schema",
68
- type: "ZodSchema",
69
- required: true,
70
- description: "Zod schema for validating inputs",
88
+ description: "Unique identifier for the tool. This should be descriptive of the tool's function."
71
89
  },
72
90
  {
73
91
  name: "description",
74
92
  type: "string",
75
93
  required: true,
76
- description: "Clear explanation of what market data the tool provides",
94
+ description: "Detailed description of what the tool does, when it should be used, and what inputs it requires. This helps the AI understand how to use the tool effectively."
77
95
  },
78
96
  {
79
- name: "executor",
80
- type: "(params: ExecutorParams) => Promise<any>",
81
- required: true,
82
- description: "Async function that fetches the requested market data",
97
+ name: "execute",
98
+ type: "(context: ToolExecutionContext, options?: any) => Promise<any>",
99
+ required: false,
100
+ description: "Async function that implements the tool's logic. Receives the execution context and optional configuration.",
83
101
  properties: [
84
102
  {
85
- type: "ExecutorParams",
103
+ type: "ToolExecutionContext",
86
104
  parameters: [
87
105
  {
88
- name: "data",
106
+ name: "context",
89
107
  type: "object",
90
- description: "The validated input data (in this case, symbol)",
91
- },
92
- {
93
- name: "integrationsRegistry",
94
- type: "function",
95
- description: "Function to get connected integrations",
108
+ description: "The validated input data that matches the inputSchema"
96
109
  },
97
110
  {
98
- name: "runId",
111
+ name: "threadId",
99
112
  type: "string",
100
113
  isOptional: true,
101
- description: "The runId of the current run",
114
+ description: "Identifier for the conversation thread, if available"
102
115
  },
103
116
  {
104
- name: "threadId",
117
+ name: "resourceId",
105
118
  type: "string",
106
119
  isOptional: true,
107
- description:
108
- "Identifier for the conversation thread. Allows for maintaining context across multiple interactions.",
120
+ description: "Identifier for the user or resource interacting with the tool"
109
121
  },
110
122
  {
111
- name: "resourceId",
112
- type: "string",
123
+ name: "mastra",
124
+ type: "Mastra",
113
125
  isOptional: true,
114
- description:
115
- "Identifier for the user or resource interacting with the tool.",
126
+ description: "Reference to the Mastra instance, if available"
116
127
  },
128
+ ]
129
+ },
130
+ {
131
+ type: "ToolOptions",
132
+ parameters: [
117
133
  {
118
- name: "agents",
119
- type: "Map<string, Agent<any>>",
120
- description: "Map of registered agents",
134
+ name: "toolCallId",
135
+ type: "string",
136
+ description: "The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data."
121
137
  },
122
138
  {
123
- name: "engine",
124
- isOptional: true,
125
- type: "MastraEngine",
126
- description: "Mastra engine instance",
139
+ name: "messages",
140
+ type: "CoreMessage[]",
141
+ description: "Messages that were sent to the language model to initiate the response that contained the tool call. The messages do not include the system prompt nor the assistant response that contained the tool call."
127
142
  },
128
143
  {
129
- name: "llm",
130
- type: "LLM",
131
- description: "LLM instance",
144
+ name: "abortSignal",
145
+ type: "AbortSignal",
146
+ isOptional: true,
147
+ description: "An optional abort signal that indicates that the overall operation should be aborted."
132
148
  },
133
- ],
134
- },
135
- ],
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ name: "inputSchema",
155
+ type: "ZodSchema",
156
+ required: false,
157
+ description: "Zod schema that defines and validates the tool's input parameters. If not provided, the tool will accept any input."
136
158
  },
137
159
  {
138
160
  name: "outputSchema",
139
161
  type: "ZodSchema",
140
- isOptional: true,
141
- description: "Zod schema for validating outputs",
162
+ required: false,
163
+ description: "Zod schema that defines and validates the tool's output. Helps ensure the tool returns data in the expected format."
142
164
  },
143
165
  ]}
144
166
  />
@@ -148,43 +170,60 @@ export const threadInfo = createTool({
148
170
  <PropertiesTable
149
171
  content={[
150
172
  {
151
- name: "ToolApi",
152
- type: "object",
153
- description:
154
- "The tool API object that includes the schema, label, description, and executor function.",
173
+ name: "Tool",
174
+ type: "Tool<TSchemaIn, TSchemaOut>",
175
+ description: "A Tool instance that can be used with agents, workflows, or directly executed.",
155
176
  properties: [
156
177
  {
157
- type: "ToolApi",
178
+ type: "Tool",
158
179
  parameters: [
159
180
  {
160
- name: "schema",
161
- type: "ZodSchema<IN>",
162
- description: "Zod schema for validating inputs.",
163
- },
164
- {
165
- name: "label",
181
+ name: "id",
166
182
  type: "string",
167
- description: "Name of the tool.",
183
+ description: "The tool's unique identifier"
168
184
  },
169
185
  {
170
186
  name: "description",
171
187
  type: "string",
172
- description: "Description of the tool's functionality.",
188
+ description: "Description of the tool's functionality"
189
+ },
190
+ {
191
+ name: "inputSchema",
192
+ type: "ZodSchema | undefined",
193
+ description: "Schema for validating inputs"
173
194
  },
174
195
  {
175
196
  name: "outputSchema",
176
- type: "ZodSchema<OUT>",
177
- isOptional: true,
178
- description: "Zod schema for validating outputs.",
197
+ type: "ZodSchema | undefined",
198
+ description: "Schema for validating outputs"
179
199
  },
180
200
  {
181
201
  name: "execute",
182
- type: "(params: IntegrationApiExcutorParams<IN>) => Promise<OUT>",
183
- description: "Async function that executes the tool's logic.",
184
- },
185
- ],
186
- },
187
- ],
188
- },
202
+ type: "Function",
203
+ description: "The tool's execution function"
204
+ }
205
+ ]
206
+ }
207
+ ]
208
+ }
189
209
  ]}
190
210
  />
211
+
212
+ ## Type Safety
213
+
214
+ The `createTool()` function provides full type safety through TypeScript generics:
215
+
216
+ - Input types are inferred from the `inputSchema`
217
+ - Output types are inferred from the `outputSchema`
218
+ - The execution context is properly typed based on the input schema
219
+
220
+ This ensures that your tools are type-safe throughout your application.
221
+
222
+ ## Best Practices
223
+
224
+ 1. **Descriptive IDs**: Use clear, action-oriented IDs like `getWeatherForecast` or `searchDatabase`
225
+ 2. **Detailed Descriptions**: Provide comprehensive descriptions that explain when and how to use the tool
226
+ 3. **Input Validation**: Use Zod schemas to validate inputs and provide helpful error messages
227
+ 4. **Error Handling**: Implement proper error handling in your execute function
228
+ 5. **Idempotency**: When possible, make your tools idempotent (same input always produces same output)
229
+ 6. **Performance**: Keep tools lightweight and fast to execute
@@ -238,12 +238,6 @@ Settings for telemetry collection during streaming:
238
238
 
239
239
  <PropertiesTable
240
240
  content={[
241
- {
242
- name: "functionId",
243
- type: "string",
244
- isOptional: true,
245
- description: "Identifier for this function. Used to group telemetry data by function.",
246
- },
247
241
  {
248
242
  name: "isEnabled",
249
243
  type: "boolean",
@@ -251,12 +245,6 @@ Settings for telemetry collection during streaming:
251
245
  defaultValue: "false",
252
246
  description: "Enable or disable telemetry. Disabled by default while experimental.",
253
247
  },
254
- {
255
- name: "metadata",
256
- type: "Record<string, AttributeValue>",
257
- isOptional: true,
258
- description: "Additional information to include in the telemetry data. AttributeValue can be string, number, boolean, array of these types, or null.",
259
- },
260
248
  {
261
249
  name: "recordInputs",
262
250
  type: "boolean",
@@ -271,6 +259,18 @@ Settings for telemetry collection during streaming:
271
259
  defaultValue: "true",
272
260
  description: "Enable or disable output recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
273
261
  },
262
+ {
263
+ name: "functionId",
264
+ type: "string",
265
+ isOptional: true,
266
+ description: "Identifier for this function. Used to group telemetry data by function.",
267
+ },
268
+ {
269
+ name: "metadata",
270
+ type: "Record<string, AttributeValue>",
271
+ isOptional: true,
272
+ description: "Additional information to include in the telemetry data. AttributeValue can be string, number, boolean, array of these types, or null.",
273
+ },
274
274
  {
275
275
  name: "tracer",
276
276
  type: "Tracer",
@@ -289,10 +289,10 @@ The return value of the `stream()` method depends on the options provided, speci
289
289
  <PropertiesTable
290
290
  content={[
291
291
  {
292
- name: "object",
293
- type: "Promise<object>",
292
+ name: "textStream",
293
+ type: "AsyncIterable<string>",
294
294
  isOptional: true,
295
- description: "Promise that resolves to the final structured output. Present when using either `output` or `experimental_output` options.",
295
+ description: "Stream of text chunks. Present when output is 'text' (no schema provided) or when using `experimental_output`.",
296
296
  },
297
297
  {
298
298
  name: "objectStream",
@@ -307,10 +307,10 @@ The return value of the `stream()` method depends on the options provided, speci
307
307
  description: "Stream of structured data. Present only when using `experimental_output` option.",
308
308
  },
309
309
  {
310
- name: "textStream",
311
- type: "AsyncIterable<string>",
310
+ name: "object",
311
+ type: "Promise<object>",
312
312
  isOptional: true,
313
- description: "Stream of text chunks. Present when output is 'text' (no schema provided) or when using `experimental_output`.",
313
+ description: "Promise that resolves to the final structured output. Present when using either `output` or `experimental_output` options.",
314
314
  }
315
315
  ]}
316
316
  />
@@ -359,3 +359,4 @@ console.log("Final structured result:", result);
359
359
  ```
360
360
 
361
361
  The key difference between Agent's `stream()` and LLM's `stream()` is that Agents maintain conversation context through `threadId`, can access tools, and integrate with the agent's memory system.
362
+
@@ -5,7 +5,7 @@ description: Documentation for the mastra dev command, which starts a developmen
5
5
 
6
6
  # `mastra dev` Reference
7
7
 
8
- The `mastra dev` command starts a development server that exposes REST endpoints for your agents, tools, and workflows,
8
+ The `mastra dev` command starts a development server that exposes REST routes for your agents, tools, and workflows,
9
9
 
10
10
  ## Parameters
11
11
 
@@ -37,39 +37,81 @@ The `mastra dev` command starts a development server that exposes REST endpoints
37
37
 
38
38
  ## Routes
39
39
 
40
- Starting the server with `mastra dev` exposes a set of REST endpoints by default:
40
+ Starting the server with `mastra dev` exposes a set of REST routes by default:
41
+
42
+ ### System Routes
43
+ - **GET `/api`**: Get API status.
41
44
 
42
45
  ### Agent Routes
43
46
 
44
47
  Agents are expected to be exported from `src/mastra/agents`.
45
48
 
46
- `GET /api/agents`
47
- - Lists the registered agents found in your Mastra folder.
48
- `POST /api/agents/:agentId/generate`
49
- - Sends a text-based prompt to the specified agent, returning the agent's response.
49
+ - **GET `/api/agents`**: Lists the registered agents found in your Mastra folder.
50
+ - **GET `/api/agents/:agentId`**: Get agent by ID.
51
+ - **GET `/api/agents/:agentId/evals/ci`**: Get CI evals by agent ID.
52
+ - **GET `/api/agents/:agentId/evals/live`**: Get live evals by agent ID.
53
+ - **POST `/api/agents/:agentId/generate`**: Sends a text-based prompt to the specified agent, returning the agent's response.
54
+ - **POST `/api/agents/:agentId/stream`**: Stream a response from an agent.
55
+ - **POST `/api/agents/:agentId/instructions`**: Update an agent's instructions.
56
+ - **POST `/api/agents/:agentId/instructions/enhance`**: Generate an improved system prompt from instructions.
57
+ - **GET `/api/agents/:agentId/speakers`**: Get available speakers for an agent.
58
+ - **POST `/api/agents/:agentId/speak`**: Convert text to speech using the agent's voice provider.
59
+ - **POST `/api/agents/:agentId/listen`**: Convert speech to text using the agent's voice provider.
60
+ - **POST `/api/agents/:agentId/tools/:toolId/execute`**: Execute a tool through an agent.
50
61
 
51
62
  ### Tool Routes
52
63
 
53
64
  Tools are expected to be exported from `src/mastra/tools` (or the configured tools directory).
54
65
 
55
- `POST /api/tools/:toolName`
56
- - Invokes a specific tool by name, passing input data in the request body.
66
+ - **GET `/api/tools`**: Get all tools.
67
+ - **GET `/api/tools/:toolId`**: Get tool by ID.
68
+ - **POST `/api/tools/:toolId/execute`**: Invokes a specific tool by name, passing input data in the request body.
57
69
 
58
70
  ### Workflow Routes
59
71
 
60
72
  Workflows are expected to be exported from `src/mastra/workflows` (or the configured workflows directory).
61
73
 
62
- `POST /api/workflows/:workflowName/start`
63
- - Starts the specified workflow.
64
- `POST /api/workflows/:workflowName/:instanceId/event`
65
- - Sends an event or trigger signal to an existing workflow instance.
66
- `GET /api/workflows/:workflowName/:instanceId/status`
67
- - Returns status info for a running workflow instance.
74
+ - **GET `/api/workflows`**: Get all workflows.
75
+ - **GET `/api/workflows/:workflowId`**: Get workflow by ID.
76
+ - **POST `/api/workflows/:workflowName/start`**: Starts the specified workflow.
77
+ - **POST `/api/workflows/:workflowName/:instanceId/event`**: Sends an event or trigger signal to an existing workflow instance.
78
+ - **GET `/api/workflows/:workflowName/:instanceId/status`**: Returns status info for a running workflow instance.
79
+ - **POST `/api/workflows/:workflowId/resume`**: Resume a suspended workflow step.
80
+ - **POST `/api/workflows/:workflowId/resumeAsync`**: Resume a suspended workflow step asynchronously.
81
+ - **POST `/api/workflows/:workflowId/createRun`**: Create a new workflow run.
82
+ - **POST `/api/workflows/:workflowId/startAsync`**: Execute/Start a workflow asynchronously.
83
+ - **GET `/api/workflows/:workflowId/watch`**: Watch workflow transitions in real-time.
84
+
85
+ ### Memory Routes
86
+ - **GET `/api/memory/status`**: Get memory status.
87
+ - **GET `/api/memory/threads`**: Get all threads.
88
+ - **GET `/api/memory/threads/:threadId`**: Get thread by ID.
89
+ - **GET `/api/memory/threads/:threadId/messages`**: Get messages for a thread.
90
+ - **POST `/api/memory/threads`**: Create a new thread.
91
+ - **PATCH `/api/memory/threads/:threadId`**: Update a thread.
92
+ - **DELETE `/api/memory/threads/:threadId`**: Delete a thread.
93
+ - **POST `/api/memory/save-messages`**: Save messages.
94
+
95
+ ### Telemetry Routes
96
+ - **GET `/api/telemetry`**: Get all traces.
97
+
98
+ ### Log Routes
99
+ - **GET `/api/logs`**: Get all logs.
100
+ - **GET `/api/logs/transports`**: List of all log transports.
101
+ - **GET `/api/logs/:runId`**: Get logs by run ID.
102
+
103
+ ### Vector Routes
104
+ - **POST `/api/vector/:vectorName/upsert`**: Upsert vectors into an index.
105
+ - **POST `/api/vector/:vectorName/create-index`**: Create a new vector index.
106
+ - **POST `/api/vector/:vectorName/query`**: Query vectors from an index.
107
+ - **GET `/api/vector/:vectorName/indexes`**: List all indexes for a vector store.
108
+ - **GET `/api/vector/:vectorName/indexes/:indexName`**: Get details about a specific index.
109
+ - **DELETE `/api/vector/:vectorName/indexes/:indexName`**: Delete a specific index.
68
110
 
69
111
  ### OpenAPI Specification
70
112
 
71
- `GET /openapi.json`
72
- - Returns an auto-generated OpenAPI specification for your project's endpoints.
113
+ - **GET `/openapi.json`**: Returns an auto-generated OpenAPI specification for your project's routes.
114
+ - **GET `/swagger-ui`**: Access Swagger UI for API documentation.
73
115
 
74
116
  ## Additional Notes
75
117
 
@@ -90,8 +132,3 @@ curl -X POST http://localhost:4111/api/agents/myAgent/generate \
90
132
  ]
91
133
  }'
92
134
  ```
93
-
94
- ## Related Docs
95
-
96
- - [REST Endpoints Overview](../../local-dev/mastra-dev.mdx) – More detailed usage of the dev server and agent endpoints.
97
- - [mastra deploy](../../deployment/deployment.mdx) – Deploy your project to Vercel or Cloudflare.