@mastra/mcp-docs-server 1.2.4 → 1.2.5-alpha.3

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 (200) hide show
  1. package/.docs/docs/agent-builder/deploying.md +1 -1
  2. package/.docs/docs/agent-controller/overview.md +1 -1
  3. package/.docs/docs/agent-controller/session.md +1 -1
  4. package/.docs/docs/agents/overview.md +1 -1
  5. package/.docs/docs/agents/processors.md +1 -1
  6. package/.docs/docs/agents/supervisor-agents.md +3 -3
  7. package/.docs/docs/agents/using-tools.md +1 -1
  8. package/.docs/docs/{agents → long-running-agents}/background-tasks.md +2 -2
  9. package/.docs/docs/{agents → long-running-agents}/durable-agents.md +2 -2
  10. package/.docs/docs/{agents → long-running-agents}/goals.md +1 -1
  11. package/.docs/docs/{agents → long-running-agents}/heartbeats.md +5 -5
  12. package/.docs/docs/{agents → long-running-agents}/signal-providers.md +4 -4
  13. package/.docs/docs/memory/working-memory.md +1 -1
  14. package/.docs/docs/observability/config.md +1 -2
  15. package/.docs/docs/server/pubsub.md +2 -2
  16. package/.docs/docs/voice/overview.md +3 -3
  17. package/.docs/docs/voice/speech-to-speech.md +81 -1
  18. package/.docs/docs/voice/speech-to-text.md +19 -1
  19. package/.docs/docs/voice/text-to-speech.md +21 -1
  20. package/.docs/docs/workflows/control-flow.md +1 -1
  21. package/.docs/docs/workflows/error-handling.md +1 -1
  22. package/.docs/docs/workflows/human-in-the-loop.md +1 -1
  23. package/.docs/docs/workflows/overview.md +1 -1
  24. package/.docs/docs/workflows/snapshots.md +1 -1
  25. package/.docs/docs/workflows/suspend-and-resume.md +1 -1
  26. package/.docs/docs/workflows/time-travel.md +1 -1
  27. package/.docs/docs/workflows/workflow-state.md +1 -1
  28. package/.docs/guides/build-your-ui/copilotkit/channels.md +76 -0
  29. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
  30. package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
  31. package/.docs/guides/concepts/streaming.md +1 -1
  32. package/.docs/guides/deployment/vercel.md +1 -2
  33. package/.docs/guides/guide/signal-provider.md +5 -5
  34. package/.docs/models/environment-variables.md +2 -0
  35. package/.docs/models/index.md +1 -1
  36. package/.docs/models/providers/alibaba-cn.md +2 -1
  37. package/.docs/models/providers/friendli.md +1 -2
  38. package/.docs/models/providers/kenari.md +95 -0
  39. package/.docs/models/providers/nvidia.md +2 -3
  40. package/.docs/models/providers/tencent-token-plan.md +7 -7
  41. package/.docs/models/providers/tencent-tokenhub.md +5 -4
  42. package/.docs/models/providers.md +2 -0
  43. package/.docs/reference/acp/acp-agent.md +5 -5
  44. package/.docs/reference/acp/create-acp-tool.md +5 -5
  45. package/.docs/reference/agent-controller/agent-controller-class.md +27 -27
  46. package/.docs/reference/agents/agent.md +34 -34
  47. package/.docs/reference/agents/channels.md +19 -19
  48. package/.docs/reference/agents/createSkill.md +2 -2
  49. package/.docs/reference/agents/durable-agent.md +22 -22
  50. package/.docs/reference/agents/generate.md +10 -10
  51. package/.docs/reference/agents/generateLegacy.md +12 -12
  52. package/.docs/reference/agents/getMetadata.md +1 -1
  53. package/.docs/reference/agents/getVoice.md +1 -1
  54. package/.docs/reference/agents/inngest-agent.md +9 -9
  55. package/.docs/reference/agents/network.md +1 -1
  56. package/.docs/reference/ai-sdk/chat-route.md +4 -4
  57. package/.docs/reference/ai-sdk/handle-chat-stream.md +6 -6
  58. package/.docs/reference/ai-sdk/handle-network-stream.md +3 -3
  59. package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
  60. package/.docs/reference/ai-sdk/network-route.md +4 -4
  61. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
  62. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
  63. package/.docs/reference/ai-sdk/with-mastra.md +2 -2
  64. package/.docs/reference/ai-sdk/workflow-route.md +2 -2
  65. package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +1 -1
  66. package/.docs/reference/auth/google.md +10 -10
  67. package/.docs/reference/auth/okta.md +11 -11
  68. package/.docs/reference/auth/workos.md +3 -3
  69. package/.docs/reference/channels/slack-provider.md +15 -15
  70. package/.docs/reference/cli/mastra.md +145 -0
  71. package/.docs/reference/client-js/agents.md +9 -9
  72. package/.docs/reference/client-js/mastra-client.md +5 -5
  73. package/.docs/reference/client-js/responses.md +3 -3
  74. package/.docs/reference/configuration.md +1 -1
  75. package/.docs/reference/core/getAgentById.md +3 -3
  76. package/.docs/reference/core/getWorkflow.md +1 -1
  77. package/.docs/reference/core/listWorkflows.md +1 -1
  78. package/.docs/reference/core/mastra-class.md +3 -3
  79. package/.docs/reference/core/removeWorkspace.md +2 -2
  80. package/.docs/reference/datasets/compareExperiments.md +1 -1
  81. package/.docs/reference/datasets/getItemHistory.md +1 -1
  82. package/.docs/reference/datasets/list.md +5 -5
  83. package/.docs/reference/datasets/listExperimentResults.md +4 -4
  84. package/.docs/reference/datasets/listExperiments.md +4 -4
  85. package/.docs/reference/datasets/listItems.md +5 -5
  86. package/.docs/reference/datasets/listVersions.md +3 -3
  87. package/.docs/reference/datasets/startExperiment.md +8 -8
  88. package/.docs/reference/datasets/startExperimentAsync.md +1 -1
  89. package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
  90. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +7 -7
  91. package/.docs/reference/editor/agent-builder/builder-models.md +4 -4
  92. package/.docs/reference/editor/blob-store-provider.md +2 -2
  93. package/.docs/reference/editor/browser-provider.md +2 -2
  94. package/.docs/reference/editor/filesystem-provider.md +2 -2
  95. package/.docs/reference/editor/mastra-editor.md +2 -2
  96. package/.docs/reference/editor/processor-provider.md +4 -4
  97. package/.docs/reference/editor/sandbox-provider.md +2 -2
  98. package/.docs/reference/editor/storage-browser-ref.md +2 -2
  99. package/.docs/reference/editor/storage-workspace-ref.md +7 -7
  100. package/.docs/reference/evals/create-scorer.md +8 -8
  101. package/.docs/reference/evals/rubric.md +1 -1
  102. package/.docs/reference/evals/run-evals.md +7 -7
  103. package/.docs/reference/evals/trajectory-accuracy.md +1 -1
  104. package/.docs/reference/index.md +2 -2
  105. package/.docs/reference/logging/pino-logger.md +4 -4
  106. package/.docs/reference/memory/cloneThread.md +35 -4
  107. package/.docs/reference/memory/memory-class.md +5 -5
  108. package/.docs/reference/memory/observational-memory.md +43 -43
  109. package/.docs/reference/memory/recall.md +4 -4
  110. package/.docs/reference/memory/serialized-memory-config.md +6 -6
  111. package/.docs/reference/observability/tracing/configuration.md +4 -4
  112. package/.docs/reference/processors/language-detector.md +1 -1
  113. package/.docs/reference/processors/moderation-processor.md +1 -1
  114. package/.docs/reference/processors/pii-detector.md +1 -1
  115. package/.docs/reference/processors/processor-interface.md +20 -20
  116. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  117. package/.docs/reference/processors/response-cache.md +6 -6
  118. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  119. package/.docs/reference/pubsub/base.md +7 -7
  120. package/.docs/reference/pubsub/caching-pubsub.md +1 -1
  121. package/.docs/reference/pubsub/event-emitter.md +2 -2
  122. package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
  123. package/.docs/reference/pubsub/lease-provider.md +3 -3
  124. package/.docs/reference/pubsub/redis-streams.md +6 -6
  125. package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
  126. package/.docs/reference/rag/chunk.md +2 -2
  127. package/.docs/reference/server/create-route.md +3 -3
  128. package/.docs/reference/server/express-adapter.md +4 -4
  129. package/.docs/reference/server/fastify-adapter.md +4 -4
  130. package/.docs/reference/server/hono-adapter.md +4 -4
  131. package/.docs/reference/server/koa-adapter.md +4 -4
  132. package/.docs/reference/server/mastra-server.md +1 -1
  133. package/.docs/reference/server/nestjs-adapter.md +3 -3
  134. package/.docs/reference/server/register-api-route.md +3 -3
  135. package/.docs/reference/signals/create-notification-inbox-tool.md +3 -3
  136. package/.docs/reference/signals/signal-provider.md +7 -7
  137. package/.docs/reference/signals/webhook-signal-provider.md +2 -2
  138. package/.docs/reference/storage/clickhouse.md +7 -7
  139. package/.docs/reference/storage/composite.md +2 -2
  140. package/.docs/reference/storage/duckdb.md +1 -1
  141. package/.docs/reference/storage/dynamodb.md +1 -1
  142. package/.docs/reference/storage/libsql.md +1 -1
  143. package/.docs/reference/storage/postgresql.md +2 -2
  144. package/.docs/reference/storage/redis.md +2 -2
  145. package/.docs/reference/storage/retention.md +5 -5
  146. package/.docs/reference/storage/spanner.md +6 -6
  147. package/.docs/reference/streaming/ChunkType.md +3 -3
  148. package/.docs/reference/streaming/agents/stream.md +14 -14
  149. package/.docs/reference/streaming/agents/streamLegacy.md +10 -10
  150. package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
  151. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  152. package/.docs/reference/templates/overview.md +1 -140
  153. package/.docs/reference/tools/brightdata.md +4 -4
  154. package/.docs/reference/tools/create-code-mode.md +5 -5
  155. package/.docs/reference/tools/create-tool.md +15 -15
  156. package/.docs/reference/tools/graph-rag-tool.md +1 -1
  157. package/.docs/reference/tools/mcp-client.md +2 -2
  158. package/.docs/reference/tools/mcp-server.md +12 -12
  159. package/.docs/reference/tools/perplexity.md +3 -3
  160. package/.docs/reference/tools/tavily.md +1 -1
  161. package/.docs/reference/tools/vector-query-tool.md +1 -1
  162. package/.docs/reference/vectors/chroma.md +1 -1
  163. package/.docs/reference/vectors/mongodb.md +1 -1
  164. package/.docs/reference/vectors/pg.md +1 -1
  165. package/.docs/reference/vectors/s3vectors.md +4 -4
  166. package/.docs/reference/voice/google-gemini-live.md +3 -3
  167. package/.docs/reference/voice/inworld-realtime.md +12 -12
  168. package/.docs/reference/voice/inworld.md +2 -2
  169. package/.docs/reference/voice/voice.on.md +1 -1
  170. package/.docs/reference/workflows/run-methods/resume.md +1 -1
  171. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  172. package/.docs/reference/workspace/agentcore-runtime-sandbox.md +4 -4
  173. package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
  174. package/.docs/reference/workspace/apple-container-sandbox.md +5 -5
  175. package/.docs/reference/workspace/archil-filesystem.md +5 -5
  176. package/.docs/reference/workspace/blaxel-sandbox.md +1 -1
  177. package/.docs/reference/workspace/daytona-sandbox.md +1 -1
  178. package/.docs/reference/workspace/docker-sandbox.md +2 -2
  179. package/.docs/reference/workspace/e2b-sandbox.md +2 -2
  180. package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
  181. package/.docs/reference/workspace/filesystem.md +1 -1
  182. package/.docs/reference/workspace/local-filesystem.md +3 -3
  183. package/.docs/reference/workspace/local-sandbox.md +1 -1
  184. package/.docs/reference/workspace/mesa-filesystem.md +3 -3
  185. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  186. package/.docs/reference/workspace/railway-sandbox.md +1 -1
  187. package/.docs/reference/workspace/s3-filesystem.md +4 -4
  188. package/.docs/reference/workspace/sandbox.md +1 -1
  189. package/.docs/reference/workspace/{vercel-microvm-sandbox.md → vercel-sandbox.md} +21 -15
  190. package/.docs/reference/workspace/{vercel.md → vercel-serverless.md} +21 -14
  191. package/.docs/reference/workspace/workspace-class.md +15 -15
  192. package/CHANGELOG.md +15 -0
  193. package/package.json +5 -5
  194. package/.docs/docs/agents/adding-voice.md +0 -383
  195. package/.docs/docs/community/contributing-templates.md +0 -5
  196. package/.docs/docs/community/discord.md +0 -11
  197. package/.docs/guides/build-your-ui/copilotkit.md +0 -291
  198. package/LICENSE.md +0 -30
  199. /package/.docs/docs/{community/licensing.md → license.md} +0 -0
  200. /package/.docs/docs/{agents → long-running-agents}/signals.md +0 -0
