@mastra/mcp-docs-server 1.1.8 → 1.1.9-alpha.1
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 +3 -3
- package/.docs/docs/agents/guardrails.md +3 -3
- package/.docs/docs/agents/network-approval.md +5 -2
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/processors.md +42 -24
- package/.docs/docs/agents/structured-output.md +2 -2
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +3 -3
- package/.docs/docs/build-with-ai/mcp-docs-server.md +5 -5
- package/.docs/docs/build-with-ai/skills.md +2 -2
- package/.docs/docs/community/contributing-templates.md +1 -1
- package/.docs/docs/community/discord.md +3 -3
- package/.docs/docs/community/licensing.md +2 -2
- package/.docs/docs/deployment/cloud-providers.md +2 -2
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/monorepo.md +1 -1
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/studio.md +3 -3
- package/.docs/docs/deployment/web-framework.md +2 -2
- 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 +2 -2
- package/.docs/docs/evals/running-in-ci.md +6 -6
- package/.docs/docs/getting-started/build-with-ai.md +3 -3
- package/.docs/docs/getting-started/manual-install.md +1 -1
- package/.docs/docs/getting-started/project-structure.md +2 -2
- package/.docs/docs/index.md +63 -17
- package/.docs/docs/mastra-cloud/deployment.md +1 -1
- package/.docs/docs/mastra-cloud/studio.md +1 -1
- package/.docs/docs/mcp/overview.md +1 -1
- package/.docs/docs/mcp/publishing-mcp-server.md +4 -4
- package/.docs/docs/memory/memory-processors.md +9 -9
- package/.docs/docs/memory/message-history.md +4 -4
- package/.docs/docs/memory/observational-memory.md +11 -7
- package/.docs/docs/memory/semantic-recall.md +9 -9
- package/.docs/docs/memory/storage.md +1 -1
- package/.docs/docs/memory/working-memory.md +20 -20
- 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 +9 -9
- 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 +8 -8
- 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 +24 -24
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +13 -13
- package/.docs/docs/rag/chunking-and-embedding.md +5 -5
- package/.docs/docs/rag/overview.md +2 -2
- package/.docs/docs/rag/retrieval.md +4 -4
- package/.docs/docs/rag/vector-databases.md +13 -13
- package/.docs/docs/server/auth/auth0.md +2 -2
- 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 +3 -3
- package/.docs/docs/server/auth/jwt.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +9 -9
- package/.docs/docs/server/auth/supabase.md +1 -1
- package/.docs/docs/server/auth/workos.md +1 -1
- package/.docs/docs/server/auth.md +2 -2
- 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 +2 -2
- package/.docs/docs/server/mastra-server.md +2 -2
- package/.docs/docs/server/request-context.md +2 -2
- package/.docs/docs/server/server-adapters.md +3 -3
- package/.docs/docs/streaming/events.md +2 -2
- package/.docs/docs/streaming/overview.md +2 -2
- package/.docs/docs/streaming/tool-streaming.md +46 -32
- package/.docs/docs/streaming/workflow-streaming.md +1 -1
- 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 +45 -3
- package/.docs/docs/workflows/error-handling.md +4 -4
- package/.docs/docs/workflows/overview.md +3 -3
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +3 -3
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/docs/workspace/filesystem.md +3 -3
- package/.docs/docs/workspace/overview.md +53 -8
- package/.docs/docs/workspace/sandbox.md +72 -13
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +4 -4
- 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 +2 -2
- package/.docs/guides/deployment/digital-ocean.md +1 -1
- package/.docs/guides/deployment/inngest.md +4 -4
- 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 +4 -4
- 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 +4 -4
- package/.docs/guides/guide/notes-mcp-server.md +4 -4
- 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 +6 -6
- package/.docs/guides/guide/web-search.md +2 -2
- package/.docs/guides/guide/whatsapp-chat-bot.md +1 -1
- package/.docs/guides/migrations/agentnetwork.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/client.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +2 -2
- 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/memory.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +4 -4
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +2 -2
- 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 +6 -6
- package/.docs/guides/migrations/vnext-to-standard-apis.md +3 -3
- package/.docs/models/embeddings.md +4 -4
- package/.docs/models/gateways/custom-gateways.md +4 -4
- package/.docs/models/gateways/netlify.md +2 -3
- package/.docs/models/gateways/openrouter.md +9 -2
- package/.docs/models/gateways/vercel.md +11 -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 +24 -14
- package/.docs/models/providers/aihubmix.md +10 -5
- package/.docs/models/providers/alibaba-cn.md +83 -74
- package/.docs/models/providers/alibaba-coding-plan-cn.md +78 -0
- package/.docs/models/providers/alibaba-coding-plan.md +78 -0
- package/.docs/models/providers/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 +7 -6
- package/.docs/models/providers/clarifai.md +81 -0
- package/.docs/models/providers/cloudferro-sherlock.md +8 -7
- package/.docs/models/providers/cloudflare-workers-ai.md +6 -5
- package/.docs/models/providers/cortecs.md +10 -8
- package/.docs/models/providers/deepinfra.md +11 -6
- package/.docs/models/providers/deepseek.md +4 -4
- package/.docs/models/providers/drun.md +73 -0
- 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 +31 -23
- package/.docs/models/providers/friendli.md +3 -3
- package/.docs/models/providers/github-models.md +3 -3
- package/.docs/models/providers/google.md +7 -5
- 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 +7 -5
- 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 +6 -4
- 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 +523 -42
- package/.docs/models/providers/nebius.md +37 -37
- package/.docs/models/providers/nova.md +3 -3
- package/.docs/models/providers/novita-ai.md +3 -3
- package/.docs/models/providers/nvidia.md +7 -5
- package/.docs/models/providers/ollama-cloud.md +4 -5
- package/.docs/models/providers/openai.md +7 -5
- package/.docs/models/providers/opencode-go.md +3 -3
- package/.docs/models/providers/opencode.md +39 -36
- 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 +11 -5
- 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 +23 -8
- package/.docs/models/providers/requesty.md +20 -4
- package/.docs/models/providers/scaleway.md +3 -3
- package/.docs/models/providers/siliconflow-cn.md +10 -4
- 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 +5 -7
- 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 +34 -31
- package/.docs/models/providers/xiaomi.md +4 -4
- package/.docs/models/providers/zai-coding-plan.md +3 -3
- package/.docs/models/providers/zai.md +3 -3
- package/.docs/models/providers/zenmux.md +7 -5
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -3
- package/.docs/models/providers/zhipuai.md +3 -3
- package/.docs/models/providers.md +4 -0
- package/.docs/reference/agents/agent.md +3 -3
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/agents/getDefaultGenerateOptions.md +1 -1
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/getDescription.md +1 -1
- package/.docs/reference/agents/network.md +5 -3
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.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/auth/auth0.md +7 -7
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +5 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +6 -6
- package/.docs/reference/cli/mastra.md +5 -5
- 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 +2 -2
- 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/configuration.md +62 -6
- package/.docs/reference/core/getDeployer.md +1 -1
- package/.docs/reference/core/getGatewayById.md +1 -1
- package/.docs/reference/core/getLogger.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 +4 -4
- package/.docs/reference/core/getScorerById.md +2 -2
- package/.docs/reference/core/getServer.md +1 -1
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getStoredAgentById.md +3 -3
- package/.docs/reference/core/getTelemetry.md +1 -1
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listAgents.md +1 -1
- package/.docs/reference/core/listMCPServers.md +3 -3
- package/.docs/reference/core/listMemory.md +1 -1
- package/.docs/reference/core/listScorers.md +1 -1
- package/.docs/reference/core/listStoredAgents.md +3 -3
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +2 -2
- package/.docs/reference/core/mastra-model-gateway.md +11 -11
- package/.docs/reference/core/setLogger.md +1 -1
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/datasets/dataset.md +2 -2
- package/.docs/reference/datasets/datasets-manager.md +1 -1
- package/.docs/reference/datasets/get.md +2 -2
- package/.docs/reference/datasets/getDetails.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/vercel.md +1 -1
- package/.docs/reference/deployer.md +4 -4
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/answer-similarity.md +3 -3
- package/.docs/reference/evals/bias.md +4 -4
- package/.docs/reference/evals/completeness.md +6 -6
- package/.docs/reference/evals/content-similarity.md +3 -3
- package/.docs/reference/evals/context-precision.md +9 -9
- package/.docs/reference/evals/context-relevance.md +7 -7
- package/.docs/reference/evals/create-scorer.md +7 -7
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/hallucination.md +8 -14
- package/.docs/reference/evals/keyword-coverage.md +4 -4
- package/.docs/reference/evals/mastra-scorer.md +7 -7
- package/.docs/reference/evals/noise-sensitivity.md +11 -11
- 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 +4 -4
- package/.docs/reference/evals/tone-consistency.md +5 -5
- package/.docs/reference/evals/tool-call-accuracy.md +10 -10
- package/.docs/reference/evals/toxicity.md +3 -3
- package/.docs/reference/harness/harness-class.md +5 -3
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/memory/clone-utilities.md +7 -7
- package/.docs/reference/memory/cloneThread.md +5 -5
- 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 +8 -6
- package/.docs/reference/memory/recall.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +6 -6
- 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 +6 -6
- package/.docs/reference/observability/tracing/spans.md +15 -13
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +21 -17
- package/.docs/reference/processors/token-limiter-processor.md +2 -2
- 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 +15 -15
- package/.docs/reference/rag/rerank.md +2 -2
- package/.docs/reference/rag/rerankWithScorer.md +2 -2
- package/.docs/reference/server/create-route.md +2 -0
- 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 +2 -2
- package/.docs/reference/server/mastra-server.md +16 -16
- package/.docs/reference/server/register-api-route.md +7 -7
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/storage/cloudflare-d1.md +5 -5
- package/.docs/reference/storage/cloudflare.md +3 -3
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +6 -6
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +5 -5
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/mongodb.md +6 -6
- package/.docs/reference/storage/mssql.md +4 -4
- package/.docs/reference/storage/overview.md +2 -2
- package/.docs/reference/storage/postgresql.md +7 -7
- package/.docs/reference/storage/upstash.md +4 -4
- 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 +2 -2
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/templates/overview.md +4 -4
- package/.docs/reference/tools/create-tool.md +10 -10
- 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 +27 -27
- package/.docs/reference/tools/vector-query-tool.md +12 -12
- package/.docs/reference/vectors/astra.md +13 -13
- package/.docs/reference/vectors/chroma.md +18 -18
- package/.docs/reference/vectors/convex.md +15 -15
- package/.docs/reference/vectors/couchbase.md +21 -21
- 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 +23 -21
- package/.docs/reference/vectors/pinecone.md +15 -15
- package/.docs/reference/vectors/qdrant.md +15 -15
- package/.docs/reference/vectors/s3vectors.md +22 -22
- 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 +12 -10
- package/.docs/reference/voice/cloudflare.md +9 -7
- package/.docs/reference/voice/composite-voice.md +5 -5
- package/.docs/reference/voice/deepgram.md +5 -5
- package/.docs/reference/voice/elevenlabs.md +7 -7
- package/.docs/reference/voice/google-gemini-live.md +22 -22
- package/.docs/reference/voice/google.md +12 -12
- package/.docs/reference/voice/mastra-voice.md +18 -18
- package/.docs/reference/voice/murf.md +8 -8
- package/.docs/reference/voice/openai-realtime.md +19 -17
- package/.docs/reference/voice/openai.md +12 -8
- package/.docs/reference/voice/playai.md +9 -7
- package/.docs/reference/voice/sarvam.md +8 -6
- package/.docs/reference/voice/speechify.md +11 -9
- package/.docs/reference/voice/voice.addInstructions.md +4 -4
- package/.docs/reference/voice/voice.addTools.md +3 -3
- package/.docs/reference/voice/voice.answer.md +2 -2
- package/.docs/reference/voice/voice.close.md +4 -4
- package/.docs/reference/voice/voice.connect.md +9 -7
- package/.docs/reference/voice/voice.events.md +4 -4
- package/.docs/reference/voice/voice.getSpeakers.md +4 -4
- package/.docs/reference/voice/voice.listen.md +17 -11
- package/.docs/reference/voice/voice.off.md +4 -4
- package/.docs/reference/voice/voice.on.md +5 -5
- package/.docs/reference/voice/voice.send.md +2 -2
- package/.docs/reference/voice/voice.speak.md +19 -9
- package/.docs/reference/voice/voice.updateConfig.md +4 -4
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.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/blaxel-sandbox.md +164 -0
- package/.docs/reference/workspace/daytona-sandbox.md +50 -141
- package/.docs/reference/workspace/e2b-sandbox.md +41 -77
- package/.docs/reference/workspace/filesystem.md +25 -11
- package/.docs/reference/workspace/gcs-filesystem.md +21 -1
- package/.docs/reference/workspace/local-filesystem.md +24 -10
- package/.docs/reference/workspace/local-sandbox.md +27 -102
- package/.docs/reference/workspace/process-manager.md +296 -0
- package/.docs/reference/workspace/s3-filesystem.md +21 -1
- package/.docs/reference/workspace/sandbox.md +9 -1
- package/.docs/reference/workspace/workspace-class.md +95 -27
- package/CHANGELOG.md +15 -0
- package/dist/tools/course.d.ts +7 -27
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts +6 -18
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +12 -112
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/dist/tools/migration.d.ts +6 -26
- package/dist/tools/migration.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Agents API provides methods to interact with Mastra AI agents, including generating responses, streaming interactions, and managing agent tools.
|
|
4
4
|
|
|
5
|
-
## Getting
|
|
5
|
+
## Getting all agents
|
|
6
6
|
|
|
7
7
|
Retrieve a list of all available agents:
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ const agents = await mastraClient.listAgents()
|
|
|
12
12
|
|
|
13
13
|
Returns a record of agent IDs to their serialized agent configurations.
|
|
14
14
|
|
|
15
|
-
## Working with a
|
|
15
|
+
## Working with a specific agent
|
|
16
16
|
|
|
17
17
|
Get an instance of a specific agent by its ID:
|
|
18
18
|
|
|
@@ -26,9 +26,9 @@ export const myAgent = new Agent({
|
|
|
26
26
|
const agent = mastraClient.getAgent('my-agent')
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
## Agent
|
|
29
|
+
## Agent methods
|
|
30
30
|
|
|
31
|
-
### details()
|
|
31
|
+
### `details()`
|
|
32
32
|
|
|
33
33
|
Retrieve detailed information about an agent:
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Retrieve detailed information about an agent:
|
|
|
36
36
|
const details = await agent.details()
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
### generate()
|
|
39
|
+
### `generate()`
|
|
40
40
|
|
|
41
41
|
Generate a response from the agent:
|
|
42
42
|
|
|
@@ -69,7 +69,7 @@ const response = await agent.generate('Hello, how are you?', {
|
|
|
69
69
|
})
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
### stream()
|
|
72
|
+
### `stream()`
|
|
73
73
|
|
|
74
74
|
Stream responses from the agent for real-time interactions:
|
|
75
75
|
|
|
@@ -151,7 +151,7 @@ for await (const part of uiMessageStream) {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
### getTool()
|
|
154
|
+
### `getTool()`
|
|
155
155
|
|
|
156
156
|
Retrieve information about a specific tool available to the agent:
|
|
157
157
|
|
|
@@ -159,7 +159,7 @@ Retrieve information about a specific tool available to the agent:
|
|
|
159
159
|
const tool = await agent.getTool('tool-id')
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
### executeTool()
|
|
162
|
+
### `executeTool()`
|
|
163
163
|
|
|
164
164
|
Execute a specific tool for the agent:
|
|
165
165
|
|
|
@@ -169,7 +169,7 @@ const result = await agent.executeTool('tool-id', {
|
|
|
169
169
|
})
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
### network()
|
|
172
|
+
### `network()`
|
|
173
173
|
|
|
174
174
|
Stream responses from an agent network for multi-agent interactions:
|
|
175
175
|
|
|
@@ -183,7 +183,7 @@ response.processDataStream({
|
|
|
183
183
|
})
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
### approveToolCall()
|
|
186
|
+
### `approveToolCall()`
|
|
187
187
|
|
|
188
188
|
Approve a pending tool call that requires human confirmation:
|
|
189
189
|
|
|
@@ -200,7 +200,7 @@ response.processDataStream({
|
|
|
200
200
|
})
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
### declineToolCall()
|
|
203
|
+
### `declineToolCall()`
|
|
204
204
|
|
|
205
205
|
Decline a pending tool call that requires human confirmation:
|
|
206
206
|
|
|
@@ -217,7 +217,7 @@ response.processDataStream({
|
|
|
217
217
|
})
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
### approveToolCallGenerate()
|
|
220
|
+
### `approveToolCallGenerate()`
|
|
221
221
|
|
|
222
222
|
Approve a pending tool call when using `generate()` (non-streaming). Returns the complete response:
|
|
223
223
|
|
|
@@ -236,7 +236,7 @@ if (output.finishReason === 'suspended') {
|
|
|
236
236
|
}
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
-
### declineToolCallGenerate()
|
|
239
|
+
### `declineToolCallGenerate()`
|
|
240
240
|
|
|
241
241
|
Decline a pending tool call when using `generate()` (non-streaming). Returns the complete response:
|
|
242
242
|
|
|
@@ -255,7 +255,7 @@ if (output.finishReason === 'suspended') {
|
|
|
255
255
|
}
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
## Client
|
|
258
|
+
## Client tools
|
|
259
259
|
|
|
260
260
|
Client-side tools allow you to execute custom functions on the client side when the agent requests them.
|
|
261
261
|
|
|
@@ -306,11 +306,11 @@ response.processDataStream({
|
|
|
306
306
|
})
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
-
## Stored
|
|
309
|
+
## Stored agents
|
|
310
310
|
|
|
311
311
|
Stored agents are agent configurations stored in a database that can be created, updated, and deleted at runtime. They reference primitives (tools, workflows, other agents, memory, scorers) by key, which are resolved from the Mastra registry when the agent is instantiated.
|
|
312
312
|
|
|
313
|
-
### listStoredAgents()
|
|
313
|
+
### `listStoredAgents()`
|
|
314
314
|
|
|
315
315
|
Retrieve a paginated list of all stored agents:
|
|
316
316
|
|
|
@@ -333,7 +333,7 @@ const result = await mastraClient.listStoredAgents({
|
|
|
333
333
|
})
|
|
334
334
|
```
|
|
335
335
|
|
|
336
|
-
### createStoredAgent()
|
|
336
|
+
### `createStoredAgent()`
|
|
337
337
|
|
|
338
338
|
Create a new stored agent:
|
|
339
339
|
|
|
@@ -380,7 +380,7 @@ const agent = await mastraClient.createStoredAgent({
|
|
|
380
380
|
})
|
|
381
381
|
```
|
|
382
382
|
|
|
383
|
-
### getStoredAgent()
|
|
383
|
+
### `getStoredAgent()`
|
|
384
384
|
|
|
385
385
|
Get an instance of a specific stored agent:
|
|
386
386
|
|
|
@@ -388,9 +388,9 @@ Get an instance of a specific stored agent:
|
|
|
388
388
|
const storedAgent = mastraClient.getStoredAgent('my-agent')
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
## Stored
|
|
391
|
+
## Stored agent methods
|
|
392
392
|
|
|
393
|
-
### details()
|
|
393
|
+
### `details()`
|
|
394
394
|
|
|
395
395
|
Retrieve the stored agent configuration:
|
|
396
396
|
|
|
@@ -401,7 +401,7 @@ console.log(details.instructions)
|
|
|
401
401
|
console.log(details.model)
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
### update()
|
|
404
|
+
### `update()`
|
|
405
405
|
|
|
406
406
|
Update specific fields of a stored agent. All fields are optional:
|
|
407
407
|
|
|
@@ -427,7 +427,7 @@ await storedAgent.update({
|
|
|
427
427
|
})
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
### delete()
|
|
430
|
+
### `delete()`
|
|
431
431
|
|
|
432
432
|
Delete a stored agent:
|
|
433
433
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Logs API provides methods to access and query system logs and debugging information in Mastra.
|
|
4
4
|
|
|
5
|
-
## Getting
|
|
5
|
+
## Getting logs
|
|
6
6
|
|
|
7
7
|
Retrieve system logs with optional filtering:
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ const logs = await mastraClient.listLogs({
|
|
|
12
12
|
})
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Getting
|
|
15
|
+
## Getting logs for a specific run
|
|
16
16
|
|
|
17
17
|
Retrieve logs for a specific execution run:
|
|
18
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Mastra
|
|
1
|
+
# Mastra client SDK
|
|
2
2
|
|
|
3
|
-
The Mastra Client SDK provides a
|
|
3
|
+
The Mastra Client SDK provides a type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/deployment/mastra-server) from your client environment.
|
|
4
4
|
|
|
5
5
|
## Usage example
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Memory API provides methods to manage conversation threads and message history in Mastra.
|
|
4
4
|
|
|
5
|
-
## Get
|
|
5
|
+
## Get all threads
|
|
6
6
|
|
|
7
7
|
Retrieve all memory threads for a specific resource:
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ const threads = await mastraClient.getMemoryThreads({
|
|
|
15
15
|
|
|
16
16
|
When `agentId` is omitted and storage is configured on the server, threads will be retrieved using storage directly. This is useful when multiple agents share the same threads (e.g., in workflows with multiple agent steps).
|
|
17
17
|
|
|
18
|
-
## Create a
|
|
18
|
+
## Create a new thread
|
|
19
19
|
|
|
20
20
|
Create a new memory thread:
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ const thread = await mastraClient.createMemoryThread({
|
|
|
28
28
|
})
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Working with a
|
|
31
|
+
## Working with a specific thread
|
|
32
32
|
|
|
33
33
|
Get an instance of a specific memory thread:
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Get an instance of a specific memory thread:
|
|
|
36
36
|
const thread = mastraClient.getMemoryThread({ threadId: 'thread-id', agentId: 'agent-id' })
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
## Thread
|
|
39
|
+
## Thread methods
|
|
40
40
|
|
|
41
41
|
### Get Thread Details
|
|
42
42
|
|
|
@@ -105,7 +105,7 @@ The clone response includes:
|
|
|
105
105
|
- `thread`: The newly created cloned thread with clone metadata
|
|
106
106
|
- `clonedMessages`: Array of the cloned messages with new IDs
|
|
107
107
|
|
|
108
|
-
## Message
|
|
108
|
+
## Message operations
|
|
109
109
|
|
|
110
110
|
### Save Messages
|
|
111
111
|
|
|
@@ -168,7 +168,7 @@ const result = await thread.deleteMessages(['message-1', 'message-2', 'message-3
|
|
|
168
168
|
// Returns: { success: true, message: "Message deleted successfully" }
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
## Working
|
|
171
|
+
## Working memory
|
|
172
172
|
|
|
173
173
|
Working memory allows agents to maintain persistent information about users across interactions. It can be scoped to either a specific thread or across all threads for a resource (user).
|
|
174
174
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Observability API provides methods to retrieve traces, monitor your application's performance, and score traces for evaluation. This helps you understand how your AI agents and workflows are performing.
|
|
4
4
|
|
|
5
|
-
## Getting a
|
|
5
|
+
## Getting a specific trace
|
|
6
6
|
|
|
7
7
|
Retrieve a specific trace by its ID, including all its spans and details:
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Retrieve a specific trace by its ID, including all its spans and details:
|
|
|
10
10
|
const trace = await mastraClient.getTrace('trace-id-123')
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
## Getting
|
|
13
|
+
## Getting traces with filtering
|
|
14
14
|
|
|
15
15
|
Retrieve a paginated list of trace root spans with optional filtering:
|
|
16
16
|
|
|
@@ -39,7 +39,7 @@ console.log(`Total pages: ${traces.pagination.totalPages}`)
|
|
|
39
39
|
const completeTrace = await mastraClient.getTrace(traces.spans[0].traceId)
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
## Scoring
|
|
42
|
+
## Scoring traces
|
|
43
43
|
|
|
44
44
|
Score specific traces using registered scorers for evaluation:
|
|
45
45
|
|
|
@@ -53,7 +53,7 @@ const result = await mastraClient.score({
|
|
|
53
53
|
})
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
## Getting
|
|
56
|
+
## Getting scores by span
|
|
57
57
|
|
|
58
58
|
Retrieve scores for a specific span within a trace:
|
|
59
59
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Telemetry API provides methods to retrieve and analyze traces from your Mastra application. This helps you monitor and debug your application's behavior and performance.
|
|
4
4
|
|
|
5
|
-
## Getting
|
|
5
|
+
## Getting traces
|
|
6
6
|
|
|
7
7
|
Retrieve traces with optional filtering and pagination:
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Tools API provides methods to interact with and execute tools available in the Mastra platform.
|
|
4
4
|
|
|
5
|
-
## Getting
|
|
5
|
+
## Getting all tools
|
|
6
6
|
|
|
7
7
|
Retrieve a list of all available tools:
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Retrieve a list of all available tools:
|
|
|
10
10
|
const tools = await mastraClient.listTools()
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
## Working with a
|
|
13
|
+
## Working with a specific tool
|
|
14
14
|
|
|
15
15
|
Get an instance of a specific tool:
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Get an instance of a specific tool:
|
|
|
18
18
|
const tool = mastraClient.getTool('tool-id')
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
## Tool
|
|
21
|
+
## Tool methods
|
|
22
22
|
|
|
23
23
|
### Get Tool Details
|
|
24
24
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Vectors API provides methods to work with vector embeddings for semantic search and similarity matching in Mastra.
|
|
4
4
|
|
|
5
|
-
## Working with
|
|
5
|
+
## Working with vectors
|
|
6
6
|
|
|
7
7
|
Get an instance of a vector store:
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Get an instance of a vector store:
|
|
|
10
10
|
const vector = mastraClient.getVector('vector-name')
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
## Vector
|
|
13
|
+
## Vector methods
|
|
14
14
|
|
|
15
15
|
### Get Vector Index Details
|
|
16
16
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The Workflows API provides methods to interact with and execute automated workflows in Mastra.
|
|
4
4
|
|
|
5
|
-
## Getting
|
|
5
|
+
## Getting all workflows
|
|
6
6
|
|
|
7
7
|
Retrieve a list of all available workflows:
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Retrieve a list of all available workflows:
|
|
|
10
10
|
const workflows = await mastraClient.listWorkflows()
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
## Working with a
|
|
13
|
+
## Working with a specific workflow
|
|
14
14
|
|
|
15
15
|
Get an instance of a specific workflow by its ID:
|
|
16
16
|
|
|
@@ -24,9 +24,9 @@ export const testWorkflow = createWorkflow({
|
|
|
24
24
|
const workflow = mastraClient.getWorkflow('city-workflow')
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
## Workflow
|
|
27
|
+
## Workflow methods
|
|
28
28
|
|
|
29
|
-
### details()
|
|
29
|
+
### `details()`
|
|
30
30
|
|
|
31
31
|
Retrieve detailed information about a workflow:
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ Retrieve detailed information about a workflow:
|
|
|
34
34
|
const details = await workflow.details()
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### createRun()
|
|
37
|
+
### `createRun()`
|
|
38
38
|
|
|
39
39
|
Create a new workflow run instance:
|
|
40
40
|
|
|
@@ -53,7 +53,7 @@ const run = await workflow.createRun({
|
|
|
53
53
|
|
|
54
54
|
The `resourceId` parameter associates the workflow run with a specific resource (e.g., user ID, tenant ID). This value is persisted with the run and can be used for filtering and querying runs later.
|
|
55
55
|
|
|
56
|
-
### startAsync()
|
|
56
|
+
### `startAsync()`
|
|
57
57
|
|
|
58
58
|
Start a workflow run and await the full result:
|
|
59
59
|
|
|
@@ -95,7 +95,7 @@ const result = await run.startAsync({
|
|
|
95
95
|
})
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
### start()
|
|
98
|
+
### `start()`
|
|
99
99
|
|
|
100
100
|
Start a workflow run without waiting for completion:
|
|
101
101
|
|
|
@@ -114,7 +114,7 @@ const result = await workflow.runById(run.runId)
|
|
|
114
114
|
|
|
115
115
|
This is useful for long-running workflows where you want to start execution and check results later.
|
|
116
116
|
|
|
117
|
-
### resumeAsync()
|
|
117
|
+
### `resumeAsync()`
|
|
118
118
|
|
|
119
119
|
Resume a suspended workflow step and await the full result:
|
|
120
120
|
|
|
@@ -127,7 +127,7 @@ const result = await run.resumeAsync({
|
|
|
127
127
|
})
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
### resume()
|
|
130
|
+
### `resume()`
|
|
131
131
|
|
|
132
132
|
Resume a suspended workflow step without waiting for completion:
|
|
133
133
|
|
|
@@ -140,7 +140,7 @@ await run.resume({
|
|
|
140
140
|
})
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
### cancel()
|
|
143
|
+
### `cancel()`
|
|
144
144
|
|
|
145
145
|
Cancel a running workflow:
|
|
146
146
|
|
|
@@ -155,7 +155,7 @@ This method stops any running steps and prevents subsequent steps from executing
|
|
|
155
155
|
|
|
156
156
|
See the [Run.cancel()](https://mastra.ai/reference/workflows/run-methods/cancel) reference for detailed information about how cancellation works and how to write steps that respond to cancellation.
|
|
157
157
|
|
|
158
|
-
### stream()
|
|
158
|
+
### `stream()`
|
|
159
159
|
|
|
160
160
|
Stream workflow execution for real-time updates:
|
|
161
161
|
|
|
@@ -173,7 +173,7 @@ for await (const chunk of stream) {
|
|
|
173
173
|
}
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
### runById()
|
|
176
|
+
### `runById()`
|
|
177
177
|
|
|
178
178
|
Get the execution result for a workflow run:
|
|
179
179
|
|
|
@@ -59,7 +59,7 @@ export const mastra = new Mastra({
|
|
|
59
59
|
|
|
60
60
|
Event handlers for the internal pub/sub system. Maps event topics to handler functions that are called when events are published to those topics.
|
|
61
61
|
|
|
62
|
-
> **Warning:** This is used internally by Mastra's workflow engine. Most users
|
|
62
|
+
> **Warning:** This is used internally by Mastra's workflow engine. Most users won't need to configure this option.
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
65
|
import { Mastra } from '@mastra/core'
|
|
@@ -94,19 +94,39 @@ export const mastra = new Mastra({
|
|
|
94
94
|
|
|
95
95
|
### idGenerator
|
|
96
96
|
|
|
97
|
-
**Type:** `() => string`\
|
|
97
|
+
**Type:** `(context?: IdGeneratorContext) => string`\
|
|
98
98
|
**Default:** `crypto.randomUUID()`
|
|
99
99
|
|
|
100
|
-
Custom ID generator function for creating unique identifiers.
|
|
100
|
+
Custom ID generator function for creating unique identifiers. Mastra passes optional context so you can generate IDs based on what's being created.
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
`IdGeneratorContext` includes:
|
|
103
|
+
|
|
104
|
+
- `idType`: `'thread' | 'message' | 'run' | 'step' | 'generic'`
|
|
105
|
+
- `source?`: `'agent' | 'workflow' | 'memory'`
|
|
106
|
+
- `entityId?`: ID of the requesting agent/workflow/memory entity
|
|
107
|
+
- `threadId?`: Thread ID when relevant (for example, when creating message IDs)
|
|
108
|
+
- `resourceId?`: Resource ID when relevant (for example, user-scoped threads)
|
|
109
|
+
- `role?`: Message role when creating a message ID
|
|
110
|
+
- `stepType?`: Workflow step type when creating a step ID
|
|
111
|
+
|
|
112
|
+
> **Warning:** This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users won't need to configure this option.
|
|
103
113
|
|
|
104
114
|
```typescript
|
|
105
115
|
import { Mastra } from '@mastra/core'
|
|
106
116
|
import { nanoid } from 'nanoid'
|
|
107
117
|
|
|
108
118
|
export const mastra = new Mastra({
|
|
109
|
-
idGenerator:
|
|
119
|
+
idGenerator: context => {
|
|
120
|
+
if (context?.idType === 'message' && context?.threadId) {
|
|
121
|
+
return `msg-${context.threadId}-${nanoid(8)}`
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (context?.idType === 'run' && context?.source && context?.entityId) {
|
|
125
|
+
return `${context.source}-run-${context.entityId}-${nanoid(6)}`
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return nanoid()
|
|
129
|
+
},
|
|
110
130
|
})
|
|
111
131
|
```
|
|
112
132
|
|
|
@@ -243,7 +263,7 @@ export const mastra = new Mastra({
|
|
|
243
263
|
|
|
244
264
|
Pub/sub system for event-driven communication between components. Used internally by Mastra for workflow event processing and component communication.
|
|
245
265
|
|
|
246
|
-
> **Warning:** This is used internally by Mastra. Most users
|
|
266
|
+
> **Warning:** This is used internally by Mastra. Most users won't need to configure this option.
|
|
247
267
|
|
|
248
268
|
```typescript
|
|
249
269
|
import { Mastra } from '@mastra/core'
|
|
@@ -693,6 +713,42 @@ export const mastra = new Mastra({
|
|
|
693
713
|
})
|
|
694
714
|
```
|
|
695
715
|
|
|
716
|
+
### server.onValidationError
|
|
717
|
+
|
|
718
|
+
**Type:** `(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`
|
|
719
|
+
|
|
720
|
+
Custom handler called when a request fails Zod schema validation. Use this to customize validation error responses, change the status code, or format errors to match your API standards.
|
|
721
|
+
|
|
722
|
+
Return a `{ status, body }` object to override the default `400` response, or `undefined` to fall through to the default behavior. This hook is supported by all server adapters (Hono, Express, Fastify, Koa).
|
|
723
|
+
|
|
724
|
+
The `context` parameter indicates which part of the request failed validation:
|
|
725
|
+
|
|
726
|
+
- `'query'` — query parameters
|
|
727
|
+
- `'body'` — request body
|
|
728
|
+
- `'path'` — path parameters
|
|
729
|
+
|
|
730
|
+
```typescript
|
|
731
|
+
import { Mastra } from '@mastra/core'
|
|
732
|
+
|
|
733
|
+
export const mastra = new Mastra({
|
|
734
|
+
server: {
|
|
735
|
+
onValidationError: (error, context) => ({
|
|
736
|
+
status: 422,
|
|
737
|
+
body: {
|
|
738
|
+
ok: false,
|
|
739
|
+
errors: error.issues.map(i => ({
|
|
740
|
+
path: i.path.join('.'),
|
|
741
|
+
message: i.message,
|
|
742
|
+
})),
|
|
743
|
+
source: context,
|
|
744
|
+
},
|
|
745
|
+
}),
|
|
746
|
+
},
|
|
747
|
+
})
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
You can also set `onValidationError` on individual routes created with `createRoute()`. A route-level hook takes precedence over the server-level hook.
|
|
751
|
+
|
|
696
752
|
### server.port
|
|
697
753
|
|
|
698
754
|
**Type:** `number`\
|
|
@@ -18,7 +18,7 @@ const gateway = mastra.getGatewayById('my-custom-gateway')
|
|
|
18
18
|
console.log(gateway.name) // 'My Custom Gateway'
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
## Use
|
|
21
|
+
## Use cases
|
|
22
22
|
|
|
23
23
|
- Gateway versioning: Different versions with unique IDs (`'gateway-v1'`, `'gateway-v2'`)
|
|
24
24
|
- Finding gateways when registration keys are unknown
|
|
@@ -36,12 +36,12 @@ const serverById = mastra.getMCPServerById('my-mcp-server')
|
|
|
36
36
|
|
|
37
37
|
**server** (`MCPServerBase | undefined`): The MCP server instance with the specified registry key, or undefined if not found.
|
|
38
38
|
|
|
39
|
-
## Related
|
|
39
|
+
## Related methods
|
|
40
40
|
|
|
41
41
|
- [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById) - Retrieve an MCP server by its intrinsic `id` property
|
|
42
42
|
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers) - List all registered MCP servers
|
|
43
43
|
|
|
44
|
-
## See
|
|
44
|
+
## See also
|
|
45
45
|
|
|
46
46
|
- [MCP overview](https://mastra.ai/docs/mcp/overview)
|
|
47
47
|
- [MCP server reference](https://mastra.ai/reference/tools/mcp-server)
|
|
@@ -44,12 +44,12 @@ const serverByKey = mastra.getMCPServer('customKey')
|
|
|
44
44
|
- If multiple servers have the same `id` but different versions, you must provide the `version` parameter to disambiguate
|
|
45
45
|
- If no `version` is provided and multiple versions exist, the method returns the first match
|
|
46
46
|
|
|
47
|
-
## Related
|
|
47
|
+
## Related methods
|
|
48
48
|
|
|
49
49
|
- [Mastra.getMCPServer()](https://mastra.ai/reference/core/getMCPServer) - Retrieve an MCP server by its registry key
|
|
50
50
|
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers) - List all registered MCP servers
|
|
51
51
|
|
|
52
|
-
## See
|
|
52
|
+
## See also
|
|
53
53
|
|
|
54
54
|
- [MCP overview](https://mastra.ai/docs/mcp/overview)
|
|
55
55
|
- [MCP server reference](https://mastra.ai/reference/tools/mcp-server)
|
|
@@ -22,7 +22,7 @@ const thread = await memory.createThread({
|
|
|
22
22
|
|
|
23
23
|
**memory** (`TMemory[TMemoryKey]`): The memory instance with the specified key. Throws an error if the memory is not found.
|
|
24
24
|
|
|
25
|
-
## Example: Registering and
|
|
25
|
+
## Example: Registering and retrieving memory
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
28
|
import { Mastra } from '@mastra/core'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# getScorer()
|
|
2
2
|
|
|
3
|
-
The `getScorer()` method retrieves a specific scorer that was registered with the Mastra instance using its registration key. This method provides type-safe access to scorers and throws an error if the requested scorer
|
|
3
|
+
The `getScorer()` method retrieves a specific scorer that was registered with the Mastra instance using its registration key. This method provides type-safe access to scorers and throws an error if the requested scorer isn't found.
|
|
4
4
|
|
|
5
|
-
## Usage
|
|
5
|
+
## Usage example
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { mastra } from './mastra'
|
|
@@ -30,11 +30,11 @@ await weatherAgent.generate('What is the weather in Rome', {
|
|
|
30
30
|
|
|
31
31
|
**scorer** (`MastraScorer`): The MastraScorer instance associated with the provided key.
|
|
32
32
|
|
|
33
|
-
## Error
|
|
33
|
+
## Error handling
|
|
34
34
|
|
|
35
35
|
This method throws a `MastraError` if:
|
|
36
36
|
|
|
37
|
-
- The scorer with the specified key
|
|
37
|
+
- The scorer with the specified key isn't found
|
|
38
38
|
- No scorers are registered with the Mastra instance
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `getScorerById()` method retrieves a scorer by searching for its `id` property (or `name` property as a fallback) rather than the registration key. This is useful when you know the scorer's id but not necessarily how it was registered in the Mastra instance.
|
|
4
4
|
|
|
5
|
-
## Usage
|
|
5
|
+
## Usage example
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
import { mastra } from './mastra'
|
|
@@ -30,7 +30,7 @@ await weatherAgent.generate('What is the weather in Rome', {
|
|
|
30
30
|
|
|
31
31
|
**scorer** (`MastraScorer`): The MastraScorer instance that has the matching id (or name) property.
|
|
32
32
|
|
|
33
|
-
## Error
|
|
33
|
+
## Error handling
|
|
34
34
|
|
|
35
35
|
This method throws a `MastraError` if:
|
|
36
36
|
|