@mastra/mcp-docs-server 1.2.0 → 1.2.1-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 (102) hide show
  1. package/.docs/docs/agents/goals.md +2 -2
  2. package/.docs/docs/harness/modes.md +2 -2
  3. package/.docs/docs/harness/overview.md +23 -25
  4. package/.docs/docs/harness/session.md +2 -2
  5. package/.docs/docs/harness/subagents.md +3 -3
  6. package/.docs/docs/harness/tool-approvals.md +2 -2
  7. package/.docs/guides/build-your-ui/openui.md +297 -0
  8. package/.docs/models/gateways/custom-gateways.md +12 -0
  9. package/.docs/models/gateways/netlify.md +4 -7
  10. package/.docs/models/gateways/openrouter.md +20 -40
  11. package/.docs/models/gateways/vercel.md +281 -246
  12. package/.docs/models/index.md +1 -1
  13. package/.docs/models/providers/alibaba-cn.md +5 -2
  14. package/.docs/models/providers/alibaba-coding-plan-cn.md +5 -2
  15. package/.docs/models/providers/alibaba-coding-plan.md +5 -2
  16. package/.docs/models/providers/alibaba-token-plan-cn.md +88 -0
  17. package/.docs/models/providers/alibaba-token-plan.md +88 -0
  18. package/.docs/models/providers/alibaba.md +3 -1
  19. package/.docs/models/providers/ambient.md +6 -5
  20. package/.docs/models/providers/anthropic.md +8 -11
  21. package/.docs/models/providers/anyapi.md +99 -0
  22. package/.docs/models/providers/baseten.md +19 -19
  23. package/.docs/models/providers/cerebras.md +5 -7
  24. package/.docs/models/providers/claudinio.md +3 -2
  25. package/.docs/models/providers/cloudflare-workers-ai.md +4 -9
  26. package/.docs/models/providers/cortecs.md +9 -2
  27. package/.docs/models/providers/crof.md +12 -10
  28. package/.docs/models/providers/deepinfra.md +18 -31
  29. package/.docs/models/providers/deepseek.md +1 -1
  30. package/.docs/models/providers/digitalocean.md +5 -1
  31. package/.docs/models/providers/fastrouter.md +34 -2
  32. package/.docs/models/providers/fireworks-ai.md +22 -27
  33. package/.docs/models/providers/freemodel.md +108 -0
  34. package/.docs/models/providers/google.md +7 -9
  35. package/.docs/models/providers/groq.md +7 -9
  36. package/.docs/models/providers/helicone.md +1 -1
  37. package/.docs/models/providers/hpc-ai.md +3 -3
  38. package/.docs/models/providers/huggingface.md +1 -1
  39. package/.docs/models/providers/kilo.md +9 -8
  40. package/.docs/models/providers/kimi-for-coding.md +4 -3
  41. package/.docs/models/providers/llmgateway.md +38 -29
  42. package/.docs/models/providers/llmtr.md +76 -0
  43. package/.docs/models/providers/lucidquery.md +11 -9
  44. package/.docs/models/providers/minimax-cn-coding-plan.md +3 -2
  45. package/.docs/models/providers/minimax-cn.md +3 -2
  46. package/.docs/models/providers/minimax-coding-plan.md +3 -2
  47. package/.docs/models/providers/minimax.md +3 -2
  48. package/.docs/models/providers/mistral.md +25 -31
  49. package/.docs/models/providers/moonshotai-cn.md +13 -11
  50. package/.docs/models/providers/moonshotai.md +13 -11
  51. package/.docs/models/providers/nano-gpt.md +621 -529
  52. package/.docs/models/providers/nearai.md +5 -1
  53. package/.docs/models/providers/nebius.md +2 -15
  54. package/.docs/models/providers/neon.md +96 -0
  55. package/.docs/models/providers/neuralwatt.md +19 -20
  56. package/.docs/models/providers/novita-ai.md +7 -2
  57. package/.docs/models/providers/nvidia.md +5 -14
  58. package/.docs/models/providers/ollama-cloud.md +8 -12
  59. package/.docs/models/providers/openai.md +2 -3
  60. package/.docs/models/providers/opencode-go.md +10 -9
  61. package/.docs/models/providers/opencode.md +7 -2
  62. package/.docs/models/providers/ovhcloud.md +7 -3
  63. package/.docs/models/providers/poe.md +2 -1
  64. package/.docs/models/providers/poolside.md +72 -0
  65. package/.docs/models/providers/routing-run.md +5 -3
  66. package/.docs/models/providers/scaleway.md +3 -5
  67. package/.docs/models/providers/siliconflow-cn.md +4 -11
  68. package/.docs/models/providers/siliconflow.md +7 -13
  69. package/.docs/models/providers/snowflake-cortex.md +89 -0
  70. package/.docs/models/providers/stepfun-ai.md +5 -5
  71. package/.docs/models/providers/stepfun.md +1 -1
  72. package/.docs/models/providers/synthetic.md +2 -1
  73. package/.docs/models/providers/togetherai.md +30 -24
  74. package/.docs/models/providers/umans-ai-coding-plan.md +3 -2
  75. package/.docs/models/providers/umans-ai.md +75 -0
  76. package/.docs/models/providers/vivgrid.md +1 -1
  77. package/.docs/models/providers/vultr.md +14 -12
  78. package/.docs/models/providers/wafer.ai.md +9 -4
  79. package/.docs/models/providers/xai.md +3 -3
  80. package/.docs/models/providers/xiaomi-token-plan-ams.md +15 -13
  81. package/.docs/models/providers/xiaomi-token-plan-cn.md +15 -13
  82. package/.docs/models/providers/xiaomi-token-plan-sgp.md +15 -13
  83. package/.docs/models/providers/xiaomi.md +10 -9
  84. package/.docs/models/providers/xpersona.md +4 -3
  85. package/.docs/models/providers/zai-coding-plan.md +2 -1
  86. package/.docs/models/providers/zai.md +2 -1
  87. package/.docs/models/providers/zeldoc.md +71 -0
  88. package/.docs/models/providers/zenmux.md +19 -3
  89. package/.docs/models/providers/zhipuai-coding-plan.md +3 -1
  90. package/.docs/models/providers/zhipuai.md +2 -1
  91. package/.docs/models/providers.md +12 -3
  92. package/.docs/reference/agents/agent.md +18 -5
  93. package/.docs/reference/harness/harness-class.md +3 -137
  94. package/.docs/reference/harness/session.md +128 -2
  95. package/.docs/reference/index.md +1 -0
  96. package/.docs/reference/tools/mcp-client.md +11 -0
  97. package/.docs/reference/voice/google-gemini-live.md +22 -0
  98. package/.docs/reference/workspace/archil-filesystem.md +203 -0
  99. package/.docs/reference/workspace/gcs-filesystem.md +1 -0
  100. package/.docs/reference/workspace/s3-filesystem.md +1 -0
  101. package/CHANGELOG.md +8 -0
  102. package/package.json +5 -5