@@ -49,23 +49,23 @@ The instance and database must already exist. The adapter creates the required t
49
49
 
50
50
  **id** (`string`): Unique identifier for this storage instance.
51
51
 
52
- **projectId** (`string`): Google Cloud project ID. Required unless \`database\` is provided.
52
+ **projectId** (`string`): Google Cloud project ID. Required unless database is provided.
53
53
 
54
- **instanceId** (`string`): Cloud Spanner instance ID. Required unless \`database\` is provided.
54
+ **instanceId** (`string`): Cloud Spanner instance ID. Required unless database is provided.
55
55
 
56
- **databaseId** (`string`): Cloud Spanner database ID. Required unless \`database\` is provided.
56
+ **databaseId** (`string`): Cloud Spanner database ID. Required unless database is provided.
57
57
 
58
58
  **database** (`@google-cloud/spanner Database`): Pre-configured Spanner Database handle. Use this when you manage the Spanner client elsewhere (for example, to share auth or connection options across services).
59
59
 
60
- **spannerOptions** (`object`): Options forwarded to the \`@google-cloud/spanner\` client constructor. Use this to set credentials, custom endpoints, or to point at the local emulator.
60
+ **spannerOptions** (`object`): Options forwarded to the @google-cloud/spanner client constructor. Use this to set credentials, custom endpoints, or to point at the local emulator.
61
61
 
62
- **disableInit** (`boolean`): When true, skip automatic table creation on first use. You must call \`storage.init()\` explicitly during a separate deploy step. (Default: `false`)
62
+ **disableInit** (`boolean`): When true, skip automatic table creation on first use. You must call storage.init() explicitly during a separate deploy step. (Default: `false`)
63
63
 
64
64
  **skipDefaultIndexes** (`boolean`): When true, skip creation of default indexes during initialization. (Default: `false`)
65
65
 
66
66
  **indexes** (`CreateIndexOptions[]`): Custom secondary indexes to create. Each index must specify the table it belongs to. Indexes are routed to the appropriate domain based on the table name.
67
67
 
68
- **initMode** (`'sync' | 'validate'`): Controls schema-initialization behavior. \`'sync'\` creates missing tables, columns, and indexes during \`init()\` (the historical behavior). \`'validate'\` issues no DDL and instead verifies that every expected table, column, and default/custom index already exists, throwing a typed user error if anything is missing — useful when an external process (Terraform, Liquibase, a release pipeline, etc.) owns the schema and Mastra should only verify it. (Default: `'sync'`)
68
+ **initMode** (`'sync' | 'validate'`): Controls schema-initialization behavior. 'sync' creates missing tables, columns, and indexes during init() (the historical behavior). 'validate' issues no DDL and instead verifies that every expected table, column, and default/custom index already exists, throwing a typed user error if anything is missing — useful when an external process (Terraform, Liquibase, a release pipeline, etc.) owns the schema and Mastra should only verify it. (Default: `'sync'`)
69
69
 
70
70
  ## Constructor examples
71
71
 
@@ -402,7 +402,7 @@ Contains output from workflow step execution, used primarily for usage tracking
402
402
 
403
403
  ## Background task chunks
404
404
 
405
- Emitted when a tool call is dispatched as a [background task](https://mastra.ai/docs/agents/background-tasks) and `streamUntilIdle()` is used.
405
+ Emitted when a tool call is dispatched as a [background task](https://mastra.ai/docs/long-running-agents/background-tasks) and `streamUntilIdle()` is used.
406
406
 
407
407
  ### background-task-started
408
408
 
@@ -540,7 +540,7 @@ When consumed by [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streami
540
540
 
541
541
  **payload.agentId** (`string`): ID of the agent that dispatched the task
542
542
 
543
- **payload.suspendData** (`unknown`): Whatever the tool passed to \`suspend(data)\`
543
+ **payload.suspendData** (`unknown`): Whatever the tool passed to suspend(data)
544
544
 
545
545
  ### background-task-resumed
546
546
 
@@ -614,7 +614,7 @@ Contains monitoring and observability data from agent execution. Can include wor
614
614
 
615
615
  ### goal
616
616
 
617
- Emitted on every evaluation of an agent [goal](https://mastra.ai/docs/agents/goals). Consumers use this to render judge progress and the result mid-run. A goal that has no judge model configured produces no `goal` chunk.
617
+ Emitted on every evaluation of an agent [goal](https://mastra.ai/docs/long-running-agents/goals). Consumers use this to render judge progress and the result mid-run. A goal that has no judge model configured produces no `goal` chunk.
618
618
 
619
619
  **type** (`"goal"`): Chunk type identifier
620
620
 
@@ -66,7 +66,7 @@ const stream = await agent.stream('message for agent')
66
66
 
67
67
  **options.delegation.onDelegationStart** (`(context: DelegationStartContext) => DelegationStartResult | void | Promise<DelegationStartResult | void>`): Called before delegating to a subagent. Use this to modify the delegation parameters or reject the delegation entirely.
68
68
 
69
- **options.delegation.onDelegationComplete** (`(context: DelegationCompleteContext) => { feedback?: string } | void | Promise<{ feedback?: string } | void>`): Called after a subagent delegation completes. The context includes a \`bail()\` method to stop further execution, and you can return \`{ feedback }\` to guide the supervisor's next action. Feedback is saved to supervisor memory as an assistant message.
69
+ **options.delegation.onDelegationComplete** (`(context: DelegationCompleteContext) => { feedback?: string } | void | Promise<{ feedback?: string } | void>`): Called after a subagent delegation completes. The context includes a bail() method to stop further execution, and you can return { feedback } to guide the supervisor's next action. Feedback is saved to supervisor memory as an assistant message.
70
70
 
71
71
  **options.delegation.messageFilter** (`(context: MessageFilterContext) => MastraDBMessage[] | Promise<MastraDBMessage[]>`): Callback function called before delegating to a subagent. Use this to filter the messages that are passed to the subagent.
72
72
 
@@ -102,13 +102,13 @@ const stream = await agent.stream('message for agent')
102
102
 
103
103
  **options.structuredOutput.jsonPromptInjection** (`boolean`): Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs.
104
104
 
105
- **options.structuredOutput.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal structuring agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`).
105
+ **options.structuredOutput.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal structuring agent. Use this to control model behavior like reasoning effort for thinking models (e.g., { openai: { reasoningEffort: 'low' } }).
106
106
 
