@mastra/mcp-docs-server 1.2.11-alpha.6 → 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 (262) 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/gateways/vercel.md +1 -2
  47. package/.docs/models/index.md +1 -1
  48. package/.docs/models/providers/aiand.md +1 -3
  49. package/.docs/models/providers/berget.md +2 -1
  50. package/.docs/models/providers/hyper.md +7 -7
  51. package/.docs/models/providers/modal.md +73 -0
  52. package/.docs/models/providers/xpersona.md +12 -2
  53. package/.docs/models/providers.md +1 -0
  54. package/.docs/reference/acp/acp-agent.md +3 -3
  55. package/.docs/reference/acp/create-acp-tool.md +2 -2
  56. package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
  57. package/.docs/reference/agent-controller/session.md +6 -6
  58. package/.docs/reference/agents/agent.md +7 -7
  59. package/.docs/reference/agents/channels.md +3 -3
  60. package/.docs/reference/agents/durable-agent.md +3 -3
  61. package/.docs/reference/agents/generate.md +3 -3
  62. package/.docs/reference/agents/getDefaultOptions.md +1 -1
  63. package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
  64. package/.docs/reference/agents/listScorers.md +1 -1
  65. package/.docs/reference/agents/listSkills.md +1 -1
  66. package/.docs/reference/agents/listSuspendedRuns.md +2 -2
  67. package/.docs/reference/ai-sdk/chat-route.md +1 -1
  68. package/.docs/reference/ai-sdk/network-route.md +1 -1
  69. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
  70. package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
  71. package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
  72. package/.docs/reference/ai-sdk/workflow-route.md +1 -1
  73. package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
  74. package/.docs/reference/auth/auth0.md +1 -1
  75. package/.docs/reference/auth/fga.md +2 -2
  76. package/.docs/reference/auth/google.md +2 -2
  77. package/.docs/reference/auth/okta.md +1 -1
  78. package/.docs/reference/auth/workos.md +2 -2
  79. package/.docs/reference/browser/agent-browser.md +2 -2
  80. package/.docs/reference/browser/browser-viewer.md +3 -3
  81. package/.docs/reference/browser/mastra-browser.md +3 -3
  82. package/.docs/reference/browser/stagehand-browser.md +4 -4
  83. package/.docs/reference/channels/slack-provider.md +2 -2
  84. package/.docs/reference/cli/create-mastra.md +1 -1
  85. package/.docs/reference/cli/mastra.md +23 -23
  86. package/.docs/reference/client-js/agents.md +9 -9
  87. package/.docs/reference/client-js/memory.md +2 -2
  88. package/.docs/reference/client-js/workflows.md +1 -1
  89. package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
  90. package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
  91. package/.docs/reference/configuration.md +6 -6
  92. package/.docs/reference/core/getMCPServer.md +1 -1
  93. package/.docs/reference/core/getScorer.md +1 -1
  94. package/.docs/reference/datasets/addItem.md +1 -1
  95. package/.docs/reference/datasets/listItems.md +1 -1
  96. package/.docs/reference/deployer/netlify.md +4 -4
  97. package/.docs/reference/deployer/vercel.md +7 -7
  98. package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
  99. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
  100. package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
  101. package/.docs/reference/editor/blob-store-provider.md +1 -1
  102. package/.docs/reference/editor/browser-provider.md +3 -3
  103. package/.docs/reference/editor/filesystem-provider.md +4 -4
  104. package/.docs/reference/editor/mastra-editor.md +5 -5
  105. package/.docs/reference/editor/processor-provider.md +3 -3
  106. package/.docs/reference/editor/sandbox-provider.md +4 -4
  107. package/.docs/reference/editor/storage-browser-ref.md +6 -6
  108. package/.docs/reference/editor/storage-workspace-ref.md +4 -4
  109. package/.docs/reference/editor/tool-provider.md +1 -1
  110. package/.docs/reference/evals/answer-relevancy.md +4 -4
  111. package/.docs/reference/evals/bias.md +3 -3
  112. package/.docs/reference/evals/checks.md +3 -3
  113. package/.docs/reference/evals/completeness.md +5 -5
  114. package/.docs/reference/evals/content-similarity.md +5 -5
  115. package/.docs/reference/evals/context-precision.md +2 -2
  116. package/.docs/reference/evals/context-recall.md +8 -8
  117. package/.docs/reference/evals/context-relevance.md +4 -4
  118. package/.docs/reference/evals/create-scorer.md +1 -1
  119. package/.docs/reference/evals/faithfulness.md +3 -3
  120. package/.docs/reference/evals/filter-run.md +2 -2
  121. package/.docs/reference/evals/hallucination.md +6 -6
  122. package/.docs/reference/evals/keyword-coverage.md +6 -6
  123. package/.docs/reference/evals/mastra-scorer.md +9 -3
  124. package/.docs/reference/evals/noise-sensitivity.md +5 -5
  125. package/.docs/reference/evals/prompt-alignment.md +5 -5
  126. package/.docs/reference/evals/rubric.md +1 -1
  127. package/.docs/reference/evals/run-evals.md +3 -3
  128. package/.docs/reference/evals/scorer-utils.md +4 -4
  129. package/.docs/reference/evals/textual-difference.md +4 -4
  130. package/.docs/reference/evals/tool-call-accuracy.md +1 -1
  131. package/.docs/reference/evals/toxicity.md +4 -4
  132. package/.docs/reference/evals/trajectory-accuracy.md +10 -10
  133. package/.docs/reference/file-based-agents/instructions.md +2 -2
  134. package/.docs/reference/file-based-agents/logger.md +1 -1
  135. package/.docs/reference/file-based-agents/observability.md +1 -1
  136. package/.docs/reference/file-based-agents/processors.md +1 -1
  137. package/.docs/reference/file-based-agents/skills.md +1 -1
  138. package/.docs/reference/file-based-agents/storage.md +1 -1
  139. package/.docs/reference/file-based-agents/studio.md +1 -1
  140. package/.docs/reference/file-based-agents/subagents.md +1 -1
  141. package/.docs/reference/file-based-agents/tools.md +1 -1
  142. package/.docs/reference/file-based-agents/workspace.md +1 -1
  143. package/.docs/reference/logging/pino-logger.md +3 -3
  144. package/.docs/reference/memory/clone-utilities.md +1 -1
  145. package/.docs/reference/memory/cloneThread.md +3 -3
  146. package/.docs/reference/memory/listThreads.md +1 -1
  147. package/.docs/reference/memory/memory-class.md +1 -1
  148. package/.docs/reference/memory/observational-memory.md +11 -11
  149. package/.docs/reference/memory/recall.md +2 -2
  150. package/.docs/reference/memory/serialized-memory-config.md +4 -4
  151. package/.docs/reference/memory/summarizeConversation.md +3 -3
  152. package/.docs/reference/memory/summarizeThread.md +3 -3
  153. package/.docs/reference/observability/feedback.md +1 -1
  154. package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
  155. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  156. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
  157. package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
  158. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
  159. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
  160. package/.docs/reference/observability/tracing/interfaces.md +1 -1
  161. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
  162. package/.docs/reference/observability/tracing/span-filtering.md +1 -1
  163. package/.docs/reference/processors/cost-guard-processor.md +1 -1
  164. package/.docs/reference/processors/pii-detector.md +1 -1
  165. package/.docs/reference/processors/processor-interface.md +12 -12
  166. package/.docs/reference/processors/prompt-injection-detector.md +1 -1
  167. package/.docs/reference/processors/provider-history-compat.md +1 -1
  168. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  169. package/.docs/reference/processors/response-cache.md +8 -8
  170. package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
  171. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  172. package/.docs/reference/processors/tool-search-processor.md +7 -7
  173. package/.docs/reference/processors/unicode-normalizer.md +1 -1
  174. package/.docs/reference/project-structure.md +1 -1
  175. package/.docs/reference/pubsub/base.md +4 -4
  176. package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
  177. package/.docs/reference/pubsub/lease-provider.md +4 -4
  178. package/.docs/reference/pubsub/redis-streams.md +1 -1
  179. package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
  180. package/.docs/reference/rag/chunk.md +5 -5
  181. package/.docs/reference/rag/database-config.md +2 -2
  182. package/.docs/reference/rag/metadata-filters.md +2 -2
  183. package/.docs/reference/schedules/overview.md +1 -1
  184. package/.docs/reference/server/register-api-route.md +1 -1
  185. package/.docs/reference/server/routes.md +1 -1
  186. package/.docs/reference/signals/signal-provider.md +8 -8
  187. package/.docs/reference/storage/clickhouse.md +4 -4
  188. package/.docs/reference/storage/cloudflare-d1.md +4 -4
  189. package/.docs/reference/storage/convex.md +4 -4
  190. package/.docs/reference/storage/dsql.md +2 -2
  191. package/.docs/reference/storage/dynamodb.md +7 -7
  192. package/.docs/reference/storage/lance.md +1 -1
  193. package/.docs/reference/storage/mongodb.md +1 -1
  194. package/.docs/reference/storage/mssql.md +1 -1
  195. package/.docs/reference/storage/postgresql.md +1 -1
  196. package/.docs/reference/storage/retention.md +33 -33
  197. package/.docs/reference/storage/spanner.md +8 -8
  198. package/.docs/reference/streaming/ChunkType.md +2 -2
  199. package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
  200. package/.docs/reference/streaming/agents/stream.md +1 -1
  201. package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
  202. package/.docs/reference/streaming/workflows/observeStream.md +1 -1
  203. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  204. package/.docs/reference/streaming/workflows/stream.md +1 -1
  205. package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
  206. package/.docs/reference/templates/overview.md +1 -1
  207. package/.docs/reference/tools/brightdata.md +1 -1
  208. package/.docs/reference/tools/create-tool.md +1 -1
  209. package/.docs/reference/tools/graph-rag-tool.md +1 -1
  210. package/.docs/reference/tools/mcp-client.md +13 -13
  211. package/.docs/reference/tools/mcp-server.md +20 -20
  212. package/.docs/reference/tools/submit-plan-tool.md +1 -1
  213. package/.docs/reference/tools/tavily.md +1 -1
  214. package/.docs/reference/tools/vector-query-tool.md +4 -4
  215. package/.docs/reference/vectors/astra.md +1 -1
  216. package/.docs/reference/vectors/chroma.md +2 -2
  217. package/.docs/reference/vectors/convex.md +2 -2
  218. package/.docs/reference/vectors/couchbase.md +4 -4
  219. package/.docs/reference/vectors/libsql.md +1 -1
  220. package/.docs/reference/vectors/mongodb.md +1 -1
  221. package/.docs/reference/vectors/pg.md +4 -4
  222. package/.docs/reference/vectors/qdrant.md +2 -2
  223. package/.docs/reference/vectors/s3vectors.md +4 -4
  224. package/.docs/reference/vectors/turbopuffer.md +1 -1
  225. package/.docs/reference/voice/aws-nova-sonic.md +1 -1
  226. package/.docs/reference/voice/azure.md +1 -1
  227. package/.docs/reference/voice/google-gemini-live.md +4 -4
  228. package/.docs/reference/voice/inworld-realtime.md +7 -7
  229. package/.docs/reference/voice/livekit.md +13 -13
  230. package/.docs/reference/voice/mistral.md +1 -1
  231. package/.docs/reference/voice/openai-realtime.md +1 -1
  232. package/.docs/reference/voice/sarvam.md +1 -1
  233. package/.docs/reference/voice/voice.addTools.md +1 -1
  234. package/.docs/reference/voice/voice.events.md +1 -1
  235. package/.docs/reference/voice/voice.getSpeakers.md +2 -2
  236. package/.docs/reference/voice/voice.on.md +2 -2
  237. package/.docs/reference/voice/xai-realtime.md +2 -2
  238. package/.docs/reference/workflows/run-methods/cancel.md +1 -1
  239. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  240. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  241. package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
  242. package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
  243. package/.docs/reference/workflows/workflow-state-reader.md +2 -2
  244. package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
  245. package/.docs/reference/workspace/daytona-sandbox.md +3 -3
  246. package/.docs/reference/workspace/docker-sandbox.md +2 -2
  247. package/.docs/reference/workspace/e2b-sandbox.md +2 -2
  248. package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
  249. package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
  250. package/.docs/reference/workspace/local-filesystem.md +2 -2
  251. package/.docs/reference/workspace/local-sandbox.md +2 -2
  252. package/.docs/reference/workspace/modal-sandbox.md +1 -1
  253. package/.docs/reference/workspace/platform-filesystem.md +3 -3
  254. package/.docs/reference/workspace/platform-sandbox.md +2 -2
  255. package/.docs/reference/workspace/process-manager.md +1 -1
  256. package/.docs/reference/workspace/railway-sandbox.md +4 -4
  257. package/.docs/reference/workspace/s3-filesystem.md +1 -1
  258. package/.docs/reference/workspace/sandbox.md +1 -1
  259. package/.docs/reference/workspace/vercel-sandbox.md +1 -1
  260. package/.docs/reference/workspace/workspace-class.md +10 -10
  261. package/CHANGELOG.md +14 -0
  262. package/package.json +6 -6
@@ -4,9 +4,9 @@
4
4
 
5
5
  Storage grows without bound by default. Retention is an opt-in, age-based cleanup system: you declare per-table `maxAge` policies in the `retention` config, then call `storage.prune()` to delete rows older than their configured age. Anything you don't configure is kept forever, so there is no behavior change until you opt in.
6
6
 
7
- `prune()` deletes rows. It caps growth and is safe to run against large tables (batched, bounded, resumable, cancellable). It never reclaims disk on SQLite/libSQL the freed pages are reused by future writes so the file stops growing, but handing disk back to the OS (for example a `VACUUM`) is left to the underlying database and the operator to manage.
7
+ `prune()` deletes rows. It caps growth and is safe to run against large tables (batched, bounded, resumable, cancellable). It never reclaims disk: on SQLite/libSQL the freed pages are reused by future writes so the file stops growing, but handing disk back to the OS (for example a `VACUUM`) is left to the underlying database and the operator to manage.
8
8
 
9
- Retention covers **growth tables** only tables that accumulate rows unbounded as a side effect of normal operation (conversation history, telemetry, job and run records, schedule fire history, event feeds). User-authored artifacts and config (agents, skills, workspaces, prompt blocks, datasets, schedule definitions, channel installations, and so on) grow with user intent and are edited or deleted explicitly, so they're not valid retention keys.
9
+ Retention covers **growth tables** only: tables that accumulate rows unbounded as a side effect of normal operation (conversation history, telemetry, job and run records, schedule fire history, event feeds). User-authored artifacts and config (agents, skills, workspaces, prompt blocks, datasets, schedule definitions, channel installations, and so on) grow with user intent and are edited or deleted explicitly, so they're not valid retention keys.
10
10
 
