@mastra/mcp-docs-server 1.2.8-alpha.0 → 1.2.8-alpha.17

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 (147) hide show
  1. package/.docs/docs/agent-builder/deploying.md +1 -0
  2. package/.docs/docs/agent-builder/integrations.md +1 -3
  3. package/.docs/docs/agent-builder/overview.md +1 -1
  4. package/.docs/docs/agent-controller/overview.md +1 -1
  5. package/.docs/docs/agents/overview.md +17 -13
  6. package/.docs/docs/agents/skills.md +1 -3
  7. package/.docs/docs/agents/structured-output.md +14 -7
  8. package/.docs/docs/agents/using-tools.md +80 -26
  9. package/.docs/docs/browser/agent-browser.md +1 -0
  10. package/.docs/docs/browser/firecrawl.md +129 -0
  11. package/.docs/docs/browser/overview.md +16 -2
  12. package/.docs/docs/capabilities/channels/other-adapters.md +1 -1
  13. package/.docs/docs/capabilities/channels/overview.md +1 -0
  14. package/.docs/docs/capabilities/channels/slack.md +113 -3
  15. package/.docs/docs/deployment/mastra-server.md +35 -0
  16. package/.docs/docs/deployment/monorepo.md +2 -0
  17. package/.docs/docs/deployment/overview.md +6 -0
  18. package/.docs/docs/deployment/sandbox.md +277 -0
  19. package/.docs/docs/editor/overview.md +2 -6
  20. package/.docs/docs/editor/tools.md +2 -6
  21. package/.docs/docs/evals/multi-turn.md +178 -0
  22. package/.docs/docs/evals/overview.md +1 -0
  23. package/.docs/docs/evals/running-in-ci.md +3 -9
  24. package/.docs/docs/getting-started/file-based-agents.md +2 -2
  25. package/.docs/docs/index.md +17 -13
  26. package/.docs/docs/long-running-agents/background-tasks.md +2 -2
  27. package/.docs/docs/long-running-agents/durable-agents.md +2 -1
  28. package/.docs/docs/long-running-agents/schedules.md +2 -2
  29. package/.docs/docs/mastra-platform/database.md +13 -6
  30. package/.docs/docs/mastra-platform/deploy.md +17 -8
  31. package/.docs/docs/mastra-platform/environments.md +5 -4
  32. package/.docs/docs/mastra-platform/regions.md +73 -0
  33. package/.docs/docs/mcp/overview.md +1 -1
  34. package/.docs/docs/memory/multi-user-threads.md +4 -4
  35. package/.docs/docs/memory/observational-memory.md +78 -3
  36. package/.docs/docs/memory/overview.md +4 -0
  37. package/.docs/docs/memory/working-memory.md +1 -1
  38. package/.docs/docs/observability/integrations/bridges/otel.md +1 -3
  39. package/.docs/docs/observability/integrations/exporters/braintrust.md +34 -2
  40. package/.docs/docs/observability/integrations/exporters/otel.md +1 -3
  41. package/.docs/docs/server/auth/simple-auth.md +1 -3
  42. package/.docs/docs/server/request-context.md +2 -0
  43. package/.docs/docs/studio/overview.md +2 -0
  44. package/.docs/docs/voice/livekit.md +1 -1
  45. package/.docs/docs/workflows/control-flow.md +1 -3
  46. package/.docs/guides/build-your-ui/ai-sdk-ui.md +1 -0
  47. package/.docs/guides/guide/signal-provider.md +2 -0
  48. package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -3
  49. package/.docs/models/environment-variables.md +1 -0
  50. package/.docs/models/gateways/openrouter.md +339 -345
  51. package/.docs/models/gateways/vercel.md +6 -5
  52. package/.docs/models/index.md +1 -1
  53. package/.docs/models/providers/ambient.md +12 -10
  54. package/.docs/models/providers/baseten.md +3 -2
  55. package/.docs/models/providers/crossmodel.md +2 -1
  56. package/.docs/models/providers/deepinfra.md +4 -7
  57. package/.docs/models/providers/empiriolabs.md +2 -1
  58. package/.docs/models/providers/evroc.md +3 -2
  59. package/.docs/models/providers/google.md +2 -2
  60. package/.docs/models/providers/kilo.md +1 -1
  61. package/.docs/models/providers/kimi-for-coding.md +10 -11
  62. package/.docs/models/providers/llmgateway.md +3 -8
  63. package/.docs/models/providers/moonshotai-cn.md +3 -2
  64. package/.docs/models/providers/moonshotai.md +3 -2
  65. package/.docs/models/providers/nebius.md +3 -1
  66. package/.docs/models/providers/ollama-cloud.md +25 -42
  67. package/.docs/models/providers/opencode-go.md +5 -3
  68. package/.docs/models/providers/orcarouter.md +1 -1
  69. package/.docs/models/providers/privatemode-ai.md +10 -10
  70. package/.docs/models/providers/thinkingmachines.md +73 -0
  71. package/.docs/models/providers/togetherai.md +2 -6
  72. package/.docs/models/providers/zenmux.md +2 -1
  73. package/.docs/models/providers.md +1 -0
  74. package/.docs/reference/acp/acp-agent.md +2 -0
  75. package/.docs/reference/acp/create-acp-tool.md +28 -0
  76. package/.docs/reference/agent-controller/agent-controller-class.md +1 -1
  77. package/.docs/reference/agent-controller/session.md +15 -0
  78. package/.docs/reference/agents/agent.md +14 -2
  79. package/.docs/reference/agents/durable-agent.md +23 -0
  80. package/.docs/reference/agents/generate.md +19 -1
  81. package/.docs/reference/browser/firecrawl-browser.md +71 -0
  82. package/.docs/reference/cli/mastra.md +14 -6
  83. package/.docs/reference/code-sdk/mount-agent-controller.md +1 -3
  84. package/.docs/reference/core/getMCPServer.md +1 -3
  85. package/.docs/reference/core/getMCPServerById.md +1 -3
  86. package/.docs/reference/core/getTool.md +33 -0
  87. package/.docs/reference/core/getToolById.md +48 -0
  88. package/.docs/reference/core/getWorkflow.md +1 -3
  89. package/.docs/reference/core/listMCPServers.md +2 -6
  90. package/.docs/reference/core/listTools.md +38 -0
  91. package/.docs/reference/core/mastra-class.md +1 -1
  92. package/.docs/reference/datasets/addItem.md +1 -3
  93. package/.docs/reference/datasets/addItems.md +1 -3
  94. package/.docs/reference/datasets/compareExperiments.md +1 -3
  95. package/.docs/reference/datasets/create.md +1 -3
  96. package/.docs/reference/datasets/dataset.md +2 -6
  97. package/.docs/reference/datasets/datasets-manager.md +5 -15
  98. package/.docs/reference/datasets/delete.md +1 -3
  99. package/.docs/reference/datasets/deleteExperiment.md +1 -3
  100. package/.docs/reference/datasets/deleteItem.md +1 -3
  101. package/.docs/reference/datasets/deleteItems.md +1 -3
  102. package/.docs/reference/datasets/get.md +1 -3
  103. package/.docs/reference/datasets/getDetails.md +1 -3
  104. package/.docs/reference/datasets/getExperiment.md +1 -3
  105. package/.docs/reference/datasets/getItem.md +1 -3
  106. package/.docs/reference/datasets/getItemHistory.md +1 -3
  107. package/.docs/reference/datasets/list.md +1 -3
  108. package/.docs/reference/datasets/listExperimentResults.md +1 -3
  109. package/.docs/reference/datasets/listExperiments.md +1 -3
  110. package/.docs/reference/datasets/listItems.md +1 -3
  111. package/.docs/reference/datasets/listVersions.md +1 -3
  112. package/.docs/reference/datasets/startExperiment.md +1 -3
  113. package/.docs/reference/datasets/startExperimentAsync.md +1 -3
  114. package/.docs/reference/datasets/update.md +1 -3
  115. package/.docs/reference/datasets/updateItem.md +1 -3
  116. package/.docs/reference/editor/mastra-editor.md +1 -3
  117. package/.docs/reference/evals/create-scorer.md +4 -10
  118. package/.docs/reference/evals/mastra-scorer.md +1 -3
  119. package/.docs/reference/evals/run-evals.md +94 -2
  120. package/.docs/reference/file-based-agents/logger.md +1 -1
  121. package/.docs/reference/file-based-agents/tools.md +7 -6
  122. package/.docs/reference/index.md +5 -0
  123. package/.docs/reference/memory/observational-memory.md +21 -0
  124. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -3
  125. package/.docs/reference/processors/token-limiter-processor.md +1 -3
  126. package/.docs/reference/rag/database-config.md +12 -0
  127. package/.docs/reference/storage/clickhouse.md +1 -1
  128. package/.docs/reference/storage/convex.md +17 -10
  129. package/.docs/reference/storage/retention.md +1 -1
  130. package/.docs/reference/streaming/agents/stream.md +3 -1
  131. package/.docs/reference/tools/create-tool.md +78 -52
  132. package/.docs/reference/tools/mcp-client.md +104 -24
  133. package/.docs/reference/tools/mcp-server.md +143 -44
  134. package/.docs/reference/tools/task-tools.md +2 -2
  135. package/.docs/reference/tools/tavily.md +1 -1
  136. package/.docs/reference/tools/vector-query-tool.md +22 -0
  137. package/.docs/reference/vectors/mongodb.md +2 -0
  138. package/.docs/reference/vectors/turbopuffer.md +4 -0
  139. package/.docs/reference/voice/mistral.md +127 -0
  140. package/.docs/reference/workspace/daytona-sandbox.md +2 -6
  141. package/CHANGELOG.md +64 -0
  142. package/dist/{chunk-GLPCVXXO.js → chunk-HGADBLKG.js} +2 -2
  143. package/dist/{chunk-GLPCVXXO.js.map → chunk-HGADBLKG.js.map} +1 -1
  144. package/dist/index.js +1 -1
  145. package/dist/stdio.js +1 -1
  146. package/dist/tools/docs.d.ts.map +1 -1
  147. package/package.json +7 -7