@@ -16,7 +16,10 @@ Direct access to individual AI model providers. Each provider offers unique mode
16
16
  - [Alibaba (China)](https://mastra.ai/models/providers/alibaba-cn)
17
17
  - [Alibaba Coding Plan](https://mastra.ai/models/providers/alibaba-coding-plan)
18
18
  - [Alibaba Coding Plan (China)](https://mastra.ai/models/providers/alibaba-coding-plan-cn)
19
+ - [Alibaba Token Plan](https://mastra.ai/models/providers/alibaba-token-plan)
20
+ - [Alibaba Token Plan (China)](https://mastra.ai/models/providers/alibaba-token-plan-cn)
19
21
  - [Ambient](https://mastra.ai/models/providers/ambient)
22
+ - [AnyAPI](https://mastra.ai/models/providers/anyapi)
20
23
  - [Atomic Chat](https://mastra.ai/models/providers/atomic-chat)
21
24
  - [Auriko](https://mastra.ai/models/providers/auriko)
22
25
  - [Bailing](https://mastra.ai/models/providers/bailing)
@@ -37,8 +40,8 @@ Direct access to individual AI model providers. Each provider offers unique mode
37
40
  - [DInference](https://mastra.ai/models/providers/dinference)
38
41
  - [evroc](https://mastra.ai/models/providers/evroc)
39
42
  - [FastRouter](https://mastra.ai/models/providers/fastrouter)
40
- - [Fireworks (Firepass)](https://mastra.ai/models/providers/firepass)
41
43
  - [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
44
+ - [FreeModel](https://mastra.ai/models/providers/freemodel)
42
45
  - [Friendli](https://mastra.ai/models/providers/friendli)
43
46
  - [FrogBot](https://mastra.ai/models/providers/frogbot)
44
47
  - [GitHub Models](https://mastra.ai/models/providers/github-models)
@@ -58,8 +61,9 @@ Direct access to individual AI model providers. Each provider offers unique mode
58
61
  - [Lilac](https://mastra.ai/models/providers/lilac)
59
62
  - [Llama](https://mastra.ai/models/providers/llama)
60
63
  - [LLM Gateway](https://mastra.ai/models/providers/llmgateway)
64
+ - [LLMTR](https://mastra.ai/models/providers/llmtr)
61
65
  - [LMStudio](https://mastra.ai/models/providers/lmstudio)
62
- - [LucidQuery AI](https://mastra.ai/models/providers/lucidquery)
66
+ - [LucidQuery](https://mastra.ai/models/providers/lucidquery)
63
67
  - [Meganova](https://mastra.ai/models/providers/meganova)
64
68
  - [MiniMax (minimax.io)](https://mastra.ai/models/providers/minimax)
65
69
  - [MiniMax (minimaxi.com)](https://mastra.ai/models/providers/minimax-cn)
@@ -74,6 +78,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
74
78
  - [NanoGPT](https://mastra.ai/models/providers/nano-gpt)
75
79
  - [NEAR AI Cloud](https://mastra.ai/models/providers/nearai)
76
80
  - [Nebius Token Factory](https://mastra.ai/models/providers/nebius)
81
+ - [Neon](https://mastra.ai/models/providers/neon)
77
82
  - [Neuralwatt](https://mastra.ai/models/providers/neuralwatt)
78
83
  - [Nova](https://mastra.ai/models/providers/nova)
79
84
  - [NovitaAI](https://mastra.ai/models/providers/novita-ai)
@@ -86,6 +91,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
86
91
  - [Perplexity](https://mastra.ai/models/providers/perplexity)
87
92
  - [Perplexity Agent](https://mastra.ai/models/providers/perplexity-agent)
88
93
  - [Poe](https://mastra.ai/models/providers/poe)
94
+ - [Poolside](https://mastra.ai/models/providers/poolside)
89
95
  - [Privatemode AI](https://mastra.ai/models/providers/privatemode-ai)
90
96
  - [QiHang](https://mastra.ai/models/providers/qihang-ai)
91
97
  - [Qiniu](https://mastra.ai/models/providers/qiniu-ai)
@@ -96,15 +102,17 @@ Direct access to individual AI model providers. Each provider offers unique mode
96
102
  - [Scaleway](https://mastra.ai/models/providers/scaleway)
97
103
  - [SiliconFlow](https://mastra.ai/models/providers/siliconflow)
98
104
  - [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn)
105
+ - [Snowflake Cortex](https://mastra.ai/models/providers/snowflake-cortex)
99
106
  - [STACKIT](https://mastra.ai/models/providers/stackit)
100
107
  - [StepFun](https://mastra.ai/models/providers/stepfun)
101
- - [StepFun](https://mastra.ai/models/providers/stepfun-ai)
108
+ - [StepFun AI](https://mastra.ai/models/providers/stepfun-ai)
102
109
  - [submodel](https://mastra.ai/models/providers/submodel)
103
110
  - [Synthetic](https://mastra.ai/models/providers/synthetic)
104
111
  - [Tencent Coding Plan (China)](https://mastra.ai/models/providers/tencent-coding-plan)
105
112
  - [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
106
113
  - [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
107
114
  - [Together AI](https://mastra.ai/models/providers/togetherai)
115
+ - [Umans AI](https://mastra.ai/models/providers/umans-ai)
108
116
  - [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan)
109
117
  - [Upstage](https://mastra.ai/models/providers/upstage)
110
118
  - [Vivgrid](https://mastra.ai/models/providers/vivgrid)
@@ -118,6 +126,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
118
126
  - [Xpersona](https://mastra.ai/models/providers/xpersona)
119
127
  - [Z.AI](https://mastra.ai/models/providers/zai)
120
128
  - [Z.AI Coding Plan](https://mastra.ai/models/providers/zai-coding-plan)
129
+ - [Zeldoc](https://mastra.ai/models/providers/zeldoc)
121
130
  - [ZenMux](https://mastra.ai/models/providers/zenmux)
122
131
  - [Zhipu AI](https://mastra.ai/models/providers/zhipuai)
123
132
  - [Zhipu AI Coding Plan](https://mastra.ai/models/providers/zhipuai-coding-plan)
@@ -215,7 +215,7 @@ agent.sendMessage('Continue with the next step.', {
215
215
  })
216
216
  ```
217
217
 
218
- Returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the message to memory.
218
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the message: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the message is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the message and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored message. `accepted` resolves for routing — a generation error on a `wake` run surfaces through `output.consumeStream()` — and rejects only when the message could not be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the message to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
219
219
 
220
220
  ### `queueMessage(message, options)`
221
221
 
@@ -228,7 +228,7 @@ agent.queueMessage('Also check whether the tests need updates.', {
228
228
  })
229
229
  ```
230
230
 
231
- `queueMessage()` accepts the same `message` and `options` shape as `sendMessage()` and returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void> }`.
231
+ `queueMessage()` accepts the same `message` and `options` shape as `sendMessage()` and returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`, with the same `accepted` semantics as `sendMessage()`.
232
232
 
233
233
  ### `sendSignal(signal, options)`
234
234
 
@@ -258,7 +258,20 @@ Sends a signal to an active run or memory thread.
258
258
 
259
259
  **options.ifIdle.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is idle.
260
260
 
261
- Returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory.
261
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void> }`. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `action` mirrors the winning `behavior` from `ifActive`/`ifIdle`. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored signal. `accepted` resolves for routing — a generation error on a `wake` run surfaces through `output.consumeStream()` — and rejects only when the signal could not be routed or started at all (e.g. a misconfigured agent). `persisted` is only present for `persist` behavior and resolves when Mastra finishes writing the signal to memory. On the `wake` action, `output` is the agent stream for in-process consumption.
262
+
263
+ In serverless handlers, await `accepted` and pass the `wake` output to your platform's `waitUntil` equivalent so the winning process can drain the stream after the HTTP response returns.
264
+
265
+ ```typescript
266
+ const result = agent.sendSignal(signal, { resourceId, threadId })
267
+ ctx.waitUntil(
268
+ result.accepted.then(async accepted => {
269
+ if (accepted.action === 'wake') {
270
+ await accepted.output.consumeStream()
271
+ }
272
+ }),
273
+ )
274
+ ```
262
275
 
263
276
  ### `sendStateSignal(state, options)`
264
277
 
@@ -306,7 +319,7 @@ const result = await agent.sendStateSignal(
306
319
 
307
320
  **options** (`object`): Targeting and delivery behavior for the state signal. Accepts the same options as \`sendSignal()\`.
308
321
 
309
- Returns `{ accepted: true, runId: string, signal: CreatedAgentSignal, persisted?: Promise<void>, skipped?: false }` when Mastra accepts new state. Returns `{ accepted: true, skipped: true, reason: 'unchanged' }` when the same `cacheKey` and mode are already current for the state lane.
322
+ Returns `{ accepted: Promise<SendAgentSignalAccepted>, signal: CreatedAgentSignal, persisted?: Promise<void>, skipped?: false }` when Mastra accepts new state. Returns `{ skipped: true, reason: 'unchanged' }` when the same `cacheKey` and mode are already current for the state lane. `accepted` resolves at decision-time, once Mastra decides what to do with the signal: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run (including when this process loses a cross-process wake race), or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` is the authoritative id of the run that handled the signal and is present only on `wake` and `deliver`; for `persist`/`discard` use `result.signal.id` to correlate the stored signal. On the `wake` action, `output` is the agent stream for in-process consumption.
310
323
 
311
324
  ### `sendNotificationSignal(notification, options)`
312
325
 
@@ -358,7 +371,7 @@ const result = await agent.sendNotificationSignal(
358
371
 
359
372
  **options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when an immediate notification wakes an idle thread.
360
373
 
361
- Returns `{ accepted: true, record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread.
374
+ Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
362
375
 
363
376
  Default delivery is priority-aware. `urgent` notifications deliver immediately. `high` notifications deliver immediately when the thread is idle; when the thread is active, Mastra emits a summary immediately and keeps `deliverAt` for later full delivery when the thread is idle. `medium` notifications deliver immediately when idle and batch into summaries when active. `low` notifications batch into summaries in both active and idle threads; idle low-priority summaries reach subscribers without waking the model loop. For the full flow, visit [Signals](https://mastra.ai/docs/agents/signals).
364
377
 
@@ -134,7 +134,7 @@ await harness.sendMessage({ content: 'Hello!' })
134
134
 
135
135
  **modelUseCountProvider** (`ModelUseCountProvider`): Provides per-model use counts for sorting and display in \`listAvailableModels()\`.
136
136
 
137
- **modelUseCountTracker** (`ModelUseCountTracker`): Callback invoked when a model is selected via \`switchModel()\`. Use to track and persist model usage for ranking.
137
+ **modelUseCountTracker** (`ModelUseCountTracker`): Callback invoked when a model is selected via \`session.model.switch()\`. Use to track and persist model usage for ranking.
138
138
 
139
139
  **customModelCatalogProvider** (`CustomModelCatalogProvider`): Catalog hook for additional models (e.g., user-defined custom providers). Returned entries are merged into \`listAvailableModels()\`.
140
140
 
@@ -234,45 +234,9 @@ const modes = harness.listModes()
234
234
 
235
235
  To read the active mode, use [`session.mode.get()`](https://mastra.ai/reference/harness/session); to resolve it to a full `HarnessMode`, use [`session.mode.resolve()`](https://mastra.ai/reference/harness/session).
236
236
 
237
- #### `switchMode({ modeId })`
238
-
239
- Switch to a different mode. Aborts any in-progress generation, saves the current model to the outgoing mode, loads the incoming mode's model, and emits `mode_changed` and `model_changed` events.
240
-
241
- ```typescript
242
- await harness.switchMode({ modeId: 'build' })
243
- ```
244
-
245
237
  ### Models
246
238
 
247
- To read the active model ID, use [`session.model.get()`](https://mastra.ai/reference/harness/session); to check whether a model is selected, use [`session.model.hasSelection()`](https://mastra.ai/reference/harness/session).
248
-
249
- #### `getModelName()`
250
-
251
- Return a short display name from the current model ID. For example, `"claude-sonnet-4"` from `"anthropic/claude-sonnet-4"`.
252
-
253
- ```typescript
254
- const name = harness.getModelName()
255
- ```
256
-
257
- #### `getFullModelId()`
258
-
259
- Return the complete model ID string.
260
-
261
- ```typescript
262
- const fullId = harness.getFullModelId()
263
- ```
264
-
265
- #### `switchModel({ modelId, scope?, modeId? })`
266
-
267
- Switch the active model. When `scope` is `'thread'`, the model ID is persisted to thread metadata so it's restored when switching back. Emits a `model_changed` event.
268
-
269
- ```typescript
270
- // Set for current session only
271
- await harness.switchModel({ modelId: 'anthropic/claude-sonnet-4-6' })
272
-
273
- // Persist to the current thread
274
- await harness.switchModel({ modelId: 'anthropic/claude-sonnet-4-6', scope: 'thread' })
275
- ```
239
+ To read the active model ID, use [`session.model.get()`](https://mastra.ai/reference/harness/session); for a short display name, use [`session.model.displayName()`](https://mastra.ai/reference/harness/session); to check whether a model is selected, use [`session.model.hasSelection()`](https://mastra.ai/reference/harness/session).
276
240
 
277
241
  #### `getCurrentModelAuthStatus()`
278
242
 
@@ -469,33 +433,6 @@ harness.respondToToolSuspension({
469
433
 
470
434
  ### Permissions
471
435
 
472
- The harness owns the permission _policy_ — the rules that decide when a tool requires approval. Session-scoped _grants_ (which tools and categories are auto-approved for the current conversation) live on the session: see [`session.grantCategory()`](https://mastra.ai/reference/harness/session), [`session.grantTool()`](https://mastra.ai/reference/harness/session), and [`session.getGrants()`](https://mastra.ai/reference/harness/session).
473
-
474
- #### `setPermissionForCategory({ category, policy })`
475
-
476
- Set the permission policy for a tool category.
477
-
478
- ```typescript
479
- harness.setPermissionForCategory({ category: 'execute', policy: 'ask' })
480
- ```
481
-
482
- #### `setPermissionForTool({ toolName, policy })`
483
-
484
- Set the permission policy for a specific tool. Per-tool policies take precedence over category policies.
485
-
486
- ```typescript
487
- harness.setPermissionForTool({ toolName: 'dangerous_tool', policy: 'deny' })
488
- ```
489
-
490
- #### `getPermissionRules()`
491
-
492
- Return the current permission rules.
493
-
494
- ```typescript
495
- const rules = harness.getPermissionRules()
496
- // { categories: { execute: 'ask' }, tools: { dangerous_tool: 'deny' } }
497
- ```
498
-
499
436
  #### `getToolCategory({ toolName })`
500
437
 
501
438
  Resolve a tool's category using the configured `toolCategoryResolver`.
@@ -575,78 +512,7 @@ if (record) {
575
512
  }
576
513
  ```
577
514
 
578
- #### `getObserverModelId()`
579
-
580
- Return the observer model ID from state or the default from `omConfig`.
581
-
582
- ```typescript
583
- const modelId = harness.getObserverModelId()
584
- ```
585
-
586
- #### `getReflectorModelId()`
587
-
588
- Return the reflector model ID from state or the default from `omConfig`.
589
-
590
- ```typescript
591
- const modelId = harness.getReflectorModelId()
592
- ```
593
-
594
- #### `switchObserverModel({ modelId })`
595
-
596
- Switch the observer model. Persists the setting to thread metadata and emits an `om_model_changed` event.
597
-
598
- ```typescript
599
- await harness.switchObserverModel({ modelId: 'anthropic/claude-haiku-4-5' })
600
- ```
601
-
602
- #### `switchReflectorModel({ modelId })`
603
-
604
- Switch the reflector model. Persists the setting to thread metadata and emits an `om_model_changed` event.
605
-
606
- ```typescript
607
- await harness.switchReflectorModel({ modelId: 'anthropic/claude-haiku-4-5' })
608
- ```
609
-
610
- #### `getObservationThreshold()`
611
-
612
- Return the observation threshold in tokens from state or the default from `omConfig`.
613
-
614
- ```typescript
615
- const threshold = harness.getObservationThreshold()
616
- ```
617
-
618
- #### `getReflectionThreshold()`
619
-
620
- Return the reflection threshold in tokens from state or the default from `omConfig`.
621
-
622
- ```typescript
623
- const threshold = harness.getReflectionThreshold()
624
- ```
625
-
626
- ### Subagents
627
-
628
- #### `getSubagentModelId({ agentType? })`
629
-
630
- Retrieve the subagent model ID. Prioritizes per-type settings over the global setting.
631
-
632
- ```typescript
633
- const modelId = harness.getSubagentModelId({ agentType: 'explore' })
634
- ```
635
-
636
- #### `setSubagentModelId({ modelId, agentType? })`
637
-
638
- Set the subagent model ID. Pass an `agentType` to set a per-type override, or omit it to set the global default. Persists to thread settings and emits a `subagent_model_changed` event.
639
-
640
- ```typescript
641
- // Set global subagent model
642
- await harness.setSubagentModelId({ modelId: 'anthropic/claude-sonnet-4-6' })
643
-
644
- // Set per-type model
645
- await harness.setSubagentModelId({
646
- modelId: 'anthropic/claude-haiku-4-5',
647
- agentType: 'explore',
648
- })
649
- ```
515
+ The observer/reflector model selection and observation/reflection thresholds live on the Session under [`session.om`](https://mastra.ai/reference/harness/session), grouped by role. Read them with `session.om.observer.modelId()` / `session.om.reflector.modelId()` and `session.om.observer.threshold()` / `session.om.reflector.threshold()`, and change a role's model with `session.om.observer.switchModel()` / `session.om.reflector.switchModel()`.
650
516
 
651
517
  ### Forked subagents
652
518
 
@@ -221,7 +221,7 @@ await harness.session.thread.deleteSetting({ key: 'omThreshold' })
221
221
 
222
222
  ## Mode
223
223
 
224
- `session.mode` owns the active mode selection. Switching modes is performed on the [`Harness`](https://mastra.ai/reference/harness/harness-class) because it emits events and rebinds the stream.
224
+ `session.mode` owns the active mode selection.
225
225
 
226
226
  ### `session.mode.get()`
227
227
 
@@ -239,9 +239,17 @@ Return the full `HarnessMode` object for the active mode, resolved against the h
239
239
  const mode = harness.session.mode.resolve()
240
240
  ```
241
241
 
242
+ ### `session.mode.switch({ modeId })`
243
+
244
+ Switch to a different mode. Aborts any in-progress generation, saves the current model to the outgoing mode, loads the incoming mode's model, and emits `mode_changed` and `model_changed` events.
245
+
246
+ ```typescript
247
+ await harness.session.mode.switch({ modeId: 'build' })
248
+ ```
249
+
242
250
  ## Model
243
251
 
244
- `session.model` owns the active model selection, including per-mode model memory. Switching models is performed on the [`Harness`](https://mastra.ai/reference/harness/harness-class).
252
+ `session.model` owns the active model selection, including per-mode model memory.
245
253
 
246
254
  ### `session.model.get()`
247
255
 
@@ -251,6 +259,14 @@ Return the active model ID.
251
259
  const modelId = harness.session.model.get()
252
260
  ```
253
261
 
262
+ ### `session.model.displayName()`
263
+
264
+ Return a short display name for the active model: the last segment of the model ID (for example, `claude-sonnet-4` from `anthropic/claude-sonnet-4`). Returns `'unknown'` when no model is selected.
265
+
266
+ ```typescript
267
+ const name = harness.session.model.displayName()
268
+ ```
269
+
254
270
  ### `session.model.hasSelection()`
255
271
 
256
272
  Check whether a model is currently selected.
@@ -261,6 +277,116 @@ if (harness.session.model.hasSelection()) {
261
277
  }
262
278
  ```
263
279
 
280
+ ### `session.model.switch({ modelId, scope?, modeId? })`
281
+
282
+ Switch the active model. When `scope` is `'thread'` (the default), the model ID is persisted as the per-mode model so it's restored when switching back. Reports the selection to the harness's `modelUseCountTracker` and emits a `model_changed` event.
283
+
284
+ ```typescript
285
+ // Set for the current session only
286
+ await harness.session.model.switch({
287
+ modelId: 'anthropic/claude-sonnet-4-6',
288
+ scope: 'global',
289
+ })
290
+
291
+ // Persist to the current thread (default)
292
+ await harness.session.model.switch({ modelId: 'anthropic/claude-sonnet-4-6' })
293
+ ```
294
+
295
+ ## Observational Memory
296
+
297
+ The observational-memory model selection, grouped by role under `session.om.observer` and `session.om.reflector`. Both roles expose the same methods. Reads return the value from session state when set, falling back to the harness's `omConfig` defaults.
298
+
299
+ ### `session.om.observer.modelId()` / `session.om.reflector.modelId()`
300
+
301
+ Return the role's model ID, or `undefined` when neither session state nor `omConfig` provides one.
302
+
303
+ ```typescript
304
+ const observer = harness.session.om.observer.modelId()
305
+ const reflector = harness.session.om.reflector.modelId()
306
+ ```
307
+
308
+ ### `session.om.observer.threshold()` / `session.om.reflector.threshold()`
309
+
310
+ Return the role's threshold in tokens (observation threshold for the observer, reflection threshold for the reflector), or `undefined` when unset.
311
+
312
+ ```typescript
313
+ const observationThreshold = harness.session.om.observer.threshold()
314
+ const reflectionThreshold = harness.session.om.reflector.threshold()
315
+ ```
316
+
317
+ ### `session.om.observer.switchModel({ modelId })` / `session.om.reflector.switchModel({ modelId })`
318
+
319
+ Switch the role's model. Persists the setting to thread metadata and emits an `om_model_changed` event.
320
+
321
+ ```typescript
322
+ await harness.session.om.observer.switchModel({ modelId: 'anthropic/claude-haiku-4-5' })
323
+ await harness.session.om.reflector.switchModel({ modelId: 'anthropic/claude-haiku-4-5' })
324
+ ```
325
+
326
+ ### `session.om.observer.resolvedModel()` / `session.om.reflector.resolvedModel()`
327
+
328
+ Resolve the role's model ID to a model instance via the harness's `resolveModel`, or `undefined` when no model ID is set or no resolver is configured.
329
+
330
+ ```typescript
331
+ const observerModel = harness.session.om.observer.resolvedModel()
332
+ ```
333
+
334
+ ## Permissions
335
+
336
+ `session.permissions` owns the persisted tool-approval _policy_ — the per-category and per-tool rules consulted during approval resolution. These are distinct from the in-memory session _grants_ documented under [Methods → Permissions](#permissions); grants reset each session, whereas these rules are persisted in session state.
337
+
338
+ ### `session.permissions.getRules()`
339
+
340
+ Return the current permission rules, or empty rules (`{ categories: {}, tools: {} }`) when none are set.
341
+
342
+ ```typescript
343
+ const rules = harness.session.permissions.getRules()
344
+ // { categories: { execute: 'ask' }, tools: { dangerous_tool: 'deny' } }
345
+ ```
346
+
347
+ ### `session.permissions.setForCategory({ category, policy })`
348
+
349
+ Set the approval policy (`'allow' | 'ask' | 'deny'`) for a tool category. Resolves once the change is persisted to session state.
350
+
351
+ ```typescript
352
+ await harness.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
353
+ ```
354
+
355
+ ### `session.permissions.setForTool({ toolName, policy })`
356
+
357
+ Set the approval policy for a specific tool. Per-tool policies take precedence over category policies. Resolves once persisted.
358
+
359
+ ```typescript
360
+ await harness.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
361
+ ```
362
+
363
+ ## Subagents
364
+
365
+ `session.subagents` owns subagent configuration. It currently exposes the subagent model selection under `session.subagents.model`.
366
+
367
+ ### `session.subagents.model.get({ agentType? })`
368
+
369
+ Return the subagent model ID, preferring the per-`agentType` value when one is given, then the global subagent model, or `null` when neither is set.
370
+
371
+ ```typescript
372
+ const modelId = harness.session.subagents.model.get({ agentType: 'explore' })
373
+ ```
374
+
375
+ ### `session.subagents.model.set({ modelId, agentType? })`
376
+
377
+ Set the subagent model ID. Pass an `agentType` to set a per-type override, or omit it to set the global default. Persists to thread settings and emits a `subagent_model_changed` event.
378
+
379
+ ```typescript
380
+ // Set the global subagent model
381
+ await harness.session.subagents.model.set({ modelId: 'anthropic/claude-sonnet-4-6' })
382
+
383
+ // Set a per-type override
384
+ await harness.session.subagents.model.set({
385
+ modelId: 'anthropic/claude-haiku-4-5',
386
+ agentType: 'explore',
387
+ })
388
+ ```
389
+
264
390
  ## Run
265
391
 
266
392
  `session.run` owns run and trace identity plus abort state for the in-flight run.
@@ -335,6 +335,7 @@ The Reference section provides documentation of Mastra's API, including paramete
335
335
  - [.timeTravel()](https://mastra.ai/reference/workflows/run-methods/timeTravel)
336
336
  - [AgentCoreRuntimeSandbox](https://mastra.ai/reference/workspace/agentcore-runtime-sandbox)
337
337
  - [AgentFSFilesystem](https://mastra.ai/reference/workspace/agentfs-filesystem)
338
+ - [ArchilFilesystem](https://mastra.ai/reference/workspace/archil-filesystem)
338
339
  - [AzureBlobFilesystem](https://mastra.ai/reference/workspace/azure-blob-filesystem)
339
340
  - [BlaxelSandbox](https://mastra.ai/reference/workspace/blaxel-sandbox)
340
341
  - [DaytonaSandbox](https://mastra.ai/reference/workspace/daytona-sandbox)
@@ -167,6 +167,17 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
167
167
  new Agent({ id: 'agent', tools: await mcp.listTools() })
168
168
  ```
169
169
 
170
+ ### `listToolsWithErrors()`
171
+
172
+ Retrieves all tools from all configured servers, with tool names namespaced by their server name. Also returns per-server errors for servers that failed to connect or list tools.
173
+
174
+ ```typescript
175
+ const { tools, errors } = await mcp.listToolsWithErrors()
176
+
177
+ new Agent({ id: 'agent', tools })
178
+ console.log(errors)
179
+ ```
180
+
170
181
  ### `listToolsets()`
171
182
 
172
183
  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.
@@ -146,6 +146,28 @@ Converts text to speech and sends it to the model. Can accept either a string or
146
146
 
147
147
  Returns: `Promise<void>` (responses are emitted via `speaker` and `writing` events)
148
148
 
149
+ ### `sendContext()`
150
+
151
+ Sends conversation history into the live session without triggering a model response. Use this to seed prior turns (e.g. from Mastra Memory) on a cold connect so the model has context before the user speaks.
152
+
153
+ ```typescript
154
+ await voice.sendContext([
155
+ { role: 'user', content: 'What is the weather?' },
156
+ { role: 'assistant', content: 'It is 72°F in San Francisco.' },
157
+ ])
158
+
159
+ // Model stays silent until the user actually speaks.
160
+ await voice.send(micStream)
161
+ ```
162
+
163
+ **turns** (`IncrementalTurn[]`): Prior conversation turns to seed into the session. Each turn has a \`role\` ("user" or "assistant") and \`content\` string. Both roles are supported on newer models (e.g. \`gemini-2.5-flash-native-audio-preview-12-2025\`). Some older models only accept user-role turns.
164
+
165
+ **options** (`object`): Optional configuration.
166
+
167
+ **options.turnComplete** (`boolean`): Whether to mark the turn as complete and trigger a model response.
168
+
169
+ Returns: `Promise<void>`
170
+
149
171
  ### `listen()`
150
172
 
151
173
  Processes audio input for speech recognition. Takes a readable stream of audio data and returns the transcribed text.