11
11
  The reference implementations are [libSQL](https://mastra.ai/reference/storage/libsql), [PostgreSQL](https://mastra.ai/reference/storage/postgresql), and [MongoDB](https://mastra.ai/reference/storage/mongodb). Other adapters keep rows forever until they implement retention.
12
12
 
@@ -31,7 +31,7 @@ const storage = new LibSQLStore({
31
31
  },
32
32
  })
33
33
 
34
- // Wire this to your own cron/scheduler Mastra never runs it for you.
34
+ // Wire this to your own cron/scheduler: Mastra never runs it for you.
35
35
  const results = await storage.prune()
36
36
  ```
37
37
 
@@ -65,35 +65,35 @@ Set the `retention` field on the store config.
65
65
 
66
66
  ### Retention-eligible tables
67
67
 
68
- Each domain declares which of its tables can be age-pruned and which timestamp column anchors the comparison. The anchor is chosen so `maxAge` means what you'd expect for that data: creation time for append-only logs, last activity for live state, and completion time for jobs and runs (so in-flight work is never pruned).
69
-
70
- | Domain | Table key | Anchor column | `maxAge` measures |
71
- | ----------------- | ------------------ | ---------------- | ----------------------------------------------------------------- |
72
- | `memory` | `threads` | `createdAt` | Thread age |
73
- | `memory` | `messages` | `createdAt` | Message age |
74
- | `memory` | `resources` | `createdAt` | Resource age |
75
- | `threadState` | `threadState` | `updatedAt` | Inactivity state for still-active threads survives |
76
- | `observability` | `spans` | `startedAt` | Span age |
77
- | `observability` | `metrics` | `timestamp` | Metric event age (v-next only) |
78
- | `observability` | `logs` | `timestamp` | Log event age (v-next only) |
79
- | `observability` | `scores` | `timestamp` | Score event age (v-next only) |
80
- | `observability` | `feedback` | `timestamp` | Feedback event age (v-next only) |
81
- | `scores` | `scorers` | `createdAt` | Score record age |
82
- | `workflows` | `workflowSnapshot` | `updatedAt` | Inactivity suspended or long-running workflows survive |
83
- | `backgroundTasks` | `backgroundTasks` | `completedAt` | Time since completion in-flight tasks (`NULL`) are never pruned |
84
- | `experiments` | `experiments` | `completedAt` | Time since completion running experiments are never pruned |
85
- | `notifications` | `notifications` | `createdAt` | Notification age |
86
- | `harness` | `sessions` | `createdAt` | Session record age |
87
- | `schedules` | `triggers` | `actual_fire_at` | Fire-history age (epoch-ms column) |
68
+ Each domain declares which of its tables can be age-pruned and which timestamp column anchors the comparison. The anchor is chosen so `maxAge` means what you'd expect for that data. Append-only logs use creation time, and live state uses last activity. Jobs and runs use completion time, so in-flight work is never pruned.
69
+
70
+ | Domain | Table key | Anchor column | `maxAge` measures |
71
+ | ----------------- | ------------------ | ---------------- | ---------------------------------------------------------------- |
72
+ | `memory` | `threads` | `createdAt` | Thread age |
73
+ | `memory` | `messages` | `createdAt` | Message age |
74
+ | `memory` | `resources` | `createdAt` | Resource age |
75
+ | `threadState` | `threadState` | `updatedAt` | Inactivity: state for still-active threads survives |
76
+ | `observability` | `spans` | `startedAt` | Span age |
77
+ | `observability` | `metrics` | `timestamp` | Metric event age (v-next only) |
78
+ | `observability` | `logs` | `timestamp` | Log event age (v-next only) |
79
+ | `observability` | `scores` | `timestamp` | Score event age (v-next only) |
80
+ | `observability` | `feedback` | `timestamp` | Feedback event age (v-next only) |
81
+ | `scores` | `scorers` | `createdAt` | Score record age |
82
+ | `workflows` | `workflowSnapshot` | `updatedAt` | Inactivity, suspended or long-running workflows survive |
83
+ | `backgroundTasks` | `backgroundTasks` | `completedAt` | Time since completion, in-flight tasks (`NULL`) are never pruned |
84
+ | `experiments` | `experiments` | `completedAt` | Time since completion, running experiments are never pruned |
85
+ | `notifications` | `notifications` | `createdAt` | Notification age |
86
+ | `harness` | `sessions` | `createdAt` | Session record age |
87
+ | `schedules` | `triggers` | `actual_fire_at` | Fire-history age (epoch-ms column) |
88
88
 
89
89
  > **Note:**
90
90
  >
91
91
  > - The memory `observational_memory` table has no timestamp anchor, so it can't be age-pruned and isn't a valid retention key.
92
92
  > - Experiments prune as whole units: an aged experiment's result rows are deleted together with it (results cascade with their parent), so a run is never left partially deleted. Retention doesn't have a separate `results` key.
93
- > - For `schedules`, the growth table is the fire history (`schedule_triggers`, one row per fire) schedule definitions are config and aren't pruned.
93
+ > - For `schedules`, the growth table is the fire history (`schedule_triggers`, one row per fire): schedule definitions are config and aren't pruned.
94
94
  > - On PostgreSQL, timestamp anchors use the timezone-aware mirror columns (for example `createdAtZ`, `completedAtZ`).
95
95
  > - LibSQL supports all domains above; PostgreSQL and MongoDB support all except `threadState` and `harness`, which they don't implement.
96
- > - The v-next PostgreSQL observability domain stores signal events in day-partitioned tables (`spans`, `metrics`, `logs`, `scores`, `feedback`). For it, `prune()` drops whole day partitions (or TimescaleDB chunks) that are entirely older than the cutoff instead of deleting rows effective granularity is one day, and a partition is only dropped once its entire day is past `maxAge`. `PruneResult.deleted` reports the number of rows in the dropped partitions.
96
+ > - The v-next PostgreSQL observability domain stores signal events in day-partitioned tables (`spans`, `metrics`, `logs`, `scores`, `feedback`). For it, `prune()` drops whole day partitions (or TimescaleDB chunks) that are entirely older than the cutoff instead of deleting rows: effective level of detail is one day, and a partition is only dropped once its entire day is past `maxAge`. `PruneResult.deleted` reports the number of rows in the dropped partitions.
97
97
 
98
98
  ## Methods
99
99
 
@@ -103,11 +103,11 @@ Each domain declares which of its tables can be age-pruned and which timestamp c
103
103
 
104
104
  Deletes rows older than their configured `maxAge` across every domain that has a policy in `retention`. Returns one `PruneResult` per table touched. With no `retention` configured it's a no-op returning `[]`.
105
105
 
106
- `prune()` is designed to be safe on tables with millions of rows. It deletes in bounded, batched chunks each batch is its own transaction so it never takes a long lock or bloats the transaction log. It never runs a `VACUUM`.
106
+ `prune()` is designed to be safe on tables with millions of rows. It deletes in bounded, batched chunks (each batch is its own transaction) so it never takes a long lock or bloats the transaction log. It never runs a `VACUUM`.
107
107
 
108
- Pass `options.retention` to replace the configured policies for that call only for example to skip a domain (keep chat history) or prune more aggressively than the standing config. The store's configured `retention` is unchanged.
108
+ Pass `options.retention` to replace the configured policies for that call only: for example to skip a domain (keep chat history) or prune more aggressively than the standing config. The store's configured `retention` is unchanged.
109
109
 
110
- Anchor-column indexes are created lazily on the first `prune()` call for each table with a policy never at `init()` so deployments that don't configure retention pay no extra index write or disk overhead. The first prune of an existing large table pays a one-time index build; subsequent prunes reuse the index.
110
+ Anchor-column indexes are created lazily on the first `prune()` call for each table with a policy (never at `init()`) so deployments that don't configure retention pay no extra index write or disk overhead. The first prune of an existing large table pays a one-time index build. Subsequent prunes reuse the index.
111
111
 
112
112
  ```typescript