@@ -17,7 +17,7 @@ const agent = new Agent({
17
17
  id: "my-agent",
18
18
  name: "My Agent",
19
19
  instructions: "You are a helpful assistant",
20
- model: "privatemode-ai/gemma-3-27b"
20
+ model: "privatemode-ai/gpt-oss-120b"
21
21
  });
22
22
 
23
23
  // Generate a response
@@ -34,13 +34,13 @@ for await (const chunk of stream) {
34
34
 
35
35
  ## Models
36
36
 
37
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
- | ------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
- | `privatemode-ai/gemma-3-27b` | 128K | | | | | | — | — |
40
- | `privatemode-ai/gpt-oss-120b` | 128K | | | | | | — | — |
41
- | `privatemode-ai/qwen3-coder-30b-a3b` | 128K | | | | | | — | — |
42
- | `privatemode-ai/qwen3-embedding-4b` | 32K | | | | | | — | — |
43
- | `privatemode-ai/whisper-large-v3` | — | | | | | | — | — |
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | ----------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `privatemode-ai/gpt-oss-120b` | 128K | | | | | | — | — |
40
+ | `privatemode-ai/kimi-k2.6` | 262K | | | | | | — | — |
41
+ | `privatemode-ai/qwen3-embedding-4b` | 32K | | | | | | — | — |
42
+ | `privatemode-ai/voxtral-mini-3b` | 32K | | | | | | — | — |
43
+ | `privatemode-ai/whisper-large-v3` | — | | | | | | — | — |
44
44
 
45
45
  ## Advanced configuration
46
46
 
@@ -52,7 +52,7 @@ const agent = new Agent({
52
52
  name: "custom-agent",
53
53
  model: {
54
54
  url: "http://localhost:8080/v1",
55
- id: "privatemode-ai/gemma-3-27b",
55
+ id: "privatemode-ai/gpt-oss-120b",
56
56
  apiKey: process.env.PRIVATEMODE_API_KEY,
57
57
  headers: {
58
58
  "X-Custom-Header": "value"
@@ -71,7 +71,7 @@ const agent = new Agent({
71
71
  const useAdvanced = requestContext.task === "complex";
72
72
  return useAdvanced
73
73
  ? "privatemode-ai/whisper-large-v3"
74
- : "privatemode-ai/gemma-3-27b";
74
+ : "privatemode-ai/gpt-oss-120b";
75
75
  }
76
76
  });
77
77
  ```
@@ -0,0 +1,73 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # ![Thinking Machines logo](https://models.dev/logos/thinkingmachines.svg)Thinking Machines
4
+
5
+ Access 1 Thinking Machines model through Mastra's model router. Authentication is handled automatically using the `TINKER_API_KEY` environment variable.
6
+
7
+ Learn more in the [Thinking Machines documentation](https://tinker-docs.thinkingmachines.ai/tinker/compatible-apis/openai/).
8
+
9
+ ```bash
10
+ TINKER_API_KEY=your-api-key
11
+ ```
12
+
13
+ ```typescript
14
+ import { Agent } from "@mastra/core/agent";
15
+
16
+ const agent = new Agent({
17
+ id: "my-agent",
18
+ name: "My Agent",
19
+ instructions: "You are a helpful assistant",
20
+ model: "thinkingmachines/inkling"
21
+ });
22
+
23
+ // Generate a response
24
+ const response = await agent.generate("Hello!");
25
+
26
+ // Stream a response
27
+ const stream = await agent.stream("Tell me a story");
28
+ for await (const chunk of stream) {
29
+ console.log(chunk);
30
+ }
31
+ ```
32
+
33
+ > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Thinking Machines documentation](https://tinker-docs.thinkingmachines.ai/tinker/compatible-apis/openai/) for details.
34
+
35
+ ## Models
36
+
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | -------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `thinkingmachines/inkling` | 256K | | | | | | $4 | $9 |
40
+
41
+ ## Advanced configuration
42
+
43
+ ### Custom headers
44
+
45
+ ```typescript
46
+ const agent = new Agent({
47
+ id: "custom-agent",
48
+ name: "custom-agent",
49
+ model: {
50
+ url: "https://tinker.thinkingmachines.dev/services/tinker-prod/oai/api/v1",
51
+ id: "thinkingmachines/inkling",
52
+ apiKey: process.env.TINKER_API_KEY,
53
+ headers: {
54
+ "X-Custom-Header": "value"
55
+ }
56
+ }
57
+ });
58
+ ```
59
+
60
+ ### Dynamic model selection
61
+
62
+ ```typescript
63
+ const agent = new Agent({
64
+ id: "dynamic-agent",
65
+ name: "Dynamic Agent",
66
+ model: ({ requestContext }) => {
67
+ const useAdvanced = requestContext.task === "complex";
68
+ return useAdvanced
69
+ ? "thinkingmachines/inkling"
70
+ : "thinkingmachines/inkling";
71
+ }
72
+ });
73
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Together AI logo](https://models.dev/logos/togetherai.svg)Together AI
4
4
 
5
- Access 25 Together AI models through Mastra's model router. Authentication is handled automatically using the `TOGETHER_API_KEY` environment variable.
5
+ Access 21 Together AI models through Mastra's model router. Authentication is handled automatically using the `TOGETHER_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [Together AI documentation](https://docs.together.ai/docs/serverless-models).
8
8
 
@@ -36,7 +36,6 @@ for await (const chunk of stream) {
36
36
  | ----------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
37
37
  | `togetherai/deepcogito/cogito-v2-1-671b` | 164K | | | | | | $1 | $1 |
38
38
  | `togetherai/deepseek-ai/DeepSeek-V4-Pro` | 512K | | | | | | $2 | $3 |
39
- | `togetherai/essentialai/Rnj-1-Instruct` | 33K | | | | | | $0.15 | $0.15 |
40
39
  | `togetherai/google/gemma-3n-E4B-it` | 33K | | | | | | $0.06 | $0.12 |
41
40
  | `togetherai/google/gemma-4-31B-it` | 262K | | | | | | $0.39 | $0.97 |
42
41
  | `togetherai/LiquidAI/LFM2-24B-A2B` | 33K | | | | | | $0.03 | $0.12 |
@@ -51,13 +50,10 @@ for await (const chunk of stream) {
51
50
  | `togetherai/openai/gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 |
52
51
  | `togetherai/pearl-ai/gemma-4-31b-it` | 32K | | | | | | $0.28 | $0.86 |
53
52
  | `togetherai/Qwen/Qwen2.5-7B-Instruct-Turbo` | 33K | | | | | | $0.30 | $0.30 |
54
- | `togetherai/Qwen/Qwen3-235B-A22B-Instruct-2507-tput` | 262K | | | | | | $0.20 | $0.60 |
55
- | `togetherai/Qwen/Qwen3.5-397B-A17B` | 262K | | | | | | $0.60 | $4 |
56
53
  | `togetherai/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.17 | $0.25 |
57
54
  | `togetherai/Qwen/Qwen3.6-Plus` | 1.0M | | | | | | $0.50 | $3 |
58
55
  | `togetherai/Qwen/Qwen3.7-Max` | 1.0M | | | | | | $1 | $4 |
59
- | `togetherai/zai-org/GLM-5` | 203K | | | | | | $1 | $3 |
60
- | `togetherai/zai-org/GLM-5.1` | 203K | | | | | | $1 | $4 |
56
+ | `togetherai/thinkingmachines/Inkling` | 524K | | | | | | $1 | $4 |
61
57
  | `togetherai/zai-org/GLM-5.2` | 262K | | | | | | $1 | $4 |
62
58
 
63
59
  ## Advanced configuration
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![ZenMux logo](https://models.dev/logos/zenmux.svg)ZenMux
4
4
 
5
- Access 118 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
5
+ Access 119 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
8
8
 
@@ -83,6 +83,7 @@ for await (const chunk of stream) {
83
83
  | `zenmux/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
84
84
  | `zenmux/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
85
85
  | `zenmux/moonshotai/kimi-k2.7-code-free` | 262K | | | | | | — | — |
86
+ | `zenmux/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $15 |
86
87
  | `zenmux/openai/gpt-5` | 400K | | | | | | $1 | $10 |
87
88
  | `zenmux/openai/gpt-5-codex` | 400K | | | | | | $1 | $10 |
88
89
  | `zenmux/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
@@ -131,6 +131,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
131
131
  - [Tencent Token Plan](https://mastra.ai/models/providers/tencent-token-plan)
132
132
  - [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
133
133
  - [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
134
+ - [Thinking Machines](https://mastra.ai/models/providers/thinkingmachines)
134
135
  - [Tinfoil](https://mastra.ai/models/providers/tinfoil)
135
136
  - [Together AI](https://mastra.ai/models/providers/togetherai)
136
137
  - [TrustedRouter](https://mastra.ai/models/providers/trustedrouter)
@@ -76,6 +76,8 @@ export const claudeCodeAgent = new AcpAgent({
76
76
 
77
77
  **onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
78
78
 
79
+ **createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers. See Extension methods.
80
+
79
81
  **workspace** (`Workspace`): Workspace used for ACP file read and write requests. Defaults to a Workspace backed by LocalFilesystem at cwd or process.cwd().
80
82
 
81
83
  **model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
@@ -57,6 +57,8 @@ export const codeSupervisor = new Agent({
57
57
 
58
58
  **onPermissionRequest** (`(request: RequestPermissionRequest) => Promise<RequestPermissionResponse>`): Callback invoked when the ACP agent requests permission. Defaults to selecting the first permission option, or cancelling when no option is available.
59
59
 
60
+ **createClient** (`(defaultClient: Client) => Client`): Customize the ACP client used to answer agent requests. Receives the default client so it can be wrapped or extended, for example with extMethod and extNotification handlers.
61
+
60
62
  **workspace** (`Workspace`): Workspace option from the shared ACP connection options. During tool execution, createACPTool() passes the current Mastra workspace from the execution context when one is available; otherwise the ACP connection falls back to a local filesystem workspace. Use AcpAgent when you need to provide an explicit workspace instance.
61
63
 
62
64
  **model** (`ModelId`): Model ID to select after ACP session creation using the ACP session/set\_model method.
@@ -124,6 +126,32 @@ export const codeAgentTool = createACPTool({
124
126
 
125
127
  Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
126
128
 
129
+ ## Extension methods
130
+
131
+ Some ACP agents call custom extension methods on the client, outside the standard ACP request set. The default client rejects unknown methods with a "Method not found" error, which can abort the agent's turn.
132
+
133
+ Pass `createClient` to extend or replace the default client. The callback receives the default client and returns the client used for the connection:
134
+
135
+ ```typescript
136
+ import { createACPTool } from '@mastra/acp'
137
+
138
+ export const codeAgentTool = createACPTool({
139
+ id: 'code-agent',
140
+ description: 'Use an ACP-compatible coding agent',
141
+ command: 'acp-agent',
142
+ args: ['--stdio'],
143
+ createClient: defaultClient =>
144
+ Object.assign(defaultClient, {
145
+ async extMethod(method: string, params: Record<string, unknown>) {
146
+ return {}
147
+ },
148
+ async extNotification(method: string, params: Record<string, unknown>) {},
149
+ }),
150
+ })
151
+ ```
152
+
153
+ Return a fully custom `Client` implementation when you need to change the standard handlers as well. The `Client` type is re-exported from `@mastra/acp`.
154
+
127
155
  ## Related
128
156
 
129
157
  - [Agent Client Protocol docs](https://mastra.ai/docs/agents/acp)
@@ -22,7 +22,7 @@ import { z } from 'zod'
22
22
  const agentController = new AgentController({
23
23
  id: 'my-coding-agent',
24
24
  agent: myAgent,
25
- storage: new LibSQLStore({ url: 'file:./data.db' }),
25
+ storage: new LibSQLStore({ id: 'agent-storage', url: 'file:./data.db' }),
26
26
  stateSchema: z.object({
27
27
  currentModelId: z.string().optional(),
28
28
  }),
@@ -57,6 +57,19 @@ The session is organized into sub-objects, each owning one domain of per-convers
57
57
 
58
58
  ## Methods
59
59
 
60
+ ### Workspace
61
+
62
+ #### `getWorkspace()`
63
+
64
+ Return the workspace resolved for this session. This preserves session-level overrides and workspaces selected from the session scope.
65
+
66
+ ```typescript
67
+ const workspace = agentController.session.getWorkspace()
68
+ const skill = await workspace.skills?.get('code-review')
69
+ ```
70
+
71
+ Returns: `Workspace`
72
+
60
73
  ### Permissions
61
74
 
62
75
  Session-scoped grants auto-approve tools without prompting. Grants are ephemeral — they reset when the session restarts and are never persisted.
@@ -211,6 +224,8 @@ Retrieve messages for a specific thread.
211
224
  const messages = await agentController.session.thread.listMessages({ threadId: 'thread-abc123' })
212
225
  ```
213
226
 
227
+ The message-reading methods `listActiveMessages`, `listMessages`, and `firstUserMessage` return `MastraDBMessage` objects, while `firstUserMessages` returns a `Map<string, MastraDBMessage>` keyed by thread ID. Each message has a `role`, an `id`, a `createdAt`, and a `content` object with `content.format` and a `content.parts` array. Read text, reasoning, tool calls, and attachments from `content.parts`. Signals such as system reminders and notifications are returned as separate messages with `role: 'signal'`.
228
+
214
229
  ### `session.thread.firstUserMessage({ threadId })`
215
230
 
216
231
  Retrieve the first user message for a thread, or `null` if none.
@@ -96,6 +96,18 @@ export const agent = new Agent({
96
96
  })
97
97
  ```
98
98
 
99
+ ## Model strings
100
+
101
+ For the simplest setup, pass `model` as a string in `provider/model` format. Separate the provider and model name with a slash. Mastra reads the matching provider credentials from the environment, so this format doesn't require a provider package or import.
102
+
103
+ Popular provider strings and credentials:
104
+
105
+ - **OpenAI**: `openai/gpt-5.5` uses `OPENAI_API_KEY`.
106
+ - **Anthropic**: `anthropic/claude-sonnet-4-6` uses `ANTHROPIC_API_KEY`.
107
+ - **Google**: `google/gemini-2.5-pro` uses `GOOGLE_API_KEY` or `GOOGLE_GENERATIVE_AI_API_KEY`.
108
+
109
+ See [models](https://mastra.ai/models) for supported model IDs and [environment variables](https://mastra.ai/models/environment-variables) for the complete provider list.
110
+
99
111
  ## Thread signals
100
112
 
101
113
  Use Agent signals to send real-time input and context into a memory thread. Message APIs are for user-authored input. `sendSignal()` is the lower-level API for system-generated context.
@@ -435,11 +447,11 @@ Returns an `AgentThreadSubscription` object with these members:
435
447
 
436
448
  **instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): Instructions that guide the agent's behavior. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types dynamically. SystemMessage types: string | string\[] | CoreSystemMessage | CoreSystemMessage\[] | SystemModelMessage | SystemModelMessage\[]
437
449
 
438
- **model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Can be provided statically or resolved at runtime.
450
+ **model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Pass a model router string in provider/model format, a model configuration or provider instance, or a function that resolves the model at runtime. See Model strings for common providers and environment variables.
439
451
 
440
452
  **agents** (`Record<string, Agent> | ({ requestContext: RequestContext }) => Record<string, Agent> | Promise<Record<string, Agent>>`): Subagents that the agent can access. Can be provided statically or resolved dynamically.
441
453
 
442
- **tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
454
+ **tools** (`ToolsInput | ({ requestContext: RequestContext, mastra?: Mastra }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically from the request context and associated Mastra instance when available.
443
455
 
444
456
  **hooks** (`ToolHooks`): Hooks that run before and after every tool call made by this agent. Per-execution hooks passed to generate() or stream() override matching hooks set here. See Tool hooks below.
445
457
 
@@ -37,6 +37,29 @@ const text = await output.text
37
37
  cleanup()
38
38
  ```
39
39
 
40
+ ### Using the `durable` config flag
41
+
42
+ Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it is attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, or `cleanupTimeoutMs`.
43
+
44
+ ```typescript
45
+ import { Mastra } from '@mastra/core'
46
+ import { Agent } from '@mastra/core/agent'
47
+
48
+ const myAgent = new Agent({
49
+ id: 'my-agent',
50
+ name: 'My Agent',
51
+ instructions: 'You are a helpful assistant',
52
+ model: 'openai/gpt-5.5',
53
+ durable: true, // or: { maxSteps: 10, cleanupTimeoutMs: 60_000 }
54
+ })
55
+
56
+ export const mastra = new Mastra({
57
+ agents: { myAgent },
58
+ })
59
+ ```
60
+
61
+ `mastra.getAgent('myAgent')` returns the wrapped `DurableAgent`. Standalone agents (constructed but never registered on a `Mastra` instance) do not become durable; the wrapping is applied at registration.
62
+
40
63
  ## `createDurableAgent(options)`
41
64
 
42
65
  Wraps an `Agent` with durable execution and resumable streams. This is the recommended way to create a `DurableAgent`.
@@ -106,7 +106,7 @@ const result = await agent.generate('message for agent')
106
106
 
107
107
  **options.structuredOutput.instructions** (`string`): Additional instructions for the structured output model.
108
108
 
109
- **options.structuredOutput.jsonPromptInjection** (`boolean`): Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs.
109
+ **options.structuredOutput.jsonPromptInjection** (`boolean | 'system' | 'inline' | 'auto'`): Controls how the JSON schema reaches the model. Set to 'auto' to use native structured output when supported and inline prompt injection otherwise.
110
110
 
111
111
  **options.structuredOutput.logger** (`IMastraLogger`): Optional logger instance for structured logging during output generation.
112
112
 
@@ -132,6 +132,8 @@ const result = await agent.generate('message for agent')
132
132
 
133
133
  **options.memory.options** (`MemoryConfig`): Additional memory configuration options including lastMessages, readOnly, semanticRecall, workingMemory, and filterIncompleteToolCalls.
134
134
 
135
+ **options.memory.onTitleGenerated** (`(title: string) => void | Promise<void>`): Callback fired asynchronously when a thread title is generated and persisted to storage. Title generation runs in the background and may complete after generate() returns. Only fires when generateTitle is enabled in memory options and the thread has no existing title.
136
+
135
137
  **options.onFinish** (`LoopConfig['onFinish']`): Callback fired when generation completes.
136
138
 
137
139
  **options.onStepFinish** (`LoopConfig['onStepFinish']`): Callback fired after each generation step.
@@ -456,4 +458,20 @@ const response = await agent.generate('Help me organize my day', {
456
458
  console.log({ text, toolCalls, toolResults, finishReason, usage })
457
459
  },
458
460
  })
461
+ ```
462
+
463
+ ### Using `onTitleGenerated`
464
+
465
+ When `generateTitle` is enabled in memory options, title generation runs asynchronously after the response completes. Use `onTitleGenerated` to react when the title is ready — for example, to push it to the client via SSE.
466
+
467
+ ```typescript
468
+ const response = await agent.generate('What is quantum computing?', {
469
+ memory: {
470
+ thread: threadId,
471
+ resource: userId,
472
+ onTitleGenerated: title => {
473
+ console.log('Thread title:', title)
474
+ },
475
+ },
476
+ })
459
477
  ```
@@ -0,0 +1,71 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # FirecrawlBrowser class
4
+
5
+ The `FirecrawlBrowser` class provides browser automation backed by the [Firecrawl Browser Sandbox](https://docs.firecrawl.dev/features/browser). It provisions remote browser sessions through the Firecrawl API and connects to them over the Chrome DevTools Protocol (CDP).
6
+
7
+ `FirecrawlBrowser` extends [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser) and exposes the same deterministic toolset. Use it when you want hosted browser sessions instead of a local Chromium install. For local automation, see [`AgentBrowser`](https://mastra.ai/reference/browser/agent-browser). For AI-powered interactions using natural language, see [`StagehandBrowser`](https://mastra.ai/reference/browser/stagehand-browser).
8
+
9
+ ## Usage example
10
+
11
+ ```typescript
12
+ import { Agent } from '@mastra/core/agent'
13
+ import { FirecrawlBrowser } from '@mastra/browser-firecrawl'
14
+
15
+ const browser = new FirecrawlBrowser({
16
+ apiKey: process.env.FIRECRAWL_API_KEY,
17
+ firecrawl: {
18
+ ttl: 600,
19
+ },
20
+ })
21
+
22
+ export const browserAgent = new Agent({
23
+ id: 'browser-agent',
24
+ name: 'Browser Agent',
25
+ instructions: `You can browse the web. Use browser_snapshot to see the page structure,
26
+ then interact with elements using their refs (e.g., @e5).`,
27
+ model: 'openai/gpt-5.5',
28
+ browser,
29
+ })
30
+ ```
31
+
32
+ ## Constructor parameters
33
+
34
+ `FirecrawlBrowser` accepts all [`AgentBrowser` constructor parameters](https://mastra.ai/reference/browser/agent-browser) plus the following:
35
+
36
+ **apiKey** (`string`): Firecrawl API key. Falls back to the FIRECRAWL\_API\_KEY environment variable. The constructor throws if neither is set.
37
+
38
+ **apiUrl** (`string`): Base URL for a self-hosted Firecrawl API.
39
+
40
+ **firecrawl** (`FirecrawlBrowserSessionOptions`): Session options passed to the Firecrawl browser() API when creating sandbox sessions.
41
+
42
+ **firecrawl.ttl** (`number`): Maximum session lifetime in seconds.
43
+
44
+ **firecrawl.activityTtl** (`number`): Idle timeout in seconds before the sandbox recycles the session.
45
+
46
+ **firecrawl.streamWebView** (`boolean`): When true, Firecrawl may stream WebView frames for the remote session.
47
+
48
+ **firecrawl.profile** (`{ name: string; saveChanges?: boolean }`): Named Firecrawl sandbox profile. Set saveChanges: true to persist cookies and login state when the session ends; naming a profile alone does not save changes. Distinct from the top-level AgentBrowser profile option, which is a local Playwright user-data directory path.
49
+
50
+ **firecrawl.integration** (`string`): Integration label for Firecrawl analytics and routing.
51
+
52
+ **firecrawl.origin** (`string`): Origin hint for the Firecrawl browser session.
53
+
54
+ ## Session lifecycle
55
+
56
+ Session provisioning depends on the `scope` option inherited from `AgentBrowser`:
57
+
58
+ - `'thread'` (default): Each conversation thread gets its own Firecrawl sandbox session, created on first use and deleted when the thread's browser session is destroyed.
59
+ - `'shared'`: One Firecrawl sandbox session is created when the browser launches and shared across all threads. The session is deleted when the browser closes.
60
+
61
+ In both cases, `FirecrawlBrowser` deletes the remote Firecrawl session when the browser closes, including when session creation or connection fails partway through.
62
+
63
+ ## Tools
64
+
65
+ `FirecrawlBrowser` provides the same toolset as `AgentBrowser`, including `browser_goto`, `browser_snapshot`, `browser_click`, `browser_type`, and `browser_screenshot`. See the [`AgentBrowser` tool reference](https://mastra.ai/reference/browser/agent-browser) for the full list and tool parameters.
66
+
67
+ ## Related
68
+
69
+ - [Firecrawl docs](https://mastra.ai/docs/browser/firecrawl)
70
+ - [`AgentBrowser` reference](https://mastra.ai/reference/browser/agent-browser)
71
+ - [Browser overview](https://mastra.ai/docs/browser/overview)
@@ -361,7 +361,7 @@ File to write. Defaults to `.env`.
361
361
 
362
362
  Manages databases attached to a project on Mastra platform. Databases are provisioned from a managed provider (for example Turso or Neon) and inject their connection env vars into deploys automatically.
363
363
 
364
- A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Pass the environment argument to work with environment-scoped databases; omit it for shared databases.
364
+ A database is either **environment-scoped** (its env vars only go to one environment) or **shared** (project-scoped: its env vars go to all environments). Environment-scoped is the default for `mastra env db create` — pass an environment argument, or let the CLI pick or prompt for one. Pass `--shared` on create to attach a shared database instead. For other subcommands (`list`, `delete`, `keys`), pass the environment argument to work with environment-scoped databases and omit it for shared databases.
365
365
 
366
366
  Creating and deleting databases requires the `admin` role in the organization.
367
367
 
@@ -382,11 +382,15 @@ Emit machine-readable JSON.
382
382
 
383
383
  Provisions a managed database, attaches it, and polls until it's ready. Provisioning errors are printed with the provider's error detail.
384
384
 
385
- With an environment argument, the database is scoped to that environment: only it receives the database's connection env vars, and the provider region is derived from the environment's region. Without one, the database is shared by all environments.
385
+ By default the database is scoped to a single environment: pass an environment argument to pick it, or omit the argument to have the CLI pick for you. When the project has one environment, that environment is used. When it has several, the CLI prompts you to select one interactively; in non-interactive contexts (CI, `--json`) an environment argument is required. Pass `--shared` to attach a project-scoped database that's shared by every environment instead.
386
+
387
+ Environment-scoped databases inherit their provider region from the environment. Shared databases accept `--region`.
386
388
 
387
389
  ```bash
388
- mastra env db create <env> --kind turso
389
- mastra env db create --kind neon --name my-app-db --region aws-us-east-1
390
+ mastra env db create --kind turso # picks or prompts for an environment
391
+ mastra env db create staging --kind turso # scoped to the "staging" environment
392
+ mastra env db create --kind turso --shared # shared by all environments
393
+ mastra env db create --kind neon --name my-app-db --region aws-us-east-1 --shared
390
394
  ```
391
395
 
392
396
  #### `--kind`
@@ -401,13 +405,17 @@ Database name. Defaults to a name derived from the project slug (for example `my
401
405
 
402
406
  Provider region ID for shared databases. Ignored for environment-scoped databases.
403
407
 
408
+ #### `--shared`
409
+
410
+ Attach as a project-scoped database that's shared by every environment. Cannot be combined with an environment argument.
411
+
404
412
  #### `--no-wait`
405
413
 
406
414
  Return immediately after the attach is queued instead of polling until the database is ready. Check progress later with `mastra env db show`.
407
415
 
408
416
  #### `--json`
409
417
 
410
- Emit machine-readable JSON.
418
+ Emit machine-readable JSON. In this mode, an environment argument or `--shared` is required when the project has more than one environment (no interactive prompt).
411
419
 
412
420
  ### `mastra env db show`
413
421
 
@@ -429,7 +437,7 @@ Emit machine-readable JSON. Secret values are masked unless `--show-secrets` is
429
437
 
430
438
  ### `mastra env db delete`
431
439
 
432
- Permanently deletes a database with the provider, including all of its data. This cannot be undone. The CLI prompts for confirmation unless `--yes` is passed. After deletion, deploys no longer receive the database's env vars.
440
+ Permanently deletes a database with the provider, including all of its data. This can't be undone. The CLI prompts for confirmation unless `--yes` is passed. After deletion, deploys no longer receive the database's env vars.
433
441
 
434
442
  ```bash
435
443
  mastra env db delete <database>
@@ -27,9 +27,7 @@ Pass an existing `mastra` to mount the controller onto a Mastra instance that al
27
27
  import { Mastra } from '@mastra/core/mastra'
28
28
  import { mountAgentControllerOnMastra } from '@mastra/code-sdk'
29
29
 
30
- const mastra = new Mastra({
31
- /* ... */
32
- })
30
+ const mastra = new Mastra({/* ... */})
33
31
 
34
32
  const { controller } = await mountAgentControllerOnMastra({ mastra })
35
33
  ```
@@ -12,9 +12,7 @@ const myServer = new MCPServer({
12
12
  id: 'my-mcp-server',
13
13
  name: 'My Server',
14
14
  version: '1.0.0',
15
- tools: {
16
- /* ... */
17
- },
15
+ tools: {/* ... */},
18
16
  })
19
17
 
20
18
  export const mastra = new Mastra({
@@ -12,9 +12,7 @@ const myServer = new MCPServer({
12
12
  id: 'my-mcp-server',
13
13
  name: 'My Server',
14
14
  version: '1.0.0',
15
- tools: {
16
- /* ... */
17
- },
15
+ tools: {/* ... */},
18
16
  })
19
17
 
20
18
  export const mastra = new Mastra({
@@ -0,0 +1,33 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Mastra.getTool()
4
+
5
+ The `.getTool()` method retrieves a tool from the Mastra-level registry by its registration key.
6
+
7
+ ## Usage example
8
+
9
+ Register a tool under the `weather` key, then use that key to retrieve it.
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra'
13
+ import { weatherTool } from './tools/weather-tool'
14
+
15
+ export const mastra = new Mastra({
16
+ tools: {
17
+ weather: weatherTool,
18
+ },
19
+ })
20
+
21
+ const tool = mastra.getTool('weather')
22
+ ```
23
+
24
+ ## Parameters
25
+
26
+ **name** (`TToolName extends keyof TTools`): The registration key of the tool in the Mastra tools registry.
27
+
28
+ ## Related
29
+
30
+ - [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
31
+ - [Mastra class](https://mastra.ai/reference/core/mastra-class)
32
+ - [Mastra.getToolById()](https://mastra.ai/reference/core/getToolById)
33
+ - [Mastra.listTools()](https://mastra.ai/reference/core/listTools)
@@ -0,0 +1,48 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Mastra.getToolById()
4
+
5
+ The `.getToolById()` method first searches the Mastra-level registry for a tool with a matching intrinsic `id`. If no intrinsic ID matches, it treats the value as a registration key.
6
+
7
+ ## Usage example
8
+
9
+ This example uses `weather` as the registration key and `weather-tool` as the tool's intrinsic ID.
10
+
11
+ ```typescript
12
+ import { Mastra } from '@mastra/core/mastra'
13
+ import { createTool } from '@mastra/core/tools'
14
+ import { z } from 'zod'
15
+
16
+ const weatherTool = createTool({
17
+ id: 'weather-tool',
18
+ description: 'Fetches weather for a location',
19
+ inputSchema: z.object({
20
+ location: z.string(),
21
+ }),
22
+ outputSchema: z.object({
23
+ weather: z.string(),
24
+ }),
25
+ execute: async ({ location }) => ({
26
+ weather: `Weather for ${location}`,
27
+ }),
28
+ })
29
+
30
+ export const mastra = new Mastra({
31
+ tools: {
32
+ weather: weatherTool,
33
+ },
34
+ })
35
+
36
+ const toolById = mastra.getToolById('weather-tool')
37
+ ```
38
+
39
+ ## Parameters
40
+
41
+ **id** (`TTools[TToolName]['id']`): The intrinsic tool ID to find. When no tool has that ID, Mastra uses the value as a registration key.
42
+
43
+ ## Related
44
+
45
+ - [Share tools across agents](https://mastra.ai/docs/agents/using-tools)
46
+ - [Mastra class](https://mastra.ai/reference/core/mastra-class)
47
+ - [Mastra.getTool()](https://mastra.ai/reference/core/getTool)
48
+ - [Mastra.listTools()](https://mastra.ai/reference/core/listTools)
@@ -13,9 +13,7 @@ const run = await workflow.createRun()
13
13
 
14
14
  // TypeScript will properly infer the input schema type
15
15
  await run.startAsync({
16
- inputData: {
17
- /* properly typed */
18
- },
16
+ inputData: {/* properly typed */},
19
17
  })
20
18
  ```
21
19