@mastra/mcp-docs-server 1.1.32-alpha.5 → 1.1.32-alpha.6
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.
|
@@ -327,19 +327,20 @@ For the complete list of supported AI SDK providers and their capabilities:
|
|
|
327
327
|
|
|
328
328
|
Mastra supports multiple voice providers for text-to-speech (TTS) and speech-to-text (STT) capabilities:
|
|
329
329
|
|
|
330
|
-
| Provider | Package | Features
|
|
331
|
-
| --------------- | ------------------------------- |
|
|
332
|
-
| OpenAI | `@mastra/voice-openai` | TTS, STT
|
|
333
|
-
| OpenAI Realtime | `@mastra/voice-openai-realtime` | Realtime speech-to-speech
|
|
334
|
-
|
|
|
335
|
-
|
|
|
336
|
-
|
|
|
337
|
-
|
|
|
338
|
-
|
|
|
339
|
-
|
|
|
340
|
-
|
|
|
341
|
-
|
|
|
342
|
-
|
|
|
330
|
+
| Provider | Package | Features | Reference |
|
|
331
|
+
| --------------- | ------------------------------- | ----------------------------------------- | ------------------------------------------------------------------ |
|
|
332
|
+
| OpenAI | `@mastra/voice-openai` | TTS, STT | [Documentation](https://mastra.ai/reference/voice/openai) |
|
|
333
|
+
| OpenAI Realtime | `@mastra/voice-openai-realtime` | Realtime speech-to-speech | [Documentation](https://mastra.ai/reference/voice/openai-realtime) |
|
|
334
|
+
| AWS Nova Sonic | `@mastra/voice-aws-nova-sonic` | Realtime speech-to-speech via AWS Bedrock | [Documentation](https://mastra.ai/reference/voice/aws-nova-sonic) |
|
|
335
|
+
| ElevenLabs | `@mastra/voice-elevenlabs` | High-quality TTS | [Documentation](https://mastra.ai/reference/voice/elevenlabs) |
|
|
336
|
+
| PlayAI | `@mastra/voice-playai` | TTS | [Documentation](https://mastra.ai/reference/voice/playai) |
|
|
337
|
+
| Google | `@mastra/voice-google` | TTS, STT | [Documentation](https://mastra.ai/reference/voice/google) |
|
|
338
|
+
| Deepgram | `@mastra/voice-deepgram` | STT | [Documentation](https://mastra.ai/reference/voice/deepgram) |
|
|
339
|
+
| Murf | `@mastra/voice-murf` | TTS | [Documentation](https://mastra.ai/reference/voice/murf) |
|
|
340
|
+
| Speechify | `@mastra/voice-speechify` | TTS | [Documentation](https://mastra.ai/reference/voice/speechify) |
|
|
341
|
+
| Sarvam | `@mastra/voice-sarvam` | TTS, STT | [Documentation](https://mastra.ai/reference/voice/sarvam) |
|
|
342
|
+
| Azure | `@mastra/voice-azure` | TTS, STT | [Documentation](https://mastra.ai/reference/voice/mastra-voice) |
|
|
343
|
+
| Cloudflare | `@mastra/voice-cloudflare` | TTS | [Documentation](https://mastra.ai/reference/voice/mastra-voice) |
|
|
343
344
|
|
|
344
345
|
## Next steps
|
|
345
346
|
|
|
@@ -588,6 +588,49 @@ await voiceAgent.voice.send(micStream)
|
|
|
588
588
|
|
|
589
589
|
Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
|
|
590
590
|
|
|
591
|
+
**AWS Nova Sonic**:
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
import { Agent } from '@mastra/core/agent'
|
|
595
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
596
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
597
|
+
|
|
598
|
+
const voiceAgent = new Agent({
|
|
599
|
+
id: 'voice-agent',
|
|
600
|
+
name: 'Voice Agent',
|
|
601
|
+
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
602
|
+
model: 'openai/gpt-5.4',
|
|
603
|
+
voice: new NovaSonicVoice({
|
|
604
|
+
region: 'us-east-1',
|
|
605
|
+
speaker: 'matthew',
|
|
606
|
+
// Static credentials are optional. The default AWS credential
|
|
607
|
+
// provider chain is used when none are passed.
|
|
608
|
+
}),
|
|
609
|
+
})
|
|
610
|
+
|
|
611
|
+
// Connect before using speak/send
|
|
612
|
+
await voiceAgent.voice.connect()
|
|
613
|
+
|
|
614
|
+
// Listen for assistant audio (Int16Array PCM)
|
|
615
|
+
voiceAgent.voice.on('speaking', ({ audioData }) => {
|
|
616
|
+
if (audioData) playAudio(audioData)
|
|
617
|
+
})
|
|
618
|
+
|
|
619
|
+
// Listen for transcribed text
|
|
620
|
+
voiceAgent.voice.on('writing', ({ text, role }) => {
|
|
621
|
+
console.log(`${role}: ${text}`)
|
|
622
|
+
})
|
|
623
|
+
|
|
624
|
+
// Initiate the conversation
|
|
625
|
+
await voiceAgent.voice.speak('How can I help you today?')
|
|
626
|
+
|
|
627
|
+
// Send continuous audio from the microphone
|
|
628
|
+
const micStream = getMicrophoneStream()
|
|
629
|
+
await voiceAgent.voice.send(micStream)
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
633
|
+
|
|
591
634
|
## Voice configuration
|
|
592
635
|
|
|
593
636
|
Each voice provider can be configured with different models and options. Below are the detailed configuration options for all supported providers:
|
|
@@ -828,6 +871,28 @@ const voice = new GeminiLiveVoice({
|
|
|
828
871
|
|
|
829
872
|
Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
|
|
830
873
|
|
|
874
|
+
**AWS Nova Sonic**:
|
|
875
|
+
|
|
876
|
+
```typescript
|
|
877
|
+
// AWS Nova Sonic Voice Configuration
|
|
878
|
+
const voice = new NovaSonicVoice({
|
|
879
|
+
region: 'us-east-1',
|
|
880
|
+
speaker: 'matthew',
|
|
881
|
+
sessionConfig: {
|
|
882
|
+
inferenceConfiguration: {
|
|
883
|
+
temperature: 0.7,
|
|
884
|
+
maxTokens: 1024,
|
|
885
|
+
},
|
|
886
|
+
turnDetectionConfiguration: {
|
|
887
|
+
endpointingSensitivity: 'MEDIUM',
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
// AWS Nova Sonic is a realtime bidirectional API without separate speech and listening models
|
|
891
|
+
})
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
895
|
+
|
|
831
896
|
**AI SDK**:
|
|
832
897
|
|
|
833
898
|
```typescript
|
|
@@ -957,6 +1022,7 @@ For more information on the CompositeVoice, refer to the [CompositeVoice Referen
|
|
|
957
1022
|
- [Azure Voice](https://mastra.ai/reference/voice/azure)
|
|
958
1023
|
- [Google Voice](https://mastra.ai/reference/voice/google)
|
|
959
1024
|
- [Google Gemini Live Voice](https://mastra.ai/reference/voice/google-gemini-live)
|
|
1025
|
+
- [AWS Nova Sonic Voice](https://mastra.ai/reference/voice/aws-nova-sonic)
|
|
960
1026
|
- [Deepgram Voice](https://mastra.ai/reference/voice/deepgram)
|
|
961
1027
|
- [PlayAI Voice](https://mastra.ai/reference/voice/playai)
|
|
962
1028
|
- [Voice Examples](https://github.com/mastra-ai/voice-examples)
|
|
@@ -99,4 +99,48 @@ await agent.voice.send(micStream)
|
|
|
99
99
|
Note:
|
|
100
100
|
|
|
101
101
|
- Live API requires `GOOGLE_API_KEY`. Vertex AI requires project/location and service account credentials.
|
|
102
|
-
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
102
|
+
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
103
|
+
|
|
104
|
+
## AWS Nova Sonic (Realtime)
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { Agent } from '@mastra/core/agent'
|
|
108
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
109
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
110
|
+
|
|
111
|
+
const agent = new Agent({
|
|
112
|
+
id: 'agent',
|
|
113
|
+
name: 'Nova Sonic Agent',
|
|
114
|
+
instructions: 'You are a helpful assistant with real-time voice capabilities.',
|
|
115
|
+
// Model used for text generation; voice provider handles realtime audio
|
|
116
|
+
model: 'openai/gpt-5.4',
|
|
117
|
+
voice: new NovaSonicVoice({
|
|
118
|
+
region: 'us-east-1',
|
|
119
|
+
speaker: 'matthew',
|
|
120
|
+
// Static credentials are optional. The default AWS credential provider
|
|
121
|
+
// chain is used when none are passed.
|
|
122
|
+
}),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
await agent.voice.connect()
|
|
126
|
+
|
|
127
|
+
// Assistant audio is emitted as 16-bit PCM on the `speaking` event
|
|
128
|
+
agent.voice.on('speaking', ({ audioData }) => {
|
|
129
|
+
if (audioData) playAudio(audioData)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
agent.voice.on('writing', ({ role, text }) => {
|
|
133
|
+
console.log(`${role}: ${text}`)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
await agent.voice.speak('How can I help you today?')
|
|
137
|
+
|
|
138
|
+
const micStream = getMicrophoneStream()
|
|
139
|
+
await agent.voice.send(micStream)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Note:
|
|
143
|
+
|
|
144
|
+
- Available regions: `us-east-1`, `us-west-2`, and `ap-northeast-1`.
|
|
145
|
+
- Authenticates through the standard AWS credential provider chain. Pass `credentials` to override.
|
|
146
|
+
- Events: `speaking` (Int16Array audio), `writing` (text with `generationStage`), `toolCall`, `interrupt`, `turnComplete`, `usage`, `session`, and `error`.
|
package/.docs/reference/index.md
CHANGED
|
@@ -244,6 +244,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
244
244
|
- [Qdrant Vector Store](https://mastra.ai/reference/vectors/qdrant)
|
|
245
245
|
- [Turbopuffer Vector Store](https://mastra.ai/reference/vectors/turbopuffer)
|
|
246
246
|
- [Upstash Vector Store](https://mastra.ai/reference/vectors/upstash)
|
|
247
|
+
- [AWS Nova Sonic](https://mastra.ai/reference/voice/aws-nova-sonic)
|
|
247
248
|
- [Azure](https://mastra.ai/reference/voice/azure)
|
|
248
249
|
- [Cloudflare](https://mastra.ai/reference/voice/cloudflare)
|
|
249
250
|
- [Composite Voice](https://mastra.ai/reference/voice/composite-voice)
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AWS Nova Sonic voice
|
|
2
|
+
|
|
3
|
+
The `NovaSonicVoice` class provides real-time speech-to-speech capabilities backed by [AWS Bedrock Nova 2 Sonic](https://docs.aws.amazon.com/nova/latest/userguide/speech.html). It opens a bidirectional stream to the model and emits events for assistant audio, transcribed text, tool calls, turn boundaries, and interruptions.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
9
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
10
|
+
|
|
11
|
+
// Initialize using the default AWS credential provider chain
|
|
12
|
+
const voice = new NovaSonicVoice({
|
|
13
|
+
region: 'us-east-1',
|
|
14
|
+
speaker: 'matthew',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Or pass explicit credentials
|
|
18
|
+
const voiceWithCredentials = new NovaSonicVoice({
|
|
19
|
+
region: 'us-east-1',
|
|
20
|
+
speaker: 'tiffany',
|
|
21
|
+
credentials: {
|
|
22
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
23
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Establish the bidirectional stream
|
|
28
|
+
await voice.connect()
|
|
29
|
+
|
|
30
|
+
// Listen for assistant audio (Int16Array PCM)
|
|
31
|
+
voice.on('speaking', ({ audioData }) => {
|
|
32
|
+
if (audioData) playAudio(audioData)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Listen for transcribed text from the user and assistant
|
|
36
|
+
voice.on('writing', ({ text, role, generationStage }) => {
|
|
37
|
+
console.log(`${role} (${generationStage ?? 'FINAL'}): ${text}`)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Stream microphone audio in real time
|
|
41
|
+
const microphoneStream = getMicrophoneStream()
|
|
42
|
+
await voice.send(microphoneStream)
|
|
43
|
+
|
|
44
|
+
// Disconnect when done
|
|
45
|
+
voice.close()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Authentication
|
|
49
|
+
|
|
50
|
+
`NovaSonicVoice` uses the AWS SDK credential resolution chain when no `credentials` option is passed. Mastra calls `defaultProvider()` from `@aws-sdk/credential-provider-node`, which checks (in order) environment variables, shared credentials files, IAM role for EC2, ECS, EKS, and other standard sources.
|
|
51
|
+
|
|
52
|
+
To use static credentials, pass them on the constructor:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
new NovaSonicVoice({
|
|
56
|
+
region: 'us-east-1',
|
|
57
|
+
credentials: {
|
|
58
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
59
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
60
|
+
sessionToken: process.env.AWS_SESSION_TOKEN,
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The voice provider never logs credential values.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
### Constructor options
|
|
70
|
+
|
|
71
|
+
**region** (`'us-east-1' | 'us-west-2' | 'ap-northeast-1'`): AWS region that hosts the Nova Sonic model. (Default: `'us-east-1'`)
|
|
72
|
+
|
|
73
|
+
**model** (`string`): Bedrock model ID for the bidirectional stream. (Default: `'amazon.nova-2-sonic-v1:0'`)
|
|
74
|
+
|
|
75
|
+
**credentials** (`AwsCredentialIdentity`): Static AWS credentials. When omitted the default AWS credential provider chain is used.
|
|
76
|
+
|
|
77
|
+
**speaker** (`string | NovaSonicVoiceConfigDetails`): Default voice for the assistant. Pass a voice ID string such as 'matthew' or an object that includes a language code and gender. (Default: `'matthew'`)
|
|
78
|
+
|
|
79
|
+
**languageCode** (`NovaSonicLanguageCode`): Language code used for the session. Polyglot voices support all listed languages.
|
|
80
|
+
|
|
81
|
+
**instructions** (`string`): System prompt sent at session start. Equivalent to calling addInstructions() before connect().
|
|
82
|
+
|
|
83
|
+
**tools** (`NovaSonicToolConfig[]`): Tools exposed to the model. When the voice instance is attached to an Agent, the Agent's tools are added automatically.
|
|
84
|
+
|
|
85
|
+
**sessionConfig** (`NovaSonicSessionConfig`): Inference, turn-detection, and tool-choice configuration. See Session configuration below.
|
|
86
|
+
|
|
87
|
+
**debug** (`boolean`): Enable verbose logging for stream events. Sensitive fields are masked. (Default: `false`)
|
|
88
|
+
|
|
89
|
+
### Session configuration
|
|
90
|
+
|
|
91
|
+
`sessionConfig` controls inference parameters and turn-taking behavior. All fields are optional.
|
|
92
|
+
|
|
93
|
+
**inferenceConfiguration** (`object`): Sampling and decoding parameters.
|
|
94
|
+
|
|
95
|
+
**inferenceConfiguration.maxTokens** (`number`): Maximum tokens generated per turn.
|
|
96
|
+
|
|
97
|
+
**inferenceConfiguration.temperature** (`number`): Sampling temperature.
|
|
98
|
+
|
|
99
|
+
**inferenceConfiguration.topP** (`number`): Nucleus sampling probability.
|
|
100
|
+
|
|
101
|
+
**inferenceConfiguration.topK** (`number`): Top-k sampling.
|
|
102
|
+
|
|
103
|
+
**inferenceConfiguration.stopSequences** (`string[]`): Sequences that end generation.
|
|
104
|
+
|
|
105
|
+
**turnDetectionConfiguration** (`object`): Endpointing sensitivity for turn detection.
|
|
106
|
+
|
|
107
|
+
**turnDetectionConfiguration.endpointingSensitivity** (`'HIGH' | 'MEDIUM' | 'LOW'`): Pause duration before the model considers a turn complete. HIGH ends turns fastest (about 1.5s pause), MEDIUM is balanced (about 1.75s), LOW waits longest (about 2s).
|
|
108
|
+
|
|
109
|
+
**toolChoice** (`'auto' | 'any' | { tool: { name: string } }`): How the model decides whether to call a tool.
|
|
110
|
+
|
|
111
|
+
**enableKnowledgeGrounding** (`boolean`): Enable retrieval-augmented grounding against a Bedrock knowledge base.
|
|
112
|
+
|
|
113
|
+
**knowledgeBaseConfig** (`{ knowledgeBaseId?: string; dataSourceId?: string }`): Knowledge base used when knowledge grounding is enabled.
|
|
114
|
+
|
|
115
|
+
## Methods
|
|
116
|
+
|
|
117
|
+
### `connect()`
|
|
118
|
+
|
|
119
|
+
Opens the bidirectional stream to AWS Bedrock and sends the initial session, prompt, and system events. Call this before `speak`, `listen`, or `send`.
|
|
120
|
+
|
|
121
|
+
**options** (`{ requestContext?: RequestContext }`): Optional request context propagated to tool calls made during the session.
|
|
122
|
+
|
|
123
|
+
Returns: `Promise<void>`
|
|
124
|
+
|
|
125
|
+
### `speak()`
|
|
126
|
+
|
|
127
|
+
Synthesizes speech for a text prompt and emits `speaking` events as audio is produced.
|
|
128
|
+
|
|
129
|
+
**input** (`string | NodeJS.ReadableStream`): Text or text stream to synthesize.
|
|
130
|
+
|
|
131
|
+
**options** (`NovaSonicVoiceOptions`): Per-call overrides such as the speaker or language code.
|
|
132
|
+
|
|
133
|
+
Returns: `Promise<void>`
|
|
134
|
+
|
|
135
|
+
### `send()`
|
|
136
|
+
|
|
137
|
+
Streams microphone audio (or any PCM source) to the model. Use this for live, continuous conversation.
|
|
138
|
+
|
|
139
|
+
**audioData** (`NodeJS.ReadableStream | Int16Array`): 16-bit PCM audio to forward to the model.
|
|
140
|
+
|
|
141
|
+
Returns: `Promise<void>`
|
|
142
|
+
|
|
143
|
+
### `listen()`
|
|
144
|
+
|
|
145
|
+
Convenience wrapper that delegates to `send()`. Use it when you want a single transcription pass over a finite audio stream.
|
|
146
|
+
|
|
147
|
+
**audioData** (`NodeJS.ReadableStream`): Audio stream to transcribe.
|
|
148
|
+
|
|
149
|
+
Returns: `Promise<void>`
|
|
150
|
+
|
|
151
|
+
### `endAudioInput()`
|
|
152
|
+
|
|
153
|
+
Signals the end of the current audio turn so the model can finalize its response. Call this when the user stops speaking and the provider is not configured for server-side turn detection.
|
|
154
|
+
|
|
155
|
+
Returns: `Promise<void>`
|
|
156
|
+
|
|
157
|
+
### `addInstructions()`
|
|
158
|
+
|
|
159
|
+
Updates the system prompt for the active session.
|
|
160
|
+
|
|
161
|
+
**instructions** (`string`): System prompt to apply to the session.
|
|
162
|
+
|
|
163
|
+
Returns: `void`
|
|
164
|
+
|
|
165
|
+
### `addTools()`
|
|
166
|
+
|
|
167
|
+
Registers tools with the voice instance. When `NovaSonicVoice` is attached to an Agent, the Agent's tools are added automatically.
|
|
168
|
+
|
|
169
|
+
**tools** (`ToolsInput`): Tools exposed to the model.
|
|
170
|
+
|
|
171
|
+
Returns: `void`
|
|
172
|
+
|
|
173
|
+
### `getSpeakers()`
|
|
174
|
+
|
|
175
|
+
Returns the list of voices supported by Nova 2 Sonic.
|
|
176
|
+
|
|
177
|
+
Returns: `Promise<Array<{ voiceId: string; name: string; language: string; locale: string; gender: 'masculine' | 'feminine'; polyglot: boolean }>>`
|
|
178
|
+
|
|
179
|
+
### `getListener()`
|
|
180
|
+
|
|
181
|
+
Returns whether the voice instance currently holds an open stream.
|
|
182
|
+
|
|
183
|
+
Returns: `Promise<{ enabled: boolean }>`
|
|
184
|
+
|
|
185
|
+
### `close()`
|
|
186
|
+
|
|
187
|
+
Closes the bidirectional stream and destroys the underlying Bedrock client. Call this when the conversation ends.
|
|
188
|
+
|
|
189
|
+
Returns: `void`
|
|
190
|
+
|
|
191
|
+
### `on()` / `off()`
|
|
192
|
+
|
|
193
|
+
Registers and removes event listeners. See [Voice events](https://mastra.ai/reference/voice/voice.events) for the shared event API.
|
|
194
|
+
|
|
195
|
+
## Events
|
|
196
|
+
|
|
197
|
+
`NovaSonicVoice` emits the following events:
|
|
198
|
+
|
|
199
|
+
**speaking** (`event`): Assistant audio chunk. Callback receives { audioData: Int16Array, sampleRate?: number }.
|
|
200
|
+
|
|
201
|
+
**writing** (`event`): Transcribed text from the user or assistant. Callback receives { text: string, role: 'assistant' | 'user', generationStage?: 'SPECULATIVE' | 'FINAL' }.
|
|
202
|
+
|
|
203
|
+
**toolCall** (`event`): Model requested a tool call. Callback receives { name: string, args: Record\<string, any>, id: string }.
|
|
204
|
+
|
|
205
|
+
**interrupt** (`event`): User or model interrupted the current turn. Callback receives { type: 'user' | 'model', timestamp: number }.
|
|
206
|
+
|
|
207
|
+
**turnComplete** (`event`): Model finished its turn. Callback receives { timestamp: number }.
|
|
208
|
+
|
|
209
|
+
**session** (`event`): Session state transition. Callback receives { state: 'connecting' | 'connected' | 'disconnected' | 'disconnecting' | 'error' }.
|
|
210
|
+
|
|
211
|
+
**usage** (`event`): Token usage for the turn. Callback receives { inputTokens: number, outputTokens: number, totalTokens: number }.
|
|
212
|
+
|
|
213
|
+
**error** (`event`): Stream or provider error. Callback receives { message: string, code?: string, details?: unknown }.
|
|
214
|
+
|
|
215
|
+
`generationStage` distinguishes provisional transcripts (`'SPECULATIVE'`) from finalized ones (`'FINAL'`). Use `'FINAL'` text for persistent storage and `'SPECULATIVE'` text for live captions.
|
|
216
|
+
|
|
217
|
+
## Available voices
|
|
218
|
+
|
|
219
|
+
Nova 2 Sonic ships voices in ten locales. Tiffany and Matthew are polyglot and can speak any supported language.
|
|
220
|
+
|
|
221
|
+
| Voice ID | Name | Language | Locale | Gender | Polyglot |
|
|
222
|
+
| ---------- | -------- | ---------- | ------ | --------- | -------- |
|
|
223
|
+
| `tiffany` | Tiffany | English | en-US | feminine | yes |
|
|
224
|
+
| `matthew` | Matthew | English | en-US | masculine | yes |
|
|
225
|
+
| `amy` | Amy | English | en-GB | feminine | no |
|
|
226
|
+
| `olivia` | Olivia | English | en-AU | feminine | no |
|
|
227
|
+
| `kiara` | Kiara | English | en-IN | feminine | no |
|
|
228
|
+
| `arjun` | Arjun | English | en-IN | masculine | no |
|
|
229
|
+
| `ambre` | Ambre | French | fr-FR | feminine | no |
|
|
230
|
+
| `florian` | Florian | French | fr-FR | masculine | no |
|
|
231
|
+
| `beatrice` | Beatrice | Italian | it-IT | feminine | no |
|
|
232
|
+
| `lorenzo` | Lorenzo | Italian | it-IT | masculine | no |
|
|
233
|
+
| `tina` | Tina | German | de-DE | feminine | no |
|
|
234
|
+
| `lennart` | Lennart | German | de-DE | masculine | no |
|
|
235
|
+
| `lupe` | Lupe | Spanish | es-US | feminine | no |
|
|
236
|
+
| `carlos` | Carlos | Spanish | es-US | masculine | no |
|
|
237
|
+
| `carolina` | Carolina | Portuguese | pt-BR | feminine | no |
|
|
238
|
+
| `leo` | Leo | Portuguese | pt-BR | masculine | no |
|
|
239
|
+
| `kiara` | Kiara | Hindi | hi-IN | feminine | no |
|
|
240
|
+
| `arjun` | Arjun | Hindi | hi-IN | masculine | no |
|
|
241
|
+
|
|
242
|
+
## Notes
|
|
243
|
+
|
|
244
|
+
- Audio is streamed as 16-bit PCM. Assistant audio is emitted as `Int16Array` on the `speaking` event.
|
|
245
|
+
- The voice instance must call `connect()` before any other streaming method.
|
|
246
|
+
- `close()` destroys the underlying `BedrockRuntimeClient` to release the HTTP/2 session.
|
|
247
|
+
- Nova 2 Sonic is available in `us-east-1`, `us-west-2`, and `ap-northeast-1`. Other regions throw a configuration error during construction.
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.1.32-alpha.
|
|
3
|
+
"version": "1.1.32-alpha.6",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"local-pkg": "^1.1.2",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
32
|
"@mastra/mcp": "^1.6.0",
|
|
33
|
-
"@mastra/core": "1.31.0-alpha.
|
|
33
|
+
"@mastra/core": "1.31.0-alpha.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@hono/node-server": "^1.19.11",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"tsx": "^4.21.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
48
|
"vitest": "4.1.5",
|
|
49
|
+
"@mastra/core": "1.31.0-alpha.5",
|
|
49
50
|
"@internal/lint": "0.0.89",
|
|
50
|
-
"@internal/types-builder": "0.0.64"
|
|
51
|
-
"@mastra/core": "1.31.0-alpha.4"
|
|
51
|
+
"@internal/types-builder": "0.0.64"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://mastra.ai",
|
|
54
54
|
"repository": {
|