@mastra/mcp-docs-server 1.1.8 → 1.1.9-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 (228) hide show
  1. package/.docs/docs/agents/agent-memory.md +2 -2
  2. package/.docs/docs/agents/guardrails.md +3 -3
  3. package/.docs/docs/agents/network-approval.md +4 -1
  4. package/.docs/docs/agents/networks.md +1 -1
  5. package/.docs/docs/agents/overview.md +1 -1
  6. package/.docs/docs/agents/processors.md +35 -17
  7. package/.docs/docs/agents/structured-output.md +1 -1
  8. package/.docs/docs/agents/using-tools.md +2 -2
  9. package/.docs/docs/build-with-ai/mcp-docs-server.md +4 -4
  10. package/.docs/docs/build-with-ai/skills.md +1 -1
  11. package/.docs/docs/community/discord.md +1 -1
  12. package/.docs/docs/community/licensing.md +1 -1
  13. package/.docs/docs/deployment/mastra-server.md +1 -1
  14. package/.docs/docs/deployment/studio.md +2 -2
  15. package/.docs/docs/deployment/web-framework.md +1 -1
  16. package/.docs/docs/evals/overview.md +1 -1
  17. package/.docs/docs/getting-started/build-with-ai.md +1 -1
  18. package/.docs/docs/getting-started/project-structure.md +1 -1
  19. package/.docs/docs/index.md +62 -16
  20. package/.docs/docs/mastra-cloud/deployment.md +1 -1
  21. package/.docs/docs/mastra-cloud/studio.md +1 -1
  22. package/.docs/docs/mcp/publishing-mcp-server.md +1 -1
  23. package/.docs/docs/memory/memory-processors.md +1 -1
  24. package/.docs/docs/memory/message-history.md +2 -2
  25. package/.docs/docs/memory/observational-memory.md +6 -2
  26. package/.docs/docs/memory/semantic-recall.md +2 -2
  27. package/.docs/docs/memory/storage.md +1 -1
  28. package/.docs/docs/memory/working-memory.md +6 -6
  29. package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
  30. package/.docs/docs/observability/tracing/exporters/default.md +1 -1
  31. package/.docs/docs/observability/tracing/overview.md +4 -4
  32. package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +2 -2
  33. package/.docs/docs/rag/chunking-and-embedding.md +1 -1
  34. package/.docs/docs/rag/vector-databases.md +2 -2
  35. package/.docs/docs/server/auth/auth0.md +1 -1
  36. package/.docs/docs/server/auth/firebase.md +1 -1
  37. package/.docs/docs/server/auth/simple-auth.md +1 -1
  38. package/.docs/docs/server/auth.md +1 -1
  39. package/.docs/docs/server/mastra-client.md +1 -1
  40. package/.docs/docs/server/mastra-server.md +1 -1
  41. package/.docs/docs/server/server-adapters.md +2 -2
  42. package/.docs/docs/streaming/events.md +1 -1
  43. package/.docs/docs/streaming/overview.md +1 -1
  44. package/.docs/docs/streaming/tool-streaming.md +44 -30
  45. package/.docs/docs/streaming/workflow-streaming.md +1 -1
  46. package/.docs/docs/workflows/control-flow.md +44 -2
  47. package/.docs/docs/workflows/error-handling.md +1 -1
  48. package/.docs/docs/workflows/overview.md +3 -3
  49. package/.docs/docs/workflows/snapshots.md +1 -1
  50. package/.docs/docs/workflows/time-travel.md +2 -2
  51. package/.docs/docs/workspace/filesystem.md +2 -2
  52. package/.docs/docs/workspace/overview.md +52 -7
  53. package/.docs/docs/workspace/sandbox.md +72 -13
  54. package/.docs/docs/workspace/skills.md +2 -2
  55. package/.docs/guides/build-your-ui/copilotkit.md +1 -1
  56. package/.docs/guides/deployment/inngest.md +4 -4
  57. package/.docs/guides/guide/ai-recruiter.md +1 -1
  58. package/.docs/guides/guide/github-actions-pr-description.md +2 -2
  59. package/.docs/guides/guide/notes-mcp-server.md +1 -1
  60. package/.docs/guides/guide/stock-agent.md +2 -2
  61. package/.docs/guides/migrations/agentnetwork.md +1 -1
  62. package/.docs/guides/migrations/upgrade-to-v1/client.md +2 -2
  63. package/.docs/guides/migrations/upgrade-to-v1/deployment.md +1 -1
  64. package/.docs/guides/migrations/upgrade-to-v1/memory.md +2 -2
  65. package/.docs/guides/migrations/upgrade-to-v1/storage.md +1 -1
  66. package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
  67. package/.docs/guides/migrations/upgrade-to-v1/workflows.md +5 -5
  68. package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
  69. package/.docs/models/gateways/netlify.md +1 -2
  70. package/.docs/models/gateways/openrouter.md +8 -1
  71. package/.docs/models/gateways/vercel.md +3 -1
  72. package/.docs/models/index.md +1 -1
  73. package/.docs/models/providers/abacus.md +21 -11
  74. package/.docs/models/providers/aihubmix.md +7 -2
  75. package/.docs/models/providers/alibaba-cn.md +80 -71
  76. package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
  77. package/.docs/models/providers/alibaba-coding-plan.md +78 -0
  78. package/.docs/models/providers/chutes.md +1 -1
  79. package/.docs/models/providers/clarifai.md +81 -0
  80. package/.docs/models/providers/cloudferro-sherlock.md +5 -4
  81. package/.docs/models/providers/cloudflare-workers-ai.md +3 -2
  82. package/.docs/models/providers/cortecs.md +7 -5
  83. package/.docs/models/providers/deepinfra.md +7 -2
  84. package/.docs/models/providers/deepseek.md +1 -1
  85. package/.docs/models/providers/drun.md +73 -0
  86. package/.docs/models/providers/firmware.md +28 -20
  87. package/.docs/models/providers/google.md +3 -1
  88. package/.docs/models/providers/inception.md +4 -2
  89. package/.docs/models/providers/kilo.md +3 -1
  90. package/.docs/models/providers/nano-gpt.md +519 -40
  91. package/.docs/models/providers/nebius.md +34 -34
  92. package/.docs/models/providers/nvidia.md +4 -2
  93. package/.docs/models/providers/ollama-cloud.md +1 -2
  94. package/.docs/models/providers/openai.md +3 -1
  95. package/.docs/models/providers/opencode.md +36 -33
  96. package/.docs/models/providers/poe.md +8 -2
  97. package/.docs/models/providers/qiniu-ai.md +20 -5
  98. package/.docs/models/providers/requesty.md +17 -1
  99. package/.docs/models/providers/siliconflow-cn.md +7 -1
  100. package/.docs/models/providers/togetherai.md +1 -3
  101. package/.docs/models/providers/xai.md +28 -25
  102. package/.docs/models/providers/xiaomi.md +1 -1
  103. package/.docs/models/providers/zenmux.md +3 -1
  104. package/.docs/models/providers.md +4 -0
  105. package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
  106. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  107. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  108. package/.docs/reference/agents/getDescription.md +1 -1
  109. package/.docs/reference/agents/network.md +3 -1
  110. package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
  111. package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
  112. package/.docs/reference/ai-sdk/network-route.md +2 -0
  113. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
  114. package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
  115. package/.docs/reference/auth/auth0.md +3 -3
  116. package/.docs/reference/auth/firebase.md +1 -1
  117. package/.docs/reference/auth/workos.md +2 -2
  118. package/.docs/reference/cli/mastra.md +4 -4
  119. package/.docs/reference/client-js/mastra-client.md +1 -1
  120. package/.docs/reference/configuration.md +62 -6
  121. package/.docs/reference/core/getDeployer.md +1 -1
  122. package/.docs/reference/core/getLogger.md +1 -1
  123. package/.docs/reference/core/getScorer.md +2 -2
  124. package/.docs/reference/core/getServer.md +1 -1
  125. package/.docs/reference/core/getStorage.md +1 -1
  126. package/.docs/reference/core/getStoredAgentById.md +1 -1
  127. package/.docs/reference/core/getTelemetry.md +1 -1
  128. package/.docs/reference/core/getWorkflow.md +1 -1
  129. package/.docs/reference/core/listAgents.md +1 -1
  130. package/.docs/reference/core/listMCPServers.md +1 -1
  131. package/.docs/reference/core/listStoredAgents.md +1 -1
  132. package/.docs/reference/core/listVectors.md +1 -1
  133. package/.docs/reference/core/mastra-class.md +1 -1
  134. package/.docs/reference/core/setLogger.md +1 -1
  135. package/.docs/reference/core/setStorage.md +1 -1
  136. package/.docs/reference/datasets/dataset.md +1 -1
  137. package/.docs/reference/datasets/datasets-manager.md +1 -1
  138. package/.docs/reference/datasets/get.md +2 -2
  139. package/.docs/reference/datasets/getDetails.md +1 -1
  140. package/.docs/reference/datasets/listItems.md +1 -1
  141. package/.docs/reference/deployer/vercel.md +1 -1
  142. package/.docs/reference/evals/answer-relevancy.md +1 -1
  143. package/.docs/reference/evals/completeness.md +1 -1
  144. package/.docs/reference/evals/context-precision.md +3 -3
  145. package/.docs/reference/evals/context-relevance.md +1 -1
  146. package/.docs/reference/evals/hallucination.md +3 -9
  147. package/.docs/reference/evals/keyword-coverage.md +1 -1
  148. package/.docs/reference/evals/mastra-scorer.md +1 -1
  149. package/.docs/reference/evals/noise-sensitivity.md +2 -2
  150. package/.docs/reference/evals/textual-difference.md +1 -1
  151. package/.docs/reference/evals/tone-consistency.md +1 -1
  152. package/.docs/reference/evals/tool-call-accuracy.md +1 -1
  153. package/.docs/reference/harness/harness-class.md +4 -2
  154. package/.docs/reference/index.md +2 -0
  155. package/.docs/reference/memory/cloneThread.md +1 -1
  156. package/.docs/reference/memory/observational-memory.md +7 -5
  157. package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
  158. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
  159. package/.docs/reference/observability/tracing/spans.md +2 -0
  160. package/.docs/reference/processors/message-history-processor.md +1 -1
  161. package/.docs/reference/processors/processor-interface.md +6 -2
  162. package/.docs/reference/processors/token-limiter-processor.md +2 -2
  163. package/.docs/reference/rag/metadata-filters.md +10 -10
  164. package/.docs/reference/server/create-route.md +2 -0
  165. package/.docs/reference/server/koa-adapter.md +1 -1
  166. package/.docs/reference/server/register-api-route.md +2 -2
  167. package/.docs/reference/storage/cloudflare-d1.md +3 -3
  168. package/.docs/reference/storage/cloudflare.md +1 -1
  169. package/.docs/reference/storage/convex.md +1 -1
  170. package/.docs/reference/storage/dynamodb.md +2 -2
  171. package/.docs/reference/storage/lance.md +2 -2
  172. package/.docs/reference/storage/mongodb.md +1 -1
  173. package/.docs/reference/storage/mssql.md +1 -1
  174. package/.docs/reference/storage/postgresql.md +2 -2
  175. package/.docs/reference/storage/upstash.md +1 -1
  176. package/.docs/reference/streaming/workflows/observeStream.md +1 -1
  177. package/.docs/reference/templates/overview.md +1 -1
  178. package/.docs/reference/tools/create-tool.md +1 -1
  179. package/.docs/reference/tools/mcp-server.md +4 -4
  180. package/.docs/reference/vectors/chroma.md +2 -2
  181. package/.docs/reference/vectors/couchbase.md +6 -6
  182. package/.docs/reference/vectors/pg.md +2 -0
  183. package/.docs/reference/vectors/s3vectors.md +5 -5
  184. package/.docs/reference/voice/azure.md +4 -2
  185. package/.docs/reference/voice/cloudflare.md +4 -2
  186. package/.docs/reference/voice/elevenlabs.md +1 -1
  187. package/.docs/reference/voice/google-gemini-live.md +2 -2
  188. package/.docs/reference/voice/google.md +3 -3
  189. package/.docs/reference/voice/mastra-voice.md +1 -1
  190. package/.docs/reference/voice/murf.md +2 -2
  191. package/.docs/reference/voice/openai-realtime.md +3 -1
  192. package/.docs/reference/voice/openai.md +7 -3
  193. package/.docs/reference/voice/playai.md +4 -2
  194. package/.docs/reference/voice/sarvam.md +3 -1
  195. package/.docs/reference/voice/speechify.md +6 -4
  196. package/.docs/reference/voice/voice.addInstructions.md +2 -2
  197. package/.docs/reference/voice/voice.addTools.md +1 -1
  198. package/.docs/reference/voice/voice.close.md +2 -2
  199. package/.docs/reference/voice/voice.connect.md +4 -2
  200. package/.docs/reference/voice/voice.events.md +2 -2
  201. package/.docs/reference/voice/voice.getSpeakers.md +1 -1
  202. package/.docs/reference/voice/voice.listen.md +11 -5
  203. package/.docs/reference/voice/voice.off.md +2 -2
  204. package/.docs/reference/voice/voice.on.md +2 -2
  205. package/.docs/reference/voice/voice.speak.md +14 -4
  206. package/.docs/reference/voice/voice.updateConfig.md +1 -1
  207. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  208. package/.docs/reference/workspace/blaxel-sandbox.md +164 -0
  209. package/.docs/reference/workspace/daytona-sandbox.md +48 -139
  210. package/.docs/reference/workspace/e2b-sandbox.md +39 -75
  211. package/.docs/reference/workspace/filesystem.md +24 -10
  212. package/.docs/reference/workspace/gcs-filesystem.md +20 -0
  213. package/.docs/reference/workspace/local-filesystem.md +23 -9
  214. package/.docs/reference/workspace/local-sandbox.md +23 -98
  215. package/.docs/reference/workspace/process-manager.md +296 -0
  216. package/.docs/reference/workspace/s3-filesystem.md +20 -0
  217. package/.docs/reference/workspace/sandbox.md +9 -1
  218. package/.docs/reference/workspace/workspace-class.md +93 -25
  219. package/CHANGELOG.md +8 -0
  220. package/dist/tools/course.d.ts +7 -27
  221. package/dist/tools/course.d.ts.map +1 -1
  222. package/dist/tools/docs.d.ts +6 -18
  223. package/dist/tools/docs.d.ts.map +1 -1
  224. package/dist/tools/embedded-docs.d.ts +12 -112
  225. package/dist/tools/embedded-docs.d.ts.map +1 -1
  226. package/dist/tools/migration.d.ts +6 -26
  227. package/dist/tools/migration.d.ts.map +1 -1
  228. package/package.json +7 -7
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Warning:** **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.getDefaultOptions()`](https://mastra.ai/reference/agents/getDefaultOptions) method instead.
4
4
 
5
- Agents can be configured with default generation options for controlling model behavior, output formatting and tool and workflow calls. The `.getDefaultGenerateOptionsLegacy()` method retrieves these defaults, resolving them if they are functions. These options apply to all `generateLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
5
+ Agents can be configured with default generation options for controlling model behavior, output formatting and tool and workflow calls. The `.getDefaultGenerateOptionsLegacy()` method retrieves these defaults, resolving them if they're functions. These options apply to all `generateLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Agent.getDefaultOptions()
2
2
 