113
113
  const results = await storage.prune({
@@ -156,7 +156,7 @@ interface PruneResult {
156
156
 
157
157
  ## Running prune on a schedule
158
158
 
159
- `prune()` has no built-in scheduler you decide when it runs. Because it's bounded, a single call may not delete everything. When any result has `done: false`, eligible rows remain and you call again on the next tick. This keeps each invocation short and lets a large backlog drain over several runs.
159
+ `prune()` has no built-in scheduler: you decide when it runs. Because it's bounded, a single call may not delete everything. When any result has `done: false`, eligible rows remain and you call again on the next tick. This keeps each invocation short and lets a large backlog drain over several runs.
160
160
 
161
161
  ```typescript
162
162
  // Runs on your own cron (node-cron, a workflow schedule, an external job, etc.).
@@ -173,7 +173,7 @@ async function retentionTick() {
173
173
  }
174
174
  ```
175
175
 
176
- You can also cancel a long-running prune with an `AbortSignal` the loop stops between batches and returns partial results with `done: false`, so the next run resumes cleanly.
176
+ You can also cancel a long-running prune with an `AbortSignal`: the loop stops between batches and returns partial results with `done: false`, so the next run resumes cleanly.
177
177
 
178
178
  ## MongoDB TTL indexes (alternative to prune)
179
179
 
@@ -192,7 +192,7 @@ MongoDB offers native [TTL (Time-To-Live) indexes](https://www.mongodb.com/docs/
192
192
  > - You need resumable, cancellable cleanup operations
193
193
  > - You're using composite storage with multiple databases
194
194
  >
195
- > Both approaches are valid. TTL is simpler; `prune()` gives more control.
195
+ > Both approaches are valid. TTL is simpler. `prune()` gives more control.
196
196
 
197
197
  ### Setting up TTL indexes on MongoDB
198
198
 
@@ -232,9 +232,9 @@ const storage = new MongoDBStore({
232
232
 
233
233
  ## Reclaiming disk
234
234
 
235
- `prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing for most users this alone solves the unbounded-growth problem.
235
+ `prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing: for most users this alone solves the unbounded-growth problem.
236
236
 
237
- Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself, in a maintenance window a full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically; a manual `VACUUM FULL` is only needed if you must return disk to the OS.
237
+ Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically; a manual `VACUUM FULL` is only needed if you must return disk to the OS.
238
238
 
239
239
  For MongoDB, deleted documents are reused by future insertions. To reclaim disk space, run [`db.runCommand({ compact: "collection_name" })`](https://www.mongodb.com/docs/manual/reference/command/compact/) during a maintenance window.
240
240
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Google Cloud Spanner storage
4
4
 
5
- The Google Cloud Spanner storage implementation provides a horizontally scalable, strongly consistent storage backend for Mastra. It targets the GoogleSQL dialect of Cloud Spanner.
5
+ The Google Cloud Spanner storage implementation provides a horizontally high-capacity, strongly consistent storage backend for Mastra. It targets the GoogleSQL dialect of Cloud Spanner.
6
6
 
7
7
  ## Installation
8
8
 
@@ -133,14 +133,14 @@ The storage adapter creates the following tables, all using the GoogleSQL dialec
133
133
 
134
134
  Tables are created with `STRING(MAX)` for text and JSON payloads, `INT64`, `FLOAT64`, `BOOL`, and `TIMESTAMP`.
135
135
 
136
- Two tables also carry Spanner-specific `STORED` generated columns that the adapter populates from JSON payloads so common filters can use a regular secondary index instead of a `JSON_VALUE` scan:
136
+ The following tables carry Spanner-specific `STORED` generated columns that the adapter populates from JSON payloads so common filters can use a regular secondary index instead of a `JSON_VALUE` scan:
137
137
 
138
- - `mastra_workflow_snapshot.snapshotStatus` extracts `$.status` from `snapshot`; backs `listWorkflowRuns({ status })`.
139
- - `mastra_schedules.target_workflow_id` extracts `$.workflowId` from `target`; backs `listSchedules({ workflowId })`.
138
+ - `mastra_workflow_snapshot.snapshotStatus`: Extracts `$.status` from `snapshot`. Backs `listWorkflowRuns({ status })`.
139
+ - `mastra_schedules.target_workflow_id`: Extracts `$.workflowId` from `target`. Backs `listSchedules({ workflowId })`.
140
140
 
141
141
  Both are added via `ALTER TABLE ... ADD COLUMN IF NOT EXISTS` during `init()` and skipped under `initMode: 'validate'` (where the schema is owned externally). When the column is absent, the adapter falls back to a `JSON_VALUE` filter at runtime.
142
142
 
143
- The adapter doesn't create or use named schemas; use a dedicated database for isolation.
143
+ The adapter doesn't create or use schemas. Use a dedicated database for isolation.
144
144
 
145
145
  ### Initialization
146
146
 
@@ -184,11 +184,11 @@ const thread = await memory?.getThreadById({ threadId: '...' })
184
184
  A few behaviors differ from other relational adapters:
185
185
 
186
186
  - Upserts use `INSERT OR UPDATE`. Spanner doesn't provide a `RETURNING` clause for upserts, so callers needing the post-write state must read it back.
187
- - No `TRUNCATE` exists; `dangerouslyClearAll()` issues `DELETE WHERE TRUE`.
187
+ - No `TRUNCATE` exists. `dangerouslyClearAll()` issues `DELETE WHERE TRUE`.
188
188
  - Identifiers are quoted with backticks.
189
189
  - DDL is applied through `database.updateSchema(...)`, which is asynchronous (long-running operation).
190
190
  - `NULLS FIRST/LAST` isn't supported. Ordering with NULL handling is emulated through an `IS NULL` ordering key.
191
- - JSON containment isn't supported natively. `listTraces` `metadata` and `scope` filters compile to per-key `JSON_VALUE(...) = @v` equality checks, and `tags` filters compile to `EXISTS` over `JSON_QUERY_ARRAY(...)`. This differs from Postgres' `@>` containment operator (which can match nested structure in a single index scan) most one-shot lookups still work but deeply nested structural matches aren't expressible.
191
+ - JSON containment isn't supported natively. `listTraces` `metadata` and `scope` filters compile to per-key `JSON_VALUE(...) = @v` equality checks, and `tags` filters compile to `EXISTS` over `JSON_QUERY_ARRAY(...)`. This differs from Postgres' `@>` containment operator (which can match nested structure in a single index scan): most one-shot lookups still work but deeply nested structural matches aren't expressible.
192
192
 
193
193
  ### Direct database access
194
194
 
@@ -217,4 +217,4 @@ gcloud spanner instances create test-instance --config=emulator-config --nodes=1
217
217
  gcloud spanner databases create test-db --instance=test-instance
218
218
  ```
219
219
 
220
- Then connect with the same env var set in your Node.js process; the `@google-cloud/spanner` client detects the emulator automatically.
220
+ Then connect with the same env var set in your Node.js process. The `@google-cloud/spanner` client detects the emulator automatically.
@@ -522,9 +522,9 @@ Emitted when the task throws or times out. Triggers a continuation turn when con
522
522
 
523
523
  ### background-task-suspended
524
524
 
525
- Emitted when a tool calls `suspend()` from inside its background execution. Pauses the task's workflow run with its snapshot persisted; resume with `mastra.backgroundTaskManager.resume(taskId, resumeData)`.
525
+ Emitted when a tool calls `suspend()` from inside its background execution. Pauses the task's workflow run with its snapshot persisted. Resume with `mastra.backgroundTaskManager.resume(taskId, resumeData)`.
526
526
 
527
- When consumed by [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle), this chunk drops the task from the loop's wait set without queuing a continuation the agent's response ends, and the resumed task's eventual completion injects into the message list for the next user turn.
527
+ When consumed by [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle), this chunk drops the task from the loop's wait set without queuing a continuation. The agent's response ends, and the resumed task's eventual completion injects into the message list for the next user turn.
528
528
 
529
529
  **type** (`"background-task-suspended"`): Chunk type identifier
530
530
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # MastraModelOutput
4
4
 
5
- The `MastraModelOutput` class is returned by [.stream()](https://mastra.ai/reference/streaming/agents/stream) and provides both streaming and promise-based access to model outputs. It supports structured output generation, tool calls, reasoning, and comprehensive usage tracking.
5
+ The `MastraModelOutput` class is returned by [.stream()](https://mastra.ai/reference/streaming/agents/stream) and provides both streaming and promise-based access to model outputs. It supports structured output generation, tool calls, reasoning, and detailed usage tracking.
6
6
 
7
7
  ```typescript
8
8
  // MastraModelOutput is returned by agent.stream()
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Agent.stream()
4
4
 
5
- The `.stream()` method enables real-time streaming of responses from an agent with enhanced capabilities and format flexibility. This method accepts messages and optional streaming options, providing a next-generation streaming experience with support for both Mastra's native format and AI SDK v5+ compatibility.
5
+ The `.stream()` method enables real-time streaming of responses from an agent with enhanced capabilities and format flexibility. This method accepts messages and optional streaming options, providing a current streaming experience with support for both Mastra's native format and AI SDK v5+ compatibility.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -32,7 +32,7 @@ for await (const chunk of stream.fullStream) {
32
32
  }
33
33
  ```
34
34
 
35
- > **Info:** `streamUntilIdle()` requires both a [`BackgroundTaskManager`](https://mastra.ai/reference/configuration) and a [memory](https://mastra.ai/docs/memory/overview) backend. Without either, it falls through to a plain `agent.stream()` call.
35
+ > **Info:** `streamUntilIdle()` requires both a [`BackgroundTaskManager`](https://mastra.ai/reference/configuration) and a [memory](https://mastra.ai/docs/memory/overview) backend. Without either, it uses a plain `agent.stream()` call.
36
36
 
37
37
  ## Parameters
38
38
 
@@ -54,7 +54,7 @@ For every other option (`maxSteps`, `modelSettings`, `toolChoice`, `outputProces
54
54
 
55
55
  ### Aggregate properties caveat
56
56
 
57
- `streamUntilIdle()` returns a proxy over the first turn's `MastraModelOutput`. Only `fullStream` is replaced with a combined stream that spans every continuation. Every other property `text`, `toolCalls`, `toolResults`, `finishReason`, `messageList`, `getFullOutput()` resolves against the **first turn's** internal buffer.
57
+ `streamUntilIdle()` returns a proxy over the first turn's `MastraModelOutput`. Only `fullStream` is replaced with a combined stream that spans every continuation. Every other property (`text`, `toolCalls`, `toolResults`, `finishReason`, `messageList`, and `getFullOutput()`) resolves against the **first turn's** internal buffer.
58
58
 
59
59
  If you need an aggregate view across all continuations, consume `fullStream` yourself and accumulate.
60
60
 
@@ -28,7 +28,7 @@ for await (const chunk of stream) {
28
28
 
29
29
  ## Stream events
30
30
 
31
- The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
31
+ The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
32
32
 
33
33
  - **`workflow-start`**: Workflow execution begins
34
34
  - **`workflow-step-start`**: A step begins execution
@@ -60,7 +60,7 @@ if (result!.status === 'suspended') {
60
60
 
61
61
  ## Stream events
62
62
 
63
- The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
63
+ The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
64
64
 
65
65
  - **`workflow-start`**: Workflow execution begins
66
66
  - **`workflow-step-start`**: A step begins execution
@@ -86,7 +86,7 @@ console.log('Status:', stream.status)
86
86
 
87
87
  ## Stream events
88
88
 
89
- The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
89
+ The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
90
90
 
91
91
  - **`workflow-start`**: Workflow execution begins
92
92
  - **`workflow-step-start`**: A step begins execution
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Run.timeTravelStream()
4
4
 
5
- The `.timeTravelStream()` method re-executes a workflow starting from any specific step with streaming events. This allows you to receive real-time updates during time travel execution while maintaining full visibility into each step's progress.
5
+ The `.timeTravelStream()` method re-executes a workflow starting from any specific step with streaming events. You can receive real-time updates during time travel execution while maintaining full visibility into each step's progress.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -39,7 +39,7 @@ All parameters are the same as [`Run.timeTravel()`](https://mastra.ai/reference/
39
39
 
40
40
  ## Stream events
41
41
 
42
- The stream emits various workflow events during execution:
42
+ The stream emits workflow events during execution:
43
43
 
44
44
  - `workflow-step-start`: Emitted when a step begins execution
45
45
  - `workflow-step-finish`: Emitted when a step completes successfully
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Overview
4
4
 
5
- This reference provides comprehensive information about Mastra templates, including how to use existing templates, create your own, and contribute to the community ecosystem.
5
+ This reference explains how to use existing Mastra templates and create your own. It also covers contributing templates to the community ecosystem.
6
6
 
7
7
  Mastra templates are pre-built project structures that demonstrate specific use cases and patterns. They provide:
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Bright Data tools
4
4
 
5
- The `@mastra/brightdata` package wraps the [Bright Data SDK](https://github.com/brightdata/bright-data-sdk-node) as Mastra-compatible tools. It exposes factory functions for web search and web fetch each returning a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
5
+ The `@mastra/brightdata` package wraps the [Bright Data SDK](https://github.com/brightdata/bright-data-sdk-node) as Mastra-compatible tools. It exposes factory functions for web search and web fetch. Each function returns a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
6
6
 
7
7
  The search tool is backed by Bright Data's [SERP API](https://brightdata.com/products/serp-api) and the fetch tool by [Web Unlocker](https://brightdata.com/products/web-unlocker). Both bypass bot detection and CAPTCHAs.
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # createTool()
4
4
 
5
- The `createTool()` function is used to define custom tools that your Mastra agents can execute. Tools extend an agent's capabilities by allowing it to interact with external systems, perform calculations, or access specific data.
5
+ The `createTool()` function is used to define custom tools that your Mastra agents can execute. Tools extend an agent's capabilities by allowing it to interact with external systems or perform calculations. They can also access specific data.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -51,7 +51,7 @@ const graphTool = createGraphRAGTool({
51
51
 
52
52
  **graphOptions.restartProb** (`number`): Probability of restarting random walk from query node. (Can be set at creation or overridden at runtime.)
53
53
 
54
- **providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). \*\*Important\*\*: Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
54
+ **providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
55
55
 
56
56
  **vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
57
57
 
@@ -125,7 +125,7 @@ const mcp = new MCPClient({
125
125
  })
126
126
  ```
127
127
 
128
- Per the MCP specification, **clients MUST consider tool annotations to be untrusted unless they come from trusted servers**. Annotations are advisory hints, not a security boundary a malicious or buggy server can claim a tool is read-only when it isn't. Only use annotations to relax approval requirements for servers you trust.
128
+ Per the MCP specification: **clients MUST consider tool annotations to be untrusted unless they come from trusted servers**. Annotations are advisory hints and provide no security boundary. A malicious or buggy server can claim a tool is read-only when it isn't. Only use annotations to relax approval requirements for servers you trust.
129
129
 
130
130
  The same annotations are also exposed on the tools returned by `listTools()` and `listToolsets()` under `tool.mcp.annotations`, so you can inspect them when wiring tools into an agent.
131
131
 
@@ -182,7 +182,7 @@ console.log(errors)
182
182
 
183
183
  ### `listToolsets()`
184
184
 
185
- Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed dynamically into the generate or stream method.
185
+ Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed at runtime into the generate or stream method.
186
186
 
187
187
  ```typescript
188
188
  const res = await agent.stream(prompt, {
@@ -227,9 +227,9 @@ getServerAuthState(serverName: string): 'needs-auth' | 'authorized' | undefined
227
227
 
228
228
  ### `cancelAuthentication()`
229
229
 
230
- Cancels an in-progress `authenticate()` flow for a server, so an abandoned browser authorization does not leave the client waiting indefinitely. It aborts the flow (including its setup phase, before the callback server binds), closes the local callback server if one is listening, and the pending `authenticate()` call rejects. Returns `true` if a flow was cancelled, or `false` when no flow was in progress.
230
+ Cancels an in-progress `authenticate()` flow for a server, so an abandoned browser authorization doesn't leave the client waiting indefinitely. It aborts the flow (including its setup phase, before the callback server binds), closes the local callback server if one is listening, and the pending `authenticate()` call rejects. Returns `true` if a flow was cancelled, or `false` when no flow was in progress.
231
231
 
232
- The resulting `getServerAuthState()` depends on how far the flow had progressed: a flow cancelled after the server rejected the connection with `401` stays at `'needs-auth'` and can be retried immediately, while a flow cancelled during the setup phase — before any connection was attempted — leaves the state unchanged (typically `undefined`).
232
+ The resulting `getServerAuthState()` depends on how far the flow progressed. A flow cancelled after a `401` rejection stays at `'needs-auth'` and can be retried immediately. Cancellation during setup leaves the state unchanged (typically `undefined`) if no connection was attempted.
233
233
 
234
234
  ```typescript
235
235
  async cancelAuthentication(serverName: string): Promise<boolean>
@@ -324,7 +324,7 @@ for (const serverName in templatesByServer) {
324
324
 
325
325
  #### `resources.read(serverName: string, uri: string)`
326
326
 
327
- Reads the content of a specific resource from a named server.
327
+ Reads the content of a specific resource from a server.
328
328
 
329
329
  ```typescript
330
330
  async read(serverName: string, uri: string): Promise<ReadResourceResult>
@@ -342,7 +342,7 @@ console.log('Current weather:', content.contents[0].text)
342
342
 
343
343
  #### `resources.subscribe(serverName: string, uri: string)`
344
344
 
345
- Subscribes to updates for a specific resource on a named server.
345
+ Subscribes to updates for a specific resource on a server.
346
346
 
347
347
  ```typescript
348
348
  async subscribe(serverName: string, uri: string): Promise<object>
@@ -356,7 +356,7 @@ await mcpClient.resources.subscribe('myWeatherServer', 'weather://current')
356
356
 
357
357
  #### `resources.unsubscribe(serverName: string, uri: string)`
358
358
 
359
- Unsubscribes from updates for a specific resource on a named server.
359
+ Unsubscribes from updates for a specific resource on a server.
360
360
 
361
361
  ```typescript
362
362
  async unsubscribe(serverName: string, uri: string): Promise<object>
@@ -388,7 +388,7 @@ mcpClient.resources.onUpdated('myWeatherServer', params => {
388
388
 
389
389
  #### `resources.onListChanged(serverName: string, handler: () => void)`
390
390
 
391
- Sets a notification handler that will be called when the overall list of available resources changes on a specific server.
391
+ Sets a notification handler that will be called when the list of available resources changes on a specific server.
392
392
 
393
393
  ```typescript
394
394
  async onListChanged(serverName: string, handler: () => void): Promise<void>
@@ -847,7 +847,7 @@ Give each server its own `MCPOAuthClientProvider` instance. A provider holds per
847
847
 
848
848
  ### Interactive browser authentication
849
849
 
850
- When a server rejects a connection because authorization is required, the client records a `'needs-auth'` state instead of failing outright. Calling `authenticate()` then completes the flow end to end: it starts a one-shot callback server on the provider's loopback redirect URL (falling back to the next sequential ports when it is in use), lets the SDK run discovery and dynamic client registration, delivers the authorization URL through `onRedirectToAuthorization` open it in the user's browser and finishes the token exchange once the browser returns the authorization code:
850
+ When a server rejects a connection because authorization is required, the client records a `'needs-auth'` state instead of failing outright. Calling `authenticate()` completes the flow. It starts a one-shot callback server on the provider's loopback redirect URL, falling back to the next sequential ports when it's in use. The SDK then performs discovery and client registration at runtime. `onRedirectToAuthorization` receives the authorization URL so your application can open it in the user's browser. The token exchange finishes after the browser returns the authorization code:
851
851
 
852
852
  ```typescript
853
853
  import { MCPClient, MCPOAuthClientProvider } from '@mastra/mcp'
@@ -884,9 +884,9 @@ try {
884
884
  }
885
885
  ```
886
886
 
887
- Concurrent `authenticate()` calls for the same server join the pending flow; different servers authenticate independently. With valid stored tokens the call simply reconnects without opening a browser.
887
+ Concurrent `authenticate()` calls for the same server join the pending flow. Different servers authenticate independently. With valid stored tokens the call reconnects without opening a browser.
888
888
 
889
- Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server, validates the OAuth `state` parameter, and resolves with the code. It creates a plain HTTP server, so it is only for local loopback redirects. Web applications that use an HTTPS redirect URL must host their own callback endpoint and drive the provider directly rather than using this helper:
889
+ Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server, validates the OAuth `state` parameter, and resolves with the code. It creates a plain HTTP server, so it's only for local loopback redirects. Web applications that use an HTTPS redirect URL must host their own callback endpoint and drive the provider directly rather than using this helper:
890
890
 
891
891
  ```typescript
892
892
  import { createOAuthCallbackServer, getCallbackUrlCandidates } from '@mastra/mcp'
@@ -1139,9 +1139,9 @@ MCPClient handles server connections gracefully:
1139
1139
  2. Graceful server shutdown to prevent error messages during development
1140
1140
  3. Proper cleanup of resources when disconnecting
1141
1141
 
1142
- ## Using custom fetch for dynamic authentication
1142
+ ## Using custom fetch for runtime-defined authentication
1143
1143
 
1144
- For HTTP servers, you can provide a custom `fetch` function to handle dynamic authentication, request interception, or other custom behavior. This is particularly useful when you need to refresh tokens on each request or forward user credentials from the incoming request to the MCP server.
1144
+ For HTTP servers, you can provide a custom `fetch` function to handle runtime-defined authentication or request interception. It can also handle other custom behavior. This is particularly useful when you need to refresh tokens on each request or forward user credentials from the incoming request to the MCP server.
1145
1145
 
1146
1146
  The custom `fetch` function receives an optional third `requestContext` parameter, which provides access to request-scoped data (e.g., authentication cookies, bearer tokens) set by middleware or passed during agent/tool execution. The `requestContext` is `null` during the initial connection handshake.
1147
1147
 
@@ -101,20 +101,20 @@ A powerful feature of `MCPServer` is its ability to automatically expose your Ma
101
101
 
102
102
  - **Description**: The generated tool's description will be in the format: "Ask agent `<AgentName>` a question. Original agent instructions: `<agent description>`".
103
103
  - **Input**: The tool expects a single object argument with a `message` property (string): `{ message: "Your question for the agent" }`.
104
- - **Execution**: When this tool is called, it invokes the `generate()` method of the corresponding agent, passing the provided `query`.
104
+ - **Execution**: When this tool is called, it invokes the corresponding agent's `generate()` method with the provided `query`.
105
105
  - **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
106
106
 
107
- - **Name Collisions**: If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., you have a tool named `ask_myAgentKey` and also an agent with the key `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
107
+ - **Name collisions.** If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., a tool named `ask_myAgentKey` alongside an agent keyed as `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
108
108
 
109
109
  This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
110
110
 
111
111
  ### Agent-to-Tool Conversion
112
112
 
113
- When you provide agents in the `agents` configuration property, `MCPServer` will automatically create a corresponding tool for each agent. The tool will be named `ask_<agentIdentifier>`, where `<agentIdentifier>` is the key you used in the `agents` object.
113
+ When you provide agents in the `agents` configuration property, `MCPServer` will automatically create a corresponding tool for each agent. The tool will be `ask_<agentIdentifier>`, where `<agentIdentifier>` is the key you used in the `agents` object.
114
114
 
115
115
  The description for this generated tool will be: "Ask agent `<agent.name>` a question. Agent description: `<agent.description>`".
116
116
 
117
- **Important**: For an agent to be converted into a tool, it **must** have a non-empty `description` string property set in its configuration when it was instantiated (e.g., `new Agent({ id: 'my-agent', name: 'myAgent', description: 'This agent does X.', ... })`). If an agent is passed to `MCPServer` with a missing or empty `description`, an error will be thrown when the `MCPServer` is instantiated, and server setup will fail.
117
+ For an agent to be converted into a tool, it **must** have a non-empty `description` string property set in its configuration when it was instantiated (e.g., `new Agent({ id: 'my-agent', name: 'myAgent', description: 'This agent does X.', ... })`). If an agent is passed to `MCPServer` with a missing or empty `description`, an error will be thrown when the `MCPServer` is instantiated, and server setup will fail.
118
118
 
119
119
  This allows you to quickly expose the generative capabilities of your agents through the MCP, enabling clients to "ask" your agents questions directly.
120
120
 
@@ -412,7 +412,7 @@ serve(async req => {
412
412
  >
413
413
  > This is still stateless: no `mcp-session-id` is required or persisted. It only enables notifications scoped to the current request (such as progress). The session-dependent features below remain unavailable.
414
414
  >
415
- > **Note:** The following MCP features require session state or persistent connections and **won't work** in serverless mode (including with `serverlessStreaming: true`):
415
+ > The following MCP features require session state or persistent connections and **won't work** in serverless mode (including with `serverlessStreaming: true`):
416
416
  >
417
417
  > - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
418
418
  > - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
@@ -439,7 +439,7 @@ The `StreamableHTTPServerTransportOptions` object allows you to customize the be
439
439
 
440
440
  **serverless** (`boolean`): If true, runs in stateless mode without session management. Each request is handled independently with a fresh server instance. Essential for serverless environments (Cloudflare Workers, Supabase Edge Functions, Vercel Edge, etc.) where sessions cannot persist between invocations. Defaults to false.
441
441
 
442
- **serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior. This enables only request-scoped notifications such as progress; elicitation, subscriptions, and out-of-request notifications still require session state.
442
+ **serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior. It enables only request-scoped notifications such as progress; elicitation, subscriptions, and out-of-request notifications still require session state.
443
443
 
444
444
  **sessionIdGenerator** (`(() => string) | undefined`): A function that generates a unique session ID. This should be a cryptographically secure, globally unique string. Return undefined to disable session management.
445
445
 
@@ -459,7 +459,7 @@ async close(): Promise<void>
459
459
 
460
460
  ### `getServerInfo()`
461
461
 
462
- This method gives you a look at the server's basic information.
462
+ The method returns the server's basic information.
463
463
 
464
464
  ```typescript
465
465
  getServerInfo(): ServerInfo
@@ -467,7 +467,7 @@ getServerInfo(): ServerInfo
467
467
 
468
468
  ### `getServerDetail()`
469
469
 
470
- This method gives you a detailed look at the server's information.
470
+ The method returns details about the server's information.
471
471
 
472
472
  ```typescript
473
473
  getServerDetail(): ServerDetail
@@ -475,7 +475,7 @@ getServerDetail(): ServerDetail
475
475
 
476
476
  ### `getToolListInfo()`
477
477
 
478
- This method gives you a look at the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
478
+ The method returns the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
479
479
 
480
480
  ```typescript
481
481
  getToolListInfo(): ToolListInfo
@@ -483,7 +483,7 @@ getToolListInfo(): ToolListInfo
483
483
 
484
484
  ### `getToolInfo()`
485
485
 
486
- This method gives you detailed information about a specific tool.
486
+ The method returns details about a specific tool.
487
487
 
488
488
  ```typescript
489
489
  getToolInfo(toolName: string): ToolInfo
@@ -565,7 +565,7 @@ Resources are identified by unique URIs (e.g., `file:///home/user/documents/repo
565
565
  Clients can discover resources through:
566
566
 
567
567
  1. **Direct resources**: Servers expose a list of concrete resources via a `resources/list` endpoint.
568
- 2. **Resource templates**: For dynamic resources, servers can expose URI templates (RFC 6570) that clients use to construct resource URIs.
568
+ 2. **Resource templates**: For runtime-defined resources, servers can expose URI templates (RFC 6570) that clients use to construct resource URIs.
569
569
 
570
570
  To read a resource, clients make a `resources/read` request with the URI. Servers can also notify clients about changes to the resource list (`notifications/resources/list_changed`) or updates to specific resource content (`notifications/resources/updated`) if a client has subscribed to that resource.
571
571
 
@@ -659,7 +659,7 @@ await serverWithResources.resources.notifyUpdated({ uri: 'file://data.txt' })
659
659
 
660
660
  #### `server.resources.notifyListChanged()`
661
661
 
662
- Call this method when the overall list of available resources has changed (e.g., a resource was added or removed). This will send a `notifications/resources/list_changed` message to clients, prompting them to re-fetch the list of resources.
662
+ Call this method when the list of available resources has changed (e.g., a resource was added or removed). This will send a `notifications/resources/list_changed` message to clients, prompting them to re-fetch the list of resources.
663
663
 
664
664
  ```typescript
665
665
  async server.resources.notifyListChanged(): Promise<void>
@@ -676,9 +676,9 @@ await serverWithResources.resources.notifyListChanged()
676
676
 
677
677
  ### What are MCP Prompts?
678
678
 
679
- Prompts are reusable templates or workflows that MCP servers expose to clients. They can accept arguments, include resource context, support versioning, and be used to standardize LLM interactions.
679
+ Prompts are reusable templates or workflows that MCP servers expose to clients. They can accept arguments and include resource context. They also support versioning and standardize LLM interactions.
680
680
 
681
- Prompts are identified by a unique name (and optional version) and can be dynamic or static.
681
+ Prompts are identified by a unique name (and optional version) and can be runtime-defined or static.
682
682
 
683
683
  ### `MCPServerPrompts` Type
684
684
 
@@ -773,7 +773,7 @@ If the available prompts change, your server can notify connected clients:
773
773
 
774
774
  #### `server.prompts.notifyListChanged()`
775
775
 
776
- Call this method when the overall list of available prompts has changed (e.g., a prompt was added or removed). This will send a `notifications/prompts/list_changed` message to clients, prompting them to re-fetch the list of prompts.
776
+ Call this method when the list of available prompts has changed (e.g., a prompt was added or removed). This will send a `notifications/prompts/list_changed` message to clients, prompting them to re-fetch the list of prompts.
777
777
 
778
778
  ```typescript
779
779
  await serverWithPrompts.prompts.notifyListChanged()
@@ -793,7 +793,7 @@ await serverWithPrompts.prompts.notifyListChanged()
793
793
 
794
794
  Tools are usually provided when constructing the `MCPServer`, but you can also add or remove tools while the server is running. The server exposes these operations through the `toolActions` property. When the tool list changes, connected clients receive a `notifications/tools/list_changed` message prompting them to re-fetch the tool list.
795
795
 
796
- The property is named `toolActions` because `tools()` is the method that returns the registered tool registry.
796
+ The property is `toolActions` because `tools()` is the method that returns the registered tool registry.
797
797
 
798
798
  ### `toolActions.add(tools)`
799
799
 
@@ -821,7 +821,7 @@ await server.toolActions.add({ searchTool })
821
821
 
822
822
  ### `toolActions.remove(toolIds)`
823
823
 
824
- Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored. If no tools were removed, no notification is sent.
824
+ Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored. A notification is sent only when at least one tool is removed.
825
825
 
826
826
  ```typescript
827
827
  async server.toolActions.remove(toolIds: string[]): Promise<void>
@@ -847,7 +847,7 @@ When the server is registered with a Mastra instance, `toolActions.add()` and `t
847
847
 
848
848
  ## Logging
849
849
 
850
- MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request; the server drops messages below the requested minimum level (following RFC 5424 severity ordering). The level is tracked per session, so different clients can request different verbosity.
850
+ MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request. The server drops messages below the requested minimum level (following RFC 5424 severity ordering). The level is tracked per session, so different clients can request different verbosity.
851
851
 
852
852
  ### `sendLoggingMessage()`
853
853
 
@@ -937,7 +937,7 @@ The example at the beginning of this page also demonstrates how to instantiate `
937
937
 
938
938
  ### What's Elicitation?
939
939
 
940
- Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. This enables interactive workflows where servers can collect additional data dynamically.
940
+ Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. It supports interactive workflows where servers can collect additional data at runtime.
941
941
 
942
942
  The `MCPServer` class automatically includes elicitation capabilities. Tools receive a `context.mcp` object in their `execute` function that includes an `elicitation.sendRequest()` method for requesting user input.
943
943
 
@@ -1126,7 +1126,7 @@ execute: async (inputData, context) => {
1126
1126
  }
1127
1127
  ```
1128
1128
 
1129
- Note that elicitation is **session-aware** when using HTTP-based transports (SSE or HTTP). This means that when multiple clients are connected to the same server, elicitation requests are routed to the correct client session that initiated the tool execution.
1129
+ Elicitation is **session-aware** when using HTTP-based transports (SSE or HTTP). When multiple clients are connected to the same server, elicitation requests are routed to the client session that initiated the tool execution.
1130
1130
 
1131
1131
  The `ElicitResult` type:
1132
1132