@mastra/mcp-docs-server 1.2.11 → 1.2.12-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 (257) hide show
  1. package/.docs/docs/agents/using-tools.md +25 -0
  2. package/.docs/guides/build-your-ui/ai-sdk-ui.md +5 -5
  3. package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +8 -8
  4. package/.docs/guides/build-your-ui/copilotkit/overview.md +2 -2
  5. package/.docs/guides/build-your-ui/openui.md +1 -1
  6. package/.docs/guides/concepts/multi-agent-systems.md +5 -5
  7. package/.docs/guides/concepts/streaming.md +9 -9
  8. package/.docs/guides/deployment/amazon-ec2.md +1 -1
  9. package/.docs/guides/deployment/aws-lambda.md +1 -1
  10. package/.docs/guides/deployment/azure-app-services.md +1 -1
  11. package/.docs/guides/deployment/cloudflare.md +1 -1
  12. package/.docs/guides/deployment/inngest.md +6 -6
  13. package/.docs/guides/deployment/temporal.md +1 -1
  14. package/.docs/guides/deployment/vercel.md +1 -1
  15. package/.docs/guides/getting-started/astro.md +1 -1
  16. package/.docs/guides/getting-started/electron.md +1 -1
  17. package/.docs/guides/getting-started/nestjs.md +5 -5
  18. package/.docs/guides/getting-started/vite-react.md +1 -1
  19. package/.docs/guides/guide/chef-michel.md +1 -1
  20. package/.docs/guides/guide/code-review-bot.md +1 -1
  21. package/.docs/guides/guide/coding-agent.md +4 -4
  22. package/.docs/guides/guide/dev-assistant.md +1 -1
  23. package/.docs/guides/guide/docs-manager.md +3 -3
  24. package/.docs/guides/guide/github-actions-pr-description.md +4 -4
  25. package/.docs/guides/guide/research-assistant.md +3 -3
  26. package/.docs/guides/guide/research-coordinator.md +3 -3
  27. package/.docs/guides/guide/slack-assistant.md +1 -1
  28. package/.docs/guides/guide/stock-agent.md +1 -1
  29. package/.docs/guides/index.md +1 -1
  30. package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +1 -1
  31. package/.docs/guides/migrations/mastra-cloud.md +6 -6
  32. package/.docs/guides/migrations/network-to-supervisor.md +9 -9
  33. package/.docs/guides/migrations/upgrade-to-v1/agent.md +5 -5
  34. package/.docs/guides/migrations/upgrade-to-v1/cli.md +1 -1
  35. package/.docs/guides/migrations/upgrade-to-v1/client.md +3 -3
  36. package/.docs/guides/migrations/upgrade-to-v1/evals.md +2 -2
  37. package/.docs/guides/migrations/upgrade-to-v1/memory.md +1 -1
  38. package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
  39. package/.docs/guides/migrations/upgrade-to-v1/processors.md +1 -1
  40. package/.docs/guides/migrations/upgrade-to-v1/storage.md +11 -11
  41. package/.docs/guides/migrations/upgrade-to-v1/tools.md +3 -3
  42. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
  43. package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
  44. package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
  45. package/.docs/models/environment-variables.md +1 -0
  46. package/.docs/models/index.md +1 -1
  47. package/.docs/models/providers/modal.md +73 -0
  48. package/.docs/models/providers.md +1 -0
  49. package/.docs/reference/acp/acp-agent.md +3 -3
  50. package/.docs/reference/acp/create-acp-tool.md +2 -2
  51. package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
  52. package/.docs/reference/agent-controller/session.md +6 -6
  53. package/.docs/reference/agents/agent.md +7 -7
  54. package/.docs/reference/agents/channels.md +3 -3
  55. package/.docs/reference/agents/durable-agent.md +3 -3
  56. package/.docs/reference/agents/generate.md +3 -3
  57. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  58. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  59. package/.docs/reference/agents/listScorers.md +1 -1
  60. package/.docs/reference/agents/listSkills.md +1 -1
  61. package/.docs/reference/agents/listSuspendedRuns.md +2 -2
  62. package/.docs/reference/ai-sdk/chat-route.md +1 -1
  63. package/.docs/reference/ai-sdk/network-route.md +1 -1
  64. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
  65. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
  66. package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
  67. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  68. package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
  69. package/.docs/reference/auth/auth0.md +1 -1
  70. package/.docs/reference/auth/fga.md +2 -2
  71. package/.docs/reference/auth/google.md +2 -2
  72. package/.docs/reference/auth/okta.md +1 -1
  73. package/.docs/reference/auth/workos.md +2 -2
  74. package/.docs/reference/browser/agent-browser.md +2 -2
  75. package/.docs/reference/browser/browser-viewer.md +3 -3
  76. package/.docs/reference/browser/mastra-browser.md +3 -3
  77. package/.docs/reference/browser/stagehand-browser.md +4 -4
  78. package/.docs/reference/channels/slack-provider.md +2 -2
  79. package/.docs/reference/cli/create-mastra.md +1 -1
  80. package/.docs/reference/cli/mastra.md +23 -23
  81. package/.docs/reference/client-js/agents.md +9 -9
  82. package/.docs/reference/client-js/memory.md +2 -2
  83. package/.docs/reference/client-js/workflows.md +1 -1
  84. package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
  85. package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
  86. package/.docs/reference/configuration.md +6 -6
  87. package/.docs/reference/core/getMCPServer.md +1 -1
  88. package/.docs/reference/core/getScorer.md +1 -1
  89. package/.docs/reference/datasets/addItem.md +1 -1
  90. package/.docs/reference/datasets/listItems.md +1 -1
  91. package/.docs/reference/deployer/netlify.md +4 -4
  92. package/.docs/reference/deployer/vercel.md +7 -7
  93. package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
  94. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
  95. package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
  96. package/.docs/reference/editor/blob-store-provider.md +1 -1
  97. package/.docs/reference/editor/browser-provider.md +3 -3
  98. package/.docs/reference/editor/filesystem-provider.md +4 -4
  99. package/.docs/reference/editor/mastra-editor.md +5 -5
  100. package/.docs/reference/editor/processor-provider.md +3 -3
  101. package/.docs/reference/editor/sandbox-provider.md +4 -4
  102. package/.docs/reference/editor/storage-browser-ref.md +6 -6
  103. package/.docs/reference/editor/storage-workspace-ref.md +4 -4
  104. package/.docs/reference/editor/tool-provider.md +1 -1
  105. package/.docs/reference/evals/answer-relevancy.md +4 -4
  106. package/.docs/reference/evals/bias.md +3 -3
  107. package/.docs/reference/evals/checks.md +3 -3
  108. package/.docs/reference/evals/completeness.md +5 -5
  109. package/.docs/reference/evals/content-similarity.md +5 -5
  110. package/.docs/reference/evals/context-precision.md +2 -2
  111. package/.docs/reference/evals/context-recall.md +8 -8
  112. package/.docs/reference/evals/context-relevance.md +4 -4
  113. package/.docs/reference/evals/create-scorer.md +1 -1
  114. package/.docs/reference/evals/faithfulness.md +3 -3
  115. package/.docs/reference/evals/filter-run.md +2 -2
  116. package/.docs/reference/evals/hallucination.md +6 -6
  117. package/.docs/reference/evals/keyword-coverage.md +6 -6
  118. package/.docs/reference/evals/mastra-scorer.md +2 -2
  119. package/.docs/reference/evals/noise-sensitivity.md +5 -5
  120. package/.docs/reference/evals/prompt-alignment.md +5 -5
  121. package/.docs/reference/evals/rubric.md +1 -1
  122. package/.docs/reference/evals/run-evals.md +3 -3
  123. package/.docs/reference/evals/scorer-utils.md +4 -4
  124. package/.docs/reference/evals/textual-difference.md +4 -4
  125. package/.docs/reference/evals/tool-call-accuracy.md +1 -1
  126. package/.docs/reference/evals/toxicity.md +4 -4
  127. package/.docs/reference/evals/trajectory-accuracy.md +10 -10
  128. package/.docs/reference/file-based-agents/instructions.md +2 -2
  129. package/.docs/reference/file-based-agents/logger.md +1 -1
  130. package/.docs/reference/file-based-agents/observability.md +1 -1
  131. package/.docs/reference/file-based-agents/processors.md +1 -1
  132. package/.docs/reference/file-based-agents/skills.md +1 -1
  133. package/.docs/reference/file-based-agents/storage.md +1 -1
  134. package/.docs/reference/file-based-agents/studio.md +1 -1
  135. package/.docs/reference/file-based-agents/subagents.md +1 -1
  136. package/.docs/reference/file-based-agents/tools.md +1 -1
  137. package/.docs/reference/file-based-agents/workspace.md +1 -1
  138. package/.docs/reference/logging/pino-logger.md +3 -3
  139. package/.docs/reference/memory/clone-utilities.md +1 -1
  140. package/.docs/reference/memory/cloneThread.md +3 -3
  141. package/.docs/reference/memory/listThreads.md +1 -1
  142. package/.docs/reference/memory/memory-class.md +1 -1
  143. package/.docs/reference/memory/observational-memory.md +11 -11
  144. package/.docs/reference/memory/recall.md +2 -2
  145. package/.docs/reference/memory/serialized-memory-config.md +4 -4
  146. package/.docs/reference/memory/summarizeConversation.md +3 -3
  147. package/.docs/reference/memory/summarizeThread.md +3 -3
  148. package/.docs/reference/observability/feedback.md +1 -1
  149. package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
  150. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  151. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
  152. package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
  153. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
  154. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
  155. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  156. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
  157. package/.docs/reference/observability/tracing/span-filtering.md +1 -1
  158. package/.docs/reference/processors/cost-guard-processor.md +1 -1
  159. package/.docs/reference/processors/pii-detector.md +1 -1
  160. package/.docs/reference/processors/processor-interface.md +12 -12
  161. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  162. package/.docs/reference/processors/provider-history-compat.md +1 -1
  163. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  164. package/.docs/reference/processors/response-cache.md +8 -8
  165. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  166. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  167. package/.docs/reference/processors/tool-search-processor.md +7 -7
  168. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  169. package/.docs/reference/project-structure.md +1 -1
  170. package/.docs/reference/pubsub/base.md +4 -4
  171. package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
  172. package/.docs/reference/pubsub/lease-provider.md +4 -4
  173. package/.docs/reference/pubsub/redis-streams.md +1 -1
  174. package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
  175. package/.docs/reference/rag/chunk.md +5 -5
  176. package/.docs/reference/rag/database-config.md +2 -2
  177. package/.docs/reference/rag/metadata-filters.md +2 -2
  178. package/.docs/reference/schedules/overview.md +1 -1
  179. package/.docs/reference/server/register-api-route.md +1 -1
  180. package/.docs/reference/server/routes.md +1 -1
  181. package/.docs/reference/signals/signal-provider.md +8 -8
  182. package/.docs/reference/storage/clickhouse.md +4 -4
  183. package/.docs/reference/storage/cloudflare-d1.md +4 -4
  184. package/.docs/reference/storage/convex.md +4 -4
  185. package/.docs/reference/storage/dsql.md +2 -2
  186. package/.docs/reference/storage/dynamodb.md +7 -7
  187. package/.docs/reference/storage/lance.md +1 -1
  188. package/.docs/reference/storage/mongodb.md +1 -1
  189. package/.docs/reference/storage/mssql.md +1 -1
  190. package/.docs/reference/storage/postgresql.md +1 -1
  191. package/.docs/reference/storage/retention.md +33 -33
  192. package/.docs/reference/storage/spanner.md +8 -8
  193. package/.docs/reference/streaming/ChunkType.md +2 -2
  194. package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
  195. package/.docs/reference/streaming/agents/stream.md +1 -1
  196. package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
  197. package/.docs/reference/streaming/workflows/observeStream.md +1 -1
  198. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  199. package/.docs/reference/streaming/workflows/stream.md +1 -1
  200. package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
  201. package/.docs/reference/templates/overview.md +1 -1
  202. package/.docs/reference/tools/brightdata.md +1 -1
  203. package/.docs/reference/tools/create-tool.md +1 -1
  204. package/.docs/reference/tools/graph-rag-tool.md +1 -1
  205. package/.docs/reference/tools/mcp-client.md +13 -13
  206. package/.docs/reference/tools/mcp-server.md +20 -20
  207. package/.docs/reference/tools/submit-plan-tool.md +1 -1
  208. package/.docs/reference/tools/tavily.md +1 -1
  209. package/.docs/reference/tools/vector-query-tool.md +4 -4
  210. package/.docs/reference/vectors/astra.md +1 -1
  211. package/.docs/reference/vectors/chroma.md +2 -2
  212. package/.docs/reference/vectors/convex.md +2 -2
  213. package/.docs/reference/vectors/couchbase.md +4 -4
  214. package/.docs/reference/vectors/libsql.md +1 -1
  215. package/.docs/reference/vectors/mongodb.md +1 -1
  216. package/.docs/reference/vectors/pg.md +4 -4
  217. package/.docs/reference/vectors/qdrant.md +2 -2
  218. package/.docs/reference/vectors/s3vectors.md +4 -4
  219. package/.docs/reference/vectors/turbopuffer.md +1 -1
  220. package/.docs/reference/voice/aws-nova-sonic.md +1 -1
  221. package/.docs/reference/voice/azure.md +1 -1
  222. package/.docs/reference/voice/google-gemini-live.md +4 -4
  223. package/.docs/reference/voice/inworld-realtime.md +7 -7
  224. package/.docs/reference/voice/livekit.md +13 -13
  225. package/.docs/reference/voice/mistral.md +1 -1
  226. package/.docs/reference/voice/openai-realtime.md +1 -1
  227. package/.docs/reference/voice/sarvam.md +1 -1
  228. package/.docs/reference/voice/voice.addTools.md +1 -1
  229. package/.docs/reference/voice/voice.events.md +1 -1
  230. package/.docs/reference/voice/voice.getSpeakers.md +2 -2
  231. package/.docs/reference/voice/voice.on.md +2 -2
  232. package/.docs/reference/voice/xai-realtime.md +2 -2
  233. package/.docs/reference/workflows/run-methods/cancel.md +1 -1
  234. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  235. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  236. package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
  237. package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
  238. package/.docs/reference/workflows/workflow-state-reader.md +2 -2
  239. package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
  240. package/.docs/reference/workspace/daytona-sandbox.md +3 -3
  241. package/.docs/reference/workspace/docker-sandbox.md +2 -2
  242. package/.docs/reference/workspace/e2b-sandbox.md +2 -2
  243. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
  244. package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
  245. package/.docs/reference/workspace/local-filesystem.md +2 -2
  246. package/.docs/reference/workspace/local-sandbox.md +2 -2
  247. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  248. package/.docs/reference/workspace/platform-filesystem.md +3 -3
  249. package/.docs/reference/workspace/platform-sandbox.md +2 -2
  250. package/.docs/reference/workspace/process-manager.md +1 -1
  251. package/.docs/reference/workspace/railway-sandbox.md +4 -4
  252. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  253. package/.docs/reference/workspace/sandbox.md +1 -1
  254. package/.docs/reference/workspace/vercel-sandbox.md +1 -1
  255. package/.docs/reference/workspace/workspace-class.md +10 -10
  256. package/CHANGELOG.md +7 -0
  257. package/package.json +5 -5
@@ -12,7 +12,7 @@ Metrics are extracted from spans when they end. The observability layer inspects
12
12
 
13
13
  ### What affects whether a metric is available
14
14
 
15
- Two conditions must be true for a metric to reach storage:
15
+ A metric reaches storage when:
16
16
 
17
17
  1. `MastraStorageExporter` is configured as an exporter.
18
18
  2. The storage backend supports metrics (ClickHouse, DuckDB, or Postgres v-next with the observability domain enabled).
@@ -33,7 +33,7 @@ Duration metrics record execution time in milliseconds, calculated from the span
33
33
 
34
34
  ## Token usage metrics
35
35
 
36
- Token metrics are emitted only from `MODEL_GENERATION` spans that include `usage` data. If the provider doesn't report usage, no token metrics are emitted for that span.
36
+ Token metrics are emitted only from `MODEL_GENERATION` spans that include `usage` data. Token metrics require usage data from the provider.
37
37
 
38
38
  ### Input token metrics
39
39
 
@@ -64,7 +64,7 @@ The detailed breakdown metrics (everything except `total_input` and `total_outpu
64
64
 
65
65
  ### When cost context is attached
66
66
 
67
- Cost context is attached to token metrics when the embedded pricing registry has a matching entry for the provider and model. The registry ships with Mastra and covers common providers and models. If no match is found, token metrics are still emitted but without cost fields.
67
+ Cost context is attached to token metrics when the embedded pricing registry has a matching entry for the provider and model. Mastra includes the registry and covers common providers and models. If no match is found, token metrics are still emitted but without cost fields.
68
68
 
69
69
  ### What cost fields may be included
70
70
 
@@ -80,9 +80,9 @@ Cost context is attached to token metrics when the embedded pricing registry has
80
80
 
81
81
  ### How metrics relate to spans and trace context
82
82
 
83
- Each metric carries a `CorrelationContext` snapshot from the span that produced it. This context is stored alongside the metric value and lets you navigate from a metric to the exact span and trace.
83
+ Each metric carries a `CorrelationContext` snapshot from the span that produced it. This context is stored alongside the metric value and links a metric to the exact span and trace.
84
84
 
85
- The correlation fields are grouped into four categories:
85
+ Correlation fields use these categories:
86
86
 
87
87
  **Trace correlation**
88
88
 
@@ -110,7 +110,7 @@ The correlation fields are grouped into four categories:
110
110
 
111
111
  ### Why correlation helps with debugging
112
112
 
113
- When you spot a spike in latency or token usage on the Metrics dashboard, correlation context lets you drill directly into the trace that produced the metric. From there you can inspect the individual span to find the root cause: a slow tool call, a large prompt, or an unexpected error.
113
+ When you spot a spike in latency or token usage on the Metrics dashboard, correlation context lets you drill directly into the trace that produced the metric. From there you can inspect the individual span. The root cause might be a slow tool call or a large prompt. It might also be an unexpected error.
114
114
 
115
115
  ## Troubleshooting
116
116
 
@@ -129,7 +129,7 @@ When you spot a spike in latency or token usage on the Metrics dashboard, correl
129
129
  ### Token metrics are missing
130
130
 
131
131
  - **Span is a model generation**: Token metrics are only emitted from `MODEL_GENERATION` spans.
132
- - **Provider reports usage**: The model provider must include `usage` data in its response. If usage is absent, no token metrics are emitted.
132
+ - **Provider reports usage**: The model provider must include `usage` data in its response. Usage data is required to emit token metrics.
133
133
 
134
134
  ## Related
135
135
 
@@ -40,7 +40,7 @@ Extends `BaseExporterConfig`, which includes:
40
40
  createSpan(options: CreateSpanOptions<SpanType>): SpanIds | undefined
41
41
  ```
42
42
 
43
- Called by the Mastra observability instance during span construction. Creates a dd-trace APM span eagerly via `tracer.startSpan()` and returns Mastra-compatible identifiers. The returned IDs are used by Mastra throughout the span's lifetime; the dd-trace span object is stored internally and used for scope activation.
43
+ Called by the Mastra observability instance during span construction. Creates a dd-trace APM span eagerly via `tracer.startSpan()` and returns Mastra-compatible identifiers. The returned IDs are used by Mastra throughout the span's lifetime. The dd-trace span object is stored internally and used for scope activation.
44
44
 
45
45
  **Returns:** `SpanIds | undefined` - `{ spanId, traceId, parentSpanId }`, or `undefined` if the bridge is disabled.
46
46
 
@@ -151,7 +151,7 @@ const mastra = new Mastra({
151
151
  })
152
152
  ```
153
153
 
154
- > **Note:** Don't combine `DatadogBridge` with `DatadogExporter` in the same configuration both emit to LLM Observability and would double-write the same data.
154
+ > **Note:** Don't combine `DatadogBridge` with `DatadogExporter` in the same configuration. Both emit to LLM Observability and would double-write the same data.
155
155
 
156
156
  ## Setup requirements
157
157
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/observability@1.8.0`. **Deprecated in `1.12.0`** in favor of [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
6
6
 
7
- > **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. The two classes share the same constructor, environment variables, and runtime behavior; `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
7
+ > **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior; `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
8
8
 
9
9
  Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
10
10
 
@@ -106,7 +106,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
106
106
 
107
107
  Processes metric signals for Cloud export.
108
108
 
109
- Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint. Additional filtering by metric subtype or status inside `CloudExporter` isn't performed; the exporter forwards every metric event it receives unless it's disabled.
109
+ Every `MetricEvent` passed to this handler is buffered and exported to the Cloud metrics endpoint derived from the configured base endpoint. Additional filtering by metric subtype or status inside `CloudExporter` isn't performed. The exporter forwards every metric event it receives unless it's disabled.
110
110
 
111
111
  **Returns:** `Promise<void>` after the metric event has been accepted for buffering.
112
112
 
@@ -130,7 +130,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
130
130
 
131
131
  Processes feedback signals for Cloud export.
132
132
 
133
- Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `CloudExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
133
+ Every `FeedbackEvent` passed to this handler is buffered and exported to the Cloud feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `CloudExporter` is performed. All feedback events received here are forwarded unless the exporter is disabled.
134
134
 
135
135
  **Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
136
136
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Deprecated in `@mastra/observability@1.12.0`** in favor of [`MastraStorageExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter).
6
6
 
7
- > **Deprecated:** `DefaultExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraStorageExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter) for new projects. The two classes share the same constructor, configuration, and runtime behavior; `DefaultExporter` keeps its original `mastra-default-observability-exporter` exporter `name` so monitoring rules built against it keep working.
7
+ > **Deprecated:** `DefaultExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraStorageExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-storage-exporter) for new projects. Both classes share the same constructor, configuration, and runtime behavior. `DefaultExporter` keeps its original `mastra-default-observability-exporter` exporter `name` so monitoring rules built against it keep working.
8
8
 
9
9
  Persists observability events to Mastra Storage with automatic batching and retry logic.
10
10
 
@@ -108,7 +108,7 @@ async onMetricEvent(event: MetricEvent): Promise<void>
108
108
 
109
109
  Processes metric signals for export.
110
110
 
111
- Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint. No additional filtering by metric subtype or status inside `MastraPlatformExporter` is performed; the exporter forwards every metric event it receives unless it's disabled.
111
+ Every `MetricEvent` passed to this handler is buffered and exported to the metrics endpoint derived from the configured base endpoint. No additional filtering by metric subtype or status inside `MastraPlatformExporter` is performed. The exporter forwards every metric event it receives unless it's disabled.
112
112
 
113
113
  **Returns:** `Promise<void>` after the metric event has been accepted for buffering.
114
114
 
@@ -132,7 +132,7 @@ async onFeedbackEvent(event: FeedbackEvent): Promise<void>
132
132
 
133
133
  Processes feedback signals for export.
134
134
 
135
- Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `MastraPlatformExporter` is performed; all feedback events received here are forwarded unless the exporter is disabled.
135
+ Every `FeedbackEvent` passed to this handler is buffered and exported to the feedback endpoint derived from the configured base endpoint. No feedback-type filtering inside `MastraPlatformExporter` is performed. All feedback events received here are forwarded unless the exporter is disabled.
136
136
 
