@mastra/mcp-docs-server 1.1.9-alpha.0 → 1.1.9-alpha.2
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/adding-voice.md +4 -4
- package/.docs/docs/agents/agent-approval.md +3 -3
- package/.docs/docs/agents/agent-memory.md +1 -1
- package/.docs/docs/agents/network-approval.md +1 -1
- package/.docs/docs/agents/networks.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +8 -8
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/build-with-ai/mcp-docs-server.md +1 -1
- package/.docs/docs/build-with-ai/skills.md +1 -1
- package/.docs/docs/community/contributing-templates.md +1 -1
- package/.docs/docs/community/discord.md +2 -2
- package/.docs/docs/community/licensing.md +1 -1
- package/.docs/docs/deployment/cloud-providers.md +2 -2
- package/.docs/docs/deployment/mastra-server.md +1 -1
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/studio.md +1 -1
- package/.docs/docs/deployment/web-framework.md +1 -1
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/evals/built-in-scorers.md +1 -1
- package/.docs/docs/evals/custom-scorers.md +6 -6
- package/.docs/docs/evals/overview.md +1 -1
- package/.docs/docs/evals/running-in-ci.md +6 -6
- package/.docs/docs/getting-started/build-with-ai.md +2 -2
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +1 -1
- package/.docs/docs/index.md +1 -1
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +3 -3
- package/.docs/docs/memory/memory-processors.md +8 -8
- package/.docs/docs/memory/message-history.md +2 -2
- package/.docs/docs/memory/observational-memory.md +5 -5
- package/.docs/docs/memory/semantic-recall.md +7 -7
- package/.docs/docs/memory/working-memory.md +14 -14
- package/.docs/docs/observability/datasets/overview.md +1 -1
- package/.docs/docs/observability/datasets/running-experiments.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/overview.md +5 -5
- package/.docs/docs/observability/tracing/bridges/otel.md +7 -7
- package/.docs/docs/observability/tracing/exporters/arize.md +3 -3
- package/.docs/docs/observability/tracing/exporters/braintrust.md +1 -1
- package/.docs/docs/observability/tracing/exporters/cloud.md +2 -2
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -3
- package/.docs/docs/observability/tracing/exporters/default.md +7 -7
- package/.docs/docs/observability/tracing/exporters/laminar.md +1 -1
- package/.docs/docs/observability/tracing/exporters/langfuse.md +3 -3
- package/.docs/docs/observability/tracing/exporters/langsmith.md +4 -4
- package/.docs/docs/observability/tracing/exporters/otel.md +8 -8
- package/.docs/docs/observability/tracing/exporters/posthog.md +2 -2
- package/.docs/docs/observability/tracing/exporters/sentry.md +4 -4
- package/.docs/docs/observability/tracing/overview.md +20 -20
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +11 -11
- package/.docs/docs/rag/chunking-and-embedding.md +4 -4
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +4 -4
- package/.docs/docs/rag/vector-databases.md +11 -11
- package/.docs/docs/server/auth/auth0.md +1 -1
- package/.docs/docs/server/auth/clerk.md +1 -1
- package/.docs/docs/server/auth/composite-auth.md +9 -9
- package/.docs/docs/server/auth/custom-auth-provider.md +12 -12
- package/.docs/docs/server/auth/firebase.md +2 -2
- package/.docs/docs/server/auth/jwt.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +8 -8
- package/.docs/docs/server/auth/supabase.md +1 -1
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/auth.md +1 -1
- package/.docs/docs/server/custom-adapters.md +7 -7
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/request-context.md +2 -2
- package/.docs/docs/server/server-adapters.md +1 -1
- package/.docs/docs/streaming/events.md +1 -1
- package/.docs/docs/streaming/overview.md +1 -1
- package/.docs/docs/streaming/tool-streaming.md +2 -2
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +1 -1
- package/.docs/docs/voice/speech-to-text.md +2 -2
- package/.docs/docs/voice/text-to-speech.md +2 -2
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/error-handling.md +3 -3
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +1 -1
- package/.docs/docs/workspace/overview.md +1 -1
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +2 -2
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +2 -2
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit.md +1 -1
- package/.docs/guides/deployment/digital-ocean.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/next-js.md +1 -1
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/ai-recruiter.md +3 -3
- package/.docs/guides/guide/chef-michel.md +4 -4
- package/.docs/guides/guide/code-review-bot.md +3 -3
- package/.docs/guides/guide/dev-assistant.md +5 -5
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +2 -2
- package/.docs/guides/guide/notes-mcp-server.md +3 -3
- package/.docs/guides/guide/research-assistant.md +4 -4
- package/.docs/guides/guide/research-coordinator.md +1 -1
- package/.docs/guides/guide/stock-agent.md +4 -4
- package/.docs/guides/guide/web-search.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +3 -3
- package/.docs/guides/migrations/network-to-supervisor.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
- package/.docs/guides/migrations/vnext-to-standard-apis.md +1 -1
- package/.docs/models/embeddings.md +4 -4
- package/.docs/models/gateways/custom-gateways.md +4 -4
- package/.docs/models/gateways/netlify.md +1 -1
- package/.docs/models/gateways/openrouter.md +1 -1
- package/.docs/models/gateways/vercel.md +9 -2
- package/.docs/models/gateways.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +3 -3
- package/.docs/models/providers/abacus.md +3 -3
- package/.docs/models/providers/aihubmix.md +3 -3
- package/.docs/models/providers/alibaba-cn.md +3 -3
- package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -3
- package/.docs/models/providers/alibaba-coding-plan.md +3 -3
- package/.docs/models/providers/alibaba.md +3 -3
- package/.docs/models/providers/anthropic.md +4 -4
- package/.docs/models/providers/bailing.md +3 -3
- package/.docs/models/providers/baseten.md +3 -3
- package/.docs/models/providers/berget.md +3 -3
- package/.docs/models/providers/cerebras.md +4 -4
- package/.docs/models/providers/chutes.md +6 -5
- package/.docs/models/providers/clarifai.md +3 -3
- package/.docs/models/providers/cloudferro-sherlock.md +3 -3
- package/.docs/models/providers/cloudflare-workers-ai.md +3 -3
- package/.docs/models/providers/cortecs.md +3 -3
- package/.docs/models/providers/deepinfra.md +4 -4
- package/.docs/models/providers/deepseek.md +3 -3
- package/.docs/models/providers/drun.md +3 -3
- package/.docs/models/providers/evroc.md +3 -3
- package/.docs/models/providers/fastrouter.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +3 -3
- package/.docs/models/providers/firmware.md +3 -3
- package/.docs/models/providers/friendli.md +3 -3
- package/.docs/models/providers/github-models.md +3 -3
- package/.docs/models/providers/google.md +4 -4
- package/.docs/models/providers/groq.md +4 -4
- package/.docs/models/providers/helicone.md +3 -3
- package/.docs/models/providers/huggingface.md +3 -3
- package/.docs/models/providers/iflowcn.md +3 -3
- package/.docs/models/providers/inception.md +3 -3
- package/.docs/models/providers/inference.md +3 -3
- package/.docs/models/providers/io-net.md +3 -3
- package/.docs/models/providers/jiekou.md +3 -3
- package/.docs/models/providers/kilo.md +3 -3
- package/.docs/models/providers/kimi-for-coding.md +4 -4
- package/.docs/models/providers/kuae-cloud-coding-plan.md +3 -3
- package/.docs/models/providers/llama.md +3 -3
- package/.docs/models/providers/lmstudio.md +3 -3
- package/.docs/models/providers/lucidquery.md +3 -3
- package/.docs/models/providers/meganova.md +3 -3
- package/.docs/models/providers/minimax-cn-coding-plan.md +4 -4
- package/.docs/models/providers/minimax-cn.md +4 -4
- package/.docs/models/providers/minimax-coding-plan.md +4 -4
- package/.docs/models/providers/minimax.md +4 -4
- package/.docs/models/providers/mistral.md +4 -4
- package/.docs/models/providers/moark.md +3 -3
- package/.docs/models/providers/modelscope.md +3 -3
- package/.docs/models/providers/moonshotai-cn.md +3 -3
- package/.docs/models/providers/moonshotai.md +3 -3
- package/.docs/models/providers/morph.md +3 -3
- package/.docs/models/providers/nano-gpt.md +25 -23
- package/.docs/models/providers/nebius.md +3 -3
- package/.docs/models/providers/nova.md +3 -3
- package/.docs/models/providers/novita-ai.md +3 -3
- package/.docs/models/providers/nvidia.md +3 -3
- package/.docs/models/providers/ollama-cloud.md +3 -3
- package/.docs/models/providers/openai.md +4 -4
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +3 -3
- package/.docs/models/providers/ovhcloud.md +3 -3
- package/.docs/models/providers/perplexity-agent.md +4 -4
- package/.docs/models/providers/perplexity.md +4 -4
- package/.docs/models/providers/poe.md +3 -3
- package/.docs/models/providers/privatemode-ai.md +3 -3
- package/.docs/models/providers/qihang-ai.md +3 -3
- package/.docs/models/providers/qiniu-ai.md +3 -3
- package/.docs/models/providers/requesty.md +3 -3
- package/.docs/models/providers/scaleway.md +3 -3
- package/.docs/models/providers/siliconflow-cn.md +3 -3
- package/.docs/models/providers/siliconflow.md +3 -3
- package/.docs/models/providers/stackit.md +3 -3
- package/.docs/models/providers/stepfun.md +3 -3
- package/.docs/models/providers/submodel.md +3 -3
- package/.docs/models/providers/synthetic.md +3 -3
- package/.docs/models/providers/togetherai.md +4 -4
- package/.docs/models/providers/upstage.md +3 -3
- package/.docs/models/providers/vivgrid.md +4 -4
- package/.docs/models/providers/vultr.md +3 -3
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/models/providers/xai.md +4 -4
- package/.docs/models/providers/xiaomi.md +3 -3
- package/.docs/models/providers/zai-coding-plan.md +3 -3
- package/.docs/models/providers/zai.md +3 -3
- package/.docs/models/providers/zenmux.md +4 -4
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -3
- package/.docs/models/providers/zhipuai.md +3 -3
- package/.docs/reference/agents/agent.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/network.md +2 -2
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/auth/auth0.md +4 -4
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +4 -4
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +4 -4
- package/.docs/reference/cli/mastra.md +1 -1
- package/.docs/reference/client-js/agents.md +22 -22
- package/.docs/reference/client-js/error-handling.md +2 -2
- package/.docs/reference/client-js/logs.md +2 -2
- package/.docs/reference/client-js/mastra-client.md +1 -1
- package/.docs/reference/client-js/memory.md +6 -6
- package/.docs/reference/client-js/observability.md +4 -4
- package/.docs/reference/client-js/telemetry.md +1 -1
- package/.docs/reference/client-js/tools.md +3 -3
- package/.docs/reference/client-js/vectors.md +2 -2
- package/.docs/reference/client-js/workflows.md +12 -12
- package/.docs/reference/core/getGatewayById.md +1 -1
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getMemory.md +1 -1
- package/.docs/reference/core/getScorer.md +2 -2
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getStoredAgentById.md +2 -2
- package/.docs/reference/core/listMCPServers.md +2 -2
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/core/mastra-model-gateway.md +11 -11
- package/.docs/reference/datasets/dataset.md +1 -1
- package/.docs/reference/deployer.md +4 -4
- package/.docs/reference/evals/answer-relevancy.md +3 -3
- package/.docs/reference/evals/answer-similarity.md +3 -3
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/completeness.md +5 -5
- package/.docs/reference/evals/content-similarity.md +3 -3
- package/.docs/reference/evals/context-precision.md +6 -6
- package/.docs/reference/evals/context-relevance.md +6 -6
- package/.docs/reference/evals/create-scorer.md +7 -7
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/hallucination.md +5 -5
- package/.docs/reference/evals/keyword-coverage.md +3 -3
- package/.docs/reference/evals/mastra-scorer.md +6 -6
- package/.docs/reference/evals/noise-sensitivity.md +9 -9
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/run-evals.md +5 -5
- package/.docs/reference/evals/scorer-utils.md +17 -17
- package/.docs/reference/evals/textual-difference.md +3 -3
- package/.docs/reference/evals/tone-consistency.md +4 -4
- package/.docs/reference/evals/tool-call-accuracy.md +9 -9
- package/.docs/reference/evals/toxicity.md +3 -3
- package/.docs/reference/harness/harness-class.md +1 -1
- package/.docs/reference/memory/clone-utilities.md +7 -7
- package/.docs/reference/memory/cloneThread.md +4 -4
- package/.docs/reference/memory/createThread.md +1 -1
- package/.docs/reference/memory/deleteMessages.md +1 -1
- package/.docs/reference/memory/getThreadById.md +1 -1
- package/.docs/reference/memory/listThreads.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +1 -1
- package/.docs/reference/memory/recall.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +5 -5
- package/.docs/reference/observability/tracing/configuration.md +17 -17
- package/.docs/reference/observability/tracing/exporters/arize.md +4 -4
- package/.docs/reference/observability/tracing/exporters/braintrust.md +3 -3
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/datadog.md +4 -4
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +6 -6
- package/.docs/reference/observability/tracing/exporters/laminar.md +2 -2
- package/.docs/reference/observability/tracing/exporters/langfuse.md +4 -4
- package/.docs/reference/observability/tracing/exporters/langsmith.md +6 -6
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -12
- package/.docs/reference/observability/tracing/exporters/posthog.md +3 -3
- package/.docs/reference/observability/tracing/exporters/sentry.md +5 -5
- package/.docs/reference/observability/tracing/instances.md +9 -9
- package/.docs/reference/observability/tracing/interfaces.md +39 -39
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +5 -5
- package/.docs/reference/observability/tracing/spans.md +13 -13
- package/.docs/reference/processors/processor-interface.md +15 -15
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/rag/database-config.md +8 -8
- package/.docs/reference/rag/document.md +11 -11
- package/.docs/reference/rag/embeddings.md +5 -5
- package/.docs/reference/rag/extract-params.md +8 -8
- package/.docs/reference/rag/graph-rag.md +4 -4
- package/.docs/reference/rag/metadata-filters.md +5 -5
- package/.docs/reference/rag/rerank.md +2 -2
- package/.docs/reference/rag/rerankWithScorer.md +2 -2
- package/.docs/reference/server/express-adapter.md +1 -1
- package/.docs/reference/server/fastify-adapter.md +1 -1
- package/.docs/reference/server/hono-adapter.md +1 -1
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/server/mastra-server.md +16 -16
- package/.docs/reference/server/register-api-route.md +5 -5
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/cloudflare-d1.md +2 -2
- package/.docs/reference/storage/cloudflare.md +2 -2
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +5 -5
- package/.docs/reference/storage/dynamodb.md +5 -5
- package/.docs/reference/storage/lance.md +3 -3
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +5 -5
- package/.docs/reference/storage/mssql.md +3 -3
- package/.docs/reference/storage/overview.md +2 -2
- package/.docs/reference/storage/postgresql.md +5 -5
- package/.docs/reference/storage/upstash.md +3 -3
- package/.docs/reference/streaming/ChunkType.md +13 -13
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -6
- package/.docs/reference/streaming/agents/stream.md +2 -2
- package/.docs/reference/streaming/agents/streamLegacy.md +1 -1
- 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/templates/overview.md +3 -3
- package/.docs/reference/tools/create-tool.md +9 -9
- package/.docs/reference/tools/document-chunker-tool.md +4 -4
- package/.docs/reference/tools/graph-rag-tool.md +7 -7
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +23 -23
- package/.docs/reference/tools/vector-query-tool.md +12 -12
- package/.docs/reference/vectors/astra.md +13 -13
- package/.docs/reference/vectors/chroma.md +16 -16
- package/.docs/reference/vectors/convex.md +15 -15
- package/.docs/reference/vectors/couchbase.md +15 -15
- package/.docs/reference/vectors/duckdb.md +17 -17
- package/.docs/reference/vectors/elasticsearch.md +14 -14
- package/.docs/reference/vectors/lance.md +22 -22
- package/.docs/reference/vectors/libsql.md +15 -15
- package/.docs/reference/vectors/mongodb.md +18 -18
- package/.docs/reference/vectors/opensearch.md +11 -11
- package/.docs/reference/vectors/pg.md +21 -21
- package/.docs/reference/vectors/pinecone.md +15 -15
- package/.docs/reference/vectors/qdrant.md +15 -15
- package/.docs/reference/vectors/s3vectors.md +17 -17
- package/.docs/reference/vectors/turbopuffer.md +14 -14
- package/.docs/reference/vectors/upstash.md +15 -15
- package/.docs/reference/vectors/vectorize.md +16 -16
- package/.docs/reference/voice/azure.md +8 -8
- package/.docs/reference/voice/cloudflare.md +5 -5
- package/.docs/reference/voice/composite-voice.md +5 -5
- package/.docs/reference/voice/deepgram.md +5 -5
- package/.docs/reference/voice/elevenlabs.md +6 -6
- package/.docs/reference/voice/google-gemini-live.md +20 -20
- package/.docs/reference/voice/google.md +9 -9
- package/.docs/reference/voice/mastra-voice.md +17 -17
- package/.docs/reference/voice/murf.md +6 -6
- package/.docs/reference/voice/openai-realtime.md +16 -16
- package/.docs/reference/voice/openai.md +5 -5
- package/.docs/reference/voice/playai.md +5 -5
- package/.docs/reference/voice/sarvam.md +5 -5
- package/.docs/reference/voice/speechify.md +5 -5
- package/.docs/reference/voice/voice.addInstructions.md +2 -2
- package/.docs/reference/voice/voice.addTools.md +2 -2
- package/.docs/reference/voice/voice.answer.md +2 -2
- package/.docs/reference/voice/voice.close.md +2 -2
- package/.docs/reference/voice/voice.connect.md +5 -5
- package/.docs/reference/voice/voice.events.md +2 -2
- package/.docs/reference/voice/voice.getSpeakers.md +3 -3
- package/.docs/reference/voice/voice.listen.md +6 -6
- package/.docs/reference/voice/voice.off.md +2 -2
- package/.docs/reference/voice/voice.on.md +3 -3
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.speak.md +5 -5
- package/.docs/reference/voice/voice.updateConfig.md +3 -3
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run.md +3 -3
- package/.docs/reference/workflows/step.md +2 -2
- package/.docs/reference/workflows/workflow-methods/create-run.md +1 -1
- package/.docs/reference/workflows/workflow.md +1 -1
- package/.docs/reference/workspace/daytona-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/filesystem.md +1 -1
- package/.docs/reference/workspace/gcs-filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +4 -4
- package/.docs/reference/workspace/process-manager.md +2 -2
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +2 -2
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
|
@@ -54,7 +54,7 @@ if (result!.status === 'suspended') {
|
|
|
54
54
|
|
|
55
55
|
**stream.usage** (`Promise<{ inputTokens: number; outputTokens: number; totalTokens: number, reasoningTokens?: number, cacheInputTokens?: number }>`): A promise that resolves to token usage statistics
|
|
56
56
|
|
|
57
|
-
## Stream
|
|
57
|
+
## Stream events
|
|
58
58
|
|
|
59
59
|
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
60
60
|
|
|
@@ -82,7 +82,7 @@ console.log('Token usage:', usage)
|
|
|
82
82
|
console.log('Status:', stream.status)
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
## Stream
|
|
85
|
+
## Stream events
|
|
86
86
|
|
|
87
87
|
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
88
88
|
|
|
@@ -9,7 +9,7 @@ Mastra templates are pre-built project structures that demonstrate specific use
|
|
|
9
9
|
- **Educational resources** - Learn Mastra patterns through real implementations
|
|
10
10
|
- **Quick starts** - Bootstrap projects faster than building from scratch
|
|
11
11
|
|
|
12
|
-
## Using
|
|
12
|
+
## Using templates
|
|
13
13
|
|
|
14
14
|
### Installation
|
|
15
15
|
|
|
@@ -55,7 +55,7 @@ After installation:
|
|
|
55
55
|
|
|
56
56
|
All templates follow this standardized structure:
|
|
57
57
|
|
|
58
|
-
## Creating
|
|
58
|
+
## Creating templates
|
|
59
59
|
|
|
60
60
|
### Requirements
|
|
61
61
|
|
|
@@ -155,7 +155,7 @@ Detailed explanation of the template's functionality and use case.
|
|
|
155
155
|
2. Install dependencies: `npm install`
|
|
156
156
|
3. Run the project: `npm run dev`
|
|
157
157
|
|
|
158
|
-
## Environment
|
|
158
|
+
## Environment variables
|
|
159
159
|
|
|
160
160
|
- `OPENAI_API_KEY`: Your OpenAI API key. Get one at [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
161
161
|
- `ANTHROPIC_API_KEY`: Your Anthropic API key. Get one at [Anthropic Console](https://console.anthropic.com/settings/keys)
|
|
@@ -73,7 +73,7 @@ The tool still returns the full `execute` result to your application, while the
|
|
|
73
73
|
- `type: 'json'`
|
|
74
74
|
- `type: 'content'` with parts like `text`, `image-url`, `image-data`, `file-url`, `file-data`, `file-id`, `image-file-id`, or `custom`
|
|
75
75
|
|
|
76
|
-
## Example with MCP
|
|
76
|
+
## Example with MCP annotations
|
|
77
77
|
|
|
78
78
|
When exposing tools via MCP (Model Context Protocol), you can add annotations to describe tool behavior and customize how clients display the tool. These MCP-specific properties are grouped under the `mcp` property:
|
|
79
79
|
|
|
@@ -152,13 +152,13 @@ The `createTool()` function returns a `Tool` object.
|
|
|
152
152
|
|
|
153
153
|
**Tool** (`object`): An object representing the defined tool, ready to be added to an agent.
|
|
154
154
|
|
|
155
|
-
## Tool
|
|
155
|
+
## Tool lifecycle hooks
|
|
156
156
|
|
|
157
157
|
Tools support lifecycle hooks that allow you to monitor and react to different stages of tool execution. These hooks are particularly useful for logging, analytics, validation, and real-time updates during streaming.
|
|
158
158
|
|
|
159
159
|
### Available Hooks
|
|
160
160
|
|
|
161
|
-
#### onInputStart
|
|
161
|
+
#### `onInputStart`
|
|
162
162
|
|
|
163
163
|
Called when tool call input streaming begins, before any input data is received.
|
|
164
164
|
|
|
@@ -172,7 +172,7 @@ export const tool = createTool({
|
|
|
172
172
|
})
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
#### onInputDelta
|
|
175
|
+
#### `onInputDelta`
|
|
176
176
|
|
|
177
177
|
Called for each incremental chunk of input text as it streams in. Useful for showing real-time progress or parsing partial JSON.
|
|
178
178
|
|
|
@@ -186,7 +186,7 @@ export const tool = createTool({
|
|
|
186
186
|
})
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
#### onInputAvailable
|
|
189
|
+
#### `onInputAvailable`
|
|
190
190
|
|
|
191
191
|
Called when the complete tool input is available and has been parsed and validated against the `inputSchema`.
|
|
192
192
|
|
|
@@ -204,7 +204,7 @@ export const tool = createTool({
|
|
|
204
204
|
})
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
#### onOutput
|
|
207
|
+
#### `onOutput`
|
|
208
208
|
|
|
209
209
|
Called after the tool has successfully executed and returned output. Useful for logging results, triggering follow-up actions, or analytics.
|
|
210
210
|
|
|
@@ -249,11 +249,11 @@ Additionally:
|
|
|
249
249
|
- `onInputAvailable` receives `input`: The validated input data (typed according to `inputSchema`)
|
|
250
250
|
- `onOutput` receives `output`: The tool's return value (typed according to `outputSchema`) and `toolName` (string): The name of the tool
|
|
251
251
|
|
|
252
|
-
### Error
|
|
252
|
+
### Error handling
|
|
253
253
|
|
|
254
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
|
-
## MCP
|
|
256
|
+
## MCP tool annotations
|
|
257
257
|
|
|
258
258
|
When exposing tools via the Model Context Protocol (MCP), you can provide annotations that describe tool behavior. These annotations help MCP clients like OpenAI Apps SDK understand how to present and handle your tools.
|
|
259
259
|
|
|
@@ -266,7 +266,7 @@ mcp: {
|
|
|
266
266
|
}
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
### ToolAnnotations Properties
|
|
269
|
+
### `ToolAnnotations` Properties
|
|
270
270
|
|
|
271
271
|
**title** (`string`): A human-readable title for the tool. Used for display purposes in UI components.
|
|
272
272
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `createDocumentChunkerTool()` function creates a tool for splitting documents into smaller chunks for efficient processing and retrieval. It supports different chunking strategies and configurable parameters.
|
|
4
4
|
|
|
5
|
-
## Basic
|
|
5
|
+
## Basic usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { createDocumentChunkerTool, MDocument } from '@mastra/rag'
|
|
@@ -31,7 +31,7 @@ const { chunks } = await chunker.execute()
|
|
|
31
31
|
|
|
32
32
|
**params** (`ChunkParams`): Configuration parameters for chunking (Default: `Default chunking parameters`)
|
|
33
33
|
|
|
34
|
-
### ChunkParams
|
|
34
|
+
### `ChunkParams`
|
|
35
35
|
|
|
36
36
|
**strategy** (`'recursive'`): The chunking strategy to use (Default: `'recursive'`)
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ const { chunks } = await chunker.execute()
|
|
|
45
45
|
|
|
46
46
|
**chunks** (`DocumentChunk[]`): Array of document chunks with their content and metadata
|
|
47
47
|
|
|
48
|
-
## Example with
|
|
48
|
+
## Example with custom parameters
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
51
|
const technicalDoc = new MDocument({
|
|
@@ -74,7 +74,7 @@ chunks.forEach((chunk, index) => {
|
|
|
74
74
|
})
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
## Tool
|
|
77
|
+
## Tool details
|
|
78
78
|
|
|
79
79
|
The chunker is created as a Mastra tool with the following properties:
|
|
80
80
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `createGraphRAGTool()` creates a tool that enhances RAG by building a graph of semantic relationships between documents. It uses the `GraphRAG` system under the hood to provide graph-based retrieval, finding relevant content through both direct similarity and connected relationships.
|
|
4
4
|
|
|
5
|
-
## Usage
|
|
5
|
+
## Usage example
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { createGraphRAGTool } from '@mastra/rag'
|
|
@@ -61,7 +61,7 @@ The tool returns an object with:
|
|
|
61
61
|
|
|
62
62
|
**sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
|
|
63
63
|
|
|
64
|
-
### QueryResult object structure
|
|
64
|
+
### `QueryResult` object structure
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
{
|
|
@@ -73,7 +73,7 @@ The tool returns an object with:
|
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
## Default
|
|
76
|
+
## Default tool description
|
|
77
77
|
|
|
78
78
|
The default description focuses on:
|
|
79
79
|
|
|
@@ -81,7 +81,7 @@ The default description focuses on:
|
|
|
81
81
|
- Finding patterns and connections
|
|
82
82
|
- Answering complex queries
|
|
83
83
|
|
|
84
|
-
## Advanced
|
|
84
|
+
## Advanced example
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
87
|
const graphTool = createGraphRAGTool({
|
|
@@ -97,7 +97,7 @@ const graphTool = createGraphRAGTool({
|
|
|
97
97
|
})
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
## Example with
|
|
100
|
+
## Example with custom description
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
103
|
const graphTool = createGraphRAGTool({
|
|
@@ -111,7 +111,7 @@ const graphTool = createGraphRAGTool({
|
|
|
111
111
|
|
|
112
112
|
This example shows how to customize the tool description for a specific use case while maintaining its core purpose of relationship analysis.
|
|
113
113
|
|
|
114
|
-
## Example: Using
|
|
114
|
+
## Example: Using request context
|
|
115
115
|
|
|
116
116
|
```typescript
|
|
117
117
|
const graphTool = createGraphRAGTool({
|
|
@@ -147,7 +147,7 @@ For more information on request context, please see:
|
|
|
147
147
|
- [Agent Request Context](https://mastra.ai/docs/server/request-context)
|
|
148
148
|
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
149
149
|
|
|
150
|
-
## Dynamic
|
|
150
|
+
## Dynamic vector store for multi-tenant applications
|
|
151
151
|
|
|
152
152
|
For multi-tenant applications where each tenant has isolated data, you can pass a resolver function instead of a static vector store:
|
|
153
153
|
|
|
@@ -22,7 +22,7 @@ constructor({
|
|
|
22
22
|
|
|
23
23
|
**timeout** (`number`): Global timeout value in milliseconds for all servers unless overridden in individual server configs. (Default: `60000`)
|
|
24
24
|
|
|
25
|
-
### MastraMCPServerDefinition
|
|
25
|
+
### `MastraMCPServerDefinition`
|
|
26
26
|
|
|
27
27
|
Each server in the `servers` map is configured using the `MastraMCPServerDefinition` type. The transport type is detected based on the provided parameters:
|
|
28
28
|
|
|
@@ -55,7 +55,7 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
|
|
|
55
55
|
|
|
56
56
|
## Methods
|
|
57
57
|
|
|
58
|
-
### listTools()
|
|
58
|
+
### `listTools()`
|
|
59
59
|
|
|
60
60
|
Retrieves all tools from all configured servers, with tool names namespaced by their server name (in the format `serverName_toolName`) to prevent conflicts. Intended to be passed onto an Agent definition.
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ Retrieves all tools from all configured servers, with tool names namespaced by t
|
|
|
63
63
|
new Agent({ id: 'agent', tools: await mcp.listTools() })
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
### listToolsets()
|
|
66
|
+
### `listToolsets()`
|
|
67
67
|
|
|
68
68
|
Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations. Intended to be passed dynamically into the generate or stream method.
|
|
69
69
|
|
|
@@ -73,7 +73,7 @@ const res = await agent.stream(prompt, {
|
|
|
73
73
|
})
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
### disconnect()
|
|
76
|
+
### `disconnect()`
|
|
77
77
|
|
|
78
78
|
Disconnects from all MCP servers and cleans up resources.
|
|
79
79
|
|
|
@@ -239,7 +239,7 @@ mcpClient.elicitation.onRequest('serverName', async request => {
|
|
|
239
239
|
|
|
240
240
|
Sets up a handler function that will be called when any connected MCP server sends an elicitation request. The handler receives the request and must return a response.
|
|
241
241
|
|
|
242
|
-
##### ElicitationHandler Function
|
|
242
|
+
##### `ElicitationHandler` Function
|
|
243
243
|
|
|
244
244
|
The handler function receives a request object with:
|
|
245
245
|
|
|
@@ -534,7 +534,7 @@ mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
534
534
|
})
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
### Response
|
|
537
|
+
### Response types
|
|
538
538
|
|
|
539
539
|
Your elicitation handler must return one of three response types:
|
|
540
540
|
|
|
@@ -592,7 +592,7 @@ await mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
592
592
|
})
|
|
593
593
|
```
|
|
594
594
|
|
|
595
|
-
### Best
|
|
595
|
+
### Best practices
|
|
596
596
|
|
|
597
597
|
- **Always handle elicitation**: Set up your handler before calling tools that might use elicitation
|
|
598
598
|
- **Validate input**: Check that required fields are provided
|
|
@@ -600,7 +600,7 @@ await mcpClient.elicitation.onRequest('interactiveServer', async request => {
|
|
|
600
600
|
- **Clear UI**: Make it obvious what information is being requested and why
|
|
601
601
|
- **Security**: Never auto-accept requests for sensitive information
|
|
602
602
|
|
|
603
|
-
## OAuth
|
|
603
|
+
## OAuth authentication
|
|
604
604
|
|
|
605
605
|
For connecting to MCP servers that require OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `MCPOAuthClientProvider`:
|
|
606
606
|
|
|
@@ -819,7 +819,7 @@ const response = await agent.stream('How is AAPL doing and what is the weather?'
|
|
|
819
819
|
})
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
## Instance
|
|
822
|
+
## Instance management
|
|
823
823
|
|
|
824
824
|
The `MCPClient` class includes built-in memory leak prevention for managing multiple instances:
|
|
825
825
|
|
|
@@ -863,7 +863,7 @@ const mcp4 = new MCPClient({
|
|
|
863
863
|
})
|
|
864
864
|
```
|
|
865
865
|
|
|
866
|
-
## Server
|
|
866
|
+
## Server lifecycle
|
|
867
867
|
|
|
868
868
|
MCPClient handles server connections gracefully:
|
|
869
869
|
|
|
@@ -871,7 +871,7 @@ MCPClient handles server connections gracefully:
|
|
|
871
871
|
2. Graceful server shutdown to prevent error messages during development
|
|
872
872
|
3. Proper cleanup of resources when disconnecting
|
|
873
873
|
|
|
874
|
-
## Using
|
|
874
|
+
## Using custom fetch for dynamic authentication
|
|
875
875
|
|
|
876
876
|
For HTTP servers, you can provide a custom `fetch` function to handle dynamic authentication, request interception, or 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.
|
|
877
877
|
|
|
@@ -910,7 +910,7 @@ await agent.generate('Hello!', {
|
|
|
910
910
|
})
|
|
911
911
|
```
|
|
912
912
|
|
|
913
|
-
## Using SSE
|
|
913
|
+
## Using SSE request headers
|
|
914
914
|
|
|
915
915
|
When using the legacy SSE MCP transport, you must configure both `requestInit` and `eventSourceInit` due to a bug in the MCP SDK. Alternatively, you can use a custom `fetch` function which will be automatically used for both POST requests and SSE connections:
|
|
916
916
|
|
|
@@ -959,7 +959,7 @@ const sseClientWithFetch = new MCPClient({
|
|
|
959
959
|
})
|
|
960
960
|
```
|
|
961
961
|
|
|
962
|
-
## Related
|
|
962
|
+
## Related information
|
|
963
963
|
|
|
964
964
|
- For creating MCP servers, see the [MCPServer documentation](https://mastra.ai/reference/tools/mcp-server).
|
|
965
965
|
- For more about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).
|
|
@@ -83,7 +83,7 @@ The constructor accepts an `MCPServerConfig` object with the following propertie
|
|
|
83
83
|
|
|
84
84
|
**prompts** (`MCPServerPrompts`): An object defining how the server should handle MCP prompts. See Prompt Handling section for details.
|
|
85
85
|
|
|
86
|
-
## Exposing
|
|
86
|
+
## Exposing agents as tools
|
|
87
87
|
|
|
88
88
|
A powerful feature of `MCPServer` is its ability to automatically expose your Mastra Agents as callable tools. When you provide agents in the `agents` property of the configuration:
|
|
89
89
|
|
|
@@ -164,7 +164,7 @@ const fetchUserData = createTool({
|
|
|
164
164
|
|
|
165
165
|
These are the functions you can call on an `MCPServer` instance to control its behavior and get information.
|
|
166
166
|
|
|
167
|
-
### startStdio()
|
|
167
|
+
### `startStdio()`
|
|
168
168
|
|
|
169
169
|
Use this method to start the server so it communicates using standard input and output (stdio). This is typical when running the server as a command-line program.
|
|
170
170
|
|
|
@@ -186,7 +186,7 @@ const server = new MCPServer({
|
|
|
186
186
|
await server.startStdio()
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
### startSSE()
|
|
189
|
+
### `startSSE()`
|
|
190
190
|
|
|
191
191
|
This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
|
|
192
192
|
|
|
@@ -238,7 +238,7 @@ Here are the details for the values needed by the `startSSE` method:
|
|
|
238
238
|
|
|
239
239
|
**res** (`any`): The response object from your web server, used to send data back.
|
|
240
240
|
|
|
241
|
-
### startHonoSSE()
|
|
241
|
+
### `startHonoSSE()`
|
|
242
242
|
|
|
243
243
|
This method helps you integrate the MCP server with an existing web server to use Server-Sent Events (SSE) for communication. You'll call this from your web server's code when it receives a request for the SSE or message paths.
|
|
244
244
|
|
|
@@ -290,7 +290,7 @@ Here are the details for the values needed by the `startHonoSSE` method:
|
|
|
290
290
|
|
|
291
291
|
**res** (`any`): The response object from your web server, used to send data back.
|
|
292
292
|
|
|
293
|
-
### startHTTP()
|
|
293
|
+
### `startHTTP()`
|
|
294
294
|
|
|
295
295
|
This method helps you integrate the MCP server with an existing web server to use streamable HTTP for communication. You'll call this from your web server's code when it receives HTTP requests.
|
|
296
296
|
|
|
@@ -424,7 +424,7 @@ The `StreamableHTTPServerTransportOptions` object allows you to customize the be
|
|
|
424
424
|
|
|
425
425
|
**eventStore** (`EventStore`): An event store for message resumability. Providing this enables clients to reconnect and resume message streams.
|
|
426
426
|
|
|
427
|
-
### close()
|
|
427
|
+
### `close()`
|
|
428
428
|
|
|
429
429
|
This method closes the server and releases all resources.
|
|
430
430
|
|
|
@@ -432,7 +432,7 @@ This method closes the server and releases all resources.
|
|
|
432
432
|
async close(): Promise<void>
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
-
### getServerInfo()
|
|
435
|
+
### `getServerInfo()`
|
|
436
436
|
|
|
437
437
|
This method gives you a look at the server's basic information.
|
|
438
438
|
|
|
@@ -440,7 +440,7 @@ This method gives you a look at the server's basic information.
|
|
|
440
440
|
getServerInfo(): ServerInfo
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
-
### getServerDetail()
|
|
443
|
+
### `getServerDetail()`
|
|
444
444
|
|
|
445
445
|
This method gives you a detailed look at the server's information.
|
|
446
446
|
|
|
@@ -448,7 +448,7 @@ This method gives you a detailed look at the server's information.
|
|
|
448
448
|
getServerDetail(): ServerDetail
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
### getToolListInfo()
|
|
451
|
+
### `getToolListInfo()`
|
|
452
452
|
|
|
453
453
|
This method gives you a look at the tools that were set up when you created the server. It's a read-only list, useful for debugging purposes.
|
|
454
454
|
|
|
@@ -456,7 +456,7 @@ This method gives you a look at the tools that were set up when you created the
|
|
|
456
456
|
getToolListInfo(): ToolListInfo
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
-
### getToolInfo()
|
|
459
|
+
### `getToolInfo()`
|
|
460
460
|
|
|
461
461
|
This method gives you detailed information about a specific tool.
|
|
462
462
|
|
|
@@ -464,7 +464,7 @@ This method gives you detailed information about a specific tool.
|
|
|
464
464
|
getToolInfo(toolName: string): ToolInfo
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
### executeTool()
|
|
467
|
+
### `executeTool()`
|
|
468
468
|
|
|
469
469
|
This method executes a specific tool and returns the result.
|
|
470
470
|
|
|
@@ -472,7 +472,7 @@ This method executes a specific tool and returns the result.
|
|
|
472
472
|
executeTool(toolName: string, input: any): Promise<any>
|
|
473
473
|
```
|
|
474
474
|
|
|
475
|
-
### getStdioTransport()
|
|
475
|
+
### `getStdioTransport()`
|
|
476
476
|
|
|
477
477
|
If you started the server with `startStdio()`, you can use this to get the object that manages the stdio communication. This is mostly for checking things internally or for testing.
|
|
478
478
|
|
|
@@ -480,7 +480,7 @@ If you started the server with `startStdio()`, you can use this to get the objec
|
|
|
480
480
|
getStdioTransport(): StdioServerTransport | undefined
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
### getSseTransport()
|
|
483
|
+
### `getSseTransport()`
|
|
484
484
|
|
|
485
485
|
If you started the server with `startSSE()`, you can use this to get the object that manages the SSE communication. Like `getStdioTransport`, this is mainly for internal checks or testing.
|
|
486
486
|
|
|
@@ -488,7 +488,7 @@ If you started the server with `startSSE()`, you can use this to get the object
|
|
|
488
488
|
getSseTransport(): SSEServerTransport | undefined
|
|
489
489
|
```
|
|
490
490
|
|
|
491
|
-
### getSseHonoTransport()
|
|
491
|
+
### `getSseHonoTransport()`
|
|
492
492
|
|
|
493
493
|
If you started the server with `startHonoSSE()`, you can use this to get the object that manages the SSE communication. Like `getSseTransport`, this is mainly for internal checks or testing.
|
|
494
494
|
|
|
@@ -496,7 +496,7 @@ If you started the server with `startHonoSSE()`, you can use this to get the obj
|
|
|
496
496
|
getSseHonoTransport(): SSETransport | undefined
|
|
497
497
|
```
|
|
498
498
|
|
|
499
|
-
### getStreamableHTTPTransport()
|
|
499
|
+
### `getStreamableHTTPTransport()`
|
|
500
500
|
|
|
501
501
|
If you started the server with `startHTTP()`, you can use this to get the object that manages the HTTP communication. Like `getSseTransport`, this is mainly for internal checks or testing.
|
|
502
502
|
|
|
@@ -504,7 +504,7 @@ If you started the server with `startHTTP()`, you can use this to get the object
|
|
|
504
504
|
getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
-
### tools()
|
|
507
|
+
### `tools()`
|
|
508
508
|
|
|
509
509
|
Executes a specific tool provided by this MCP server.
|
|
510
510
|
|
|
@@ -522,7 +522,7 @@ async executeTool(
|
|
|
522
522
|
|
|
523
523
|
**executionContext** (`object`): Optional context for the tool execution, like messages or a toolCallId.
|
|
524
524
|
|
|
525
|
-
## Resource
|
|
525
|
+
## Resource handling
|
|
526
526
|
|
|
527
527
|
### What are MCP Resources?
|
|
528
528
|
|
|
@@ -649,7 +649,7 @@ Example:
|
|
|
649
649
|
await serverWithResources.resources.notifyListChanged()
|
|
650
650
|
```
|
|
651
651
|
|
|
652
|
-
## Prompt
|
|
652
|
+
## Prompt handling
|
|
653
653
|
|
|
654
654
|
### What are MCP Prompts?
|
|
655
655
|
|
|
@@ -758,7 +758,7 @@ Call this method when the overall list of available prompts has changed (e.g., a
|
|
|
758
758
|
await serverWithPrompts.prompts.notifyListChanged()
|
|
759
759
|
```
|
|
760
760
|
|
|
761
|
-
### Best
|
|
761
|
+
### Best practices for Prompt Handling
|
|
762
762
|
|
|
763
763
|
- Use clear, descriptive prompt names and descriptions.
|
|
764
764
|
- Validate all required arguments in `getPromptMessages`.
|
|
@@ -982,7 +982,7 @@ type ElicitResult = {
|
|
|
982
982
|
}
|
|
983
983
|
```
|
|
984
984
|
|
|
985
|
-
## OAuth
|
|
985
|
+
## OAuth protection
|
|
986
986
|
|
|
987
987
|
To protect your MCP server with OAuth authentication per the [MCP Auth Specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization), use the `createOAuthMiddleware` function:
|
|
988
988
|
|
|
@@ -1085,11 +1085,11 @@ const customMiddleware = createOAuthMiddleware({
|
|
|
1085
1085
|
|
|
1086
1086
|
**mcpPath** (`string`): Path where the MCP endpoint is served. Only requests to this path require authentication. (Default: `'/mcp'`)
|
|
1087
1087
|
|
|
1088
|
-
## Authentication
|
|
1088
|
+
## Authentication context
|
|
1089
1089
|
|
|
1090
1090
|
Tools can access request metadata via `context.mcp.extra` when using HTTP-based transports. This allows you to pass authentication info, user context, or any custom data from your HTTP middleware to your MCP tools.
|
|
1091
1091
|
|
|
1092
|
-
### How
|
|
1092
|
+
### How it works
|
|
1093
1093
|
|
|
1094
1094
|
Whatever you set on `req.auth` in your HTTP middleware becomes available as `context.mcp.extra.authInfo` in your tools:
|
|
1095
1095
|
|
|
@@ -1265,7 +1265,7 @@ app.all('/mcp', async (req, res) => {
|
|
|
1265
1265
|
app.listen(3000)
|
|
1266
1266
|
```
|
|
1267
1267
|
|
|
1268
|
-
## Related
|
|
1268
|
+
## Related information
|
|
1269
1269
|
|
|
1270
1270
|
- For connecting to MCP servers in Mastra, see the [MCPClient documentation](https://mastra.ai/reference/tools/mcp-client).
|
|
1271
1271
|
- For more about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with various vector store backends.
|
|
4
4
|
|
|
5
|
-
## Basic
|
|
5
|
+
## Basic usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { createVectorQueryTool } from '@mastra/rag'
|
|
@@ -79,7 +79,7 @@ The tool returns an object with:
|
|
|
79
79
|
|
|
80
80
|
**sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
|
|
81
81
|
|
|
82
|
-
### QueryResult object structure
|
|
82
|
+
### `QueryResult` object structure
|
|
83
83
|
|
|
84
84
|
```typescript
|
|
85
85
|
{
|
|
@@ -91,7 +91,7 @@ The tool returns an object with:
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
## Default
|
|
94
|
+
## Default tool description
|
|
95
95
|
|
|
96
96
|
The default description focuses on:
|
|
97
97
|
|
|
@@ -99,11 +99,11 @@ The default description focuses on:
|
|
|
99
99
|
- Answering user questions
|
|
100
100
|
- Retrieving factual content
|
|
101
101
|
|
|
102
|
-
## Result
|
|
102
|
+
## Result handling
|
|
103
103
|
|
|
104
104
|
The tool determines the number of results to return based on the user's query, with a default of 10 results. This can be adjusted based on the query requirements.
|
|
105
105
|
|
|
106
|
-
## Example with
|
|
106
|
+
## Example with filters
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
const queryTool = createVectorQueryTool({
|
|
@@ -134,7 +134,7 @@ For detailed filter syntax and store-specific capabilities, see the [Metadata Fi
|
|
|
134
134
|
|
|
135
135
|
For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](https://github.com/mastra-ai/mastra/tree/main/examples/basics/rag/filter-rag) example.
|
|
136
136
|
|
|
137
|
-
## Example with
|
|
137
|
+
## Example with reranking
|
|
138
138
|
|
|
139
139
|
```typescript
|
|
140
140
|
const queryTool = createVectorQueryTool({
|
|
@@ -164,7 +164,7 @@ Reranking improves result quality by combining:
|
|
|
164
164
|
|
|
165
165
|
The reranker processes the initial vector search results and returns a reordered list optimized for relevance.
|
|
166
166
|
|
|
167
|
-
## Example with
|
|
167
|
+
## Example with custom description
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
170
|
const queryTool = createVectorQueryTool({
|
|
@@ -178,7 +178,7 @@ const queryTool = createVectorQueryTool({
|
|
|
178
178
|
|
|
179
179
|
This example shows how to customize the tool description for a specific use case while maintaining its core purpose of information retrieval.
|
|
180
180
|
|
|
181
|
-
## Database-
|
|
181
|
+
## Database-specific configuration examples
|
|
182
182
|
|
|
183
183
|
The `databaseConfig` parameter allows you to leverage unique features and optimizations specific to each vector database. These configurations are automatically applied during query execution.
|
|
184
184
|
|
|
@@ -335,7 +335,7 @@ This approach allows you to:
|
|
|
335
335
|
- Adjust performance parameters based on load
|
|
336
336
|
- Apply different filtering strategies per request
|
|
337
337
|
|
|
338
|
-
## Example: Using
|
|
338
|
+
## Example: Using request context
|
|
339
339
|
|
|
340
340
|
```typescript
|
|
341
341
|
const queryTool = createVectorQueryTool({
|
|
@@ -374,7 +374,7 @@ For more information on request context, please see:
|
|
|
374
374
|
- [Agent Request Context](https://mastra.ai/docs/server/request-context)
|
|
375
375
|
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
376
376
|
|
|
377
|
-
## Usage
|
|
377
|
+
## Usage without a Mastra server
|
|
378
378
|
|
|
379
379
|
The tool can be used by itself to retrieve documents matching a query:
|
|
380
380
|
|
|
@@ -401,7 +401,7 @@ const queryResult = await vectorQueryTool.execute({ queryText: 'foo', topK: 1 },
|
|
|
401
401
|
console.log(queryResult.sources)
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
## Dynamic
|
|
404
|
+
## Dynamic vector store for multi-tenant applications
|
|
405
405
|
|
|
406
406
|
For multi-tenant applications where each tenant has isolated data (e.g., separate PostgreSQL schemas), you can pass a resolver function instead of a static vector store instance. The function receives the request context and can return the appropriate vector store for the current tenant:
|
|
407
407
|
|
|
@@ -457,7 +457,7 @@ This pattern is similar to how `Agent.memory` supports dynamic configuration and
|
|
|
457
457
|
- **Database isolation**: Route to different database instances per tenant
|
|
458
458
|
- **Dynamic configuration**: Adjust vector store settings based on request context
|
|
459
459
|
|
|
460
|
-
## Tool
|
|
460
|
+
## Tool details
|
|
461
461
|
|
|
462
462
|
The tool is created with:
|
|
463
463
|
|