@mastra/mcp-docs-server 1.3.12 → 1.3.13-alpha.10

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 (240) hide show
  1. package/.docs/docs/agents/resumable-streams.md +140 -0
  2. package/.docs/docs/agents/tools.md +3 -2
  3. package/.docs/docs/auth/overview.md +1 -0
  4. package/.docs/docs/auth/simple-auth.md +8 -8
  5. package/.docs/docs/channels.md +34 -1
  6. package/.docs/docs/connections/mcp.md +73 -7
  7. package/.docs/docs/deployment/mastra-server.md +10 -2
  8. package/.docs/docs/deployment/workers.md +3 -1
  9. package/.docs/docs/guides/authentication-identity.md +4 -0
  10. package/.docs/docs/harness/background-tasks.md +2 -1
  11. package/.docs/docs/harness/durable-agents.md +106 -8
  12. package/.docs/docs/harness/goals.md +1 -1
  13. package/.docs/docs/harness/schedules.md +2 -0
  14. package/.docs/docs/knowledge/agents-and-tools.md +122 -0
  15. package/.docs/docs/knowledge/load-your-content.md +86 -0
  16. package/.docs/docs/knowledge/overview.md +106 -0
  17. package/.docs/docs/knowledge/patterns.md +167 -0
  18. package/.docs/docs/knowledge/pinned-context.md +177 -0
  19. package/.docs/docs/knowledge/scopes-and-access.md +202 -0
  20. package/.docs/docs/knowledge/search.md +63 -0
  21. package/.docs/docs/mastra-platform/connect.md +231 -0
  22. package/.docs/docs/mastra-platform/overview.md +1 -1
  23. package/.docs/docs/memory/observational-memory.md +23 -23
  24. package/.docs/docs/memory/overview.md +19 -7
  25. package/.docs/docs/memory/semantic-recall.md +26 -1
  26. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +41 -0
  27. package/.docs/docs/observability/tracing/overview.md +0 -2
  28. package/.docs/docs/sandbox/skills.md +32 -3
  29. package/.docs/docs/server/custom-adapters.md +44 -11
  30. package/.docs/docs/server/middleware.md +1 -1
  31. package/.docs/docs/server/request-context.md +6 -6
  32. package/.docs/docs/server/server-adapters.md +12 -12
  33. package/.docs/docs/signals/sending-signals.md +3 -1
  34. package/.docs/docs/studio/knowledge.md +45 -24
  35. package/.docs/docs/studio/overview.md +3 -1
  36. package/.docs/docs/workflows/overview.md +12 -0
  37. package/.docs/docs/workflows/suspend-and-resume.md +1 -1
  38. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +46 -0
  39. package/.docs/integrations/auth/clerk.md +46 -7
  40. package/.docs/integrations/auth/neon.md +217 -0
  41. package/.docs/integrations/auth/supabase.md +46 -7
  42. package/.docs/integrations/auth/workos.md +54 -15
  43. package/.docs/integrations/channels/discord.md +84 -6
  44. package/.docs/integrations/channels/github.md +63 -24
  45. package/.docs/integrations/channels/slack.md +89 -8
  46. package/.docs/integrations/channels/teams.md +79 -5
  47. package/.docs/integrations/channels/telegram.md +47 -6
  48. package/.docs/integrations/crm/attio.md +42 -0
  49. package/.docs/integrations/crm/clay.md +42 -0
  50. package/.docs/integrations/crm/hubspot.md +41 -0
  51. package/.docs/integrations/databases/neon.md +37 -1
  52. package/.docs/integrations/databases/postgresql.md +46 -0
  53. package/.docs/integrations/deploy/render.md +59 -18
  54. package/.docs/integrations/deploy/temporal.md +74 -0
  55. package/.docs/integrations/documents/google-docs.md +41 -0
  56. package/.docs/integrations/documents/google-sheet.md +41 -0
  57. package/.docs/integrations/documents/microsoft-excel.md +43 -0
  58. package/.docs/integrations/documents/microsoft-powerpoint.md +41 -0
  59. package/.docs/integrations/documents/microsoft-word.md +41 -0
  60. package/.docs/integrations/documents/notion.md +41 -0
  61. package/.docs/integrations/documents/one-drive.md +41 -0
  62. package/.docs/integrations/documents/sharepoint-online.md +41 -0
  63. package/.docs/integrations/email-calendar/google-calendar.md +41 -0
  64. package/.docs/integrations/email-calendar/google-mail.md +41 -0
  65. package/.docs/integrations/email-calendar/outlook.md +41 -0
  66. package/.docs/integrations/file-storage/amazon-s3.md +1 -1
  67. package/.docs/integrations/file-storage/google-drive.md +54 -15
  68. package/.docs/integrations/observability/arize.md +1 -1
  69. package/.docs/integrations/observability/posthog.md +50 -11
  70. package/.docs/integrations/other/canva.md +42 -0
  71. package/.docs/integrations/other/fireflies.md +41 -0
  72. package/.docs/integrations/other/incident-io.md +41 -0
  73. package/.docs/integrations/other/resend.md +43 -0
  74. package/.docs/integrations/other/robinhood.md +44 -0
  75. package/.docs/integrations/other/sanity.md +42 -0
  76. package/.docs/integrations/other/snowflake.md +41 -0
  77. package/.docs/integrations/project-management/jira.md +41 -0
  78. package/.docs/integrations/project-management/linear.md +41 -0
  79. package/.docs/integrations/sandboxes/e2b.md +1 -1
  80. package/.docs/integrations/voice/openai.md +40 -0
  81. package/.docs/integrations.md +40 -1
  82. package/.docs/models/environment-variables.md +1 -1
  83. package/.docs/models/gateways/azure-openai.md +61 -2
  84. package/.docs/models/gateways/custom-gateways.md +2 -0
  85. package/.docs/models/gateways/merge-gateway.md +3 -1
  86. package/.docs/models/gateways/netlify.md +13 -7
  87. package/.docs/models/gateways/openrouter.md +13 -12
  88. package/.docs/models/gateways/requesty.md +221 -0
  89. package/.docs/models/gateways/vercel.md +423 -419
  90. package/.docs/models/gateways.md +7 -1
  91. package/.docs/models/index.md +46 -3
  92. package/.docs/models/providers/aiand.md +1 -1
  93. package/.docs/models/providers/aihubmix.md +2 -0
  94. package/.docs/models/providers/amazon-bedrock.md +4 -0
  95. package/.docs/models/providers/anthropic.md +2 -1
  96. package/.docs/models/providers/azure.md +4 -0
  97. package/.docs/models/providers/baseten.md +2 -1
  98. package/.docs/models/providers/chutes.md +6 -4
  99. package/.docs/models/providers/cloudflare-ai-gateway.md +2 -0
  100. package/.docs/models/providers/cloudflare-workers-ai.md +0 -13
  101. package/.docs/models/providers/cohere.md +2 -0
  102. package/.docs/models/providers/crossmodel.md +5 -1
  103. package/.docs/models/providers/deepinfra.md +2 -1
  104. package/.docs/models/providers/edenai.md +12 -13
  105. package/.docs/models/providers/empiriolabs.md +3 -3
  106. package/.docs/models/providers/fireworks-ai.md +30 -28
  107. package/.docs/models/providers/google-vertex.md +2 -0
  108. package/.docs/models/providers/google.md +4 -3
  109. package/.docs/models/providers/hyper.md +8 -14
  110. package/.docs/models/providers/inceptron.md +3 -3
  111. package/.docs/models/providers/kilo.md +36 -40
  112. package/.docs/models/providers/llmgateway-providers.md +448 -423
  113. package/.docs/models/providers/llmgateway.md +10 -6
  114. package/.docs/models/providers/meta.md +5 -4
  115. package/.docs/models/providers/modular.md +6 -6
  116. package/.docs/models/providers/morph.md +2 -1
  117. package/.docs/models/providers/nano-gpt.md +55 -62
  118. package/.docs/models/providers/novita-ai.md +4 -2
  119. package/.docs/models/providers/ollama-cloud.md +2 -1
  120. package/.docs/models/providers/ollama.md +2 -0
  121. package/.docs/models/providers/opencode-go.md +3 -1
  122. package/.docs/models/providers/opencode.md +11 -5
  123. package/.docs/models/providers/ovhcloud.md +1 -2
  124. package/.docs/models/providers/prime.md +4 -4
  125. package/.docs/models/providers/qvac.md +2 -0
  126. package/.docs/models/providers/tencent-token-plan.md +2 -1
  127. package/.docs/models/providers/tencent-tokenhub.md +2 -1
  128. package/.docs/models/providers/tinfoil.md +4 -3
  129. package/.docs/models/providers/togetherai.md +2 -1
  130. package/.docs/models/providers/wandb.md +6 -5
  131. package/.docs/models/providers.md +0 -1
  132. package/.docs/reference/agent-controller/agent-controller-class.md +4 -2
  133. package/.docs/reference/agent-controller/session.md +1 -1
  134. package/.docs/reference/agents/agent.md +3 -1
  135. package/.docs/reference/agents/channels.md +117 -1
  136. package/.docs/reference/agents/durable-agent.md +42 -29
  137. package/.docs/reference/agents/generate.md +1 -1
  138. package/.docs/reference/agents/getLLM.md +1 -1
  139. package/.docs/reference/agents/getMetadata.md +1 -1
  140. package/.docs/reference/agents/getModel.md +4 -2
  141. package/.docs/reference/agents/getSkill.md +1 -1
  142. package/.docs/reference/agents/listScorers.md +1 -1
  143. package/.docs/reference/agents/listTools.md +1 -1
  144. package/.docs/reference/ai-sdk/chat-route.md +33 -2
  145. package/.docs/reference/auth/better-auth.md +2 -2
  146. package/.docs/reference/auth/neon.md +24 -15
  147. package/.docs/reference/build-with-ai.md +12 -2
  148. package/.docs/reference/channels/slack-provider.md +1 -1
  149. package/.docs/reference/cli/mastra.md +10 -1
  150. package/.docs/reference/client-js/agents.md +4 -4
  151. package/.docs/reference/client-js/observability.md +90 -3
  152. package/.docs/reference/code-sdk/mount-agent-controller.md +5 -1
  153. package/.docs/reference/connect/channels.md +55 -1
  154. package/.docs/reference/connect/credential.md +2 -1
  155. package/.docs/reference/connect/providers.md +5 -3
  156. package/.docs/reference/connect/tools.md +34 -3
  157. package/.docs/reference/core/addDynamicWorkflow.md +1 -1
  158. package/.docs/reference/core/addGateway.md +1 -1
  159. package/.docs/reference/core/getAgent.md +4 -2
  160. package/.docs/reference/core/getEditor.md +1 -1
  161. package/.docs/reference/core/getGateway.md +1 -1
  162. package/.docs/reference/core/getGatewayById.md +14 -1
  163. package/.docs/reference/core/getMemory.md +2 -2
  164. package/.docs/reference/core/getStorage.md +1 -1
  165. package/.docs/reference/core/listMemory.md +3 -3
  166. package/.docs/reference/core/listScorers.md +2 -2
  167. package/.docs/reference/core/listVectors.md +1 -1
  168. package/.docs/reference/core/mastra-class.md +1 -1
  169. package/.docs/reference/evals/completeness.md +0 -1
  170. package/.docs/reference/evals/content-similarity.md +1 -3
  171. package/.docs/reference/evals/create-scorer.md +8 -4
  172. package/.docs/reference/evals/faithfulness.md +1 -1
  173. package/.docs/reference/evals/hallucination.md +2 -2
  174. package/.docs/reference/evals/noise-sensitivity.md +8 -1
  175. package/.docs/reference/evals/scorer-utils.md +1 -1
  176. package/.docs/reference/file-based-agents/tools.md +3 -3
  177. package/.docs/reference/index.md +8 -0
  178. package/.docs/reference/knowledge/knowledge-class.md +296 -0
  179. package/.docs/reference/knowledge/knowledge-memory-scopes.md +78 -0
  180. package/.docs/reference/knowledge/knowledge-tools.md +299 -0
  181. package/.docs/reference/knowledge/limits.md +44 -0
  182. package/.docs/reference/knowledge/scope-declarations.md +275 -0
  183. package/.docs/reference/knowledge/tool-instructions.md +56 -0
  184. package/.docs/reference/logging/pino-logger.md +1 -1
  185. package/.docs/reference/memory/memory-class.md +1 -1
  186. package/.docs/reference/memory/observational-memory.md +9 -7
  187. package/.docs/reference/observability/feedback.md +3 -1
  188. package/.docs/reference/observability/tracing/advanced-queries.md +47 -58
  189. package/.docs/reference/observability/tracing/configuration.md +3 -0
  190. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +33 -0
  191. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +30 -0
  192. package/.docs/reference/observability/tracing/interfaces.md +2 -0
  193. package/.docs/reference/processors/batch-parts-processor.md +0 -2
  194. package/.docs/reference/processors/message-history-processor.md +1 -1
  195. package/.docs/reference/processors/moderation-processor.md +1 -1
  196. package/.docs/reference/processors/processor-interface.md +1 -1
  197. package/.docs/reference/processors/semantic-recall-processor.md +8 -4
  198. package/.docs/reference/processors/skill-search-processor.md +3 -0
  199. package/.docs/reference/processors/skills-processor.md +84 -0
  200. package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
  201. package/.docs/reference/processors/token-limiter-processor.md +1 -1
  202. package/.docs/reference/processors/tool-search-processor.md +1 -1
  203. package/.docs/reference/pubsub/lease-provider.md +4 -2
  204. package/.docs/reference/pubsub/redis-streams.md +3 -1
  205. package/.docs/reference/rag/graph-rag.md +2 -2
  206. package/.docs/reference/rag/rerank.md +1 -1
  207. package/.docs/reference/rag/rerankWithScorer.md +1 -1
  208. package/.docs/reference/schedules/overview.md +3 -3
  209. package/.docs/reference/server/invoke-route.md +86 -0
  210. package/.docs/reference/server/koa-adapter.md +1 -1
  211. package/.docs/reference/server/routes.md +63 -0
  212. package/.docs/reference/streaming/ChunkType.md +3 -1
  213. package/.docs/reference/streaming/agents/MastraModelOutput.md +13 -12
  214. package/.docs/reference/streaming/agents/stream.md +1 -1
  215. package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
  216. package/.docs/reference/tools/mcp-client.md +30 -7
  217. package/.docs/reference/tools/mcp-server.md +6 -2
  218. package/.docs/reference/tools/vector-query-tool.md +3 -3
  219. package/.docs/reference/workers/overview.md +2 -2
  220. package/.docs/reference/workflows/run-methods/resume.md +1 -1
  221. package/.docs/reference/workflows/run-methods/start.md +1 -1
  222. package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
  223. package/.docs/reference/workflows/run.md +1 -1
  224. package/.docs/reference/workflows/workflow.md +2 -0
  225. package/.docs/reference/workspace/factory-sandbox.md +24 -8
  226. package/.docs/reference/workspace/platform-sandbox.md +22 -7
  227. package/.docs/reference/workspace/sandbox.md +1 -1
  228. package/.docs/reference/workspace/workspace-class.md +5 -5
  229. package/dist/index.js +1 -1
  230. package/dist/{src-BDrEqwuY.js → src-CwUXyWAK.js} +3 -3
  231. package/dist/src-CwUXyWAK.js.map +1 -0
  232. package/dist/stdio.js +1 -1
  233. package/dist/tools/embedded-docs.d.ts.map +1 -1
  234. package/package.json +4 -5
  235. package/.docs/docs/mastra-platform/connect/channels.md +0 -165
  236. package/.docs/docs/mastra-platform/connect/overview.md +0 -102
  237. package/.docs/docs/mastra-platform/connect/providers.md +0 -66
  238. package/.docs/docs/mastra-platform/connect/tools.md +0 -151
  239. package/.docs/models/providers/requesty.md +0 -261
  240. package/dist/src-BDrEqwuY.js.map +0 -1
@@ -8,7 +8,7 @@ This page documents generated toolsets for 28 providers (1076 tools in this vers
8
8
 
9
9
  Tool keys are stable identifiers of the form `<provider>_<action>` and are the values accepted by `allowTools` and `disallowTools`. Toolsets are versioned with the package: the exact list depends on the installed `@mastra/connect` version, and this page reflects the version it was generated from.
10
10
 
11
- MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/docs/mastra-platform/connect/providers) for the list and links to each provider's MCP documentation.
11
+ MCP providers ([Attio](https://mastra.ai/integrations/crm/attio), [Canva](https://mastra.ai/integrations/other/canva), [Clay](https://mastra.ai/integrations/crm/clay), [Neon](https://mastra.ai/integrations/databases/neon), [Render](https://mastra.ai/integrations/deploy/render), [Robinhood](https://mastra.ai/integrations/other/robinhood), and [Sanity](https://mastra.ai/integrations/other/sanity)) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/reference/connect/tools) for how `tools()` discovers them.
12
12
 
13
13
  | Provider | Provider ID | Tools |
14
14
  | ----------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
@@ -30,9 +30,9 @@ MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve th
30
30
  | ![](https://cdn.simpleicons.org/microsoftteams?viewbox=auto\&size=28) [Microsoft Teams](#microsoft-teams) | `microsoft-teams` | 25 |
31
31
  | ![](https://app.nango.dev/images/template-logos/microsoft-word.svg) [Microsoft Word](#microsoft-word) | `microsoft-word` | 18 |
32
32
  | ![](https://cdn.simpleicons.org/notion?viewbox=auto\&size=28) [Notion](#notion) | `notion` | 44 |
33
- | [OneDrive](#onedrive) | `one-drive` | 20 |
33
+ | ![](https://app.nango.dev/images/template-logos/one-drive.svg) [OneDrive](#onedrive) | `one-drive` | 20 |
34
34
  | ![](https://svgl.app/library/openai.svg) [OpenAI](#openai) | `openai` | 26 |
35
- | ![](https://cdn.simpleicons.org/microsoftoutlook?viewbox=auto\&size=28) [Microsoft Outlook](#microsoft-outlook) | `outlook` | 30 |
35
+ | ![](https://app.nango.dev/images/template-logos/outlook.svg) [Microsoft Outlook](#microsoft-outlook) | `outlook` | 30 |
36
36
  | ![](https://cdn.simpleicons.org/posthog?viewbox=auto\&size=28) [PostHog](#posthog) | `posthog` | 67 |
37
37
  | ![](https://cdn.simpleicons.org/resend?viewbox=auto\&size=28) [Resend](#resend) | `resend` | 80 |
38
38
  | ![](https://app.nango.dev/images/template-logos/sharepoint-online.svg) [SharePoint Online](#sharepoint-online) | `sharepoint-online` | 53 |
@@ -1010,6 +1010,8 @@ Provider ID: `posthog` · 67 tools
1010
1010
 
1011
1011
  Provider ID: `resend` · 80 tools
1012
1012
 
1013
+ > **Note:** Connect Resend with an API key that has **Full access** permission. A **Sending access** key fails to connect because Mastra checks a new key by listing your domains, which sending access keys can't do.
1014
+
1013
1015
  | Tool | Description |
1014
1016
  | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1015
1017
  | `resend_add_contact_to_segment` | Add a contact to a segment in Resend. |
@@ -21,7 +21,7 @@ export const opsAgent = new Agent({
21
21
 
22
22
  Returns: `ToolsResolver`, a resolver producing a flat tool record keyed by tool key (for example `linear_create_issue`). See [The resolver](#the-resolver).
23
23
 
24
- See [Connect](https://mastra.ai/docs/mastra-platform/connect/overview) to get started and [Tools](https://mastra.ai/docs/mastra-platform/connect/tools) for usage.
24
+ See [Connect](https://mastra.ai/docs/mastra-platform/connect) to get started.
25
25
 
26
26
  ## Parameters
27
27
 
@@ -74,12 +74,16 @@ Each value in the `providers` record form is `true`, `false`, or a `ToolsProvide
74
74
 
75
75
  ### ConnectClientOptions
76
76
 
77
- Every field falls back to an environment variable, so a fully env-configured app can pass nothing.
77
+ Every field except `fetch` and `resourceId` falls back to an environment variable. `fetch` defaults to `globalThis.fetch`, and `resourceId` has no fallback, so a fully env-configured app that doesn't scope calls to a resource can pass nothing.
78
78
 
79
79
  **accessToken** (`string`): Platform access token. Falls back to MASTRA_PLATFORM_ACCESS_TOKEN, then MASTRA_PLATFORM_SECRET_KEY.
80
80
 
81
81
  **orgId** (`string`): Organization ID. Falls back to MASTRA_ORG_ID; sent as the x-organization-id header when present.
82
82
 
83
+ **projectId** (`string`): Project ID, sent as the x-mastra-project-id header so the platform can attribute proxy activity to the project. Falls back to MASTRA_PROJECT_ID; the header is omitted when absent.
84
+
85
+ **resourceId** (`string`): End-user resource key the client acts for, sent as the x-mastra-resource-id header. Connection listings are scoped to global connections plus that resource's connections. Has no environment variable fallback.
86
+
83
87
  **baseUrl** (`string`): Connect API base URL. Falls back to MASTRA_INTEGRATIONS_API_URL, then the regional default from MASTRA_PLATFORM_REGION (us or eu), then https\://integrations.mastra.ai.
84
88
 
85
89
  **fetch** (`typeof globalThis.fetch`): Fetch implementation, for testing or custom transports. Defaults to globalThis.fetch.
@@ -104,7 +108,34 @@ The resolver also exposes methods for manual control:
104
108
 
105
109
  - `refresh()` fetches from the platform immediately, then updates the cache and returns the tool record. Rejects if the platform fetch fails.
106
110
  - `disconnect()` clears the cached snapshots and closes the MCP transports of the state behind this resolver. Resolvers created with identical options share that state, so this disconnects them too. A later resolution rebuilds the state, and already-returned MCP tools reconnect on their next call.
107
- - `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [Tools](https://mastra.ai/docs/mastra-platform/connect/tools).
111
+ - `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [Add tools to an agent](https://mastra.ai/docs/mastra-platform/connect).
112
+
113
+ To filter on something other than tool keys, or on data that options can't express, post-process the resolved record in the agent's `tools` function. Create the resolver once, outside the function, so its cache is shared:
114
+
115
+ ```typescript
116
+ import { Agent } from '@mastra/core/agent'
117
+ import { tools } from '@mastra/connect'
118
+
119
+ const connectTools = tools({ providers: ['linear'] })
120
+ const viewerTools = new Set(['linear_list_issues'])
121
+
122
+ export const opsAgent = new Agent({
123
+ id: 'ops',
124
+ name: 'ops',
125
+ instructions: 'You help the team track work in Linear.',
126
+ model: 'openai/gpt-6-luna',
127
+ tools: async ctx => {
128
+ const all = await connectTools(ctx)
129
+
130
+ if (ctx.requestContext?.get('role') === 'admin') {
131
+ return all
132
+ }
133
+ return Object.fromEntries(Object.entries(all).filter(([key]) => viewerTools.has(key)))
134
+ },
135
+ })
136
+ ```
137
+
138
+ Only the `admin` role gets every tool. Any other or missing role gets the viewer subset. Set `role` in trusted server-side code based on the authenticated user. [Vary tools by channel](https://mastra.ai/reference/connect/channels) applies the same pattern to channel messages.
108
139
 
109
140
  Error handling depends on the cause:
110
141
 
@@ -47,7 +47,7 @@ const result = await run.start({ inputData: { name: 'Ada' } })
47
47
 
48
48
  ## Returns
49
49
 
50
- A promise that resolves once the definition is validated, registered, and persisted.
50
+ A promise that resolves once the definition is validated and registered, and persisted when storage provides a `workflowDefinitions` store.
51
51
 
52
52
  ## Behavior
53
53
 
@@ -23,7 +23,7 @@ mastra.addGateway(new MyCustomGateway())
23
23
 
24
24
  ## Parameters
25
25
 
26
- **gateway** (`MastraModelGateway`): The gateway instance to add
26
+ **gateway** (`MastraModelGatewayInterface`): The gateway instance to add
27
27
 
28
28
  **key** (`string`): Optional registration key. If not provided, uses gateway.getId()
29
29
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Mastra.getAgent()
6
6
 
7
- The `.getAgent()` method is used to retrieve an agent. The method accepts a single `string` parameter for the agent's name.
7
+ The `.getAgent()` method is used to retrieve an agent. The method accepts the agent's name and an optional version selector. Passing a version selector returns a promise.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -16,9 +16,11 @@ mastra.getAgent('testAgent')
16
16
 
17
17
  **name** (`TAgentName extends keyof TAgents`): The name of the agent to retrieve. Must be a valid agent name that exists in the Mastra configuration.
18
18
 
19
+ **version** (`{ versionId: string } | { status?: 'draft' | 'published' }`): Selects a stored version of the agent. When provided, the method returns a promise.
20
+
19
21
  ## Returns
20
22
 
21
- **agent** (`TAgents[TAgentName]`): The agent instance with the specified name. Throws an error if the agent is not found.
23
+ **agent** (`TAgents[TAgentName] | Promise<TAgents[TAgentName]>`): The agent instance with the specified name, or a promise that resolves to it when version is provided. Throws an error if the agent is not found.
22
24
 
23
25
  ## Related
24
26
 
@@ -31,7 +31,7 @@ This method doesn't accept any parameters.
31
31
 
32
32
  ## Returns
33
33
 
34
- **editor** (`MastraEditor | undefined`): The configured editor instance, or undefined if no editor has been configured.
34
+ **editor** (`IMastraEditor | undefined`): The configured editor instance, or undefined if no editor has been configured.
35
35
 
36
36
  ## Related
37
37
 
@@ -27,7 +27,7 @@ console.log(gateway.name) // 'My Custom Gateway'
27
27
 
28
28
  ## Returns
29
29
 
30
- **gateway** (`MastraModelGateway`): The gateway instance
30
+ **gateway** (`MastraModelGatewayInterface`): The gateway instance
31
31
 
32
32
  ## Throws
33
33
 
@@ -34,7 +34,20 @@ console.log(gateway.name) // 'My Custom Gateway'
34
34
 
35
35
  ## Returns
36
36
 
37
- **gateway** (`MastraModelGateway | undefined`): The gateway instance, or undefined if not found
37
+ **gateway** (`MastraModelGatewayInterface`): The gateway instance
38
+
39
+ ## Throws
40
+
41
+ Throws a `MastraError` with ID `MASTRA_GET_GATEWAY_BY_ID_NOT_FOUND` if no registered gateway has the specified ID. Wrap the call in `try`/`catch` when the gateway might not be registered:
42
+
43
+ ```typescript
44
+ let gateway
45
+ try {
46
+ gateway = mastra.getGatewayById('my-custom-gateway')
47
+ } catch {
48
+ // Gateway is not registered
49
+ }
50
+ ```
38
51
 
39
52
  ## Related
40
53
 
@@ -20,11 +20,11 @@ const thread = await memory.createThread({
20
20
 
21
21
  ## Parameters
22
22
 
23
- **key** (`TMemoryKey extends keyof TMemory`): The registry key of the memory instance to retrieve. Must match a key used when registering memory in the Mastra constructor.
23
+ **name** (`TMemoryName extends keyof TMemory`): The registry key of the memory instance to retrieve. Must match a key used when registering memory in the Mastra constructor.
24
24
 
25
25
  ## Returns
26
26
 
27
- **memory** (`TMemory[TMemoryKey]`): The memory instance with the specified key. Throws an error if the memory is not found.
27
+ **memory** (`TMemory[TMemoryName]`): The memory instance with the specified key. Throws an error if the memory is not found.
28
28
 
29
29
  ## Example: Registering and retrieving memory
30
30
 
@@ -18,7 +18,7 @@ This method doesn't accept any parameters.
18
18
 
19
19
  ## Returns
20
20
 
21
- **storage** (`MastraCompositeStore | undefined`): The configured storage instance, or undefined if no storage has been configured.
21
+ **storage** (`MastraCompositeStore | undefined`): The configured storage instance. When no storage is configured, Mastra uses a default InMemoryStore, which this method returns.
22
22
 
23
23
  ## Related
24
24
 
@@ -9,7 +9,7 @@ The `.listMemory()` method returns all memory instances registered with the Mast
9
9
  ## Usage example
10
10
 
11
11
  ```typescript
12
- const memoryInstances = mastra.listMemory()
12
+ const memoryInstances = mastra.listMemory() ?? {}
13
13
 
14
14
  for (const [key, memory] of Object.entries(memoryInstances)) {
15
15
  console.log(`Memory "${key}": ${memory.id}`)
@@ -22,7 +22,7 @@ This method takes no parameters.
22
22
 
23
23
  ## Returns
24
24
 
25
- **memory** (`Record<string, MastraMemory>`): An object containing all registered memory instances, keyed by their registry keys.
25
+ **memory** (`Record<string, MastraMemory> | undefined`): An object containing all registered memory instances, keyed by their registry keys.
26
26
 
27
27
  ## Example: Checking registered memory
28
28
 
@@ -49,7 +49,7 @@ const mastra = new Mastra({
49
49
  })
50
50
 
51
51
  // List all registered memory instances
52
- const allMemory = mastra.listMemory()
52
+ const allMemory = mastra.listMemory() ?? {}
53
53
  console.log(Object.keys(allMemory)) // ["conversationMemory", "analyticsMemory"]
54
54
  ```
55
55
 
@@ -15,7 +15,7 @@ import { mastra } from './mastra'
15
15
  const allScorers = mastra.listScorers()
16
16
 
17
17
  // Access a specific scorer
18
- const myScorer = allScorers.relevancyScorer
18
+ const myScorer = allScorers?.relevancyScorer
19
19
  ```
20
20
 
21
21
  ## Parameters
@@ -24,7 +24,7 @@ This method takes no parameters.
24
24
 
25
25
  ## Returns
26
26
 
27
- **scorers** (`Record<string, MastraScorer> | undefined`): An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns undefined if no scorers are registered.
27
+ **scorers** (`Record<string, MastraScorer> | undefined`): An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns an empty object if no scorers are registered.
28
28
 
29
29
  ## Related
30
30
 
@@ -18,7 +18,7 @@ This method doesn't accept any parameters.
18
18
 
19
19
  ## Returns
20
20
 
21
- **vectors** (`TVectors`): A record of all configured vector stores, where keys are vector store names and values are vector store instances.
21
+ **vectors** (`TVectors | undefined`): A record of all configured vector stores, where keys are vector store names and values are vector store instances.
22
22
 
23
23
  ## Related
24
24
 
@@ -137,7 +137,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
137
137
 
138
138
  **recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off', workflows: 'auto', workflowConcurrency: 5 }`)
139
139
 
140
- **recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
140
+ **recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery can run an interrupted tool call again and request a new model response in place of one that wasn't saved, so tools must be idempotent. See make tools safe to repeat.
141
141
 
142
142
  **recovery.workflows** (`'auto' | 'off'`): Set to 'off' to skip restarting active workflow runs on server boot. Individual workflows can also opt out with autoRestartActiveRuns: false.
143
143
 
@@ -47,7 +47,6 @@ The scorer extracts and analyzes several types of elements:
47
47
  The extraction process includes:
48
48
 
49
49
  - Normalization of text (removing diacritics, converting to lowercase)
50
- - Splitting camelCase words
51
50
  - Handling of word boundaries
52
51
  - Special handling of short words (3 characters or less)
53
52
  - Deduplication of elements
@@ -18,12 +18,10 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
18
18
 
19
19
  ## `.run()` returns
20
20
 
21
- **runId** (`string`): The id of the run (optional).
21
+ **runId** (`string`): The id of the run.
22
22
 
23
23
  **preprocessStepResult** (`object`): Object with processed input and output: { processedInput: string, processedOutput: string }
24
24
 
25
- **analyzeStepResult** (`object`): Object with similarity: { similarity: number }
26
-
27
25
  **score** (`number`): Similarity score (0-1) where 1 indicates perfect similarity.
28
26
 
29
27
  ## Scoring details
@@ -45,7 +45,9 @@ const scorer = createScorer({
45
45
 
46
46
  **judge.model** (`LanguageModel`): The LLM model instance to use for evaluation.
47
47
 
48
- **judge.instructions** (`string`): System prompt/instructions for the LLM.
48
+ **judge.instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): System instructions for the LLM. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types.
49
+
50
+ **judge.requestContext** (`RequestContext`): Values available to the judge's dynamic instructions, tools, and processors. Values from the run's requestContext override these values. scorer.run doesn't pass reserved Mastra keys or MastraMemory from the run to the judge, because they could put the judge on the caller's memory thread or give it credentials such as the auth token. To give the judge a reserved key, set it on this option. Only the scorer-level judge accepts this option.
49
51
 
50
52
  **judge.jsonPromptInjection** (`boolean | 'system' | 'inline' | 'auto'`): Controls how the judge's structured output schema reaches the model. Defaults to 'auto', which uses native structured output when supported and inline prompt injection otherwise. Explicit values override automatic routing.
51
53
 
@@ -268,7 +270,9 @@ The method can return any value. The returned value will be available to subsequ
268
270
 
269
271
  **Required** step that computes the final numerical score.
270
272
 
271
- **Function Mode:** Function: `({ run, results }) => number`
273
+ **Function Mode:** Function: `({ run, results }) => number | NotScorable | Promise<number | NotScorable>`
274
+
275
+ Return [`notScorable()`](https://mastra.ai/reference/evals/not-scorable) instead of a number to finish the run without a score.
272
276
 
273
277
  **run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
274
278
 
@@ -282,8 +286,8 @@ The method can return any value. The returned value will be available to subsequ
282
286
 
283
287
  **results.analyzeStepResult** (`any`): Result from analyze step, if defined (optional).
284
288
 
285
- Returns: `number`\
286
- The method must return a numerical score.
289
+ Returns: `number | NotScorable`\
290
+ Return a numerical score, or `notScorable()` to finish the run without a score.
287
291
 
288
292
  **Prompt Object Mode:**
289
293
 
@@ -10,7 +10,7 @@ The `createFaithfulnessScorer()` function evaluates how factually accurate an LL
10
10
 
11
11
  The `createFaithfulnessScorer()` function accepts a single options object with the following properties:
12
12
 
13
- **model** (`LanguageModel`): Configuration for the model used to evaluate faithfulness.
13
+ **model** (`MastraModelConfig`): Configuration for the model used to evaluate faithfulness.
14
14
 
15
15
  **options** (`{ context?: string[]; scale?: number }`): Configuration options for the scorer.
16
16
 
@@ -14,7 +14,7 @@ The `createHallucinationScorer()` function accepts a single options object with
14
14
 
15
15
  **options** (`Options`): Configuration options.
16
16
 
17
- **options.scale** (`number`): Maximum score value.
17
+ **options.scale** (`number`): Maximum score value. A value of 0 falls back to 1.
18
18
 
19
19
  **options.context** (`string[]`): Static context strings to use as ground truth for hallucination detection.
20
20
 
@@ -65,7 +65,7 @@ The scorer evaluates hallucination through contradiction detection and unsupport
65
65
  - Divides by total statements
66
66
  - Scales to configured range
67
67
 
68
- Final score: `min(1, hallucinated_statements / total_statements) * scale` when `total_statements > 0`, otherwise `0`.
68
+ Final score: `min(1, hallucinated_statements / total_statements) * (scale || 1)`, rounded to two decimal places, when `total_statements > 0`, otherwise `0`.
69
69
 
70
70
  ### Important Considerations
71
71
 
@@ -119,13 +119,20 @@ Checks if noise causes the agent to generate false or fabricated information tha
119
119
  ### Formula
120
120
 
121
121
  ```text
122
- Final Score = max(0, min(llm_score, calculated_score): issues_penalty)
122
+ selected_score = |llm_score - calculated_score| > discrepancy_threshold
123
+ ? min(llm_score, calculated_score)
124
+ : llm_score
125
+
126
+ Final Score = max(0, selected_score - issues_penalty)
123
127
  ```
124
128
 
129
+ The final score is rounded to two decimal places.
130
+
125
131
  Where:
126
132
 
127
133
  - `llm_score` = Direct robustness score from LLM analysis
128
134
  - `calculated_score` = Average of impact weights across dimensions
135
+ - `discrepancy_threshold` = `scoring.discrepancyThreshold` (default `0.2`)
129
136
  - `issues_penalty` = min(major_issues × penalty_rate, max_penalty)
130
137
 
131
138
  ### Impact Level Weights
@@ -189,7 +189,7 @@ Combines all system messages into a single prompt string, joined with double new
189
189
 
190
190
  ### `extractToolCalls`
191
191
 
192
- Extracts information about all tool calls from the run output, including tool names, call IDs, and their positions in the message array.
192
+ Extracts information about tool calls from the run output, excluding partial calls (`partial-call` state), including tool names, call IDs, and their positions in the message array.
193
193
 
194
194
  ```typescript
195
195
  const toolUsageScorer = createScorer({
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Tools
6
6
 
7
- A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time, the file must default-export a [`createTool()`](https://mastra.ai/reference/tools/create-tool) result, and the filename without its extension becomes the tool key the model can call.
7
+ A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time and must default-export a tool. Any tool an agent's `tools` option accepts works, such as a [`createTool()`](https://mastra.ai/reference/tools/create-tool) result or a Vercel AI SDK `tool()`. The filename without its extension becomes the tool key the model can call.
8
8
 
9
9
  Use this page for the file-based convention. For tool schemas, execution options, output shaping, and approval options, see the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool).
10
10
 
@@ -46,14 +46,14 @@ Because nested directories aren't discovered as tools, group related tools with
46
46
 
47
47
  ## Tool options
48
48
 
49
- The file-based convention only controls where the tool lives and how it's registered. The tool API still comes from `createTool()`:
49
+ The file-based convention only controls where the tool lives and how it's registered. Options come from the tool itself. For tools built with `createTool()`:
50
50
 
51
51
  - Use `description` to tell the model when to call the tool.
52
52
  - Use `inputSchema` and `outputSchema` for structured inputs and outputs.
53
53
  - Use `toModelOutput` when the model should see a different shape than the raw value returned from `execute`.
54
54
  - Use `requireApproval` when a tool needs human confirmation before execution.
55
55
 
56
- See the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool) for all options and [tool approval](https://mastra.ai/docs/harness/agent-controller) for the approval flow.
56
+ See the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool) for all options and [tool approval](https://mastra.ai/docs/harness/agent-controller) for the approval flow. Vercel AI SDK tools use the [AI SDK `tool()` API](https://ai-sdk.dev/docs/reference/ai-sdk-core/tool) instead.
57
57
 
58
58
  ## Runtime boundary
59
59
 
@@ -223,6 +223,12 @@ The Reference section provides documentation of Mastra's API, including paramete
223
223
  - [Tools](https://mastra.ai/reference/file-based-agents/tools)
224
224
  - [Workflows](https://mastra.ai/reference/file-based-agents/workflows)
225
225
  - [Workspace](https://mastra.ai/reference/file-based-agents/workspace)
226
+ - [Knowledge Class](https://mastra.ai/reference/knowledge/knowledge-class)
227
+ - [Knowledge Tools](https://mastra.ai/reference/knowledge/knowledge-tools)
228
+ - [knowledgeMemoryScopes()](https://mastra.ai/reference/knowledge/knowledge-memory-scopes)
229
+ - [Limits](https://mastra.ai/reference/knowledge/limits)
230
+ - [Scope declarations](https://mastra.ai/reference/knowledge/scope-declarations)
231
+ - [Tool instructions](https://mastra.ai/reference/knowledge/tool-instructions)
226
232
  - [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
227
233
  - [Memory Class](https://mastra.ai/reference/memory/memory-class)
228
234
  - [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
@@ -290,6 +296,7 @@ The Reference section provides documentation of Mastra's API, including paramete
290
296
  - [ResponseCache](https://mastra.ai/reference/processors/response-cache)
291
297
  - [SemanticRecall](https://mastra.ai/reference/processors/semantic-recall-processor)
292
298
  - [SkillSearchProcessor](https://mastra.ai/reference/processors/skill-search-processor)
299
+ - [SkillsProcessor](https://mastra.ai/reference/processors/skills-processor)
293
300
  - [StreamErrorRetryProcessor](https://mastra.ai/reference/processors/stream-error-retry-processor)
294
301
  - [SystemPromptScrubber](https://mastra.ai/reference/processors/system-prompt-scrubber)
295
302
  - [TokenCostControl](https://mastra.ai/reference/processors/token-cost-control)
@@ -327,6 +334,7 @@ The Reference section provides documentation of Mastra's API, including paramete
327
334
  - [Express Adapter](https://mastra.ai/reference/server/express-adapter)
328
335
  - [Fastify Adapter](https://mastra.ai/reference/server/fastify-adapter)
329
336
  - [Hono Adapter](https://mastra.ai/reference/server/hono-adapter)
337
+ - [invokeRoute()](https://mastra.ai/reference/server/invoke-route)
330
338
  - [Koa Adapter](https://mastra.ai/reference/server/koa-adapter)
331
339
  - [MastraServer](https://mastra.ai/reference/server/mastra-server)
332
340
  - [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter)