@mastra/mcp-docs-server 1.2.13-alpha.1 → 1.2.13-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/agent-approval.md +2 -2
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +2 -2
- package/.docs/docs/agents/using-tools.md +29 -0
- package/.docs/docs/{evals/datasets → datasets}/overview.md +3 -3
- package/.docs/docs/{evals/datasets → datasets}/running-experiments.md +27 -3
- package/.docs/docs/deployment/workers.md +14 -14
- package/.docs/docs/editor/overview.md +201 -206
- package/.docs/docs/evals/evals-with-memory.md +1 -1
- package/.docs/docs/getting-started/develop.md +196 -0
- package/.docs/docs/index.md +78 -1
- package/.docs/docs/long-running-agents/durable-agents.md +2 -2
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/workspaces.md +152 -0
- package/.docs/docs/memory/observational-memory.md +53 -13
- package/.docs/docs/memory/overview.md +14 -0
- package/.docs/docs/server/auth/workers.md +7 -5
- package/.docs/docs/server/mastra-client.md +60 -0
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/studio/observability.md +4 -0
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -0
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/deployment/kubernetes.md +2 -0
- package/.docs/guides/deployment/mastra-workers.md +350 -6
- package/.docs/guides/deployment/vercel.md +2 -0
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/{docs → guides}/rag/chunking-and-embedding.md +1 -1
- package/.docs/{docs → guides}/rag/graph-rag.md +1 -1
- package/.docs/{docs → guides}/rag/overview.md +2 -2
- package/.docs/{docs → guides}/rag/retrieval.md +1 -1
- package/.docs/{docs → guides}/voice/overview.md +4 -4
- package/.docs/{docs → guides}/voice/realtime-voice.md +2 -2
- package/.docs/{docs → guides}/voice/speech-to-speech.md +1 -1
- package/.docs/{docs → guides}/voice/speech-to-text.md +1 -1
- package/.docs/{docs → guides}/voice/text-to-speech.md +2 -2
- package/.docs/models/embeddings.md +63 -65
- package/.docs/models/environment-variables.md +1 -1
- package/.docs/models/gateways/openrouter.md +3 -6
- package/.docs/models/gateways/vercel.md +4 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/crof.md +2 -1
- package/.docs/models/providers/crossmodel.md +4 -3
- package/.docs/models/providers/empiriolabs.md +2 -1
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +10 -7
- package/.docs/models/providers/llmgateway.md +5 -4
- package/.docs/models/providers/minimax.md +1 -1
- package/.docs/models/providers/neuralwatt.md +3 -1
- package/.docs/models/providers/openai.md +2 -2
- package/.docs/models/providers/opencode-go.md +2 -1
- package/.docs/models/providers/opencode.md +1 -1
- package/.docs/models/providers/perplexity-agent.md +3 -1
- package/.docs/models/providers/scaleway.md +1 -3
- package/.docs/models/providers/the-grid-ai.md +3 -3
- package/.docs/models/providers/zai-coding-plan.md +11 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +12 -12
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/durable-agent.md +12 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/{docs/getting-started → reference}/build-with-ai.md +5 -110
- package/.docs/reference/cli/create-mastra.md +2 -0
- package/.docs/reference/cli/mastra.md +36 -16
- package/.docs/reference/client-js/agents.md +1 -1
- package/.docs/reference/configuration.md +2 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/datasets/startExperiment.md +6 -0
- package/.docs/reference/datasets/startExperimentAsync.md +4 -0
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +31 -18
- package/.docs/reference/editor/prompt-blocks.md +137 -0
- package/.docs/reference/editor/sandbox-provider.md +1 -1
- package/.docs/reference/editor/storage-browser-ref.md +3 -3
- package/.docs/reference/editor/storage-workspace-ref.md +3 -3
- package/.docs/reference/editor/tool-provider.md +44 -10
- package/.docs/reference/editor/tools.md +100 -0
- package/.docs/reference/editor/versioning.md +130 -0
- package/.docs/reference/evals/mastra-scorer.md +68 -8
- package/.docs/reference/evals/summarization.md +203 -0
- package/.docs/reference/file-based-agents/config.md +39 -1
- package/.docs/reference/index.md +4 -4
- package/.docs/reference/memory/observational-memory.md +76 -24
- package/.docs/reference/memory/serialized-memory-config.md +3 -3
- package/.docs/reference/observability/tracing/interfaces.md +6 -1
- package/.docs/reference/processors/processor-interface.md +14 -2
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +15 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/reference/storage/composite.md +2 -0
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/isolated-vm-transport.md +1 -1
- package/.docs/reference/vectors/mongodb.md +13 -13
- package/.docs/reference/voice/livekit.md +3 -3
- package/.docs/reference/workers/overview.md +10 -8
- package/.docs/reference/workspace/platform-filesystem.md +8 -5
- package/.docs/reference/workspace/platform-sandbox.md +83 -7
- package/CHANGELOG.md +44 -0
- package/README.md +1 -1
- package/package.json +5 -5
- package/.docs/docs/agent-builder/access-control.md +0 -99
- package/.docs/docs/agent-builder/browser.md +0 -63
- package/.docs/docs/agent-builder/channels.md +0 -78
- package/.docs/docs/agent-builder/configuration.md +0 -132
- package/.docs/docs/agent-builder/deploying.md +0 -124
- package/.docs/docs/agent-builder/integrations.md +0 -115
- package/.docs/docs/agent-builder/memory.md +0 -69
- package/.docs/docs/agent-builder/model-policy.md +0 -50
- package/.docs/docs/agent-builder/overview.md +0 -114
- package/.docs/docs/agent-builder/skill-registries.md +0 -31
- package/.docs/docs/agent-builder/workspace.md +0 -62
- package/.docs/docs/editor/prompts.md +0 -140
- package/.docs/docs/editor/tools.md +0 -148
- package/.docs/docs/getting-started/file-based-agents.md +0 -121
- package/.docs/docs/mastra-platform/workspace.md +0 -111
- package/.docs/docs/what-is-mastra.md +0 -161
- package/.docs/reference/client-js/agent-builder.md +0 -163
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +0 -76
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +0 -79
- package/.docs/reference/editor/agent-builder/builder-models.md +0 -66
- /package/.docs/{docs → guides}/getting-started/manual-install.md +0 -0
- /package/.docs/{docs → guides}/rag/vector-databases.md +0 -0
|
@@ -20,5 +20,5 @@ mastra.getVector('testVectorStore')
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -20,5 +20,5 @@ This method doesn't accept any parameters.
|
|
|
20
20
|
|
|
21
21
|
## Related
|
|
22
22
|
|
|
23
|
-
- [Vector stores overview](https://mastra.ai/
|
|
24
|
-
- [RAG overview](https://mastra.ai/
|
|
23
|
+
- [Vector stores overview](https://mastra.ai/guides/rag/vector-databases)
|
|
24
|
+
- [RAG overview](https://mastra.ai/guides/rag/overview)
|
|
@@ -97,7 +97,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
97
97
|
|
|
98
98
|
**notifications.dispatch.batchSize** (`number`): Maximum number of due notification records to process per dispatch run.
|
|
99
99
|
|
|
100
|
-
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See
|
|
100
|
+
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See Editor versioning for details.
|
|
101
101
|
|
|
102
102
|
**versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors. Each selector can target a specific version by ID or by publication status.
|
|
103
103
|
|
|
@@ -135,7 +135,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
135
135
|
|
|
136
136
|
Re-drives every orphaned `running` durable-agent run across all registered durable agents. Called automatically on boot when `recovery.durableAgents` is `'auto'`. You can also call it directly for manual recovery or from a scheduled task.
|
|
137
137
|
|
|
138
|
-
Requires persistent storage
|
|
138
|
+
Requires persistent storage. With an in-memory store, there's nothing to recover after a process restart.
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
141
|
const result = await mastra.recoverAllDurableAgents()
|
|
@@ -79,6 +79,12 @@ console.log(`Status: ${summary2.status}`)
|
|
|
79
79
|
|
|
80
80
|
**unmockedToolPolicy** (`'allow' | 'deny'`): Controls undeclared agent tool calls. allow executes them live. deny fails the item with TOOL\_MOCK\_NOT\_DECLARED before execution. An item-level value overrides this experiment default. (Default: `'allow'`)
|
|
81
81
|
|
|
82
|
+
**persistence** (`ExperimentPersistencePolicy`): Controls whether this run writes experiment records and score records. Targets and scorers still execute, and results remain available in the returned summary.
|
|
83
|
+
|
|
84
|
+
**persistence.experiments** (`'default' | 'none'`): Set to none to skip experiment creation, item results, progress, and terminal status writes.
|
|
85
|
+
|
|
86
|
+
**persistence.scores** (`'default' | 'none'`): Set to none to skip score writes while still running scorers.
|
|
87
|
+
|
|
82
88
|
## Returns
|
|
83
89
|
|
|
84
90
|
**result** (`Promise<ExperimentSummary>`): Summary of the completed experiment.
|
|
@@ -33,6 +33,10 @@ console.log(`Current status: ${experiment.status}`)
|
|
|
33
33
|
|
|
34
34
|
Takes the same `StartExperimentConfig` as [`dataset.startExperiment()`](https://mastra.ai/reference/datasets/startExperiment).
|
|
35
35
|
|
|
36
|
+
When `persistence.experiments` is set to `'none'`, `startExperimentAsync()` doesn't persist an experiment record, progress updates, or item results. Score persistence remains controlled separately by `persistence.scores`. Without an experiment event observer, the run is fire-and-forget, and the experiment API can't report whether it completed or failed.
|
|
37
|
+
|
|
38
|
+
Use synchronous [`startExperiment()`](https://mastra.ai/reference/datasets/startExperiment) when the caller needs the returned summary. An experiment event observer can receive lifecycle events and the terminal summary.
|
|
39
|
+
|
|
36
40
|
## Returns
|
|
37
41
|
|
|
38
42
|
**result** (`Promise<object>`): Immediate response with experiment ID.
|
|
@@ -54,7 +54,7 @@ export const myBrowserProvider: BrowserProvider<{ apiKey: string }> = {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/
|
|
57
|
+
Once registered, admins can pin the provider as a Builder default via [`BuilderAgentDefaults.browser`](https://agent-builder.mastra.ai/reference/builder-agent-defaults):
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
new MastraEditor({
|
|
@@ -72,6 +72,6 @@ new MastraEditor({
|
|
|
72
72
|
|
|
73
73
|
## Related
|
|
74
74
|
|
|
75
|
-
- [Browser](https://mastra.ai/
|
|
75
|
+
- [Browser](https://agent-builder.mastra.ai/browser): Concept and worked examples.
|
|
76
76
|
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref): Stored configuration consumed by `createBrowser`.
|
|
77
77
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -58,7 +58,7 @@ Once registered, admins can reference the provider from an inline workspace conf
|
|
|
58
58
|
|
|
59
59
|
## Related
|
|
60
60
|
|
|
61
|
-
- [Workspace](https://mastra.ai/
|
|
61
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
62
62
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Stored configuration consumed by `createFilesystem`.
|
|
63
63
|
- [SandboxProvider](https://mastra.ai/reference/editor/sandbox-provider): Sibling provider for command execution.
|
|
64
64
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -4,24 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
The `MastraEditor` class sets up the editor system. Pass it to the `Mastra` constructor to turn on editor features like prompt blocks, agent code override, versioning, and tool providers.
|
|
6
6
|
|
|
7
|
-
See
|
|
7
|
+
See [Editor](https://mastra.ai/docs/editor/overview) for an introduction to what the editor does.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
import { Mastra } from '@mastra/core'
|
|
13
13
|
import { MastraEditor } from '@mastra/editor'
|
|
14
|
-
import { ComposioToolProvider } from '@mastra/editor/providers/composio'
|
|
15
14
|
|
|
16
15
|
export const mastra = new Mastra({
|
|
17
16
|
agents: {/* your agents */},
|
|
18
|
-
editor: new MastraEditor(
|
|
19
|
-
toolProviders: {
|
|
20
|
-
composio: new ComposioToolProvider({
|
|
21
|
-
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
17
|
+
editor: new MastraEditor(),
|
|
25
18
|
})
|
|
26
19
|
```
|
|
27
20
|
|
|
@@ -43,7 +36,7 @@ export const mastra = new Mastra({
|
|
|
43
36
|
|
|
44
37
|
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set enabled: false to disable the Builder.
|
|
45
38
|
|
|
46
|
-
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See
|
|
39
|
+
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See Editor storage options for the difference. (Default: `'db'`)
|
|
47
40
|
|
|
48
41
|
**codePath** (`string`): Directory used by the 'code' source for per-agent JSON files. Ignored when source is not 'code'. (Default: `'./mastra/editor/'`)
|
|
49
42
|
|
|
@@ -59,12 +52,12 @@ Each provider field above takes a record keyed by provider id. See the per-provi
|
|
|
59
52
|
|
|
60
53
|
## Agent Builder
|
|
61
54
|
|
|
62
|
-
The `builder` field enables the [Agent Builder](https://mastra.ai/
|
|
55
|
+
The `builder` field enables the [Agent Builder](https://agent-builder.mastra.ai/), a browser-based UI for creating and editing stored agents. See:
|
|
63
56
|
|
|
64
|
-
- [Agent Builder overview](https://mastra.ai/
|
|
65
|
-
- [AgentBuilderOptions](https://mastra.ai/reference/
|
|
66
|
-
- [BuilderAgentDefaults](https://mastra.ai/reference/
|
|
67
|
-
- [builder.configuration.agent.models](https://mastra.ai/reference/
|
|
57
|
+
- [Agent Builder overview](https://agent-builder.mastra.ai/): Concepts and getting started.
|
|
58
|
+
- [AgentBuilderOptions](https://agent-builder.mastra.ai/reference/agent-builder-options): Full options schema.
|
|
59
|
+
- [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Admin-pinned defaults for new agents.
|
|
60
|
+
- [builder.configuration.agent.models](https://agent-builder.mastra.ai/reference/builder-models): Model allowlist and default model.
|
|
68
61
|
|
|
69
62
|
### Registering the Builder agent
|
|
70
63
|
|
|
@@ -85,7 +78,7 @@ export const mastra = new Mastra({
|
|
|
85
78
|
|
|
86
79
|
The key name (`builderAgent`) is conventional. Any key works. The `@mastra/editor/ee` subpath is gated by the Mastra Enterprise Edition license at runtime.
|
|
87
80
|
|
|
88
|
-
See the [Agent Builder overview](https://mastra.ai
|
|
81
|
+
See the [Agent Builder overview](https://agent-builder.mastra.ai/#prerequisites) for the full setup checklist.
|
|
89
82
|
|
|
90
83
|
## Namespaces
|
|
91
84
|
|
|
@@ -99,7 +92,7 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
99
92
|
|
|
100
93
|
**agent.getById** (`(id: string, options?: GetByIdOptions) => Promise<Agent | null>`): Return a hydrated Agent instance for a stored agent. Pass options with versionId, versionNumber, or status ("draft" | "published" | "archived") to target a specific version. Default version requests are cached.
|
|
101
94
|
|
|
102
|
-
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a
|
|
95
|
+
**agent.update** (`(input: StorageUpdateAgentInput) => Promise<Agent>`): Partially update a stored agent. Creates a version from the provided snapshot fields, assigns it to activeVersionId, and invalidates the cache. Set memory to null to disable memory.
|
|
103
96
|
|
|
104
97
|
**agent.delete** (`(id: string) => Promise<void>`): Delete a stored agent and remove it from the Mastra runtime registry.
|
|
105
98
|
|
|
@@ -179,6 +172,24 @@ All namespaces extend a shared CRUD base class, so they expose the same `create`
|
|
|
179
172
|
|
|
180
173
|
**scorer.clearCache** (`(id?: string) => void`): Clear the in-memory cache for one scorer or all scorers.
|
|
181
174
|
|
|
175
|
+
### Agent namespace examples
|
|
176
|
+
|
|
177
|
+
Create a stored override for an existing code-defined agent:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { mastra } from '../mastra'
|
|
181
|
+
|
|
182
|
+
const editor = mastra.getEditor()!
|
|
183
|
+
|
|
184
|
+
await editor.agent.create({
|
|
185
|
+
id: 'support-agent',
|
|
186
|
+
instructions: 'You are a friendly support agent for Acme.',
|
|
187
|
+
tools: {
|
|
188
|
+
search_kb: { description: 'Search the Acme knowledge base' },
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
182
193
|
## Methods
|
|
183
194
|
|
|
184
195
|
### Provider access
|
|
@@ -225,4 +236,6 @@ Returns the configured source (`'code'` or `'db'`), or `undefined` when the edit
|
|
|
225
236
|
const source = mastra.getEditor()?.getSource()
|
|
226
237
|
```
|
|
227
238
|
|
|
228
|
-
Returns: `'code' | 'db' | undefined`
|
|
239
|
+
Returns: `'code' | 'db' | undefined`
|
|
240
|
+
|
|
241
|
+
When `source` is omitted, Editor uses the configured database storage even though `getSource()` returns `undefined`. See [Editor storage options](https://mastra.ai/docs/editor/overview) for the storage workflows and [code-source versioning](https://mastra.ai/reference/editor/versioning) for activation and Git history behavior.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Prompt blocks
|
|
4
|
+
|
|
5
|
+
Prompt blocks are reusable instruction templates managed by Editor. An agent's instructions can combine inline text, embedded prompt blocks, and references to independently versioned prompt blocks.
|
|
6
|
+
|
|
7
|
+
See [Prompt blocks](https://mastra.ai/docs/editor/overview) for the Studio workflow and common uses.
|
|
8
|
+
|
|
9
|
+
## Block types
|
|
10
|
+
|
|
11
|
+
| Type | Description |
|
|
12
|
+
| ------------------ | ----------------------------------------------------------------- |
|
|
13
|
+
| `text` | Free-form text stored only in the agent version |
|
|
14
|
+
| `prompt_block` | A prompt block embedded in the agent version |
|
|
15
|
+
| `prompt_block_ref` | A reference to an independently stored and versioned prompt block |
|
|
16
|
+
|
|
17
|
+
Referenced blocks resolve at runtime. A missing or unpublished reference is omitted from the final instructions. Resolved nonempty blocks are joined with two newlines.
|
|
18
|
+
|
|
19
|
+
The following example attaches a stored block and inline text to an agent:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { mastra } from '../mastra'
|
|
23
|
+
|
|
24
|
+
const editor = mastra.getEditor()!
|
|
25
|
+
|
|
26
|
+
await editor.agent.update({
|
|
27
|
+
id: 'support-agent',
|
|
28
|
+
instructions: [
|
|
29
|
+
{ type: 'prompt_block_ref', id: 'brand-voice' },
|
|
30
|
+
{ type: 'text', content: 'Answer only questions about Acme products.' },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Template values
|
|
36
|
+
|
|
37
|
+
Templates resolve values from the request context at runtime.
|
|
38
|
+
|
|
39
|
+
| Syntax | Request context | Output |
|
|
40
|
+
| ------------------------- | ---------------------------- | ------------------ |
|
|
41
|
+
| `{{userName}}` | `{ userName: 'Maya' }` | `Maya` |
|
|
42
|
+
| `{{user.name}}` | `{ user: { name: 'Maya' } }` | `Maya` |
|
|
43
|
+
| `{{task \|\| 'request'}}` | `{}` | `request` |
|
|
44
|
+
| `{{missingValue}}` | `{}` | `{{missingValue}}` |
|
|
45
|
+
|
|
46
|
+
Variable names must begin with a letter or underscore. Fallbacks must be single-quoted or double-quoted strings. Unresolved placeholders without a fallback remain unchanged. Objects and arrays are serialized as JSON. Other values are converted to strings.
|
|
47
|
+
|
|
48
|
+
Pass values through [request context](https://mastra.ai/docs/server/request-context). Editor doesn't read a separate agent `variables` field.
|
|
49
|
+
|
|
50
|
+
## Display conditions
|
|
51
|
+
|
|
52
|
+
A prompt block can include a display condition that controls whether it's included in the final instructions. Each condition has three parts:
|
|
53
|
+
|
|
54
|
+
- **Key**: The request-context field to check, such as `user.role` or `account.plan`.
|
|
55
|
+
- **Operator**: The comparison to make, such as `equals`, `contains`, or `exists`.
|
|
56
|
+
- **Value**: The value to compare against. The `exists` and `not_exists` operators don't need one.
|
|
57
|
+
|
|
58
|
+
For example, the condition `user.role` `equals` `admin` includes the block only when request context contains `{ user: { role: 'admin' } }`.
|
|
59
|
+
|
|
60
|
+
| Operator | Example | The block is included when |
|
|
61
|
+
| ---------------------------------------------- | --------------------------------------------- | --------------------------------------------------------- |
|
|
62
|
+
| `equals` / `not_equals` | `user.role` equals `admin` | The field strictly equals, or doesn't equal, the value |
|
|
63
|
+
| `contains` / `not_contains` | `user.tags` contains `beta` | A string contains the value or an array contains the item |
|
|
64
|
+
| `greater_than` / `less_than` | `order.total` greater than `100` | The numeric field is above or below the value |
|
|
65
|
+
| `greater_than_or_equal` / `less_than_or_equal` | `account.seats` greater than or equal to `10` | The numeric field is at or beyond the value |
|
|
66
|
+
| `in` / `not_in` | `user.region` in `['US', 'CA']` | The field is, or isn't, in the supplied array |
|
|
67
|
+
| `exists` / `not_exists` | `account.plan` exists | The field has, or doesn't have, a non-null value |
|
|
68
|
+
|
|
69
|
+
Groups combine conditions with `AND` or `OR`. For example, this group includes a block for admins on a paid plan:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const rules = {
|
|
73
|
+
operator: 'AND',
|
|
74
|
+
conditions: [
|
|
75
|
+
{
|
|
76
|
+
field: 'user.role',
|
|
77
|
+
operator: 'equals',
|
|
78
|
+
value: 'admin',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
field: 'account.plan',
|
|
82
|
+
operator: 'in',
|
|
83
|
+
value: ['pro', 'enterprise'],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Dot paths are supported. An empty group evaluates to `true`, and an unknown operator evaluates to `false`. The storage type supports up to three nested group levels.
|
|
90
|
+
|
|
91
|
+
Blocks without conditions are always included.
|
|
92
|
+
|
|
93
|
+
## Programmatic API
|
|
94
|
+
|
|
95
|
+
Access prompt blocks through `mastra.getEditor().prompt`. See the [`prompt` namespace](https://mastra.ai/reference/editor/mastra-editor) for complete method signatures.
|
|
96
|
+
|
|
97
|
+
Create a prompt block:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { mastra } from '../mastra'
|
|
101
|
+
|
|
102
|
+
const editor = mastra.getEditor()!
|
|
103
|
+
|
|
104
|
+
await editor.prompt.create({
|
|
105
|
+
id: 'brand-voice',
|
|
106
|
+
name: 'Brand voice',
|
|
107
|
+
description: 'Acme tone and style guidelines',
|
|
108
|
+
content: 'Write in a friendly, concise tone. Address the user as {{userName || "there"}}.',
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Update an existing block:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
await editor.prompt.update({
|
|
116
|
+
id: 'brand-voice',
|
|
117
|
+
content: 'Write in a friendly, concise tone. Greet the user by name when available.',
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`update()` creates a new draft when the content changes. Use `list()` to paginate through stored blocks, `getById()` to fetch one block, and `preview(blocks, context)` to resolve templates and conditions with draft references.
|
|
122
|
+
|
|
123
|
+
## REST API
|
|
124
|
+
|
|
125
|
+
The default Mastra server prefix is `/api`. A custom server prefix changes the paths below.
|
|
126
|
+
|
|
127
|
+
| Method | Path | Description |
|
|
128
|
+
| -------- | ------------------------------------------------ | ---------------------------- |
|
|
129
|
+
| `GET` | `/api/stored/prompt-blocks` | List stored prompt blocks |
|
|
130
|
+
| `POST` | `/api/stored/prompt-blocks` | Create a stored prompt block |
|
|
131
|
+
| `GET` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Get a stored prompt block |
|
|
132
|
+
| `PATCH` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Update a stored prompt block |
|
|
133
|
+
| `DELETE` | `/api/stored/prompt-blocks/:storedPromptBlockId` | Delete a stored prompt block |
|
|
134
|
+
|
|
135
|
+
## Version resolution
|
|
136
|
+
|
|
137
|
+
Runtime references resolve the active published block. Editor previews resolve the latest draft. See [Editor versioning](https://mastra.ai/docs/editor/overview) for the shared draft, publish, and restore lifecycle.
|
|
@@ -57,7 +57,7 @@ Once registered, admins can reference the provider from an inline workspace conf
|
|
|
57
57
|
|
|
58
58
|
## Related
|
|
59
59
|
|
|
60
|
-
- [Workspace](https://mastra.ai/
|
|
60
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
61
61
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Stored configuration consumed by `createSandbox`.
|
|
62
62
|
- [FilesystemProvider](https://mastra.ai/reference/editor/filesystem-provider): Sibling provider for file access.
|
|
63
63
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Provider registry.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`StorageBrowserRef` is the inline browser configuration attached to a stored agent. The `provider` id is resolved at hydration time against the [`BrowserProvider`](https://mastra.ai/reference/editor/browser-provider) registered on [`MastraEditor.browsers`](https://mastra.ai/reference/editor/mastra-editor).
|
|
6
6
|
|
|
7
|
-
It's the type used by [`BuilderAgentDefaults.browser`](https://mastra.ai/reference/
|
|
7
|
+
It's the type used by [`BuilderAgentDefaults.browser`](https://agent-builder.mastra.ai/reference/builder-agent-defaults) and by stored agent records.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -76,7 +76,7 @@ The shape embedded under `config`. Defined in `@mastra/core/storage`.
|
|
|
76
76
|
|
|
77
77
|
## Related
|
|
78
78
|
|
|
79
|
-
- [Browser](https://mastra.ai/
|
|
79
|
+
- [Browser](https://agent-builder.mastra.ai/browser): Concept and worked examples.
|
|
80
80
|
- [BrowserProvider](https://mastra.ai/reference/editor/browser-provider): Implementer-facing provider interface.
|
|
81
|
-
- [BuilderAgentDefaults](https://mastra.ai/reference/
|
|
81
|
+
- [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Where this type is pinned as the Builder default.
|
|
82
82
|
- [StorageWorkspaceRef](https://mastra.ai/reference/editor/storage-workspace-ref): Sibling reference type for workspace configuration.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`StorageWorkspaceRef` is the discriminated union used to attach a workspace to a stored agent. It either points at a workspace registered on the Mastra runtime by ID, or embeds a workspace snapshot inline.
|
|
6
6
|
|
|
7
|
-
It's the type used by [`BuilderAgentDefaults.workspace`](https://mastra.ai/reference/
|
|
7
|
+
It's the type used by [`BuilderAgentDefaults.workspace`](https://agent-builder.mastra.ai/reference/builder-agent-defaults) and by stored agent records.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -89,7 +89,7 @@ The shape embedded under `{ type: 'inline', config }`. Defined in `@mastra/core/
|
|
|
89
89
|
|
|
90
90
|
## Related
|
|
91
91
|
|
|
92
|
-
- [Workspace](https://mastra.ai/
|
|
93
|
-
- [BuilderAgentDefaults](https://mastra.ai/reference/
|
|
92
|
+
- [Workspace](https://agent-builder.mastra.ai/workspace): Concept and worked examples.
|
|
93
|
+
- [BuilderAgentDefaults](https://agent-builder.mastra.ai/reference/builder-agent-defaults): Where this type is pinned as the Builder default.
|
|
94
94
|
- [MastraEditor class](https://mastra.ai/reference/editor/mastra-editor): Registers filesystem and sandbox providers.
|
|
95
95
|
- [StorageBrowserRef](https://mastra.ai/reference/editor/storage-browser-ref): Sibling reference type for browser configuration.
|
|
@@ -4,19 +4,47 @@
|
|
|
4
4
|
|
|
5
5
|
The `ToolProvider` interface defines how the editor discovers and resolves integration tools from external platforms. Mastra includes two built-in implementations: `ComposioToolProvider` and `ArcadeToolProvider`.
|
|
6
6
|
|
|
7
|
-
See [
|
|
7
|
+
See [Editor tools](https://mastra.ai/docs/editor/overview) for provider setup and the Studio workflow. See [tool configuration](https://mastra.ai/reference/editor/tools) for stored selections and resolution behavior.
|
|
8
8
|
|
|
9
9
|
## ToolProvider interface
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Providers expose metadata and the legacy discovery and resolution methods. Agent Builder integrations can also implement the optional VNext catalog, connection, authorization, and health methods.
|
|
12
12
|
|
|
13
|
-
**
|
|
13
|
+
**info** (`ToolProviderInfo`): Provider ID, name, and description.
|
|
14
14
|
|
|
15
|
-
**
|
|
15
|
+
**displayName** (`string`): Optional name shown in the tool picker. Defaults to info.name.
|
|
16
16
|
|
|
17
|
-
**
|
|
17
|
+
**capabilities** (`ToolProviderCapabilities`): Static connection and revocation capabilities. Required for VNext providers.
|
|
18
18
|
|
|
19
|
-
**
|
|
19
|
+
**defaultScope** (`'per-author' | 'caller-supplied'`): Default connection identity scope. Defaults to 'per-author' when omitted.
|
|
20
|
+
|
|
21
|
+
**listToolkits()** (`() => Promise<ToolProviderListResult<ToolProviderToolkit>>`): Lists available toolkits through the legacy interface.
|
|
22
|
+
|
|
23
|
+
**listTools(params?)** (`(params?: ListToolProviderToolsOptions) => Promise<ToolProviderListResult<ToolProviderToolInfo>>`): Lists tools with optional toolkit, search, and pagination filters.
|
|
24
|
+
|
|
25
|
+
**getToolSchema(slug)** (`(slug: string) => Promise<Record<string, unknown> | null>`): Returns a tool input schema through the legacy interface.
|
|
26
|
+
|
|
27
|
+
**resolveTools(slugs, configs?, options?)** (`(slugs: string[], configs?: Record<string, StorageToolConfig>, options?: ResolveToolProviderToolsOptions) => Promise<Record<string, ToolAction>>`): Resolves legacy tool selections into executable Mastra tools.
|
|
28
|
+
|
|
29
|
+
**listToolkitsVNext()** (`() => Promise<ListToolkitsResult>`): Lists allowed toolkits for Agent Builder and Editor.
|
|
30
|
+
|
|
31
|
+
**listToolsVNext(options?)** (`(options?: ListToolsOpts) => Promise<ListToolsResult>`): Lists allowed tools with toolkit, search, and pagination options.
|
|
32
|
+
|
|
33
|
+
**resolveToolsVNext(options)** (`(options: ResolveToolsOpts) => Promise<Record<string, ToolAction>>`): Resolves tools for one set of slugs and one authorized connection.
|
|
34
|
+
|
|
35
|
+
**authorize(options)** (`(options: AuthorizeOpts) => Promise<{ url: string; authId: string }>`): Starts an authorization flow.
|
|
36
|
+
|
|
37
|
+
**listConnectionFields(options)** (`(options: { toolkit: string }) => Promise<ConnectionField[]>`): Lists provider-specific values required to authorize a toolkit.
|
|
38
|
+
|
|
39
|
+
**getAuthStatus(authId)** (`(authId: string) => Promise<AuthFlowStatus>`): Returns the state of an authorization flow.
|
|
40
|
+
|
|
41
|
+
**getConnectionStatus(options)** (`(options: { items: Array<{ connectionId: string; toolkit: string }> }) => Promise<Record<string, { connected: boolean }>>`): Checks whether a batch of connections is still active.
|
|
42
|
+
|
|
43
|
+
**listConnections(options)** (`(options: ListConnectionsOpts) => Promise<ListConnectionsResult>`): Lists existing provider connections for a user and toolkit.
|
|
44
|
+
|
|
45
|
+
**getHealth()** (`() => Promise<ToolProviderHealth>`): Returns provider configuration and reachability health.
|
|
46
|
+
|
|
47
|
+
**revokeConnection(connectionId)** (`(connectionId: string) => Promise<void>`): Revokes a provider connection.
|
|
20
48
|
|
|
21
49
|
***
|
|
22
50
|
|
|
@@ -28,7 +56,7 @@ Connects to [Composio](https://composio.dev) for access to hundreds of integrati
|
|
|
28
56
|
|
|
29
57
|
```typescript
|
|
30
58
|
import { MastraEditor } from '@mastra/editor'
|
|
31
|
-
import { ComposioToolProvider } from '@mastra/editor/
|
|
59
|
+
import { ComposioToolProvider } from '@mastra/editor/composio'
|
|
32
60
|
|
|
33
61
|
const editor = new MastraEditor({
|
|
34
62
|
toolProviders: {
|
|
@@ -43,13 +71,19 @@ const editor = new MastraEditor({
|
|
|
43
71
|
|
|
44
72
|
**apiKey** (`string`): Your Composio API key.
|
|
45
73
|
|
|
74
|
+
**allowedToolkits** (`readonly string[]`): Toolkit slug allowlist. Supports exact matches and suffix wildcards.
|
|
75
|
+
|
|
76
|
+
**allowedTools** (`Readonly<Record<string, readonly string[]>>`): Per-toolkit tool slug allowlists. Supports exact matches and prefix wildcards.
|
|
77
|
+
|
|
78
|
+
**defaultScope** (`'per-author' | 'caller-supplied'`): Connection identity scope. Defaults to per-author. (Default: `'per-author'`)
|
|
79
|
+
|
|
46
80
|
### Tool slugs
|
|
47
81
|
|
|
48
82
|
Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MESSAGE`.
|
|
49
83
|
|
|
50
84
|
### Authentication
|
|
51
85
|
|
|
52
|
-
|
|
86
|
+
Connections use per-author scope by default. Set `defaultScope: 'caller-supplied'` to bucket authorization by the caller identity resolved from request context.
|
|
53
87
|
|
|
54
88
|
***
|
|
55
89
|
|
|
@@ -61,7 +95,7 @@ Connects to [Arcade](https://arcade.dev) for a curated tool catalog with built-i
|
|
|
61
95
|
|
|
62
96
|
```typescript
|
|
63
97
|
import { MastraEditor } from '@mastra/editor'
|
|
64
|
-
import { ArcadeToolProvider } from '@mastra/editor/
|
|
98
|
+
import { ArcadeToolProvider } from '@mastra/editor/arcade'
|
|
65
99
|
|
|
66
100
|
const editor = new MastraEditor({
|
|
67
101
|
toolProviders: {
|
|
@@ -84,4 +118,4 @@ Arcade tools use `Toolkit.ToolName` format: `Github.GetRepository`, `Slack.SendM
|
|
|
84
118
|
|
|
85
119
|
### Authentication
|
|
86
120
|
|
|
87
|
-
|
|
121
|
+
The legacy Arcade resolver uses `resourceId` from request context when available. It otherwise falls back to the supplied `userId`, then to a shared `default` identity. Use `default` only for intentionally shared integrations. In tenant-isolated deployments, provide a trusted, stable `resourceId` or explicit `userId`. Omitting both doesn't isolate callers.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Tool configuration
|
|
4
|
+
|
|
5
|
+
Editor stores tool selections as part of an agent version. A stored configuration can add registered tools, tools from integration providers, and tools from Model Context Protocol (MCP) clients.
|
|
6
|
+
|
|
7
|
+
See [Editor tools](https://mastra.ai/docs/editor/overview) for the Studio workflow and common uses.
|
|
8
|
+
|
|
9
|
+
## Tool sources
|
|
10
|
+
|
|
11
|
+
| Source | Description |
|
|
12
|
+
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
|
13
|
+
| Registered tools | Tools registered in the Mastra runtime tool registry |
|
|
14
|
+
| MCP clients | Tools exposed by stored local or remote MCP server configurations |
|
|
15
|
+
| Integration tools | Tools resolved by legacy integration-provider configuration |
|
|
16
|
+
| [Tool providers](https://mastra.ai/reference/editor/tool-provider) | Tools resolved by providers registered on `MastraEditor`, such as Composio or Arcade |
|
|
17
|
+
|
|
18
|
+
Code-defined agents keep their existing tools. The [`editor` override setting](https://mastra.ai/reference/agents/agent) controls whether Editor can add and remove tools or only change descriptions.
|
|
19
|
+
|
|
20
|
+
## Description overrides
|
|
21
|
+
|
|
22
|
+
Each selected tool can store an agent-specific description. The description changes what the model sees without modifying the original tool definition.
|
|
23
|
+
|
|
24
|
+
In description-only mode, Editor applies overrides only to tools that already exist on the code-defined agent. For MCP tools, an agent-level description takes priority over the description stored on the MCP client.
|
|
25
|
+
|
|
26
|
+
If two sources resolve the same tool ID, the later source replaces the complete earlier tool, including its description. See [Resolution order](#resolution-order).
|
|
27
|
+
|
|
28
|
+
## Conditional tool sets
|
|
29
|
+
|
|
30
|
+
Editor can store conditional variants for the `tools`, `mcpClients`, `integrationTools`, and `toolProviders` fields. At runtime, matching variants are shallow-merged based on request-context values.
|
|
31
|
+
|
|
32
|
+
The rule language uses the same operators and nesting behavior as [prompt block display conditions](https://mastra.ai/reference/editor/prompt-blocks).
|
|
33
|
+
|
|
34
|
+
Conditions apply to a tool field variant or MCP client reference. Per-tool `rules` values in stored tool entries aren't evaluated by the current Editor resolver.
|
|
35
|
+
|
|
36
|
+
## Stored MCP clients
|
|
37
|
+
|
|
38
|
+
The `editor.mcp` namespace manages reusable MCP client configurations. See the [`mcp` namespace](https://mastra.ai/reference/editor/mastra-editor) for CRUD method signatures.
|
|
39
|
+
|
|
40
|
+
`@mastra/mcp` is an optional peer dependency of `@mastra/editor`. Install it before configuring stored MCP clients so Editor can load their tools at runtime:
|
|
41
|
+
|
|
42
|
+
**npm**:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install @mastra/mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**pnpm**:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm add @mastra/mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Yarn**:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
yarn add @mastra/mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Bun**:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bun add @mastra/mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Transports
|
|
67
|
+
|
|
68
|
+
| Transport | Stored configuration |
|
|
69
|
+
| --------- | ---------------------------------------------------- |
|
|
70
|
+
| `stdio` | `command` with optional `args`, `env`, and `timeout` |
|
|
71
|
+
| HTTP | `url` with optional `timeout` |
|
|
72
|
+
|
|
73
|
+
Stored HTTP definitions don't accept arbitrary headers. When the reserved `mastra__authToken` value is present in request context, Editor forwards it as an `Authorization: Bearer` header.
|
|
74
|
+
|
|
75
|
+
### Filtering
|
|
76
|
+
|
|
77
|
+
MCP tools can be allowlisted at two levels:
|
|
78
|
+
|
|
79
|
+
1. **Server level**: The stored server's `tools` map limits tools for every agent that uses the client.
|
|
80
|
+
2. **Agent level**: The agent's MCP client reference limits the remaining tools for that agent.
|
|
81
|
+
|
|
82
|
+
Agent-level tool names can use namespaced or bare names. An explicit empty `tools` map selects all tools. With the current resolver, omitting `tools` from an agent-level MCP reference selects none.
|
|
83
|
+
|
|
84
|
+
### Namespacing
|
|
85
|
+
|
|
86
|
+
MCP tools use `serverName_toolName` IDs to avoid conflicts. A `search` tool from the `docs` server becomes `docs_search`.
|
|
87
|
+
|
|
88
|
+
## Resolution order
|
|
89
|
+
|
|
90
|
+
Editor merges tool records in the following order. Later records replace earlier records with the same ID.
|
|
91
|
+
|
|
92
|
+
1. Code-defined tools
|
|
93
|
+
2. Registered stored tools
|
|
94
|
+
3. MCP tools
|
|
95
|
+
4. Legacy integration tools
|
|
96
|
+
5. V1 tool-provider tools
|
|
97
|
+
|
|
98
|
+
Standalone stored agents use the same order without code-defined tools. Static code-agent overrides stop after legacy integration tools.
|
|
99
|
+
|
|
100
|
+
Use unique tool IDs across sources when possible. A collision replaces the complete earlier tool rather than merging its fields.
|