@mastra/mcp-docs-server 1.3.9-alpha.11 → 1.3.9-alpha.13
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/processors.md +6 -4
- package/.docs/docs/auth/custom-auth-provider.md +1 -1
- package/.docs/docs/auth/overview.md +3 -1
- package/.docs/docs/connections/sdk-agents.md +18 -7
- package/.docs/docs/guides/mcp-authentication-authorization.md +2 -2
- package/.docs/docs/harness/agent-controller.md +11 -14
- package/.docs/docs/harness/durable-agents.md +3 -1
- package/.docs/docs/harness/schedules.md +8 -6
- package/.docs/docs/mastra-platform/environments.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/studio.md +1 -1
- package/.docs/docs/memory/semantic-recall.md +20 -0
- package/.docs/docs/studio/auth.md +2 -2
- package/.docs/docs/studio/observability.md +5 -1
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/models/environment-variables.md +0 -1
- package/.docs/models/gateways/merge-gateway.md +6 -1
- package/.docs/models/index.md +1 -2
- package/.docs/models/providers/aixy.md +3 -1
- package/.docs/models/providers/alibaba-cn.md +7 -55
- package/.docs/models/providers/alibaba-coding-plan-cn.md +8 -12
- package/.docs/models/providers/alibaba-coding-plan.md +8 -12
- package/.docs/models/providers/alibaba-token-plan-cn.md +0 -2
- package/.docs/models/providers/alibaba-token-plan.md +29 -30
- package/.docs/models/providers/alibaba.md +32 -61
- package/.docs/models/providers/ambient.md +0 -8
- package/.docs/models/providers/anthropic.md +4 -2
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/edenai.md +7 -1
- package/.docs/models/providers/empiriolabs.md +1 -3
- package/.docs/models/providers/google.md +2 -0
- package/.docs/models/providers/inception.md +2 -1
- package/.docs/models/providers/kilo.md +11 -25
- package/.docs/models/providers/llmgateway-providers.md +3 -1
- package/.docs/models/providers/llmgateway.md +3 -1
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -11
- package/.docs/models/providers/minimax-cn.md +4 -10
- package/.docs/models/providers/minimax-coding-plan.md +4 -11
- package/.docs/models/providers/minimax.md +4 -10
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/moonshotai-cn.md +2 -2
- package/.docs/models/providers/nano-gpt.md +12 -16
- package/.docs/models/providers/openai.md +3 -1
- package/.docs/models/providers/runinfra.md +2 -1
- package/.docs/models/providers/xai.md +3 -1
- package/.docs/models/providers/zai-coding-plan.md +0 -4
- package/.docs/models/providers/zhipuai-coding-plan.md +0 -1
- package/.docs/models/providers/zhipuai.md +12 -12
- package/.docs/models/providers.md +0 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +17 -22
- package/.docs/reference/agent-controller/session.md +3 -3
- package/.docs/reference/agents/channels.md +7 -1
- package/.docs/reference/agents/durable-agent.md +9 -7
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -4
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/client-js/agent-controller.md +13 -3
- package/.docs/reference/client-js/mastra-client.md +1 -1
- package/.docs/reference/client-js/observability.md +1 -1
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/editor/mastra-editor.md +9 -7
- package/.docs/reference/editor/tool-provider.md +2 -2
- package/.docs/reference/evals/create-classifier-scorer.md +6 -2
- package/.docs/reference/file-based-agents/instructions.md +1 -1
- package/.docs/reference/file-based-agents/processors.md +2 -0
- package/.docs/reference/file-based-agents/schedules.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/memory/cloneThread.md +1 -1
- package/.docs/reference/memory/copyThread.md +1 -1
- package/.docs/reference/memory/memory-class.md +2 -0
- package/.docs/reference/memory/serialized-memory-config.md +1 -1
- package/.docs/reference/observability/tracing/advanced-queries.md +11 -9
- package/.docs/reference/processors/processor-interface.md +10 -2
- package/.docs/reference/signals/signal-provider.md +2 -0
- package/.docs/reference/signals/task-signal-provider.md +1 -1
- package/package.json +4 -4
|
@@ -35,11 +35,8 @@ interface SkillMetadata {
|
|
|
35
35
|
name: string
|
|
36
36
|
description: string
|
|
37
37
|
path: string
|
|
38
|
-
references: string[]
|
|
39
|
-
scripts: string[]
|
|
40
|
-
assets: string[]
|
|
41
38
|
license?: string
|
|
42
|
-
compatibility?:
|
|
39
|
+
compatibility?: unknown
|
|
43
40
|
'user-invocable'?: boolean
|
|
44
41
|
metadata?: Record<string, unknown>
|
|
45
42
|
}
|
|
@@ -53,7 +53,7 @@ export const browserAgent = new Agent({
|
|
|
53
53
|
|
|
54
54
|
**screencast.format** (`'jpeg' | 'png'`): Image format for screencast frames.
|
|
55
55
|
|
|
56
|
-
**screencast.quality** (`number`): Image quality (
|
|
56
|
+
**screencast.quality** (`number`): Image quality (0-100). Only applies to JPEG format.
|
|
57
57
|
|
|
58
58
|
**screencast.maxWidth** (`number`): Maximum width for screencast frames.
|
|
59
59
|
|
|
@@ -81,11 +81,19 @@ Returns the controller's workspace status.
|
|
|
81
81
|
|
|
82
82
|
Returns: `Promise<AgentControllerWorkspaceStatus>`
|
|
83
83
|
|
|
84
|
-
### `session(
|
|
84
|
+
### `session(sessionId)`
|
|
85
85
|
|
|
86
|
-
Returns an `AgentControllerSession`
|
|
86
|
+
Returns an `AgentControllerSession` addressed by its session id. Every request goes to `/agent-controller/:controllerId/sessions/:sessionId/...`. Sessions are get-or-create on the server, so calling `create()` with the same `sessionId` resumes the existing conversation instead of forking it.
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Sessions that share a resource but use different session ids each get their own run loop, thread binding, mode, model, and state. Their stored threads and resource-scoped memory belong to the shared resource. Pass the resource to `create()`:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const runA = client.getAgentController('code').session('run-a')
|
|
92
|
+
await runA.create({ resourceId: 'factory-1' })
|
|
93
|
+
|
|
94
|
+
const runB = client.getAgentController('code').session('run-b')
|
|
95
|
+
await runB.create({ resourceId: 'factory-1' })
|
|
96
|
+
```
|
|
89
97
|
|
|
90
98
|
## Session methods
|
|
91
99
|
|
|
@@ -93,6 +101,8 @@ Pass `scope` to address an independent session over the same `resourceId`. Sessi
|
|
|
93
101
|
|
|
94
102
|
Creates or resumes the session.
|
|
95
103
|
|
|
104
|
+
**resourceId** (`string`): Memory resource that owns the session's threads. Defaults to the session id, so a session created with only an id keeps one resource of its own.
|
|
105
|
+
|
|
96
106
|
**tags** (`Record<string, string>`): Scopes initial thread selection. A thread is a resume candidate only when its metadata matches every tag.
|
|
97
107
|
|
|
98
108
|
**threadId** (`string`): Binds the session to one exact thread, creating it with that ID when it does not exist.
|
|
@@ -61,7 +61,7 @@ You can also pass `requestContext` as a `Record<string, any>`.
|
|
|
61
61
|
|
|
62
62
|
**listAgentControllers()** (`Promise<AgentControllerInfo[]>`): Returns the agent controllers hosted on the connected Mastra instance. Each entry's id is the key the controller is registered under in new Mastra({ agentControllers }).
|
|
63
63
|
|
|
64
|
-
**getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by the key it is registered under in new Mastra({ agentControllers }), which can differ from the controller id. .session(
|
|
64
|
+
**getAgentController(controllerId)** (`AgentController`): Retrieves a specific agent controller by the key it is registered under in new Mastra({ agentControllers }), which can differ from the controller id. .session(sessionId) returns a session client; call await session.create() to create or resume the server session.
|
|
65
65
|
|
|
66
66
|
**listMemoryThreads(params)** (`Promise<StorageThreadType[]>`): Retrieves memory threads for the specified resource and agent. Requires a resourceId and an agentId.
|
|
67
67
|
|
|
@@ -105,7 +105,7 @@ Combine predicates with `and`, `or` and `not`. Membership uses `{ op: 'in', valu
|
|
|
105
105
|
|
|
106
106
|
Each summary includes identity, context, entity lineage, status, timestamps, `durationMs`, model/provider and input/output/error previews. Model/provider are available in returned rows but aren't filterable.
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Check `capabilities.spanQueryContextFields` from `getObservabilityCapabilities()` before using the additional identity, context and parent/root entity filters. A missing or false value means these filters aren't available. With an older adapter, requests using these filters return a structured `422` error.
|
|
109
109
|
|
|
110
110
|
DuckDB returns `null` for parent/root entity type, ID and name, and for `executionSource`. Equality filters on these fields match no spans. Parent/root entity version IDs remain available.
|
|
111
111
|
|
|
@@ -147,9 +147,9 @@ Re-drives every orphaned `running` durable-agent run across all registered durab
|
|
|
147
147
|
|
|
148
148
|
Requires persistent storage. With an in-memory store, there's nothing to recover after a process restart.
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
Recovery processes up to five agents concurrently, with up to five run waits per agent, independently of `recovery.workflowConcurrency`. Each built-in `recoverActiveRuns()` attempt waits up to 30 seconds in total for `recover()` setup and settlement of the whole recovered workflow, then frees its slot for another run. These limits bound waiting, not live executions. This isn't an overall recovery deadline: discovery and overridden custom recovery methods aren't bounded by this budget.
|
|
151
151
|
|
|
152
|
-
A timed-out attempt continues in the background. Its outcome is `status: 'skipped'` with `reason: 'recovery-timeout'` and
|
|
152
|
+
A timed-out attempt continues in the background. Its outcome is `status: 'skipped'` with `reason: 'recovery-timeout'` and a future `retryAt`. It contributes only to `skipped`, not `recovered`, `succeeded`, or `failed`. Mastra schedules re-checks automatically. While the original attempt is pending, re-checks defer without starting another execution. After it settles, recovery checks the persisted snapshot and ownership before retrying; finished or suspended runs aren't restarted. Late settlement doesn't change the returned counts.
|
|
153
153
|
|
|
154
154
|
When shutdown begins, recovery stops dispatching new agents and runs. The recovery traversal and original attempts, including timed-out setup or execution, participate in the same shared shutdown drain as active executions. A recovery wait timeout doesn't cancel the attempt or give it a separate shutdown drain window.
|
|
155
155
|
|
|
@@ -102,9 +102,9 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
102
102
|
|
|
103
103
|
**agent.listResolved** (`(args?: StorageListAgentsInput) => Promise<StorageListAgentsResolvedOutput>`): Same as list, but returns fully resolved configurations with references dereferenced.
|
|
104
104
|
|
|
105
|
-
**agent.applyStoredOverrides** (`(agent: Agent, options?: {
|
|
105
|
+
**agent.applyStoredOverrides** (`(agent: Agent, options?: { status?: "draft" | "published" } | { versionId: string }, requestContext?: RequestContext) => Promise<Agent>`): Apply any stored overrides (instructions and tools) to a code-defined agent. When overrides exist, it returns a fork with them applied and leaves the input agent unchanged, so use the returned Agent. Pass either a status or a specific versionId, not both. Called internally by mastra.getAgent() — you rarely call it directly.
|
|
106
106
|
|
|
107
|
-
**agent.clone** (`(agent: Agent, options: { newId: string; newName?: string; metadata?: Record<string, unknown>; authorId?: string; requestContext?: RequestContext
|
|
107
|
+
**agent.clone** (`(agent: Agent, options: { newId: string; newName?: string; metadata?: Record<string, unknown>; authorId?: string; visibility?: "private" | "public"; requestContext?: RequestContext }) => Promise<StorageResolvedAgentType>`): Create a new stored agent by cloning an existing agent and return the resolved stored agent record.
|
|
108
108
|
|
|
109
109
|
**agent.clearCache** (`(agentId?: string) => void`): Clear the in-memory cache for one agent or all agents. Called automatically after mutations.
|
|
110
110
|
|
|
@@ -160,17 +160,19 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
160
160
|
|
|
161
161
|
**scorer** (`EditorScorerNamespace`): CRUD operations for scorer configurations.
|
|
162
162
|
|
|
163
|
-
**scorer.create** (`(input:
|
|
163
|
+
**scorer.create** (`(input: StorageCreateScorerDefinitionInput) => Promise<StorageResolvedScorerDefinitionType>`): Create a new stored scorer definition and return the resolved definition.
|
|
164
164
|
|
|
165
|
-
**scorer.getById** (`(id: string, options?: GetByIdOptions) => Promise<
|
|
165
|
+
**scorer.getById** (`(id: string, options?: GetByIdOptions) => Promise<StorageResolvedScorerDefinitionType | null>`): Return the resolved scorer definition for a given id.
|
|
166
166
|
|
|
167
|
-
**scorer.update** (`(input:
|
|
167
|
+
**scorer.update** (`(input: StorageUpdateScorerDefinitionInput) => Promise<StorageResolvedScorerDefinitionType>`): Partially update a stored scorer.
|
|
168
168
|
|
|
169
169
|
**scorer.delete** (`(id: string) => Promise<void>`): Delete a stored scorer and remove it from the Mastra runtime registry.
|
|
170
170
|
|
|
171
|
-
**scorer.list** (`(args?:
|
|
171
|
+
**scorer.list** (`(args?: StorageListScorerDefinitionsInput) => Promise<StorageListScorerDefinitionsOutput>`): List stored scorers with optional pagination and filters.
|
|
172
172
|
|
|
173
|
-
**scorer.listResolved** (`(args?:
|
|
173
|
+
**scorer.listResolved** (`(args?: StorageListScorerDefinitionsInput) => Promise<StorageListScorerDefinitionsResolvedOutput>`): Same as list, but returns fully resolved scorer configurations.
|
|
174
|
+
|
|
175
|
+
**scorer.resolve** (`(storedScorer: StorageResolvedScorerDefinitionType) => MastraScorer | null`): Build a runnable MastraScorer from a resolved stored definition. Supports llm-judge definitions; returns null for preset types or when instructions or model configuration are missing.
|
|
174
176
|
|
|
175
177
|
**scorer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one scorer or all scorers.
|
|
176
178
|
|
|
@@ -18,7 +18,7 @@ Providers expose metadata and the legacy discovery and resolution methods. Agent
|
|
|
18
18
|
|
|
19
19
|
**capabilities** (`ToolProviderCapabilities`): Static connection and revocation capabilities. Required for VNext providers.
|
|
20
20
|
|
|
21
|
-
**defaultScope** (`'per-author' | 'caller-supplied'`): Default connection identity scope. Defaults to 'per-author' when omitted.
|
|
21
|
+
**defaultScope** (`'per-author' | 'shared' | 'caller-supplied'`): Default connection identity scope. Defaults to 'per-author' when omitted.
|
|
22
22
|
|
|
23
23
|
**listToolkits()** (`() => Promise<ToolProviderListResult<ToolProviderToolkit>>`): Lists available toolkits through the legacy interface.
|
|
24
24
|
|
|
@@ -77,7 +77,7 @@ const editor = new MastraEditor({
|
|
|
77
77
|
|
|
78
78
|
**allowedTools** (`Readonly<Record<string, readonly string[]>>`): Per-toolkit tool slug allowlists. Supports exact matches and prefix wildcards.
|
|
79
79
|
|
|
80
|
-
**defaultScope** (`'per-author' | 'caller-supplied'`): Connection identity scope. Defaults to per-author. (Default: `'per-author'`)
|
|
80
|
+
**defaultScope** (`'per-author' | 'shared' | 'caller-supplied'`): Connection identity scope. Defaults to per-author. (Default: `'per-author'`)
|
|
81
81
|
|
|
82
82
|
**userIdResolver** (`ComposioUserIdResolver`): Server-side resolver that derives the effective Composio userId from authenticated context fields. Used for invoker and caller-supplied execution. The exact connected account always comes from the stored connection pin.
|
|
83
83
|
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
`createClassifierScorer()` adapts one constructor-configured [`Classifier`](https://mastra.ai/reference/classifier/classifier) question to Mastra's scorer pipeline. It returns a normal `MastraScorer` with a numeric `score` and retains the selected answer, probabilities, usage, warnings, and safe response metadata in `analyzeStepResult`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Each scorer run calls `Classifier.decide()` to evaluate all questions configured on the classifier, then projects only the answer selected by `question` into a score between 0 and 1. The `question` option doesn't limit which questions are sent to the model. The adapter doesn't aggregate questions, apply boolean thresholds, infer choice ordering, or call a second judge model.
|
|
10
|
+
|
|
11
|
+
To evaluate exactly one question per scorer run, use a separate classifier configured with only that question. For example, five rubric scorers that share a five-question classifier each evaluate all five questions on every run, rather than only their selected question.
|
|
10
12
|
|
|
11
13
|
Agent scorer runs contain message objects that `Classifier.decide()` can't accept directly, so `state` is required. Use it to extract JSON-compatible text, for example with the helpers from `@mastra/evals/scorers/utils`.
|
|
12
14
|
|
|
@@ -58,6 +60,8 @@ export const qualityScorer = createClassifierScorer({
|
|
|
58
60
|
})
|
|
59
61
|
```
|
|
60
62
|
|
|
63
|
+
This classifier configures three questions so the examples below can reuse it. Each `qualityScorer.run()` evaluates `quality`, `route`, and `factual`, but only the `quality` answer determines its score. To evaluate only `quality`, remove `route` and `factual` from this classifier's `questions`.
|
|
64
|
+
|
|
61
65
|
For a score question with N criteria, the classifier answers with a level from `0` to `N - 1`, and `result.score` divides that level by `N - 1`. With three criteria, `Partially correct` scores `0.5`.
|
|
62
66
|
|
|
63
67
|
## Choice questions
|
|
@@ -155,7 +159,7 @@ Running an ID-backed scorer before registering it with Mastra rejects with an er
|
|
|
155
159
|
|
|
156
160
|
**classifier** (`Classifier | string`): A classifier with constructor-configured questions, or its registered Mastra ID.
|
|
157
161
|
|
|
158
|
-
**question** (`keyof classifier.questions`): The
|
|
162
|
+
**question** (`keyof classifier.questions`): The configured question whose answer is projected into the score. All questions configured on the classifier are evaluated on each scorer run.
|
|
159
163
|
|
|
160
164
|
**scores** (`Record<ChoiceKey, number>`): Required exhaustive mapping for choice questions. Each value must be between 0 and 1. Rejected for score and boolean questions.
|
|
161
165
|
|
|
@@ -56,7 +56,7 @@ export default agentInstructions(({ requestContext }) => {
|
|
|
56
56
|
})
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
The function can be `async`
|
|
59
|
+
The function can be `async`. Alongside `requestContext`, it receives `mastra`, the Mastra instance the agent is registered with, so it can read from storage or another registered primitive before returning the prompt. `mastra` is optional in the function type, so guard its use (for example, `mastra?.getStorage()`).
|
|
60
60
|
|
|
61
61
|
Both files can also live in a [subagent](https://mastra.ai/reference/file-based-agents/subagents) directory, which follows the same rules.
|
|
62
62
|
|
|
@@ -45,6 +45,8 @@ model → config.outputProcessors → processors/output/* → response
|
|
|
45
45
|
|
|
46
46
|
If `config.inputProcessors` or `config.outputProcessors` is a function, discovered processors of that type are ignored with a warning because function-valued processors can't be statically merged.
|
|
47
47
|
|
|
48
|
+
If `config.ts` exports a `new Agent()` instead of a config object, Mastra uses that agent as-is. Discovered files under `processors/input/` and `processors/output/` are ignored with a warning, so set `inputProcessors` and `outputProcessors` on the `Agent` instead.
|
|
49
|
+
|
|
48
50
|
## Precedence with config
|
|
49
51
|
|
|
50
52
|
Use `config.ts` for processors that need to be created at runtime or shared across agents. Use file-based processors for static, per-agent processors that should be reviewed alongside the agent.
|
|
@@ -120,7 +120,7 @@ Frontmatter accepts every option below except `handler`, which needs a function
|
|
|
120
120
|
|
|
121
121
|
**prompt** (`string`): Message the agent runs on each fire. Set this or handler, not both.
|
|
122
122
|
|
|
123
|
-
**handler** (`(ctx) =>
|
|
123
|
+
**handler** (`(ctx) => AgentScheduleHandlerResult | null | undefined | void | Promise<AgentScheduleHandlerResult | null | undefined | void>`): Computes the fire at trigger time and can be async. Return overrides to apply as an AgentScheduleHandlerResult (Partial\<ScheduleEffective>), or null to skip this fire. Returning nothing applies no overrides, which fails the fire because handler mode has no stored prompt. Set this or prompt, not both.
|
|
124
124
|
|
|
125
125
|
**timezone** (`string`): IANA timezone the cron is evaluated in (e.g. America/New\_York). Defaults to the host process timezone, which varies by deployment, so set this explicitly for anything time-of-day sensitive. DST transitions are handled by the timezone rules, so 0 9 \* \* \* stays 9am local across the shift.
|
|
126
126
|
|
|
@@ -10,7 +10,7 @@ Use this page for the file-based convention. For code-defined skills, see [Agent
|
|
|
10
10
|
|
|
11
11
|
## Quickstart
|
|
12
12
|
|
|
13
|
-
The simplest skill is one markdown file under `skills/`. The filename becomes the skill name
|
|
13
|
+
The simplest skill is one markdown file under `skills/`. The filename becomes the skill name unless the frontmatter sets `name`, which takes precedence. The `description` tells the agent when to load it.
|
|
14
14
|
|
|
15
15
|
```markdown
|
|
16
16
|
---
|
|
@@ -42,7 +42,7 @@ export default agentConfig({
|
|
|
42
42
|
|
|
43
43
|
A subagent's `description` is routing text for the parent model. Write it like a [tool description](https://mastra.ai/reference/file-based-agents/tools): explain what the subagent does and when to delegate to it.
|
|
44
44
|
|
|
45
|
-
The build fails when a discovered subagent doesn't provide a non-empty description.
|
|
45
|
+
The build fails when a discovered subagent doesn't provide a non-empty description. The exception is a parent whose `config.ts` exports a `new Agent()`: its `subagents/` directory is ignored with a warning, so no description check runs. Set `agents` on the `Agent` instead.
|
|
46
46
|
|
|
47
47
|
## Isolation
|
|
48
48
|
|
|
@@ -35,7 +35,7 @@ const { thread, clonedMessages } = await memory.cloneThread({
|
|
|
35
35
|
|
|
36
36
|
**title** (`string`): Optional title for the cloned thread. If omitted, the clone uses Clone of ${sourceThread.title} when the source thread has a title. Otherwise, the title is empty.
|
|
37
37
|
|
|
38
|
-
**metadata** (`Record<string, unknown>`): Optional metadata
|
|
38
|
+
**metadata** (`Record<string, unknown>`): Optional metadata for the new thread. The new thread's metadata contains only the supplied metadata plus an automatically added clone record with sourceThreadId, clonedAt, and optional lastMessageId. Source-thread metadata isn't copied.
|
|
39
39
|
|
|
40
40
|
**options** (`CloneOptions`): Optional filtering options for the clone operation.
|
|
41
41
|
|
|
@@ -35,7 +35,7 @@ const { thread, messageIdMap } = await memory.copyThread({
|
|
|
35
35
|
|
|
36
36
|
**title** (`string`): Optional title for the new thread. If omitted, the copy uses Clone of ${sourceThread.title} when the source thread has a title. Otherwise, the title is empty.
|
|
37
37
|
|
|
38
|
-
**metadata** (`Record<string, unknown>`): Optional metadata
|
|
38
|
+
**metadata** (`Record<string, unknown>`): Optional metadata for the new thread. The new thread's metadata contains only the supplied metadata plus an automatically added clone record with sourceThreadId, clonedAt, and optional lastMessageId. Source-thread metadata isn't copied.
|
|
39
39
|
|
|
40
40
|
**options** (`CloneOptions`): Optional filtering options. See cloneThread() for the full shape.
|
|
41
41
|
|
|
@@ -37,6 +37,8 @@ export const agent = new Agent({
|
|
|
37
37
|
|
|
38
38
|
**embedder** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder instance for vector embeddings. Required when semantic recall is enabled.
|
|
39
39
|
|
|
40
|
+
**embeddingDimension** (`number`): Output dimension of the embedder, as a positive integer. When set, Memory uses it to name the semantic recall index instead of embedding a probe string on first use. It must match the vectors the embedder returns: a mismatch throws a MASTRA\_MEMORY\_EMBEDDING\_DIMENSION\_MISMATCH error before any index is created. See Setting the embedding dimension.
|
|
41
|
+
|
|
40
42
|
**options** (`MemoryConfig`): Memory configuration options.
|
|
41
43
|
|
|
42
44
|
**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.
|
|
@@ -52,7 +52,7 @@ new MastraEditor({
|
|
|
52
52
|
|
|
53
53
|
**model** (`string`): Model ID used by both the Observer and Reflector (for example, "google/gemini-2.5-flash").
|
|
54
54
|
|
|
55
|
-
**scope** (`'resource' | 'thread'`):
|
|
55
|
+
**scope** (`'resource' | 'thread'`): Deprecated. 'resource' will be removed in a future release, leaving 'thread' (already the default) as the only scope. Omit this option to use thread scope. See resource scope (deprecated). (Default: `'thread'`)
|
|
56
56
|
|
|
57
57
|
**activateAfterIdle** (`ObservationalMemoryActivationTTL`): Inactivity TTL before forcing buffered observation activation.
|
|
58
58
|
|
|
@@ -30,10 +30,11 @@ The configured observability store must support each API. Call `getObservability
|
|
|
30
30
|
| `traceQueryTimeToFirstChunkSort` | `trace-query-time-to-first-chunk-sort` | `orderBy` on `timeToFirstChunkMs` |
|
|
31
31
|
| `traceQueryContextIds` | `trace-query-context-ids` | `runId`, `sessionId`, `userId`, and `organizationId` predicates |
|
|
32
32
|
| `traceQueryRootSpanFields` | `trace-query-root-span-fields` | Trace-scope `name` and `spanType` predicates, dimensions, and `countDistinct` measures |
|
|
33
|
+
| `traceQueryRootEntityId` | `trace-query-root-entity-id` | Trace-scope `entityId` predicates, dimensions, and `countDistinct` measures |
|
|
33
34
|
| `traceQueryDiscovery` | `trace-query-discovery` | [Field and value discovery](#discover-fields-and-values) |
|
|
34
35
|
| `traceQueryTenantScope` | `trace-query-tenant-scope` | [Trusted tenant scope](#trusted-tenant-scope) |
|
|
35
36
|
|
|
36
|
-
A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name` and `
|
|
37
|
+
A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name`, `spanType`, and `entityId` are the exception and return `422` with a `field_not_allowed` issue.
|
|
37
38
|
|
|
38
39
|
## Select traces
|
|
39
40
|
|
|
@@ -76,7 +77,7 @@ Span clauses examine the current root span and current child spans. The root `ti
|
|
|
76
77
|
|
|
77
78
|
| Predicate context | Fields | Operators |
|
|
78
79
|
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
|
|
79
|
-
| Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityName`, `entityType`, `name`, `spanType`, `environment`, `status`
|
|
80
|
+
| Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityId`, `entityName`, `entityType`, `name`, `spanType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
|
|
80
81
|
| Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
|
|
81
82
|
| Trace | `startedAt`, `endedAt`, `durationMs`, `timeToFirstChunkMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
|
|
82
83
|
| Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
|
|
@@ -85,7 +86,7 @@ Span clauses examine the current root span and current child spans. The root `ti
|
|
|
85
86
|
| Span | `startedAt`, `endedAt`, `durationMs`, `timeToFirstChunkMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
|
|
86
87
|
| Span | `error` | `exists`, `notExists` |
|
|
87
88
|
|
|
88
|
-
Trace-scope `name` and `
|
|
89
|
+
Trace-scope `name`, `spanType`, and `entityId` read the current root span, so `{ op: 'eq', left: { path: 'spanType' }, right: { literal: 'workflow_run' } }` selects traces started by a workflow run. Inside `spans.some` or `spans.none`, the same fields match any span in the trace.
|
|
89
90
|
|
|
90
91
|
Compose predicates with `{ op: 'and', args: [...] }`, `{ op: 'or', args: [...] }`, and `{ op: 'not', arg: ... }`. Comparison predicates place a field reference on the left and a literal on the right. Membership predicates use a field reference in `value` and a homogeneous literal array in `set`. Tag predicates name the stored tag collection in `path`. `includes` and `notIncludes` also take one tag in `value`, while `exists` and `notExists` take only `op` and `path`. See [Filter by tags](#filter-by-tags). Text predicates use the comparison shape with a string literal. See [Filter by text](#filter-by-text).
|
|
91
92
|
|
|
@@ -664,12 +665,13 @@ Unknown fields are rejected. Aggregation isn't paginated. Narrow the selection,
|
|
|
664
665
|
|
|
665
666
|
Dimensions read the current root span of each selected trace:
|
|
666
667
|
|
|
667
|
-
| Dimension | Notes
|
|
668
|
-
| ------------------------------------------------------------------------------------- |
|
|
669
|
-
| `entityType`, `entityName`, `environment`, `status`, `serviceName`, `executionSource` | Root span attributes.
|
|
670
|
-
| `threadId`, `resourceId`, `userId`, `sessionId`, `organizationId`, `experimentId` | Context identifiers recorded on the root span.
|
|
671
|
-
| `name`, `spanType` | Root span name and type. Requires the `traceQueryRootSpanFields` capability.
|
|
672
|
-
| `
|
|
668
|
+
| Dimension | Notes |
|
|
669
|
+
| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
670
|
+
| `entityType`, `entityName`, `environment`, `status`, `serviceName`, `executionSource` | Root span attributes. |
|
|
671
|
+
| `threadId`, `resourceId`, `userId`, `sessionId`, `organizationId`, `experimentId` | Context identifiers recorded on the root span. |
|
|
672
|
+
| `name`, `spanType` | Root span name and type. Requires the `traceQueryRootSpanFields` capability. |
|
|
673
|
+
| `entityId` | Root span entity ID. Groups traces that have no `entityName`, such as scorer runs. Requires the `traceQueryRootEntityId` capability. |
|
|
674
|
+
| `metadata.<key>` | One non-empty top-level metadata key. Values are trimmed. Missing, empty, and non-string values group as `null`. |
|
|
673
675
|
|
|
674
676
|
Every dimension except `serviceName`, `executionSource`, and `experimentId` is also a trace-scope `where` field, so you can drill into a group by adding its values to the predicate. `traceId`, `spanId`, `runId`, and `requestId` aren't groupable. Traces with no value for a dimension form their own group with a `null` value.
|
|
675
677
|
|
|
@@ -668,6 +668,14 @@ processOutputStep?(args: ProcessOutputStepArgs): ProcessorMessageResult;
|
|
|
668
668
|
|
|
669
669
|
**requestContext** (`RequestContext`): Request-scoped context with execution metadata.
|
|
670
670
|
|
|
671
|
+
#### Return value
|
|
672
|
+
|
|
673
|
+
`processOutputStep` returns a `MessageList` or `MastraDBMessage[]`, directly or in a promise.
|
|
674
|
+
|
|
675
|
+
- Return the supplied `messageList` instance to keep it, including any in-place changes.
|
|
676
|
+
- Return a messages array to replace the current messages. Return the supplied `messages` array to leave them unchanged.
|
|
677
|
+
- Returning `[]` removes all current messages, including the conversation history and the latest response. It isn't a no-op.
|
|
678
|
+
|
|
671
679
|
#### Use cases
|
|
672
680
|
|
|
673
681
|
- Implementing quality guardrails that can request retries
|
|
@@ -683,7 +691,7 @@ import type { Processor } from '@mastra/core/processors'
|
|
|
683
691
|
export class QualityGuardrail implements Processor {
|
|
684
692
|
id = 'quality-guardrail'
|
|
685
693
|
|
|
686
|
-
async processOutputStep({ text, abort, retryCount }) {
|
|
694
|
+
async processOutputStep({ messages, text, abort, retryCount }) {
|
|
687
695
|
const score = await evaluateResponseQuality(text)
|
|
688
696
|
|
|
689
697
|
if (score < 0.7) {
|
|
@@ -699,7 +707,7 @@ export class QualityGuardrail implements Processor {
|
|
|
699
707
|
}
|
|
700
708
|
}
|
|
701
709
|
|
|
702
|
-
return
|
|
710
|
+
return messages
|
|
703
711
|
}
|
|
704
712
|
}
|
|
705
713
|
```
|
|
@@ -396,6 +396,8 @@ Identifies a specific agent thread.
|
|
|
396
396
|
|
|
397
397
|
**agentId** (`string`): Agent identifier.
|
|
398
398
|
|
|
399
|
+
**ifIdle** (`AgentSignalIfIdleOptions`): Options for signal delivery when the target thread is idle. Forwarded to sendNotificationSignal. See thread signals.
|
|
400
|
+
|
|
399
401
|
## Type guard
|
|
400
402
|
|
|
401
403
|
### `isSignalProvider(obj)`
|
|
@@ -8,7 +8,7 @@
|
|
|
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
|
|
|
11
|
-
Extends [`SignalProvider`](https://mastra.ai/reference/signals/signal-provider). The task list is stored in the thread-scoped `
|
|
11
|
+
Extends [`SignalProvider`](https://mastra.ai/reference/signals/signal-provider). The task list is stored under the `task` state type in the thread-scoped `threadState` storage domain, which is the source of truth, and projected onto the `tasks` agent state-signal lane by the processor, so it survives observational-memory truncation without invalidating the prompt cache.
|
|
12
12
|
|
|
13
13
|
## Usage example
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.9-alpha.
|
|
3
|
+
"version": "1.3.9-alpha.13",
|
|
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.7",
|
|
29
|
-
"@mastra/
|
|
30
|
-
"@mastra/
|
|
29
|
+
"@mastra/mcp": "^2.5.0-alpha.1",
|
|
30
|
+
"@mastra/core": "1.79.0-alpha.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hono/node-server": "^2.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vitest": "4.1.11",
|
|
45
45
|
"@internal/lint": "0.0.144",
|
|
46
46
|
"@internal/types-builder": "0.0.119",
|
|
47
|
-
"@mastra/core": "1.79.0-alpha.
|
|
47
|
+
"@mastra/core": "1.79.0-alpha.9"
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://mastra.ai",
|
|
50
50
|
"repository": {
|