107
- **options.outputProcessors** (`Processor[]`): Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the \`processOutputResult\` and \`processOutputStream\` functions.
107
+ **options.outputProcessors** (`Processor[]`): Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the processOutputResult and processOutputStream functions.
108
108
 
109
109
  **options.includeRawChunks** (`boolean`): Whether to include raw chunks in the stream output (not available on all model providers).
110
110
 
111
- **options.inputProcessors** (`Processor[]`): Overrides the input processors set on the agent. Input processors that can modify or validate messages before they are processed by the agent. Must implement the \`processInput\` function.
111
+ **options.inputProcessors** (`Processor[]`): Overrides the input processors set on the agent. Input processors that can modify or validate messages before they are processed by the agent. Must implement the processInput function.
112
112
 
113
113
  **options.instructions** (`string`): Custom instructions that override the agent's default instructions for this specific generation. Useful for dynamically modifying agent behavior without creating a new agent instance.
114
114
 
@@ -118,7 +118,7 @@ const stream = await agent.stream('message for agent')
118
118
 
119
119
  **options.memory** (`object`): Configuration for memory. This is the preferred way to manage memory.
120
120
 
121
- **options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): The conversation thread, as a string ID or an object with an \`id\` and optional \`metadata\`.
121
+ **options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): The conversation thread, as a string ID or an object with an id and optional metadata.
122
122
 
123
123
  **options.memory.resource** (`string`): Identifier for the user or resource associated with the thread.
124
124
 
@@ -170,23 +170,23 @@ const stream = await agent.stream('message for agent')
170
170
 
171
171
  **options.clientTools** (`ToolsInput`): Tools that are executed on the 'client' side of the request. These tools do not have execute functions in the definition.
172
172
 
173
- **options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls. Overrides matching agent-level hooks for this execution. \`beforeToolCall\` can return \`{ proceed: false, output }\` to skip the tool call.
173
+ **options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls. Overrides matching agent-level hooks for this execution. beforeToolCall can return { proceed: false, output } to skip the tool call.
174
174
 
175
175
  **options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
176
176
 
177
- **options.requireToolApproval** (`boolean`): When true, all tool calls require explicit approval before execution. The stream will emit \`tool-call-approval\` chunks and pause until \`approveToolCall()\` or \`declineToolCall()\` is called.
177
+ **options.requireToolApproval** (`boolean`): When true, all tool calls require explicit approval before execution. The stream will emit tool-call-approval chunks and pause until approveToolCall() or declineToolCall() is called.
178
178
 
179
- **options.autoResumeSuspendedTools** (`boolean`): When true, automatically resumes suspended tools when the user sends a new message on the same thread. The agent extracts \`resumeData\` from the user's message based on the tool's \`resumeSchema\`. Requires memory to be configured.
179
+ **options.autoResumeSuspendedTools** (`boolean`): When true, automatically resumes suspended tools when the user sends a new message on the same thread. The agent extracts resumeData from the user's message based on the tool's resumeSchema. Requires memory to be configured.
180
180
 
181
181
  **options.toolCallConcurrency** (`number`): Maximum number of tool calls to execute concurrently. Defaults to 1 when approval may be required, otherwise 10.
182
182
 
183
- **options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Additional provider-specific options that are passed through to the underlying LLM provider. The structure is \`{ providerName: { optionKey: value } }\`. For example: \`{ openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }\`.
183
+ **options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Additional provider-specific options that are passed through to the underlying LLM provider. The structure is { providerName: { optionKey: value } }. For example: { openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }.
184
184
 
185
- **options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options. Example: \`{ reasoningEffort: 'high' }\`
185
+ **options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options. Example: { reasoningEffort: 'high' }
186
186
 
187
- **options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options. Example: \`{ maxTokens: 1000 }\`
187
+ **options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options. Example: { maxTokens: 1000 }
188
188
 
189
- **options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options. Example: \`{ safetySettings: \[...] }\`
189
+ **options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options. Example: { safetySettings: \[...] }
190
190
 
191
191
  **options.providerOptions.\[providerName]** (`Record<string, JSONValue>`): Other provider-specific options. The key is the provider name and the value is a record of provider-specific options.
192
192
 
@@ -210,7 +210,7 @@ const stream = await agent.stream('message for agent')
210
210
 
211
211
  **options.tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
212
212
 
213
- **options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See \[Sub-agent versioning]\(/docs/editor/overview#sub-agent-versioning).
213
+ **options.versions** (`VersionOverrides`): Per-invocation version overrides for sub-agent delegation. Merged on top of Mastra instance-level versions and propagated automatically through sub-agent calls via requestContext. Requires the editor package. See Sub-agent versioning.
214
214
 
215
215
  **options.versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors.
216
216
 
@@ -218,7 +218,7 @@ const stream = await agent.stream('message for agent')
218
218
 
219
219
  **options.versions.agents.status** (`'draft' | 'published'`): Target the latest version with this publication status.
220
220
 
221
- **options.untilIdle** (`boolean | { maxIdleMs?: number }`): When set, keeps the stream open across background-task continuations. The agent will automatically re-invoke the LLM when background tasks complete, streaming continuation turns through the same \`fullStream\`. Pass \`true\` for default settings (5 min idle timeout), or an object with \`maxIdleMs\` to configure. Requires memory. Replaces the standalone \`streamUntilIdle()\` method.
221
+ **options.untilIdle** (`boolean | { maxIdleMs?: number }`): When set, keeps the stream open across background-task continuations. The agent will automatically re-invoke the LLM when background tasks complete, streaming continuation turns through the same fullStream. Pass true for default settings (5 min idle timeout), or an object with maxIdleMs to configure. Requires memory. Replaces the standalone streamUntilIdle() method.
222
222
 
223
223
  **options.untilIdle.maxIdleMs** (`number`): Closes the outer stream after this many ms of idleness between turns. The timer only runs while the wrapper is between turns. Default: 5 minutes.
224
224
 
@@ -30,7 +30,7 @@ await agent.streamLegacy('message for agent')
30
30
 
31
31
  **options.memory** (`object`): Configuration for memory. This is the preferred way to manage memory.
32
32
 
33
- **options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): The conversation thread, as a string ID or an object with an \`id\` and optional \`metadata\`.
33
+ **options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): The conversation thread, as a string ID or an object with an id and optional metadata.
34
34
 
35
35
  **options.memory.resource** (`string`): Identifier for the user or resource associated with the thread.
36
36
 
@@ -40,7 +40,7 @@ await agent.streamLegacy('message for agent')
40
40
 
41
41
  **options.maxRetries** (`number`): Maximum number of retries. Set to 0 to disable retries.
42
42
 
43
- **options.memoryOptions** (`MemoryConfig`): \*\*Deprecated.\*\* Use \`memory.options\` instead. Configuration options for memory management.
43
+ **options.memoryOptions** (`MemoryConfig`): \*\*Deprecated.\*\* Use memory.options instead. Configuration options for memory management.
44
44
 
45
45
  **options.memoryOptions.lastMessages** (`number | false`): Number of recent messages to include in context, or false to disable.
46
46
 
@@ -54,7 +54,7 @@ await agent.streamLegacy('message for agent')
54
54
 
55
55
  **options.onStepFinish** (`StreamTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives step details as a JSON string. Unavailable for structured output
