@mastra/mcp-docs-server 1.2.7-alpha.20 → 1.2.7-alpha.22

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.
@@ -850,10 +850,16 @@ const agent = new Agent({
850
850
 
851
851
  The retry mechanism:
852
852
 
853
- - Only works in `processOutputStep()` and `processInputStep()` methods
853
+ - Works in `processOutputStep()` and `processInputStep()` methods
854
854
  - Replays the step with the abort reason added as context for the LLM
855
855
  - Tracks retry count via the `retryCount` parameter
856
- - Respects `maxProcessorRetries` limit on the agent
856
+ - Requires an explicit `maxProcessorRetries` limit on the agent or call
857
+
858
+ ### Error processor retry limits
859
+
860
+ `processAPIError()` has a separate default: when `errorProcessors` are configured and `maxProcessorRetries` is omitted, the runtime allows up to `10` retries. Set the limit explicitly when you need a bounded retry budget.
861
+
862
+ For `StreamErrorRetryProcessor`, also set its `maxRetries` to the same value. Its own default is `1`, which can otherwise be lower than the agent cap. Keep model retries at `0` when the processor is the only retry mechanism for a request.
857
863
 
858
864
  ### Violation callbacks
859
865
 
@@ -908,7 +914,7 @@ For `agent.generate()`, the result exposes the same information as `result.tripw
908
914
 
909
915
  `abort` accepts a second options argument:
910
916
 
911
- - `retry: true` asks the agent to retry instead of ending. Retries require `maxProcessorRetries` to be set on the agent or call.
917
+ - `retry: true` asks the agent to retry instead of ending. Input and output processor retries require `maxProcessorRetries` to be set on the agent or call.
912
918
  - `metadata` attaches structured data to the `tripwire` chunk so downstream consumers can branch on categories like `pii`, `quality`, or `moderation`.
913
919
 
914
920
  ## API error handling
@@ -2,9 +2,9 @@
2
2
 
3
3
  # Agent.generateLegacy() (Legacy)
4
4
 
5
- > **Warning:** **Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.generate()`](https://mastra.ai/reference/agents/generate) method instead.
5
+ > **Warning:** **Deprecated**: This method is deprecated and only works with legacy model adapters. For current model adapters, use [`.generate()`](https://mastra.ai/reference/agents/generate) instead.
6
6
 
7
- The `.generateLegacy()` method is the legacy version of the agent generation API, used to interact with V1 model agents to produce text or structured responses. This method accepts messages and optional generation options.
7
+ The `.generateLegacy()` method is the legacy version of the agent generation API, used with legacy model adapters to produce text or structured responses. This method accepts messages and optional generation options.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -12,6 +12,12 @@ The `.generateLegacy()` method is the legacy version of the agent generation API
12
12
  await agent.generateLegacy('message for agent')
13
13
  ```
14
14
 
15
+ ## Processor retry support
16
+
17
+ `generateLegacy()` doesn't run error processors or `maxProcessorRetries`. It uses the legacy AI SDK generation path instead.
18
+
19
+ Scorer judges with legacy model adapters call `generateLegacy()`. They don't receive the coordinated `StreamErrorRetryProcessor` budget available to scorer judges that use Mastra’s current generation API. Use a current model adapter when you need error-processor retries. The legacy `maxRetries` option remains separate and defaults to `2`.
20
+
15
21
  ## Parameters
16
22
 
17
23
  **messages** (`string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]`): The messages to send to the agent. Can be a single string, array of strings, or structured message objects with multimodal content (text, images, etc.).
@@ -57,9 +57,9 @@ const scorer = createScorer({
57
57
 
58
58
  **judge.outputProcessors** (`Processor[]`): Output processors applied to the internal judge agent's output before it is returned (e.g. moderation, transformation).
59
59
 
60
- **judge.errorProcessors** (`Processor[]`): Error processors for the internal judge agent. These implement processAPIError and can inspect LLM API rejections and signal a retry, e.g. StreamErrorRetryProcessor. Requires maxProcessorRetries to be set for retry-based processors to take effect.
60
+ **judge.errorProcessors** (`Processor[]`): Error processors for judge models that use Mastra’s current generation API. These implement processAPIError and can inspect LLM API rejections and signal a retry, e.g. StreamErrorRetryProcessor. Legacy model adapters use generateLegacy() and do not run error processors.
61
61
 
62
- **judge.maxProcessorRetries** (`number`): Maximum number of times processors can trigger a retry per judge generation. Required for retry-based error processors (e.g. StreamErrorRetryProcessor) to take effect.
62
+ **judge.maxProcessorRetries** (`number`): Maximum number of times error processors can retry one judge generation. The runtime defaults to 10 when errorProcessors are configured without this value. Set it explicitly to bound the retry budget.
63
63
 
64
64
  **type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
65
65
 
@@ -71,6 +71,61 @@ The judge only runs for steps defined as **prompt objects** (`preprocess`, `anal
71
71
 
72
72
  When a prompt-object step runs, its structured LLM output is stored in the corresponding result field (`preprocessStepResult`, `analyzeStepResult`, or the value consumed by `calculateScore` in `generateScore`).
73
73
 
74
+ ## Retry judge requests
75
+
76
+ Use the existing judge `errorProcessors` configuration to retry transient failures inside a failed judge request. This doesn't retry the scorer workflow, trace target, batch item, score write, or a completed scorer step.
77
+
78
+ `@mastra/core` `1.49.0` doesn't include scorer error-processor configuration. Upgrade to a version with scorer processor support, or backport that focused change, before using this configuration.
79
+
80
+ The following example uses one bounded retry budget. Set the processor `maxRetries` and `judge.maxProcessorRetries` to the same value. Keep the internal judge agent's model retries at the default of `0` so model retries don't multiply processor attempts.
81
+
82
+ ```typescript
83
+ import { createScorer } from '@mastra/core/evals'
84
+ import { StreamErrorRetryProcessor } from '@mastra/core/processors'
85
+
86
+ const isTransientNetworkError = (error: unknown) =>
87
+ error instanceof Error && /ECONNRESET|ETIMEDOUT|socket hang up/i.test(error.message)
88
+
89
+ const retryProcessor = new StreamErrorRetryProcessor({
90
+ maxRetries: 2,
91
+ maxRetryAfterMs: 30_000,
92
+ delayMs: ({ retryCount }) => Math.min(1_000 * 2 ** retryCount, 30_000),
93
+ matchers: [isTransientNetworkError],
94
+ retryUnknownErrors: false,
95
+ })
96
+
97
+ export const responseQuality = createScorer({
98
+ id: 'response-quality',
99
+ description: 'Scores response quality',
100
+ judge: {
101
+ model: myModel,
102
+ instructions: 'Return a score and concise reason.',
103
+ errorProcessors: [retryProcessor],
104
+ maxProcessorRetries: 2,
105
+ },
106
+ })
107
+ .generateScore({
108
+ description: 'Score the response quality.',
109
+ createPrompt: ({ run }) => `Score: ${run.output}`,
110
+ })
111
+ .generateReason({
112
+ description: 'Explain the score.',
113
+ createPrompt: () => 'Explain the score.',
114
+ })
115
+ ```
116
+
117
+ With this configuration, a failed request has at most three provider attempts: the initial request plus two processor retries. If `generateScore` completes and `generateReason` receives a retryable failure, only `generateReason` retries.
118
+
119
+ `StreamErrorRetryProcessor` honors retryable provider metadata and narrow custom matchers. It keeps `retryUnknownErrors` disabled by default, so authentication, invalid-request, and context-length errors fail immediately unless you explicitly match them. It bounds `Retry-After` values to `30_000` milliseconds by default; use `maxRetryAfterMs` to change that cap.
120
+
121
+ Avoid adding outer scorer or workflow retries. Avoid combining a nonzero model retry setting with this processor unless you intentionally accept additional attempts.
122
+
123
+ ### Override retries for one step
124
+
125
+ A step's `judge` configuration overrides scorer-level judge fields. Processor arrays replace the scorer-level arrays. Omit `maxProcessorRetries` in the step configuration to inherit the scorer-level numeric cap.
126
+
127
+ Coordinated processor retries require a judge model that uses Mastra’s current generation API. Legacy model adapters call [`generateLegacy()`](https://mastra.ai/reference/agents/generateLegacy), bypass error processors, and use that API's separate AI SDK `maxRetries` default of `2`.
128
+
74
129
  ## Type safety
75
130
 
76
131
  You can specify input/output types when creating scorers for better type inference and IntelliSense support:
@@ -2,9 +2,9 @@
2
2
 
3
3
  # StreamErrorRetryProcessor
4
4
 
5
- `StreamErrorRetryProcessor` is an **error processor** that retries transient errors emitted after an LLM stream starts. It includes built-in matching for OpenAI Responses stream errors and supports additional matchers for other provider-specific stream error shapes.
5
+ `StreamErrorRetryProcessor` is an **error processor** that retries transient LLM API and stream failures. It includes built-in matching for OpenAI Responses stream errors and supports additional matchers for other provider-specific error shapes.
6
6
 
7
- The processor isn't enabled by default in core. Add it to `errorProcessors` for agents that need stream-error retry handling.
7
+ The processor isn't enabled by default in core. Add it to `errorProcessors` for agents that need bounded retry handling.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -35,6 +35,18 @@ When the error is retryable, the processor returns `{ retry: true }`. It doesn't
35
35
 
36
36
  When `delayMs` is set, the processor waits before signaling a retry. This is useful for transient network errors like `ECONNRESET` where immediately retrying is likely to fail again. The delay can be a fixed number of milliseconds or a function evaluated with the error args (for example, to implement exponential backoff).
37
37
 
38
+ ### Retry limits
39
+
40
+ `maxRetries` defaults to `1` and limits this processor's retry requests. The agent also limits processor retries with `maxProcessorRetries`. When error processors are configured without an agent limit, the runtime cap is `10`.
41
+
42
+ Set both values explicitly to the same bounded value when you need a single retry budget. Keep model `maxRetries` at `0` for that call to avoid multiplying provider attempts.
43
+
44
+ ### `Retry-After` handling
45
+
46
+ For retryable errors with a `Retry-After` response header, the processor reads case-insensitive delta-seconds and HTTP-date values through the error cause chain. It waits for the longer of `delayMs` and the bounded server delay.
47
+
48
+ `maxRetryAfterMs` defaults to `30_000`. It caps only provider-provided wait time. A longer explicit `delayMs` remains unchanged. Invalid or expired headers are ignored.
49
+
38
50
  ## Retry unknown errors
39
51
 
40
52
  Set `retryUnknownErrors` to retry errors that don't match provider metadata, the built-in OpenAI matcher, or a custom matcher. Unknown-error retries use the processor-level `maxRetries` and `delayMs` values. Known authorization failures, including HTTP `401` and `403` responses, aren't retried:
@@ -101,6 +101,16 @@ Waits for any in-flight deliveries to settle. Call this before shutdown to avoid
101
101
  await pubsub.flush()
102
102
  ```
103
103
 
104
+ #### `clearTopic(topic)`
105
+
106
+ Deletes all retained state for a topic — cached history, persistent stream entries, and consumer groups — once no more events will be published to it. Mastra's run lifecycles (durable agents and the evented workflow engine) call this automatically when a run reaches a terminal state, so per-run topics don't accumulate on transports that retain messages.
107
+
108
+ The default implementation is a no-op: transports that retain nothing per topic (such as `EventEmitterPubSub`) have nothing to clear. Backends that persist messages, like [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), override it. The contract is best-effort — implementations log failures rather than throwing, because callers invoke it fire-and-forget at cleanup boundaries.
109
+
110
+ ```typescript
111
+ await pubsub.clearTopic('workflow.events.v2.run-123')
112
+ ```
113
+
104
114
  ### Replay methods
105
115
 
106
116
  These methods support resuming a stream after a disconnect. The default implementations fall back to a regular `subscribe`, so backends without history support behave as live-only. [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub) overrides them to replay cached events.
@@ -92,6 +92,14 @@ const events = await pubsub.getHistory('my-topic', 0)
92
92
 
93
93
  Returns: `Promise<Event[]>`
94
94
 
95
+ ### `clearTopic(topic)`
96
+
97
+ Removes the topic's cached events and offset counter, and forwards the call to the inner pub/sub so persistent transports (such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams)) can delete their retained state too. Mastra's run lifecycles call this automatically when a run finishes.
98
+
99
+ ```typescript
100
+ await pubsub.clearTopic('my-topic')
101
+ ```
102
+
95
103
  ## Functions
96
104
 
97
105
  ### `withCaching(pubsub, cache, options?)`
@@ -101,7 +101,7 @@ await pubsub.flush()
101
101
 
102
102
  ### `clearTopic(topic)`
103
103
 
104
- Deletes a topic's stream and every consumer group on it, freeing the memory a finished topic would otherwise hold. The durable-agent runtime calls this automatically when a run's cleanup fires; call it yourself only once nothing will read the topic again. It's best-effort and never throws — failures are logged at warn level. A subscriber still attached when the stream is deleted recovers on its own but misses the deleted entries.
104
+ Deletes a topic's stream and every consumer group on it, freeing the memory a finished topic would otherwise hold. Mastra's run lifecycles — durable agents and the evented workflow engine — call this automatically when a run reaches a terminal state; call it yourself only once nothing will read the topic again. It's best-effort and never throws — failures are logged at warn level. A subscriber still attached when the stream is deleted recovers on its own but misses the deleted entries.
105
105
 
106
106
  Automatic cleanup requires `@mastra/core` and `@mastra/redis-streams` versions that both support `clearTopic`: the runtime routes the call through its caching layer, so upgrade the two packages together to get end-of-run stream deletion.
107
107
 
@@ -12,7 +12,7 @@ import { GoogleVoice } from '@mastra/voice-google'
12
12
  // Initialize with default configuration (uses GOOGLE_API_KEY environment variable)
13
13
  const voice = new GoogleVoice()
14
14
 
15
- // Text-to-Speech
15
+ // Text-to-Speech (plain text)
16
16
  const audioStream = await voice.speak('Hello, world!', {
17
17
  languageCode: 'en-US',
18
18
  audioConfig: {
@@ -20,6 +20,19 @@ const audioStream = await voice.speak('Hello, world!', {
20
20
  },
21
21
  })
22
22
 
23
+ // Text-to-Speech with SSML
24
+ const ssmlStream = await voice.speak('ignored', {
25
+ input: {
26
+ ssml: '<speak>Take <say-as interpret-as="unit">5 mg</say-as> daily.</speak>',
27
+ },
28
+ })
29
+
30
+ // Text-to-Speech with Gemini-TTS model
31
+ const geminiStream = await voice.speak('Hello from Gemini TTS!', {
32
+ voice: { name: 'Kore', modelName: 'gemini-2.5-flash-preview-tts' },
33
+ input: { prompt: 'Warm, calm tone.' },
34
+ })
35
+
23
36
  // Speech-to-Text
24
37
  const transcript = await voice.listen(audioStream, {
25
38
  config: {
@@ -68,25 +81,52 @@ Converts text to speech using Google Cloud Text-to-Speech service.
68
81
 
69
82
  **options** (`object`): Speech synthesis options
70
83
 
71
- **options.speaker** (`string`): Voice ID to use for this request
84
+ **options.speaker** (`string`): Voice ID to use for this request.
85
+
86
+ **options.languageCode** (`string`): Language code for the voice (e.g., 'en-US'). Defaults to the language code derived from the speaker ID, or 'en-US'.
72
87
 
73
- **options.languageCode** (`string`): Language code for the voice (e.g., 'en-US'). Defaults to the language code from the speaker ID or 'en-US'
88
+ **options.input** (`ISynthesizeSpeechRequest['input']`): Rich input object passed through to the Google Cloud TTS API. Supports ssml, markup, prompt (Gemini-TTS style steering), customPronunciations, and multiSpeakerMarkup. When provided without text, ssml, markup, or multiSpeakerMarkup, the positional input argument is used as the text field automatically.
74
89
 
75
- **options.audioConfig** (`ISynthesizeSpeechRequest['audioConfig']`): Audio configuration options from Google Cloud Text-to-Speech API
90
+ **options.voice** (`ISynthesizeSpeechRequest['voice']`): Voice configuration merged on top of defaults (name and languageCode). Supports modelName (e.g., 'gemini-2.5-flash-preview-tts') and multiSpeakerVoiceConfig.
91
+
92
+ **options.audioConfig** (`ISynthesizeSpeechRequest['audioConfig']`): Audio configuration options from Google Cloud Text-to-Speech API.
76
93
 
77
94
  Returns: `Promise<NodeJS.ReadableStream>`
78
95
 
79
96
  ### `listen()`
80
97
 
81
- Converts speech to text using Google Cloud Speech-to-Text service.
98
+ Converts speech to text using Google Cloud Speech-to-Text service. Supports both v1 (default) and v2 APIs. The v2 API adds support for AAC-in-MP4 audio (iOS Safari) via auto-decoding.
99
+
100
+ #### v1 (default)
82
101
 
83
102
  **audioStream** (`NodeJS.ReadableStream`): Audio stream to transcribe
84
103
 
85
- **options** (`object`): Recognition options
104
+ **options** (`GoogleListenOptionsV1`): v1 recognition options
105
+
106
+ **options.config** (`IRecognitionConfig`): v1 recognition configuration from Google Cloud Speech-to-Text API
107
+
108
+ #### v2
109
+
110
+ Pass `v2: true` to use the Cloud Speech-to-Text v2 API, which supports additional audio formats like AAC-in-MP4 (iOS Safari).
111
+
112
+ ```typescript
113
+ const transcript = await voice.listen(iosSafariAacStream, {
114
+ v2: true,
115
+ config: {
116
+ autoDecodingConfig: {},
117
+ },
118
+ })
119
+ ```
120
+
121
+ **audioStream** (`NodeJS.ReadableStream`): Audio stream to transcribe
122
+
123
+ **options** (`GoogleListenOptionsV2`): v2 recognition options
124
+
125
+ **options.v2** (`true`): Enables the v2 API path
86
126
 
87
- **options.stream** (`boolean`): Whether to use streaming recognition
127
+ **options.config** (`v2.IRecognitionConfig`): v2 recognition configuration. Defaults to auto-decoding with languageCodes: \['en-US'] and model: 'long'. Set autoDecodingConfig: {} to auto-detect the audio format, or use explicitDecodingConfig to specify an encoding like MP4\_AAC, M4A\_AAC, or MOV\_AAC.
88
128
 
89
- **options.config** (`IRecognitionConfig`): Recognition configuration from Google Cloud Speech-to-Text API
129
+ **options.recognizer** (`string`): v2 recognizer resource path. Defaults to projects/{project}/locations/global/recognizers/\_ where {project} is resolved from the constructor project option, GOOGLE\_CLOUD\_PROJECT, or the client's default project.
90
130
 
91
131
  Returns: `Promise<string>`
92
132
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.7-alpha.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`aa38805`](https://github.com/mastra-ai/mastra/commit/aa38805b878b827403be785eb90688d7172f5a40), [`2d22570`](https://github.com/mastra-ai/mastra/commit/2d22570c7dfdd02123d0ecc529efb05ccba2d9fc), [`4378341`](https://github.com/mastra-ai/mastra/commit/43783412df5ea3dd35f5b1f6e4851e79c346fc89)]:
8
+ - @mastra/core@1.51.0-alpha.12
9
+
10
+ ## 1.2.7-alpha.21
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`45a8e65`](https://github.com/mastra-ai/mastra/commit/45a8e65e1556d1362cb3f25187023c36de26661d), [`c8ed116`](https://github.com/mastra-ai/mastra/commit/c8ed11699f62bcac70102ab4ec84d80d20541da6), [`33f2b88`](https://github.com/mastra-ai/mastra/commit/33f2b88842c09a567f906fac4cb61cd5277ced59)]:
15
+ - @mastra/core@1.51.0-alpha.11
16
+
3
17
  ## 1.2.7-alpha.20
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.2.7-alpha.20",
3
+ "version": "1.2.7-alpha.22",
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/mcp": "^1.14.0-alpha.0",
32
- "@mastra/core": "1.51.0-alpha.10"
31
+ "@mastra/core": "1.51.0-alpha.12",
32
+ "@mastra/mcp": "^1.14.0-alpha.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^1.19.11",
@@ -45,9 +45,9 @@
45
45
  "tsx": "^4.22.4",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "4.1.10",
48
- "@internal/lint": "0.0.113",
49
48
  "@internal/types-builder": "0.0.88",
50
- "@mastra/core": "1.51.0-alpha.10"
49
+ "@internal/lint": "0.0.113",
50
+ "@mastra/core": "1.51.0-alpha.12"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {