@mastra/mcp-docs-server 1.1.42-alpha.7 → 1.1.42-alpha.8

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.
@@ -233,9 +233,24 @@ Existing stored signal rows and older clients continue to load through the compa
233
233
 
234
234
  > **Note:** Visit [Agent signals reference](https://mastra.ai/reference/agents/agent) for the full message, signal, and subscription types.
235
235
 
236
+ ## Approve tool calls
237
+
238
+ When a subscribed run pauses for tool approval, approve or decline the tool call with the subscription-native methods. The call returns a JSON acknowledgement. The resumed chunks arrive through the existing thread subscription.
239
+
240
+ ```typescript
241
+ await agent.sendToolApproval({
242
+ resourceId: 'user_123',
243
+ threadId: 'thread_456',
244
+ toolCallId: 'tool-call_456',
245
+ approved: true,
246
+ })
247
+ ```
248
+
249
+ Pass `approved: false` to decline the same pending tool call. Use the older `approveToolCall()` and `declineToolCall()` methods only when you are rendering the separate continuation stream directly.
250
+
236
251
  ## Use HTTP routes
237
252
 
238
- If you call Mastra over HTTP directly, use `POST /api/agents/:agentId/send-message` for immediate messages and `POST /api/agents/:agentId/queue-message` for next-turn messages. See [Server routes reference](https://mastra.ai/reference/server/routes) for request and response schemas.
253
+ If you call Mastra over HTTP directly, use `POST /api/agents/:agentId/send-message` for immediate messages and `POST /api/agents/:agentId/queue-message` for next-turn messages. For subscription-native tool approval, use `POST /api/agents/:agentId/send-tool-approval`. See [Server routes reference](https://mastra.ai/reference/server/routes) for request and response schemas.
239
254
 
240
255
  ## Use the client SDK
241
256
 
@@ -294,4 +309,5 @@ Use heartbeats together with client-side reconnect logic. Heartbeats reduce idle
294
309
  - [`Agent.subscribeToThread()`](https://mastra.ai/reference/agents/agent)
295
310
  - [Server agent routes](https://mastra.ai/reference/server/routes)
296
311
  - [`client.getAgent().sendSignal()`](https://mastra.ai/reference/client-js/agents)
297
- - [`client.getAgent().subscribeToThread()`](https://mastra.ai/reference/client-js/agents)
312
+ - [`client.getAgent().subscribeToThread()`](https://mastra.ai/reference/client-js/agents)
313
+ - [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
@@ -326,7 +326,7 @@ response.processDataStream({
326
326
 
327
327
  ### `approveToolCall()`
328
328
 
329
- Approve a pending tool call that requires human confirmation:
329
+ Approve a pending tool call and return a continuation stream. Use this when you are rendering the resumed chunks from the approval response.
330
330
 
331
331
  ```typescript
332
332
  const response = await agent.approveToolCall({
@@ -341,9 +341,26 @@ response.processDataStream({
341
341
  })
342
342
  ```
343
343
 
344
+ ### `sendToolApproval()`
345
+
346
+ Approve or decline a pending tool call for a subscribed thread. Use this with `subscribeToThread()` when the resumed chunks should arrive through the existing thread subscription instead of a separate continuation stream.
347
+
348
+ ```typescript
349
+ const result = await agent.sendToolApproval({
350
+ resourceId: 'user-123',
351
+ threadId: 'thread-456',
352
+ toolCallId: 'tool-call-456',
353
+ approved: true,
354
+ })
355
+
356
+ console.log(result.accepted)
357
+ ```
358
+
359
+ Returns `{ accepted: true, runId: string, toolCallId?: string }`.
360
+
344
361
  ### `declineToolCall()`
345
362
 
346
- Decline a pending tool call that requires human confirmation:
363
+ Decline a pending tool call and return a continuation stream. Use this when you are rendering the resumed chunks from the decline response.
347
364
 
348
365
  ```typescript
349
366
  const response = await agent.declineToolCall({
@@ -4,19 +4,20 @@ Server adapters register these routes when you call `server.init()`. All routes
4
4
 
5
5
  ## Agents
6
6
 
7
- | Method | Path | Description |
8
- | ------ | -------------------------------------------- | ----------------------------------------------------- |
9
- | `GET` | `/api/agents` | List all agents |
10
- | `GET` | `/api/agents/:agentId` | Get agent by ID (supports version query params) |
11
- | `POST` | `/api/agents/:agentId/generate` | Generate agent response |
12
- | `POST` | `/api/agents/:agentId/stream` | Stream agent response |
13
- | `POST` | `/api/agents/:agentId/send-message` | Send a user message to an active or idle thread |
14
- | `POST` | `/api/agents/:agentId/queue-message` | Queue a user message for the next thread turn |
15
- | `POST` | `/api/agents/:agentId/signals` | Send a lower-level signal to an active or idle thread |
16
- | `POST` | `/api/agents/:agentId/subscribe-thread` | Subscribe to a thread stream |
17
- | `POST` | `/api/agents/:agentId/resume-stream` | Resume a suspended agent stream with custom data |
18
- | `GET` | `/api/agents/:agentId/tools` | List agent tools |
19
- | `POST` | `/api/agents/:agentId/tools/:toolId/execute` | Execute agent tool |
7
+ | Method | Path | Description |
8
+ | ------ | -------------------------------------------- | ----------------------------------------------------------------------- |
9
+ | `GET` | `/api/agents` | List all agents |
10
+ | `GET` | `/api/agents/:agentId` | Get agent by ID (supports version query params) |
11
+ | `POST` | `/api/agents/:agentId/generate` | Generate agent response |
12
+ | `POST` | `/api/agents/:agentId/stream` | Stream agent response |
13
+ | `POST` | `/api/agents/:agentId/send-message` | Send a user message to an active or idle thread |
14
+ | `POST` | `/api/agents/:agentId/queue-message` | Queue a user message for the next thread turn |
15
+ | `POST` | `/api/agents/:agentId/signals` | Send a lower-level signal to an active or idle thread |
16
+ | `POST` | `/api/agents/:agentId/threads/subscribe` | Subscribe to a thread stream |
17
+ | `POST` | `/api/agents/:agentId/send-tool-approval` | Approve or decline a tool call and resume through a thread subscription |
18
+ | `POST` | `/api/agents/:agentId/resume-stream` | Resume a suspended agent stream with custom data |
19
+ | `GET` | `/api/agents/:agentId/tools` | List agent tools |
20
+ | `POST` | `/api/agents/:agentId/tools/:toolId/execute` | Execute agent tool |
20
21
 
21
22
  ### Get agent query parameters
22
23
 
@@ -140,6 +141,32 @@ Both routes return:
140
141
  }
141
142
  ```
142
143
 
144
+ ### Subscription tool approval routes
145
+
146
+ Use `POST /api/agents/:agentId/send-tool-approval` when the client already has an active thread subscription. The route resumes the run and returns a JSON acknowledgement. Resumed stream chunks are delivered through `POST /api/agents/:agentId/threads/subscribe`.
147
+
148
+ The route accepts this request body:
149
+
150
+ ```typescript
151
+ {
152
+ resourceId: string;
153
+ threadId: string;
154
+ toolCallId: string;
155
+ approved: boolean;
156
+ requestContext?: Record<string, unknown>;
157
+ }
158
+ ```
159
+
160
+ The route returns:
161
+
162
+ ```typescript
163
+ {
164
+ accepted: true;
165
+ runId: string;
166
+ toolCallId?: string;
167
+ }
168
+ ```
169
+
143
170
  ## Workflows
144
171
 
145
172
  | Method | Path | Description |
@@ -242,7 +242,9 @@ The GeminiLiveVoice class emits the following events:
242
242
 
243
243
  **speaking** (`event`): Emitted with audio metadata. Callback receives { audioData?: Int16Array, sampleRate?: number }.
244
244
 
245
- **writing** (`event`): Emitted when transcribed text is available. Callback receives { text: string, role: 'assistant' | 'user' }.
245
+ **writing** (`event`): Emitted when transcribed text is available. Callback receives { text: string, role: 'assistant' | 'user' }. On native-audio models the assistant transcript is driven by the server's \`output\_audio\_transcription\` channel rather than \`modelTurn.parts.text\`.
246
+
247
+ **thinking** (`event`): Emitted on native-audio models with the model's chain-of-thought / reasoning text from \`modelTurn.parts.text\`. Callback receives { text: string }. Does not fire on non-native-audio models, where \`modelTurn.parts.text\` is the spoken response and is emitted as \`writing\` instead.
246
248
 
247
249
  **session** (`event`): Emitted on session state changes. Callback receives { state: 'connecting' | 'connected' | 'disconnected' | 'disconnecting' | 'updated', config?: object }.
248
250
 
@@ -254,7 +256,18 @@ The GeminiLiveVoice class emits the following events:
254
256
 
255
257
  **error** (`event`): Emitted when an error occurs. Callback receives { message: string, code?: string, details?: unknown }.
256
258
 
257
- **interrupt** (`event`): Interrupt events. Callback receives { type: 'user' | 'model', timestamp: number }.
259
+ **interrupt** (`event`): Emitted on barge-in when the user starts speaking over an in-flight model response. The server cancels any further audio for the current turn. Callback receives { type: 'user', timestamp: number }.
260
+
261
+ ## Native-audio behavior
262
+
263
+ Native-audio Gemini Live models — any model whose ID contains `native-audio`, such as `gemini-2.5-flash-native-audio-preview-12-2025` — split text output across two channels:
264
+
265
+ - The model's spoken reply is delivered as audio plus an `output_audio_transcription` transcript and surfaced as `writing` with `role: 'assistant'`.
266
+ - The model's internal reasoning is delivered as `modelTurn.parts.text` and surfaced as `thinking`.
267
+
268
+ On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing`; the `thinking` event does not fire.
269
+
270
+ Input transcription, output transcription, and barge-in detection (`realtime_input_config.activity_handling = 'START_OF_ACTIVITY_INTERRUPTS'`) are enabled automatically in the setup payload — no extra configuration is required.
258
271
 
259
272
  ## Available models
260
273
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.1.42-alpha.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`19a8658`](https://github.com/mastra-ai/mastra/commit/19a86589c788ef48bb6c1b0612cc82a201857379), [`a659a77`](https://github.com/mastra-ai/mastra/commit/a659a779bdebe3a52a518c56d2260592d0240fe0), [`3332be9`](https://github.com/mastra-ai/mastra/commit/3332be9701ecd77aba840959d9a1d1ce7aef02d3)]:
8
+ - @mastra/core@1.38.0-alpha.6
9
+
3
10
  ## 1.1.42-alpha.7
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.1.42-alpha.7",
3
+ "version": "1.1.42-alpha.8",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "jsdom": "^26.1.0",
29
29
  "local-pkg": "^1.1.2",
30
30
  "zod": "^4.4.3",
31
- "@mastra/core": "1.38.0-alpha.5",
32
- "@mastra/mcp": "^1.9.0-alpha.0"
31
+ "@mastra/mcp": "^1.9.0-alpha.0",
32
+ "@mastra/core": "1.38.0-alpha.6"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.11",
@@ -45,9 +45,9 @@
45
45
  "tsx": "^4.21.0",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "4.1.5",
48
+ "@internal/lint": "0.0.99",
48
49
  "@internal/types-builder": "0.0.74",
49
- "@mastra/core": "1.38.0-alpha.5",
50
- "@internal/lint": "0.0.99"
50
+ "@mastra/core": "1.38.0-alpha.6"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {