@mastra/mcp-docs-server 1.1.8-alpha.0 → 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 +16 -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 +9 -9
@@ -23,7 +23,7 @@ The OtelBridge provides two-way integration:
23
23
 
24
24
  - Reads from OTEL ambient context (AsyncLocalStorage) automatically
25
25
  - Inherits trace ID and parent span ID from active OTEL spans
26
- - Respects OTEL sampling decisions — if a trace is not sampled, Mastra won't create spans for it
26
+ - Respects OTEL sampling decisions — if a trace isn't sampled, Mastra won't create spans for it
27
27
  - No manual trace ID passing required when OTEL auto-instrumentation is active
28
28
 
29
29
  **From Mastra to OTEL:**
@@ -196,7 +196,7 @@ Tags are exported as a JSON string in the `mastra.tags` span attribute for broad
196
196
 
197
197
  ## Troubleshooting
198
198
 
199
- If traces aren't appearing or connecting as expected:
199
+ If traces aren't displaying or connecting as expected:
200
200
 
201
201
  - Verify OTEL SDK is initialized before Mastra (use `--import` flag or import at top of entry point)
202
202
  - Ensure the OtelBridge is added to your observability config
@@ -124,7 +124,7 @@ If you set the strategy to `'auto'`, the `DefaultExporter` automatically selects
124
124
 
125
125
  ### Providers without Observability Support
126
126
 
127
- The following storage providers **do not support** the observability domain. If you're using one of these providers and need observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider:
127
+ The following storage providers **don't support** the observability domain. If you're using one of these providers and need observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider:
128
128
 
129
129
  - [Convex](https://mastra.ai/reference/storage/convex)
130
130
  - [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
@@ -429,7 +429,7 @@ requestContext.set('session', { data: { experimentId: 'exp-999' } })
429
429
 
430
430
  ### Adding Tags to Traces
431
431
 
432
- Tags are string labels that help you categorize and filter traces. Unlike metadata (which contains structured key-value data), tags are simple strings designed for quick filtering and organization.
432
+ Tags are string labels that help you categorize and filter traces. Unlike metadata (which contains structured key-value data), tags are plain strings designed for quick filtering and organization.
433
433
 
434
434
  Use `tracingOptions.tags` to add tags when executing agents or workflows:
435
435
 
@@ -617,11 +617,11 @@ Span processors transform, filter, or enrich trace data before it's exported. Th
617
617
 
618
618
  #### Built-in Processors
619
619
 
620
- - [Sensitive Data Filter](https://mastra.ai/docs/observability/tracing/processors/sensitive-data-filter) redacts sensitive information. It is enabled in the default observability config.
620
+ - [Sensitive Data Filter](https://mastra.ai/docs/observability/tracing/processors/sensitive-data-filter) redacts sensitive information. It's enabled in the default observability config.
621
621
 
622
622
  #### Creating Custom Processors
623
623
 
624
- You can create custom span processors by implementing the `SpanOutputProcessor` interface. Here's a simple example that converts all input text in spans to lowercase:
624
+ You can create custom span processors by implementing the `SpanOutputProcessor` interface. Here's a basic example that converts all input text in spans to lowercase:
625
625
 
626
626
  ```ts
627
627
  import type { SpanOutputProcessor, AnySpan } from '@mastra/observability'
@@ -667,7 +667,7 @@ Custom span formatters transform how spans appear in specific observability plat
667
667
  #### Use Cases
668
668
 
669
669
  - **Extract plain text from AI SDK messages** - Convert structured message arrays to readable text
670
- - **Transform input/output formats** - Customize how data appears in specific platforms
670
+ - **Transform input/output formats** - Customize how data displays in specific platforms
671
671
  - **Platform-specific field mapping** - Add or remove fields based on platform requirements
672
672
  - **Async data enrichment** - Fetch additional context from external APIs or databases
673
673
 
@@ -67,7 +67,7 @@ When a sensitive field is detected, its value is replaced with `[REDACTED]` by d
67
67
 
68
68
  ## Custom Configuration
69
69
 
70
- You can customize which fields are redacted and how redaction appears:
70
+ You can customize which fields are redacted and how redaction displays:
71
71
 
72
72
  ```ts
73
73
  import { SensitiveDataFilter, DefaultExporter, Observability } from '@mastra/observability'
@@ -167,7 +167,7 @@ The filter uses intelligent field matching:
167
167
  3. **Exact Matching**: After normalization, fields must match exactly
168
168
 
169
169
  - `token` matches `token`, `Token`, `TOKEN`
170
- - `token` does NOT match `promptTokens` or `tokenCount`
170
+ - `token` doesn't match `promptTokens` or `tokenCount`
171
171
 
172
172
  ## Nested Object Handling
173
173
 
@@ -123,7 +123,7 @@ const { embeddings } = await embedMany({
123
123
  })
124
124
  ```
125
125
 
126
- > **Vector Database Compatibility:** When storing embeddings, the vector database index must be configured to match the output size of your embedding model. If the dimensions do not match, you may get errors or data corruption.
126
+ > **Vector Database Compatibility:** When storing embeddings, the vector database index must be configured to match the output size of your embedding model. If the dimensions don't match, you may get errors or data corruption.
127
127
 
128
128
  ## Example: Complete Pipeline
129
129
 
@@ -359,7 +359,7 @@ The dimension size must match the output dimension of your chosen embedding mode
359
359
  - Cohere embed-multilingual-v3: 1024 dimensions
360
360
  - Google gemini-embedding-001: 768 dimensions (or custom)
361
361
 
362
- > **Warning:** Index dimensions cannot be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
362
+ > **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
363
363
 
364
364
  ### Naming Rules for Databases
365
365
 
@@ -583,7 +583,7 @@ Key metadata considerations:
583
583
 
584
584
  ## Deleting Vectors
585
585
 
586
- When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it easy to remove all embeddings associated with a specific document.
586
+ When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it straightforward to remove all embeddings associated with a specific document.
587
587
 
588
588
  ### Delete by Metadata Filter
589
589
 
@@ -66,7 +66,7 @@ export const mastra = new Mastra({
66
66
  By default, `MastraAuthAuth0` allows all authenticated users who have valid Auth0 tokens for the specified audience. The token verification ensures that:
67
67
 
68
68
  1. The token is properly signed by Auth0
69
- 2. The token is not expired
69
+ 2. The token isn't expired
70
70
  3. The token audience matches your configured audience
71
71
  4. The token issuer matches your Auth0 domain
72
72
 
@@ -71,7 +71,7 @@ The `MastraAuthFirebase` class can be configured through constructor options or
71
71
  - `FIREBASE_SERVICE_ACCOUNT`: Path to Firebase service account JSON file
72
72
  - `FIRESTORE_DATABASE_ID` or `FIREBASE_DATABASE_ID`: Firestore database ID
73
73
 
74
- > **Note:** When constructor options are not provided, the class automatically reads these environment variables. This means you can simply call `new MastraAuthFirebase()` without any arguments if your environment variables are properly configured.
74
+ > **Note:** When constructor options aren't provided, the class automatically reads these environment variables. This means you can call `new MastraAuthFirebase()` without any arguments if your environment variables are properly configured.
75
75
 
76
76
  ### User Authorization
77
77
 
@@ -1,6 +1,6 @@
1
1
  # SimpleAuth Class
2
2
 
3
- The `SimpleAuth` class provides token-based authentication using a simple token-to-user mapping. It's included in `@mastra/core/server` and is useful for development, testing, and simple API key authentication scenarios.
3
+ The `SimpleAuth` class provides token-based authentication using a basic token-to-user mapping. It's included in `@mastra/core/server` and is useful for development, testing, and basic API key authentication scenarios.
4
4
 
5
5
  ## Use Cases
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Mastra lets you choose how you handle authentication, so you can secure access to your application's endpoints using the identity system that fits your stack.
4
4
 
5
- You can start with simple shared secret JWT authentication and switch to providers like Supabase, Firebase Auth, Auth0, Clerk, or WorkOS when you need more advanced identity features.
5
+ You can start with basic shared secret JWT authentication and switch to providers like Supabase, Firebase Auth, Auth0, Clerk, or WorkOS when you need more advanced identity features.
6
6
 
7
7
  ## Default behavior
8
8
 
@@ -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/server/mastra-server) from your client environment.
3
+ The Mastra Client SDK provides a concise and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/server/mastra-server) from your client environment.
4
4
 
5
5
  ## Prerequisites
6
6
 
@@ -51,7 +51,7 @@ This behavior is only configurable by using [server adapters](https://mastra.ai/
51
51
 
52
52
  ## TypeScript configuration
53
53
 
54
- Mastra requires `module` and `moduleResolution` settings compatible with modern Node.js. Legacy options like `CommonJS` or `node` are not supported.
54
+ Mastra requires `module` and `moduleResolution` settings compatible with modern Node.js. Legacy options like `CommonJS` or `node` aren't supported.
55
55
 
56
56
  ```json
57
57
  {
@@ -389,7 +389,7 @@ const server = new MastraServer({
389
389
  })
390
390
  ```
391
391
 
392
- With this prefix, Mastra routes become `/api/v2/agents`, `/api/v2/workflows`, etc. Custom routes you add directly to the app are not affected by this prefix.
392
+ With this prefix, Mastra routes become `/api/v2/agents`, `/api/v2/workflows`, etc. Custom routes you add directly to the app aren't affected by this prefix.
393
393
 
394
394
  ## OpenAPI spec
395
395
 
@@ -487,7 +487,7 @@ The adapter reads these settings from `mastra.getServer()`:
487
487
 
488
488
  ### Adapter constructor only
489
489
 
490
- These options are passed directly to the adapter constructor and are not read from the Mastra config:
490
+ These options are passed directly to the adapter constructor and aren't read from the Mastra config:
491
491
 
492
492
  | Option | Description |
493
493
  | ----------------------- | --------------------------------------------------------------------------- |
@@ -143,7 +143,7 @@ Each progress event includes:
143
143
  - **`id`**: The step ID of the foreach step
144
144
  - **`completedCount`**: Number of iterations completed so far
145
145
  - **`totalCount`**: Total number of iterations
146
- - **`currentIndex`**: Index of the iteration that just completed
146
+ - **`currentIndex`**: Index of the iteration that completed
147
147
  - **`iterationStatus`**: Status of the iteration (`success`, `failed`, or `suspended`)
148
148
  - **`iterationOutput`**: Output of the iteration (when successful)
149
149
 
@@ -11,7 +11,7 @@ Mastra's streaming API adapts based on your model version:
11
11
 
12
12
  ## Streaming with agents
13
13
 
14
- You can pass a single string for simple prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
14
+ You can pass a single string for basic prompts, an array of strings when providing multiple pieces of context, or an array of message objects with `role` and `content` for precise control over roles and conversational flows.
15
15
 
16
16
  ### Using `Agent.stream()`
17
17
 
@@ -5,7 +5,7 @@ Tool streaming in Mastra enables tools to send incremental results while they ru
5
5
  Streams can be written to in two main ways:
6
6
 
7
7
  - **From within a tool**: every tool receives a `context.writer` object, which is a writable stream you can use to push updates as execution progresses.
8
- - **From an agent stream**: you can also pipe an agent's `stream` output directly into a tool's writer, making it easy to chain agent responses into tool results without extra glue code.
8
+ - **From an agent stream**: you can also pipe an agent's `stream` output directly into a tool's writer, making it convenient to chain agent responses into tool results without extra glue code.
9
9
 
10
10
  By combining writable tool streams with agent streaming, you gain fine grained control over how intermediate results flow through your system and into the user experience.
11
11
 
@@ -33,59 +33,73 @@ The `context.writer` object is available in a tool's `execute()` function and ca
33
33
  > **Warning:** You must `await` the call to `writer.write()` or else you will lock the stream and get a `WritableStream is locked` error.
34
34
 
35
35
  ```typescript
36
- import { createTool } from "@mastra/core/tools";
36
+ import { createTool } from '@mastra/core/tools'
37
37
 
38
38
  export const testTool = createTool({
39
39
  execute: async (inputData, context) => {
40
- const { value } = inputData;
40
+ const { value } = inputData
41
41
 
42
42
  await context?.writer?.write({
43
- type: "custom-event",
44
- status: "pending"
45
- });
43
+ type: 'custom-event',
44
+ status: 'pending',
45
+ })
46
46
 
47
- const response = await fetch(...);
47
+ const response = await fetch()
48
48
 
49
49
  await context?.writer?.write({
50
- type: "custom-event",
51
- status: "success"
52
- });
50
+ type: 'custom-event',
51
+ status: 'success',
52
+ })
53
53
 
54
54
  return {
55
- value: ""
56
- };
57
- }
58
- });
55
+ value: '',
56
+ }
57
+ },
58
+ })
59
59
  ```
60
60
 
61
- You can also use `writer.custom()` if you want to emit top level stream chunks, This useful and relevant when integrating with UI Frameworks
61
+ You can also use `writer.custom()` to emit top-level stream chunks. This is useful when integrating with UI frameworks.
62
62
 
63
63
  ```typescript