56
56
 
57
- **options.resourceId** (`string`): \*\*Deprecated.\*\* Use \`memory.resource\` instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.
57
+ **options.resourceId** (`string`): \*\*Deprecated.\*\* Use memory.resource instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.
58
58
 
59
59
  **options.telemetry** (`TelemetrySettings`): Settings for telemetry collection during streaming.
60
60
 
@@ -68,7 +68,7 @@ await agent.streamLegacy('message for agent')
68
68
 
69
69
  **options.temperature** (`number`): Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.
70
70
 
71
- **options.threadId** (`string`): \*\*Deprecated.\*\* Use \`memory.thread\` instead. Identifier for the conversation thread. Allows for maintaining context across multiple interactions. Must be provided if resourceId is provided.
71
+ **options.threadId** (`string`): \*\*Deprecated.\*\* Use memory.thread instead. Identifier for the conversation thread. Allows for maintaining context across multiple interactions. Must be provided if resourceId is provided.
72
72
 
73
73
  **options.toolChoice** (`'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }`): Controls how the agent uses tools during streaming.
74
74
 
@@ -84,17 +84,17 @@ await agent.streamLegacy('message for agent')
84
84
 
85
85
  **options.clientTools** (`ToolsInput`): Tools that are executed on the 'client' side of the request. These tools do not have execute functions in the definition.