137
137
  **Returns:** `Promise<void>` after the feedback event has been accepted for buffering.
138
138
 
@@ -192,7 +192,7 @@ Errors raised by `MastraPlatformExporter` use the `MASTRA_PLATFORM_EXPORTER_*` `
192
192
 
193
193
  ## Span wire format
194
194
 
195
- The shape of each span sent to Mastra platform is documented here for reference only it's not exported from `@mastra/observability` and shouldn't be imported. The exporter spreads the original `AnyExportedSpan` (so the source field names are preserved) and layers a small set of platform-friendly aliases on top:
195
+ The shape of each span sent to Mastra platform is documented here for reference only: it's not exported from `@mastra/observability` and shouldn't be imported. The exporter spreads the original `AnyExportedSpan` (so the source field names are preserved) and layers a small set of platform-friendly aliases on top:
196
196
 
197
197
  ```typescript
198
198
  type MastraPlatformSpanRecord = AnyExportedSpan & {
@@ -231,7 +231,7 @@ const customExporter = new MastraPlatformExporter({
231
231
 
232
232
  ## Migrating from `CloudExporter`
233
233
 
234
- The two classes share the same constructor signature, environment variables, and behavior. To migrate, replace the import and constructor:
234
+ Both classes share the same constructor signature, environment variables, and behavior. To migrate, replace the import and constructor:
235
235
 
236
236
  ```typescript
237
237
  // Before
@@ -162,7 +162,7 @@ const customExporter = new MastraStorageExporter({
162
162
 
163
163
  ## Migrating from `DefaultExporter`
164
164
 
165
- The two classes share the same constructor signature and behavior. To migrate, replace the import and constructor:
165
+ Both classes share the same constructor signature and behavior. To migrate, replace the import and constructor:
166
166
 
167
167
  ```typescript
168
168
  // Before
@@ -803,7 +803,7 @@ interface CustomSamplerOptions {
803
803
 
804
804
  ### `ConfigSelector`
805
805
 
806
- Function to select which observability instance to use for a given span.
806
+ Function to select which observability instance to use for a span.
807
807
 
808
808
  ```typescript
809
809
  type ConfigSelector = (
@@ -22,7 +22,7 @@ new Observability({
22
22
  })
23
23
  ```
24
24
 
25
- If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values aren't modified add a `SensitiveDataFilter` to their processors yourself if needed.
25
+ If a config already includes a `SensitiveDataFilter` in `spanOutputProcessors`, the auto-applied filter is skipped to avoid double redaction. Pre-instantiated `ObservabilityInstance` values aren't modified. Add a `SensitiveDataFilter` to their processors yourself if needed.
26
26
 
27
27
  ## Constructor
28
28
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Span filtering
4
4
 
5
- Span filtering controls which spans are exported from an observability config. Use it to reduce noise, lower per-span costs, or keep only the spans that matter for a specific exporter or environment.
5
+ Span filtering controls which spans are exported from an observability config. Use it to reduce noise or lower per-span costs. It can also keep only the spans that matter for a specific exporter or environment.
6
6
 
7
7
  For a shorter overview of tracing configuration, see [Tracing](https://mastra.ai/docs/observability/tracing/overview).
8
8
 
@@ -14,7 +14,7 @@ Supports three scoping modes:
14
14
  - **Resource scope** (default): Tracks cumulative cost per `resourceId` across runs
15
15
  - **Thread scope**: Tracks cumulative cost per `threadId` across runs
16
16
 
17
- > **Approximate cost guard.** Cost data is persisted asynchronously via buffered exporters in the observability pipeline. Fast-running agents may exceed the configured limit before metrics are available for query. Treat `maxCost` as a best-effort threshold, not a hard ceiling.
17
+ > **Approximate cost guard.** Cost data is persisted asynchronously via buffered exporters in the observability pipeline. Fast-running agents may exceed the configured limit before metrics are available for query. Treat `maxCost` as an approximate threshold that fast-running agents may exceed.
18
18
 
19
19
  ## Usage example
20
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # PIIDetector
4
4
 
5
- The `PIIDetector` is a **hybrid processor** that can be used for both input and output processing to detect and redact personally identifiable information (PII) for privacy compliance. This processor helps maintain privacy by identifying various types of PII and providing flexible strategies for handling them, including multiple redaction methods to ensure compliance with GDPR, CCPA, HIPAA, and other privacy regulations.
5
+ The `PIIDetector` is a **hybrid processor** that can be used for both input and output processing to detect and redact personally identifiable information (PII) for privacy compliance. This processor helps maintain privacy by identifying types of PII and providing flexible strategies for handling them, including multiple redaction methods to ensure compliance with GDPR, CCPA, HIPAA, and other privacy regulations.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -6,7 +6,7 @@ The `Processor` interface defines the contract for all processors in Mastra. Pro
6
6
 
7
7
  ## When processor methods run
8
8
 
9
- The eight processor methods run at different points in the agent execution lifecycle:
9
+ Processor methods run at different points in the agent execution lifecycle:
10
10
 
11
11
  ```text
12
12
  ┌────────────────────────────────────────────────────────────────────┐
@@ -168,16 +168,16 @@ Use `messages` when you only need to read, map over, or lightly edit fields on t
168
168
 
169
169
  ### Persistence
170
170
 
171
- When memory is enabled, only what ends up in `messageList` after all processors finish is persisted to storage. The two return styles are equivalent for persistence:
171
+ When memory is enabled, only what ends up in `messageList` after all processors finish is persisted to storage. Both return styles are equivalent for persistence:
172
172
 
173
- - Mutating `messageList` directly (or returning the same `MessageList` instance) recorded mutations are applied in place, so the saved conversation reflects your changes.
174
- - Returning a `MastraDBMessage[]` or `{ messages, systemMessages }` Mastra reconciles the returned array against `messageList` for the current stage, removing missing messages and replacing system messages.
173
+ - When you mutate `messageList` directly (or return the same `MessageList` instance), recorded mutations are applied in place, so the saved conversation reflects your changes.
174
+ - When you return a `MastraDBMessage[]` or `{ messages, systemMessages }`, Mastra reconciles the returned array against `messageList` for the current stage, removing missing messages and replacing system messages.
175
175
 
176
- Returning a different `MessageList` instance is an error; always mutate the one passed to your processor.
176
+ Returning a different `MessageList` instance is an error. Always mutate the one passed to your processor.
177
177
 
178
178
  ### Reading text from a message
179
179
 
180
- `MastraDBMessage.content` is a structured object, not a string. The canonical way to read user or assistant text is `content.parts`:
180
+ `MastraDBMessage.content` uses a structured object. Strings aren't supported. The canonical way to read user or assistant text is `content.parts`:
181
181
 
182
182
  ```typescript
183
183
  import type { MastraDBMessage } from '@mastra/core/memory'
@@ -313,10 +313,10 @@ processInputStep?<TTripwireMetadata = unknown>(
313
313
 
314
314
  `processInputStep` can return several shapes:
315
315
 
316
- - **`ProcessInputStepResult` object** override any combination of the properties below for this step (described next).
317
- - **`MessageList`** return the same `messageList` instance to signal you mutated messages in place.
318
- - **`MastraDBMessage[]`** return a transformed messages array; replaces the step's messages.
319
- - **`void` or `undefined`** return nothing to leave the step unchanged.
316
+ - **`ProcessInputStepResult` object**: Override any combination of the properties below for this step (described next).
317
+ - **`MessageList`**: Return the same `messageList` instance to signal you mutated messages in place.
318
+ - **`MastraDBMessage[]`**: Return a transformed messages array. Replaces the step's messages.
319
+ - **`void` or `undefined`**: Return nothing to leave the step unchanged.
320
320
 
321
321
  The object form can return any combination of these properties:
322
322
 
@@ -480,7 +480,7 @@ Handles LLM API rejection errors before they surface as final errors. This runs
480
480
 
481
481
  Add processors that implement `processAPIError` to an agent's `errorProcessors` array.
482
482
 
483
- Processors can inspect the error, modify the request (for example, by appending messages to the `messageList`), and return `{ retry: true }` to signal a retry with the modified state.
483
+ Processors can inspect the error and modify the request, for example by appending messages to the `messageList`. Return `{ retry: true }` to retry with the modified state.
484
484
 
485
485
  ```typescript
486
486
  processAPIError?(args: ProcessAPIErrorArgs): Promise<ProcessAPIErrorResult | void> | ProcessAPIErrorResult | void;
@@ -896,7 +896,7 @@ export class WordCounter implements Processor {
896
896
 
897
897
  Every processor receives a `state` object in `processLLMRequest`, `processLLMResponse`, `processOutputStream`, `processOutputStep`, `processOutputResult`, and `processAPIError`. State has three important properties:
898
898
 
899
- - **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Two processors with different ids can't read or overwrite each other's state.
899
+ - **Per-processor**: Each processor gets its own `state` object, keyed by the processor's `id`. Processors with different ids can't read or overwrite each other's state.
900
900
  - **Per-request**: A fresh state object is created at the start of every `agent.generate()` or `agent.stream()` call. State doesn't leak between requests or between users.
901
901
  - **Shared across methods**: Within one request, the same `state` object is passed to `processLLMRequest` (before the provider call), `processLLMResponse` (after the step completes), `processOutputStream` (for every chunk), `processOutputStep` (after every LLM step), `processOutputResult` (once at the end), and `processAPIError` (when an LLM call fails). For example, `processLLMRequest` can stash a cache key and `processLLMResponse` can read it back to write the response.
902
902
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # PromptInjectionDetector
4
4
 
5
- The `PromptInjectionDetector` is an **input processor** that detects and prevents prompt injection attacks, jailbreaks, and system manipulation attempts before messages are sent to the language model. This processor helps maintain security by identifying various types of injection attempts and providing flexible strategies for handling them, including content rewriting to neutralize attacks while preserving legitimate user intent.
5
+ The `PromptInjectionDetector` is an **input processor** that detects and prevents prompt injection attacks, jailbreaks, and system manipulation attempts before messages are sent to the language model. This processor helps maintain security by identifying types of injection attempts and providing flexible strategies for handling them, including content rewriting to neutralize attacks while preserving legitimate user intent.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  The `ProviderHistoryCompat` processor handles provider-specific history incompatibilities. It can rewrite the outbound language model prompt before a provider call, or react to API errors and retry with repaired message history.
6
6
 
7
- Use it when an agent may switch between model providers, reuse message history across providers, or call a provider that rejects fields emitted by another provider.
7
+ Use it when an agent may switch between model providers or reuse message history across providers. It also handles providers that reject fields emitted by another provider.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # RegexFilterProcessor
4
4
 
5
- The `RegexFilterProcessor` applies zero-cost regex pattern matching to filter, redact, or block content in agent messages. No LLM calls are made all detection is regex-based.
5
+ The `RegexFilterProcessor` applies zero-cost regex pattern matching to filter, redact, or block content in agent messages. No LLM calls are made. All detection is regex-based.
6
6
 
7
7
  Supports built-in presets for common patterns (PII, secrets, URLs) and custom regex rules. Can be applied to input, output, or both phases.
8
8
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  # ResponseCache
4
4
 
5
- `ResponseCache` is an input processor that caches LLM responses on the request/response boundary inside the agentic loop. It hooks into `processLLMRequest` (cache lookup; short-circuits on hit) and `processLLMResponse` (cache write on completion).
5
+ `ResponseCache` is an input processor that caches LLM responses on the request/response boundary inside the agentic loop. It hooks into `processLLMRequest` for cache lookup and short-circuits on a hit. It uses `processLLMResponse` to write the completed response.
6
6
 
7
- The cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model i.e. _after_ memory has loaded and earlier input processors have transformed the prompt so two users with different memory contexts produce different cache keys. Each step in an agentic tool loop is independently cached.
7
+ The cache key is derived from the resolved `LanguageModelV2Prompt` Mastra is about to send to the model (i.e. _after_ memory has loaded and earlier input processors have transformed the prompt) so two users with different memory contexts produce different cache keys. Each step in an agentic tool loop is independently cached.
8
8
 
9
- No agent-level option for response caching exists; register `ResponseCache` explicitly on `inputProcessors`. Per-call overrides flow through `RequestContext` via [`ResponseCache.context()`](#static-helpers) and [`ResponseCache.applyContext()`](#static-helpers).
9
+ No agent-level option for response caching exists. Register `ResponseCache` explicitly on `inputProcessors`. Per-call overrides flow through `RequestContext` via [`ResponseCache.context()`](#static-helpers) and [`ResponseCache.applyContext()`](#static-helpers).
10
10
 
11
11
  ## Usage example
12
12
 
@@ -55,7 +55,7 @@ See [Response caching](https://mastra.ai/docs/agents/processors) for the concept
55
55
 
56
56
  ## Static helpers
57
57
 
58
- `ResponseCache` exposes two static helpers for setting per-call overrides on a `RequestContext`. The helpers keep the underlying context key a private implementation detail prefer them over reading/writing the raw key.
58
+ `ResponseCache` exposes two static helpers for setting per-call overrides on a `RequestContext`. The helpers keep the underlying context key a private implementation detail: prefer them over reading/writing the raw key.
59
59
 
60
60
  ### `ResponseCache.context(options)`
61
61
 
@@ -88,7 +88,7 @@ The shape passed to `ResponseCache.context()` / `ResponseCache.applyContext()`.
88
88
 
89
89
  **bust** (`boolean`): Skip the cache read but still write on completion.
90
90
 
91
- `cache`, `ttl`, and `agentId` are intentionally not overridable per call they're instance-level concerns that shouldn't vary per request.
91
+ `cache`, `ttl`, and `agentId` are intentionally not overridable per call: they're instance-level concerns that shouldn't vary per request.
92
92
 
93
93
  ## ResponseCacheKeyInputs
94
94
 
@@ -106,9 +106,9 @@ The argument passed to a `key` function (constructor or per-call). All fields co
106
106
 
107
107
  ## Helper exports
108
108
 
109
- - `buildResponseCacheKey(inputs)` the deterministic hash used by default. Re-export it to override individual fields while preserving the rest of the standard key shape.
110
- - `DEFAULT_RESPONSE_CACHE_TTL_SECONDS` the default `ttl` (`300`).
111
- - `RESPONSE_CACHE_CONTEXT_KEY` the `RequestContext` key the static helpers write to. Exposed for advanced cases (e.g. clearing the override mid-pipeline); prefer the helpers.
109
+ - `buildResponseCacheKey(inputs)`: The deterministic hash used by default. Re-export it to override individual fields while preserving the rest of the standard key shape.
110
+ - `DEFAULT_RESPONSE_CACHE_TTL_SECONDS`: The default `ttl` (`300`).
111
+ - `RESPONSE_CACHE_CONTEXT_KEY`: The `RequestContext` key the static helpers write to. Exposed for advanced cases (e.g. clearing the override mid-pipeline). Prefer the helpers.
112
112
 
113
113
  ## Related
114
114
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # SystemPromptScrubber
4
4
 
5
- The `SystemPromptScrubber` is an **output processor** that detects and handles system prompts, instructions, and other revealing information that could introduce security vulnerabilities. This processor helps maintain security by identifying various types of system prompts and providing flexible strategies for handling them, including multiple redaction methods to ensure sensitive information is properly sanitized.
5
+ The `SystemPromptScrubber` is an **output processor** that detects and handles system prompts, instructions, and other revealing information that could introduce security vulnerabilities. This processor helps maintain security by identifying types of system prompts and providing flexible strategies for handling them, including multiple redaction methods to ensure sensitive information is properly sanitized.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -94,7 +94,7 @@ export const agent = new Agent({
94
94
 
95
95
  ### As a per-step input processor (limit multi-step token growth)
96
96
 
97
- When an agent uses tools across multiple steps (e.g. `maxSteps > 1`), each step accumulates conversation history from all previous steps. Use `inputProcessors` to also limit tokens at each step of the agentic loop the `TokenLimiterProcessor` automatically applies to both the initial input and every subsequent step:
97
+ When an agent uses tools across multiple steps (e.g. `maxSteps > 1`), each step accumulates conversation history from all previous steps. Use `inputProcessors` to also limit tokens at each step of the agentic loop. The `TokenLimiterProcessor` automatically applies to both the initial input and every subsequent step:
98
98
 
99
99
  ```typescript
100
100
  import { Agent } from '@mastra/core/agent'
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ToolSearchProcessor
4
4
 
5
- The `ToolSearchProcessor` is an **input processor** that enables dynamic tool discovery and loading. Instead of providing all tools to the agent upfront, it gives the agent two meta-tools (`search_tools` and `load_tool`) that let it find and load tools on demand. This reduces context token usage when working with large tool libraries.
5
+ The `ToolSearchProcessor` is an **input processor** that enables runtime-defined tool discovery and loading. Instead of providing all tools to the agent upfront, it gives the agent two meta-tools (`search_tools` and `load_tool`) that let it find and load tools on demand. This reduces context token usage when working with large tool libraries.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -91,11 +91,11 @@ Immediately runs TTL cleanup instead of waiting for the scheduled sweep.
91
91
  const cleaned = processor.cleanupNow()
92
92
  ```
93
93
 
94
- Returns: `number` the count of threads cleaned up.
94
+ Returns: `number`: the count of threads cleaned up.
95
95
 
96
96
  ## Request-aware filtering
97
97
 
98
- Use `filter` to apply request-specific policy to dynamic tools. The hook receives the resolved tool ID as `toolName`, the tool, request context, and phase. `toolName` is the ID returned by `search_tools`, which may differ from the key used in the `tools` object.
98
+ Use `filter` to apply request-specific policy to runtime-defined tools. The hook receives the resolved tool ID as `toolName`, the tool, request context, and phase. `toolName` is the ID returned by `search_tools`, which may differ from the key used in the `tools` object.
99
99
 
100
100
  ```typescript
101
101
  import { ToolSearchProcessor } from '@mastra/core/processors'
@@ -120,7 +120,7 @@ The `phase` value describes where the filter is being applied:
120
120
  - `load`: Blocks `load_tool` from loading disallowed tools.
121
121
  - `active`: Hides already-loaded tools from the current request if they're no longer allowed.
122
122
 
123
- If the hook throws or rejects, `ToolSearchProcessor` treats the tool as disallowed for that request. The hook may run for every matching search candidate, so keep async policy checks cheap or cached. The `search_tools` meta-tool is always available; `load_tool` is available unless `search.autoLoad` is enabled. Tools passed directly through the agent or `processInputStep` remain available unless you filter them outside `ToolSearchProcessor`.
123
+ If the hook throws or rejects, `ToolSearchProcessor` treats the tool as disallowed for that request. The hook may run for every matching search candidate, so keep async policy checks cheap or cached. The `search_tools` meta-tool is always available. `load_tool` is available unless `search.autoLoad` is enabled. Tools passed directly through the agent or `processInputStep` remain available unless you filter them outside `ToolSearchProcessor`.
124
124
 
125
125
  ## Extended usage example
126
126
 
@@ -188,7 +188,7 @@ Every match is activated, so keep `topK` small (for example, `3`) to avoid addin
188
188
 
189
189
  ## Loaded-tool storage
190
190
 
191
- The `storage` option controls where the set of loaded tools is tracked. The default is `'in-memory'`; the `'context'` store is opt-in.
191
+ The `storage` option controls where the set of loaded tools is tracked. The default is `'in-memory'`. The `'context'` store is opt-in.
192
192
 
193
193
  ### `'in-memory'` (default)
194
194
 
@@ -205,7 +205,7 @@ Use `clearState`, `clearAllState`, `getStateStats`, and `cleanupNow` to inspect
205
205
  Loaded state is derived from the conversation messages: a tool is loaded while a `search_tools` or `load_tool` result naming it remains in the messages. This mode:
206
206
 
207
207
  - Requires no memory configuration.
208
- - Is restart-safe the durable record is the persisted message history.
208
+ - Is restart-safe: the durable record is the persisted message history.
209
209
  - De-loads a tool automatically once that result is no longer present in the messages.
210
210
 
211
211
  ```typescript
@@ -219,7 +219,7 @@ const toolSearch = new ToolSearchProcessor({
219
219
 
220
220
  Loading tools is cache-friendly in both modes: loads are append-only, so the cached prompt prefix stays stable for providers that support prompt caching.
221
221
 
222
- Unloading a tool changes the tool definitions sent to the model, which shifts the cached prefix and causes the next turn to pay a cache write instead of a cache hit. In `'in-memory'` mode this happens when a thread's state is evicted by `ttl`. In `'context'` mode it happens when a tool's discovery result is no longer present in the messages (for example, when older messages are trimmed) the tool de-loads and the model must search for it again before reuse. This is expected: removing an unused tool trades one cache write for a smaller prefix on later turns.
222
+ Unloading a tool changes the tool definitions sent to the model, which shifts the cached prefix and causes the next turn to pay a cache write instead of a cache hit. In `'in-memory'` mode this happens when a thread's state is evicted by `ttl`. In `'context'` mode it happens when a tool's discovery result is no longer present in the messages (for example, when older messages are trimmed). The tool de-loads, and the model must search for it again before reuse. This is expected: removing an unused tool trades one cache write for a smaller prefix on later turns.
223
223
 
224
224
  ## Combining with other processors
225
225
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # UnicodeNormalizer
4
4
 
5
- The `UnicodeNormalizer` is an **input processor** that normalizes Unicode text to ensure consistent formatting and remove potentially problematic characters before messages are sent to the language model. This processor helps maintain text quality by handling various Unicode representations, removing control characters, and standardizing whitespace formatting.
5
+ The `UnicodeNormalizer` is an **input processor** that normalizes Unicode text to ensure consistent formatting and remove potentially problematic characters before messages are sent to the language model. This processor handles Unicode representations and removes control characters. It also standardizes whitespace formatting.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Your new Mastra project, created with the `create mastra` command, comes with a predefined set of files and folders to help you get started.
6
6
 
7
- Mastra is a framework, but it's mostly **unopinionated** about how you organize or colocate your files. The CLI provides a sensible default structure that works well for most projects, but you're free to adapt it to your workflow or team conventions. You could even build your entire project in a single file if you wanted! Whatever structure you choose, keep it consistent to ensure your code stays maintainable and straightforward to navigate.
7
+ Mastra is a framework, but it's mostly **unopinionated** about how you organize or colocate your files. The CLI provides a sensible default structure that works well for most projects, but you're free to adapt it to your workflow or team conventions. You could even build your entire project in a single file if you wanted! Whatever structure you choose, keep it consistent to ensure your code stays maintainable and straightforward to browse.
8
8
 
9
9
  ## Default project structure
10
10
 
@@ -77,7 +77,7 @@ await pubsub.publish('my-topic', {
77
77
 
78
78
  Registers a callback to receive events published to a topic. When `options.group` is set, subscribers in the same group compete for messages and each event is delivered to one member. Without a group, every subscriber receives every event.
79
79
 
80
- Pass `options.batch` to opt in to batched delivery. The callback signature is unchanged: a batch of N events is delivered as N consecutive `cb(event, ack, nack)` calls in publish order. Batching is honored only when the backend's [`supportsNativeBatching`](#properties) is `true`; other backends ignore the option and deliver events one at a time.
80
+ Pass `options.batch` to opt in to batched delivery. The callback signature is unchanged: a batch of N events is delivered as N consecutive `cb(event, ack, nack)` calls in publish order. Batching is honored only when the backend's [`supportsNativeBatching`](#properties) is `true`. Other backends ignore the option and deliver events one at a time.
81
81
 
82
82
  ```typescript
83
83
  await pubsub.subscribe('my-topic', (event, ack, nack) => {
@@ -103,9 +103,9 @@ await pubsub.flush()
103
103
 
104
104
  #### `clearTopic(topic)`
105
105
 
106
- Deletes all retained state for a topic cached history, persistent stream entries, and consumer groups once no more events will be published to it. Mastra's run lifecycles (durable agents and the evented workflow engine) call this automatically when a run reaches a terminal state, so per-run topics don't accumulate on transports that retain messages.
106
+ Deletes all retained state for a topic (cached history, persistent stream entries, and consumer groups) once no more events will be published to it. Mastra's run lifecycles (durable agents and the evented workflow engine) call this automatically when a run reaches a terminal state, so per-run topics don't accumulate on transports that retain messages.
107
107
 
108
- The default implementation is a no-op: transports that retain nothing per topic (such as `EventEmitterPubSub`) have nothing to clear. Backends that persist messages, like [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), override it. The contract is best-effort implementations log failures rather than throwing, because callers invoke it fire-and-forget at cleanup boundaries.
108
+ The default implementation is a no-op: transports that retain nothing per topic (such as `EventEmitterPubSub`) have nothing to clear. Backends that persist messages, like [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), override it. The contract is best-effort: implementations log failures rather than throwing, because callers invoke it fire-and-forget at cleanup boundaries.
109
109
 
110
110
  ```typescript
111
111
  await pubsub.clearTopic('workflow.events.v2.run-123')
@@ -177,7 +177,7 @@ await pubsub.subscribeFromOffset('my-topic', 42, event => {
177
177
 
178
178
  ### `SubscribeBatchOptions`
179
179
 
180
- Per-subscription batching policy. The callback signature doesn't change; a batch of N events becomes N consecutive callback invocations in publish order.
180
+ Per-subscription batching policy. The callback signature doesn't change. A batch of N events becomes N consecutive callback invocations in publish order.
181
181
 
182
182
  **maxSize** (`number`): Maximum events held before forcing a flush.
183
183
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  Use it for distributed deployments on Google Cloud. For single-process delivery, use [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). For Redis, use [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams).
8
8
 
9
- Each topic maps to a Google Cloud topic. Subscriptions with a group share a named subscription, so members compete for events. Subscriptions without a group create a per-instance subscription, so every instance receives every event.
9
+ Each topic maps to a Google Cloud topic. Subscriptions with a group share a subscription, so members compete for events. Subscriptions without a group create a per-instance subscription, so every instance receives every event.
10
10
 
11
11
  ## Installation
12
12
 
@@ -85,7 +85,7 @@ await pubsub.flush()
85
85
 
86
86
  ### `destroy(topicName)`
87
87
 
88
- Removes the subscription and topic for a given topic name. Use this to clean up Google Cloud resources.
88
+ Removes the subscription and topic for a topic name. Use this to clean up Google Cloud resources.
89
89
 
90
90
  ```typescript
91
91
  await pubsub.destroy('workflow.events')
@@ -2,9 +2,9 @@
2
2
 
3
3
  # LeaseProvider
4
4
 
5
- `LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/long-running-agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a given resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
5
+ `LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/long-running-agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
6
6
 
7
- Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can genuinely coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that can't lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
7
+ Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can actually coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that can't lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
8
8
 
9
9
  The built-in [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) implements `LeaseProvider`, which is what enables signals to coordinate across instances in distributed and serverless deployments.
10
10
 
@@ -102,7 +102,7 @@ Returns: `Promise<boolean>`
102
102
 
103
103
  #### `transferLease(key, fromOwner, toOwner, ttlMs)`
104
104
 
105
- Atomically hands a held lease from `fromOwner` to `toOwner`, refreshing its TTL, without releasing the key in between. This is the gap-free primitive used when one owner finishes but a follow-up owner must take over the same key immediately, for example when a thread run completes and a queued follow-up run drains on the same thread. A naive release-then-acquire would briefly leave the key empty, letting a racing process win the freed lease and start a competing run.
105
+ Atomically transfers a held lease from `fromOwner` to `toOwner` and refreshes its TTL without releasing the key in between. This gap-free primitive lets a follow-up owner take over the same key immediately after the current owner finishes. For example, a queued follow-up run can take over when a thread run completes. A naive release-then-acquire briefly leaves the key empty. A racing process could then win the freed lease and start a competing run.
106
106
 
107
107
  Returns `true` if `fromOwner` still held the lease and ownership moved to `toOwner`, or `false` if the lease was already lost, in which case the caller should fall back to a fresh `acquireLease`.
108
108
 
@@ -129,5 +129,5 @@ When the configured pub/sub backend doesn't implement `LeaseProvider`, the runti
129
129
 
130
130
  - [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
131
131
  - [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
132
- - [Signals](https://mastra.ai/docs/long-running-agents/signals): The runtime that uses leasing to coordinate thread runs across processes
132
+ - [Signals](https://mastra.ai/docs/long-running-agents/signals): The runtime that uses leasing to coordinate thread execution across processes
133
133
  - [Channels](https://mastra.ai/docs/capabilities/channels/overview): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
@@ -101,7 +101,7 @@ await pubsub.flush()
101
101
 
102
102
  ### `clearTopic(topic)`
103
103
 
104
- Deletes a topic's stream and every consumer group on it, freeing the memory a finished topic would otherwise hold. Mastra's run lifecycles durable agents and the evented workflow engine call this automatically when a run reaches a terminal state; call it yourself only once nothing will read the topic again. It's best-effort and never throws failures are logged at warn level. A subscriber still attached when the stream is deleted recovers on its own but misses the deleted entries.
104
+ Deletes a topic's stream and every consumer group on it, freeing the memory a finished topic would otherwise hold. Mastra's run lifecycles (durable agents and the evented workflow engine) call this automatically when a run reaches a terminal state. Call it yourself only once nothing will read the topic again. It's best-effort and never throws. Failures are logged at warn level. A subscriber still attached when the stream is deleted recovers on its own but misses the deleted entries.
105
105
 
106
106
  Automatic cleanup requires `@mastra/core` and `@mastra/redis-streams` versions that both support `clearTopic`: the runtime routes the call through its caching layer, so upgrade the two packages together to get end-of-run stream deletion.
107
107
 
@@ -51,4 +51,4 @@ await pubsub.close()
51
51
 
52
52
  ## Broker election
53
53
 
54
- The first process to bind the socket becomes the broker and routes events between all connected clients. Other processes connect as clients. When the broker exits, an exclusive lock file serializes the next election so exactly one client becomes the new broker, and the remaining clients resubscribe to it. This avoids a split-brain state where two processes both act as broker.
54
+ The first process to bind the socket becomes the broker and routes events between all connected clients. Other processes connect as clients. When the broker exits, an exclusive lock file serializes the next election. Exactly one client becomes the new broker. The remaining clients resubscribe to it. This avoids a split-brain state where two processes both act as broker.