64
- import { createTool } from "@mastra/core/tools";
64
+ import { createTool } from '@mastra/core/tools'
65
65
 
66
66
  export const testTool = createTool({
67
67
  execute: async (inputData, context) => {
68
- const { value } = inputData;
68
+ const { value } = inputData
69
69
 
70
- await context?.writer?.custom({
71
- type: "data-tool-progress",
72
- status: "pending"
73
- });
70
+ await context?.writer?.custom({
71
+ type: 'data-tool-progress',
72
+ status: 'pending',
73
+ })
74
74
 
75
- const response = await fetch(...);
75
+ const response = await fetch()
76
76
 
77
- await context?.writer?.custom({
78
- type: "data-tool-progress",
79
- status: "success"
80
- });
77
+ await context?.writer?.custom({
78
+ type: 'data-tool-progress',
79
+ status: 'success',
80
+ })
81
81
 
82
82
  return {
83
- value: ""
84
- };
85
- }
86
- });
83
+ value: '',
84
+ }
85
+ },
86
+ })
87
+ ```
88
+
89
+ ### Transient data chunks
90
+
91
+ By default, `data-*` chunks emitted with `writer.custom()` are persisted to storage as part of the message history. For chunks that are only needed during live streaming — such as progress updates or verbose log output — set `transient: true` to skip storage persistence. Transient chunks are still streamed to the client in real time but aren't saved to the database.
92
+
93
+ ```typescript
94
+ await context?.writer?.custom({
95
+ type: 'data-build-log',
96
+ data: { line: 'Compiling module 3 of 12...' },
97
+ transient: true,
98
+ })
87
99
  ```
88
100
 
101
+ Use transient chunks when the data is large or high-frequency and only relevant during the live session. After a page refresh, transient chunks are no longer available — only the tool's return value and any non-transient chunks are loaded from storage.
102
+
89
103
  ### Inspecting stream payloads
90
104
 
91
105
  Events written to the stream are included in the emitted chunks. These chunks can be inspected to access any custom fields, such as event types, intermediate values, or tool-specific data.
@@ -5,7 +5,7 @@ Workflow streaming in Mastra enables workflows to send incremental results while
5
5
  Streams can be written to in two main ways:
6
6
 
7
7
  - **From within a workflow step**: every workflow step receives a `writer` argument, which is a writable stream you can use to push updates as execution progresses.
8
- - **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it easy to chain agent responses into workflow results without extra glue code.
8
+ - **From an agent stream**: you can also pipe an agent's `stream` output directly into a workflow step's writer, making it convenient to chain agent responses into workflow results without extra glue code.
9
9
 
10
10
  By combining writable workflow streams with agent streaming, you gain fine-grained control over how intermediate results flow through your system and into the user experience.
11
11
 
@@ -166,6 +166,48 @@ export const testWorkflow = createWorkflow({
166
166
  - The next step receives an object containing all parallel step outputs
167
167
  - You must define the `inputSchema` of the following step to match this structure
168
168
 
169
+ ### Handling step failures
170
+
171
+ If any parallel step throws an error, the entire parallel block fails. To build resilient parallel workflows where some steps may fail — for example, multiple research agents where one might have an expired auth token — handle errors inside the step itself using try/catch:
172
+
173
+ ```typescript
174
+ const resilientStep = createStep({
175
+ id: 'researcher',
176
+ inputSchema: z.object({ query: z.string() }),
177
+ outputSchema: z.object({
178
+ brief: z.string().nullable(),
179
+ failed: z.boolean(),
180
+ }),
181
+ execute: async ({ inputData }) => {
182
+ try {
183
+ const result = await fetchExternalData(inputData.query)
184
+ return { brief: result, failed: false }
185
+ } catch {
186
+ return { brief: null, failed: true }
187
+ }
188
+ },
189
+ })
190
+ ```
191
+
192
+ This way the step always succeeds with a typed result, and the downstream step can filter out failed results:
193
+
194
+ ```typescript
195
+ const writerStep = createStep({
196
+ id: 'writer',
197
+ inputSchema: z.object({
198
+ 'researcher-a': z.object({ brief: z.string().nullable(), failed: z.boolean() }),
199
+ 'researcher-b': z.object({ brief: z.string().nullable(), failed: z.boolean() }),
200
+ }),
201
+ outputSchema: z.object({ synthesis: z.string() }),
202
+ execute: async ({ inputData }) => {
203
+ const briefs = Object.values(inputData)
204
+ .filter(v => !v.failed && v.brief)
205
+ .map(v => v.brief)
206
+ return { synthesis: briefs.join('; ') }
207
+ },
208
+ })
209
+ ```
210
+
169
211
  > **Info:** Visit [Choosing the right pattern](#choosing-the-right-pattern) to understand when to use `.parallel()` vs `.foreach()`.
170
212
 
171
213
  ## Conditional logic with `.branch()`
@@ -292,7 +334,7 @@ export const testWorkflow = createWorkflow({
292
334
 
293
335
  ## Input data mapping
294
336
 
295
- When using `.then()`, `.parallel()`, or `.branch()`, it is sometimes necessary to transform the output of a previous step to match the input of the next. In these cases you can use `.map()` to access the `inputData` and transform it to create a suitable data shape for the next step.
337
+ When using `.then()`, `.parallel()`, or `.branch()`, it's sometimes necessary to transform the output of a previous step to match the input of the next. In these cases you can use `.map()` to access the `inputData` and transform it to create a suitable data shape for the next step.
296
338
 
297
339
  ![Mapping with .map()](/assets/images/workflows-data-mapping-map-87fd84a06b4bbf4b93868a5db99ca179.jpg)
298
340
 
@@ -777,7 +819,7 @@ This means:
777
819
 
778
820
  - `.parallel()` collects all branch outputs into an object, then passes it to the next step
779
821
  - `.foreach()` collects all iteration outputs into an array, then passes it to the next step
780
- - There is no way to "stream" results to the next step as they complete
822
+ - Results can't be "streamed" to the next step as they complete
781
823
 
782
824
  ### Concurrency behavior
783
825
 
@@ -166,7 +166,7 @@ const pipelineWorkflow = createWorkflow({
166
166
 
167
167
  ### Error handling in callbacks
168
168
 
169
- Errors thrown inside callbacks are caught and logged—they will not affect the workflow result or cause it to fail. This ensures that callback issues don't break your workflows in production.
169
+ Errors thrown inside callbacks are caught and logged—they won't affect the workflow result or cause it to fail. This ensures that callback issues don't break your workflows in production.
170
170
 
171
171
  ```typescript
