@mastra/mcp-docs-server 1.0.0-beta.1 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +1 -15
- package/.docs/organized/changelogs/%40internal%2Fexternal-types.md +1 -7
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +201 -1
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +1 -55
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +276 -76
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +200 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +26 -0
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +89 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +392 -192
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +200 -0
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +61 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flance.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +263 -63
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Frag.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Freact.md +154 -1
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +18 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +274 -74
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +92 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +67 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +201 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +201 -1
- package/.docs/organized/changelogs/create-mastra.md +201 -1
- package/.docs/organized/changelogs/mastra.md +201 -1
- package/.docs/organized/code-examples/agui.md +1 -0
- package/.docs/organized/code-examples/ai-elements.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-v5.md +3 -2
- package/.docs/organized/code-examples/assistant-ui.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +2 -2
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +2 -2
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/heads-up-game.md +1 -1
- package/.docs/organized/code-examples/mcp-configuration.md +0 -3
- package/.docs/organized/code-examples/mcp-server-adapters.md +720 -0
- package/.docs/organized/code-examples/memory-per-resource-example.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +1 -1
- package/.docs/organized/code-examples/processors-with-ai-sdk.md +14 -0
- package/.docs/organized/code-examples/quick-start.md +2 -2
- package/.docs/organized/code-examples/server-app-access.md +342 -0
- package/.docs/organized/code-examples/server-express-adapter.md +87 -0
- package/.docs/organized/code-examples/server-hono-adapter.md +85 -0
- package/.docs/organized/code-examples/stock-price-tool.md +1 -21
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +56 -10
- package/.docs/raw/agents/agent-approval.mdx +189 -0
- package/.docs/raw/agents/agent-memory.mdx +1 -1
- package/.docs/raw/agents/guardrails.mdx +70 -30
- package/.docs/raw/agents/networks.mdx +3 -3
- package/.docs/raw/agents/overview.mdx +18 -167
- package/.docs/raw/agents/processors.mdx +430 -0
- package/.docs/raw/agents/structured-output.mdx +224 -0
- package/.docs/raw/agents/using-tools.mdx +14 -14
- package/.docs/raw/auth/auth0.mdx +1 -1
- package/.docs/raw/auth/clerk.mdx +1 -1
- package/.docs/raw/auth/firebase.mdx +1 -1
- package/.docs/raw/auth/index.mdx +1 -1
- package/.docs/raw/auth/jwt.mdx +1 -1
- package/.docs/raw/auth/supabase.mdx +1 -1
- package/.docs/raw/auth/workos.mdx +1 -1
- package/.docs/raw/community/contributing-templates.mdx +1 -1
- package/.docs/raw/community/discord.mdx +2 -2
- package/.docs/raw/community/licensing.mdx +1 -1
- package/.docs/raw/course/01-first-agent/05-running-playground.md +5 -5
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +3 -3
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +3 -3
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +2 -2
- package/.docs/raw/course/04-workflows/07-using-playground.md +1 -1
- package/.docs/raw/deployment/{server-deployment.mdx → building-mastra.mdx} +4 -4
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +2 -2
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +3 -3
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +2 -2
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/cloudflare-deployer.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +2 -2
- package/.docs/raw/deployment/cloud-providers/index.mdx +26 -29
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/netlify-deployer.mdx +45 -14
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/vercel-deployer.mdx +1 -1
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/dashboard.mdx +3 -3
- package/.docs/raw/deployment/mastra-cloud/observability.mdx +53 -0
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/overview.mdx +3 -3
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/setting-up.mdx +4 -4
- package/.docs/raw/deployment/monorepo.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -7
- package/.docs/raw/deployment/web-framework.mdx +6 -6
- package/.docs/raw/evals/{off-the-shelf-scorers.mdx → built-in-scorers.mdx} +17 -15
- package/.docs/raw/evals/custom-scorers.mdx +4 -6
- package/.docs/raw/evals/overview.mdx +5 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -4
- package/.docs/raw/getting-started/{installation.mdx → manual-install.mdx} +6 -80
- package/.docs/raw/getting-started/mcp-docs-server.mdx +63 -6
- package/.docs/raw/getting-started/project-structure.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +72 -0
- package/.docs/raw/getting-started/studio.mdx +32 -7
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +147 -0
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +627 -0
- package/.docs/raw/{frameworks/agentic-uis → guides/build-your-ui}/assistant-ui.mdx +71 -19
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +206 -0
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/astro.mdx +24 -26
- package/.docs/raw/{frameworks/servers → guides/getting-started}/express.mdx +4 -5
- package/.docs/raw/guides/{quickstarts/nextjs.mdx → getting-started/next-js.mdx} +26 -25
- package/.docs/raw/guides/getting-started/quickstart.mdx +97 -0
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/sveltekit.mdx +24 -26
- package/.docs/raw/{frameworks/web-frameworks → guides/getting-started}/vite-react.mdx +7 -7
- package/.docs/raw/guides/guide/ai-recruiter.mdx +2 -3
- package/.docs/raw/guides/guide/chef-michel.mdx +2 -3
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +2 -2
- package/.docs/raw/guides/guide/research-assistant.mdx +7 -8
- package/.docs/raw/guides/guide/stock-agent.mdx +4 -6
- package/.docs/raw/guides/guide/web-search.mdx +12 -10
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
- package/.docs/raw/guides/index.mdx +3 -35
- package/.docs/raw/guides/migrations/agentnetwork.mdx +4 -4
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +119 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +121 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/client.mdx +42 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/evals.mdx +31 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/mastra.mdx +27 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/mcp.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +28 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/overview.mdx +25 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +80 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/tools.mdx +68 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/vectors.mdx +25 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +174 -1
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +2 -2
- package/.docs/raw/index.mdx +3 -3
- package/.docs/raw/mcp/overview.mdx +358 -0
- package/.docs/raw/mcp/publishing-mcp-server.mdx +139 -0
- package/.docs/raw/memory/conversation-history.mdx +1 -1
- package/.docs/raw/memory/memory-processors.mdx +265 -80
- package/.docs/raw/memory/overview.mdx +2 -2
- package/.docs/raw/memory/semantic-recall.mdx +9 -9
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +3 -8
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +150 -0
- package/.docs/raw/memory/storage/memory-with-pg.mdx +3 -8
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +3 -8
- package/.docs/raw/memory/threads-and-resources.mdx +4 -4
- package/.docs/raw/memory/working-memory.mdx +16 -8
- package/.docs/raw/{logging.mdx → observability/logging.mdx} +7 -7
- package/.docs/raw/observability/overview.mdx +3 -4
- package/.docs/raw/observability/tracing/bridges/otel.mdx +200 -0
- package/.docs/raw/observability/tracing/exporters/arize.mdx +37 -1
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +20 -1
- package/.docs/raw/observability/tracing/exporters/cloud.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/default.mdx +1 -1
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +84 -1
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +13 -1
- package/.docs/raw/observability/tracing/exporters/otel.mdx +123 -25
- package/.docs/raw/observability/tracing/exporters/posthog.mdx +127 -0
- package/.docs/raw/observability/tracing/overview.mdx +80 -9
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +1 -2
- package/.docs/raw/rag/chunking-and-embedding.mdx +16 -17
- package/.docs/raw/rag/overview.mdx +4 -3
- package/.docs/raw/rag/retrieval.mdx +44 -39
- package/.docs/raw/rag/vector-databases.mdx +94 -3
- package/.docs/raw/reference/agents/agent.mdx +19 -16
- package/.docs/raw/reference/agents/generate.mdx +67 -99
- package/.docs/raw/reference/agents/generateLegacy.mdx +3 -3
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +1 -1
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +1 -1
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +1 -1
- package/.docs/raw/reference/agents/getModel.mdx +1 -1
- package/.docs/raw/reference/agents/getTools.mdx +69 -0
- package/.docs/raw/reference/agents/getVoice.mdx +1 -1
- package/.docs/raw/reference/agents/listAgents.mdx +1 -1
- package/.docs/raw/reference/agents/listScorers.mdx +1 -1
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +33 -72
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +127 -0
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +117 -0
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +64 -0
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +116 -0
- package/.docs/raw/reference/ai-sdk/network-route.mdx +99 -0
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +289 -0
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +119 -0
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +110 -0
- package/.docs/raw/reference/auth/auth0.mdx +1 -1
- package/.docs/raw/reference/auth/clerk.mdx +1 -1
- package/.docs/raw/reference/auth/firebase.mdx +1 -1
- package/.docs/raw/reference/auth/jwt.mdx +1 -1
- package/.docs/raw/reference/auth/supabase.mdx +1 -1
- package/.docs/raw/reference/auth/workos.mdx +1 -1
- package/.docs/raw/reference/cli/create-mastra.mdx +1 -1
- package/.docs/raw/reference/cli/mastra.mdx +19 -6
- package/.docs/raw/reference/client-js/agents.mdx +252 -68
- package/.docs/raw/reference/client-js/error-handling.mdx +1 -1
- package/.docs/raw/reference/client-js/logs.mdx +1 -1
- package/.docs/raw/reference/client-js/mastra-client.mdx +4 -4
- package/.docs/raw/reference/client-js/memory.mdx +48 -2
- package/.docs/raw/reference/client-js/observability.mdx +1 -1
- package/.docs/raw/reference/client-js/telemetry.mdx +1 -1
- package/.docs/raw/reference/client-js/tools.mdx +1 -1
- package/.docs/raw/reference/client-js/vectors.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows.mdx +93 -64
- package/.docs/raw/reference/core/addGateway.mdx +59 -0
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getGateway.mdx +59 -0
- package/.docs/raw/reference/core/getGatewayById.mdx +62 -0
- package/.docs/raw/reference/core/getLogger.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServer.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServerById.mdx +2 -2
- package/.docs/raw/reference/core/getMemory.mdx +73 -0
- package/.docs/raw/reference/core/getScorer.mdx +1 -1
- package/.docs/raw/reference/core/getScorerById.mdx +1 -1
- package/.docs/raw/reference/core/getServer.mdx +3 -3
- package/.docs/raw/reference/core/getStorage.mdx +1 -1
- package/.docs/raw/reference/core/getStoredAgentById.mdx +183 -0
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listGateways.mdx +53 -0
- package/.docs/raw/reference/core/listLogs.mdx +2 -2
- package/.docs/raw/reference/core/listLogsByRunId.mdx +2 -2
- package/.docs/raw/reference/core/listMCPServers.mdx +2 -2
- package/.docs/raw/reference/core/listMemory.mdx +70 -0
- package/.docs/raw/reference/core/listScorers.mdx +1 -1
- package/.docs/raw/reference/core/listStoredAgents.mdx +151 -0
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/mastra-class.mdx +17 -1
- package/.docs/raw/reference/core/mastra-model-gateway.mdx +227 -0
- package/.docs/raw/reference/core/setLogger.mdx +2 -2
- package/.docs/raw/reference/core/setStorage.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -1
- package/.docs/raw/reference/deployer/deployer.mdx +1 -1
- package/.docs/raw/reference/deployer/netlify.mdx +2 -3
- package/.docs/raw/reference/deployer/vercel.mdx +1 -1
- package/.docs/raw/reference/evals/answer-relevancy.mdx +29 -99
- package/.docs/raw/reference/evals/answer-similarity.mdx +13 -259
- package/.docs/raw/reference/evals/bias.mdx +30 -88
- package/.docs/raw/reference/evals/completeness.mdx +32 -91
- package/.docs/raw/reference/evals/content-similarity.mdx +29 -89
- package/.docs/raw/reference/evals/context-precision.mdx +29 -131
- package/.docs/raw/reference/evals/context-relevance.mdx +12 -12
- package/.docs/raw/reference/evals/create-scorer.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +29 -102
- package/.docs/raw/reference/evals/hallucination.mdx +29 -104
- package/.docs/raw/reference/evals/keyword-coverage.mdx +29 -108
- package/.docs/raw/reference/evals/mastra-scorer.mdx +1 -1
- package/.docs/raw/reference/evals/noise-sensitivity.mdx +12 -12
- package/.docs/raw/reference/evals/prompt-alignment.mdx +16 -16
- package/.docs/raw/reference/evals/run-evals.mdx +1 -1
- package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +28 -101
- package/.docs/raw/reference/evals/tone-consistency.mdx +26 -99
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +8 -8
- package/.docs/raw/reference/evals/toxicity.mdx +30 -93
- package/.docs/raw/reference/index.mdx +1 -0
- package/.docs/raw/reference/logging/pino-logger.mdx +2 -2
- package/.docs/raw/reference/memory/createThread.mdx +1 -1
- package/.docs/raw/reference/memory/deleteMessages.mdx +1 -1
- package/.docs/raw/reference/memory/getThreadById.mdx +1 -1
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +1 -1
- package/.docs/raw/reference/memory/memory-class.mdx +6 -8
- package/.docs/raw/reference/memory/query.mdx +1 -1
- package/.docs/raw/reference/memory/recall.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +177 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +1 -5
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +30 -1
- package/.docs/raw/reference/observability/tracing/exporters/braintrust.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/exporters/cloud-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/exporters/console-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/exporters/default-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +44 -1
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +18 -2
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +34 -44
- package/.docs/raw/reference/observability/tracing/exporters/posthog.mdx +132 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +1 -5
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +30 -5
- package/.docs/raw/reference/observability/tracing/processors/sensitive-data-filter.mdx +1 -1
- package/.docs/raw/reference/observability/tracing/spans.mdx +1 -5
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +11 -4
- package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +13 -6
- package/.docs/raw/reference/processors/pii-detector.mdx +13 -6
- package/.docs/raw/reference/processors/processor-interface.mdx +803 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +11 -4
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +4 -5
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +3 -3
- package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/database-config.mdx +1 -1
- package/.docs/raw/reference/rag/document.mdx +1 -1
- package/.docs/raw/reference/rag/embeddings.mdx +6 -6
- package/.docs/raw/reference/rag/extract-params.mdx +1 -1
- package/.docs/raw/reference/rag/graph-rag.mdx +1 -1
- package/.docs/raw/reference/rag/metadata-filters.mdx +1 -1
- package/.docs/raw/reference/rag/rerank.mdx +2 -3
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +1 -2
- package/.docs/raw/reference/server/create-route.mdx +328 -0
- package/.docs/raw/reference/server/express-adapter.mdx +260 -0
- package/.docs/raw/reference/server/hono-adapter.mdx +242 -0
- package/.docs/raw/reference/server/mastra-server.mdx +345 -0
- package/.docs/raw/reference/server/routes.mdx +250 -0
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +38 -1
- package/.docs/raw/reference/storage/cloudflare.mdx +1 -1
- package/.docs/raw/reference/storage/convex.mdx +164 -0
- package/.docs/raw/reference/storage/dynamodb.mdx +1 -1
- package/.docs/raw/reference/storage/lance.mdx +34 -1
- package/.docs/raw/reference/storage/libsql.mdx +38 -1
- package/.docs/raw/reference/storage/mongodb.mdx +40 -1
- package/.docs/raw/reference/storage/mssql.mdx +38 -1
- package/.docs/raw/reference/storage/postgresql.mdx +38 -1
- package/.docs/raw/reference/storage/upstash.mdx +1 -1
- package/.docs/raw/reference/streaming/ChunkType.mdx +25 -4
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +84 -124
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +8 -10
- package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
- package/.docs/raw/reference/streaming/workflows/stream.mdx +84 -25
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
- package/.docs/raw/reference/templates/overview.mdx +2 -5
- package/.docs/raw/reference/tools/client.mdx +2 -3
- package/.docs/raw/reference/tools/create-tool.mdx +135 -4
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +1 -1
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +7 -7
- package/.docs/raw/reference/tools/mcp-client.mdx +131 -23
- package/.docs/raw/reference/tools/mcp-server.mdx +56 -8
- package/.docs/raw/reference/tools/vector-query-tool.mdx +16 -17
- package/.docs/raw/reference/vectors/astra.mdx +1 -1
- package/.docs/raw/reference/vectors/chroma.mdx +82 -2
- package/.docs/raw/reference/vectors/convex.mdx +429 -0
- package/.docs/raw/reference/vectors/couchbase.mdx +25 -18
- package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
- package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
- package/.docs/raw/reference/vectors/lance.mdx +39 -23
- package/.docs/raw/reference/vectors/libsql.mdx +36 -3
- package/.docs/raw/reference/vectors/mongodb.mdx +36 -3
- package/.docs/raw/reference/vectors/opensearch.mdx +38 -17
- package/.docs/raw/reference/vectors/pg.mdx +44 -37
- package/.docs/raw/reference/vectors/pinecone.mdx +70 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +37 -2
- package/.docs/raw/reference/vectors/s3vectors.mdx +1 -1
- package/.docs/raw/reference/vectors/turbopuffer.mdx +75 -1
- package/.docs/raw/reference/vectors/upstash.mdx +1 -1
- package/.docs/raw/reference/vectors/vectorize.mdx +1 -1
- package/.docs/raw/reference/voice/azure.mdx +96 -81
- package/.docs/raw/reference/voice/cloudflare.mdx +1 -1
- package/.docs/raw/reference/voice/composite-voice.mdx +72 -29
- package/.docs/raw/reference/voice/deepgram.mdx +1 -1
- package/.docs/raw/reference/voice/elevenlabs.mdx +1 -1
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/voice/google.mdx +160 -21
- package/.docs/raw/reference/voice/mastra-voice.mdx +1 -1
- package/.docs/raw/reference/voice/murf.mdx +1 -1
- package/.docs/raw/reference/voice/openai-realtime.mdx +3 -3
- package/.docs/raw/reference/voice/openai.mdx +1 -1
- package/.docs/raw/reference/voice/playai.mdx +1 -1
- package/.docs/raw/reference/voice/sarvam.mdx +1 -1
- package/.docs/raw/reference/voice/speechify.mdx +1 -1
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +3 -4
- package/.docs/raw/reference/voice/voice.addTools.mdx +2 -2
- package/.docs/raw/reference/voice/voice.answer.mdx +2 -2
- package/.docs/raw/reference/voice/voice.close.mdx +2 -2
- package/.docs/raw/reference/voice/voice.connect.mdx +2 -2
- package/.docs/raw/reference/voice/voice.events.mdx +1 -1
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +1 -1
- package/.docs/raw/reference/voice/voice.listen.mdx +87 -53
- package/.docs/raw/reference/voice/voice.off.mdx +2 -2
- package/.docs/raw/reference/voice/voice.on.mdx +2 -2
- package/.docs/raw/reference/voice/voice.send.mdx +2 -2
- package/.docs/raw/reference/voice/voice.speak.mdx +76 -41
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +45 -1
- package/.docs/raw/reference/workflows/run-methods/start.mdx +48 -4
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
- package/.docs/raw/reference/workflows/run.mdx +28 -6
- package/.docs/raw/reference/workflows/step.mdx +65 -1
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +69 -4
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow.mdx +44 -2
- package/.docs/raw/server-db/custom-adapters.mdx +386 -0
- package/.docs/raw/server-db/custom-api-routes.mdx +6 -6
- package/.docs/raw/server-db/mastra-client.mdx +3 -4
- package/.docs/raw/server-db/{production-server.mdx → mastra-server.mdx} +22 -12
- package/.docs/raw/server-db/middleware.mdx +31 -31
- package/.docs/raw/server-db/request-context.mdx +3 -4
- package/.docs/raw/server-db/server-adapters.mdx +312 -0
- package/.docs/raw/server-db/storage.mdx +12 -1
- package/.docs/raw/streaming/events.mdx +1 -1
- package/.docs/raw/streaming/overview.mdx +27 -16
- package/.docs/raw/streaming/tool-streaming.mdx +58 -19
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -12
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -3
- package/.docs/raw/tools-mcp/mcp-overview.mdx +4 -6
- package/.docs/raw/tools-mcp/overview.mdx +1 -1
- package/.docs/raw/voice/overview.mdx +88 -41
- package/.docs/raw/voice/speech-to-speech.mdx +5 -5
- package/.docs/raw/voice/speech-to-text.mdx +2 -3
- package/.docs/raw/voice/text-to-speech.mdx +2 -3
- package/.docs/raw/workflows/agents-and-tools.mdx +43 -5
- package/.docs/raw/workflows/control-flow.mdx +534 -3
- package/.docs/raw/workflows/error-handling.mdx +5 -4
- package/.docs/raw/workflows/human-in-the-loop.mdx +160 -213
- package/.docs/raw/workflows/inngest-workflow.mdx +1 -1
- package/.docs/raw/workflows/input-data-mapping.mdx +1 -1
- package/.docs/raw/workflows/overview.mdx +67 -47
- package/.docs/raw/workflows/snapshots.mdx +5 -3
- package/.docs/raw/workflows/suspend-and-resume.mdx +121 -204
- package/.docs/raw/workflows/time-travel.mdx +313 -0
- package/.docs/raw/workflows/workflow-state.mdx +190 -0
- package/CHANGELOG.md +88 -0
- package/dist/{chunk-5NJC7NRO.js → chunk-4CM2BQNP.js} +24 -4
- package/dist/prepare-docs/package-changes.d.ts.map +1 -1
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +17 -19
- package/package.json +10 -14
- package/.docs/raw/deployment/serverless-platforms/index.mdx +0 -58
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +0 -688
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -123
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +0 -382
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -179
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -379
- package/.docs/raw/getting-started/templates.mdx +0 -73
- package/.docs/raw/mastra-cloud/observability.mdx +0 -51
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
|
@@ -25,7 +25,7 @@ To migrate, replace all calls to `mastra.getAgents()` with `mastra.listAgents()`
|
|
|
25
25
|
You can use Mastra's codemod CLI to update your code automatically:
|
|
26
26
|
|
|
27
27
|
```shell
|
|
28
|
-
npx @mastra/codemod@beta v1/
|
|
28
|
+
npx @mastra/codemod@beta v1/mastra-plural-apis .
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
:::
|
|
@@ -177,6 +177,16 @@ To migrate, move `abortSignal` from `modelSettings` to the top level.
|
|
|
177
177
|
});
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
:::tip[Codemod]
|
|
181
|
+
|
|
182
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
183
|
+
|
|
184
|
+
```shell
|
|
185
|
+
npx @mastra/codemod@beta v1/agent-abort-signal .
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
:::
|
|
189
|
+
|
|
180
190
|
### `output` to `structuredOutput.schema`
|
|
181
191
|
|
|
182
192
|
The deprecated `output` and `experimental_output` options have been removed. This change consolidates on a single, stable API for structured output.
|
|
@@ -192,6 +202,46 @@ To migrate, update from `output` or `experimental_output` to `structuredOutput.s
|
|
|
192
202
|
});
|
|
193
203
|
```
|
|
194
204
|
|
|
205
|
+
### Agent `id` field is now required
|
|
206
|
+
|
|
207
|
+
The `id` field is now required when creating an Agent. Previously, agents could be created without an explicit ID, but this is no longer supported.
|
|
208
|
+
|
|
209
|
+
To migrate, add an `id` field to all Agent configurations.
|
|
210
|
+
|
|
211
|
+
```diff
|
|
212
|
+
const agent = new Agent({
|
|
213
|
+
+ id: 'my-agent',
|
|
214
|
+
name: 'My Agent',
|
|
215
|
+
instructions: 'You are a helpful assistant',
|
|
216
|
+
model: openai('gpt-4'),
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The `id` can be the same as the `name`, or you can use a different identifier. The ID will be used when calling `mastra.getAgentById()` and must be unique within your Mastra instance.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// Register agent with Mastra
|
|
224
|
+
const mastra = new Mastra({
|
|
225
|
+
agents: {
|
|
226
|
+
myAgent: agent, // key can differ from id
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Retrieve by ID
|
|
231
|
+
const agent = mastra.getAgentById('my-agent');
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Stream API responses now redact sensitive data
|
|
235
|
+
|
|
236
|
+
The Mastra server now automatically redacts sensitive information from agent stream responses. This prevents accidental exposure of system prompts, tool definitions, and API keys in `step-start`, `step-finish`, and `finish` stream chunks.
|
|
237
|
+
|
|
238
|
+
**What's redacted:**
|
|
239
|
+
- `request.body` containing LLM request payloads (system prompts, tool schemas)
|
|
240
|
+
- `metadata.request` in step results
|
|
241
|
+
- `output.steps[].request` in nested step data
|
|
242
|
+
|
|
243
|
+
This behavior is enabled by default. If you need access to the full request data (e.g., for debugging or internal services), you can disable redaction when using server adapters directly (e.g., `@mastra/hono` or `@mastra/express`).
|
|
244
|
+
|
|
195
245
|
## Removed
|
|
196
246
|
|
|
197
247
|
### `generateVNext` and `streamVNext` methods
|
|
@@ -263,3 +313,73 @@ To migrate, remove the `TMetrics` generic parameter and configure scorers using
|
|
|
263
313
|
// ...
|
|
264
314
|
});
|
|
265
315
|
```
|
|
316
|
+
|
|
317
|
+
### Tripwire response format changed
|
|
318
|
+
|
|
319
|
+
The tripwire response format has changed from separate `tripwire` and `tripwireReason` fields to a single `tripwire` object containing all related data.
|
|
320
|
+
|
|
321
|
+
To migrate, update your code to access tripwire data from the new object structure.
|
|
322
|
+
|
|
323
|
+
```diff
|
|
324
|
+
const result = await agent.generate('Hello');
|
|
325
|
+
|
|
326
|
+
- if (result.tripwire) {
|
|
327
|
+
- console.log(result.tripwireReason);
|
|
328
|
+
- }
|
|
329
|
+
+ if (result.tripwire) {
|
|
330
|
+
+ console.log(result.tripwire.reason);
|
|
331
|
+
+ // New fields available:
|
|
332
|
+
+ // result.tripwire.retry - whether this step should be retried
|
|
333
|
+
+ // result.tripwire.metadata - additional metadata from the processor
|
|
334
|
+
+ // result.tripwire.processorId - which processor triggered the tripwire
|
|
335
|
+
+ }
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
For streaming responses:
|
|
339
|
+
|
|
340
|
+
```diff
|
|
341
|
+
for await (const chunk of stream.fullStream) {
|
|
342
|
+
if (chunk.type === 'tripwire') {
|
|
343
|
+
- console.log(chunk.payload.tripwireReason);
|
|
344
|
+
+ console.log(chunk.payload.reason);
|
|
345
|
+
+ // New fields available:
|
|
346
|
+
+ // chunk.payload.retry
|
|
347
|
+
+ // chunk.payload.metadata
|
|
348
|
+
+ // chunk.payload.processorId
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
The step results now also include tripwire information:
|
|
354
|
+
|
|
355
|
+
```diff
|
|
356
|
+
const result = await agent.generate('Hello');
|
|
357
|
+
|
|
358
|
+
for (const step of result.steps) {
|
|
359
|
+
- // No tripwire info on steps
|
|
360
|
+
+ if (step.tripwire) {
|
|
361
|
+
+ console.log('Step was blocked:', step.tripwire.reason);
|
|
362
|
+
+ }
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### `prepareStep` messages format
|
|
367
|
+
|
|
368
|
+
The `prepareStep` callback now receives messages in `MastraDBMessage` format instead of AI SDK v5 model message format. This change unifies `prepareStep` with the new `processInputStep` processor method, which runs at each step of the agentic loop.
|
|
369
|
+
|
|
370
|
+
If you need the old AI SDK v5 format, use `messageList.get.all.aiV5.model()`:
|
|
371
|
+
|
|
372
|
+
```diff
|
|
373
|
+
agent.generate({
|
|
374
|
+
prompt: 'Hello',
|
|
375
|
+
prepareStep: async ({ messages, messageList }) => {
|
|
376
|
+
- // messages was AI SDK v5 ModelMessage format
|
|
377
|
+
- console.log(messages[0].content);
|
|
378
|
+
+ // messages is now MastraDBMessage format
|
|
379
|
+
+ // Use messageList to get AI SDK v5 format if needed:
|
|
380
|
+
+ const aiSdkMessages = messageList.get.all.aiV5.model();
|
|
381
|
+
|
|
382
|
+
return { toolChoice: 'auto' };
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
```
|
|
@@ -28,6 +28,16 @@ To migrate, update type imports to use the new naming pattern.
|
|
|
28
28
|
+ } from '@mastra/client-js';
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
:::tip[Codemod]
|
|
32
|
+
|
|
33
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
npx @mastra/codemod@beta v1/client-sdk-types .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
:::
|
|
40
|
+
|
|
31
41
|
### Pagination parameters from `offset/limit` to `page/perPage`
|
|
32
42
|
|
|
33
43
|
All client SDK methods that used `offset/limit` now use `page/perPage`. This change provides a more intuitive pagination model aligned with web pagination patterns.
|
|
@@ -44,6 +54,16 @@ To migrate, update pagination parameters in all client SDK method calls. Example
|
|
|
44
54
|
});
|
|
45
55
|
```
|
|
46
56
|
|
|
57
|
+
:::tip[Codemod]
|
|
58
|
+
|
|
59
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
60
|
+
|
|
61
|
+
```shell
|
|
62
|
+
npx @mastra/codemod@beta v1/client-offset-limit .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
:::
|
|
66
|
+
|
|
47
67
|
### `getMemoryThread` parameter structure
|
|
48
68
|
|
|
49
69
|
The `getMemoryThread` method parameter structure has been updated. This change provides a more consistent API across memory methods.
|
|
@@ -51,10 +71,20 @@ The `getMemoryThread` method parameter structure has been updated. This change p
|
|
|
51
71
|
To migrate, update the method call with the new parameter structure. Check the updated API documentation for the specific changes.
|
|
52
72
|
|
|
53
73
|
```diff
|
|
54
|
-
- const thread = await client.
|
|
55
|
-
+ const thread = await client.
|
|
74
|
+
- const thread = await client.getMemoryThread(threadId, agentId);
|
|
75
|
+
+ const thread = await client.getMemoryThread({ threadId, agentId });
|
|
56
76
|
```
|
|
57
77
|
|
|
78
|
+
:::tip[Codemod]
|
|
79
|
+
|
|
80
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
npx @mastra/codemod@beta v1/client-get-memory-thread .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
:::
|
|
87
|
+
|
|
58
88
|
## Removed
|
|
59
89
|
|
|
60
90
|
### `toAISdkFormat` function
|
|
@@ -70,6 +100,16 @@ To migrate, use `toAISdkStream()` instead.
|
|
|
70
100
|
+ const stream = toAISdkStream(agentStream, { from: 'agent' });
|
|
71
101
|
```
|
|
72
102
|
|
|
103
|
+
:::tip[Codemod]
|
|
104
|
+
|
|
105
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
npx @mastra/codemod@beta v1/client-to-ai-sdk-format .
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
:::
|
|
112
|
+
|
|
73
113
|
### Network memory methods
|
|
74
114
|
|
|
75
115
|
Network memory methods have been removed from `@mastra/client-js`. The `NetworkMemoryThread` class and all network memory-related methods are no longer available. This change simplifies the memory API by removing specialized network memory functionality.
|
|
@@ -25,7 +25,7 @@ To migrate, replace all calls to `getScorers()` with `listScorers()`.
|
|
|
25
25
|
You can use Mastra's codemod CLI to update your code automatically:
|
|
26
26
|
|
|
27
27
|
```shell
|
|
28
|
-
npx @mastra/codemod@beta v1/
|
|
28
|
+
npx @mastra/codemod@beta v1/mastra-plural-apis .
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
:::
|
|
@@ -50,6 +50,16 @@ To migrate, update function calls from `runExperiment` to `runEvals`.
|
|
|
50
50
|
+ const result = await runEvals({ target: myAgent, scorers: [scorer], data: inputs });
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
:::tip[Codemod]
|
|
54
|
+
|
|
55
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
npx @mastra/codemod@beta v1/evals-run-experiment .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
:::
|
|
62
|
+
|
|
53
63
|
### `getScorerByName` to `getScorerById`
|
|
54
64
|
|
|
55
65
|
The `getScorerByName()` method has been renamed to `getScorerById()`. Scorers now require an `id` field instead of `name`. This change aligns with the broader API pattern of using `id` for entity identification.
|
|
@@ -67,6 +77,16 @@ To migrate, update method calls and scorer configuration to use `id` instead of
|
|
|
67
77
|
+ const scorer = mastra.getScorerById('helpfulness-scorer');
|
|
68
78
|
```
|
|
69
79
|
|
|
80
|
+
:::tip[Codemod]
|
|
81
|
+
|
|
82
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
83
|
+
|
|
84
|
+
```shell
|
|
85
|
+
npx @mastra/codemod@beta v1/evals-scorer-by-name .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
:::
|
|
89
|
+
|
|
70
90
|
### Scorer configuration from `name` to `id`
|
|
71
91
|
|
|
72
92
|
Scorers now require an `id` field instead of `name`. The `name` field is now optional. This change provides consistency with other Mastra entities.
|
|
@@ -120,6 +140,16 @@ To migrate, update import statements to use the new `scorers/prebuilt` path.
|
|
|
120
140
|
+ import { createCompletenessScorer } from '@mastra/evals/scorers/prebuilt';
|
|
121
141
|
```
|
|
122
142
|
|
|
143
|
+
:::tip[Codemod]
|
|
144
|
+
|
|
145
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
146
|
+
|
|
147
|
+
```shell
|
|
148
|
+
npx @mastra/codemod@beta v1/evals-prebuilt-imports .
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
:::
|
|
152
|
+
|
|
123
153
|
### Scorer message types from `UIMessage` to `MastraDBMessage`
|
|
124
154
|
|
|
125
155
|
Scorer input and output types now use `MastraDBMessage[]` instead of `UIMessage`. This change aligns scorers with the database-persisted message format for consistency across the framework.
|
|
@@ -60,9 +60,9 @@ npx @mastra/codemod@beta v1/experimental-auth .
|
|
|
60
60
|
|
|
61
61
|
### Required `id` parameter for all mastra primitives
|
|
62
62
|
|
|
63
|
-
All
|
|
63
|
+
All storages, vector stores, agents, workflows, mcpServers, processors, scorers, and tools now require an `id` parameter during initialization. This enables the standardized Mastra API and prevents ID conflicts.
|
|
64
64
|
|
|
65
|
-
All these primitives also now have
|
|
65
|
+
All these primitives also now have `get`, `list`, and `add` functions.
|
|
66
66
|
|
|
67
67
|
To migrate, add an `id` parameter to all storage and vector store instantiations. When using the same storage/vector class multiple times, ensure each instance has a unique ID.
|
|
68
68
|
|
|
@@ -105,12 +105,36 @@ When using separate instances for different purposes, use descriptive unique IDs
|
|
|
105
105
|
|
|
106
106
|
### Primitive plural APIs changes from `get<primitives>` to `list<primitive>`
|
|
107
107
|
|
|
108
|
+
`get*` functions that returned all instances of a primitive have been renamed to `list*` to better reflect their purpose.
|
|
109
|
+
|
|
108
110
|
```diff
|
|
111
|
+
- const agents = mastra.getAgents();
|
|
112
|
+
+ const agents = mastra.listAgents();
|
|
113
|
+
- const vectors = mastra.getVectors();
|
|
114
|
+
+ const vectors = mastra.listVectors();
|
|
115
|
+
- const workflows = mastra.getWorkflows();
|
|
116
|
+
+ const workflows = mastra.listWorkflows();
|
|
117
|
+
- const scorers = mastra.getScorers();
|
|
118
|
+
+ const scorers = mastra.listScorers();
|
|
109
119
|
- const mcpServers = mastra.getMCPServers();
|
|
110
120
|
+ const mcpServers = mastra.listMCPServers();
|
|
121
|
+
- const logsByRunId = await mastra.getLogsByRunId({ runId: 'id', transportId: 'id' });
|
|
122
|
+
+ const logsByRunId = await mastra.listLogsByRunId({ runId: 'id', transportId: 'id' });
|
|
123
|
+
- const logs = await mastra.getLogs('transportId');
|
|
124
|
+
+ const logs = await mastra.listLogs('transportId');
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
:::tip[Codemod]
|
|
128
|
+
|
|
129
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
130
|
+
|
|
131
|
+
```shell
|
|
132
|
+
npx @mastra/codemod@beta v1/mastra-plural-apis .
|
|
111
133
|
```
|
|
112
134
|
|
|
113
|
-
|
|
135
|
+
:::
|
|
136
|
+
|
|
137
|
+
### Each primitive has a `getById` and a `get` function
|
|
114
138
|
|
|
115
139
|
```typescript
|
|
116
140
|
mastra.getMCPServer('myServer'); // Works (registry key)
|
|
@@ -25,7 +25,7 @@ To migrate, replace all calls to `mastra.getMCPServers()` with `mastra.listMCPSe
|
|
|
25
25
|
You can use Mastra's codemod CLI to update your code automatically:
|
|
26
26
|
|
|
27
27
|
```shell
|
|
28
|
-
npx @mastra/codemod@beta v1/
|
|
28
|
+
npx @mastra/codemod@beta v1/mastra-plural-apis .
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
:::
|
|
@@ -111,6 +111,16 @@ To migrate, rename `query()` to `recall()` and update code that expects the old
|
|
|
111
111
|
+ const messages = result.messages;
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
:::tip[Codemod]
|
|
115
|
+
|
|
116
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
117
|
+
|
|
118
|
+
```shell
|
|
119
|
+
npx @mastra/codemod@beta v1/memory-query-to-recall .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
:::
|
|
123
|
+
|
|
114
124
|
### `Memory.recall()` parameter changes
|
|
115
125
|
|
|
116
126
|
The `Memory.recall()` method now uses `StorageListMessagesInput` format with pagination, and the `vectorMessageSearch` parameter has been renamed to `vectorSearchString`. These changes align the memory API with the storage pagination API and provide more consistent naming.
|
|
@@ -132,6 +142,16 @@ To migrate, update method name, query parameters, and the vector search paramete
|
|
|
132
142
|
});
|
|
133
143
|
```
|
|
134
144
|
|
|
145
|
+
:::tip[Codemod]
|
|
146
|
+
|
|
147
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
148
|
+
|
|
149
|
+
```shell
|
|
150
|
+
npx @mastra/codemod@beta v1/memory-vector-search-param .
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
:::
|
|
154
|
+
|
|
135
155
|
### `MastraMessageV2` type renamed to `MastraDBMessage`
|
|
136
156
|
|
|
137
157
|
The `MastraMessageV2` type has been renamed to `MastraDBMessage` for clarity. This change better describes the purpose of this type as the database message format.
|
|
@@ -145,7 +165,15 @@ To migrate, replace all instances of `MastraMessageV2` with `MastraDBMessage`.
|
|
|
145
165
|
+ function yourCustomFunction(input: MastraDBMessage) {}
|
|
146
166
|
```
|
|
147
167
|
|
|
168
|
+
:::tip[Codemod]
|
|
169
|
+
|
|
170
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
171
|
+
|
|
172
|
+
```shell
|
|
173
|
+
npx @mastra/codemod@beta v1/memory-message-v2-type .
|
|
174
|
+
```
|
|
148
175
|
|
|
176
|
+
:::
|
|
149
177
|
|
|
150
178
|
## Removed
|
|
151
179
|
|
|
@@ -13,13 +13,35 @@ Need help with the migration? Join our [Discord community](https://discord.gg/BT
|
|
|
13
13
|
|
|
14
14
|
## Migration Strategy
|
|
15
15
|
|
|
16
|
-
### Update all Mastra packages
|
|
16
|
+
### Update all Mastra packages to `beta` tag
|
|
17
17
|
|
|
18
18
|
Use your package manager to update your project's versions. Be sure to update **all** Mastra packages at the same time to ensure compatibility.
|
|
19
19
|
|
|
20
|
+
Here's how you update the most commonly used packages:
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
npm install @mastra/core@beta mastra@beta @mastra/loggers@beta @mastra/memory@beta
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Install any other Mastra package with the `@beta` tag and you'll get the latest beta version available. Be sure to update all Mastra packages (especially if you're in a monorepo) to avoid version mismatches.
|
|
27
|
+
|
|
20
28
|
### Update Node.js version
|
|
21
29
|
|
|
22
|
-
Mastra v1 requires Node.js 22.13.0 or higher. Update your development and production environments accordingly.
|
|
30
|
+
Mastra v1 requires Node.js **22.13.0** or higher. Update your development and production environments accordingly.
|
|
31
|
+
|
|
32
|
+
### Go through migration checklist
|
|
33
|
+
|
|
34
|
+
Work through the [migration checklist](#migration-checklist) below to update your codebase. Each item links to a detailed guide for that specific change.
|
|
35
|
+
|
|
36
|
+
:::info[Codemods]
|
|
37
|
+
|
|
38
|
+
We prepared automated [codemods](https://github.com/mastra-ai/mastra/tree/main/packages/codemod) for you. If you want, you can run all v1 codemods at once:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npx @mastra/codemod@beta v1
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
:::
|
|
23
45
|
|
|
24
46
|
## Breaking Changes by Area
|
|
25
47
|
|
|
@@ -41,7 +63,7 @@ Mastra v1 requires Node.js 22.13.0 or higher. Update your development and produc
|
|
|
41
63
|
|
|
42
64
|
Work through this checklist in order, starting with high-impact changes that affect most applications.
|
|
43
65
|
|
|
44
|
-
:::info[
|
|
66
|
+
:::info[Codemods]
|
|
45
67
|
|
|
46
68
|
We prepared automated [codemods](https://github.com/mastra-ai/mastra/tree/main/packages/codemod) for you. Throughout the migration guide you'll find instructions on how to use them for specific changes.
|
|
47
69
|
|
|
@@ -9,6 +9,26 @@ Storage APIs have been standardized with consistent pagination and naming patter
|
|
|
9
9
|
|
|
10
10
|
## Changed
|
|
11
11
|
|
|
12
|
+
### Required `id` property for storage instances
|
|
13
|
+
|
|
14
|
+
Storage instances now require an `id` property. This unique identifier is used for tracking and managing storage instances within Mastra. The `id` should be a descriptive, unique string for each storage instance in your application.
|
|
15
|
+
|
|
16
|
+
To migrate, add an `id` field to your storage constructor.
|
|
17
|
+
|
|
18
|
+
```diff
|
|
19
|
+
const storage = new PostgresStore({
|
|
20
|
+
+ id: 'main-postgres-store',
|
|
21
|
+
connectionString: process.env.POSTGRES_CONNECTION_STRING,
|
|
22
|
+
schemaName: 'public',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const upstashStore = new UpstashStore({
|
|
26
|
+
+ id: 'upstash-cache-store',
|
|
27
|
+
url: process.env.UPSTASH_REDIS_REST_URL,
|
|
28
|
+
token: process.env.UPSTASH_REDIS_REST_TOKEN,
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
12
32
|
### Pagination from `offset/limit` to `page/perPage`
|
|
13
33
|
|
|
14
34
|
All pagination APIs now use `page` and `perPage` instead of `offset` and `limit`. This change provides a more intuitive pagination model that aligns with common web pagination patterns.
|
|
@@ -50,6 +70,16 @@ To migrate, rename the method and update pagination parameters. You can now use
|
|
|
50
70
|
+ });
|
|
51
71
|
```
|
|
52
72
|
|
|
73
|
+
:::tip[Codemod]
|
|
74
|
+
|
|
75
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
npx @mastra/codemod@beta v1/storage-get-messages-paginated .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
:::
|
|
82
|
+
|
|
53
83
|
### `getThreadsByResourceId` to `listThreadsByResourceId`
|
|
54
84
|
|
|
55
85
|
The `getThreadsByResourceId()` method has been renamed to `listThreadsByResourceId()`. This change aligns with the convention that `list*` methods return collections.
|
|
@@ -65,6 +95,16 @@ To migrate, rename the method call and update pagination parameters.
|
|
|
65
95
|
});
|
|
66
96
|
```
|
|
67
97
|
|
|
98
|
+
:::tip[Codemod]
|
|
99
|
+
|
|
100
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
npx @mastra/codemod@beta v1/storage-get-threads-by-resource .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
:::
|
|
107
|
+
|
|
68
108
|
### `getWorkflowRuns` to `listWorkflowRuns`
|
|
69
109
|
|
|
70
110
|
The `getWorkflowRuns()` method has been renamed to `listWorkflowRuns()`. This change aligns with the convention that `list*` methods return collections.
|
|
@@ -81,6 +121,16 @@ To migrate, rename the method call and update pagination parameters.
|
|
|
81
121
|
});
|
|
82
122
|
```
|
|
83
123
|
|
|
124
|
+
:::tip[Codemod]
|
|
125
|
+
|
|
126
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
npx @mastra/codemod@beta v1/storage-list-workflow-runs .
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
:::
|
|
133
|
+
|
|
84
134
|
### `getMessagesById` to `listMessagesById`
|
|
85
135
|
|
|
86
136
|
The `getMessagesById()` method has been renamed to `listMessagesById()`. This change aligns with the convention that `list*` methods return collections.
|
|
@@ -94,6 +144,16 @@ To migrate, rename the method call.
|
|
|
94
144
|
});
|
|
95
145
|
```
|
|
96
146
|
|
|
147
|
+
:::tip[Codemod]
|
|
148
|
+
|
|
149
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
150
|
+
|
|
151
|
+
```shell
|
|
152
|
+
npx @mastra/codemod@beta v1/storage-list-messages-by-id .
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
:::
|
|
156
|
+
|
|
97
157
|
### Storage `getMessages` and `saveMessages` signatures
|
|
98
158
|
|
|
99
159
|
The `getMessages()` and `saveMessages()` methods have changed signatures and return types. Format overloads have been removed, and the methods now always work with `MastraDBMessage`. This change simplifies the API by removing format variations.
|
|
@@ -169,6 +229,16 @@ To migrate, pass the connection string as an object property.
|
|
|
169
229
|
+ });
|
|
170
230
|
```
|
|
171
231
|
|
|
232
|
+
:::tip[Codemod]
|
|
233
|
+
|
|
234
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
235
|
+
|
|
236
|
+
```shell
|
|
237
|
+
npx @mastra/codemod@beta v1/vector-pg-constructor .
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
:::
|
|
241
|
+
|
|
172
242
|
### PGVector `defineIndex` to `buildIndex`
|
|
173
243
|
|
|
174
244
|
The `defineIndex()` method has been removed in favor of `buildIndex()`. This change provides clearer naming for the index building operation.
|
|
@@ -198,6 +268,16 @@ To migrate, rename the parameter.
|
|
|
198
268
|
});
|
|
199
269
|
```
|
|
200
270
|
|
|
271
|
+
:::tip[Codemod]
|
|
272
|
+
|
|
273
|
+
You can use Mastra's codemod CLI to update your code automatically:
|
|
274
|
+
|
|
275
|
+
```shell
|
|
276
|
+
npx @mastra/codemod@beta v1/storage-postgres-schema-name .
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
:::
|
|
280
|
+
|
|
201
281
|
### Score storage methods to `listScoresBy*` pattern
|
|
202
282
|
|
|
203
283
|
Score storage APIs have been renamed to follow the `listScoresBy*` pattern. This change provides consistency with the broader API naming conventions.
|
|
@@ -11,11 +11,11 @@ Tool execution signatures have been updated to use separate input and context pa
|
|
|
11
11
|
|
|
12
12
|
### `createTool` execute signature to `(inputData, context)` format
|
|
13
13
|
|
|
14
|
-
All
|
|
14
|
+
All `createTool` execute functions now use a new signature with separate `inputData` and `context` parameters instead of a single destructured object. This change provides clearer separation between tool inputs and execution context.
|
|
15
15
|
|
|
16
16
|
**Note:** This change only applies to `createTool`. If you're using `createStep` for workflows, the signature remains `async (inputData, context)` and does not need to be changed.
|
|
17
17
|
|
|
18
|
-
To migrate, update
|
|
18
|
+
To migrate, update `createTool` signatures to use `inputData` as the first parameter (typed from `inputSchema`) and `context` as the second parameter.
|
|
19
19
|
|
|
20
20
|
```diff
|
|
21
21
|
createTool({
|
|
@@ -35,7 +35,7 @@ To migrate, update **`createTool`** signatures to use `inputData` as the first p
|
|
|
35
35
|
|
|
36
36
|
### `createTool` context properties organization
|
|
37
37
|
|
|
38
|
-
Context properties in
|
|
38
|
+
Context properties in `createTool` are now organized into namespaces. Agent-specific properties are under `context.agent`, workflow-specific properties are under `context.workflow`, and MCP-specific properties are under `context.mcp`. This change provides better organization and clearer API surface.
|
|
39
39
|
|
|
40
40
|
For tools that are executed inside an agent, access agent-specific properties through `context.agent`.
|
|
41
41
|
|
|
@@ -83,6 +83,11 @@ For tools that are executed inside a workflow, access workflow-specific properti
|
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
The `suspendPayload` gets validated against the `suspendSchema` when the tool is executed. If the suspendPayload doesn't match the `suspendSchema`, a warning is logged and the error is returned as tool output, but suspension continues.
|
|
87
|
+
Also, when the tool is resumed, the `resumeData` gets validated against the `resumeSchema`. If the resumeData doesn't match the `resumeSchema`, the tool will return a `ValidationError`, preventing the tool resumption.
|
|
88
|
+
|
|
89
|
+
To skip the `suspendSchema` or `resumeSchema` validation, do not define `suspendSchema` or `resumeSchema` in the tool creation.
|
|
90
|
+
|
|
86
91
|
:::note
|
|
87
92
|
For MCP-specific tool context changes, see the [MCP migration guide](/guides/v1/migrations/upgrade-to-v1/mcp).
|
|
88
93
|
:::
|
|
@@ -113,3 +118,63 @@ npx @mastra/codemod@beta v1/runtime-context .
|
|
|
113
118
|
```
|
|
114
119
|
|
|
115
120
|
:::
|
|
121
|
+
|
|
122
|
+
This applies to all tool executions, whether called directly or through agents and workflows. The type narrowing ensures you handle validation errors appropriately and prevents runtime errors when accessing output properties.
|
|
123
|
+
|
|
124
|
+
### Tool output validation with `outputSchema`
|
|
125
|
+
|
|
126
|
+
Tools with an `outputSchema` now validate their return values at runtime. Previously, `outputSchema` was only used for type inference - the output was never validated.
|
|
127
|
+
|
|
128
|
+
If your tool returns data that doesn't match its `outputSchema`, it will now return a `ValidationError` instead of the invalid data.
|
|
129
|
+
|
|
130
|
+
To fix validation errors, ensure the tool's output matches the schema definition:
|
|
131
|
+
|
|
132
|
+
```diff
|
|
133
|
+
const getUserTool = createTool({
|
|
134
|
+
id: "get-user",
|
|
135
|
+
outputSchema: z.object({
|
|
136
|
+
id: z.string(),
|
|
137
|
+
name: z.string(),
|
|
138
|
+
email: z.string().email(),
|
|
139
|
+
}),
|
|
140
|
+
execute: async (inputData) => {
|
|
141
|
+
- return { id: "123", name: "John" }; // Missing email
|
|
142
|
+
+ return { id: "123", name: "John", email: "john@example.com" };
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
When validation fails, the tool returns a `ValidationError`:
|
|
148
|
+
|
|
149
|
+
```diff
|
|
150
|
+
+ // Before v1 - invalid output would silently pass through
|
|
151
|
+
await getUserTool.execute({});
|
|
152
|
+
- // { id: "123", name: "John" } - missing email
|
|
153
|
+
+ // {
|
|
154
|
+
+ // error: true,
|
|
155
|
+
+ // message: "Tool output validation failed for get-user. The tool returned invalid output:\n- email: Required\n\nReturned output: {...}",
|
|
156
|
+
+ // validationErrors: { ... }
|
|
157
|
+
+ // }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `tool.execute` return type includes `ValidationError`
|
|
161
|
+
|
|
162
|
+
The return type of `tool.execute` now includes `ValidationError` to handle validation failures. You must narrow the result type before accessing output schema properties to satisfy TypeScript's type checking.
|
|
163
|
+
|
|
164
|
+
When calling `tool.execute`, check if the result contains an error before accessing output properties:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const result = await getUserTool.execute({});
|
|
168
|
+
|
|
169
|
+
// Type-safe check for validation errors
|
|
170
|
+
if ('error' in result && result.error) {
|
|
171
|
+
console.error('Validation failed:', result.message);
|
|
172
|
+
console.error('Details:', result.validationErrors);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// TypeScript knows result is valid here
|
|
177
|
+
console.log(result.id, result.name, result.email);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Alternatively, update the `outputSchema` to match your actual output, or remove `outputSchema` entirely if you don't need validation.
|