@mastra/mcp-docs-server 1.2.26 → 1.2.27-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 (91) hide show
  1. package/.docs/docs/agents/structured-output.md +17 -0
  2. package/.docs/docs/connections/a2a.md +4 -3
  3. package/.docs/docs/deployment/monorepo.md +2 -2
  4. package/.docs/docs/evals/datasets.md +53 -0
  5. package/.docs/docs/guides/build-an-eval-loop.md +395 -0
  6. package/.docs/docs/harness/durable-agents.md +27 -2
  7. package/.docs/docs/mastra-platform/alerts.md +83 -0
  8. package/.docs/docs/mastra-platform/observability.md +184 -0
  9. package/.docs/docs/mastra-platform/overview.md +2 -0
  10. package/.docs/docs/memory/message-history.md +21 -0
  11. package/.docs/docs/memory/observational-memory.md +33 -0
  12. package/.docs/docs/observability/feedback.md +1 -1
  13. package/.docs/docs/observability/tracing/overview.md +2 -0
  14. package/.docs/docs/server/custom-adapters.md +43 -0
  15. package/.docs/docs/subagents.md +38 -7
  16. package/.docs/integrations/channels/github.md +6 -2
  17. package/.docs/integrations/databases/clickhouse.md +1 -1
  18. package/.docs/integrations/observability/confident-ai.md +67 -43
  19. package/.docs/integrations/observability/langfuse.md +4 -0
  20. package/.docs/integrations/observability/opentelemetry.md +14 -6
  21. package/.docs/integrations/sandboxes/cloudflare-sandbox.md +36 -4
  22. package/.docs/models/environment-variables.md +5 -1
  23. package/.docs/models/gateways/netlify.md +8 -4
  24. package/.docs/models/gateways/openrouter.md +5 -2
  25. package/.docs/models/gateways/vercel.md +378 -379
  26. package/.docs/models/index.md +22 -1
  27. package/.docs/models/providers/ai21.md +78 -0
  28. package/.docs/models/providers/ainetcafe.md +77 -0
  29. package/.docs/models/providers/alibaba-cn.md +8 -6
  30. package/.docs/models/providers/alibaba-token-plan-cn.md +2 -1
  31. package/.docs/models/providers/alibaba-token-plan.md +3 -1
  32. package/.docs/models/providers/alibaba.md +2 -1
  33. package/.docs/models/providers/chutes.md +2 -2
  34. package/.docs/models/providers/cortecs.md +6 -7
  35. package/.docs/models/providers/digitalocean.md +1 -1
  36. package/.docs/models/providers/edenai.md +4 -7
  37. package/.docs/models/providers/empiriolabs.md +2 -1
  38. package/.docs/models/providers/fireworks-ai.md +11 -10
  39. package/.docs/models/providers/hyper.md +26 -37
  40. package/.docs/models/providers/inception.md +3 -3
  41. package/.docs/models/providers/inco.md +83 -0
  42. package/.docs/models/providers/iteracompute.md +14 -7
  43. package/.docs/models/providers/kilo.md +12 -9
  44. package/.docs/models/providers/llmgateway-providers.md +4 -2
  45. package/.docs/models/providers/llmgateway.md +1 -1
  46. package/.docs/models/providers/mistral.md +3 -2
  47. package/.docs/models/providers/nano-gpt.md +10 -19
  48. package/.docs/models/providers/nvidia.md +2 -1
  49. package/.docs/models/providers/oci.md +85 -0
  50. package/.docs/models/providers/ofox.md +24 -23
  51. package/.docs/models/providers/opencode.md +2 -1
  52. package/.docs/models/providers/ovhcloud.md +1 -1
  53. package/.docs/models/providers/privatemode-ai.md +3 -3
  54. package/.docs/models/providers/scnet-token-plan.md +2 -1
  55. package/.docs/models/providers/synthetic.md +2 -1
  56. package/.docs/models/providers/tensorx.md +2 -1
  57. package/.docs/models/providers/tinfoil.md +1 -1
  58. package/.docs/models/providers/umans-ai-coding-plan.md +3 -4
  59. package/.docs/models/providers/umans-ai.md +3 -4
  60. package/.docs/models/providers/vancine.md +10 -10
  61. package/.docs/models/providers/volcengine.md +3 -2
  62. package/.docs/models/providers/wandb.md +4 -4
  63. package/.docs/models/providers/xai.md +1 -3
  64. package/.docs/models/providers/zhipuai-coding-plan.md +2 -8
  65. package/.docs/models/providers.md +5 -1
  66. package/.docs/reference/agents/durable-agent.md +9 -1
  67. package/.docs/reference/agents/generate.md +1 -1
  68. package/.docs/reference/agents/inngest-agent.md +2 -0
  69. package/.docs/reference/auth/clerk.md +25 -1
  70. package/.docs/reference/cli/mastra.md +84 -0
  71. package/.docs/reference/client-js/agents.md +25 -0
  72. package/.docs/reference/client-js/mastra-client.md +1 -1
  73. package/.docs/reference/client-js/observability.md +101 -4
  74. package/.docs/reference/code-sdk/mount-agent-controller.md +23 -0
  75. package/.docs/reference/core/getMCPServer.md +47 -0
  76. package/.docs/reference/core/mastra-class.md +1 -1
  77. package/.docs/reference/index.md +2 -0
  78. package/.docs/reference/memory/memory-class.md +2 -0
  79. package/.docs/reference/memory/observational-memory.md +34 -4
  80. package/.docs/reference/observability/tracing/interfaces.md +3 -1
  81. package/.docs/reference/observability/tracing/trace-query.md +219 -46
  82. package/.docs/reference/pubsub/redis-streams.md +34 -0
  83. package/.docs/reference/rag/vector-databases.md +73 -0
  84. package/.docs/reference/storage/retention.md +56 -4
  85. package/.docs/reference/streaming/agents/stream.md +1 -1
  86. package/.docs/reference/tools/mcp-server.md +0 -28
  87. package/.docs/reference/vectors/azure-ai-search.md +150 -0
  88. package/.docs/reference/vectors/weaviate.md +128 -0
  89. package/.docs/reference/workspace/workspace-class.md +10 -2
  90. package/package.json +10 -12
  91. package/.docs/docs/connections/connect-mcp-client.md +0 -211
