@mastra/mcp-docs-server 1.2.11 → 1.2.12-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/using-tools.md +25 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +5 -5
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +8 -8
- package/.docs/guides/build-your-ui/copilotkit/overview.md +2 -2
- package/.docs/guides/build-your-ui/openui.md +1 -1
- package/.docs/guides/concepts/multi-agent-systems.md +5 -5
- package/.docs/guides/concepts/streaming.md +9 -9
- package/.docs/guides/deployment/amazon-ec2.md +1 -1
- package/.docs/guides/deployment/aws-lambda.md +1 -1
- package/.docs/guides/deployment/azure-app-services.md +1 -1
- package/.docs/guides/deployment/cloudflare.md +1 -1
- package/.docs/guides/deployment/inngest.md +6 -6
- package/.docs/guides/deployment/temporal.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -1
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/nestjs.md +5 -5
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/code-review-bot.md +1 -1
- package/.docs/guides/guide/coding-agent.md +4 -4
- package/.docs/guides/guide/dev-assistant.md +1 -1
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +4 -4
- package/.docs/guides/guide/research-assistant.md +3 -3
- package/.docs/guides/guide/research-coordinator.md +3 -3
- package/.docs/guides/guide/slack-assistant.md +1 -1
- package/.docs/guides/guide/stock-agent.md +1 -1
- package/.docs/guides/index.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/network-to-supervisor.md +9 -9
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +5 -5
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +11 -11
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/modal.md +73 -0
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +3 -3
- package/.docs/reference/acp/create-acp-tool.md +2 -2
- package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
- package/.docs/reference/agent-controller/session.md +6 -6
- package/.docs/reference/agents/agent.md +7 -7
- package/.docs/reference/agents/channels.md +3 -3
- package/.docs/reference/agents/durable-agent.md +3 -3
- package/.docs/reference/agents/generate.md +3 -3
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/listScorers.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -1
- package/.docs/reference/agents/listSuspendedRuns.md +2 -2
- package/.docs/reference/ai-sdk/chat-route.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- 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/ai-sdk/workflow-route.md +1 -1
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/fga.md +2 -2
- package/.docs/reference/auth/google.md +2 -2
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/auth/workos.md +2 -2
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +3 -3
- package/.docs/reference/browser/mastra-browser.md +3 -3
- package/.docs/reference/browser/stagehand-browser.md +4 -4
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/create-mastra.md +1 -1
- package/.docs/reference/cli/mastra.md +23 -23
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/memory.md +2 -2
- package/.docs/reference/client-js/workflows.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
- package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/core/getMCPServer.md +1 -1
- package/.docs/reference/core/getScorer.md +1 -1
- package/.docs/reference/datasets/addItem.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/netlify.md +4 -4
- package/.docs/reference/deployer/vercel.md +7 -7
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
- package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
- package/.docs/reference/editor/blob-store-provider.md +1 -1
- package/.docs/reference/editor/browser-provider.md +3 -3
- package/.docs/reference/editor/filesystem-provider.md +4 -4
- package/.docs/reference/editor/mastra-editor.md +5 -5
- package/.docs/reference/editor/processor-provider.md +3 -3
- package/.docs/reference/editor/sandbox-provider.md +4 -4
- package/.docs/reference/editor/storage-browser-ref.md +6 -6
- package/.docs/reference/editor/storage-workspace-ref.md +4 -4
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/bias.md +3 -3
- package/.docs/reference/evals/checks.md +3 -3
- package/.docs/reference/evals/completeness.md +5 -5
- package/.docs/reference/evals/content-similarity.md +5 -5
- package/.docs/reference/evals/context-precision.md +2 -2
- package/.docs/reference/evals/context-recall.md +8 -8
- package/.docs/reference/evals/context-relevance.md +4 -4
- package/.docs/reference/evals/create-scorer.md +1 -1
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/filter-run.md +2 -2
- package/.docs/reference/evals/hallucination.md +6 -6
- package/.docs/reference/evals/keyword-coverage.md +6 -6
- package/.docs/reference/evals/mastra-scorer.md +2 -2
- package/.docs/reference/evals/noise-sensitivity.md +5 -5
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +3 -3
- package/.docs/reference/evals/scorer-utils.md +4 -4
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tool-call-accuracy.md +1 -1
- package/.docs/reference/evals/toxicity.md +4 -4
- package/.docs/reference/evals/trajectory-accuracy.md +10 -10
- package/.docs/reference/file-based-agents/instructions.md +2 -2
- package/.docs/reference/file-based-agents/logger.md +1 -1
- package/.docs/reference/file-based-agents/observability.md +1 -1
- package/.docs/reference/file-based-agents/processors.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +1 -1
- package/.docs/reference/file-based-agents/studio.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +1 -1
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/logging/pino-logger.md +3 -3
- package/.docs/reference/memory/clone-utilities.md +1 -1
- package/.docs/reference/memory/cloneThread.md +3 -3
- package/.docs/reference/memory/listThreads.md +1 -1
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +11 -11
- package/.docs/reference/memory/recall.md +2 -2
- package/.docs/reference/memory/serialized-memory-config.md +4 -4
- package/.docs/reference/memory/summarizeConversation.md +3 -3
- package/.docs/reference/memory/summarizeThread.md +3 -3
- package/.docs/reference/observability/feedback.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/interfaces.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
- package/.docs/reference/observability/tracing/span-filtering.md +1 -1
- package/.docs/reference/processors/cost-guard-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +12 -12
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/provider-history-compat.md +1 -1
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/response-cache.md +8 -8
- package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +1 -1
- package/.docs/reference/processors/tool-search-processor.md +7 -7
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/base.md +4 -4
- package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
- package/.docs/reference/pubsub/lease-provider.md +4 -4
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +5 -5
- package/.docs/reference/rag/database-config.md +2 -2
- package/.docs/reference/rag/metadata-filters.md +2 -2
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/server/register-api-route.md +1 -1
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/signals/signal-provider.md +8 -8
- package/.docs/reference/storage/clickhouse.md +4 -4
- package/.docs/reference/storage/cloudflare-d1.md +4 -4
- package/.docs/reference/storage/convex.md +4 -4
- package/.docs/reference/storage/dsql.md +2 -2
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/mongodb.md +1 -1
- package/.docs/reference/storage/mssql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/retention.md +33 -33
- package/.docs/reference/storage/spanner.md +8 -8
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
- package/.docs/reference/streaming/workflows/observeStream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/brightdata.md +1 -1
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +20 -20
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +4 -4
- package/.docs/reference/vectors/astra.md +1 -1
- package/.docs/reference/vectors/chroma.md +2 -2
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/couchbase.md +4 -4
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +4 -4
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/vectors/turbopuffer.md +1 -1
- package/.docs/reference/voice/aws-nova-sonic.md +1 -1
- package/.docs/reference/voice/azure.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +4 -4
- package/.docs/reference/voice/inworld-realtime.md +7 -7
- package/.docs/reference/voice/livekit.md +13 -13
- package/.docs/reference/voice/mistral.md +1 -1
- package/.docs/reference/voice/openai-realtime.md +1 -1
- package/.docs/reference/voice/sarvam.md +1 -1
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.events.md +1 -1
- package/.docs/reference/voice/voice.getSpeakers.md +2 -2
- package/.docs/reference/voice/voice.on.md +2 -2
- package/.docs/reference/voice/xai-realtime.md +2 -2
- package/.docs/reference/workflows/run-methods/cancel.md +1 -1
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
- package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
- package/.docs/reference/workflows/workflow-state-reader.md +2 -2
- package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
- package/.docs/reference/workspace/daytona-sandbox.md +3 -3
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
- package/.docs/reference/workspace/local-filesystem.md +2 -2
- package/.docs/reference/workspace/local-sandbox.md +2 -2
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +2 -2
- package/.docs/reference/workspace/process-manager.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +4 -4
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/vercel-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +10 -10
- package/CHANGELOG.md +7 -0
- package/package.json +5 -5
|
@@ -32,7 +32,7 @@ for await (const chunk of stream.fullStream) {
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
> **Info:** `streamUntilIdle()` requires both a [`BackgroundTaskManager`](https://mastra.ai/reference/configuration) and a [memory](https://mastra.ai/docs/memory/overview) backend. Without either, it
|
|
35
|
+
> **Info:** `streamUntilIdle()` requires both a [`BackgroundTaskManager`](https://mastra.ai/reference/configuration) and a [memory](https://mastra.ai/docs/memory/overview) backend. Without either, it uses a plain `agent.stream()` call.
|
|
36
36
|
|
|
37
37
|
## Parameters
|
|
38
38
|
|
|
@@ -54,7 +54,7 @@ For every other option (`maxSteps`, `modelSettings`, `toolChoice`, `outputProces
|
|
|
54
54
|
|
|
55
55
|
### Aggregate properties caveat
|
|
56
56
|
|
|
57
|
-
`streamUntilIdle()` returns a proxy over the first turn's `MastraModelOutput`. Only `fullStream` is replaced with a combined stream that spans every continuation. Every other property
|
|
57
|
+
`streamUntilIdle()` returns a proxy over the first turn's `MastraModelOutput`. Only `fullStream` is replaced with a combined stream that spans every continuation. Every other property (`text`, `toolCalls`, `toolResults`, `finishReason`, `messageList`, and `getFullOutput()`) resolves against the **first turn's** internal buffer.
|
|
58
58
|
|
|
59
59
|
If you need an aggregate view across all continuations, consume `fullStream` yourself and accumulate.
|
|
60
60
|
|
|
@@ -28,7 +28,7 @@ for await (const chunk of stream) {
|
|
|
28
28
|
|
|
29
29
|
## Stream events
|
|
30
30
|
|
|
31
|
-
The stream emits
|
|
31
|
+
The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
32
32
|
|
|
33
33
|
- **`workflow-start`**: Workflow execution begins
|
|
34
34
|
- **`workflow-step-start`**: A step begins execution
|
|
@@ -60,7 +60,7 @@ if (result!.status === 'suspended') {
|
|
|
60
60
|
|
|
61
61
|
## Stream events
|
|
62
62
|
|
|
63
|
-
The stream emits
|
|
63
|
+
The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
64
64
|
|
|
65
65
|
- **`workflow-start`**: Workflow execution begins
|
|
66
66
|
- **`workflow-step-start`**: A step begins execution
|
|
@@ -86,7 +86,7 @@ console.log('Status:', stream.status)
|
|
|
86
86
|
|
|
87
87
|
## Stream events
|
|
88
88
|
|
|
89
|
-
The stream emits
|
|
89
|
+
The stream emits event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
90
90
|
|
|
91
91
|
- **`workflow-start`**: Workflow execution begins
|
|
92
92
|
- **`workflow-step-start`**: A step begins execution
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Run.timeTravelStream()
|
|
4
4
|
|
|
5
|
-
The `.timeTravelStream()` method re-executes a workflow starting from any specific step with streaming events.
|
|
5
|
+
The `.timeTravelStream()` method re-executes a workflow starting from any specific step with streaming events. You can receive real-time updates during time travel execution while maintaining full visibility into each step's progress.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -39,7 +39,7 @@ All parameters are the same as [`Run.timeTravel()`](https://mastra.ai/reference/
|
|
|
39
39
|
|
|
40
40
|
## Stream events
|
|
41
41
|
|
|
42
|
-
The stream emits
|
|
42
|
+
The stream emits workflow events during execution:
|
|
43
43
|
|
|
44
44
|
- `workflow-step-start`: Emitted when a step begins execution
|
|
45
45
|
- `workflow-step-finish`: Emitted when a step completes successfully
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Overview
|
|
4
4
|
|
|
5
|
-
This reference
|
|
5
|
+
This reference explains how to use existing Mastra templates and create your own. It also covers contributing templates to the community ecosystem.
|
|
6
6
|
|
|
7
7
|
Mastra templates are pre-built project structures that demonstrate specific use cases and patterns. They provide:
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Bright Data tools
|
|
4
4
|
|
|
5
|
-
The `@mastra/brightdata` package wraps the [Bright Data SDK](https://github.com/brightdata/bright-data-sdk-node) as Mastra-compatible tools. It exposes factory functions for web search and web fetch
|
|
5
|
+
The `@mastra/brightdata` package wraps the [Bright Data SDK](https://github.com/brightdata/bright-data-sdk-node) as Mastra-compatible tools. It exposes factory functions for web search and web fetch. Each function returns a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
|
|
6
6
|
|
|
7
7
|
The search tool is backed by Bright Data's [SERP API](https://brightdata.com/products/serp-api) and the fetch tool by [Web Unlocker](https://brightdata.com/products/web-unlocker). Both bypass bot detection and CAPTCHAs.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# createTool()
|
|
4
4
|
|
|
5
|
-
The `createTool()` function is used to define custom tools that your Mastra agents can execute. Tools extend an agent's capabilities by allowing it to interact with external systems
|
|
5
|
+
The `createTool()` function is used to define custom tools that your Mastra agents can execute. Tools extend an agent's capabilities by allowing it to interact with external systems or perform calculations. They can also access specific data.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ const graphTool = createGraphRAGTool({
|
|
|
51
51
|
|
|
52
52
|
**graphOptions.restartProb** (`number`): Probability of restarting random walk from query node. (Can be set at creation or overridden at runtime.)
|
|
53
53
|
|
|
54
|
-
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality).
|
|
54
|
+
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
|
|
55
55
|
|
|
56
56
|
**vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
|
|
57
57
|
|
|
@@ -125,7 +125,7 @@ const mcp = new MCPClient({
|
|
|
125
125
|
})
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
Per the MCP specification
|
|
128
|
+
Per the MCP specification: **clients MUST consider tool annotations to be untrusted unless they come from trusted servers**. Annotations are advisory hints and provide no security boundary. A malicious or buggy server can claim a tool is read-only when it isn't. Only use annotations to relax approval requirements for servers you trust.
|
|
129
129
|
|
|
130
130
|
The same annotations are also exposed on the tools returned by `listTools()` and `listToolsets()` under `tool.mcp.annotations`, so you can inspect them when wiring tools into an agent.
|
|
131
131
|
|
|
@@ -182,7 +182,7 @@ console.log(errors)
|
|
|
182
182
|
|
|
183
183
|
### `listToolsets()`
|
|
184
184
|
|
|
185
|
-
Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed
|
|
185
|
+
Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed at runtime into the generate or stream method.
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
188
|
const res = await agent.stream(prompt, {
|
|
@@ -227,9 +227,9 @@ getServerAuthState(serverName: string): 'needs-auth' | 'authorized' | undefined
|
|
|
227
227
|
|
|
228
228
|
### `cancelAuthentication()`
|
|
229
229
|
|
|
230
|
-
Cancels an in-progress `authenticate()` flow for a server, so an abandoned browser authorization
|
|
230
|
+
Cancels an in-progress `authenticate()` flow for a server, so an abandoned browser authorization doesn't leave the client waiting indefinitely. It aborts the flow (including its setup phase, before the callback server binds), closes the local callback server if one is listening, and the pending `authenticate()` call rejects. Returns `true` if a flow was cancelled, or `false` when no flow was in progress.
|
|
231
231
|
|
|
232
|
-
The resulting `getServerAuthState()` depends on how far the flow
|
|
232
|
+
The resulting `getServerAuthState()` depends on how far the flow progressed. A flow cancelled after a `401` rejection stays at `'needs-auth'` and can be retried immediately. Cancellation during setup leaves the state unchanged (typically `undefined`) if no connection was attempted.
|
|
233
233
|
|
|
234
234
|
```typescript
|
|
235
235
|
async cancelAuthentication(serverName: string): Promise<boolean>
|
|
@@ -324,7 +324,7 @@ for (const serverName in templatesByServer) {
|
|
|
324
324
|
|
|
325
325
|
#### `resources.read(serverName: string, uri: string)`
|
|
326
326
|
|
|
327
|
-
Reads the content of a specific resource from a
|
|
327
|
+
Reads the content of a specific resource from a server.
|
|
328
328
|
|
|
329
329
|
```typescript
|
|
330
330
|
async read(serverName: string, uri: string): Promise<ReadResourceResult>
|
|
@@ -342,7 +342,7 @@ console.log('Current weather:', content.contents[0].text)
|
|
|
342
342
|
|
|
343
343
|
#### `resources.subscribe(serverName: string, uri: string)`
|
|
344
344
|
|
|
345
|
-
Subscribes to updates for a specific resource on a
|
|
345
|
+
Subscribes to updates for a specific resource on a server.
|
|
346
346
|
|
|
347
347
|
```typescript
|
|
348
348
|
async subscribe(serverName: string, uri: string): Promise<object>
|
|
@@ -356,7 +356,7 @@ await mcpClient.resources.subscribe('myWeatherServer', 'weather://current')
|
|
|
356
356
|
|
|
357
357
|
#### `resources.unsubscribe(serverName: string, uri: string)`
|
|
358
358
|
|
|
359
|
-
Unsubscribes from updates for a specific resource on a
|
|
359
|
+
Unsubscribes from updates for a specific resource on a server.
|
|
360
360
|
|
|
361
361
|
```typescript
|
|
362
362
|
async unsubscribe(serverName: string, uri: string): Promise<object>
|
|
@@ -388,7 +388,7 @@ mcpClient.resources.onUpdated('myWeatherServer', params => {
|
|
|
388
388
|
|
|
389
389
|
#### `resources.onListChanged(serverName: string, handler: () => void)`
|
|
390
390
|
|
|
391
|
-
Sets a notification handler that will be called when the
|
|
391
|
+
Sets a notification handler that will be called when the list of available resources changes on a specific server.
|
|
392
392
|
|
|
393
393
|
```typescript
|
|
394
394
|
async onListChanged(serverName: string, handler: () => void): Promise<void>
|
|
@@ -847,7 +847,7 @@ Give each server its own `MCPOAuthClientProvider` instance. A provider holds per
|
|
|
847
847
|
|
|
848
848
|
### Interactive browser authentication
|
|
849
849
|
|
|
850
|
-
When a server rejects a connection because authorization is required, the client records a `'needs-auth'` state instead of failing outright. Calling `authenticate()`
|
|
850
|
+
When a server rejects a connection because authorization is required, the client records a `'needs-auth'` state instead of failing outright. Calling `authenticate()` completes the flow. It starts a one-shot callback server on the provider's loopback redirect URL, falling back to the next sequential ports when it's in use. The SDK then performs discovery and client registration at runtime. `onRedirectToAuthorization` receives the authorization URL so your application can open it in the user's browser. The token exchange finishes after the browser returns the authorization code:
|
|
851
851
|
|
|
852
852
|
```typescript
|
|
853
853
|
import { MCPClient, MCPOAuthClientProvider } from '@mastra/mcp'
|
|
@@ -884,9 +884,9 @@ try {
|
|
|
884
884
|
}
|
|
885
885
|
```
|
|
886
886
|
|
|
887
|
-
Concurrent `authenticate()` calls for the same server join the pending flow
|
|
887
|
+
Concurrent `authenticate()` calls for the same server join the pending flow. Different servers authenticate independently. With valid stored tokens the call reconnects without opening a browser.
|
|
888
888
|
|
|
889
|
-
Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server, validates the OAuth `state` parameter, and resolves with the code. It creates a plain HTTP server, so it
|
|
889
|
+
Hosts that drive the flow themselves can capture the authorization code with the exported `createOAuthCallbackServer` helper, which binds a one-shot loopback server, validates the OAuth `state` parameter, and resolves with the code. It creates a plain HTTP server, so it's only for local loopback redirects. Web applications that use an HTTPS redirect URL must host their own callback endpoint and drive the provider directly rather than using this helper:
|
|
890
890
|
|
|
891
891
|
```typescript
|
|
892
892
|
import { createOAuthCallbackServer, getCallbackUrlCandidates } from '@mastra/mcp'
|
|
@@ -1139,9 +1139,9 @@ MCPClient handles server connections gracefully:
|
|
|
1139
1139
|
2. Graceful server shutdown to prevent error messages during development
|
|
1140
1140
|
3. Proper cleanup of resources when disconnecting
|
|
1141
1141
|
|
|
1142
|
-
## Using custom fetch for
|
|
1142
|
+
## Using custom fetch for runtime-defined authentication
|
|
1143
1143
|
|
|
1144
|
-
For HTTP servers, you can provide a custom `fetch` function to handle
|
|
1144
|
+
For HTTP servers, you can provide a custom `fetch` function to handle runtime-defined authentication or request interception. It can also handle other custom behavior. This is particularly useful when you need to refresh tokens on each request or forward user credentials from the incoming request to the MCP server.
|
|
1145
1145
|
|
|
1146
1146
|
The custom `fetch` function receives an optional third `requestContext` parameter, which provides access to request-scoped data (e.g., authentication cookies, bearer tokens) set by middleware or passed during agent/tool execution. The `requestContext` is `null` during the initial connection handshake.
|
|
1147
1147
|
|
|
@@ -101,20 +101,20 @@ A powerful feature of `MCPServer` is its ability to automatically expose your Ma
|
|
|
101
101
|
|
|
102
102
|
- **Description**: The generated tool's description will be in the format: "Ask agent `<AgentName>` a question. Original agent instructions: `<agent description>`".
|
|
103
103
|
- **Input**: The tool expects a single object argument with a `message` property (string): `{ message: "Your question for the agent" }`.
|
|
104
|
-
- **Execution**: When this tool is called, it invokes the `generate()` method
|
|
104
|
+
- **Execution**: When this tool is called, it invokes the corresponding agent's `generate()` method with the provided `query`.
|
|
105
105
|
- **Output**: The direct result from the agent's `generate()` method is returned as the output of the tool.
|
|
106
106
|
|
|
107
|
-
- **Name
|
|
107
|
+
- **Name collisions.** If an explicit tool defined in the `tools` configuration has the same name as an agent-derived tool (e.g., a tool named `ask_myAgentKey` alongside an agent keyed as `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.
|
|
108
108
|
|
|
109
109
|
This makes it straightforward to allow MCP clients to interact with your agents using natural language queries, like any other tool.
|
|
110
110
|
|
|
111
111
|
### Agent-to-Tool Conversion
|
|
112
112
|
|
|
113
|
-
When you provide agents in the `agents` configuration property, `MCPServer` will automatically create a corresponding tool for each agent. The tool will be
|
|
113
|
+
When you provide agents in the `agents` configuration property, `MCPServer` will automatically create a corresponding tool for each agent. The tool will be `ask_<agentIdentifier>`, where `<agentIdentifier>` is the key you used in the `agents` object.
|
|
114
114
|
|
|
115
115
|
The description for this generated tool will be: "Ask agent `<agent.name>` a question. Agent description: `<agent.description>`".
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
For an agent to be converted into a tool, it **must** have a non-empty `description` string property set in its configuration when it was instantiated (e.g., `new Agent({ id: 'my-agent', name: 'myAgent', description: 'This agent does X.', ... })`). If an agent is passed to `MCPServer` with a missing or empty `description`, an error will be thrown when the `MCPServer` is instantiated, and server setup will fail.
|
|
118
118
|
|
|
119
119
|
This allows you to quickly expose the generative capabilities of your agents through the MCP, enabling clients to "ask" your agents questions directly.
|
|
120
120
|
|
|
@@ -412,7 +412,7 @@ serve(async req => {
|
|
|
412
412
|
>
|
|
413
413
|
> This is still stateless: no `mcp-session-id` is required or persisted. It only enables notifications scoped to the current request (such as progress). The session-dependent features below remain unavailable.
|
|
414
414
|
>
|
|
415
|
-
>
|
|
415
|
+
> The following MCP features require session state or persistent connections and **won't work** in serverless mode (including with `serverlessStreaming: true`):
|
|
416
416
|
>
|
|
417
417
|
> - **Elicitation** - Interactive user input requests during tool execution require session management to route responses back to the correct client
|
|
418
418
|
> - **Resource subscriptions** - `resources/subscribe` and `resources/unsubscribe` need persistent connections to maintain subscription state
|
|
@@ -439,7 +439,7 @@ The `StreamableHTTPServerTransportOptions` object allows you to customize the be
|
|
|
439
439
|
|
|
440
440
|
**serverless** (`boolean`): If true, runs in stateless mode without session management. Each request is handled independently with a fresh server instance. Essential for serverless environments (Cloudflare Workers, Supabase Edge Functions, Vercel Edge, etc.) where sessions cannot persist between invocations. Defaults to false.
|
|
441
441
|
|
|
442
|
-
**serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior.
|
|
442
|
+
**serverlessStreaming** (`boolean`): If true, serverless requests use request-scoped SSE streaming instead of a buffered JSON response, allowing in-request notifications/progress to reach the client before the final result. Only takes effect together with serverless: true. Defaults to false (buffered JSON responses), which preserves backward-compatible behavior. It enables only request-scoped notifications such as progress; elicitation, subscriptions, and out-of-request notifications still require session state.
|
|
443
443
|
|
|
444
444
|
**sessionIdGenerator** (`(() => string) | undefined`): A function that generates a unique session ID. This should be a cryptographically secure, globally unique string. Return undefined to disable session management.
|
|
445
445
|
|
|
@@ -459,7 +459,7 @@ async close(): Promise<void>
|
|
|
459
459
|
|
|
460
460
|
### `getServerInfo()`
|
|
461
461
|
|
|
462
|
-
|
|
462
|
+
The method returns the server's basic information.
|
|
463
463
|
|
|
464
464
|
```typescript
|
|
465
465
|
getServerInfo(): ServerInfo
|
|
@@ -467,7 +467,7 @@ getServerInfo(): ServerInfo
|
|
|
467
467
|
|
|
468
468
|
### `getServerDetail()`
|
|
469
469
|
|
|
470
|
-
|
|
470
|
+
The method returns details about the server's information.
|
|
471
471
|
|
|
472
472
|
```typescript
|
|
473
473
|
getServerDetail(): ServerDetail
|
|
@@ -475,7 +475,7 @@ getServerDetail(): ServerDetail
|
|
|
475
475
|
|
|
476
476
|
### `getToolListInfo()`
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
The method returns the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
|
|
479
479
|
|
|
480
480
|
```typescript
|
|
481
481
|
getToolListInfo(): ToolListInfo
|
|
@@ -483,7 +483,7 @@ getToolListInfo(): ToolListInfo
|
|
|
483
483
|
|
|
484
484
|
### `getToolInfo()`
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
The method returns details about a specific tool.
|
|
487
487
|
|
|
488
488
|
```typescript
|
|
489
489
|
getToolInfo(toolName: string): ToolInfo
|
|
@@ -565,7 +565,7 @@ Resources are identified by unique URIs (e.g., `file:///home/user/documents/repo
|
|
|
565
565
|
Clients can discover resources through:
|
|
566
566
|
|
|
567
567
|
1. **Direct resources**: Servers expose a list of concrete resources via a `resources/list` endpoint.
|
|
568
|
-
2. **Resource templates**: For
|
|
568
|
+
2. **Resource templates**: For runtime-defined resources, servers can expose URI templates (RFC 6570) that clients use to construct resource URIs.
|
|
569
569
|
|
|
570
570
|
To read a resource, clients make a `resources/read` request with the URI. Servers can also notify clients about changes to the resource list (`notifications/resources/list_changed`) or updates to specific resource content (`notifications/resources/updated`) if a client has subscribed to that resource.
|
|
571
571
|
|
|
@@ -659,7 +659,7 @@ await serverWithResources.resources.notifyUpdated({ uri: 'file://data.txt' })
|
|
|
659
659
|
|
|
660
660
|
#### `server.resources.notifyListChanged()`
|
|
661
661
|
|
|
662
|
-
Call this method when the
|
|
662
|
+
Call this method when the list of available resources has changed (e.g., a resource was added or removed). This will send a `notifications/resources/list_changed` message to clients, prompting them to re-fetch the list of resources.
|
|
663
663
|
|
|
664
664
|
```typescript
|
|
665
665
|
async server.resources.notifyListChanged(): Promise<void>
|
|
@@ -676,9 +676,9 @@ await serverWithResources.resources.notifyListChanged()
|
|
|
676
676
|
|
|
677
677
|
### What are MCP Prompts?
|
|
678
678
|
|
|
679
|
-
Prompts are reusable templates or workflows that MCP servers expose to clients. They can accept arguments
|
|
679
|
+
Prompts are reusable templates or workflows that MCP servers expose to clients. They can accept arguments and include resource context. They also support versioning and standardize LLM interactions.
|
|
680
680
|
|
|
681
|
-
Prompts are identified by a unique name (and optional version) and can be
|
|
681
|
+
Prompts are identified by a unique name (and optional version) and can be runtime-defined or static.
|
|
682
682
|
|
|
683
683
|
### `MCPServerPrompts` Type
|
|
684
684
|
|
|
@@ -773,7 +773,7 @@ If the available prompts change, your server can notify connected clients:
|
|
|
773
773
|
|
|
774
774
|
#### `server.prompts.notifyListChanged()`
|
|
775
775
|
|
|
776
|
-
Call this method when the
|
|
776
|
+
Call this method when the list of available prompts has changed (e.g., a prompt was added or removed). This will send a `notifications/prompts/list_changed` message to clients, prompting them to re-fetch the list of prompts.
|
|
777
777
|
|
|
778
778
|
```typescript
|
|
779
779
|
await serverWithPrompts.prompts.notifyListChanged()
|
|
@@ -793,7 +793,7 @@ await serverWithPrompts.prompts.notifyListChanged()
|
|
|
793
793
|
|
|
794
794
|
Tools are usually provided when constructing the `MCPServer`, but you can also add or remove tools while the server is running. The server exposes these operations through the `toolActions` property. When the tool list changes, connected clients receive a `notifications/tools/list_changed` message prompting them to re-fetch the tool list.
|
|
795
795
|
|
|
796
|
-
The property is
|
|
796
|
+
The property is `toolActions` because `tools()` is the method that returns the registered tool registry.
|
|
797
797
|
|
|
798
798
|
### `toolActions.add(tools)`
|
|
799
799
|
|
|
@@ -821,7 +821,7 @@ await server.toolActions.add({ searchTool })
|
|
|
821
821
|
|
|
822
822
|
### `toolActions.remove(toolIds)`
|
|
823
823
|
|
|
824
|
-
Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored.
|
|
824
|
+
Removes tools from the running server by tool ID and notifies connected clients. Unknown tool IDs are ignored. A notification is sent only when at least one tool is removed.
|
|
825
825
|
|
|
826
826
|
```typescript
|
|
827
827
|
async server.toolActions.remove(toolIds: string[]): Promise<void>
|
|
@@ -847,7 +847,7 @@ When the server is registered with a Mastra instance, `toolActions.add()` and `t
|
|
|
847
847
|
|
|
848
848
|
## Logging
|
|
849
849
|
|
|
850
|
-
MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request
|
|
850
|
+
MCP servers can send structured log messages to clients using `notifications/message`. Clients control verbosity by sending a `logging/setLevel` request. The server drops messages below the requested minimum level (following RFC 5424 severity ordering). The level is tracked per session, so different clients can request different verbosity.
|
|
851
851
|
|
|
852
852
|
### `sendLoggingMessage()`
|
|
853
853
|
|
|
@@ -937,7 +937,7 @@ The example at the beginning of this page also demonstrates how to instantiate `
|
|
|
937
937
|
|
|
938
938
|
### What's Elicitation?
|
|
939
939
|
|
|
940
|
-
Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users.
|
|
940
|
+
Elicitation is a feature in the Model Context Protocol (MCP) that allows servers to request structured information from users. It supports interactive workflows where servers can collect additional data at runtime.
|
|
941
941
|
|
|
942
942
|
The `MCPServer` class automatically includes elicitation capabilities. Tools receive a `context.mcp` object in their `execute` function that includes an `elicitation.sendRequest()` method for requesting user input.
|
|
943
943
|
|
|
@@ -1126,7 +1126,7 @@ execute: async (inputData, context) => {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
```
|
|
1128
1128
|
|
|
1129
|
-
|
|
1129
|
+
Elicitation is **session-aware** when using HTTP-based transports (SSE or HTTP). When multiple clients are connected to the same server, elicitation requests are routed to the client session that initiated the tool execution.
|
|
1130
1130
|
|
|
1131
1131
|
The `ElicitResult` type:
|
|
1132
1132
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A built-in, agent-agnostic tool that submits an implementation plan for user review. The agent writes a plan to a markdown file and passes the file path to this tool. The tool suspends the run until the user approves or rejects the plan.
|
|
6
6
|
|
|
7
|
-
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/agent-approval) primitive: it calls `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event. The host reads the plan file
|
|
7
|
+
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/agent-approval) primitive: it calls `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event. The host reads the plan file and presents it to the user. It then resumes with an approval or rejection.
|
|
8
8
|
|
|
9
9
|
When executed outside an agent run (no `suspend` available), the tool returns a readable fallback string containing the file path.
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Tavily tools
|
|
4
4
|
|
|
5
|
-
The `@mastra/tavily` package wraps the [Tavily](https://app.tavily.com) API as Mastra-compatible tools. It exposes factory functions for search, extract, crawl, and map
|
|
5
|
+
The `@mastra/tavily` package wraps the [Tavily](https://app.tavily.com) API as Mastra-compatible tools. It exposes factory functions for search, extract, crawl, and map. Each function returns a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# createVectorQueryTool()
|
|
4
4
|
|
|
5
|
-
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with
|
|
5
|
+
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with vector store backends.
|
|
6
6
|
|
|
7
7
|
## Basic usage
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ const queryTool = createVectorQueryTool({
|
|
|
69
69
|
|
|
70
70
|
**databaseConfig.chroma.whereDocument** (`Record<string, any>`): Document content filtering conditions
|
|
71
71
|
|
|
72
|
-
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality).
|
|
72
|
+
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
|
|
73
73
|
|
|
74
74
|
**vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
|
|
75
75
|
|
|
@@ -182,7 +182,7 @@ This example shows how to customize the tool description for a specific use case
|
|
|
182
182
|
|
|
183
183
|
## Database-specific configuration examples
|
|
184
184
|
|
|
185
|
-
The `databaseConfig` parameter allows you to
|
|
185
|
+
The `databaseConfig` parameter allows you to use features and optimizations specific to each vector database. These configurations are automatically applied during query execution.
|
|
186
186
|
|
|
187
187
|
**Pinecone**:
|
|
188
188
|
|
|
@@ -475,7 +475,7 @@ const result = await vectorQueryTool.execute(
|
|
|
475
475
|
)
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
This pattern is similar to how `Agent.memory` supports
|
|
478
|
+
This pattern is similar to how `Agent.memory` supports runtime-defined configuration and enables:
|
|
479
479
|
|
|
480
480
|
- **Schema isolation**: Each tenant's data in separate PostgreSQL schemas
|
|
481
481
|
- **Database isolation**: Route to different database instances per tenant
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Astra vector store
|
|
4
4
|
|
|
5
|
-
The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade
|
|
5
|
+
The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade capacity and high availability.
|
|
6
6
|
|
|
7
7
|
## Constructor options
|
|
8
8
|
|
|
@@ -8,7 +8,7 @@ The ChromaVector class provides vector search using [Chroma](https://docs.trychr
|
|
|
8
8
|
>
|
|
9
9
|
> **Chroma Cloud**
|
|
10
10
|
>
|
|
11
|
-
> Chroma Cloud powers serverless vector and full-text search. It's extremely fast, cost-effective,
|
|
11
|
+
> Chroma Cloud powers serverless vector and full-text search. It's extremely fast, cost-effective, high-capacity, and painless. Create a DB and try it out in under 30 seconds with $5 of free credits.
|
|
12
12
|
>
|
|
13
13
|
> [Get started with Chroma Cloud](https://trychroma.com/signup)
|
|
14
14
|
|
|
@@ -197,7 +197,7 @@ await vectorStore.updateVector({
|
|
|
197
197
|
|
|
198
198
|
### `deleteVectors()`
|
|
199
199
|
|
|
200
|
-
Delete multiple vectors by IDs or by metadata filter.
|
|
200
|
+
Delete multiple vectors by IDs or by metadata filter. The method supports bulk deletion and source-based vector management. Either `ids` or `filter` must be provided, but not both.
|
|
201
201
|
|
|
202
202
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
203
203
|
|
|
@@ -351,7 +351,7 @@ interface QueryResult {
|
|
|
351
351
|
|
|
352
352
|
## Metadata filtering
|
|
353
353
|
|
|
354
|
-
`ConvexVector` supports metadata filtering with
|
|
354
|
+
`ConvexVector` supports metadata filtering with operators. These filters are applied by the adapter after vectors are loaded from Convex.
|
|
355
355
|
|
|
356
356
|
```typescript
|
|
357
357
|
// Simple equality
|
|
@@ -415,7 +415,7 @@ Vector similarity search is performed with cosine similarity in the Mastra adapt
|
|
|
415
415
|
- Filters must target fields listed in the Convex vector index `filterFields`.
|
|
416
416
|
- Use one dedicated table per Mastra vector index to avoid cross-index results.
|
|
417
417
|
|
|
418
|
-
Use an external vector database when you need
|
|
418
|
+
Use an external vector database when you need runtime-defined index creation at runtime, metadata-only queries, complex filter operators, filter-based bulk updates or deletes, or result limits above Convex's native vector search cap.
|
|
419
419
|
|
|
420
420
|
## Related
|
|
421
421
|
|
|
@@ -75,7 +75,7 @@ const store = new CouchbaseVector({
|
|
|
75
75
|
|
|
76
76
|
Creates a new vector index in Couchbase.
|
|
77
77
|
|
|
78
|
-
> **Note:** Index creation is asynchronous. After calling `createIndex`, allow time (typically 1
|
|
78
|
+
> **Note:** Index creation is asynchronous. After calling `createIndex`, allow time (typically 1 to 5 seconds for small datasets, longer for large ones) before querying. For production, implement polling to check index status rather than using fixed delays.
|
|
79
79
|
|
|
80
80
|
**indexName** (`string`): Name of the index to create
|
|
81
81
|
|
|
@@ -145,7 +145,7 @@ Returns: `Promise<string[]>`
|
|
|
145
145
|
|
|
146
146
|
### `updateVector()`
|
|
147
147
|
|
|
148
|
-
Updates a specific vector entry by its ID with new vector data and/or metadata.
|
|
148
|
+
Updates a specific vector entry by its ID with new vector data and/or metadata. Filter-based updates aren't yet implemented for Couchbase.
|
|
149
149
|
|
|
150
150
|
**indexName** (`string`): Name of the index containing the vector
|
|
151
151
|
|
|
@@ -163,7 +163,7 @@ Deletes a single vector by its ID from the index.
|
|
|
163
163
|
|
|
164
164
|
### `deleteVectors()`
|
|
165
165
|
|
|
166
|
-
Deletes multiple vectors by their IDs.
|
|
166
|
+
Deletes multiple vectors by their IDs. Filter-based deletion isn't yet implemented for Couchbase.
|
|
167
167
|
|
|
168
168
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
169
169
|
|
|
@@ -221,7 +221,7 @@ try {
|
|
|
221
221
|
|
|
222
222
|
- Index creation delays may impact immediate querying after creation.
|
|
223
223
|
- No hard enforcement of vector dimension at ingest time (dimension mismatches will error at query time).
|
|
224
|
-
- Vector insertion and index updates are eventually consistent
|
|
224
|
+
- Vector insertion and index updates are eventually consistent. Strong consistency isn't guaranteed immediately after writes.
|
|
225
225
|
|
|
226
226
|
## Related
|
|
227
227
|
|
|
@@ -85,7 +85,7 @@ const results = await store.query({
|
|
|
85
85
|
|
|
86
86
|
### `createIndex()`
|
|
87
87
|
|
|
88
|
-
Creates a new vector collection. The index name must start with a letter or underscore and can only contain letters, numbers, and
|
|
88
|
+
Creates a new vector collection. The index name must start with a letter or underscore and can only contain letters, numbers, and underscore characters. The dimension must be a positive integer.
|
|
89
89
|
|
|
90
90
|
**indexName** (`string`): Name of the index to create
|
|
91
91
|
|
|
@@ -559,7 +559,7 @@ export const mongodbVoyageAgent = new Agent({
|
|
|
559
559
|
})
|
|
560
560
|
```
|
|
561
561
|
|
|
562
|
-
For
|
|
562
|
+
For detailed VoyageAI embedding examples including specialized models, multimodal embeddings, and retrieval optimization, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings).
|
|
563
563
|
|
|
564
564
|
## Related
|
|
565
565
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PG vector store
|
|
4
4
|
|
|
5
|
-
The PgVector class provides vector search using [PostgreSQL](https://www.postgresql.org/) with [pgvector](https://github.com/pgvector/pgvector) extension. It provides
|
|
5
|
+
The PgVector class provides vector search using [PostgreSQL](https://www.postgresql.org/) with [pgvector](https://github.com/pgvector/pgvector) extension. It provides reliable vector similarity search capabilities within your existing PostgreSQL database.
|
|
6
6
|
|
|
7
7
|
## Constructor options
|
|
8
8
|
|
|
@@ -110,13 +110,13 @@ const vectorStore = new PgVector({
|
|
|
110
110
|
|
|
111
111
|
#### Memory Requirements
|
|
112
112
|
|
|
113
|
-
HNSW indexes require
|
|
113
|
+
HNSW indexes require substantial shared memory during construction. For 100K vectors:
|
|
114
114
|
|
|
115
115
|
- Small dimensions (64d): \~60MB with default settings
|
|
116
116
|
- Medium dimensions (256d): \~180MB with default settings
|
|
117
117
|
- Large dimensions (384d+): \~250MB+ with default settings
|
|
118
118
|
|
|
119
|
-
Higher M values or efConstruction values will increase memory requirements
|
|
119
|
+
Higher M values or efConstruction values will increase memory requirements substantially. Adjust your system's shared memory limits if needed.
|
|
120
120
|
|
|
121
121
|
### `upsert()`
|
|
122
122
|
|
|
@@ -340,7 +340,7 @@ The system automatically detects configuration changes and only rebuilds indexes
|
|
|
340
340
|
- Regularly evaluate your index configuration to ensure optimal performance.
|
|
341
341
|
- Adjust parameters like `lists` and `m` based on dataset size and query requirements.
|
|
342
342
|
- **Monitor index performance** using `describeIndex()` to track usage
|
|
343
|
-
- Rebuild indexes periodically to maintain efficiency, especially after
|
|
343
|
+
- Rebuild indexes periodically to maintain efficiency, especially after substantial data changes
|
|
344
344
|
|
|
345
345
|
## Direct pool access
|
|
346
346
|
|
|
@@ -86,7 +86,7 @@ await store.upsert({
|
|
|
86
86
|
|
|
87
87
|
#### Named Vectors
|
|
88
88
|
|
|
89
|
-
Qdrant supports [
|
|
89
|
+
Qdrant supports [multiple vectors per collection](https://qdrant.tech/documentation/concepts/vectors/#named-vectors), with a name assigned to each vector field. Use the `using` parameter to select the vector field to query:
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
const results = await store.query({
|
|
@@ -131,7 +131,7 @@ Update a single vector by ID or by metadata filter. Either `id` or `filter` must
|
|
|
131
131
|
|
|
132
132
|
**update** (`{ vector?: number[]; metadata?: Record<string, any>; }`): Object containing the vector and/or metadata to update
|
|
133
133
|
|
|
134
|
-
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated.
|
|
134
|
+
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated. Providing either value updates that value alone.
|
|
135
135
|
|
|
136
136
|
### `deleteVector()`
|
|
137
137
|
|
|
@@ -205,8 +205,8 @@ S3 Vectors supports a strict subset of operators and value types. The Mastra fil
|
|
|
205
205
|
|
|
206
206
|
- **Canonicalizes implicit AND**: `{a:1,b:2}` → `{ $and: [{a:1},{b:2}] }`.
|
|
207
207
|
- **Normalizes Date values** to epoch ms for numeric comparisons and array elements.
|
|
208
|
-
- **Disallows Date** in equality positions (`field: value` or `$eq/$ne`)
|
|
209
|
-
- **Rejects** null/undefined for equality
|
|
208
|
+
- **Disallows Date** in equality positions (`field: value` or `$eq/$ne`). Equality values must be **string | number | boolean**.
|
|
209
|
+
- **Rejects** null/undefined for equality. **array equality** isn't supported (use `$in`/`$nin`).
|
|
210
210
|
- Only **`$and` / `$or`** are allowed as top-level logical operators.
|
|
211
211
|
- Logical operators must contain **field conditions** (not direct operators).
|
|
212
212
|
|
|
@@ -268,10 +268,10 @@ Typical environment variables when wiring your app:
|
|
|
268
268
|
|
|
269
269
|
## Best practices
|
|
270
270
|
|
|
271
|
-
- Choose the metric (`cosine` or `euclidean`) to match your embedding model
|
|
271
|
+
- Choose the metric (`cosine` or `euclidean`) to match your embedding model. `dotproduct` isn't supported.
|
|
272
272
|
- Keep **filterable** metadata small and structured (string/number/boolean). Store large text (e.g., `content`) as **non-filterable**.
|
|
273
273
|
- Use **dotted paths** for nested metadata and explicit `$and`/`$or` for complex logic.
|
|
274
|
-
- Avoid calling `describeIndex()` on hot paths
|
|
274
|
+
- Avoid calling `describeIndex()` on hot paths. `count` is computed with paginated `ListVectors` (**O(n)**).
|
|
275
275
|
- Use `includeVector: true` only when you need raw vectors.
|
|
276
276
|
|
|
277
277
|
## Related
|