@mastra/mcp-docs-server 1.2.7-alpha.21 → 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:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 1.2.7-alpha.21
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.2.7-alpha.21",
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,7 +28,7 @@
28
28
  "jsdom": "^26.1.0",
29
29
  "local-pkg": "^1.1.2",
30
30
  "zod": "^4.4.3",
31
- "@mastra/core": "1.51.0-alpha.11",
31
+ "@mastra/core": "1.51.0-alpha.12",
32
32
  "@mastra/mcp": "^1.14.0-alpha.0"
33
33
  },
34
34
  "devDependencies": {
@@ -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.11"
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": {