@mastra/mcp-docs-server 1.3.4 → 1.3.5-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.
- package/.docs/docs/agents/code-mode.md +0 -2
- package/.docs/docs/channels.md +12 -4
- package/.docs/docs/develop.md +1 -3
- package/.docs/docs/guides/context-engineering.md +0 -2
- package/.docs/docs/harness/agent-controller.md +0 -2
- package/.docs/docs/harness/durable-agents.md +2 -0
- package/.docs/docs/harness/goals.md +1 -3
- package/.docs/docs/harness/schedules.md +0 -2
- package/.docs/docs/harness/signal-providers.md +1 -3
- package/.docs/docs/harness/signals.md +15 -3
- package/.docs/docs/memory/observational-memory.md +26 -2
- package/.docs/docs/memory/semantic-recall.md +35 -1
- package/.docs/docs/storage.md +1 -0
- package/.docs/docs/workflows/error-handling.md +2 -0
- package/.docs/docs/workflows/scheduled-workflows.md +2 -2
- package/.docs/integrations/databases/clickhouse-managed-postgres.md +82 -0
- package/.docs/integrations/file-storage/mesa.md +40 -39
- package/.docs/integrations.md +1 -0
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/merge-gateway.md +3 -1
- package/.docs/models/gateways/neon.md +2 -1
- package/.docs/models/gateways/netlify.md +5 -1
- package/.docs/models/gateways/openrouter.md +4 -1
- package/.docs/models/gateways/vercel.md +10 -3
- package/.docs/models/index.md +2 -1
- package/.docs/models/providers/aiand.md +17 -15
- package/.docs/models/providers/blueclaw.md +8 -9
- package/.docs/models/providers/coralbricks.md +6 -4
- package/.docs/models/providers/cortecs.md +5 -11
- package/.docs/models/providers/crossmodel.md +2 -1
- package/.docs/models/providers/deepinfra.md +57 -62
- package/.docs/models/providers/deepseek.md +1 -1
- package/.docs/models/providers/edenai.md +12 -7
- package/.docs/models/providers/engy.md +84 -0
- package/.docs/models/providers/fireworks-ai.md +2 -2
- package/.docs/models/providers/hyper.md +1 -1
- package/.docs/models/providers/kilo.md +18 -15
- package/.docs/models/providers/llmgateway-providers.md +23 -13
- package/.docs/models/providers/llmgateway.md +8 -8
- package/.docs/models/providers/nano-gpt.md +8 -6
- package/.docs/models/providers/nvidia.md +4 -4
- package/.docs/models/providers/opencode.md +3 -1
- package/.docs/models/providers/privatemode-ai.md +5 -5
- package/.docs/models/providers/requesty.md +2 -1
- package/.docs/models/providers/subconscious.md +8 -8
- package/.docs/models/providers/synthetic.md +2 -1
- package/.docs/models/providers/togetherai.md +21 -28
- package/.docs/models/providers/umans-ai-coding-plan.md +2 -1
- package/.docs/models/providers/umans-ai.md +2 -1
- package/.docs/models/providers/xai.md +3 -2
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
- package/.docs/reference/agent-controller/session.md +8 -2
- package/.docs/reference/agents/channels.md +3 -2
- package/.docs/reference/agents/durable-agent.md +12 -7
- package/.docs/reference/client-js/agents.md +1 -1
- package/.docs/reference/client-js/observability.md +28 -0
- package/.docs/reference/code-sdk/acp-server.md +19 -2
- package/.docs/reference/code-sdk/mount-agent-controller.md +0 -2
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +28 -0
- package/.docs/reference/file-based-agents/config.md +0 -2
- package/.docs/reference/file-based-agents/instructions.md +0 -2
- package/.docs/reference/file-based-agents/logger.md +0 -2
- package/.docs/reference/file-based-agents/memory.md +0 -2
- package/.docs/reference/file-based-agents/observability.md +0 -2
- package/.docs/reference/file-based-agents/processors.md +0 -2
- package/.docs/reference/file-based-agents/schedules.md +2 -4
- package/.docs/reference/file-based-agents/scorers.md +0 -2
- package/.docs/reference/file-based-agents/server.md +0 -2
- package/.docs/reference/file-based-agents/skills.md +0 -2
- package/.docs/reference/file-based-agents/storage.md +0 -2
- package/.docs/reference/file-based-agents/studio.md +0 -2
- package/.docs/reference/file-based-agents/subagents.md +0 -2
- package/.docs/reference/file-based-agents/tools.md +0 -2
- package/.docs/reference/file-based-agents/workflows.md +0 -2
- package/.docs/reference/file-based-agents/workspace.md +0 -2
- package/.docs/reference/memory/observational-memory.md +5 -5
- package/.docs/reference/observability/tracing/interfaces.md +62 -2
- package/.docs/reference/observability/tracing/trace-query.md +113 -2
- package/.docs/reference/schedules/overview.md +3 -5
- package/.docs/reference/server/elysia-adapter.md +18 -0
- package/.docs/reference/signals/create-notification-inbox-tool.md +0 -2
- package/.docs/reference/signals/signal-provider.md +1 -3
- package/.docs/reference/signals/task-signal-provider.md +1 -1
- package/.docs/reference/signals/webhook-signal-provider.md +1 -3
- package/.docs/reference/streaming/ChunkType.md +2 -0
- package/.docs/reference/tools/create-code-mode.md +0 -2
- package/.docs/reference/tools/mcp-client.md +17 -0
- package/package.json +4 -4
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Schedules
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A file-based agent discovers **schedules** from its `schedules/` directory. Each file declares one recurring task: a cron expression plus what the agent should do when it fires. Mastra registers them into schedule storage at startup. A scheduled agent needs no runtime registration code.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. To create schedules at runtime instead, see [Schedules](https://mastra.ai/reference/schedules/overview).
|
|
@@ -118,7 +116,7 @@ Frontmatter accepts every option below except `handler`, which needs a function
|
|
|
118
116
|
|
|
119
117
|
## Options
|
|
120
118
|
|
|
121
|
-
**cron** (`string`):
|
|
119
|
+
**cron** (`string`): A 5-, 6-, or 7-part cron expression. Required.
|
|
122
120
|
|
|
123
121
|
**prompt** (`string`): Message the agent runs on each fire. Set this or handler, not both.
|
|
124
122
|
|
|
@@ -144,7 +142,7 @@ Frontmatter accepts every option below except `handler`, which needs a function
|
|
|
144
142
|
|
|
145
143
|
**ifIdle** (`ScheduleIfIdle`): What to do when the target thread is idle: wake, persist, or discard. Threaded schedules only.
|
|
146
144
|
|
|
147
|
-
**status** (`'active' | 'paused'`): Status the row is created with. Applies on first create
|
|
145
|
+
**status** (`'active' | 'paused'`): Status the row is created with. Applies on first create, because a redeploy that leaves the cadence unchanged never patches status, so pausing through the API survives it. Changing this value in code later has no effect on an existing schedule. A cadence with no future occurrence is registered as completed, and a later cadence edit that can fire reactivates a completed row. (Default: `'active'`)
|
|
148
146
|
|
|
149
147
|
**metadata** (`Record<string, unknown>`): Arbitrary JSON-safe data stored alongside the schedule row.
|
|
150
148
|
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Scorers
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A file-based agent discovers [scorers](https://mastra.ai/docs/evals/overview) from its `scorers/` directory. Use this page for the file-based convention; use the scorers guide for built-in scorers, custom scorers, and sampling.
|
|
10
8
|
|
|
11
9
|
Each file under `scorers/` default-exports one scorer, and the filename becomes its key. The default export is either a [`MastraScorer`](https://mastra.ai/reference/evals/create-scorer) or a `{ scorer, sampling }` entry.
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Server
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
Mastra configures its HTTP [server](https://mastra.ai/docs/server/overview) from a `server.ts` file directly under `src/mastra/`. The server exposes agents, workflows, and other registered primitives as REST endpoints, and the file default-exports the same `ServerConfig` shape you'd pass to [`new Mastra()`](https://mastra.ai/reference/core/mastra-class).
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For server features, middleware, custom routes, generated API docs, and deployment behavior, see [Server overview](https://mastra.ai/docs/server/overview).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Skills
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A file-based agent discovers skills from its `skills/` directory and bundles them at build time. Skills are reusable procedures or reference material that the agent can load when relevant, instead of putting every detail into the always-on prompt.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For code-defined skills, see [Agent skills](https://mastra.ai/docs/skills). For the `SKILL.md` package format, see [Workspace skills](https://mastra.ai/docs/sandbox/skills).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Storage
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
Mastra sets the project's default [storage](https://mastra.ai/docs/storage) from a `storage.ts` file directly under `src/mastra/`. The file default-exports a store, which replaces the built-in in-memory store used for memory, workflows, observability, and other storage domains.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For backend choice, storage domains, retention, and provider details, see [storage overview](https://mastra.ai/docs/storage).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Studio
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
Mastra configures [Studio](https://mastra.ai/docs/studio/overview) from a `studio.ts` file directly under `src/mastra/`. The file default-exports a `StudioConfig` object for Studio authentication and authorization: who can access Studio, and what authenticated users can do.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For auth providers, role-based access control (RBAC), and fine-grained authorization (FGA), see [Studio auth](https://mastra.ai/docs/studio/auth).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Subagents
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A file-based agent can declare **subagents**, specialist child agents it delegates to. The parent model sees each subagent as a delegation tool named after the subagent directory and calls that tool to hand off a task. The subagent's result returns to the parent conversation.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For broader delegation patterns, hooks, memory isolation, tool approval propagation, and scoring, see [Supervisor agents](https://mastra.ai/docs/subagents).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Tools
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time, the file must default-export a [`createTool()`](https://mastra.ai/reference/tools/create-tool) result, and the filename without its extension becomes the tool key the model can call.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For tool schemas, execution options, output shaping, and approval options, see the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Workflows
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
Mastra discovers project-level workflows from `.ts` and `.js` files under `src/mastra/workflows/`. This convention isn't scoped to one agent: every file with a default export becomes a registered workflow, and the filename becomes the workflow key.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For steps, schemas, control flow, streaming, state, and workflow execution, see [Workflows overview](https://mastra.ai/docs/workflows/overview).
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Workspace
|
|
6
6
|
|
|
7
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
8
|
-
|
|
9
7
|
A [workspace](https://mastra.ai/docs/sandbox/overview) assembles capabilities such as filesystem access and command execution. The configured backends determine which tools are available. File-based agents get a default workspace automatically when discovered through `mastra dev` or `mastra build`. This default includes filesystem access and command execution, so agents can read and write files and run shell commands without extra configuration.
|
|
10
8
|
|
|
11
9
|
Use this page for the file-based convention. For workspace providers, tools, search, lifecycle, and sandbox details, see [Sandbox](https://mastra.ai/docs/sandbox/overview).
|
|
@@ -41,7 +41,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
41
41
|
|
|
42
42
|
**scope** (`'resource' | 'thread'`): Memory scope for observations. 'thread' keeps observations per-thread. 'resource' is deprecated and will be removed in a future release. It shares observations across all threads for a resource and works much worse than thread scope for prompt caching and agent understanding. For cross-thread continuity, use thread scope with retrieval or resource-scoped working memory. See resource scope (deprecated). (Default: `'thread'`)
|
|
43
43
|
|
|
44
|
-
**activateAfterIdle** (`number | string | false | "auto"
|
|
44
|
+
**activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered observations are forced to activate after inactivity, even before observation.messageTokens is reached. Accepts a numeric millisecond value such as 300\_000, duration strings like "5m" or "1hr", "auto" for a provider-aware prompt cache TTL, false to disable inherited observation idle activation, or an object of per-provider TTLs such as { default: "auto", anthropic: "1h" }. Object keys match the actor model provider before the first ., case-insensitively, so anthropic covers the direct Anthropic provider but not Claude through another provider such as amazon-bedrock; default covers every other provider. Reflections do not inherit this setting. Use reflection.activateAfterIdle to opt reflections into idle activation.
|
|
45
45
|
|
|
46
46
|
**activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. Reflections do not inherit this setting. Use reflection.activateOnProviderChange to opt reflections into provider-change activation. (Default: `false`)
|
|
47
47
|
|
|
@@ -91,11 +91,11 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
91
91
|
|
|
92
92
|
**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.
|
|
93
93
|
|
|
94
|
-
**observation.activateAfterIdle** (`number | string | false | "auto"
|
|
94
|
+
**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.
|
|
95
95
|
|
|
96
96
|
**observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
|
|
97
97
|
|
|
98
|
-
**observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Above this point, activation uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Crossing blockAfter does not trigger a blocking observation. A synchronous (blocking) observation runs when the messageTokens threshold is reached and buffered
|
|
98
|
+
**observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Above this point, activation uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Crossing blockAfter does not trigger a blocking observation. A synchronous (blocking) observation runs when the messageTokens threshold is reached and activating buffered chunks doesn't bring pending tokens back under it, for example when a large tool result arrives after buffering has stopped. All remaining buffered chunks are activated first, so the synchronous observation only covers messages no chunk has observed. Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
|
|
99
99
|
|
|
100
100
|
**observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to 0 to omit previous observations entirely, or false to disable truncation explicitly.
|
|
101
101
|
|
|
@@ -125,7 +125,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
125
125
|
|
|
126
126
|
**reflection.bufferActivation** (`number`): When background reflection starts, as a ratio (0-1) of observationTokens: 0.5 starts reflecting in the background once observations reach 50% of the threshold (20k tokens with the default 40k). When the full threshold is reached, the buffered reflection replaces the observations it covers, preserving any new observations appended after that range.
|
|
127
127
|
|
|
128
|
-
**reflection.activateAfterIdle** (`number | string | false | "auto"
|
|
128
|
+
**reflection.activateAfterIdle** (`number | string | false | "auto" | Record<string, number | string | false | "auto">`): Time before buffered reflections 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. Reflections do not inherit top-level activateAfterIdle; set this explicitly to opt reflections into idle activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
|
|
129
129
|
|
|
130
130
|
**reflection.activateOnProviderChange** (`boolean`): Force buffered reflections to activate when the actor provider or model changes. Reflections do not inherit top-level activateOnProviderChange; set this explicitly to opt reflections into provider-change activation. Currently only applied when using the standalone ObservationalMemory class; this setting has no effect through new Memory(...).
|
|
131
131
|
|
|
@@ -367,7 +367,7 @@ export const agent = new Agent({
|
|
|
367
367
|
|
|
368
368
|
Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows: when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
|
|
369
369
|
|
|
370
|
-
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals and produce chunks of observations. At the threshold, activation moves observations into the log and removes raw messages from context. Above `blockAfter`, activation may overshoot the retention target instead of activating fewer chunks. A synchronous observation runs if the threshold
|
|
370
|
+
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals and produce chunks of observations. At the threshold, activation moves observations into the log and removes raw messages from context. Above `blockAfter`, activation may overshoot the retention target instead of activating fewer chunks. A synchronous observation runs if pending tokens are still at or above the threshold after all buffered chunks have been activated.
|
|
371
371
|
|
|
372
372
|
Default settings:
|
|
373
373
|
|
|
@@ -557,8 +557,8 @@ interface ModelGenerationAttributes {
|
|
|
557
557
|
/**
|
|
558
558
|
* Definitions of the tools made available to the model for this generation
|
|
559
559
|
* (name, description, and JSON-schema parameters), captured once per
|
|
560
|
-
* generation.
|
|
561
|
-
* `
|
|
560
|
+
* generation. The definitions sent on each provider call live on
|
|
561
|
+
* MODEL_INFERENCE spans as `tools`.
|
|
562
562
|
*/
|
|
563
563
|
tools?: ModelToolDefinition[]
|
|
564
564
|
|
|
@@ -639,6 +639,66 @@ interface ModelStepAttributes {
|
|
|
639
639
|
}
|
|
640
640
|
```
|
|
641
641
|
|
|
642
|
+
### `ModelInferenceAttributes`
|
|
643
|
+
|
|
644
|
+
Model Inference attributes - for a single call to the model provider within a step. The span covers only the provider call, so it doesn't include processors or tool executions.
|
|
645
|
+
|
|
646
|
+
```typescript
|
|
647
|
+
interface ModelInferenceAttributes {
|
|
648
|
+
/** Model name (e.g., 'gpt-5.4', 'claude-opus-4-6') */
|
|
649
|
+
model?: string
|
|
650
|
+
|
|
651
|
+
/** Model provider (e.g., 'openai', 'anthropic') */
|
|
652
|
+
provider?: string
|
|
653
|
+
|
|
654
|
+
/** Index of the parent step in the generation (0, 1, 2, ...) */
|
|
655
|
+
stepIndex?: number
|
|
656
|
+
|
|
657
|
+
/** Token usage statistics */
|
|
658
|
+
usage?: UsageStats
|
|
659
|
+
|
|
660
|
+
/** Reason this inference finished (stop, tool-calls, length, etc.) */
|
|
661
|
+
finishReason?: string
|
|
662
|
+
|
|
663
|
+
/** Whether this was a streaming response */
|
|
664
|
+
streaming?: boolean
|
|
665
|
+
|
|
666
|
+
/** When the first token/chunk of the completion was received */
|
|
667
|
+
completionStartTime?: Date
|
|
668
|
+
|
|
669
|
+
/** Result warnings */
|
|
670
|
+
warnings?: Record<string, any>
|
|
671
|
+
|
|
672
|
+
/** Actual model used in the response (may differ from request model) */
|
|
673
|
+
responseModel?: string
|
|
674
|
+
|
|
675
|
+
/** Unique identifier for the response */
|
|
676
|
+
responseId?: string
|
|
677
|
+
|
|
678
|
+
/** Model parameters sent on the request (temperature, maxOutputTokens, topP, etc.) */
|
|
679
|
+
parameters?: Record<string, unknown>
|
|
680
|
+
|
|
681
|
+
/** Provider-specific options forwarded on the request */
|
|
682
|
+
providerOptions?: Record<string, unknown>
|
|
683
|
+
|
|
684
|
+
/** Names of tools made available to the model on this inference call */
|
|
685
|
+
availableTools?: string[]
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Definitions of the tools sent to the provider on this inference call
|
|
689
|
+
* (name, description, and JSON-schema parameters), after per-step changes
|
|
690
|
+
* from processors, `prepareStep`, `activeTools`, and `toolChoice`.
|
|
691
|
+
*/
|
|
692
|
+
tools?: ModelToolDefinition[]
|
|
693
|
+
|
|
694
|
+
/** How the model was instructed to choose tools */
|
|
695
|
+
toolChoice?: 'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }
|
|
696
|
+
|
|
697
|
+
/** Requested response format */
|
|
698
|
+
responseFormat?: 'text' | 'json' | 'json_schema' | { type: string; name?: string }
|
|
699
|
+
}
|
|
700
|
+
```
|
|
701
|
+
|
|
642
702
|
### `ModelChunkAttributes`
|
|
643
703
|
|
|
644
704
|
Model Chunk attributes - for individual streaming chunks/events.
|
|
@@ -6,10 +6,121 @@
|
|
|
6
6
|
|
|
7
7
|
Use `queryTraces()` or `POST /api/observability/traces/query` to find completed logical traces that match trace fields and related span, score, or feedback records. Use `queryTraceThreads()` or `POST /api/observability/threads/query` to find thread identities that qualify across multiple eligible traces.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use `querySpans()` or `POST /api/observability/spans/query` to list the individual completed spans that match a span predicate.
|
|
10
|
+
|
|
11
|
+
All three endpoints use the same authentication as other observability routes and require the `observability:read` permission. The configured observability store must support the requested trace-query, thread-query, or span-query operation.
|
|
10
12
|
|
|
11
13
|
> **Thread grouping is deprecated:** The `group` option remains supported until the next major release. Use [`queryTraceThreads()`](https://mastra.ai/reference/client-js/observability) to retrieve matching thread identities in new code.
|
|
12
14
|
|
|
15
|
+
## Query individual spans
|
|
16
|
+
|
|
17
|
+
`querySpans()` returns one row per matching completed span across traces, including matching child spans. Use it to list the spans themselves, for example every failed tool call in the last day.
|
|
18
|
+
|
|
19
|
+
`queryTraces()` with a `spans.some` predicate answers a different question. It returns the traces that contain at least one matching span, and it doesn't identify which spans matched. Both use the same span fields and operators.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
const timeRange = {
|
|
23
|
+
from: '2026-10-01T00:00:00.000Z',
|
|
24
|
+
to: '2026-10-02T00:00:00.000Z',
|
|
25
|
+
}
|
|
26
|
+
const where = {
|
|
27
|
+
op: 'and',
|
|
28
|
+
args: [
|
|
29
|
+
{ op: 'eq', left: { path: 'spanType' }, right: { literal: 'tool_call' } },
|
|
30
|
+
{ op: 'eq', left: { path: 'status' }, right: { literal: 'error' } },
|
|
31
|
+
],
|
|
32
|
+
} as const
|
|
33
|
+
|
|
34
|
+
const firstPage = await mastraClient.querySpans({
|
|
35
|
+
timeRange,
|
|
36
|
+
where,
|
|
37
|
+
orderBy: [{ field: 'startedAt', direction: 'desc' }],
|
|
38
|
+
page: { limit: 50 },
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
if (firstPage.page.next) {
|
|
42
|
+
const secondPage = await mastraClient.querySpans({
|
|
43
|
+
timeRange,
|
|
44
|
+
where,
|
|
45
|
+
orderBy: [{ field: 'startedAt', direction: 'desc' }],
|
|
46
|
+
page: { limit: 50, after: firstPage.page.next },
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The HTTP route accepts the same body:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
curl --request POST \
|
|
55
|
+
--url http://localhost:4111/api/observability/spans/query \
|
|
56
|
+
--header 'Authorization: Bearer <token>' \
|
|
57
|
+
--header 'Content-Type: application/json' \
|
|
58
|
+
--data '{
|
|
59
|
+
"timeRange": {
|
|
60
|
+
"from": "2026-10-01T00:00:00.000Z",
|
|
61
|
+
"to": "2026-10-02T00:00:00.000Z"
|
|
62
|
+
},
|
|
63
|
+
"where": { "op": "eq", "left": { "path": "spanType" }, "right": { "literal": "tool_call" } },
|
|
64
|
+
"page": { "limit": 50 }
|
|
65
|
+
}'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Span queries are optional for observability stores. Call `mastraClient.getObservabilityCapabilities()` and check `capabilities.spanQuery` before showing a span list. Treat a missing `spanQuery` value as unsupported, because older servers don't report it. A server whose store or `@mastra/core` version doesn't support span queries returns `501` with code `SPAN_QUERY_UNSUPPORTED`.
|
|
69
|
+
|
|
70
|
+
The other statuses match trace queries: `400` for malformed JSON or a malformed cursor, `409` for a cursor that doesn't match the query, `413` for a body over 256 KiB, `422` with code `TRACE_QUERY_INVALID` and structured `issues` for an invalid query, `503` with code `TRACE_QUERY_RESOURCE_LIMIT` when a page exceeds a resource limit, and `504` with code `TRACE_QUERY_EXECUTION_TIMEOUT` when the database deadline is exceeded.
|
|
71
|
+
|
|
72
|
+
The server applies [trusted tenant scope](#trusted-tenant-scope) to span queries the same way it does for trace queries. A cursor created under one scope and reused under another returns `409`.
|
|
73
|
+
|
|
74
|
+
### Query individual spans through storage
|
|
75
|
+
|
|
76
|
+
The observability domain in DuckDB and the PostgreSQL and ClickHouse v-next stores supports `querySpans(plan)`. Check `storage.getFeatures()?.includes('span-query')` before using this optional storage method.
|
|
77
|
+
|
|
78
|
+
Build the plan in trusted backend code:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { planSpanQuery } from '@mastra/core/storage'
|
|
82
|
+
|
|
83
|
+
const storage = await mastra.getStorage()?.getStore('observability')
|
|
84
|
+
if (!storage?.getFeatures()?.includes('span-query')) {
|
|
85
|
+
throw new Error('This store does not support span queries')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const plan = planSpanQuery({
|
|
89
|
+
timeRange: {
|
|
90
|
+
from: '2026-10-01T00:00:00.000Z',
|
|
91
|
+
to: '2026-10-02T00:00:00.000Z',
|
|
92
|
+
},
|
|
93
|
+
where: {
|
|
94
|
+
op: 'eq',
|
|
95
|
+
left: { path: 'spanType' },
|
|
96
|
+
right: { literal: 'tool_call' },
|
|
97
|
+
},
|
|
98
|
+
page: { limit: 50 },
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const { spans, page } = await storage.querySpans(plan)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This example uses local, unscoped storage. For a shared database, pass `{ scope: { organizationId, resourceId } }` as the second argument to `planSpanQuery()`, using identifiers resolved by your backend's authorization. The request body can't supply trusted scope. Apply the same authorization when loading full span details with `getSpan({ traceId, spanId })`.
|
|
105
|
+
|
|
106
|
+
Span queries use the scalar fields and operators available inside `queryTraces()`'s `spans.some` predicate. They don't accept related-record clauses. Nested attributes require support in the shared predicate contract and each store.
|
|
107
|
+
|
|
108
|
+
The `timeRange` applies to each span's `startedAt`, includes `from`, excludes `to`, and can cover at most 31 days. Sort by `startedAt` or `endedAt`, in either direction. The default is `startedAt` descending. A page contains up to 1,000 rows, with a default of 100. Pass `page.next` back as `page.after` with the same filters, time range, scope, and ordering. Cursors use scope and span identifiers to break timestamp ties. They aren't a snapshot across requests. New completions can appear when the view is refreshed.
|
|
109
|
+
|
|
110
|
+
Each row contains span and trace identifiers, display fields, duration, status, and input/output previews of at most 256 Unicode characters. Truncation flags indicate when a preview is incomplete. Stores select the page before loading previews and cost. Full payloads remain available through the existing span detail method.
|
|
111
|
+
|
|
112
|
+
The `cost` field describes only that span's model-token cost:
|
|
113
|
+
|
|
114
|
+
- `available` includes `amount` and `currency`. Zero is a valid amount.
|
|
115
|
+
- `missing` means no matching model metrics were found.
|
|
116
|
+
- `unavailable` means metrics exist but a complete, unambiguous cost can't be established.
|
|
117
|
+
|
|
118
|
+
Directional token totals supply the cost. Overlapping detail metrics aren't added again. A provider-supplied `query_total` cost is counted once. Partial pricing, conflicting currencies, and ambiguous totals produce `unavailable`.
|
|
119
|
+
|
|
120
|
+
Current-record selection runs before mutable filters. PostgreSQL and ClickHouse select the greatest completed `endedAt`. PostgreSQL breaks ties with its ingestion cursor. DuckDB reconstructs the earliest start event and selects the latest ingested completed event, matching its existing span-predicate behavior. Time bounds are checked again after reconstruction. ClickHouse uses its existing completion-only, insert-only model, where equal-version retries must contain identical records. Querying spans doesn't add a table or materialized view.
|
|
121
|
+
|
|
122
|
+
Queries have a 15-second default execution deadline. PostgreSQL and ClickHouse use their existing `traceQuery.timeoutMs` setting. ClickHouse also caps each query at 512 MiB. A page with more than 50,000 matching model metrics fails with a resource-limit error instead of returning partial cost. A small page size limits returned rows, but doesn't limit the number of records the database must examine.
|
|
123
|
+
|
|
13
124
|
## Query traces with the client SDK
|
|
14
125
|
|
|
15
126
|
Pass the query to `queryTraces()`:
|
|
@@ -718,7 +829,7 @@ PostgreSQL and ClickHouse stop advanced trace and thread queries after 15 second
|
|
|
718
829
|
|
|
719
830
|
## Limitations
|
|
720
831
|
|
|
721
|
-
|
|
832
|
+
Trace and thread queries consider completed traces only, and span queries consider completed spans only. They don't support running traces, custom projections, embedded evidence, summaries, aggregations, measures, or custom grouping. Numbered trace pages include a total count.
|
|
722
833
|
|
|
723
834
|
## Related
|
|
724
835
|
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
**Added in:** `@mastra/core@1.50.0`
|
|
8
8
|
|
|
9
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
10
|
-
|
|
11
9
|
`mastra.schedules` is the CRUD service for persisted cron schedules. Use it to create, list, update, pause, resume, manually run, and delete schedules for agents or workflows.
|
|
12
10
|
|
|
13
11
|
For usage patterns and concepts, see [Schedules](https://mastra.ai/docs/harness/schedules).
|
|
@@ -139,13 +137,13 @@ const schedules = await mastra.schedules.list({
|
|
|
139
137
|
|
|
140
138
|
**filter.name** (`string`): Return only agent schedules with this label.
|
|
141
139
|
|
|
142
|
-
**filter.status** (`'active' | 'paused'`): Return only schedules with this status.
|
|
140
|
+
**filter.status** (`'active' | 'paused' | 'completed'`): Return only schedules with this status. The default listing omits completed schedules.
|
|
143
141
|
|
|
144
142
|
### Update schedules
|
|
145
143
|
|
|
146
144
|
#### `update(id, patch)`
|
|
147
145
|
|
|
148
|
-
Updates a schedule. Changing `cron` or `timezone` recomputes the next fire time. Updating `status` from `paused` to `active` also recomputes the next fire time.
|
|
146
|
+
Updates a schedule. Changing `cron` or `timezone` recomputes the next fire time. Updating `status` from `paused` to `active` also recomputes the next fire time. A schedule becomes `completed` once its cron has no future occurrence. A cadence edit that leaves no future occurrence completes the row even when it was `paused`. Editing the cadence of a completed schedule reactivates it when the new cadence can still fire, and leaves it completed when it can't.
|
|
149
147
|
|
|
150
148
|
```typescript
|
|
151
149
|
const updated = await mastra.schedules.update('pinger', {
|
|
@@ -170,7 +168,7 @@ const paused = await mastra.schedules.pause('pinger')
|
|
|
170
168
|
|
|
171
169
|
#### `resume(id)`
|
|
172
170
|
|
|
173
|
-
Resumes a paused schedule and recomputes the next fire time from the current time.
|
|
171
|
+
Resumes a paused schedule and recomputes the next fire time from the current time. A paused schedule whose cron has no future occurrence is completed instead of resumed.
|
|
174
172
|
|
|
175
173
|
```typescript
|
|
176
174
|
const active = await mastra.schedules.resume('pinger')
|
|
@@ -130,6 +130,24 @@ app.get('/custom/public', async ctx => {
|
|
|
130
130
|
})
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
When the auth provider refreshes an expired session, `createAuthMiddleware()` forwards the refreshed session headers (such as `Set-Cookie`) to the response, including error responses. `MastraServer` registers the `applyAuthRefreshHeaders` hook during `init()`, so routes added after `init()` get these headers alongside any cookies your route sets.
|
|
134
|
+
|
|
135
|
+
If you use `createAuthMiddleware()` without `MastraServer`, register the hook yourself before defining routes:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { Elysia } from 'elysia'
|
|
139
|
+
import { applyAuthRefreshHeaders, createAuthMiddleware } from '@mastra/elysia'
|
|
140
|
+
import { mastra } from './mastra'
|
|
141
|
+
|
|
142
|
+
const app = new Elysia()
|
|
143
|
+
.onAfterHandle({ as: 'global' }, applyAuthRefreshHeaders)
|
|
144
|
+
.onError({ as: 'global' }, applyAuthRefreshHeaders)
|
|
145
|
+
|
|
146
|
+
app.get('/custom/protected', () => ({ ok: true }), {
|
|
147
|
+
beforeHandle: createAuthMiddleware({ mastra }),
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
|
|
133
151
|
## Accessing context
|
|
134
152
|
|
|
135
153
|
In Elysia handlers registered after `init()`, access Mastra context from the handler context:
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
**Added in:** `@mastra/core@1.39.0`
|
|
8
8
|
|
|
9
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
10
|
-
|
|
11
9
|
`createNotificationInboxTool()` creates a Mastra tool that lets an agent inspect and manage notification inbox records for the current thread.
|
|
12
10
|
|
|
13
11
|
Use this tool with durable notification signals. For sending notification records, see [`Agent.sendNotificationSignal()`](https://mastra.ai/reference/agents/agent).
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# SignalProvider
|
|
6
6
|
|
|
7
|
-
**Added in:** `@mastra/core@1.
|
|
8
|
-
|
|
9
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
7
|
+
**Added in:** `@mastra/core@1.42.0`
|
|
10
8
|
|
|
11
9
|
Abstract base class for building signal providers. A signal provider monitors external sources (APIs, webhooks, event streams) and pushes notification signals into agent threads through a built-in subscription registry.
|
|
12
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# TaskSignalProvider
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Added in:** `@mastra/core@1.42.0`
|
|
8
8
|
|
|
9
9
|
Bundles the built-in task tools (`task_write`, `task_update`, `task_complete`, `task_check`) and the `TaskStateProcessor` behind a single agent registration. Use it to add a structured, durable task list to an agent without wiring the tools and processor separately.
|
|
10
10
|
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# WebhookSignalProvider
|
|
6
6
|
|
|
7
|
-
**Added in:** `@mastra/core@1.
|
|
8
|
-
|
|
9
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
7
|
+
**Added in:** `@mastra/core@1.42.0`
|
|
10
8
|
|
|
11
9
|
Concrete signal provider for push-based event delivery. Routes incoming webhook payloads to subscribed agent threads by matching the payload against a configurable resource ID extractor.
|
|
12
10
|
|
|
@@ -14,6 +14,8 @@ All chunks include these base properties:
|
|
|
14
14
|
|
|
15
15
|
**runId** (`string`): Unique identifier for this execution run
|
|
16
16
|
|
|
17
|
+
**traceId** (`string`): Trace ID of the run that produced this chunk, when tracing is enabled. Not set on custom data-\* chunks.
|
|
18
|
+
|
|
17
19
|
**from** (`ChunkFrom`): Source of the chunk
|
|
18
20
|
|
|
19
21
|
**from.AGENT** (`'AGENT'`): Chunk from agent execution
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
**Added in:** `@mastra/core@1.38.0`
|
|
8
8
|
|
|
9
|
-
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
10
|
-
|
|
11
9
|
The `createCodeMode()` function returns a tool and generated instructions that let an agent run multi-tool computations as one TypeScript function. The generated code runs in a workspace sandbox, and each `external_*` call runs the real tool on the host with validation, request context, and tracing.
|
|
12
10
|
|
|
13
11
|
For a conceptual overview, see [Code mode](https://mastra.ai/docs/agents/code-mode).
|
|
@@ -367,6 +367,23 @@ const instructionsByServer = mcp.getServerInstructions()
|
|
|
367
367
|
console.log(instructionsByServer.db)
|
|
368
368
|
```
|
|
369
369
|
|
|
370
|
+
### `getServerInfo()`
|
|
371
|
+
|
|
372
|
+
Returns the identity each configured MCP server announced when it connected (its `serverInfo`, from the `server/discover` result or, for servers on an older revision, the `initialize` handshake): `name` and `version`, plus `title`, `description`, `websiteUrl`, and `icons` when the server provides them. A server's entry is `undefined` if it hasn't connected yet, or if it connected over the `2026-07-28` revision without announcing an identity, which that revision allows. Don't use it to check whether a server is connected. The values come from the remote server and aren't validated, so treat icon and website URLs as untrusted.
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
getServerInfo(): Record<string, MCPServerImplementation | undefined>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Example:
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
await mcp.listTools()
|
|
382
|
+
|
|
383
|
+
const info = mcp.getServerInfo()
|
|
384
|
+
console.log(info.myServer?.title, info.myServer?.version)
|
|
385
|
+
```
|
|
386
|
+
|
|
370
387
|
### `authenticate()`
|
|
371
388
|
|
|
372
389
|
Runs the interactive OAuth authorization-code flow for a server whose `MCPOAuthClientProvider` uses a loopback redirect URL. A local callback server passes the authorization URL to the provider's `onRedirectToAuthorization` callback and waits for the browser to return the code. It then exchanges the code for tokens and reconnects. See [Interactive browser authentication](#interactive-browser-authentication).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5-alpha.11",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
|
|
27
27
|
"local-pkg": "^1.1.2",
|
|
28
28
|
"zod": "^4.6.4",
|
|
29
|
-
"@mastra/core": "1.
|
|
30
|
-
"@mastra/mcp": "^2.
|
|
29
|
+
"@mastra/core": "1.75.0-alpha.4",
|
|
30
|
+
"@mastra/mcp": "^2.2.0-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hono/node-server": "^2.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"vitest": "4.1.11",
|
|
46
46
|
"@internal/lint": "0.0.140",
|
|
47
47
|
"@internal/types-builder": "0.0.115",
|
|
48
|
-
"@mastra/core": "1.
|
|
48
|
+
"@mastra/core": "1.75.0-alpha.4"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://mastra.ai",
|
|
51
51
|
"repository": {
|