@@ -1079,6 +1079,90 @@ See the [Storage migration guide](https://mastra.ai/reference/migrations/upgrade
1079
1079
 
1080
1080
  It accepts [common flags](#common-flags).
1081
1081
 
1082
+ ## `mastra traces import`
1083
+
1084
+ Imports historical traces from a supported observability provider into an existing Mastra Platform project. The command prepares complete traces locally, uploads whole-trace batches, supports resume, and verifies a sample through Mastra Platform.
1085
+
1086
+ ```bash
1087
+ mastra traces import <provider> [options]
1088
+ ```
1089
+
1090
+ The following provider is currently supported:
1091
+
1092
+ | Provider | Argument | Requirements |
1093
+ | -------- | ---------- | -------------------------------------------------- |
1094
+ | Langfuse | `langfuse` | Langfuse Cloud or self-hosted Langfuse v4 or later |
1095
+
1096
+ See [Import existing traces](https://mastra.ai/docs/mastra-platform/observability) for the complete workflow, data mapping, local-file lifecycle, and limits.
1097
+
1098
+ ### Options
1099
+
1100
+ #### `--project <name|slug|id>`
1101
+
1102
+ Selects the destination Mastra Platform project. `MASTRA_PROJECT_ID` takes precedence when set. Without either value, the command uses the project linked in `.mastra-project.json`.
1103
+
1104
+ #### `--from <date>`
1105
+
1106
+ Sets the inclusive start of the import window as an ISO 8601 date or timestamp. It defaults to 30 days before `--to`, clamped to the current 30-day Platform retention boundary.
1107
+
1108
+ #### `--to <date>`
1109
+
1110
+ Sets the exclusive end of the import window as an ISO 8601 date or timestamp. It defaults to the time when the import starts and can't be in the future.
1111
+
1112
+ The complete window must fall within the current 30-day Platform retention period, `--from` must be earlier than `--to`, and the window can't exceed 30 days.
1113
+
1114
+ #### `--dry-run`
1115
+
1116
+ Reads the source and prepares valid traces locally without uploading them. The command writes a report and prints a command that resumes the prepared import.
1117
+
1118
+ #### `--resume <import-id>`
1119
+
1120
+ Resumes a prepared import using its saved provider, destination project, date window, and acknowledged progress. Use the same destination project shown in the generated resume command. This option can't be combined with `--from`, `--to`, or `--dry-run`.
1121
+
1122
+ #### `-y, --yes`
1123
+
1124
+ Uploads without asking for confirmation.
1125
+
1126
+ ### Environment variables
1127
+
1128
+ The command loads `.env` and `.env.local` from the current directory.
1129
+
1130
+ | Variable | Required | Description |
1131
+ | ------------------------------ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
1132
+ | `LANGFUSE_PUBLIC_KEY` | For new Langfuse imports | Public project API key. |
1133
+ | `LANGFUSE_SECRET_KEY` | For new Langfuse imports | Secret project API key. |
1134
+ | `LANGFUSE_BASE_URL` | No | Langfuse host. Defaults to `https://cloud.langfuse.com`. |
1135
+ | `MASTRA_API_TOKEN` | For headless authentication | Mastra Platform API token. Without it, the command uses credentials from `mastra auth login`. |
1136
+ | `MASTRA_ORG_ID` | With `MASTRA_API_TOKEN` | Organization that owns the destination project. |
1137
+ | `MASTRA_PLATFORM_ACCESS_TOKEN` | For upload and read-back with interactive login | Mastra Platform access token for the destination. Not required for `--dry-run` or when `MASTRA_API_TOKEN` is set. |
1138
+ | `MASTRA_PROJECT_ID` | When no project is otherwise linked | Destination project ID. Takes precedence over `--project`. |
1139
+
1140
+ ### Examples
1141
+
1142
+ Preview the default 30-day window without uploading:
1143
+
1144
+ ```bash
1145
+ mastra traces import langfuse --project my-project --dry-run
1146
+ ```
1147
+
1148
+ Import a smaller date window without a confirmation prompt:
1149
+
1150
+ ```bash
1151
+ mastra traces import langfuse \
1152
+ --project my-project \
1153
+ --from "$FROM" \
1154
+ --to "$TO" \
1155
+ --yes
1156
+ ```
1157
+
1158
+ Resume an existing import:
1159
+
1160
+ ```bash
1161
+ mastra traces import langfuse \
1162
+ --resume 00000000-0000-0000-0000-000000000000 \
1163
+ --project my-project
1164
+ ```
1165
+
1082
1166
  ## `mastra api`
1083
1167
 
1084
1168
  Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra platform projects, self-hosted Mastra servers, or hosted Mastra Platform Observability APIs.
@@ -119,6 +119,31 @@ while (true) {
119
119
  }
120
120
  ```
121
121
 
122
+ #### Cancelling a stream
123
+
124
+ Cancelling the response body aborts the underlying HTTP request and stops any pending client tool executions and follow-up requests:
125
+
126
+ ```typescript
127
+ const response = await agent.stream('Tell me a story')
128
+ const reader = response.body.getReader()
129
+
130
+ const { value } = await reader.read()
131
+ await reader.cancel('user navigated away')
132
+ ```
133
+
134
+ You can also pass an `abortSignal` to cancel from outside the stream. The same option is available on `streamUntilIdle()`, `resumeStream()`, `resumeStreamUntilIdle()`, `approveToolCall()`, `declineToolCall()`, `generate()`, and `generateLegacy()`:
135
+
136
+ ```typescript
137
+ const controller = new AbortController()
138
+
139
+ const response = await agent.stream('Tell me a story', {
140
+ abortSignal: controller.signal,
141
+ })
142
+
143
+ // Later
144
+ controller.abort()
145
+ ```
146
+
122
147
  #### AI SDK compatible format
123
148
 
124
149
  To stream AI SDK-formatted parts on the client from an `agent.stream(...)` response, wrap `response.processDataStream` into a `ReadableStream<ChunkType>` and use `toAISdkStream`:
@@ -81,7 +81,7 @@ You can also pass `requestContext` as a `Record<string, any>`.
81
81
 
82
82
  **getWorkflow(workflowId)** (`Workflow`): Retrieves a specific workflow instance by ID.
83
83
 
84
- **getAgentBuilderActions()** (`Promise<Record<string, WorkflowInfo>>`): Returns all available Agent Builder actions. See Agent Builder API.
84
+ **getAgentBuilderActions()** (`Promise<GetAgentBuilderActionsResponse>`): Returns all available Agent Builder actions. See Agent Builder API.
85
85
 
86
86
  **getAgentBuilderAction(actionId)** (`AgentBuilder`): Retrieves an Agent Builder action by ID. See Agent Builder API.
87
87
 
@@ -65,9 +65,9 @@ const selected = await mastraClient.getTrace(list.spans[0].traceId)
65
65
 
66
66
  It accepts the same filtering, ordering and delta-polling arguments as `listTraces()`. Use `listTraces()` when you actually need the full span payloads.
67
67
 
68
- ## Querying traces with recursive predicates
68
+ ## Querying traces and threads
69
69
 
70
- `queryTraces()` finds completed logical traces using trace fields and conditions over related spans or scores. Every query requires an ISO timestamp range of at most 31 days.
70
+ `queryTraces()` finds completed logical traces using trace fields and conditions over related spans, scores, or feedback. Every query requires an ISO timestamp range of at most 31 days.
71
71
 
72
72
  ```typescript
73
73
  const result = await mastraClient.queryTraces({
@@ -89,9 +89,106 @@ const result = await mastraClient.queryTraces({
89
89
  })
90
90
  ```
91
91
 
92
- The API limits predicate depth, nodes, related clauses, set members, literal bytes, and the total literal budget before storage execution. Cursor pages are deterministic but aren't a database snapshot, so signals written between requests can change later pages. PostgreSQL and ClickHouse queries have a configurable 15-second execution timeout.
92
+ ### Discover trace-query fields and values
93
93
 
94
- See [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for the complete limits, request fields, predicates, grouping, cursor pagination, response shapes, and errors.
94
+ `getTraceQueryFields()` returns canonical query fields and observed top-level string metadata fields for one predicate scope. The response includes each field's value kind, supported operators, and whether value suggestions are available.
95
+
96
+ ```typescript
97
+ const timeRange = {
98
+ from: '2026-08-01T00:00:00.000Z',
99
+ to: '2026-08-08T00:00:00.000Z',
100
+ }
101
+
102
+ const fields = await mastraClient.getTraceQueryFields({
103
+ timeRange,
104
+ predicateScope: 'spans',
105
+ search: 'model',
106
+ limit: 25,
107
+ })
108
+ ```
109
+
110
+ Use the exact local path from the response with the same scope. For example, `model` belongs inside a `spans.some` or `spans.none` predicate. A global picker can fetch `trace`, `spans`, `scores`, and `feedback` in parallel.
111
+
112
+ Call `getTraceQueryValues()` only after selecting a field with `valueSuggestions: true`:
113
+
114
+ ```typescript
115
+ const controller = new AbortController()
116
+
117
+ const values = await mastraClient.getTraceQueryValues(
118
+ {
119
+ timeRange,
120
+ predicateScope: 'spans',
121
+ path: 'model',
122
+ search: 'claude',
123
+ limit: 25,
124
+ },
125
+ { signal: controller.signal },
126
+ )
127
+
128
+ // Cancel this autocomplete request when the search text changes.
129
+ controller.abort()
130
+ ```
131
+
132
+ Both methods use case-insensitive literal substring search and accept an empty search. Limits default to 25 and can't exceed 100. Results are ordered by occurrence count, then deterministically by path or value. `observedFieldsTruncated` and `valuesTruncated` indicate that the caller should refine `search`. Discovery has no cursor.
133
+
134
+ Suggestions are bounded and advisory. Manual values remain valid when suggestions are unavailable, empty, or truncated. Discovery doesn't accept a draft query predicate. The client doesn't retry either request, and a per-call `AbortSignal` takes precedence over the signal configured on `MastraClient`.
135
+
136
+ A discovery timeout rejects with `504 TRACE_QUERY_EXECUTION_TIMEOUT`. Backend memory or resource exhaustion rejects with `503 TRACE_QUERY_RESOURCE_LIMIT`. Neither error contains partial suggestions; truncation flags are only present on successful, completely ranked responses.
137
+
138
+ `queryTraceThreads()` returns thread identities derived from observability traces after applying eligibility and cross-trace conditions. It doesn't read or return memory thread records or messages. In this example, one production trace can have the low factuality score while another production trace in the same thread has the clinician correction:
139
+
140
+ ```typescript
141
+ const result = await mastraClient.queryTraceThreads({
142
+ traces: {
143
+ timeRange: {
144
+ from: '2026-08-01T00:00:00.000Z',
145
+ to: '2026-08-08T00:00:00.000Z',
146
+ },
147
+ where: {
148
+ op: 'eq',
149
+ left: { path: 'environment' },
150
+ right: { literal: 'production' },
151
+ },
152
+ },
153
+ where: {
154
+ op: 'and',
155
+ args: [
156
+ {
157
+ traces: {
158
+ some: {
159
+ scores: {
160
+ some: {
161
+ op: 'lt',
162
+ left: { path: 'score' },
163
+ right: { literal: 0.6 },
164
+ },
165
+ },
166
+ },
167
+ },
168
+ },
169
+ {
170
+ traces: {
171
+ some: {
172
+ feedback: {
173
+ some: {
174
+ op: 'eq',
175
+ left: { path: 'feedbackType' },
176
+ right: { literal: 'clinician-correction' },
177
+ },
178
+ },
179
+ },
180
+ },
181
+ },
182
+ ],
183
+ },
184
+ })
185
+
186
+ // { threads: [{ threadId: 'thread-123' }], page: { next: null } }
187
+ ```
188
+
189
+ The API limits predicate depth, nodes, related clauses, set members, literal bytes, and the total literal budget before storage execution. Cursor pages are deterministic but aren't a database snapshot, so signals written between requests can change later pages. PostgreSQL and ClickHouse trace and thread queries have a configurable 15-second execution timeout.
190
+
191
+ See [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for the complete limits, request fields, predicates, thread qualification semantics, cursor pagination, response shapes, and errors.
95
192
 
96
193
  ## Deleting traces
97
194
 
@@ -94,6 +94,29 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
94
94
 
95
95
  **authStorage** (`AuthStorage`): Credential storage used by the built-in model gateway.
96
96
 
97
+ ## Nested controllers in plugins
98
+
99
+ A plugin that boots another controller in the same process must borrow the host's storage instead of opening the same database files with its own native SQLite library.
100
+
101
+ ### `context.getStorage()`
102
+
103
+ The optional accessor on `MastraCodePluginContext` returns the host's `storage` (`MastraCompositeStore`), `storageBackend` (`'libsql' | 'pg'`), and optional `vector` (`MastraVector`). Call it when the tool runs, then pass the returned object to `bootLocalAgentController()`:
104
+
105
+ ```typescript
106
+ import { bootLocalAgentController } from '@mastra/code-sdk'
107
+ import type { MastraCodePluginContext } from '@mastra/code-sdk/plugin'
108
+
109
+ async function bootNestedController(context: MastraCodePluginContext) {
110
+ const sharedStorage = context.getStorage?.()
111
+ if (!sharedStorage) {
112
+ throw new Error('This plugin requires host-provided shared storage.')
113
+ }
114
+ return bootLocalAgentController({ cwd: context.cwd, ...sharedStorage })
115
+ }
116
+ ```
117
+
118
+ The host owns these instances. Stop the nested controller's workers and destroy its controller when finished, but don't close the borrowed stores or invoke its storage-maintenance methods. If the accessor is unavailable on an older host, don't fall back to opening the same database files.
119
+
97
120
  ## Related
98
121
 
99
122
  - [AgentController class](https://mastra.ai/reference/agent-controller/agent-controller-class)
@@ -38,6 +38,53 @@ const serverById = mastra.getMCPServerById('my-mcp-server')
38
38
 
39
39
  **server** (`MCPServerBase | undefined`): The MCP server instance with the specified registry key, or undefined if not found.
40
40
 
41
+ ## MCP 1.x and 2026-07-28 servers
42
+
43
+ Both `@mastra/mcp` 1.x and 2.x servers extend the same `MCPServerBase` from `@mastra/core/mcp`. A 2.x server sets `mcpVersion` to `2`, while 1.x servers leave it undefined and need no new properties or methods. The differences are limited to what the 2026-07-28 protocol changed: `startSSE` and `startHonoSSE` are no longer abstract and throw unless a 1.x server overrides them (only 1.x implements the standalone SSE transport, and both are deprecated), and a server with `mcpVersion` set to `2` resolves `executeTool` to a `MCPToolExecutionResultV2` that reports a suspended tool rather than a bare result.
44
+
45
+ The 1.x-only surfaces are marked `@deprecated` and are removed in the next major release of `@mastra/core`: `startSSE`, `startHonoSSE`, `MCPServerSSEOptions`, `MCPServerHonoSSEOptions`, `MCPServerHTTPOptions.options`, and on `context.mcp` the members `elicitation`, `extra.sendNotification` and `extra.sendRequest`.
46
+
47
+ ### Tools that ask for input
48
+
49
+ A 2026-07-28 server runs ordinary `createTool` definitions. A tool that needs something from the user before it can finish declares `suspendSchema` and `resumeSchema` and calls `suspend()`, exactly as it would for an agent or a workflow. Core reports the suspension as `{ status: 'suspended', suspendPayload, resumeSchema }` from `executeTool`. An `@mastra/mcp` 2.x server turns that into an `input_required` round on the wire, and resumes the tool with the answer in `resumeData`.
50
+
51
+ ```typescript
52
+ import { createTool } from '@mastra/core/tools'
53
+ import { z } from 'zod'
54
+
55
+ const confirm = createTool({
56
+ id: 'confirm',
57
+ description: 'Ask for confirmation before charging',
58
+ inputSchema: z.object({ amount: z.number() }),
59
+ outputSchema: z.boolean(),
60
+ suspendSchema: z.object({ phase: z.literal('confirm'), amount: z.number() }),
61
+ resumeSchema: z.object({ confirmed: z.boolean() }),
62
+ execute: async ({ amount }, context) => {
63
+ if (!context.resumeData) {
64
+ await context.suspend?.({ phase: 'confirm', amount })
65
+ return
66
+ }
67
+ return context.resumeData.confirmed
68
+ },
69
+ })
70
+ ```
71
+
72
+ On a 2026-07-28 server and in direct execution, `suspend`, `resumeData` and `suspendPayload` sit at the top level of the tool context. Agents and workflows still nest them under `context.agent` and `context.workflow` until the next major release of `@mastra/core`. `resumeSchema` must be a flat object of primitive fields so it can be presented as an input form.
73
+
74
+ Each round is a separate request. `resumeData` carries only the current round's answer, validated against `resumeSchema`, and `suspendPayload` carries what the tool last suspended with. Because the framework never replays earlier rounds, handlers branch on explicit named phases, every round is re-authorized, and writes rely on domain-owned idempotency. `suspendPayload` is also handed back to tools resumed by agents and workflows.
75
+
76
+ ### The `mcp` context
77
+
78
+ Both server versions hand a tool the same `context.mcp` (`MCPToolExecutionContext`): `extra` with the request's `signal`, `requestId`, `authInfo` and `_meta`, plus `log(level, message, data?)` and `progress({ progress, total?, message? })`. A tool that only uses these works unchanged on either version. A 2026-07-28 server also sets `context.mcp.protocolVersion` to `'2026-07-28'`.
79
+
80
+ The 2026-07-28 protocol removed server-initiated requests, so on a 2.x server the deprecated members `elicitation.sendRequest`, `extra.sendRequest` and `extra.sendNotification` throw with a message naming the replacement instead of doing nothing. A 1.x server keeps providing them as before. To ask the user for input, call `context.suspend()` and read `context.resumeData`.
81
+
82
+ ### Registration and execution
83
+
84
+ Tools are registered on the Mastra instance exactly as a 1.x server registers them. On a server with `mcpVersion` set to `2`, `executeTool(toolId, args, context?)` returns `{ status: 'completed', output }` or, when the tool suspended, `{ status: 'suspended', suspendPayload, resumeSchema }` with `resumeSchema` as JSON Schema. The result has no failure variant: a tool that throws, or input or resume data that fails its schema, rejects the promise. Shared REST execution endpoints return the suspended shape instead of pretending the tool finished, and accept `resumeData` plus the echoed `suspendPayload` on the next call to continue the tool. Legacy SSE routes remain available only to 1.x servers. A server with `mcpVersion` set to `2` gets a 404 there.
85
+
86
+ Registering another server under an occupied registry key keeps the existing instance. Registry keys and intrinsic server IDs remain distinct.
87
+
41
88
  ## Related methods
42
89
 
43
90
  - [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById): Retrieve an MCP server by its intrinsic `id` property
@@ -131,7 +131,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
131
131
 
132
132
  **recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off' }`)
133
133
 
134
- **recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
134
+ **recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
135
135
 
136
136
  ## Methods
137
137
 
@@ -352,6 +352,7 @@ The Reference section provides documentation of Mastra's API, including paramete
352
352
  - [Task tools](https://mastra.ai/reference/tools/task-tools)
353
353
  - [Amazon S3 Vector Store](https://mastra.ai/reference/vectors/s3vectors)
354
354
  - [Astra Vector Store](https://mastra.ai/reference/vectors/astra)
355
+ - [Azure AI Search Vector Store](https://mastra.ai/reference/vectors/azure-ai-search)
355
356
  - [Chroma Vector Store](https://mastra.ai/reference/vectors/chroma)
356
357
  - [Cloudflare Vector Store](https://mastra.ai/reference/vectors/vectorize)
357
358
  - [Convex Vector Store](https://mastra.ai/reference/vectors/convex)
@@ -368,6 +369,7 @@ The Reference section provides documentation of Mastra's API, including paramete
368
369
  - [Qdrant Vector Store](https://mastra.ai/reference/vectors/qdrant)
369
370
  - [Turbopuffer Vector Store](https://mastra.ai/reference/vectors/turbopuffer)
370
371
  - [Upstash Vector Store](https://mastra.ai/reference/vectors/upstash)
372
+ - [Weaviate Vector Store](https://mastra.ai/reference/vectors/weaviate)
371
373
  - [Overview](https://mastra.ai/reference/voice/overview)
372
374
  - [Composite Voice](https://mastra.ai/reference/voice/composite-voice)
373
375
  - [Events](https://mastra.ai/reference/voice/voice.events)
@@ -41,6 +41,8 @@ export const agent = new Agent({
41
41
 
42
42
  **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable the message history feature entirely (messages are not loaded into context or saved). Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To load messages without saving new ones, use the readOnly option. The window slides forward on every request, so once a thread exceeds the limit, each turn invalidates the provider prompt cache. For long-running conversations, use Observational Memory instead.
43
43
 
44
+ **options.messageHistory** (`{ maxTokens: number; atMaxRemoveTokens?: number }`): Token budget for the complete prompt, including remembered history, system instructions, context, and the current turn. When the prompt exceeds maxTokens, the oldest remembered messages are dropped until the prompt is at most maxTokens - atMaxRemoveTokens (defaults to 25% of maxTokens). Protected content is never removed. Linked tool calls and results are removed together. During agent runs, trimmed history is excluded from later turns via a persisted per-thread boundary, but the messages themselves stay in storage. When set without an explicit lastMessages, the default 10-message cap is not applied. Set maxTokens to 0 to disable message history. Prefer this over lastMessages, since message count is a poor proxy for context size.
45
+
44
46
  **options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
45
47
 
46
48
  **options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires both vector store and embedder to be configured. Default topK is 4, default messageRange is {before: 1, after: 1}.
@@ -73,9 +73,9 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
73
73
 
74
74
  **observation.maxTokensPerBatch** (`number`): Maximum tokens per batch when observing multiple threads in resource scope. Threads are chunked into batches of this size and processed in parallel. Lower values mean more parallelism but more API calls.
75
75
 
76
- **observation.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Observer agent. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
76
+ **observation.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Observer agent. The temperature: 0.3 default is only applied when the resolved model is known to support temperature. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
77
77
 
78
- **observation.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output.
78
+ **observation.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output. The 0.3 default is only applied when the resolved model is known to support temperature.
79
79
 
80
80
  **observation.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations. The 100000 default is only applied with default model selection; custom models get no default.
81
81
 
@@ -107,9 +107,9 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
107
107
 
108
108
  **reflection.observationTokens** (`number`): Token count of observations that triggers reflection. When observation tokens exceed this threshold, the Reflector agent is called to condense them.
109
109
 
110
- **reflection.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
110
+ **reflection.modelSettings** (`ObservationalMemoryModelSettings`): Model settings for the Reflector agent. The temperature: 0 default is only applied when the resolved model is known to support temperature. The maxOutputTokens: 100\_000 default is only applied with default model selection (no model set, "default", or a ModelByInputTokens selector). Custom models get no maxOutputTokens default.
111
111
 
112
- **reflection.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output.
112
+ **reflection.modelSettings.temperature** (`number`): Temperature for generation. Lower values produce more consistent output. The 0 default is only applied when the resolved model is known to support temperature.
113
113
 
114
114
  **reflection.modelSettings.maxOutputTokens** (`number`): Maximum output tokens. Set high to prevent truncation of observations. The 100000 default is only applied with default model selection; custom models get no default.
115
115
 
@@ -883,6 +883,36 @@ const selector = new ModelByInputTokens({
883
883
 
884
884
  **getThresholds** (`() => number[]`): Returns the configured thresholds in ascending order. Useful for introspection.
885
885
 
886
+ ### skillResultRedactor
887
+
888
+ `skillResultRedactor` builds a `beforeObservation` transform hook that redacts the results of the built-in Agent Skills tools (`skill`, `skill_search`, and `skill_read`) before the Observer model sees them. Each result is replaced with a placeholder while the tool call is kept, so the Observer still records which skill was used and what it was called with, without the skill text.
889
+
890
+ ```typescript
891
+ import { Memory } from '@mastra/memory'
892
+ import { skillResultRedactor } from '@mastra/memory/hooks'
893
+
894
+ const memory = new Memory({
895
+ options: {
896
+ observationalMemory: {
897
+ model: 'google/gemini-2.5-flash',
898
+ hooks: {
899
+ beforeObservation: skillResultRedactor(),
900
+ },
901
+ },
902
+ },
903
+ })
904
+ ```
905
+
906
+ #### Parameters
907
+
908
+ **toolNames** (`readonly string[]`): Tool names whose results are redacted. Defaults to the built-in skill tools: skill, skill\_search, and skill\_read. Use this to redact a different set of tool results.
909
+
910
+ #### Returns
911
+
912
+ `(input: { messages: MastraDBMessage[] } & ObserveHookContext) => { messages: MastraDBMessage[] } | undefined`
913
+
914
+ The hook returns messages with matching tool results replaced by a placeholder, or `undefined` when no message matched (which passes the payload through unchanged). Tool calls, arguments, and every other message are left as they are.
915
+
886
916
  ### Related
887
917
 
888
918
  - [Observational Memory](https://mastra.ai/docs/memory/observational-memory)
@@ -346,12 +346,14 @@ Use `onDroppedEvent` on a custom exporter or bridge to forward these events to e
346
346
 
347
347
  Interface for span output processors.
348
348
 
349
+ `process()` must mutate the span it receives and return the same instance, or return `undefined` to drop the span. A copy of the span (for example `{ ...span }`) can't be exported because `exportSpan()` and `isValid` are instance members of the live span; if a processor returns one, Mastra logs a processor error and drops the span.
350
+
349
351
  ```typescript
350
352
  interface SpanOutputProcessor {
351
353
  /** Processor name */
352
354
  name: string
353
355
 
354
- /** Process span before export */
356
+ /** Process span before export. Mutate in place and return the same span, or return undefined to drop it. */
355
357
  process(span?: AnySpan): AnySpan | undefined
356
358
 
357
359
  /** Shutdown processor */