86
86
 
87
- **options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls. Overrides matching agent-level hooks for this execution. \`beforeToolCall\` can return \`{ proceed: false, output }\` to skip the tool call.
87
+ **options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls. Overrides matching agent-level hooks for this execution. beforeToolCall can return { proceed: false, output } to skip the tool call.
88
88
 
89
89
  **options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
90
90
 
91
- **options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Additional provider-specific options that are passed through to the underlying LLM provider. The structure is \`{ providerName: { optionKey: value } }\`. For example: \`{ openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }\`.
91
+ **options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Additional provider-specific options that are passed through to the underlying LLM provider. The structure is { providerName: { optionKey: value } }. For example: { openai: { reasoningEffort: 'high' }, anthropic: { maxTokens: 1000 } }.
92
92
 
93
- **options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options. Example: \`{ reasoningEffort: 'high' }\`
93
+ **options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options. Example: { reasoningEffort: 'high' }
94
94
 
95
- **options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options. Example: \`{ maxTokens: 1000 }\`
95
+ **options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options. Example: { maxTokens: 1000 }
96
96
 
97
- **options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options. Example: \`{ safetySettings: \[...] }\`
97
+ **options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options. Example: { safetySettings: \[...] }
98
98
 
99
99
  **options.providerOptions.\[providerName]** (`Record<string, JSONValue>`): Other provider-specific options. The key is the provider name and the value is a record of provider-specific options.
100
100
 
@@ -104,7 +104,7 @@ await agent.streamLegacy('message for agent')
104
104
 
105
105
  **options.maxTokens** (`number`): Maximum number of tokens to generate.
106
106
 
107
- **options.topP** (`number`): Nucleus sampling. This is a number between 0 and 1. It is recommended to set either \`temperature\` or \`topP\`, but not both.
107
+ **options.topP** (`number`): Nucleus sampling. This is a number between 0 and 1. It is recommended to set either temperature or topP, but not both.
108
108
 
109
109
  **options.topK** (`number`): Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses.
110
110
 
@@ -101,7 +101,7 @@ for await (const chunk of stream.fullStream) {
101
101
 
102
102
  ## Related
103
103
 
104
- - [Background tasks](https://mastra.ai/docs/agents/background-tasks)
104
+ - [Background tasks](https://mastra.ai/docs/long-running-agents/background-tasks)
105
105
  - [`Agent.stream()` reference](https://mastra.ai/reference/streaming/agents/stream)
106
106
  - [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
107
107
  - [Stream chunk types](https://mastra.ai/reference/streaming/ChunkType)
@@ -34,7 +34,7 @@ if (result!.status === 'suspended') {
34
34
 
35
35
  **step** (`Step<string, any, any, any, any, TEngineType>`): The step to resume execution from
36
36
 
37
- **forEachIndex** (`number`): Target a specific iteration of a suspended \`.foreach()\` step. Pass the zero-based index of the iteration to resume; other iterations remain suspended. Omit to resume all suspended iterations of the step with the same \`resumeData\`.
37
+ **forEachIndex** (`number`): Target a specific iteration of a suspended .foreach() step. Pass the zero-based index of the iteration to resume; other iterations remain suspended. Omit to resume all suspended iterations of the step with the same resumeData.
38
38
 
39
39
  **tracingOptions** (`TracingOptions`): Options for Tracing configuration.
40
40
 
@@ -139,143 +139,4 @@ your-template/
139
139
  ├── package.json
140
140
  ├── tsconfig.json
141
141
  └── README.md
142
- ```
143
-
144
- ## Creating templates
145
-
146
- ### Requirements
147
-
148
- Templates must meet these technical requirements:
149
-
150
- #### Project Structure
151
-
152
- - **Mastra code location**: All Mastra code must be in `src/mastra/` directory
153
-
154
- - **Component organization**:
155
-
156
- - Agents: `src/mastra/agents/`
157
- - Tools: `src/mastra/tools/`
158
- - Workflows: `src/mastra/workflows/`
159
- - Main config: `src/mastra/index.ts`
160
-
161
- #### TypeScript Configuration
162
-
163
- Use the standard Mastra TypeScript configuration:
164
-
165
- ```json
166
- {
167
- "compilerOptions": {
168
- "target": "ES2022",
169
- "module": "ES2022",
170
- "moduleResolution": "bundler",
171
- "esModuleInterop": true,
172
- "forceConsistentCasingInFileNames": true,
173
- "strict": true,
174
- "skipLibCheck": true,
175
- "noEmit": true,
176
- "outDir": "dist"
177
- },
178
- "include": ["src/**/*"]
179
- }
180
- ```
181
-
182
- #### Environment Configuration
183
-
184
- Include a `.env.example` file with all required environment variables:
185
-
186
- ```bash
187
- # LLM provider API keys (choose one or more)
188
- OPENAI_API_KEY=your_openai_api_key_here
189
- ANTHROPIC_API_KEY=your_anthropic_api_key_here
190
- GOOGLE_API_KEY=your_google_api_key_here
191
-
192
- # Other service API keys as needed
193
- OTHER_SERVICE_API_KEY=your_api_key_here
194
- ```
195
-
196
- ### Code Standards
197
-
198
- #### LLM Provider
199
-
200
- We recommend using OpenAI, Anthropic, or Google model providers for templates. Choose the provider that best fits your use case:
201
-
202
- ```typescript
203
- import { Agent } from '@mastra/core/agent'
204
-
205
- const agent = new Agent({
206
- id: 'example-agent',
207
- name: 'example-agent',
208
- model: 'openai/gpt-5.5', // or other provider strings
209
- instructions: 'Your agent instructions here',
210
- })
211
- ```
212
-
213
- #### Compatibility Requirements
214
-
215
- Templates must be:
216
-
217
- - **Single projects**: Not monorepos with multiple applications
218
- - **Framework-free**: No Next.js, Express, or other web framework boilerplate
219
- - **Mastra-focused**: Demonstrate Mastra functionality without additional layers
220
- - **Mergeable**: Structure code for seamless integration into existing projects
221
- - **Node.js compatible**: Support Node.js v22.13.0 and later
222
- - **ESM modules**: Use ES modules (`"type": "module"` in package.json)
223
-
224
- ### Documentation Requirements
225
-
226
- #### README Structure
227
-
228
- Every template must include a comprehensive README:
229
-
230
- ```markdown
231
- # Template Name
232
-
233
- Brief description of what the template demonstrates.
234
-
235
- ## Overview
236
-
237
- Detailed explanation of the template's functionality and use case.
238
-
239
- ## Setup
240
-
241
- 1. Copy `.env.example` to `.env` and fill in your API keys
242
- 2. Install dependencies: `npm install`
243
- 3. Run the project: `npm run dev`
244
-
245
- ## Environment variables
246
-
247
- - `OPENAI_API_KEY`: Your OpenAI API key. Get one at [OpenAI Platform](https://platform.openai.com/api-keys)
248
- - `ANTHROPIC_API_KEY`: Your Anthropic API key. Get one at [Anthropic Console](https://console.anthropic.com/settings/keys)
249
- - `GOOGLE_API_KEY`: Your Google AI API key. Get one at [Google AI Studio](https://makersuite.google.com/app/apikey)
250
- - `OTHER_API_KEY`: Description of what this key is for
251
-
252
- ## Usage
253
-
254
- Instructions on how to use the template and examples of expected behavior.
255
-
256
- ## Customization
257
-
258
- Guidelines for modifying the template for different use cases.
259
- ```
260
-
261
- #### Code Comments
262
-
263
- Include clear comments explaining:
264
-
265
- - Complex logic or algorithms
266
- - API integrations and their purpose
267
- - Configuration options and their effects
268
- - Example usage patterns
269
-
270
- ### Quality Standards
271
-
272
- Templates must demonstrate:
273
-
274
- - **Code quality** - Clean, well-commented, maintainable code
275
- - **Error handling** - Proper handling for external APIs and user inputs
276
- - **Type safety** - Full TypeScript typing with Zod validation
277
- - **Testing** - Verified functionality with fresh installations
278
-
279
- For information on contributing your own templates to the Mastra ecosystem, see the [Contributing Templates](https://mastra.ai/docs/community/contributing-templates) guide in the community section.
280
-
281
- > **Info:** Templates provide an excellent way to learn Mastra patterns and accelerate development. Contributing templates helps the entire community build better AI applications.
142
+ ```
@@ -59,7 +59,7 @@ By default, all tools read `BRIGHTDATA_API_TOKEN` from the environment. You can
59
59
 
60
60
  All factory functions accept `BrightDataClientOptions` from `@brightdata/sdk`:
61
61
 
62
- **apiKey** (`string`): Bright Data API token. Falls back to the \`BRIGHTDATA\_API\_TOKEN\` environment variable.
62
+ **apiKey** (`string`): Bright Data API token. Falls back to the BRIGHTDATA\_API\_TOKEN environment variable.
63
63
 
64
64
  Additional fields supported by the `bdclient` constructor (such as `timeout`, `webUnlockerZone`, `serpZone`, and `rateLimit`) can be passed through the same options object.
65
65
 
@@ -92,9 +92,9 @@ const searchTool = createBrightDataSearchTool()
92
92
 
93
93
  **query** (`string`): The search query.
94
94
 
95
- **country** (`string`): Two-letter country code for geo-targeted results (for example, \`us\` or \`gb\`).
95
+ **country** (`string`): Two-letter country code for geo-targeted results (for example, us or gb).
96
96
 
97
- **start** (`number`): Result offset for pagination. For example, \`10\` returns the second page of 10 results.
97
+ **start** (`number`): Result offset for pagination. For example, 10 returns the second page of 10 results.
98
98
 
99
99
  ### Output
100
100
 
@@ -108,7 +108,7 @@ const searchTool = createBrightDataSearchTool()
108
108
 
109
109
  **results.description** (`string`): Result snippet.
110
110
 
111
- **currentPage** (`number`): Page number returned by the SERP API. Defaults to \`1\` when the upstream response omits or returns a non-positive value.
111
+ **currentPage** (`number`): Page number returned by the SERP API. Defaults to 1 when the upstream response omits or returns a non-positive value.
112
112
 
113
113
  ## `createBrightDataFetchTool()`
114
114
 
@@ -54,9 +54,9 @@ export const shopAgent = new Agent({
54
54
 
55
55
  **config** (`CodeModeConfig`): Configuration for the code mode tool and generated instructions.
56
56
 
57
- **config.tools** (`ToolsInput`): Tools exposed to the generated code as \`external\_\<id>\` functions. Only these tools can be called.
57
+ **config.tools** (`ToolsInput`): Tools exposed to the generated code as external\_\<id> functions. Only these tools can be called.
58
58
 
59
- **config.sandbox** (`WorkspaceSandbox`): Sandbox used to execute the generated code. Required unless the agent runs in a workspace that provides a sandbox. Pass \`new LocalSandbox()\` to run on the host explicitly.
59
+ **config.sandbox** (`WorkspaceSandbox`): Sandbox used to execute the generated code. Required unless the agent runs in a workspace that provides a sandbox. Pass new LocalSandbox() to run on the host explicitly.
60
60
 
61
61
  **config.timeout** (`number`): Execution timeout in milliseconds.
62
62
 
@@ -68,9 +68,9 @@ export const shopAgent = new Agent({
68
68
 
69
69
  Returns a `CodeModeResult` object.
70
70
 
71
- **tool** (`Tool<any, any>`): The generated code mode tool. By default, its id is \`execute\_typescript\`.
71
+ **tool** (`Tool<any, any>`): The generated code mode tool. By default, its id is execute\_typescript.
72
72
 
73
- **instructions** (`string`): Generated model instructions with typed \`external\_\*\` declarations for the configured tools.
73
+ **instructions** (`string`): Generated model instructions with typed external\_\* declarations for the configured tools.
74
74
 
75
75
  ## CodeModeToolResult
76
76
 
@@ -80,7 +80,7 @@ The generated tool returns a `CodeModeToolResult`.
80
80
 
81
81
  **result** (`unknown`): The value returned by the generated code.
82
82
 
83
- **logs** (`string[]`): Captured console output from \`console.log\`, \`console.info\`, \`console.warn\`, and \`console.error\`, in order.
83
+ **logs** (`string[]`): Captured console output from console.log, console.info, console.warn, and console.error, in order.
84
84
 
85
85
  **error** (`{ message: string; name?: string; line?: number }`): Error details when the generated code throws or fails to execute.
86
86
 
@@ -35,33 +35,33 @@ export const tool = createTool({
35
35
 
36
36
  **description** (`string`): A description of what the tool does. This is used by the agent to decide when to use the tool.
37
37
 
38
- **inputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected input parameters for the tool's \`execute\` function.
38
+ **inputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected input parameters for the tool's execute function.
39
39
 
40
- **outputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected output structure of the tool's \`execute\` function.
40
+ **outputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected output structure of the tool's execute function.
41
41
 
42
42
  **strict** (`boolean`): When true, Mastra enables strict tool input generation on model adapters that support it. This helps supported providers return arguments that match the tool schema more closely.
43
43
 
44
- **toModelOutput** (`(output: TSchemaOut) => unknown`): Optional function that transforms the tool's \`execute\` output before it is sent back to the model. Use this to return \`text\`, \`json\`, or \`content\`-shaped outputs (including multimodal parts like images/files) to the model while still keeping the full raw output in your application code.
44
+ **toModelOutput** (`(output: TSchemaOut) => unknown`): Optional function that transforms the tool's execute output before it is sent back to the model. Use this to return text, json, or content-shaped outputs (including multimodal parts like images/files) to the model while still keeping the full raw output in your application code.
45
45
 
46
- **transform** (`ToolPayloadTransform`): Optional target-aware transform for tool payloads before they leave runtime for display streams or user-visible transcript messages. Configure \`display\` and \`transcript\` transforms for phases such as \`input\`, \`inputDelta\`, \`output\`, \`error\`, \`approval\`, \`suspend\`, and \`resume\`.
46
+ **transform** (`ToolPayloadTransform`): Optional target-aware transform for tool payloads before they leave runtime for display streams or user-visible transcript messages. Configure display and transcript transforms for phases such as input, inputDelta, output, error, approval, suspend, and resume.
47
47
 
48
- **suspendSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the structure of the payload passed to \`suspend()\`. This payload is returned to the client when the tool suspends execution.
48
+ **suspendSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the structure of the payload passed to suspend(). This payload is returned to the client when the tool suspends execution.
49
49
 
50
- **resumeSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected structure of \`resumeData\` when the tool is resumed. Used by the agent to extract data from user messages when \`autoResumeSuspendedTools\` is enabled.
50
+ **resumeSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected structure of resumeData when the tool is resumed. Used by the agent to extract data from user messages when autoResumeSuspendedTools is enabled.
51
51
 
52
- **requireApproval** (`boolean`): When true, the tool requires explicit approval before execution. The agent will emit a \`tool-call-approval\` chunk and pause until approved or declined.
52
+ **requireApproval** (`boolean`): When true, the tool requires explicit approval before execution. The agent will emit a tool-call-approval chunk and pause until approved or declined.
53
53
 
54
- **mcp** (`MCPToolProperties`): MCP-specific properties for tools exposed via Model Context Protocol. Includes \`annotations\` (tool behavior hints like \`title\`, \`readOnlyHint\`, \`destructiveHint\`, \`idempotentHint\`, \`openWorldHint\`) and \`\_meta\` (arbitrary metadata passed through to MCP clients).
54
+ **mcp** (`MCPToolProperties`): MCP-specific properties for tools exposed via Model Context Protocol. Includes annotations (tool behavior hints like title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint) and \_meta (arbitrary metadata passed through to MCP clients).
55
55
 
56
56
  **requestContextSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema for validating request context values. When provided, the context is validated before execute() runs, returning an error object if validation fails.
57
57
 
58
- **providerOptions** (`Record<string, Record<string, unknown>>`): Provider-specific options passed to the model when this tool is used. Keys are provider names, such as \`anthropic\` or \`openai\`, and values are provider-specific configuration objects.
58
+ **providerOptions** (`Record<string, Record<string, unknown>>`): Provider-specific options passed to the model when this tool is used. Keys are provider names, such as anthropic or openai, and values are provider-specific configuration objects.
59
59
 
60
60
  **inputExamples** (`Array<{ input: Record<string, unknown> }>`): Examples of valid tool inputs that supported model providers can use as input examples.
61
61
 
62
62
  **background** (`ToolBackgroundConfig`): Background task configuration for this tool. When enabled, the tool can execute in the background while the agent conversation continues.
63
63
 
64
- **execute** (`function`): The function that contains the tool's logic. Ordinary custom tools usually provide \`execute\`, but the type allows omission for tool definitions that are executed or adapted elsewhere. It receives two parameters: the validated input data based on inputSchema (first parameter) and an execution context object (second parameter) containing \`requestContext\`, \`abortSignal\`, and other execution metadata.
64
+ **execute** (`function`): The function that contains the tool's logic. Ordinary custom tools usually provide execute, but the type allows omission for tool definitions that are executed or adapted elsewhere. It receives two parameters: the validated input data based on inputSchema (first parameter) and an execution context object (second parameter) containing requestContext, abortSignal, and other execution metadata.
65
65
 
66
66
  **execute.input** (`z.infer<TInput>`): The validated input data based on inputSchema
67
67
 
@@ -77,15 +77,15 @@ export const tool = createTool({
77
77
 
78
78
  **execute.context.mcp** (`MCPToolExecutionContext`): MCP-specific context (elicitation, etc.)
79
79
 
80
- **execute.context.observe** (`ToolObserve`): Observability helpers for recording child spans and structured logs from inside a tool's execute function. Always provided — when no tracing context is active, \`span\` runs the function directly and \`log\` is a no-op.
80
+ **execute.context.observe** (`ToolObserve`): Observability helpers for recording child spans and structured logs from inside a tool's execute function. Always provided — when no tracing context is active, span runs the function directly and log is a no-op.
81
81
 
82
- **onInputStart** (`function`): Optional callback invoked when the tool call input streaming begins. Signature: \`(options: ToolCallOptions) => void | PromiseLike\<void>\`.
82
+ **onInputStart** (`function`): Optional callback invoked when the tool call input streaming begins. Signature: (options: ToolCallOptions) => void | PromiseLike\<void>.
83
83
 
84
- **onInputDelta** (`function`): Optional callback invoked for each incremental chunk of input text as it streams in. Signature: \`({ inputTextDelta, ...options }: { inputTextDelta: string } & ToolCallOptions) => void | PromiseLike\<void>\`.
84
+ **onInputDelta** (`function`): Optional callback invoked for each incremental chunk of input text as it streams in. Signature: ({ inputTextDelta, ...options }: { inputTextDelta: string } & ToolCallOptions) => void | PromiseLike\<void>.
85
85
 
86
- **onInputAvailable** (`function`): Optional callback invoked when the complete tool input is available and parsed. Signature: \`({ input, ...options }: { input: TSchemaIn } & ToolCallOptions) => void | PromiseLike\<void>\`.
86
+ **onInputAvailable** (`function`): Optional callback invoked when the complete tool input is available and parsed. Signature: ({ input, ...options }: { input: TSchemaIn } & ToolCallOptions) => void | PromiseLike\<void>.
87
87
 
88
- **onOutput** (`function`): Optional callback invoked after the tool has successfully executed and returned output. Signature: \`({ output, toolName, ...options }: { output: TSchemaOut; toolName: string } & Omit\<ToolCallOptions, 'messages'>) => void | PromiseLike\<void>\`.
88
+ **onOutput** (`function`): Optional callback invoked after the tool has successfully executed and returned output. Signature: ({ output, toolName, ...options }: { output: TSchemaOut; toolName: string } & Omit\<ToolCallOptions, 'messages'>) => void | PromiseLike\<void>.
89
89
 
90
90
  Runtime-populated fields such as `mastra` and `mcpMetadata` appear in source types but are set by Mastra or MCP adapters. You do not need to configure them for ordinary `createTool()` usage.
91
91
 
@@ -53,7 +53,7 @@ const graphTool = createGraphRAGTool({
53
53
 
54
54
  **providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). \*\*Important\*\*: Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
55
55
 
56
- **vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, \`vectorStoreName\` becomes optional.
56
+ **vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
57
57
 
58
58
  ## Returns
59
59
 
@@ -43,7 +43,7 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
43
43
 
44
44
  **eventSourceInit** (`EventSourceInit`): For SSE fallback: Custom fetch configuration for SSE connections. Required when using custom headers with SSE.
45
45
 
46
- **fetch** (`MastraFetchLike`): For HTTP servers: Custom fetch implementation used for all network requests. Receives an optional third \`requestContext\` parameter containing request-scoped data (e.g., authentication cookies, bearer tokens) from the incoming request. When provided, this function will be used for all HTTP requests, allowing you to add dynamic authentication headers, forward request-scoped credentials to the MCP server, customize request behavior per-request, or intercept and modify requests/responses. When \`fetch\` is provided, \`requestInit\`, \`eventSourceInit\`, and \`authProvider\` become optional, as you can handle these concerns within your custom fetch function.
46
+ **fetch** (`MastraFetchLike`): For HTTP servers: Custom fetch implementation used for all network requests. Receives an optional third requestContext parameter containing request-scoped data (e.g., authentication cookies, bearer tokens) from the incoming request. When provided, this function will be used for all HTTP requests, allowing you to add dynamic authentication headers, forward request-scoped credentials to the MCP server, customize request behavior per-request, or intercept and modify requests/responses. When fetch is provided, requestInit, eventSourceInit, and authProvider become optional, as you can handle these concerns within your custom fetch function.
47
47
 
48
48
  **logger** (`LogHandler`): Optional additional handler for logging.
49
49
 
@@ -59,7 +59,7 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
59
59
 
60
60
  **instructionsMaxLength** (`number`): Maximum number of server instruction characters to append to an agent's system prompt. (Default: `512`)
61
61
 
62
- **requireToolApproval** (`boolean | (params: RequireToolApprovalContext) => boolean | Promise<boolean>`): Require human approval before executing tools from this server. When set to \`true\`, all tools require approval. When set to a function, the function is called with the tool name, arguments, request context, and any tool annotations advertised by the server to dynamically decide whether approval is needed.
62
+ **requireToolApproval** (`boolean | (params: RequireToolApprovalContext) => boolean | Promise<boolean>`): Require human approval before executing tools from this server. When set to true, all tools require approval. When set to a function, the function is called with the tool name, arguments, request context, and any tool annotations advertised by the server to dynamically decide whether approval is needed.
63
63
 
64
64
  ## Tool approval
65
65