3
- Agents can be configured with default options for memory usage, output format, and iteration steps. The `.getDefaultOptions()` method returns these defaults, resolving them if they are functions. These options apply to all `stream()` and `generate()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
3
+ Agents can be configured with default options for memory usage, output format, and iteration steps. The `.getDefaultOptions()` method returns these defaults, resolving them if they're functions. These options apply to all `stream()` and `generate()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
4
4
 
5
5
  ## Usage example
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Warning:** **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.getDefaultOptions()`](https://mastra.ai/reference/agents/getDefaultOptions) method instead.
4
4
 
5
- Agents can be configured with default streaming options for memory usage, output format, and iteration steps. The `.getDefaultStreamOptionsLegacy()` method returns these defaults, resolving them if they are functions. These options apply to all `streamLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
5
+ Agents can be configured with default streaming options for memory usage, output format, and iteration steps. The `.getDefaultStreamOptionsLegacy()` method returns these defaults, resolving them if they're functions. These options apply to all `streamLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Agent.getDescription()
2
2
 
3
- The `.getDescription()` method retrieves the description configured for an agent. This method returns a simple string description that describes the agent's purpose and capabilities.
3
+ The `.getDescription()` method retrieves the description configured for an agent. This method returns a string description that describes the agent's purpose and capabilities.
4
4
 
5
5
  ## Usage example
6
6
 
@@ -1,5 +1,7 @@
1
1
  # Agent.network()
2
2
 
3
+ > **Deprecated:** Agent networks are deprecated and will be removed in a future release. Use the [supervisor pattern](https://mastra.ai/docs/agents/supervisor-agents) with `agent.stream()` or `agent.generate()` instead. See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade.
4
+
3
5
  The `.network()` method enables multi-agent collaboration and routing. This method accepts messages and optional execution options.
4
6
 
5
7
  ## Usage example
@@ -188,7 +190,7 @@ When using structured output, additional chunk types are emitted:
188
190
 
189
191
  ## Aborting a Network
190
192
 
191
- Use `abortSignal` to cancel a running network. When aborted, the network stops routing, cancels any in-progress sub-agent, tool, or workflow execution, and does not save partial results to memory.
193
+ Use `abortSignal` to cancel a running network. When aborted, the network stops routing, cancels any in-progress sub-agent, tool, or workflow execution, and doesn't save partial results to memory.
192
194
 
193
195
  ```typescript
194
196
  const controller = new AbortController()
@@ -40,6 +40,8 @@ export async function POST(req: Request) {
40
40
 
41
41
  **params.runId** (`string`): The run ID. Required when \`resumeData\` is provided.
42
42
 
43
+ **params.providerOptions** (`Record<string, Record<string, unknown>>`): Provider-specific options passed to the language model (e.g. \`{ openai: { reasoningEffort: "high" } }\`). Merged with \`defaultOptions.providerOptions\`, with \`params\` taking precedence.
44
+
43
45
  **params.requestContext** (`RequestContext`): Request context to pass to the agent execution.
44
46
 
45
47
  **defaultOptions** (`AgentExecutionOptions`): Default options passed to agent execution. These are merged with params, with params taking precedence.
@@ -1,5 +1,7 @@
1
1
  # handleNetworkStream()
2
2
 
3
+ > **Deprecated:** Agent networks are deprecated and will be removed in a future release. Use the [supervisor pattern](https://mastra.ai/docs/agents/supervisor-agents) with `agent.stream()` or `agent.generate()` instead. See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade.
4
+
3
5
  Framework-agnostic handler for streaming network execution in AI SDK-compatible format. Use this function directly when you need to handle network streaming outside Hono or Mastra's own [apiRoutes](https://mastra.ai/docs/server/custom-api-routes) feature.
4
6
 
5
7
  `handleNetworkStream()` returns a `ReadableStream` that you can wrap with [`createUIMessageStreamResponse()`](https://ai-sdk.dev/docs/reference/ai-sdk-ui/create-ui-message-stream-response).
@@ -1,5 +1,7 @@
1
1
  # networkRoute()
2
2
 
3
+ > **Deprecated:** Agent networks are deprecated and will be removed in a future release. Use the [supervisor pattern](https://mastra.ai/docs/agents/supervisor-agents) with `agent.stream()` or `agent.generate()` instead. See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade.
4
+
3
5
  Creates a network route handler for streaming network execution using the AI SDK format. This function registers an HTTP `POST` endpoint that accepts messages, executes an agent network, and streams the response back to the client in AI SDK-compatible format. Agent networks allow a routing agent to delegate tasks to other agents. You have to use it inside a [custom API route](https://mastra.ai/docs/server/custom-api-routes).
4
6
 
5
7
  Use [`handleNetworkStream()`](https://mastra.ai/reference/ai-sdk/handle-network-stream) if you need a framework-agnostic handler.
@@ -57,7 +57,7 @@ Returns an array of AI SDK V4 `UIMessage` objects with the following structure:
57
57
 
58
58
  ## Examples
59
59
 
60
- ### Converting simple text messages
60
+ ### Converting text messages
61
61
 
62
62
  ```typescript
63
63
  import { toAISdkV4Messages } from '@mastra/ai-sdk'
@@ -54,7 +54,7 @@ Returns an array of AI SDK V5+ `UIMessage` objects with the following structure:
54
54
 
55
55
  ## Examples
56
56
 
57
- ### Converting simple text messages
57
+ ### Converting text messages
58
58
 
59
59
  ```typescript
60
60
  import { toAISdkV5Messages } from '@mastra/ai-sdk/ui'
@@ -18,7 +18,7 @@ export const mastra = new Mastra({
18
18
  })
19
19
  ```
20
20
 
21
- > **Note:** You can omit the constructor parameters if you have the appropriately named environment variables (`AUTH0_DOMAIN` and `AUTH0_AUDIENCE`) set. In that case, simply use `new MastraAuthAuth0()` without any arguments.
21
+ > **Note:** You can omit the constructor parameters if you have the appropriately named environment variables (`AUTH0_DOMAIN` and `AUTH0_AUDIENCE`) set. In that case, use `new MastraAuthAuth0()` without any arguments.
22
22
 
23
23
  ## Constructor parameters
24
24
 
@@ -32,7 +32,7 @@ export const mastra = new Mastra({
32
32
 
33
33
  ## Environment Variables
34
34
 
35
- The following environment variables are automatically used when constructor options are not provided:
35
+ The following environment variables are automatically used when constructor options aren't provided:
36
36
 
37
37
  **AUTH0\_DOMAIN** (`string`): Your Auth0 domain. Can be found in your Auth0 Dashboard under Applications > Settings.
38
38
 
@@ -44,7 +44,7 @@ By default, `MastraAuthAuth0` validates Auth0 JWT tokens and allows access to al
44
44
 
45
45
  1. **Token Verification**: The JWT token is verified using Auth0's public keys (JWKS)
46
46
  2. **Signature Validation**: Ensures the token was signed by your Auth0 tenant
47
- 3. **Expiration Check**: Verifies the token has not expired
47
+ 3. **Expiration Check**: Verifies the token hasn't expired
48
48
  4. **Audience Validation**: Confirms the token was issued for your specific API (audience)
49
49
  5. **Issuer Validation**: Ensures the token was issued by your Auth0 domain
50
50
 
@@ -46,7 +46,7 @@ export const mastra = new Mastra({
46
46
 
47
47
  ## Environment Variables
48
48
 
49
- The following environment variables are automatically used when constructor options are not provided:
49
+ The following environment variables are automatically used when constructor options aren't provided:
50
50
 
51
51
  **FIREBASE\_SERVICE\_ACCOUNT** (`string`): Path to Firebase service account JSON file. Used if serviceAccount option is not provided.
52
52
 
@@ -18,7 +18,7 @@ export const mastra = new Mastra({
18
18
  })
19
19
  ```
20
20
 
21
- > **Note:** You can omit the constructor parameters if you have the appropriately named environment variables (`WORKOS_API_KEY` and `WORKOS_CLIENT_ID`) set. In that case, simply use `new MastraAuthWorkos()` without any arguments.
21
+ > **Note:** You can omit the constructor parameters if you have the appropriately named environment variables (`WORKOS_API_KEY` and `WORKOS_CLIENT_ID`) set. In that case, use `new MastraAuthWorkos()` without any arguments.
22
22
 
23
23
  ## Constructor parameters
24
24
 
@@ -32,7 +32,7 @@ export const mastra = new Mastra({
32
32
 
33
33
  ## Environment Variables
34
34
 
35
- The following environment variables are automatically used when constructor options are not provided:
35
+ The following environment variables are automatically used when constructor options aren't provided:
36
36
 
37
37
  **WORKOS\_API\_KEY** (`string`): Your WorkOS API key. Can be found in your WorkOS Dashboard under API Keys.
38
38
 
@@ -30,7 +30,7 @@ Comma-separated list of custom arguments to pass to the Node.js process, e.g. `-
30
30
 
31
31
  #### `--request-context-presets`
32
32
 
33
- Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. When provided, a dropdown appears in Studio's request context editor, letting you quickly switch between preset configurations.
33
+ Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. When provided, a dropdown displays in Studio's request context editor, letting you quickly switch between preset configurations.
34
34
 
35
35
  ```bash
36
36
  mastra dev --request-context-presets ./presets.json
@@ -57,7 +57,7 @@ Set `MASTRA_SKIP_PEERDEP_CHECK=1` to skip the peer dependency version mismatch c
57
57
  MASTRA_SKIP_PEERDEP_CHECK=1 mastra dev
58
58
  ```
59
59
 
60
- This is useful during monorepo development when peer dependencies may be bumped but packages are not yet published.
60
+ This is useful during monorepo development when peer dependencies may be bumped but packages aren't yet published.
61
61
 
62
62
  #### Disable build caching
63
63
 
@@ -101,7 +101,7 @@ These are forwarded to the Mastra model router and will work with any `"openai/.
101
101
 
102
102
  ## `mastra build`
103
103
 
104
- The `mastra build` command bundles your Mastra project into a production-ready Hono server. [Hono](https://hono.dev/) is a lightweight, type-safe web framework that makes it easy to deploy Mastra agents as HTTP endpoints with middleware support.
104
+ The `mastra build` command bundles your Mastra project into a production-ready Hono server. [Hono](https://hono.dev/) is a lightweight, type-safe web framework that makes it straightforward to deploy Mastra agents as HTTP endpoints with middleware support.
105
105
 
106
106
  Under the hood Mastra's Rollup server locates your Mastra entry file and bundles it to a production-ready Hono server. During that bundling it tree-shakes your code and generates source maps for debugging.
107
107
 
@@ -253,7 +253,7 @@ If enabled, example code is written to the list of components (e.g. example agen
253
253
 
254
254
  #### `--no-example`
255
255
 
256
- Do not include example code. Useful when using the `--default` flag.
256
+ Don't include example code. Useful when using the `--default` flag.
257
257
 
258
258
  #### `--mcp`
259
259
 
@@ -1,6 +1,6 @@
1
1
  # Mastra Client SDK
2
2
 
3
- The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/deployment/mastra-server) from your client environment.
3
+ The Mastra Client SDK provides a type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/deployment/mastra-server) from your client environment.
4
4
 
5
5
  ## Usage example
6
6
 
@@ -59,7 +59,7 @@ export const mastra = new Mastra({
59
59
 
60
60
  Event handlers for the internal pub/sub system. Maps event topics to handler functions that are called when events are published to those topics.
61
61
 
62
- > **Warning:** This is used internally by Mastra's workflow engine. Most users will not need to configure this option.
62
+ > **Warning:** This is used internally by Mastra's workflow engine. Most users won't need to configure this option.
63
63
 
64
64
  ```typescript
65
65
  import { Mastra } from '@mastra/core'
@@ -94,19 +94,39 @@ export const mastra = new Mastra({
94
94
 
95
95
  ### idGenerator
96
96
 
97
- **Type:** `() => string`\
97
+ **Type:** `(context?: IdGeneratorContext) => string`\
98
98
  **Default:** `crypto.randomUUID()`
99
99
 
100
- Custom ID generator function for creating unique identifiers.
100
+ Custom ID generator function for creating unique identifiers. Mastra passes optional context so you can generate IDs based on what's being created.
101
101
 
102
- > **Warning:** This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users will not need to configure this option.
102
+ `IdGeneratorContext` includes:
103
+
104
+ - `idType`: `'thread' | 'message' | 'run' | 'step' | 'generic'`
105
+ - `source?`: `'agent' | 'workflow' | 'memory'`
106
+ - `entityId?`: ID of the requesting agent/workflow/memory entity
107
+ - `threadId?`: Thread ID when relevant (for example, when creating message IDs)
108
+ - `resourceId?`: Resource ID when relevant (for example, user-scoped threads)
109
+ - `role?`: Message role when creating a message ID
110
+ - `stepType?`: Workflow step type when creating a step ID
111
+
112
+ > **Warning:** This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users won't need to configure this option.
103
113
 
104
114
  ```typescript
105
115
  import { Mastra } from '@mastra/core'
106
116
  import { nanoid } from 'nanoid'
107
117
 
108
118
  export const mastra = new Mastra({
109
- idGenerator: () => nanoid(),
119
+ idGenerator: context => {
120
+ if (context?.idType === 'message' && context?.threadId) {
121
+ return `msg-${context.threadId}-${nanoid(8)}`
122
+ }
123
+
124
+ if (context?.idType === 'run' && context?.source && context?.entityId) {
125
+ return `${context.source}-run-${context.entityId}-${nanoid(6)}`
126
+ }
127
+
128
+ return nanoid()
129
+ },
110
130
  })
111
131
  ```
112
132
 
@@ -243,7 +263,7 @@ export const mastra = new Mastra({
243
263
 
244
264
  Pub/sub system for event-driven communication between components. Used internally by Mastra for workflow event processing and component communication.
245
265
 
246
- > **Warning:** This is used internally by Mastra. Most users will not need to configure this option.
266
+ > **Warning:** This is used internally by Mastra. Most users won't need to configure this option.
247
267
 
248
268
  ```typescript
249
269
  import { Mastra } from '@mastra/core'
@@ -693,6 +713,42 @@ export const mastra = new Mastra({
693
713
  })
694
714
  ```
695
715
 
716
+ ### server.onValidationError
717
+
718
+ **Type:** `(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`
719
+
720
+ Custom handler called when a request fails Zod schema validation. Use this to customize validation error responses, change the status code, or format errors to match your API standards.
721
+
722
+ Return a `{ status, body }` object to override the default `400` response, or `undefined` to fall through to the default behavior. This hook is supported by all server adapters (Hono, Express, Fastify, Koa).
723
+
724
+ The `context` parameter indicates which part of the request failed validation:
725
+
726
+ - `'query'` — query parameters
727
+ - `'body'` — request body
728
+ - `'path'` — path parameters
729
+
730
+ ```typescript
731
+ import { Mastra } from '@mastra/core'
732
+
733
+ export const mastra = new Mastra({
734
+ server: {
735
+ onValidationError: (error, context) => ({
736
+ status: 422,
737
+ body: {
738
+ ok: false,
739
+ errors: error.issues.map(i => ({
740
+ path: i.path.join('.'),
741
+ message: i.message,
742
+ })),
743
+ source: context,
744
+ },
745
+ }),
746
+ },
747
+ })
748
+ ```
749
+
750
+ You can also set `onValidationError` on individual routes created with `createRoute()`. A route-level hook takes precedence over the server-level hook.
751
+
696
752
  ### server.port
697
753
 
698
754
  **Type:** `number`\
@@ -10,7 +10,7 @@ mastra.getDeployer()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -10,7 +10,7 @@ mastra.getLogger()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -1,6 +1,6 @@
1
1
  # getScorer()
2
2
 
3
- The `getScorer()` method retrieves a specific scorer that was registered with the Mastra instance using its registration key. This method provides type-safe access to scorers and throws an error if the requested scorer is not found.
3
+ The `getScorer()` method retrieves a specific scorer that was registered with the Mastra instance using its registration key. This method provides type-safe access to scorers and throws an error if the requested scorer isn't found.
4
4
 
5
5
  ## Usage Example
6
6
 
@@ -34,7 +34,7 @@ await weatherAgent.generate('What is the weather in Rome', {
34
34
 
35
35
  This method throws a `MastraError` if:
36
36
 
37
- - The scorer with the specified key is not found
37
+ - The scorer with the specified key isn't found
38
38
  - No scorers are registered with the Mastra instance
39
39
 
40
40
  ```typescript
@@ -10,7 +10,7 @@ mastra.getServer()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -10,7 +10,7 @@ mastra.getStorage()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -46,7 +46,7 @@ When creating an `Agent` instance from stored configuration, the method resolves
46
46
  - **Memory**: Resolved from `memory` registered in Mastra config
47
47
  - **Scorers**: Resolved from `scorers` registered in Mastra config, including sampling configuration
48
48
 
49
- If a referenced primitive is not found in the registry, a warning is logged but the agent is still created.
49
+ If a referenced primitive isn't found in the registry, a warning is logged but the agent is still created.
50
50
 
51
51
  ## StorageAgentType
52
52
 
@@ -10,7 +10,7 @@ mastra.getTelemetry()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -25,7 +25,7 @@ For best TypeScript support, use `getWorkflow()` with the workflow's **registrat
25
25
  - Output data schemas
26
26
  - Step results
27
27
 
28
- If you need to retrieve a workflow by its `id` property instead of its registration key, you can use `getWorkflowById()`, but note that type inference will not be as precise.
28
+ If you need to retrieve a workflow by its `id` property instead of its registration key, you can use `getWorkflowById()`, but note that type inference won't be as precise.
29
29
 
30
30
  ## Parameters
31
31
 
@@ -10,7 +10,7 @@ mastra.listAgents()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -38,7 +38,7 @@ const servers = mastra.listMCPServers()
38
38
 
39
39
  ## Parameters
40
40
 
41
- This method does not accept any parameters.
41
+ This method doesn't accept any parameters.
42
42
 
43
43
  ## Returns
44
44
 
@@ -63,7 +63,7 @@ When creating `Agent` instances (default behavior), each stored agent's configur
63
63
  - **Memory**: Resolved from `memory` registered in Mastra config
64
64
  - **Scorers**: Resolved from `scorers` registered in Mastra config
65
65
 
66
- If a referenced primitive is not found, a warning is logged but the agent is still created.
66
+ If a referenced primitive isn't found, a warning is logged but the agent is still created.
67
67
 
68
68
  ## Example: Iterating Through All Stored Agents
69
69
 
@@ -10,7 +10,7 @@ mastra.listVectors()
10
10
 
11
11
  ## Parameters
12
12
 
13
- This method does not accept any parameters.
13
+ This method doesn't accept any parameters.
14
14
 
15
15
  ## Returns
16
16
 
@@ -41,7 +41,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
41
41
 
42
42
  **logger** (`Logger`): Logger instance created with new PinoLogger() (Default: `Console logger with INFO level`)
43
43
 
44
- **idGenerator** (`() => string`): Custom ID generator function. Used by agents, workflows, memory, and other components to generate unique identifiers.
44
+ **idGenerator** (`(context?: IdGeneratorContext) => string`): Custom ID generator function. Used by agents, workflows, memory, and other components to generate unique identifiers. Receives optional context such as idType, source, entityId, and threadId to support context-aware ID formats.
45
45
 
46
46
  **workflows** (`Record<string, Workflow>`): Workflows to register. Structured as a key-value pair, with keys being the workflow name and values being the workflow instance. (Default: `{}`)
47
47
 
@@ -16,7 +16,7 @@ mastra.setLogger({ logger: new PinoLogger({ name: 'testLogger' }) })
16
16
 
17
17
  ## Returns
18
18
 
19
- This method does not return a value.
19
+ This method doesn't return a value.
20
20
 
21
21
  ## Related
22
22
 
@@ -19,7 +19,7 @@ mastra.setStorage(
19
19
 
20
20
  ## Returns
21
21
 
22
- This method does not return a value.
22
+ This method doesn't return a value.
23
23
 
24
24
  ## Related
25
25
 
@@ -60,7 +60,7 @@ const history = await dataset.getItemHistory({ itemId: 'item-id' })
60
60
 
61
61
  ## Access
62
62
 
63
- `Dataset` is not instantiated directly. Obtain one via `DatasetsManager`:
63
+ `Dataset` isn't instantiated directly. Obtain one via `DatasetsManager`:
64
64
 
65
65
  ```typescript
66
66
  const dataset = await mastra.datasets.get({ id: 'dataset-id' })
@@ -78,7 +78,7 @@ const comparison = await mastra.datasets.compareExperiments({
78
78
 
79
79
  ## Access
80
80
 
81
- `DatasetsManager` is not instantiated directly. Access it from a `Mastra` instance:
81
+ `DatasetsManager` isn't instantiated directly. Access it from a `Mastra` instance:
82
82
 
83
83
  ```typescript
84
84
  const mastra = new Mastra({
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Added in:** `@mastra/core@1.4.0`
4
4
 
5
- Retrieves an existing dataset by ID. Throws a `MastraError` if the dataset does not exist.
5
+ Retrieves an existing dataset by ID. Throws a `MastraError` if the dataset doesn't exist.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -26,6 +26,6 @@ console.log(details.name)
26
26
 
27
27
  ## Returns
28
28
 
29
- Throws `MastraError` if the dataset is not found.
29
+ Throws `MastraError` if the dataset isn't found.
30
30
 
31
31
  **result** (`Promise<Dataset>`): A Dataset instance.
@@ -26,7 +26,7 @@ This method takes no parameters.
26
26
 
27
27
  ## Returns
28
28
 
29
- Returns a `Promise<DatasetRecord>`. Throws `MastraError` if the dataset is not found.
29
+ Returns a `Promise<DatasetRecord>`. Throws `MastraError` if the dataset isn't found.
30
30
 
31
31
  **id** (`string`): Unique identifier of the dataset.
32
32
 
@@ -41,7 +41,7 @@ When `version` is specified:
41
41
 
42
42
  **result** (`Promise<DatasetItem[]>`): Array of all items at the specified dataset version.
43
43
 
44
- When `version` is not specified:
44
+ When `version` isn't specified:
45
45
 
46
46
  **result** (`Promise<object>`): Paginated response.
47
47
 
@@ -113,4 +113,4 @@ With `studio: true`:
113
113
 
114
114
  When studio is enabled, the routing is configured so that `/api/*` requests are handled by the serverless function, static assets (JS, CSS) are served from Vercel's Edge CDN with no function invocations, and all other paths fall back to `index.html` for client-side routing.
115
115
 
116
- This folder is generated during build and should not be committed to version control.
116
+ This folder is generated during build and shouldn't be committed to version control.
@@ -58,7 +58,7 @@ A relevancy score between 0 and 1:
58
58
  - **0.7–0.9**: The response mostly answers the query but may include minor unrelated content.
59
59
  - **0.4–0.6**: The response partially answers the query, mixing relevant and unrelated information.
60
60
  - **0.1–0.3**: The response includes minimal relevant content and largely misses the intent of the query.
61
- - **0.0**: The response is entirely unrelated and does not answer the query.
61
+ - **0.0**: The response is entirely unrelated and doesn't answer the query.
62
62
 
63
63
  ## Example
64
64
 
@@ -4,7 +4,7 @@ The `createCompletenessScorer()` function evaluates how thoroughly an LLM's outp
4
4
 
5
5
  ## Parameters
6
6
 
7
- The `createCompletenessScorer()` function does not take any options.
7
+ The `createCompletenessScorer()` function doesn't take any options.
8
8
 
9
9
  This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
10
10
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  The `createContextPrecisionScorer()` function creates a scorer that evaluates how relevant and well-positioned retrieved context pieces are for generating expected outputs. It uses **Mean Average Precision (MAP)** to reward systems that place relevant context earlier in the sequence.
4
4
 
5
- It is especially useful for these use cases:
5
+ It's especially useful for these use cases:
6
6
 
7
7
  ## RAG System Evaluation
8
8
 
9
9
  Ideal for evaluating retrieved context in RAG pipelines where:
10
10
 
11
11
  - Context ordering matters for model performance
12
- - You need to measure retrieval quality beyond simple relevance
12
+ - You need to measure retrieval quality beyond basic relevance
13
13
  - Early relevant context is more valuable than later relevant context
14
14
 
15
15
  ## Context Window Optimization
@@ -77,7 +77,7 @@ The reason field explains:
77
77
  Use results to:
78
78
 
79
79
  - **Improve retrieval**: Filter out irrelevant context before ranking
80
- - **Optimize ranking**: Ensure relevant context appears early
80
+ - **Optimize ranking**: Ensure relevant context surfaces early
81
81
  - **Tune chunk size**: Balance context detail vs. relevance precision
82
82
  - **Evaluate embeddings**: Test different embedding models for better retrieval
83
83
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  The `createContextRelevanceScorerLLM()` function creates a scorer that evaluates how relevant and useful provided context was for generating agent responses. It uses weighted relevance levels and applies penalties for unused high-relevance context and missing information.
4
4
 
5
- It is especially useful for these use cases:
5
+ It's especially useful for these use cases:
6
6
 
7
7
  ## Content Generation Evaluation
8
8
 
@@ -8,20 +8,14 @@ The `createHallucinationScorer()` function accepts a single options object with
8
8
 
9
9
  **model** (`LanguageModel`): Configuration for the model used to evaluate hallucination.
10
10
 
11
- **options.scale** (`number`): Maximum score value. (Default: `1`)
11
+ **options** (`Options`): Configuration options.
12
+
13
+ **options.scale** (`number`): Maximum score value.
12
14
 
13
15
  **options.context** (`string[]`): Static context strings to use as ground truth for hallucination detection.
14
16
 
15
17
  **options.getContext** (`(params: GetContextParams) => string[] | Promise<string[]>`): A hook to dynamically resolve context at runtime. Takes priority over static context. Useful for live scoring where context (like tool results) is only available when the scorer runs.
16
18
 
17
- **options.getContext.run** (`GetContextRun`): The scorer run containing input, output, runId, requestContext, and tracingContext.
18
-
19
- **options.getContext.results** (`Record<string, any>`): Accumulated results from previous steps (e.g., preprocessStepResult with extracted claims).
20
-
21
- **options.getContext.score** (`number`): The computed score. Only present when called from the generateReason step.
22
-
23
- **options.getContext.step** (`'analyze' | 'generateReason'`): Which step is calling the hook. Useful for caching context between calls.
24
-
25
19
  This function returns an instance of the MastraScorer class. The `.run()` method accepts the same input as other scorers (see the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer)), but the return value includes LLM-specific fields as documented below.
26
20
 
27
21
  ## .run() Returns
@@ -4,7 +4,7 @@ The `createKeywordCoverageScorer()` function evaluates how well an LLM's output
4
4
 
5
5
  ## Parameters
6
6
 
7
- The `createKeywordCoverageScorer()` function does not take any options.
7
+ The `createKeywordCoverageScorer()` function doesn't take any options.
8
8
 
9
9
  This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
10
10