172
172
  options: {
@@ -140,7 +140,7 @@ export const testWorkflow = createWorkflow({
140
140
 
141
141
  ### Cloning a workflow
142
142
 
143
- Clone a workflow using `cloneWorkflow()` when you want to reuse its logic but track it separately under a new ID. Each clone runs independently and appears as a distinct workflow in logs and observability tools.
143
+ Clone a workflow using `cloneWorkflow()` when you want to reuse its logic but track it separately under a new ID. Each clone runs independently and shows up as a distinct workflow in logs and observability tools.
144
144
 
145
145
  ```typescript
146
146
  import { cloneWorkflow } from "@mastra/core/workflows";
@@ -182,7 +182,7 @@ const testWorkflow = mastra.getWorkflow('testWorkflow')
182
182
  > 1. It provides access to the Mastra instance configuration (logger, telemetry, storage, registered agents, and vector stores)
183
183
  > 2. It provides full TypeScript type inference for workflow input and output schemas
184
184
  >
185
- > **Note:** Use `getWorkflow()` with the workflow's **registration key** (the key used when adding it to Mastra). While `getWorkflowById()` is available for retrieving workflows by their `id` property, it does not provide the same level of type inference.
185
+ > **Note:** Use `getWorkflow()` with the workflow's **registration key** (the key used when adding it to Mastra). While `getWorkflowById()` is available for retrieving workflows by their `id` property, it doesn't provide the same level of type inference.
186
186
 
187
187
  ## Running workflows
188
188
 
@@ -358,7 +358,7 @@ const step1 = createStep({
358
358
 
359
359
  ## Testing with Studio
360
360
 
361
- Use [Studio](https://mastra.ai/docs/getting-started/studio) to easily run workflows with different inputs, visualize the execution lifecycle, see the inputs and outputs for each step, and inspect each part of the workflow in more detail.
361
+ Use [Studio](https://mastra.ai/docs/getting-started/studio) to run workflows with different inputs, visualize the execution lifecycle, see the inputs and outputs for each step, and inspect each part of the workflow in more detail.
362
362
 
363
363
  ## Related
364
364
 
@@ -150,7 +150,7 @@ export const mastra = new Mastra({
150
150
  1. **Ensure Serializability**: Any data that needs to be included in the snapshot must be serializable (convertible to JSON).
151
151
  2. **Minimize Snapshot Size**: Avoid storing large data objects directly in the workflow context. Instead, store references to them (like IDs) and retrieve the data when needed.
152
152
  3. **Handle Resume Context Carefully**: When resuming a workflow, carefully consider what context to provide. This will be merged with the existing snapshot data.
153
- 4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they are properly resumed.
153
+ 4. **Set Up Proper Monitoring**: Implement monitoring for suspended workflows, especially long-running ones, to ensure they're properly resumed.
154
154
  5. **Consider Storage Scaling**: For applications with many suspended workflows, ensure your storage solution is appropriately scaled.
155
155
 
156
156
  ## Custom snapshot metadata
@@ -1,6 +1,6 @@
1
1
  # Time Travel
2
2
 
3
- Time travel allows you to re-execute a workflow starting from any specific step, using either stored snapshot data or custom context you provide. This is useful for debugging failed workflows, testing individual steps with different inputs, or recovering from errors without re-running the entire workflow. You can also use time travel to execute a workflow that has not been run yet, starting from any specific step.
3
+ Time travel allows you to re-execute a workflow starting from any specific step, using either stored snapshot data or custom context you provide. This is useful for debugging failed workflows, testing individual steps with different inputs, or recovering from errors without re-running the entire workflow. You can also use time travel to execute a workflow that hasn't been run yet, starting from any specific step.
4
4
 
5
5
  ## How time travel works
6
6
 
@@ -193,7 +193,7 @@ Time travel throws errors in specific situations:
193
193
 
194
194
  ### Running workflow
195
195
 
196
- You cannot time travel to a workflow that is currently running:
196
+ You can't time travel to a workflow that's currently running:
197
197
 
198
198
  ```typescript
199
199
  try {
@@ -101,7 +101,7 @@ const workspace = new Workspace({
101
101
  })
102
102
  ```
103
103
 
104
- When read-only, write tools (`write_file`, `edit_file`, `delete`, `mkdir`) are not added to the agent's toolset. The agent can still read and list files.
104
+ When read-only, write tools (`write_file`, `edit_file`, `delete`, `mkdir`) aren't added to the agent's toolset. The agent can still read and list files.
105
105
 
106
106
  ## Mounts and CompositeFilesystem
107
107
 
@@ -140,7 +140,7 @@ With this configuration:
140
140
 
141
141
  All file paths must start with a mount prefix. Operations on paths that don't match any mount will fail. Listing the root directory (`/`) returns virtual directory entries for each mount point.
142
142
 
143
- Mount paths cannot be nested — for example, you cannot mount at both `/data` and `/data/sub`.
143
+ Mount paths can't be nested — for example, you can't mount at both `/data` and `/data/sub`.
144
144
 
145
145
  ### `filesystem` vs `mounts`
146
146
 
@@ -7,7 +7,7 @@ A Mastra workspace gives agents a persistent environment for storing files and e
7
7
  A workspace supports the following features:
8
8
 
9
9
  - **[Filesystem](https://mastra.ai/docs/workspace/filesystem)**: File storage (read, write, list, delete, copy, move, grep)
10
- - **[Sandbox](https://mastra.ai/docs/workspace/sandbox)**: Command execution (shell commands)
10
+ - **[Sandbox](https://mastra.ai/docs/workspace/sandbox)**: Command execution (shell commands) and background processes
11
11
  - **[Search](https://mastra.ai/docs/workspace/search)**: BM25, vector, or hybrid search over indexed content
12
12
  - **[Skills](https://mastra.ai/docs/workspace/skills)**: Reusable instructions for agents
13
13
 
@@ -117,7 +117,7 @@ Under the hood, `mounts` creates a [CompositeFilesystem](https://mastra.ai/docs/
117
117
 
118
118
  You can mount multiple providers at different paths. Each mount path must be unique and non-overlapping.
119
119
 
120
- > **Note:** `filesystem` and `mounts` are mutually exclusive — you cannot use both in the same workspace. Use `filesystem` for a single provider without a sandbox, or `mounts` when you need to combine cloud storage with a sandbox.
120
+ > **Note:** `filesystem` and `mounts` are mutually exclusive — you can't use both in the same workspace. Use `filesystem` for a single provider without a sandbox, or `mounts` when you need to combine cloud storage with a sandbox.
121
121
 
122
122
  ### Filesystem only
123
123
 
@@ -190,11 +190,56 @@ const workspace = new Workspace({
190
190
 
191
191
  ### Tool options
192
192
 
193
- | Option | Type | Description |
194
- | ------------------------ | --------- | --------------------------------------------------------------------------- |
195
- | `enabled` | `boolean` | Whether the tool is available (default: `true`) |
196
- | `requireApproval` | `boolean` | Whether the tool requires user approval before execution (default: `false`) |
197
- | `requireReadBeforeWrite` | `boolean` | For write tools: require reading the file first (default: `false`) |
193
+ | Option | Type | Description |
194
+ | ------------------------ | --------- | ---------------------------------------------------------------------------------------------------------- |
195
+ | `enabled` | `boolean` | Whether the tool is available (default: `true`) |
196
+ | `requireApproval` | `boolean` | Whether the tool requires user approval before execution (default: `false`) |
197
+ | `requireReadBeforeWrite` | `boolean` | For write tools: require reading the file first (default: `false`) |
198
+ | `name` | `string` | Custom name for the tool. Replaces the default `mastra_workspace_*` name. |
199
+ | `maxOutputTokens` | `number` | Maximum tokens for tool output (default: `2000`). Output exceeding this limit is truncated using tiktoken. |
200
+
201
+ ### Tool name remapping
202
+
203
+ Rename workspace tools to match the conventions your agent expects. The config key remains the original `WORKSPACE_TOOLS` constant — only the exposed name changes.
204
+
205
+ ```typescript
206
+ import { Workspace, LocalFilesystem, LocalSandbox, WORKSPACE_TOOLS } from '@mastra/core/workspace'
207
+
208
+ const workspace = new Workspace({
209
+ filesystem: new LocalFilesystem({ basePath: './workspace' }),
210
+ sandbox: new LocalSandbox({ workingDirectory: './workspace' }),
211
+ tools: {
212
+ [WORKSPACE_TOOLS.FILESYSTEM.READ_FILE]: { name: 'view' },
213
+ [WORKSPACE_TOOLS.FILESYSTEM.GREP]: { name: 'search_content' },
214
+ [WORKSPACE_TOOLS.FILESYSTEM.LIST_FILES]: { name: 'find_files' },
215
+ [WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND]: { name: 'execute_command' },
216
+ },
217
+ })
218
+ ```
219
+
220
+ The agent sees `view`, `search_content`, `find_files`, and `execute_command` instead of the default `mastra_workspace_*` names. Tool names must be unique — duplicate names or conflicts with other default names throw an error.
221
+
222
+ ### Output truncation
223
+
224
+ Workspace tools automatically truncate large outputs to avoid exceeding LLM context limits. Two layers of truncation apply:
225
+
226
+ 1. **Line-based tail**: Command output is limited to the last 200 lines by default (configurable per-command via the `tail` parameter)
227
+ 2. **Token-based limit**: Tool output is capped at 2000 tokens by default
228
+
229
+ Set `maxOutputTokens` per tool to adjust the token limit:
230
+
231
+ ```typescript
232
+ const workspace = new Workspace({
233
+ // ...
234
+ tools: {
235
+ [WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND]: {
236
+ maxOutputTokens: 5000,
237
+ },
238
+ },
239
+ })
240
+ ```
241
+
242
+ ANSI escape codes (colors, cursor sequences) are automatically stripped from command output before it reaches the model.
198
243
 
199
244
  ### Read-before-write
200
245