@mastra/mcp-docs-server 1.2.13-alpha.1 → 1.2.13-alpha.11

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 (128) hide show
  1. package/.docs/docs/agents/agent-approval.md +2 -2
  2. package/.docs/docs/agents/overview.md +1 -1
  3. package/.docs/docs/agents/supervisor-agents.md +2 -2
  4. package/.docs/docs/agents/using-tools.md +29 -0
  5. package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
  6. package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +27 -3
  7. package/.docs/docs/deployment/workers.md +14 -14
  8. package/.docs/docs/editor/overview.md +201 -206
  9. package/.docs/docs/evals/evals-with-memory.md +1 -1
  10. package/.docs/docs/getting-started/develop.md +196 -0
  11. package/.docs/docs/index.md +78 -1
  12. package/.docs/docs/long-running-agents/durable-agents.md +2 -2
  13. package/.docs/docs/mastra-platform/overview.md +1 -1
  14. package/.docs/docs/mastra-platform/workspaces.md +152 -0
  15. package/.docs/docs/memory/observational-memory.md +53 -13
  16. package/.docs/docs/memory/overview.md +14 -0
  17. package/.docs/docs/server/auth/workers.md +7 -5
  18. package/.docs/docs/server/mastra-client.md +60 -0
  19. package/.docs/docs/server/pubsub.md +2 -2
  20. package/.docs/docs/studio/observability.md +4 -0
  21. package/.docs/docs/studio/overview.md +2 -2
  22. package/.docs/docs/workflows/overview.md +1 -1
  23. package/.docs/docs/workflows/scheduled-workflows.md +1 -0
  24. package/.docs/docs/workspace/search.md +1 -1
  25. package/.docs/guides/deployment/kubernetes.md +2 -0
  26. package/.docs/guides/deployment/mastra-workers.md +350 -6
  27. package/.docs/guides/deployment/vercel.md +2 -0
  28. package/.docs/guides/getting-started/quickstart.md +3 -3
  29. package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
  30. package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
  31. package/.docs/{docs → guides}/rag/overview.md +2 -2
  32. package/.docs/{docs → guides}/rag/retrieval.md +1 -1
  33. package/.docs/{docs → guides}/voice/overview.md +4 -4
  34. package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
  35. package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
  36. package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
  37. package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
  38. package/.docs/models/embeddings.md +63 -65
  39. package/.docs/models/environment-variables.md +1 -1
  40. package/.docs/models/gateways/openrouter.md +3 -6
  41. package/.docs/models/gateways/vercel.md +4 -1
  42. package/.docs/models/index.md +1 -1
  43. package/.docs/models/providers/crof.md +2 -1
  44. package/.docs/models/providers/crossmodel.md +4 -3
  45. package/.docs/models/providers/empiriolabs.md +2 -1
  46. package/.docs/models/providers/huggingface.md +3 -1
  47. package/.docs/models/providers/hyper.md +10 -7
  48. package/.docs/models/providers/llmgateway.md +5 -4
  49. package/.docs/models/providers/minimax.md +1 -1
  50. package/.docs/models/providers/neuralwatt.md +3 -1
  51. package/.docs/models/providers/openai.md +2 -2
  52. package/.docs/models/providers/opencode-go.md +2 -1
  53. package/.docs/models/providers/opencode.md +1 -1
  54. package/.docs/models/providers/perplexity-agent.md +3 -1
  55. package/.docs/models/providers/scaleway.md +1 -3
  56. package/.docs/models/providers/the-grid-ai.md +3 -3
  57. package/.docs/models/providers/zai-coding-plan.md +11 -13
  58. package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
  59. package/.docs/reference/agents/agent.md +1 -1
  60. package/.docs/reference/agents/durable-agent.md +12 -1
  61. package/.docs/reference/agents/generate.md +1 -1
  62. package/.docs/reference/agents/getVoice.md +1 -1
  63. package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
  64. package/.docs/reference/cli/create-mastra.md +2 -0
  65. package/.docs/reference/cli/mastra.md +36 -16
  66. package/.docs/reference/client-js/agents.md +1 -1
  67. package/.docs/reference/configuration.md +2 -2
  68. package/.docs/reference/core/getEditor.md +1 -1
  69. package/.docs/reference/core/getVector.md +2 -2
  70. package/.docs/reference/core/listVectors.md +2 -2
  71. package/.docs/reference/core/mastra-class.md +2 -2
  72. package/.docs/reference/datasets/startExperiment.md +6 -0
  73. package/.docs/reference/datasets/startExperimentAsync.md +4 -0
  74. package/.docs/reference/editor/browser-provider.md +2 -2
  75. package/.docs/reference/editor/filesystem-provider.md +1 -1
  76. package/.docs/reference/editor/mastra-editor.md +31 -18
  77. package/.docs/reference/editor/prompt-blocks.md +137 -0
  78. package/.docs/reference/editor/sandbox-provider.md +1 -1
  79. package/.docs/reference/editor/storage-browser-ref.md +3 -3
  80. package/.docs/reference/editor/storage-workspace-ref.md +3 -3
  81. package/.docs/reference/editor/tool-provider.md +44 -10
  82. package/.docs/reference/editor/tools.md +100 -0
  83. package/.docs/reference/editor/versioning.md +130 -0
  84. package/.docs/reference/evals/mastra-scorer.md +68 -8
  85. package/.docs/reference/evals/summarization.md +203 -0
  86. package/.docs/reference/file-based-agents/config.md +39 -1
  87. package/.docs/reference/index.md +4 -4
  88. package/.docs/reference/memory/observational-memory.md +76 -24
  89. package/.docs/reference/memory/serialized-memory-config.md +3 -3
  90. package/.docs/reference/observability/tracing/interfaces.md +6 -1
  91. package/.docs/reference/processors/processor-interface.md +14 -2
  92. package/.docs/reference/processors/regex-filter-processor.md +1 -1
  93. package/.docs/reference/processors/token-limiter-processor.md +15 -1
  94. package/.docs/reference/project-structure.md +1 -1
  95. package/.docs/reference/rag/database-config.md +1 -1
  96. package/.docs/reference/storage/composite.md +2 -0
  97. package/.docs/reference/streaming/agents/stream.md +1 -1
  98. package/.docs/reference/tools/isolated-vm-transport.md +1 -1
  99. package/.docs/reference/vectors/mongodb.md +13 -13
  100. package/.docs/reference/voice/livekit.md +3 -3
  101. package/.docs/reference/workers/overview.md +10 -8
  102. package/.docs/reference/workspace/platform-filesystem.md +8 -5
  103. package/.docs/reference/workspace/platform-sandbox.md +83 -7
  104. package/CHANGELOG.md +44 -0
  105. package/README.md +1 -1
  106. package/package.json +5 -5
  107. package/.docs/docs/agent-builder/access-control.md +0 -99
  108. package/.docs/docs/agent-builder/browser.md +0 -63
  109. package/.docs/docs/agent-builder/channels.md +0 -78
  110. package/.docs/docs/agent-builder/configuration.md +0 -132
  111. package/.docs/docs/agent-builder/deploying.md +0 -124
  112. package/.docs/docs/agent-builder/integrations.md +0 -115
  113. package/.docs/docs/agent-builder/memory.md +0 -69
  114. package/.docs/docs/agent-builder/model-policy.md +0 -50
  115. package/.docs/docs/agent-builder/overview.md +0 -114
  116. package/.docs/docs/agent-builder/skill-registries.md +0 -31
  117. package/.docs/docs/agent-builder/workspace.md +0 -62
  118. package/.docs/docs/editor/prompts.md +0 -140
  119. package/.docs/docs/editor/tools.md +0 -148
  120. package/.docs/docs/getting-started/file-based-agents.md +0 -121
  121. package/.docs/docs/mastra-platform/workspace.md +0 -111
  122. package/.docs/docs/what-is-mastra.md +0 -161
  123. package/.docs/reference/client-js/agent-builder.md +0 -163
  124. package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
  125. package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
  126. package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
  127. /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
  128. /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
@@ -0,0 +1,130 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Versioning
4
+
5
+ Editor versions stored agents and prompt blocks. Database-backed resources use draft and publish operations. Code-backed agent overrides use deterministic files and Git history.
6
+
7
+ See [Editor versioning](https://mastra.ai/docs/editor/overview) for release and experimentation patterns.
8
+
9
+ ## Database lifecycle
10
+
11
+ The resource record stores an `activeVersionId`. Individual snapshots don't store a lifecycle status.
12
+
13
+ | Term | Meaning |
14
+ | ---------- | -------------------------------------------------------------------------------------------- |
15
+ | Latest | The most recently created configuration snapshot |
16
+ | Published | The snapshot selected by `activeVersionId` |
17
+ | Draft | The latest snapshot when it differs from `activeVersionId`, or when no active version exists |
18
+ | Historical | Any other retained snapshot |
19
+
20
+ Saving changed snapshot fields creates a new latest version. Saving identical snapshot fields or changing metadata alone doesn't create a version.
21
+
22
+ If an active version exists, creating a draft doesn't change the version handling published requests. Publishing updates `activeVersionId`. Restoring a historical version copies its configuration into a new inactive draft.
23
+
24
+ The direct namespace methods and REST APIs differ in one important way. `editor.prompt.update()` creates an inactive draft. `editor.agent.update()` creates a version and immediately assigns it to `activeVersionId`. The stored-agent REST `PATCH` route creates an inactive draft unless `autoPublish` is enabled.
25
+
26
+ When a generic stored resource has no active version, published resolution can fall back to the latest snapshot. For a code-defined agent override, requesting `status: 'published'` without an active override returns the original code agent.
27
+
28
+ ## Code source
29
+
30
+ With `source: 'code'`, active agent overrides are serialized as deterministic JSON under `<codePath>/agents/<encodedAgentId>.json`. The default `codePath` is `./mastra/editor`.
31
+
32
+ The initial agent is published to create the file. Later server updates create a draft by default and write the file when that version becomes active. Git versions are read-only in Studio and use the commit message as their change message. The default history scan reads up to 50 recent commits and skips consecutive commits whose parsed JSON snapshot is unchanged.
33
+
34
+ See [`MastraEditor`](https://mastra.ai/reference/editor/mastra-editor) for source options.
35
+
36
+ ## Select an agent version
37
+
38
+ Calling [`mastra.getAgentById()`](https://mastra.ai/reference/core/getAgentById) without a selector returns the registered code-defined agent. Pass `status` or `versionId` to apply a stored override. See [Select a version](https://mastra.ai/docs/editor/overview) for a TypeScript example.
39
+
40
+ With the default server prefix, pass selectors as query parameters under `/api`:
41
+
42
+ ```bash
43
+ # Published version
44
+ curl http://localhost:4111/api/agents/support-agent
45
+
46
+ # Latest draft
47
+ curl http://localhost:4111/api/agents/support-agent?status=draft
48
+
49
+ # Exact version
50
+ curl http://localhost:4111/api/agents/support-agent?versionId=abc-123
51
+ ```
52
+
53
+ See the [Client SDK agents reference](https://mastra.ai/reference/client-js/agents) for Client SDK and React SDK selectors.
54
+
55
+ ## Sub-agent versioning
56
+
57
+ Version overrides propagate through [supervisor-agent delegation](https://mastra.ai/docs/agents/supervisor-agents) in request context. Define selectors at three levels:
58
+
59
+ 1. `Mastra` instance `versions`: Defaults for every invocation
60
+ 2. Server request-body `versions`: Per-request values added to request context
61
+ 3. Direct `generate()` or `stream()` `versions`: Per-invocation values
62
+
63
+ Entries merge by agent ID. For the same ID, precedence is **direct invocation > request body or existing request context > Mastra instance default**.
64
+
65
+ Set defaults on the Mastra instance:
66
+
67
+ ```typescript
68
+ import { Mastra } from '@mastra/core'
69
+ import { MastraEditor } from '@mastra/editor'
70
+
71
+ export const mastra = new Mastra({
72
+ agents: { supervisor, researchAgent, writerAgent },
73
+ editor: new MastraEditor(),
74
+ versions: {
75
+ agents: {
76
+ 'research-agent': { status: 'published' },
77
+ 'writer-agent': { versionId: 'abc-123' },
78
+ },
79
+ },
80
+ })
81
+ ```
82
+
83
+ Override one sub-agent for a direct invocation:
84
+
85
+ ```typescript
86
+ const result = await supervisor.generate('Research and write about AI safety', {
87
+ versions: {
88
+ agents: {
89
+ 'research-agent': { status: 'draft' },
90
+ },
91
+ },
92
+ })
93
+ ```
94
+
95
+ Or pass selectors in the server request body:
96
+
97
+ ```bash
98
+ curl -X POST http://localhost:4111/api/agents/supervisor/generate \
99
+ -H "Content-Type: application/json" \
100
+ -d '{
101
+ "messages": [{ "role": "user", "content": "Research AI safety" }],
102
+ "versions": {
103
+ "agents": {
104
+ "research-agent": { "status": "draft" }
105
+ }
106
+ }
107
+ }'
108
+ ```
109
+
110
+ If Editor isn't configured or a version can't be resolved, Mastra logs a warning and uses the code-defined sub-agent.
111
+
112
+ ## Stored-agent REST API
113
+
114
+ The default Mastra server prefix is `/api`. A custom server prefix changes the paths below.
115
+
116
+ | Method | Path | Description |
117
+ | -------- | ---------------------------------------------- | -------------------------------------------------------------------- |
118
+ | `GET` | `/api/stored/agents` | List stored agents |
119
+ | `POST` | `/api/stored/agents` | Create a stored agent |
120
+ | `GET` | `/api/stored/agents/:storedAgentId` | Get a stored agent |
121
+ | `PATCH` | `/api/stored/agents/:storedAgentId` | Update a stored agent |
122
+ | `DELETE` | `/api/stored/agents/:storedAgentId` | Delete a stored agent |
123
+ | `GET` | `/api/stored/agents/:storedAgentId/dependents` | List readable dependents and count hidden cross-workspace references |
124
+ | `POST` | `/api/stored/agents/:storedAgentId/export` | Export the allowed override fields as deterministic JSON |
125
+
126
+ The dependents response lists caller-readable agents by `id` and `name`. Its `hiddenCount` field counts cross-workspace references that the caller can't read, but only when the target agent is public.
127
+
128
+ Version-management routes are nested under `/api/stored/agents/:storedAgentId/versions`. See [version management](https://mastra.ai/reference/client-js/agents) for operations and Client SDK methods.
129
+
130
+ The Client SDK exposes `listStoredAgents()`, `createStoredAgent()`, and `getStoredAgent()`. The resource returned by `getStoredAgent(id)` includes methods for updates, deletion, dependents, export, and version management.
@@ -76,16 +76,19 @@ const result = await scorer.run({
76
76
  The optional `judge` record contains details about the judge model calls made by prompt-based scorer steps. Its known keys are `preprocess`, `analyze`, `generateScore`, and `generateReason`. Each key contains an ordered `executions` array.
77
77
 
78
78
  ```typescript
79
- interface ScorerJudgeExecutionSuccess {
80
- status: 'success'
79
+ interface ScorerJudgeExecutionBase {
81
80
  prompt: string
82
- output: JSONValue
83
81
  judgeModelId: string
84
82
  judgeProvider?: string
85
- usage: ScorerJudgeUsage
86
83
  attemptCount: number
87
84
  modelCallCount: number
88
85
  durationMs: number
86
+ }
87
+
88
+ interface ScorerJudgeExecutionSuccess extends ScorerJudgeExecutionBase {
89
+ status: 'success'
90
+ output: JSONValue
91
+ usage: ScorerJudgeUsage
89
92
  cost?: {
90
93
  amount: number
91
94
  unit: string
@@ -93,7 +96,20 @@ interface ScorerJudgeExecutionSuccess {
93
96
  }
94
97
  }
95
98
 
96
- type ScorerJudgeExecution = ScorerJudgeExecutionSuccess
99
+ interface ScorerJudgeExecutionFailure extends ScorerJudgeExecutionBase {
100
+ status: 'failed'
101
+ output?: JSONValue
102
+ rawOutput?: string
103
+ usage?: ScorerJudgeUsage
104
+ finishReason?: string
105
+ error: {
106
+ name: string
107
+ message: string
108
+ code?: string
109
+ }
110
+ }
111
+
112
+ type ScorerJudgeExecution = ScorerJudgeExecutionSuccess | ScorerJudgeExecutionFailure
97
113
 
98
114
  interface ScorerJudgeUsage {
99
115
  inputTokens?: number
@@ -119,18 +135,62 @@ const execution = result.judge?.generateScore?.executions[0]
119
135
 
120
136
  console.log(execution?.status)
121
137
  console.log(execution?.judgeModelId)
122
- console.log(execution?.usage.totalTokens)
138
+ console.log(execution?.usage?.totalTokens)
123
139
  console.log(execution?.durationMs)
124
140
  ```
125
141
 
126
- The `status` value describes the outcome of the logical prompt-step execution, not the quality of the evaluated response. A structured-output fallback that eventually succeeds creates one `success` execution with an `attemptCount` greater than one.
142
+ The `status` value describes the outcome of the logical prompt-step execution, not the quality of the evaluated response. A structured-output fallback that eventually succeeds creates one `success` execution with an `attemptCount` greater than one. Exhausted attempts create one `failed` execution.
143
+
144
+ Successful executions require validated `output` and normalized `usage`. Failed executions require an `error` summary and include only the evidence the runtime received. A failed execution includes `output` only when the output was validated before a later callback or orchestration failure. Mastra doesn't parse `rawOutput` to create `output`.
127
145
 
128
146
  `attemptCount` counts judge invocations, including a structured-output fallback. `modelCallCount` counts the completed model steps across those attempts. `durationMs` covers the full prompt-step execution.
129
147
 
130
- Function steps don't create `judge` entries. Usage in this record belongs to the scorer's judge model, not the agent or workflow being evaluated. The optional `cost` field is present only when the execution directly reports an authoritative cost, source, and unit.
148
+ Function steps don't create `judge` entries. Usage in this record belongs to the scorer's judge model, not the agent or workflow being evaluated. Filter by `status` when aggregating successful executions. Include both statuses when aggregating all completed provider usage. The optional `cost` field is present only on successful executions that directly report an authoritative cost, source, and unit.
131
149
 
132
150
  Use Mastra metrics to query aggregate usage, latency, and estimated cost across scorer runs. The `judge` record describes one scorer run and doesn't query metrics or traces.
133
151
 
152
+ ### Failed runs
153
+
154
+ A failed scorer stage still rejects the `.run()` promise. Catch `ScorerRunError` to inspect completed stages and any results they produced:
155
+
156
+ ```typescript
157
+ import { ScorerRunError } from '@mastra/core/evals'
158
+
159
+ try {
160
+ const result = await scorer.run({ input, output })
161
+ console.log(result.score)
162
+ } catch (error) {
163
+ if (error instanceof ScorerRunError) {
164
+ console.log(error.failedStep)
165
+ console.log(error.completedSteps)
166
+ console.log(error.result?.score)
167
+
168
+ const failedExecution = error.result?.judge?.[error.failedStep]?.executions.find(
169
+ execution => execution.status === 'failed',
170
+ )
171
+ console.log(failedExecution?.error)
172
+ }
173
+
174
+ throw error
175
+ }
176
+ ```
177
+
178
+ `ScorerRunError` exposes these properties:
179
+
180
+ **failedStep** (`ScorerStepName`): The scorer stage that failed.
181
+
182
+ **completedSteps** (`ScorerStepName[]`): The scorer stages that completed before the failure, in execution order.
183
+
184
+ **result** (`ScorerRunResultSnapshot | undefined`): Outputs from completed scorer stages and judge execution evidence from attempted prompt stages. This property is omitted when neither is available.
185
+
186
+ The `result` snapshot contains completed stage outputs and judge execution evidence. For example, if `generateReason` fails after `generateScore` returns `0`, `error.result.score` is `0`, the `generateScore` execution has `status: 'success'`, and the `generateReason` execution has `status: 'failed'`. The run remains failed.
187
+
188
+ A prompt failure can create `error.result` with only run identity, input, and a failed `judge` entry. A function stage that fails before producing a scorer field doesn't create a result.
189
+
190
+ `JSON.stringify(error)` uses the standard `MastraError` serialization and omits `result`, including successful and failed judge evidence. Read `result` explicitly when you need scorer artifacts or raw failed output.
191
+
192
+ An in-memory experiment result can keep a completed score or reason from a failed scorer along with `error`, `failedStep`, and `completedSteps`. The scorer is still treated as failed, and a recovered score isn't written to legacy successful-score storage.
193
+
134
194
  ## Step execution flow
135
195
 
136
196
  When you call `.run()`, the MastraScorer executes the defined steps in this order:
@@ -0,0 +1,203 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # Summarization scorer
4
+
5
+ The `createSummarizationScorer()` function creates a scorer that evaluates a summary on two axes: whether every claim it makes is supported by the source text, and whether it preserves the information the source states. The final score is the lower of the two, so a summary can't pass by being faithful but empty, or thorough but wrong.
6
+
7
+ The summary is the agent's last message that carries text, and the source text defaults to the first user message of the run input. Pass `source` or `sourceExtractor` when the text being summarized lives somewhere else, such as a tool result.
8
+
9
+ ## Usage example
10
+
11
+ Score a summary against the document it condenses.
12
+
13
+ ```typescript
14
+ import { createSummarizationScorer } from '@mastra/evals/scorers/prebuilt'
15
+
16
+ const scorer = createSummarizationScorer({
17
+ model: 'openai/gpt-5.6-sol',
18
+ })
19
+
20
+ const result = await scorer.run({
21
+ input: {
22
+ inputMessages: [{ id: '1', role: 'user', content: sourceDocument }],
23
+ },
24
+ output: [{ id: '2', role: 'assistant', content: summary }],
25
+ })
26
+
27
+ console.log(result.score)
28
+ console.log(result.reason)
29
+ ```
30
+
31
+ ## Summarization evaluation
32
+
33
+ Use this scorer when an agent condenses text:
34
+
35
+ - Document and transcript summarization
36
+ - Support thread and email digests
37
+ - Any step that compresses a long input into a short output
38
+
39
+ ## Parameters
40
+
41
+ **model** (`MastraModelConfig`): The language model to use for judging claims and coverage questions
42
+
43
+ **options** (`SummarizationMetricOptions`): Configuration options for the scorer
44
+
45
+ **options.source** (`string`): Text the summary is judged against. Defaults to the user message of the run input
46
+
47
+ **options.sourceExtractor** (`(input, output) => string`): Function to derive the source text from the run input and output. Takes precedence over source
48
+
49
+ **options.maxQuestions** (`number`): Upper bound on the coverage questions drawn from the source (default: 10)
50
+
51
+ **options.scale** (`number`): Scale factor to multiply the final score (default: 1)
52
+
53
+ ## `.run()` returns
54
+
55
+ **score** (`number`): Summarization score between 0 and scale (default 0-1), the lower of the alignment and coverage scores
56
+
57
+ **reason** (`string`): Human-readable explanation naming the axis that produced the score and the claims or questions behind it. Both axis scores appear in the text
58
+
59
+ **preprocessStepResult** (`object`): The alignment verdicts and the questions drawn from the source
60
+
61
+ **preprocessStepResult.alignment** (`{ claim: string; supported: boolean; reason: string }[]`): One verdict per claim the summary makes
62
+
63
+ **preprocessStepResult.questions** (`string[]`): The coverage questions drawn from the source text
64
+
65
+ **analyzeStepResult** (`object`): The coverage verdicts
66
+
67
+ **analyzeStepResult.coverage** (`{ question: string; answered: boolean; reason: string }[]`): One verdict per question, answered from the summary alone
68
+
69
+ The axis scores are derived from these verdicts rather than stored: alignment is the share of `alignment` entries with `supported: true`, and coverage is the share of `questions` whose `coverage` entry has `answered: true`.
70
+
71
+ ## Scoring details
72
+
73
+ ### Two-axis evaluation
74
+
75
+ The scorer runs a three-step pipeline:
76
+
77
+ 1. **Source judgement**: the claims the summary makes are extracted and checked against the source, and closed-ended questions are drawn from the source. Every question is written so the source answers it "yes".
78
+ 2. **Coverage**: each question is answered using the summary alone.
79
+ 3. **Scoring**: the two ratios are computed and the lower one becomes the score.
80
+
81
+ The coverage step runs as a separate model call that never receives the source text. A judge that could see the source would answer questions from it rather than from the summary, which would hide the omissions this axis exists to measure.
82
+
83
+ ### Scoring formula
84
+
85
+ ```text
86
+ Alignment = supported_claims / total_claims
87
+ Coverage = answered_questions / total_questions
88
+ Summarization = min(Alignment, Coverage) × scale
89
+ ```
90
+
91
+ The score is 0 when the summary yields no claims or the source yields no questions.
92
+
93
+ ### Score interpretation
94
+
95
+ These ranges assume the default `scale` of 1. When using a custom scale, multiply accordingly.
96
+
97
+ - **0.9-1.0**: Excellent summary, faithful to the source and covering its main points
98
+ - **0.7-0.8**: Good summary with a small omission or an unsupported detail
99
+ - **0.4-0.6**: Moderate summary, either missing important information or drifting from the source
100
+ - **0.1-0.3**: Poor summary, most of the source is lost or contradicted
101
+ - **0.0**: The summary produced nothing to judge, or it failed to support any claims. A summary that answers no questions also receives this score
102
+
103
+ ### Reading the two axes
104
+
105
+ Both axes leave their verdicts on the run result: the alignment verdicts on the preprocess step, and the coverage verdicts on the analyze step. Each verdict carries the claim or question it belongs to and the reason behind it. A low alignment score has a different meaning from a low coverage score:
106
+
107
+ - A low alignment score with high coverage means the summary invents or distorts detail
108
+ - A low coverage score with high alignment means the summary is accurate but leaves too much out
109
+
110
+ The reason field names whichever axis produced the score.
111
+
112
+ ### What the score leaves out
113
+
114
+ Length plays no part in the score. A summary that repeats the source word for word supports every claim and answers every question, so it scores 1. Add a length check of your own when compression is part of what you're testing.
115
+
116
+ ### Cost
117
+
118
+ Each evaluation makes three model calls. `maxQuestions` bounds the coverage half of the work, which otherwise grows with source length. Raise it for long documents where ten questions can't represent the content.
119
+
120
+ ## Scorer configuration
121
+
122
+ ### Summarizing the run input
123
+
124
+ ```typescript
125
+ const scorer = createSummarizationScorer({
126
+ model: 'openai/gpt-5.6-sol',
127
+ })
128
+ ```
129
+
130
+ ### Summarizing a document from elsewhere
131
+
132
+ ```typescript
133
+ import { extractToolResults } from '@mastra/evals/scorers/utils'
134
+
135
+ const scorer = createSummarizationScorer({
136
+ model: 'openai/gpt-5.6-sol',
137
+ options: {
138
+ sourceExtractor: (input, output) => {
139
+ return extractToolResults(output)
140
+ .filter(({ toolName }) => toolName === 'fetchDocument')
141
+ .map(({ result }) => String(result))
142
+ .join('\n\n')
143
+ },
144
+ maxQuestions: 20,
145
+ },
146
+ })
147
+ ```
148
+
149
+ ## Example
150
+
151
+ Evaluate a summarization agent against a set of documents:
152
+
153
+ ```typescript
154
+ import { runEvals } from '@mastra/core/evals'
155
+ import { createSummarizationScorer } from '@mastra/evals/scorers/prebuilt'
156
+ import { summarizerAgent } from './agent'
157
+
158
+ const scorer = createSummarizationScorer({
159
+ model: 'openai/gpt-5.6-sol',
160
+ options: { maxQuestions: 10 },
161
+ })
162
+
163
+ const result = await runEvals({
164
+ target: summarizerAgent,
165
+ scorers: [scorer],
166
+ data: [
167
+ {
168
+ input:
169
+ 'The company was founded in 1995 by John Smith. It started with 10 employees and grew to 500 by 2020. The company is based in Seattle.',
170
+ },
171
+ ],
172
+ onItemComplete: ({ scorerResults }) => {
173
+ console.log({
174
+ score: scorerResults[scorer.id].score,
175
+ reason: scorerResults[scorer.id].reason,
176
+ })
177
+ },
178
+ })
179
+
180
+ console.log(result.scores)
181
+ ```
182
+
183
+ For more details on `runEvals`, see the [runEvals reference](https://mastra.ai/reference/evals/run-evals).
184
+
185
+ To add this scorer to an agent, see the [Scorers overview](https://mastra.ai/docs/evals/overview) guide.
186
+
187
+ ## Comparison with faithfulness
188
+
189
+ | Use case | Summarization | Faithfulness |
190
+ | ------------------------- | ------------------------------- | --------------------------------- |
191
+ | **What it measures** | Support and coverage together | Support only |
192
+ | **Judged against** | The source text being condensed | Retrieved context or tool results |
193
+ | **Catches omission** | Yes | No |
194
+ | **Needs the full source** | Yes | No, context alone is enough |
195
+
196
+ Use `faithfulness` when the question is whether an answer stays grounded in retrieved context. Use `summarization` when the output is meant to stand in for a longer text.
197
+
198
+ ## Related
199
+
200
+ - [Faithfulness Scorer](https://mastra.ai/reference/evals/faithfulness): Measures answer groundedness in context
201
+ - [Completeness Scorer](https://mastra.ai/reference/evals/completeness): Compares element coverage without a model
202
+ - [Content Similarity Scorer](https://mastra.ai/reference/evals/content-similarity): Compares text similarity without a model
203
+ - [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Creating your own evaluation metrics
@@ -94,4 +94,42 @@ Keep `config.ts` focused on runtime options. Use sibling files for concerns that
94
94
  | Memory | `config.memory` | [`memory.ts`](https://mastra.ai/reference/file-based-agents/memory) | `config.memory` |
95
95
  | Workspace | `config.workspace` | [`workspace.ts`](https://mastra.ai/reference/file-based-agents/workspace) | `config.workspace` |
96
96
 
97
- Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
97
+ Missing both `instructions.md` and `config.instructions` fails the build. Missing both `config.memory` and `memory.ts` leaves the agent without memory.
98
+
99
+ ## Discovery lifecycle
100
+
101
+ File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra/`, imports TypeScript and JavaScript modules, reads markdown instructions and skills, copies workspace seed files, and registers the assembled primitives with your Mastra app.
102
+
103
+ After discovery, a file-based agent runs as a normal [`Agent`](https://mastra.ai/reference/agents/agent). Calling it from the Agent API, Studio, workflows, or your application code uses the same runtime as a code-defined agent.
104
+
105
+ Discovery is source-based and conservative.
106
+
107
+ It skips symlinks, test files, and directories that aren't agent directories. Workflows and singleton project files are file-routed only when they have a default export.
108
+
109
+ Start your app through the Mastra CLI so discovery runs:
110
+
111
+ **npm**:
112
+
113
+ ```bash
114
+ npx mastra dev
115
+ ```
116
+
117
+ **pnpm**:
118
+
119
+ ```bash
120
+ pnpm dlx mastra dev
121
+ ```
122
+
123
+ **Yarn**:
124
+
125
+ ```bash
126
+ yarn dlx mastra dev
127
+ ```
128
+
129
+ **Bun**:
130
+
131
+ ```bash
132
+ bun x mastra dev
133
+ ```
134
+
135
+ If you import your `mastra` instance directly, `agents/<name>/` directories and the other conventions aren't discovered. When you consume Mastra as a library, register those primitives in code instead.
@@ -65,7 +65,6 @@ The Reference section provides documentation of Mastra's API, including paramete
65
65
  - [SlackProvider](https://mastra.ai/reference/channels/slack-provider)
66
66
  - [create-mastra](https://mastra.ai/reference/cli/create-mastra)
67
67
  - [mastra](https://mastra.ai/reference/cli/mastra)
68
- - [Agent Builder API](https://mastra.ai/reference/client-js/agent-builder)
69
68
  - [Agents API](https://mastra.ai/reference/client-js/agents)
70
69
  - [Conversations API](https://mastra.ai/reference/client-js/conversations)
71
70
  - [Error Handling](https://mastra.ai/reference/client-js/error-handling)
@@ -123,10 +122,10 @@ The Reference section provides documentation of Mastra's API, including paramete
123
122
  - [BlobStoreProvider](https://mastra.ai/reference/editor/blob-store-provider)
124
123
  - [MastraEditor Class](https://mastra.ai/reference/editor/mastra-editor)
125
124
  - [ProcessorProvider](https://mastra.ai/reference/editor/processor-provider)
125
+ - [Prompt blocks](https://mastra.ai/reference/editor/prompt-blocks)
126
+ - [Tool configuration](https://mastra.ai/reference/editor/tools)
126
127
  - [ToolProvider](https://mastra.ai/reference/editor/tool-provider)
127
- - [AgentBuilderOptions](https://mastra.ai/reference/editor/agent-builder/agent-builder-options)
128
- - [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults)
129
- - [Models default](https://mastra.ai/reference/editor/agent-builder/builder-models)
128
+ - [Versioning](https://mastra.ai/reference/editor/versioning)
130
129
  - [BrowserProvider](https://mastra.ai/reference/editor/browser-provider)
131
130
  - [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref)
132
131
  - [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider)
@@ -152,6 +151,7 @@ The Reference section provides documentation of Mastra's API, including paramete
152
151
  - [Noise Sensitivity Scorer](https://mastra.ai/reference/evals/noise-sensitivity)
153
152
  - [Prompt Alignment Scorer](https://mastra.ai/reference/evals/prompt-alignment)
154
153
  - [Rubric Scorer](https://mastra.ai/reference/evals/rubric)
154
+ - [Summarization Scorer](https://mastra.ai/reference/evals/summarization)
155
155
  - [Textual Difference Scorer](https://mastra.ai/reference/evals/textual-difference)
156
156
  - [Tone Consistency Scorer](https://mastra.ai/reference/evals/tone-consistency)
157
157
  - [Tool Call Accuracy Scorers](https://mastra.ai/reference/evals/tool-call-accuracy)