@mastra/mcp-docs-server 1.3.8-alpha.0 → 1.3.8-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 (58) hide show
  1. package/.docs/docs/agents/processors.md +2 -0
  2. package/.docs/docs/agents/tools.md +3 -2
  3. package/.docs/docs/connections/mcp.md +2 -0
  4. package/.docs/docs/guides/mcp-authentication-authorization.md +10 -1
  5. package/.docs/docs/harness/agent-controller.md +2 -1
  6. package/.docs/docs/harness/signals.md +22 -0
  7. package/.docs/docs/mastra-platform/connect/providers.md +28 -113
  8. package/.docs/docs/mastra-platform/observability.md +23 -2
  9. package/.docs/docs/server/middleware.md +4 -0
  10. package/.docs/integrations/databases/clickhouse.md +1 -1
  11. package/.docs/models/environment-variables.md +2 -0
  12. package/.docs/models/gateways/neon.md +11 -1
  13. package/.docs/models/gateways/netlify.md +3 -1
  14. package/.docs/models/gateways/openrouter.md +1 -1
  15. package/.docs/models/index.md +3 -1
  16. package/.docs/models/providers/agnes.md +3 -3
  17. package/.docs/models/providers/aimlapi.md +3 -7
  18. package/.docs/models/providers/aixy.md +17 -13
  19. package/.docs/models/providers/boundless.md +96 -0
  20. package/.docs/models/providers/cortecs.md +2 -1
  21. package/.docs/models/providers/crossmodel.md +2 -1
  22. package/.docs/models/providers/digitalocean.md +1 -1
  23. package/.docs/models/providers/edenai.md +15 -11
  24. package/.docs/models/providers/kilo.md +18 -17
  25. package/.docs/models/providers/llmgateway-providers.md +5 -13
  26. package/.docs/models/providers/llmgateway.md +5 -6
  27. package/.docs/models/providers/lowrouter.md +21 -2
  28. package/.docs/models/providers/nano-gpt.md +11 -16
  29. package/.docs/models/providers/nvidia.md +1 -1
  30. package/.docs/models/providers/ofox.md +2 -1
  31. package/.docs/models/providers/opencode-go.md +34 -35
  32. package/.docs/models/providers/opencode.md +2 -4
  33. package/.docs/models/providers/ovhcloud.md +1 -2
  34. package/.docs/models/providers/poe.md +6 -1
  35. package/.docs/models/providers/prime.md +2 -1
  36. package/.docs/models/providers/sambanova.md +82 -0
  37. package/.docs/models/providers/scaleway.md +2 -1
  38. package/.docs/models/providers/sensenova.md +2 -1
  39. package/.docs/models/providers/wandb.md +2 -2
  40. package/.docs/models/providers.md +2 -0
  41. package/.docs/reference/agent-controller/session.md +13 -0
  42. package/.docs/reference/agents/agent.md +20 -2
  43. package/.docs/reference/cli/mastra.md +12 -4
  44. package/.docs/reference/client-js/agents.md +17 -0
  45. package/.docs/reference/client-js/observability.md +11 -92
  46. package/.docs/reference/code-sdk/mount-agent-controller.md +2 -0
  47. package/.docs/reference/index.md +1 -1
  48. package/.docs/reference/memory/observational-memory.md +13 -0
  49. package/.docs/reference/observability/tracing/trace-query.md +198 -443
  50. package/.docs/reference/processors/provider-history-compat.md +1 -1
  51. package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
  52. package/.docs/reference/processors/tool-search-processor.md +3 -3
  53. package/.docs/reference/server/routes.md +17 -6
  54. package/.docs/reference/storage/retention.md +15 -12
  55. package/.docs/reference/streaming/ChunkType.md +4 -0
  56. package/.docs/reference/tools/create-tool.md +2 -0
  57. package/.docs/reference/tools/mcp-server.md +1 -1
  58. package/package.json +5 -5
@@ -1648,19 +1648,27 @@ mastra api trace list '{"page":0,"perPage":20}' --verbose
1648
1648
 
1649
1649
  #### `mastra api trace query`
1650
1650
 
1651
- Queries completed observability traces with recursive predicates over trace and related span or score fields. The inline JSON input is required. Like other observability commands, it targets `https://observability.mastra.ai` by default.
1651
+ Queries completed observability traces with recursive predicates over trace fields and related spans. The inline JSON input is required and uses the same query structure as the SDK and HTTP API. Like other observability commands, it targets `https://observability.mastra.ai` by default. Pass `--url http://localhost:4111` to query a local server.
1652
1652
 
1653
1653
  ```bash
1654
1654
  mastra api trace query <input>
1655
1655
  mastra api trace query '{"timeRange":{"from":"2026-08-01T00:00:00.000Z","to":"2026-08-08T00:00:00.000Z"}}'
1656
1656
  ```
1657
1657
 
1658
- Inspect the target server's exact request contract before constructing a query:
1658
+ Inspect the command with:
1659
1659
 
1660
1660
  ```bash
1661
- mastra api trace query --schema
1661
+ mastra api trace query --help
1662
1662
  ```
1663
1663
 
1664
+ For supported fields, operators, and request options, see [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query). For a local Mastra server, you can also inspect its request and response schemas:
1665
+
1666
+ ```bash
1667
+ mastra api --url http://localhost:4111 trace query --schema
1668
+ ```
1669
+
1670
+ Mastra Platform doesn't currently expose the schema endpoint used by `--schema`. To find fields and values recorded in your project, use [field and value discovery](https://mastra.ai/reference/observability/tracing/trace-query).
1671
+
1664
1672
  The response remains nested under `data` to preserve cursor pagination:
1665
1673
 
1666
1674
  ```json
@@ -1672,7 +1680,7 @@ The response remains nested under `data` to preserve cursor pagination:
1672
1680
  }
1673
1681
  ```
1674
1682
 
1675
- Pass a non-null `page.next` value back as `page.after` in the next query. See [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for supported fields and operators, recursive predicates, limits, pagination, and errors.
1683
+ Each invocation makes one query. Pass a non-null `data.page.next` value back as `page.after` in the next query. See [Pagination and errors](https://mastra.ai/reference/observability/tracing/trace-query) for pagination modes, cursor handling, and errors.
1676
1684
 
1677
1685
  To load a numbered page and then poll, keep the same time range and predicate in both requests:
1678
1686
 
@@ -213,6 +213,23 @@ await agent.queueMessage({
213
213
  })
214
214
  ```
215
215
 
216
+ ### `queueSignal()`
217
+
218
+ Queue a typed signal for the next thread turn. It follows the same ordering as `queueMessage()`, but keeps the signal's `type`, `tagName`, and `attributes`.
219
+
220
+ ```typescript
221
+ await agent.queueSignal({
222
+ signal: {
223
+ type: 'reactive',
224
+ tagName: 'skill',
225
+ attributes: { name: 'triage' },
226
+ contents: 'Triage the new issue.',
227
+ },
228
+ resourceId: 'user-123',
229
+ threadId: 'thread-abc',
230
+ })
231
+ ```
232
+
216
233
  ### `sendSignal()`
217
234
 
218
235
  Send a lower-level signal to an active agent run or memory thread. Use this for system-generated context such as reactive reminders or notification-shaped context that doesn't need inbox storage. For durable notification records, use the server-side [`Agent.sendNotificationSignal()`](https://mastra.ai/reference/agents/agent) API. For user-authored input, prefer `sendMessage()` or `queueMessage()`.
@@ -45,7 +45,7 @@ const completeTrace = await mastraClient.getTrace(traces.spans[0].traceId)
45
45
 
46
46
  ## Listing traces for a list view
47
47
 
48
- `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries a short `inputPreview` string instead, so a list can render a preview column without transferring the whole prompt, plus `threadId` and `resourceId` for the memory context columns.
48
+ `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries short `inputPreview`, `outputPreview` and `errorPreview` strings instead (at most 100 characters, ending with `…` when cut), so a list can render preview columns without transferring the whole payload, plus `threadId` and `resourceId` for the memory context columns.
49
49
 
50
50
  Prefer it whenever you are rendering many traces at once, and fetch the full record only when a row is opened:
51
51
 
@@ -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 and threads
68
+ ## Querying traces
69
69
 
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.
70
+ `queryTraces()` finds completed logical traces using trace fields and conditions over related spans. Every query requires an ISO timestamp range.
71
71
 
72
72
  ```typescript
73
73
  const result = await mastraClient.queryTraces({
@@ -76,12 +76,12 @@ const result = await mastraClient.queryTraces({
76
76
  to: '2026-08-08T00:00:00.000Z',
77
77
  },
78
78
  where: {
79
- scores: {
79
+ spans: {
80
80
  some: {
81
81
  op: 'and',
82
82
  args: [
83
- { op: 'eq', left: { path: 'scorerId' }, right: { literal: 'factuality' } },
84
- { op: 'lt', left: { path: 'score' }, right: { literal: 0.6 } },
83
+ { op: 'eq', left: { path: 'spanType' }, right: { literal: 'tool_call' } },
84
+ { op: 'exists', path: 'error' },
85
85
  ],
86
86
  },
87
87
  },
@@ -89,6 +89,8 @@ const result = await mastraClient.queryTraces({
89
89
  })
90
90
  ```
91
91
 
92
+ See [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for request fields, predicates, limits, response shapes, and errors.
93
+
92
94
  ### Load a page and poll for traces
93
95
 
94
96
  `queryTraces()` supports keyset traversal with `page`, numbered pages with `pagination`, and delta polling with `mode: 'delta'`. Use one mode per request. To migrate from `listTracesLight()`, read `traces` instead of `spans` and retain the numbered page's `deltaCursor`:
@@ -114,7 +116,7 @@ const changes = await mastraClient.queryTraces({
114
116
 
115
117
  Merge `changes.traces` by `traceId`, retain `changes.deltaCursor`, and continue while `changes.delta.hasMore` is `true`. Keep the same time range and predicate across polls. Only completed traces are returned; polling doesn't guarantee notifications for related-record updates, deletions, or traces that stop matching.
116
118
 
117
- See [Delta polling](https://mastra.ai/reference/observability/tracing/trace-query) for bootstrap behavior, cursor lifetime, retention, and a complete polling loop. `queryTraceThreads()` remains keyset-only.
119
+ See [Delta polling](https://mastra.ai/reference/observability/tracing/trace-query) for bootstrap behavior, cursor lifetime, retention, and a complete polling loop.
118
120
 
119
121
  ### Discover trace-query fields and values
120
122
 
@@ -134,7 +136,7 @@ const fields = await mastraClient.getTraceQueryFields({
134
136
  })
135
137
  ```
136
138
 
137
- 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.
139
+ 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 field picker can fetch the `trace` and `spans` scopes in parallel.
138
140
 
139
141
  Call `getTraceQueryValues()` only after selecting a field with `valueSuggestions: true`:
140
142
 
@@ -162,89 +164,6 @@ Suggestions are bounded and advisory. Manual values remain valid when suggestion
162
164
 
163
165
  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.
164
166
 
165
- `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:
166
-
167
- ```typescript
168
- const result = await mastraClient.queryTraceThreads({
169
- traces: {
170
- timeRange: {
171
- from: '2026-08-01T00:00:00.000Z',
172
- to: '2026-08-08T00:00:00.000Z',
173
- },
174
- where: {
175
- op: 'eq',
176
- left: { path: 'environment' },
177
- right: { literal: 'production' },
178
- },
179
- },
180
- where: {
181
- op: 'and',
182
- args: [
183
- {
184
- traces: {
185
- some: {
186
- scores: {
187
- some: {
188
- op: 'lt',
189
- left: { path: 'score' },
190
- right: { literal: 0.6 },
191
- },
192
- },
193
- },
194
- },
195
- },
196
- {
197
- traces: {
198
- some: {
199
- feedback: {
200
- some: {
201
- op: 'eq',
202
- left: { path: 'feedbackType' },
203
- right: { literal: 'clinician-correction' },
204
- },
205
- },
206
- },
207
- },
208
- },
209
- ],
210
- },
211
- })
212
-
213
- // { threads: [{ threadId: 'thread-123' }], page: { next: null } }
214
- ```
215
-
216
- 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.
217
-
218
- 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.
219
-
220
- ## Querying spans
221
-
222
- `querySpans()` returns one row per matching completed span across traces. Use it to list the spans themselves. `queryTraces()` with a `spans.some` predicate returns the traces that contain a matching span instead. Every query requires an ISO timestamp range of at most 31 days.
223
-
224
- ```typescript
225
- const result = await mastraClient.querySpans({
226
- timeRange: {
227
- from: '2026-10-01T00:00:00.000Z',
228
- to: '2026-10-02T00:00:00.000Z',
229
- },
230
- where: {
231
- op: 'eq',
232
- left: { path: 'spanType' },
233
- right: { literal: 'tool_call' },
234
- },
235
- orderBy: [{ field: 'startedAt', direction: 'desc' }],
236
- page: { limit: 50 },
237
- })
238
-
239
- // { spans: [{ traceId, spanId, name, spanType, status, durationMs, cost, ... }], page: { next } }
240
- ```
241
-
242
- Pass `result.page.next` back as `page.after` with the same time range, filter, and ordering to load the next page. Each row contains identifiers, display fields, input and output previews, and the span's model cost. Use `getSpan()` to load the full span.
243
-
244
- Span queries are optional for observability stores. Check `capabilities.spanQuery` from `getObservabilityCapabilities()` before calling `querySpans()`, and treat a missing value as unsupported. Unsupported servers reject with `501 SPAN_QUERY_UNSUPPORTED`.
245
-
246
- See [Query individual spans](https://mastra.ai/reference/observability/tracing/trace-query) for filters, ordering, cursors, cost states, limits, and errors.
247
-
248
167
  ## Deleting traces
249
168
 
250
169
  Delete traces and their associated spans, metrics, logs, scores, and feedback:
@@ -393,7 +312,7 @@ const ratingPercentiles = await mastraClient.getFeedbackPercentiles({
393
312
 
394
313
  ## Related
395
314
 
396
- - [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query): Query completed traces with recursive predicates
315
+ - [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query): Query completed traces with recursive predicates
397
316
  - [Feedback guide](https://mastra.ai/docs/observability/feedback): Learn how to create, list, and query feedback
398
317
  - [Feedback reference](https://mastra.ai/reference/observability/feedback): Review feedback schemas and HTTP routes
399
318
  - [Agents API](https://mastra.ai/reference/client-js/agents): Learn about agent interactions that generate traces
@@ -72,6 +72,8 @@ const { controller } = await mountAgentControllerOnMastra({ mastra })
72
72
 
73
73
  **disabledTools** (`string[]`): Tools removed from the dynamic tool set before exposure to the model.
74
74
 
75
+ **disableBuiltinTools** (`BuiltinToolId[]`): Agent controller built-in tools (for example, 'submit\_plan') removed from every session. Tool guidance skips disabled tools, and plan mode writes the plan file instead of calling 'submit\_plan' when it's disabled.
76
+
75
77
  **storage** (`StorageConfig`): Custom storage config instead of the auto-detected default.
76
78
 
77
79
  **workspace** (`AgentControllerConfig["workspace"]`): Override the workspace. (Default: `local filesystem + local sandbox based on the detected project`)
@@ -266,11 +266,11 @@ The Reference section provides documentation of Mastra's API, including paramete
266
266
  - [Automatic Metrics](https://mastra.ai/reference/observability/metrics/automatic-metrics)
267
267
  - [Metric queries](https://mastra.ai/reference/observability/metrics/queries)
268
268
  - [Configuration](https://mastra.ai/reference/observability/tracing/configuration)
269
- - [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query)
270
269
  - [Instances](https://mastra.ai/reference/observability/tracing/instances)
271
270
  - [Interfaces](https://mastra.ai/reference/observability/tracing/interfaces)
272
271
  - [Span filtering](https://mastra.ai/reference/observability/tracing/span-filtering)
273
272
  - [Spans](https://mastra.ai/reference/observability/tracing/spans)
273
+ - [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query)
274
274
  - [AgentsMDInjector](https://mastra.ai/reference/processors/agents-md-injector)
275
275
  - [BatchPartsProcessor](https://mastra.ai/reference/processors/batch-parts-processor)
276
276
  - [ClassifierProcessor](https://mastra.ai/reference/processors/classifier-processor)
@@ -93,6 +93,8 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
93
93
 
94
94
  **observation.bufferOnIdle** (`boolean`): Run background observation buffering when an agent turn ends and the agent becomes idle. This is separate from bufferTokens, which controls step-time async buffering. Set this to true to buffer short idle turns without waiting for the next turn or the messageTokens threshold.
95
95
 
96
+ **observation.observeOnContextOverflow** (`boolean`): Recover when the model provider rejects a request for exceeding its context window. Provider token counts can be higher than Observational Memory's local estimate, for example with attachments or after switching to a model with a smaller window, so a request can overflow before the messageTokens threshold is reached. When this happens, Observational Memory activates buffered observations, observes every pending message regardless of the threshold, and retries the request once with the smaller context. Set to false to let the error reach the caller instead.
97
+
96
98
  **observation.bufferActivation** (`number`): How much of the message window to clear when buffered observations activate. Values between 0 and 1 are the fraction of messageTokens to remove: 0.8 removes \~80% of the message history and keeps \~20% (6k tokens with the default 30k). Values of 1000 or more are the token count to keep: 4000 keeps \~4k message tokens after activation. Note the direction flips: a higher ratio removes more history, while a higher token count keeps more.
97
99
 
98
100
  **observation.activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered observations are forced to activate after inactivity. Accepts milliseconds, a duration string, "auto" for a provider-aware prompt cache TTL, false, or an object of per-provider TTLs. An object replaces the top-level value and is not merged with it. If unset, the top-level activateAfterIdle value is used for observations. Set false to disable the top-level idle setting for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateAfterIdle only.
@@ -777,6 +779,17 @@ The standalone `ObservationalMemory` class accepts all the same options as the `
777
779
 
778
780
  **obscureThreadIds** (`boolean`): When enabled, thread IDs are hashed before being included in observation context. This prevents the LLM from recognizing patterns in thread identifiers. Automatically enabled when using resource scope through the Memory class. (Default: `false`)
779
781
 
782
+ ### Forcing observation
783
+
784
+ `observe()` only observes once pending tokens reach the observation threshold. Pass `force: true` to observe pending messages regardless of the threshold. The bypass applies to that call only and isn't saved to the record's config.
785
+
786
+ ```typescript
787
+ const result = await om.observe({ threadId, resourceId, force: true })
788
+ // result.observed: true if pending messages were observed
789
+ ```
790
+
791
+ Agents don't need this to recover from context-window errors. `observation.observeOnContextOverflow` handles that automatically.
792
+
780
793
  ## Recall tool
781
794
 
782
795
  When `retrieval` is truthy, Mastra registers a `recall` tool that pages through raw messages behind observation group ranges. With the default resource scope, the tool can list threads (`mode: "threads"`) and browse another thread through `threadId`. It also supports cross-thread search. Set `retrieval: { vector: true }` for semantic search (`mode: "search"`), or use `scope: 'thread'` to restrict the tool to the current thread. The tool is automatically added to the agent.