@mastra/mcp-docs-server 1.1.8-alpha.0 → 1.1.9-alpha.0
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-memory.md +2 -2
- package/.docs/docs/agents/guardrails.md +3 -3
- package/.docs/docs/agents/network-approval.md +4 -1
- package/.docs/docs/agents/networks.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +35 -17
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/using-tools.md +2 -2
- package/.docs/docs/build-with-ai/mcp-docs-server.md +4 -4
- package/.docs/docs/build-with-ai/skills.md +1 -1
- package/.docs/docs/community/discord.md +1 -1
- package/.docs/docs/community/licensing.md +1 -1
- package/.docs/docs/deployment/mastra-server.md +1 -1
- package/.docs/docs/deployment/studio.md +2 -2
- package/.docs/docs/deployment/web-framework.md +1 -1
- package/.docs/docs/evals/overview.md +1 -1
- package/.docs/docs/getting-started/build-with-ai.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +1 -1
- package/.docs/docs/index.md +62 -16
- package/.docs/docs/mastra-cloud/deployment.md +1 -1
- package/.docs/docs/mastra-cloud/studio.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +1 -1
- package/.docs/docs/memory/memory-processors.md +1 -1
- package/.docs/docs/memory/message-history.md +2 -2
- package/.docs/docs/memory/observational-memory.md +6 -2
- package/.docs/docs/memory/semantic-recall.md +2 -2
- package/.docs/docs/memory/storage.md +1 -1
- package/.docs/docs/memory/working-memory.md +6 -6
- package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
- package/.docs/docs/observability/tracing/exporters/default.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +4 -4
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +2 -2
- package/.docs/docs/rag/chunking-and-embedding.md +1 -1
- package/.docs/docs/rag/vector-databases.md +2 -2
- package/.docs/docs/server/auth/auth0.md +1 -1
- package/.docs/docs/server/auth/firebase.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +1 -1
- package/.docs/docs/server/auth.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/server-adapters.md +2 -2
- package/.docs/docs/streaming/events.md +1 -1
- package/.docs/docs/streaming/overview.md +1 -1
- package/.docs/docs/streaming/tool-streaming.md +44 -30
- package/.docs/docs/streaming/workflow-streaming.md +1 -1
- package/.docs/docs/workflows/control-flow.md +44 -2
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/docs/workflows/overview.md +3 -3
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/time-travel.md +2 -2
- package/.docs/docs/workspace/filesystem.md +2 -2
- package/.docs/docs/workspace/overview.md +52 -7
- package/.docs/docs/workspace/sandbox.md +72 -13
- package/.docs/docs/workspace/skills.md +2 -2
- package/.docs/guides/build-your-ui/copilotkit.md +1 -1
- package/.docs/guides/deployment/inngest.md +4 -4
- package/.docs/guides/guide/ai-recruiter.md +1 -1
- package/.docs/guides/guide/github-actions-pr-description.md +2 -2
- package/.docs/guides/guide/notes-mcp-server.md +1 -1
- package/.docs/guides/guide/stock-agent.md +2 -2
- package/.docs/guides/migrations/agentnetwork.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +5 -5
- package/.docs/guides/migrations/vnext-to-standard-apis.md +2 -2
- package/.docs/models/gateways/netlify.md +1 -2
- package/.docs/models/gateways/openrouter.md +8 -1
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/abacus.md +21 -11
- package/.docs/models/providers/aihubmix.md +7 -2
- package/.docs/models/providers/alibaba-cn.md +80 -71
- package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
- package/.docs/models/providers/alibaba-coding-plan.md +78 -0
- package/.docs/models/providers/chutes.md +1 -1
- package/.docs/models/providers/clarifai.md +81 -0
- package/.docs/models/providers/cloudferro-sherlock.md +5 -4
- package/.docs/models/providers/cloudflare-workers-ai.md +3 -2
- package/.docs/models/providers/cortecs.md +7 -5
- package/.docs/models/providers/deepinfra.md +7 -2
- package/.docs/models/providers/deepseek.md +1 -1
- package/.docs/models/providers/drun.md +73 -0
- package/.docs/models/providers/firmware.md +28 -20
- package/.docs/models/providers/google.md +3 -1
- package/.docs/models/providers/inception.md +4 -2
- package/.docs/models/providers/kilo.md +3 -1
- package/.docs/models/providers/nano-gpt.md +519 -40
- package/.docs/models/providers/nebius.md +34 -34
- package/.docs/models/providers/nvidia.md +4 -2
- package/.docs/models/providers/ollama-cloud.md +1 -2
- package/.docs/models/providers/openai.md +3 -1
- package/.docs/models/providers/opencode.md +36 -33
- package/.docs/models/providers/poe.md +8 -2
- package/.docs/models/providers/qiniu-ai.md +20 -5
- package/.docs/models/providers/requesty.md +17 -1
- package/.docs/models/providers/siliconflow-cn.md +7 -1
- package/.docs/models/providers/togetherai.md +1 -3
- package/.docs/models/providers/xai.md +28 -25
- package/.docs/models/providers/xiaomi.md +1 -1
- package/.docs/models/providers/zenmux.md +3 -1
- package/.docs/models/providers.md +4 -0
- package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/network.md +3 -1
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/auth/auth0.md +3 -3
- package/.docs/reference/auth/firebase.md +1 -1
- package/.docs/reference/auth/workos.md +2 -2
- package/.docs/reference/cli/mastra.md +4 -4
- package/.docs/reference/client-js/mastra-client.md +1 -1
- package/.docs/reference/configuration.md +62 -6
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getLogger.md +1 -1
- package/.docs/reference/core/getScorer.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +1 -1
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listMCPServers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +1 -1
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/core/setLogger.md +1 -1
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/dataset.md +1 -1
- package/.docs/reference/datasets/datasets-manager.md +1 -1
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/vercel.md +1 -1
- package/.docs/reference/evals/answer-relevancy.md +1 -1
- package/.docs/reference/evals/completeness.md +1 -1
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-relevance.md +1 -1
- package/.docs/reference/evals/hallucination.md +3 -9
- package/.docs/reference/evals/keyword-coverage.md +1 -1
- package/.docs/reference/evals/mastra-scorer.md +1 -1
- package/.docs/reference/evals/noise-sensitivity.md +2 -2
- package/.docs/reference/evals/textual-difference.md +1 -1
- package/.docs/reference/evals/tone-consistency.md +1 -1
- package/.docs/reference/evals/tool-call-accuracy.md +1 -1
- package/.docs/reference/harness/harness-class.md +4 -2
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/cloneThread.md +1 -1
- package/.docs/reference/memory/observational-memory.md +7 -5
- package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
- package/.docs/reference/observability/tracing/spans.md +2 -0
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +6 -2
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- package/.docs/reference/rag/metadata-filters.md +10 -10
- package/.docs/reference/server/create-route.md +2 -0
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/server/register-api-route.md +2 -2
- package/.docs/reference/storage/cloudflare-d1.md +3 -3
- package/.docs/reference/storage/cloudflare.md +1 -1
- package/.docs/reference/storage/convex.md +1 -1
- package/.docs/reference/storage/dynamodb.md +2 -2
- package/.docs/reference/storage/lance.md +2 -2
- package/.docs/reference/storage/mongodb.md +1 -1
- package/.docs/reference/storage/mssql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/workflows/observeStream.md +1 -1
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/mcp-server.md +4 -4
- package/.docs/reference/vectors/chroma.md +2 -2
- package/.docs/reference/vectors/couchbase.md +6 -6
- package/.docs/reference/vectors/pg.md +2 -0
- package/.docs/reference/vectors/s3vectors.md +5 -5
- package/.docs/reference/voice/azure.md +4 -2
- package/.docs/reference/voice/cloudflare.md +4 -2
- package/.docs/reference/voice/elevenlabs.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +2 -2
- package/.docs/reference/voice/google.md +3 -3
- package/.docs/reference/voice/mastra-voice.md +1 -1
- package/.docs/reference/voice/murf.md +2 -2
- package/.docs/reference/voice/openai-realtime.md +3 -1
- package/.docs/reference/voice/openai.md +7 -3
- package/.docs/reference/voice/playai.md +4 -2
- package/.docs/reference/voice/sarvam.md +3 -1
- package/.docs/reference/voice/speechify.md +6 -4
- package/.docs/reference/voice/voice.addInstructions.md +2 -2
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.close.md +2 -2
- package/.docs/reference/voice/voice.connect.md +4 -2
- package/.docs/reference/voice/voice.events.md +2 -2
- package/.docs/reference/voice/voice.getSpeakers.md +1 -1
- package/.docs/reference/voice/voice.listen.md +11 -5
- package/.docs/reference/voice/voice.off.md +2 -2
- package/.docs/reference/voice/voice.on.md +2 -2
- package/.docs/reference/voice/voice.speak.md +14 -4
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/blaxel-sandbox.md +164 -0
- package/.docs/reference/workspace/daytona-sandbox.md +48 -139
- package/.docs/reference/workspace/e2b-sandbox.md +39 -75
- package/.docs/reference/workspace/filesystem.md +24 -10
- package/.docs/reference/workspace/gcs-filesystem.md +20 -0
- package/.docs/reference/workspace/local-filesystem.md +23 -9
- package/.docs/reference/workspace/local-sandbox.md +23 -98
- package/.docs/reference/workspace/process-manager.md +296 -0
- package/.docs/reference/workspace/s3-filesystem.md +20 -0
- package/.docs/reference/workspace/sandbox.md +9 -1
- package/.docs/reference/workspace/workspace-class.md +93 -25
- package/CHANGELOG.md +16 -0
- package/dist/tools/course.d.ts +7 -27
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts +6 -18
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +12 -112
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/dist/tools/migration.d.ts +6 -26
- package/dist/tools/migration.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `MastraScorer` class is the base class for all scorers in Mastra. It provides a standard `.run()` method for evaluating input/output pairs and supports multi-step scoring workflows with preprocess → analyze → generateScore → generateReason execution flow.
|
|
4
4
|
|
|
5
|
-
**Note:** Most users should use [`createScorer`](https://mastra.ai/reference/evals/create-scorer) to create scorer instances. Direct instantiation of `MastraScorer`
|
|
5
|
+
**Note:** Most users should use [`createScorer`](https://mastra.ai/reference/evals/create-scorer) to create scorer instances. Direct instantiation of `MastraScorer` isn't recommended.
|
|
6
6
|
|
|
7
7
|
## How to Get a MastraScorer Instance
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `createNoiseSensitivityScorerLLM()` function creates a **CI/testing scorer** that evaluates how robust an agent is when exposed to irrelevant, distracting, or misleading information. Unlike live scorers that evaluate single production runs, this scorer requires predetermined test data including both baseline responses and noisy variations.
|
|
4
4
|
|
|
5
|
-
**Important:** This
|
|
5
|
+
**Important:** This isn't a live scorer. It requires pre-computed baseline responses and can't be used for real-time agent evaluation. Use this scorer in your CI/CD pipeline or testing suites only.
|
|
6
6
|
|
|
7
7
|
Before using the noise sensitivity scorer, prepare your test data:
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ This scorer is designed exclusively for CI/testing environments and has specific
|
|
|
26
26
|
1. **Requires Baseline Data**: You must provide a pre-computed baseline response (the "correct" answer without noise)
|
|
27
27
|
2. **Needs Test Variations**: Requires both the original query and a noisy variation prepared in advance
|
|
28
28
|
3. **Comparative Analysis**: The scorer compares responses between baseline and noisy versions, which is only possible in controlled test conditions
|
|
29
|
-
4. **Not Suitable for Production**:
|
|
29
|
+
4. **Not Suitable for Production**: Can't evaluate single, real-time agent responses without predetermined test data
|
|
30
30
|
|
|
31
31
|
### Test Data Preparation
|
|
32
32
|
|
|
@@ -4,7 +4,7 @@ The `createTextualDifferenceScorer()` function uses sequence matching to measure
|
|
|
4
4
|
|
|
5
5
|
## Parameters
|
|
6
6
|
|
|
7
|
-
The `createTextualDifferenceScorer()` function
|
|
7
|
+
The `createTextualDifferenceScorer()` function doesn't take any options.
|
|
8
8
|
|
|
9
9
|
This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ The `createToneScorer()` function evaluates the text's emotional tone and sentim
|
|
|
4
4
|
|
|
5
5
|
## Parameters
|
|
6
6
|
|
|
7
|
-
The `createToneScorer()` function
|
|
7
|
+
The `createToneScorer()` function doesn't take any options.
|
|
8
8
|
|
|
9
9
|
This function returns an instance of the MastraScorer class. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
|
|
10
10
|
|
|
@@ -43,7 +43,7 @@ The code-based scorer operates in two distinct modes:
|
|
|
43
43
|
|
|
44
44
|
#### Single Tool Mode
|
|
45
45
|
|
|
46
|
-
When `expectedToolOrder`
|
|
46
|
+
When `expectedToolOrder` isn't provided, the scorer evaluates single tool selection:
|
|
47
47
|
|
|
48
48
|
- **Standard Mode (strictMode: false)**: Returns `1` if the expected tool is called, regardless of other tools
|
|
49
49
|
- **Strict Mode (strictMode: true)**: Returns `1` only if exactly one tool is called and it matches the expected tool
|
|
@@ -82,6 +82,8 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
82
82
|
|
|
83
83
|
**subagents.allowedHarnessTools** (`string[]`): Tool IDs from the harness's shared \`tools\` config. Merged with \`tools\` above to let subagents use a subset of harness tools.
|
|
84
84
|
|
|
85
|
+
**subagents.allowedWorkspaceTools** (`string[]`): Workspace tool names the subagent is allowed to use. Uses the exposed names (after any renames via workspace tool config). When set, workspace tools not in this list are hidden from the model. Non-workspace tools are never affected. When omitted, all workspace tools are visible.
|
|
86
|
+
|
|
85
87
|
**subagents.defaultModelId** (`string`): Default model ID for this subagent type.
|
|
86
88
|
|
|
87
89
|
**subagents.maxSteps** (`number`): Optional maximum number of steps for the spawned subagent. Defaults to \`50\` when omitted.
|
|
@@ -94,7 +96,7 @@ await harness.sendMessage({ content: 'Hello!' })
|
|
|
94
96
|
|
|
95
97
|
**heartbeatHandlers** (`HeartbeatHandler[]`): Periodic background tasks started during \`init()\`. Use for gateway sync, cache refresh, and similar tasks.
|
|
96
98
|
|
|
97
|
-
**idGenerator** (`() => string`): Custom ID generator for threads
|
|
99
|
+
**idGenerator** (`() => string`): Custom ID generator for Harness-managed IDs such as threads and mode-run identifiers. (Default: `timestamp + random string`)
|
|
98
100
|
|
|
99
101
|
**modelAuthChecker** (`ModelAuthChecker`): Custom auth checker for model providers. Return \`true\`/\`false\` to override the default environment variable check, or \`undefined\` to fall back to defaults.
|
|
100
102
|
|
|
@@ -567,7 +569,7 @@ if (harness.isWorkspaceReady()) {
|
|
|
567
569
|
|
|
568
570
|
#### `destroyWorkspace()`
|
|
569
571
|
|
|
570
|
-
Destroy the workspace and release resources. Only applies to static workspaces — dynamic workspaces
|
|
572
|
+
Destroy the workspace and release resources. Only applies to static workspaces — dynamic workspaces aren't destroyed.
|
|
571
573
|
|
|
572
574
|
```typescript
|
|
573
575
|
await harness.destroyWorkspace()
|
package/.docs/reference/index.md
CHANGED
|
@@ -266,12 +266,14 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
266
266
|
- [.start()](https://mastra.ai/reference/workflows/run-methods/start)
|
|
267
267
|
- [.startAsync()](https://mastra.ai/reference/workflows/run-methods/startAsync)
|
|
268
268
|
- [.timeTravel()](https://mastra.ai/reference/workflows/run-methods/timeTravel)
|
|
269
|
+
- [BlaxelSandbox](https://mastra.ai/reference/workspace/blaxel-sandbox)
|
|
269
270
|
- [DaytonaSandbox](https://mastra.ai/reference/workspace/daytona-sandbox)
|
|
270
271
|
- [E2BSandbox](https://mastra.ai/reference/workspace/e2b-sandbox)
|
|
271
272
|
- [GCSFilesystem](https://mastra.ai/reference/workspace/gcs-filesystem)
|
|
272
273
|
- [LocalFilesystem](https://mastra.ai/reference/workspace/local-filesystem)
|
|
273
274
|
- [LocalSandbox](https://mastra.ai/reference/workspace/local-sandbox)
|
|
274
275
|
- [S3Filesystem](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
276
|
+
- [SandboxProcessManager](https://mastra.ai/reference/workspace/process-manager)
|
|
275
277
|
- [Workspace Class](https://mastra.ai/reference/workspace/workspace-class)
|
|
276
278
|
- [WorkspaceFilesystem](https://mastra.ai/reference/workspace/filesystem)
|
|
277
279
|
- [WorkspaceSandbox](https://mastra.ai/reference/workspace/sandbox)
|
|
@@ -135,4 +135,4 @@ When [Observational Memory](https://mastra.ai/docs/memory/observational-memory)
|
|
|
135
135
|
- **Resource-scoped OM (same `resourceId`)**: The OM record is shared between the source and cloned threads since they belong to the same resource. No duplication occurs.
|
|
136
136
|
- **Resource-scoped OM (different `resourceId`)**: The OM record is cloned to the new resource. Message IDs are remapped and any thread-identifying tags within observations are updated to reference the cloned thread.
|
|
137
137
|
|
|
138
|
-
Only the current (most recent) OM generation is cloned — older history generations
|
|
138
|
+
Only the current (most recent) OM generation is cloned — older history generations aren't copied. Transient processing state (observation/reflection in-progress flags) is reset on the cloned record.
|
|
@@ -26,6 +26,8 @@ export const agent = new Agent({
|
|
|
26
26
|
|
|
27
27
|
The `observationalMemory` option accepts `true`, a configuration object, or `false`. Setting `true` enables OM with `google/gemini-2.5-flash` as the default model. When passing a config object, a `model` must be explicitly set — either at the top level, or on `observation.model` and/or `reflection.model`.
|
|
28
28
|
|
|
29
|
+
Observer input is multimodal-aware. OM keeps text placeholders like `[Image #1: screenshot.png]` in the transcript it builds for the Observer, and also sends the underlying image parts when possible. This applies to both single-thread observation and batched multi-thread observation. Non-image files appear as placeholders only.
|
|
30
|
+
|
|
29
31
|
**enabled** (`boolean`): Enable or disable Observational Memory. When omitted from a config object, defaults to \`true\`. Only \`enabled: false\` explicitly disables it. (Default: `true`)
|
|
30
32
|
|
|
31
33
|
**model** (`string | LanguageModel | DynamicModel | ModelWithRetries[]`): Model for both the Observer and Reflector agents. Sets the model for both at once. Cannot be used together with \`observation.model\` or \`reflection.model\` — an error will be thrown if both are set. When using \`observationalMemory: true\`, defaults to \`google/gemini-2.5-flash\`. When passing a config object, this or \`observation.model\`/\`reflection.model\` must be set. Use \`"default"\` to explicitly use the default model (\`google/gemini-2.5-flash\`). (Default: `'google/gemini-2.5-flash' (when using observationalMemory: true)`)
|
|
@@ -40,7 +42,7 @@ The `observationalMemory` option accepts `true`, a configuration object, or `fal
|
|
|
40
42
|
|
|
41
43
|
**observation.instruction** (`string`): Custom instruction appended to the Observer's system prompt. Use this to customize what the Observer focuses on, such as domain-specific preferences or priorities.
|
|
42
44
|
|
|
43
|
-
**observation.messageTokens** (`number`): Token count of unobserved messages that triggers observation. When unobserved message tokens exceed this threshold, the Observer agent is called.
|
|
45
|
+
**observation.messageTokens** (`number`): Token count of unobserved messages that triggers observation. When unobserved message tokens exceed this threshold, the Observer agent is called. Image parts are included with model-aware estimates when possible, with deterministic fallbacks when image metadata is incomplete. Image-like \`file\` parts are counted the same way when uploads are normalized as files.
|
|
44
46
|
|
|
45
47
|
**observation.maxTokensPerBatch** (`number`): Maximum tokens per batch when observing multiple threads in resource scope. Threads are chunked into batches of this size and processed in parallel. Lower values mean more parallelism but more API calls.
|
|
46
48
|
|
|
@@ -80,9 +82,9 @@ OM persists token payload estimates so repeated counting can reuse prior tiktoke
|
|
|
80
82
|
|
|
81
83
|
- Part-level cache: `part.providerMetadata.mastra`.
|
|
82
84
|
- String-content fallback cache: message-level metadata when no parts exist.
|
|
83
|
-
- Cache entries are ignored and recomputed if cache version/tokenizer source
|
|
84
|
-
- Per-message and per-conversation overhead are always recomputed at runtime and
|
|
85
|
-
- `data-*` and `reasoning` parts are skipped and
|
|
85
|
+
- Cache entries are ignored and recomputed if cache version/tokenizer source doesn't match.
|
|
86
|
+
- Per-message and per-conversation overhead are always recomputed at runtime and aren't cached.
|
|
87
|
+
- `data-*` and `reasoning` parts are skipped and don't receive cache entries.
|
|
86
88
|
|
|
87
89
|
## Examples
|
|
88
90
|
|
|
@@ -283,7 +285,7 @@ observationalMemory: {
|
|
|
283
285
|
|
|
284
286
|
Setting `bufferTokens: false` disables both observation and reflection async buffering. Observations and reflections will run synchronously when their thresholds are reached.
|
|
285
287
|
|
|
286
|
-
> **Note:** Async buffering
|
|
288
|
+
> **Note:** Async buffering isn't supported with `scope: 'resource'` and is automatically disabled in resource scope.
|
|
287
289
|
|
|
288
290
|
## Streaming data parts
|
|
289
291
|
|
|
@@ -38,7 +38,7 @@ Executes a synchronous function within the OTEL context of a Mastra span.
|
|
|
38
38
|
async shutdown(): Promise<void>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Shuts down the bridge and cleans up resources. Ends any spans that
|
|
41
|
+
Shuts down the bridge and cleans up resources. Ends any spans that weren't properly closed.
|
|
42
42
|
|
|
43
43
|
## Usage Examples
|
|
44
44
|
|
|
@@ -105,7 +105,7 @@ When no custom fields are provided:
|
|
|
105
105
|
- **Exact matching**: After normalization, fields must match exactly
|
|
106
106
|
|
|
107
107
|
- `token` matches `token`, `Token`, `TOKEN`
|
|
108
|
-
- `token`
|
|
108
|
+
- `token` doesn't match `promptTokens` or `tokenCount`
|
|
109
109
|
|
|
110
110
|
### Redaction Styles
|
|
111
111
|
|
|
@@ -66,7 +66,7 @@ export const agent = new Agent({
|
|
|
66
66
|
|
|
67
67
|
1. Retrieves `threadId` from the request context
|
|
68
68
|
2. Fetches historical messages from storage (ordered by creation date, descending)
|
|
69
|
-
3. Filters out system messages (they
|
|
69
|
+
3. Filters out system messages (they shouldn't be stored in the database)
|
|
70
70
|
4. Merges historical messages with incoming messages, avoiding duplicates by ID
|
|
71
71
|
5. Adds historical messages with `source: 'memory'` tag
|
|
72
72
|
|
|
@@ -88,7 +88,7 @@ interface Processor<TId extends string = string> {
|
|
|
88
88
|
|
|
89
89
|
### processInput
|
|
90
90
|
|
|
91
|
-
Processes input messages before they
|
|
91
|
+
Processes input messages before they're sent to the LLM. Runs once at the start of agent execution.
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
94
|
processInput?(args: ProcessInputArgs): Promise<ProcessInputResult> | ProcessInputResult;
|
|
@@ -124,7 +124,7 @@ The method can return one of three types:
|
|
|
124
124
|
|
|
125
125
|
### processInputStep
|
|
126
126
|
|
|
127
|
-
Processes input messages at each step of the agentic loop, before they
|
|
127
|
+
Processes input messages at each step of the agentic loop, before they're sent to the LLM. Unlike `processInput` which runs once at the start, this runs at every step including tool call continuations.
|
|
128
128
|
|
|
129
129
|
```typescript
|
|
130
130
|
processInputStep?(args: ProcessInputStepArgs): ProcessorMessageResult;
|
|
@@ -269,6 +269,10 @@ processOutputResult?(args: ProcessOutputResultArgs): ProcessorMessageResult;
|
|
|
269
269
|
|
|
270
270
|
**messageList** (`MessageList`): MessageList instance for managing messages.
|
|
271
271
|
|
|
272
|
+
**state** (`Record<string, unknown>`): Per-processor state that persists across all method calls within this request. Shared with processOutputStream and other methods.
|
|
273
|
+
|
|
274
|
+
**result** (`OutputResult`): Resolved generation result containing \`text\` (accumulated text), \`usage\` (token usage with inputTokens, outputTokens, totalTokens), \`finishReason\` (why generation ended), and \`steps\` (all LLM step results, each with toolCalls, toolResults, reasoning, sources, files, etc.).
|
|
275
|
+
|
|
272
276
|
**abort** (`(reason?: string) => never`): Function to abort processing.
|
|
273
277
|
|
|
274
278
|
**tracingContext** (`TracingContext`): Tracing context for observability.
|
|
@@ -47,8 +47,8 @@ const processor = new TokenLimiterProcessor({
|
|
|
47
47
|
|
|
48
48
|
When used as an input processor, `TokenLimiterProcessor` throws a `TripWire` error in the following cases:
|
|
49
49
|
|
|
50
|
-
- **Empty messages**: If there are no messages to process, a TripWire is thrown because you
|
|
51
|
-
- **System messages exceed limit**: If system messages alone exceed the token limit, a TripWire is thrown because you
|
|
50
|
+
- **Empty messages**: If there are no messages to process, a TripWire is thrown because you can't send an LLM request with no messages.
|
|
51
|
+
- **System messages exceed limit**: If system messages alone exceed the token limit, a TripWire is thrown because you can't send an LLM request with only system messages and no user/assistant messages.
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
import { TripWire } from '@mastra/core/agent'
|
|
@@ -48,7 +48,7 @@ const results = await store.query({
|
|
|
48
48
|
|
|
49
49
|
## Common Rules and Restrictions
|
|
50
50
|
|
|
51
|
-
1. Field names
|
|
51
|
+
1. Field names can't:
|
|
52
52
|
|
|
53
53
|
- Contain dots (.) unless referring to nested fields
|
|
54
54
|
- Start with $ or contain null characters
|
|
@@ -63,11 +63,11 @@ const results = await store.query({
|
|
|
63
63
|
3. Logical operators:
|
|
64
64
|
|
|
65
65
|
- Must contain valid conditions
|
|
66
|
-
-
|
|
66
|
+
- Can't be empty
|
|
67
67
|
- Must be properly nested
|
|
68
68
|
- Can only be used at top level or nested within other logical operators
|
|
69
|
-
-
|
|
70
|
-
-
|
|
69
|
+
- Can't be used at field level or nested inside a field
|
|
70
|
+
- Can't be used inside an operator
|
|
71
71
|
- Valid: `{ "$and": [{ "field": { "$gt": 100 } }] }`
|
|
72
72
|
- Valid: `{ "$or": [{ "$and": [{ "field": { "$gt": 100 } }] }] }`
|
|
73
73
|
- Invalid: `{ "field": { "$and": [{ "$gt": 100 }] } }`
|
|
@@ -76,7 +76,7 @@ const results = await store.query({
|
|
|
76
76
|
4. $not operator:
|
|
77
77
|
|
|
78
78
|
- Must be an object
|
|
79
|
-
-
|
|
79
|
+
- Can't be empty
|
|
80
80
|
- Can be used at field level or top level
|
|
81
81
|
- Valid: `{ "$not": { "field": "value" } }`
|
|
82
82
|
- Valid: `{ "field": { "$not": { "$eq": "value" } } }`
|
|
@@ -98,7 +98,7 @@ const results = await store.query({
|
|
|
98
98
|
### ChromaDB
|
|
99
99
|
|
|
100
100
|
- Where filters only return results where the filtered field exists in metadata
|
|
101
|
-
- Empty metadata fields
|
|
101
|
+
- Empty metadata fields aren't included in filter results
|
|
102
102
|
- Metadata fields must be present for negative matches (e.g., $ne won't match documents missing the field)
|
|
103
103
|
|
|
104
104
|
### Cloudflare Vectorize
|
|
@@ -109,7 +109,7 @@ const results = await store.query({
|
|
|
109
109
|
- String values are indexed up to first 64 bytes (truncated on UTF-8 boundaries)
|
|
110
110
|
- Number values use float64 precision
|
|
111
111
|
- Filter JSON must be under 2048 bytes
|
|
112
|
-
- Field names
|
|
112
|
+
- Field names can't contain dots (.) or start with $
|
|
113
113
|
- Field names limited to 512 characters
|
|
114
114
|
- Vectors must be re-upserted after creating new metadata indexes to be included in filtered results
|
|
115
115
|
- Range queries may have reduced accuracy with very large datasets (\~10M+ vectors)
|
|
@@ -186,12 +186,12 @@ const results = await store.query({
|
|
|
186
186
|
|
|
187
187
|
### Couchbase
|
|
188
188
|
|
|
189
|
-
- Currently
|
|
189
|
+
- Currently doesn't have support for metadata filters. Filtering must be done client-side after retrieving results or by using the Couchbase SDK's Search capabilities directly for more complex queries.
|
|
190
190
|
|
|
191
191
|
### Amazon S3 Vectors
|
|
192
192
|
|
|
193
|
-
- Equality values must be primitives (string/number/boolean). `null`/`undefined`, arrays, objects, and Date
|
|
194
|
-
- `$in`/`$nin` require **non-empty arrays of primitives**; Date elements are allowed and normalized to epoch ms. **Array equality**
|
|
193
|
+
- Equality values must be primitives (string/number/boolean). `null`/`undefined`, arrays, objects, and Date aren't allowed for equality. Range operators accept numbers or Date (Dates are normalized to epoch ms).
|
|
194
|
+
- `$in`/`$nin` require **non-empty arrays of primitives**; Date elements are allowed and normalized to epoch ms. **Array equality** isn't supported.
|
|
195
195
|
- Implicit AND is canonicalized (`{a:1,b:2}` → `{$and:[{a:1},{b:2}]}`). Logical operators must contain field conditions, use non-empty arrays, and appear only at the root or within other logical operators (not inside field values).
|
|
196
196
|
- Keys listed in `nonFilterableMetadataKeys` at index creation are stored but not filterable; this setting is immutable.
|
|
197
197
|
- $exists requires a boolean value.
|
|
@@ -46,6 +46,8 @@ function createRoute<TPath, TQuery, TBody, TResponse, TResponseType>(
|
|
|
46
46
|
|
|
47
47
|
**deprecated** (`boolean`): Mark route as deprecated
|
|
48
48
|
|
|
49
|
+
**onValidationError** (`(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`): Custom validation error handler for this route. Overrides the server-level \`onValidationError\` hook. Return \`{ status, body }\` to customize the response, or \`undefined\` to use the default.
|
|
50
|
+
|
|
49
51
|
## Handler parameters
|
|
50
52
|
|
|
51
53
|
The handler receives validated parameters plus runtime context:
|
|
@@ -97,7 +97,7 @@ const server = new MastraServer({ app, mastra })
|
|
|
97
97
|
await server.init()
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
The [`server.onError`](https://mastra.ai/reference/configuration) hook is also supported. When configured, it
|
|
100
|
+
The [`server.onError`](https://mastra.ai/reference/configuration) hook is also supported. When configured, it's called before the error propagates to middleware, and its response is used directly:
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
const mastra = new Mastra({
|
|
@@ -18,7 +18,7 @@ The URL path for the route. Supports path parameters using `:param` syntax.
|
|
|
18
18
|
registerApiRoute("/items/:itemId", { ... })
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
**Note:** Paths
|
|
21
|
+
**Note:** Paths can't start with `/api/` as this prefix is reserved for Mastra server routes.
|
|
22
22
|
|
|
23
23
|
### options
|
|
24
24
|
|
|
@@ -34,7 +34,7 @@ registerApiRoute("/items/:itemId", { ... })
|
|
|
34
34
|
|
|
35
35
|
## OpenAPI Options
|
|
36
36
|
|
|
37
|
-
The `openapi` property accepts standard OpenAPI 3.1 operation fields from [hono-openapi](https://github.com/honojs/middleware/tree/main/packages/openapi). Routes without an `openapi` property
|
|
37
|
+
The `openapi` property accepts standard OpenAPI 3.1 operation fields from [hono-openapi](https://github.com/honojs/middleware/tree/main/packages/openapi). Routes without an `openapi` property aren't included in Swagger UI.
|
|
38
38
|
|
|
39
39
|
**summary** (`string`): Short summary of the operation
|
|
40
40
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Cloudflare D1 storage implementation provides a serverless SQL database solution using Cloudflare D1, supporting relational operations and transactional consistency.
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** Cloudflare D1 storage **
|
|
5
|
+
> **Observability Not Supported:** Cloudflare D1 storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to D1, and Mastra Studio's observability features won't work with D1 as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
> **Row Size Limit:** Cloudflare D1 enforces a **1 MiB maximum row size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
|
|
8
8
|
|
|
@@ -85,7 +85,7 @@ export default {
|
|
|
85
85
|
> - The **property name** (`D1Database`) must match the `binding` name in your `wrangler.toml`
|
|
86
86
|
> - The **type** (`: D1Database`) is from `@cloudflare/workers-types` for TypeScript type checking
|
|
87
87
|
>
|
|
88
|
-
> At runtime, Cloudflare Workers provides the actual D1 database instance via `env.D1Database`. You
|
|
88
|
+
> At runtime, Cloudflare Workers provides the actual D1 database instance via `env.D1Database`. You can't use `D1Database` directly outside of the worker's context.
|
|
89
89
|
|
|
90
90
|
### Using with REST API
|
|
91
91
|
|
|
@@ -207,7 +207,7 @@ export default {
|
|
|
207
207
|
}
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
> **Warning:** If `init()`
|
|
210
|
+
> **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
|
|
211
211
|
|
|
212
212
|
### Transactions & Consistency
|
|
213
213
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Cloudflare KV storage implementation provides a globally distributed, serverless key-value store solution using Cloudflare Workers KV.
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** Cloudflare KV storage **
|
|
5
|
+
> **Observability Not Supported:** Cloudflare KV storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to KV, and Mastra Studio's observability features won't work with Cloudflare KV as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Convex storage implementation provides a serverless storage solution using [Convex](https://convex.dev), a full-stack TypeScript development platform with real-time sync and automatic caching.
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** Convex storage **
|
|
5
|
+
> **Observability Not Supported:** Convex storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Convex, and Mastra Studio's observability features won't work with Convex as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
> **Record Size Limit:** Convex enforces a **1 MiB maximum record size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage like S3, Cloudflare R2, or [Convex file storage](https://docs.convex.dev/file-storage).
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The DynamoDB storage implementation provides a scalable and performant NoSQL database solution for Mastra, leveraging a single-table design pattern with [ElectroDB](https://electrodb.dev/).
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** DynamoDB storage **
|
|
5
|
+
> **Observability Not Supported:** DynamoDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to DynamoDB, and Mastra Studio's observability features won't work with DynamoDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
> **Item Size Limit:** DynamoDB enforces a **400 KB maximum item size**. This limit can be exceeded when storing messages with base64-encoded attachments such as images. See [Handling large attachments](https://mastra.ai/docs/memory/storage) for workarounds including uploading attachments to external storage.
|
|
8
8
|
|
|
@@ -211,7 +211,7 @@ aws dynamodb update-time-to-live \
|
|
|
211
211
|
1. Go to the DynamoDB console
|
|
212
212
|
2. Select your table
|
|
213
213
|
3. Go to "Additional settings" tab
|
|
214
|
-
4. Under "Time to Live (TTL)",
|
|
214
|
+
4. Under "Time to Live (TTL)", select "Manage TTL"
|
|
215
215
|
5. Enable TTL and specify the attribute name (default: `ttl`)
|
|
216
216
|
|
|
217
217
|
> **Note:** DynamoDB deletes expired items within 48 hours after expiration. Items remain queryable until actually deleted.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The LanceDB storage implementation provides a high-performance storage solution using the LanceDB database system, which excels at handling both traditional data storage and vector operations.
|
|
4
4
|
|
|
5
|
-
> **Observability Not Supported:** LanceDB storage **
|
|
5
|
+
> **Observability Not Supported:** LanceDB storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to LanceDB, and Mastra Studio's observability features won't work with LanceDB as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -101,7 +101,7 @@ const memoryStore = await storage.getStore('memory')
|
|
|
101
101
|
const thread = await memoryStore?.getThreadById({ threadId: '...' })
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
> **Warning:** If `init()`
|
|
104
|
+
> **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
|
|
105
105
|
|
|
106
106
|
### Deployment Options
|
|
107
107
|
|
|
@@ -136,7 +136,7 @@ const memoryStore = await storage.getStore('memory')
|
|
|
136
136
|
const thread = await memoryStore?.getThreadById({ threadId: '...' })
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
> **Warning:** If `init()`
|
|
139
|
+
> **Warning:** If `init()` isn't called, collections won't be created and storage operations will fail silently or throw errors.
|
|
140
140
|
|
|
141
141
|
## Vector Search Capabilities
|
|
142
142
|
|
|
@@ -138,7 +138,7 @@ const memoryStore = await storage.getStore('memory')
|
|
|
138
138
|
const thread = await memoryStore?.getThreadById({ threadId: '...' })
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
> **Warning:** If `init()`
|
|
141
|
+
> **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
|
|
142
142
|
|
|
143
143
|
### Direct Database and Pool Access
|
|
144
144
|
|
|
@@ -177,7 +177,7 @@ const memoryStore = await storage.getStore('memory')
|
|
|
177
177
|
const thread = await memoryStore?.getThreadById({ threadId: '...' })
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
> **Warning:** If `init()`
|
|
180
|
+
> **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
|
|
181
181
|
|
|
182
182
|
### Using an Existing Pool
|
|
183
183
|
|
|
@@ -201,7 +201,7 @@ const storage = new PostgresStore({
|
|
|
201
201
|
|
|
202
202
|
**Pool lifecycle behavior:**
|
|
203
203
|
|
|
204
|
-
- When you **provide a pool**: Mastra uses your pool but
|
|
204
|
+
- When you **provide a pool**: Mastra uses your pool but **doesn't** close it when `store.close()` is called. You manage the pool lifecycle.
|
|
205
205
|
- When Mastra **creates a pool**: Mastra owns the pool and will close it when `store.close()` is called.
|
|
206
206
|
|
|
207
207
|
### Direct Database and Pool Access
|
|
@@ -4,7 +4,7 @@ The Upstash storage implementation provides a serverless-friendly storage soluti
|
|
|
4
4
|
|
|
5
5
|
> **Pricing:** When using Mastra with Upstash, the pay-as-you-go model can result in unexpectedly high costs due to the high volume of Redis commands generated during agent conversations. We strongly recommend using a **fixed pricing plan** for predictable costs. See [Upstash pricing](https://upstash.com/pricing/redis) for details and [GitHub issue #5850](https://github.com/mastra-ai/mastra/issues/5850) for context.
|
|
6
6
|
|
|
7
|
-
> **Observability Not Supported:** Upstash storage **
|
|
7
|
+
> **Observability Not Supported:** Upstash storage **doesn't support the observability domain**. Traces from the `DefaultExporter` can't be persisted to Upstash, and Mastra Studio's observability features won't work with Upstash as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Run.observeStream()
|
|
2
2
|
|
|
3
|
-
The `.observeStream()` method opens a new `ReadableStream` to a workflow run that
|
|
3
|
+
The `.observeStream()` method opens a new `ReadableStream` to a workflow run that's currently running, allowing you to observe the stream of events if the original stream is no longer available.
|
|
4
4
|
|
|
5
5
|
## Usage example
|
|
6
6
|
|
|
@@ -130,7 +130,7 @@ Templates must be:
|
|
|
130
130
|
- **Single projects** - Not monorepos with multiple applications
|
|
131
131
|
- **Framework-free** - No Next.js, Express, or other web framework boilerplate
|
|
132
132
|
- **Mastra-focused** - Demonstrate Mastra functionality without additional layers
|
|
133
|
-
- **Mergeable** - Structure code for
|
|
133
|
+
- **Mergeable** - Structure code for seamless integration into existing projects
|
|
134
134
|
- **Node.js compatible** - Support Node.js v22.13.0 and later
|
|
135
135
|
- **ESM modules** - Use ES modules (`"type": "module"` in package.json)
|
|
136
136
|
|
|
@@ -251,7 +251,7 @@ Additionally:
|
|
|
251
251
|
|
|
252
252
|
### Error Handling
|
|
253
253
|
|
|
254
|
-
Hook errors are caught and logged automatically, but
|
|
254
|
+
Hook errors are caught and logged automatically, but don't prevent tool execution from continuing. If a hook throws an error, it will be logged to the console but won't fail the tool call.
|
|
255
255
|
|
|
256
256
|
## MCP Tool Annotations
|
|
257
257
|
|
|
@@ -96,9 +96,9 @@ A powerful feature of `MCPServer` is its ability to automatically expose your Ma
|
|
|
96
96
|
- **Execution**: When this tool is called, it invokes the `generate()` method of the corresponding agent, passing the provided `query`.
|
|
97
97
|
- **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
|
|
98
98
|
|
|
99
|
-
- **Name Collisions**: If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., you have a tool named `ask_myAgentKey` and also an agent with the key `myAgentKey`), the _explicitly defined tool will take precedence_. The agent
|
|
99
|
+
- **Name Collisions**: If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., you have a tool named `ask_myAgentKey` and also an agent with the key `myAgentKey`), the _explicitly defined tool will take precedence_. The agent won't be converted into a tool in this conflicting case, and a warning will be logged.
|
|
100
100
|
|
|
101
|
-
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries,
|
|
101
|
+
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
|
|
102
102
|
|
|
103
103
|
### Agent-to-Tool Conversion
|
|
104
104
|
|
|
@@ -391,7 +391,7 @@ serve(async req => {
|
|
|
391
391
|
>
|
|
392
392
|
> The serverless mode disables session management and creates fresh server instances per request, which is necessary for stateless environments where memory doesn't persist between invocations.
|
|
393
393
|
>
|
|
394
|
-
> **Note:** The following MCP features require session state or persistent connections and
|
|
394
|
+
> **Note:** The following MCP features require session state or persistent connections and **won't work** in serverless mode:
|
|
395
395
|
>
|
|
396
396
|
> - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
|
|
397
397
|
> - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
|
|
@@ -778,7 +778,7 @@ The example at the beginning of this page also demonstrates how to instantiate `
|
|
|
778
778
|
|
|
779
779
|
## Elicitation
|
|
780
780
|
|
|
781
|
-
### What
|
|
781
|
+
### What's Elicitation?
|
|
782
782
|
|
|
783
783
|
Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. This enables interactive workflows where servers can collect additional data dynamically.
|
|
784
784
|
|
|
@@ -30,7 +30,7 @@ The ChromaVector class provides vector search using [Chroma](https://docs.trychr
|
|
|
30
30
|
|
|
31
31
|
## Running a Chroma Server
|
|
32
32
|
|
|
33
|
-
If you are a Chroma Cloud user,
|
|
33
|
+
If you are a Chroma Cloud user, provide the `ChromaVector` constructor your API key, tenant, and database name.
|
|
34
34
|
|
|
35
35
|
When you install the `@mastra/chroma` package, you get access to the [Chroma CLI](https://docs.trychroma.com/docs/cli/db), which can set these as environment variables for you: `chroma db connect [DB-NAME] --env-file`.
|
|
36
36
|
|
|
@@ -54,7 +54,7 @@ Otherwise, you have several options for setting up your single-node Chroma serve
|
|
|
54
54
|
|
|
55
55
|
Note: Forking is only supported on Chroma Cloud, or if you deploy your own OSS **distributed** Chroma.
|
|
56
56
|
|
|
57
|
-
`forkIndex` lets you fork an existing Chroma index instantly. Operations on the forked index
|
|
57
|
+
`forkIndex` lets you fork an existing Chroma index instantly. Operations on the forked index don't affect the original one. Learn more on the [Chroma docs](https://docs.trychroma.com/cloud/collection-forking).
|
|
58
58
|
|
|
59
59
|
**indexName** (`string`): Name of the index to fork
|
|
60
60
|
|