@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
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: Run.stream() | Streaming
|
|
3
|
-
description: Documentation for the `Run.stream()` method in workflows, which
|
|
2
|
+
title: "Reference: Run.stream() | Streaming"
|
|
3
|
+
description: Documentation for the `Run.stream()` method in workflows, which enables real-time streaming of responses.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Run.stream()
|
|
7
7
|
|
|
8
|
-
The `.stream()` method
|
|
8
|
+
The `.stream()` method enables real-time streaming of responses from a workflow.
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
12
|
```typescript showLineNumbers copy
|
|
13
13
|
const run = await workflow.createRun();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const stream = run.stream({
|
|
16
16
|
inputData: {
|
|
17
17
|
value: "initial data",
|
|
18
18
|
},
|
|
@@ -40,7 +40,7 @@ const { stream } = await run.stream({
|
|
|
40
40
|
type: "TracingContext",
|
|
41
41
|
isOptional: true,
|
|
42
42
|
description:
|
|
43
|
-
"Tracing context for creating child spans and adding metadata.
|
|
43
|
+
"Tracing context for creating child spans and adding metadata.",
|
|
44
44
|
properties: [
|
|
45
45
|
{
|
|
46
46
|
parameters: [
|
|
@@ -49,7 +49,7 @@ const { stream } = await run.stream({
|
|
|
49
49
|
type: "Span",
|
|
50
50
|
isOptional: true,
|
|
51
51
|
description:
|
|
52
|
-
"Current span for creating child spans and adding metadata.
|
|
52
|
+
"Current span for creating child spans and adding metadata.",
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
55
|
},
|
|
@@ -67,13 +67,63 @@ const { stream } = await run.stream({
|
|
|
67
67
|
name: "metadata",
|
|
68
68
|
type: "Record<string, any>",
|
|
69
69
|
isOptional: true,
|
|
70
|
+
description: "Metadata to add to the root trace span.",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
parameters: [
|
|
76
|
+
{
|
|
77
|
+
name: "requestContextKeys",
|
|
78
|
+
type: "string[]",
|
|
79
|
+
isOptional: true,
|
|
80
|
+
description:
|
|
81
|
+
"Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
parameters: [
|
|
87
|
+
{
|
|
88
|
+
name: "traceId",
|
|
89
|
+
type: "string",
|
|
90
|
+
isOptional: true,
|
|
91
|
+
description:
|
|
92
|
+
"Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
parameters: [
|
|
98
|
+
{
|
|
99
|
+
name: "parentSpanId",
|
|
100
|
+
type: "string",
|
|
101
|
+
isOptional: true,
|
|
70
102
|
description:
|
|
71
|
-
"
|
|
103
|
+
"Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
parameters: [
|
|
109
|
+
{
|
|
110
|
+
name: "tags",
|
|
111
|
+
type: "string[]",
|
|
112
|
+
isOptional: true,
|
|
113
|
+
description:
|
|
114
|
+
"Tags to apply to this trace. String labels for categorizing and filtering traces.",
|
|
72
115
|
},
|
|
73
116
|
],
|
|
74
117
|
},
|
|
75
118
|
],
|
|
76
119
|
},
|
|
120
|
+
{
|
|
121
|
+
name: "closeOnSuspend",
|
|
122
|
+
type: "boolean",
|
|
123
|
+
description:
|
|
124
|
+
"Whether to close the stream when the workflow is suspended, or to keep the stream open until the workflow is finished (by success or error). Default value is true.",
|
|
125
|
+
isOptional: true,
|
|
126
|
+
},
|
|
77
127
|
]}
|
|
78
128
|
/>
|
|
79
129
|
|
|
@@ -83,22 +133,31 @@ const { stream } = await run.stream({
|
|
|
83
133
|
content={[
|
|
84
134
|
{
|
|
85
135
|
name: "stream",
|
|
86
|
-
type: "
|
|
136
|
+
type: "MastraWorkflowStream<ChunkType>",
|
|
87
137
|
description:
|
|
88
|
-
"A
|
|
138
|
+
"A custom stream that extends ReadableStream<ChunkType> with additional workflow-specific properties",
|
|
89
139
|
},
|
|
90
140
|
{
|
|
91
|
-
name: "
|
|
92
|
-
type: "
|
|
93
|
-
description:
|
|
94
|
-
|
|
141
|
+
name: "stream.status",
|
|
142
|
+
type: "Promise<RunStatus>",
|
|
143
|
+
description: "A promise that resolves to the current workflow run status",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "stream.result",
|
|
147
|
+
type: "Promise<WorkflowResult<TState, TOutput, TSteps>>",
|
|
148
|
+
description: "A promise that resolves to the final workflow result",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "stream.usage",
|
|
152
|
+
type: "Promise<{ inputTokens: number; outputTokens: number; totalTokens: number, reasoningTokens?: number, cacheInputTokens?: number }>",
|
|
153
|
+
description: "A promise that resolves to token usage statistics",
|
|
95
154
|
},
|
|
96
155
|
{
|
|
97
|
-
name: "traceId",
|
|
156
|
+
name: "stream.traceId",
|
|
98
157
|
type: "string",
|
|
99
158
|
isOptional: true,
|
|
100
159
|
description:
|
|
101
|
-
"The trace ID associated with this execution when Tracing is enabled.
|
|
160
|
+
"The trace ID associated with this execution when Tracing is enabled.",
|
|
102
161
|
},
|
|
103
162
|
]}
|
|
104
163
|
/>
|
|
@@ -106,29 +165,29 @@ const { stream } = await run.stream({
|
|
|
106
165
|
## Extended usage example
|
|
107
166
|
|
|
108
167
|
```typescript showLineNumbers copy
|
|
109
|
-
const
|
|
168
|
+
const run = await workflow.createRun();
|
|
169
|
+
|
|
170
|
+
const stream = run.stream({
|
|
110
171
|
inputData: {
|
|
111
172
|
value: "initial data",
|
|
112
173
|
},
|
|
113
174
|
});
|
|
114
175
|
|
|
115
|
-
const result = await
|
|
176
|
+
const result = await stream.result;
|
|
116
177
|
```
|
|
117
178
|
|
|
118
179
|
## Stream Events
|
|
119
180
|
|
|
120
181
|
The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:
|
|
121
182
|
|
|
122
|
-
- **`start`**: Workflow execution begins
|
|
123
|
-
- **`step-start`**: A step begins execution
|
|
124
|
-
- **`
|
|
125
|
-
- **`
|
|
126
|
-
- **`
|
|
127
|
-
- **`step-result`**: A step completes with results
|
|
128
|
-
- **`step-finish`**: A step finishes execution
|
|
129
|
-
- **`finish`**: Workflow execution completes
|
|
183
|
+
- **`workflow-start`**: Workflow execution begins
|
|
184
|
+
- **`workflow-step-start`**: A step begins execution
|
|
185
|
+
- **`workflow-step-output`**: Custom output from a step
|
|
186
|
+
- **`workflow-step-result`**: A step completes with results
|
|
187
|
+
- **`workflow-finish`**: Workflow execution completes with usage statistics
|
|
130
188
|
|
|
131
189
|
## Related
|
|
132
190
|
|
|
133
191
|
- [Workflows overview](/docs/v1/workflows/overview#running-workflows)
|
|
134
192
|
- [Workflow.createRun()](/reference/v1/workflows/workflow-methods/create-run)
|
|
193
|
+
- [Run.resumeStream()](./resumeStream)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Run.timeTravelStream() | Streaming"
|
|
3
|
+
description: Documentation for the `Run.timeTravelStream()` method for streaming workflow time travel execution.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run.timeTravelStream()
|
|
7
|
+
|
|
8
|
+
The `.timeTravelStream()` method re-executes a workflow starting from any specific step with streaming events. This allows you to receive real-time updates during time travel execution while maintaining full visibility into each step's progress.
|
|
9
|
+
|
|
10
|
+
## Usage example
|
|
11
|
+
|
|
12
|
+
```typescript showLineNumbers copy
|
|
13
|
+
const run = await workflow.createRun();
|
|
14
|
+
|
|
15
|
+
const output = run.timeTravelStream({
|
|
16
|
+
step: "step2",
|
|
17
|
+
inputData: { value: 10 },
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Process events as they arrive
|
|
21
|
+
for await (const event of output.fullStream) {
|
|
22
|
+
console.log(event.type, event.payload);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Get the final result
|
|
26
|
+
const result = await output.result;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Parameters
|
|
30
|
+
|
|
31
|
+
All parameters are the same as [`Run.timeTravel()`](../../workflows/run-methods/timeTravel#parameters). See the [timeTravel reference](../../workflows/run-methods/timeTravel#parameters) for detailed parameter documentation.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
<PropertiesTable
|
|
36
|
+
content={[
|
|
37
|
+
{
|
|
38
|
+
name: "output",
|
|
39
|
+
type: "WorkflowRunOutput<WorkflowResult<TState, TInput, TOutput, TSteps>>",
|
|
40
|
+
description:
|
|
41
|
+
"An object containing both the stream and result promise",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "output.fullStream",
|
|
45
|
+
type: "ReadableStream<WorkflowStreamEvent>",
|
|
46
|
+
description:
|
|
47
|
+
"A readable stream that emits workflow events as execution progresses",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "output.result",
|
|
51
|
+
type: "Promise<WorkflowResult<TState, TInput, TOutput, TSteps>>",
|
|
52
|
+
description:
|
|
53
|
+
"A promise that resolves to the final workflow execution result",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "output.traceId",
|
|
57
|
+
type: "string",
|
|
58
|
+
isOptional: true,
|
|
59
|
+
description:
|
|
60
|
+
"The trace ID associated with this execution when Tracing is enabled",
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
## Stream events
|
|
66
|
+
|
|
67
|
+
The stream emits various workflow events during execution:
|
|
68
|
+
|
|
69
|
+
- `workflow-step-start`: Emitted when a step begins execution
|
|
70
|
+
- `workflow-step-finish`: Emitted when a step completes successfully
|
|
71
|
+
- `workflow-step-error`: Emitted when a step encounters an error
|
|
72
|
+
- `workflow-step-suspended`: Emitted when a step suspends
|
|
73
|
+
- Additional events depending on step types (agents, tools, etc.)
|
|
74
|
+
|
|
75
|
+
## Extended usage examples
|
|
76
|
+
|
|
77
|
+
### Processing events during time travel
|
|
78
|
+
|
|
79
|
+
```typescript showLineNumbers copy
|
|
80
|
+
const run = await workflow.createRun();
|
|
81
|
+
|
|
82
|
+
const output = run.timeTravelStream({
|
|
83
|
+
step: "step2",
|
|
84
|
+
inputData: { value: 10 },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
for await (const event of output.fullStream) {
|
|
88
|
+
switch (event.type) {
|
|
89
|
+
case "workflow-step-start":
|
|
90
|
+
console.log(`Starting step: ${event.payload.stepName}`);
|
|
91
|
+
break;
|
|
92
|
+
case "workflow-step-finish":
|
|
93
|
+
console.log(`Completed step: ${event.payload.stepName}`);
|
|
94
|
+
break;
|
|
95
|
+
case "workflow-step-error":
|
|
96
|
+
console.error(`Error in step: ${event.payload.stepName}`, event.payload.error);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const result = await output.result;
|
|
102
|
+
console.log("Time travel completed:", result);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Time travel stream with context
|
|
106
|
+
|
|
107
|
+
```typescript showLineNumbers copy
|
|
108
|
+
const output = run.timeTravelStream({
|
|
109
|
+
step: "step2",
|
|
110
|
+
context: {
|
|
111
|
+
step1: {
|
|
112
|
+
status: "success",
|
|
113
|
+
payload: { value: 0 },
|
|
114
|
+
output: { step1Result: 2 },
|
|
115
|
+
startedAt: Date.now(),
|
|
116
|
+
endedAt: Date.now(),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
for await (const event of output.fullStream) {
|
|
122
|
+
// Handle events
|
|
123
|
+
console.log(event);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const result = await output.result;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Time travel stream with nested workflows
|
|
130
|
+
|
|
131
|
+
```typescript showLineNumbers copy
|
|
132
|
+
const output = run.timeTravelStream({
|
|
133
|
+
step: ["nestedWorkflow", "step3"],
|
|
134
|
+
inputData: { value: 10 },
|
|
135
|
+
nestedStepsContext: {
|
|
136
|
+
nestedWorkflow: {
|
|
137
|
+
step2: {
|
|
138
|
+
status: "success",
|
|
139
|
+
payload: { step1Result: 2 },
|
|
140
|
+
output: { step2Result: 3 },
|
|
141
|
+
startedAt: Date.now(),
|
|
142
|
+
endedAt: Date.now(),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
for await (const event of output.fullStream) {
|
|
149
|
+
console.log(event.type, event.payload);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const result = await output.result;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Notes
|
|
156
|
+
|
|
157
|
+
- The stream closes automatically when time travel execution completes or encounters an error
|
|
158
|
+
- You can process events from the stream while the workflow is still executing
|
|
159
|
+
- The `result` promise resolves only after all steps have completed
|
|
160
|
+
- Stream events follow the same format as regular workflow streaming
|
|
161
|
+
- Time travel streaming requires storage to be configured since it relies on persisted workflow snapshots
|
|
162
|
+
|
|
163
|
+
## Related
|
|
164
|
+
|
|
165
|
+
- [Run.timeTravel()](../../workflows/run-methods/timeTravel)
|
|
166
|
+
- [Time Travel](/docs/v1/workflows/time-travel)
|
|
167
|
+
- [Workflow Streaming](/docs/v1/streaming/workflow-streaming)
|
|
168
|
+
- [Run.stream()](./stream)
|
|
169
|
+
- [Run.resumeStream()](./resumeStream)
|
|
170
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: LLM provider API keys (choose one or more) | Templates
|
|
2
|
+
title: "Reference: LLM provider API keys (choose one or more) | Templates"
|
|
3
3
|
description: "Complete guide to creating, using, and contributing Mastra templates"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -118,13 +118,10 @@ We recommend using OpenAI, Anthropic, or Google model providers for templates. C
|
|
|
118
118
|
|
|
119
119
|
```typescript title="src/mastra/agents/example-agent.ts"
|
|
120
120
|
import { Agent } from "@mastra/core/agent";
|
|
121
|
-
import { openai } from "@ai-sdk/openai";
|
|
122
|
-
// Or use: import { anthropic } from '@ai-sdk/anthropic';
|
|
123
|
-
// Or use: import { google } from '@ai-sdk/google';
|
|
124
121
|
|
|
125
122
|
const agent = new Agent({
|
|
126
123
|
name: "example-agent",
|
|
127
|
-
model: openai
|
|
124
|
+
model: "openai/gpt-5.1", // or other provider strings
|
|
128
125
|
instructions: "Your agent instructions here",
|
|
129
126
|
// ... other configuration
|
|
130
127
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: MastraMCPClient (Deprecated) | Tools & MCP
|
|
2
|
+
title: "Reference: MastraMCPClient (Deprecated) | Tools & MCP"
|
|
3
3
|
description: API Reference for MastraMCPClient - A client implementation for the Model Context Protocol.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -230,7 +230,6 @@ Returns an object mapping tool names to their corresponding Mastra tool implemen
|
|
|
230
230
|
```typescript
|
|
231
231
|
import { Agent } from "@mastra/core/agent";
|
|
232
232
|
import { MastraMCPClient } from "@mastra/mcp";
|
|
233
|
-
import { openai } from "@ai-sdk/openai";
|
|
234
233
|
|
|
235
234
|
// Initialize the MCP client using mcp/fetch as an example https://hub.docker.com/r/mcp/fetch
|
|
236
235
|
// Visit https://github.com/docker/mcp-servers for other reference docker mcp servers
|
|
@@ -250,7 +249,7 @@ const agent = new Agent({
|
|
|
250
249
|
name: "Fetch agent",
|
|
251
250
|
instructions:
|
|
252
251
|
"You are able to fetch data from URLs on demand and discuss the response data with the user.",
|
|
253
|
-
model: openai
|
|
252
|
+
model: "openai/gpt-5.1",
|
|
254
253
|
});
|
|
255
254
|
|
|
256
255
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: createTool() | Tools & MCP
|
|
2
|
+
title: "Reference: createTool() | Tools & MCP"
|
|
3
3
|
description: Documentation for the `createTool()` function in Mastra, used to define custom tools for agents.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -131,6 +131,34 @@ export const tool = createTool({
|
|
|
131
131
|
},
|
|
132
132
|
],
|
|
133
133
|
},
|
|
134
|
+
{
|
|
135
|
+
name: "onInputStart",
|
|
136
|
+
type: "function",
|
|
137
|
+
description:
|
|
138
|
+
"Optional callback invoked when the tool call input streaming begins. Receives `toolCallId`, `messages`, and `abortSignal`.",
|
|
139
|
+
isOptional: true,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "onInputDelta",
|
|
143
|
+
type: "function",
|
|
144
|
+
description:
|
|
145
|
+
"Optional callback invoked for each incremental chunk of input text as it streams in. Receives `inputTextDelta`, `toolCallId`, `messages`, and `abortSignal`.",
|
|
146
|
+
isOptional: true,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "onInputAvailable",
|
|
150
|
+
type: "function",
|
|
151
|
+
description:
|
|
152
|
+
"Optional callback invoked when the complete tool input is available and parsed. Receives the validated `input` object, `toolCallId`, `messages`, and `abortSignal`.",
|
|
153
|
+
isOptional: true,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "onOutput",
|
|
157
|
+
type: "function",
|
|
158
|
+
description:
|
|
159
|
+
"Optional callback invoked after the tool has successfully executed and returned output. Receives the tool's `output`, `toolCallId`, `messages`, and `abortSignal`.",
|
|
160
|
+
isOptional: true,
|
|
161
|
+
},
|
|
134
162
|
]}
|
|
135
163
|
/>
|
|
136
164
|
|
|
@@ -149,9 +177,112 @@ The `createTool()` function returns a `Tool` object.
|
|
|
149
177
|
]}
|
|
150
178
|
/>
|
|
151
179
|
|
|
180
|
+
## Tool Lifecycle Hooks
|
|
181
|
+
|
|
182
|
+
Tools support lifecycle hooks that allow you to monitor and react to different stages of tool execution. These hooks are particularly useful for logging, analytics, validation, and real-time updates during streaming.
|
|
183
|
+
|
|
184
|
+
### Available Hooks
|
|
185
|
+
|
|
186
|
+
#### onInputStart
|
|
187
|
+
|
|
188
|
+
Called when tool call input streaming begins, before any input data is received.
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
export const tool = createTool({
|
|
192
|
+
id: "example-tool",
|
|
193
|
+
description: "Example tool with hooks",
|
|
194
|
+
onInputStart: ({ toolCallId, messages, abortSignal }) => {
|
|
195
|
+
console.log(`Tool ${toolCallId} input streaming started`);
|
|
196
|
+
},
|
|
197
|
+
// ... other properties
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### onInputDelta
|
|
202
|
+
|
|
203
|
+
Called for each incremental chunk of input text as it streams in. Useful for showing real-time progress or parsing partial JSON.
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
export const tool = createTool({
|
|
207
|
+
id: "example-tool",
|
|
208
|
+
description: "Example tool with hooks",
|
|
209
|
+
onInputDelta: ({ inputTextDelta, toolCallId, messages, abortSignal }) => {
|
|
210
|
+
console.log(`Received input chunk: ${inputTextDelta}`);
|
|
211
|
+
},
|
|
212
|
+
// ... other properties
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### onInputAvailable
|
|
217
|
+
|
|
218
|
+
Called when the complete tool input is available and has been parsed and validated against the `inputSchema`.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
export const tool = createTool({
|
|
222
|
+
id: "example-tool",
|
|
223
|
+
description: "Example tool with hooks",
|
|
224
|
+
inputSchema: z.object({
|
|
225
|
+
city: z.string(),
|
|
226
|
+
}),
|
|
227
|
+
onInputAvailable: ({ input, toolCallId, messages, abortSignal }) => {
|
|
228
|
+
console.log(`Tool received complete input:`, input);
|
|
229
|
+
// input is fully typed based on inputSchema
|
|
230
|
+
},
|
|
231
|
+
// ... other properties
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### onOutput
|
|
236
|
+
|
|
237
|
+
Called after the tool has successfully executed and returned output. Useful for logging results, triggering follow-up actions, or analytics.
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
export const tool = createTool({
|
|
241
|
+
id: "example-tool",
|
|
242
|
+
description: "Example tool with hooks",
|
|
243
|
+
outputSchema: z.object({
|
|
244
|
+
result: z.string(),
|
|
245
|
+
}),
|
|
246
|
+
execute: async (input) => {
|
|
247
|
+
return { result: "Success" };
|
|
248
|
+
},
|
|
249
|
+
onOutput: ({ output, toolCallId, toolName, abortSignal }) => {
|
|
250
|
+
console.log(`${toolName} execution completed:`, output);
|
|
251
|
+
// output is fully typed based on outputSchema
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Hook Execution Order
|
|
257
|
+
|
|
258
|
+
For a typical streaming tool call, the hooks are invoked in this order:
|
|
259
|
+
|
|
260
|
+
1. **onInputStart** - Input streaming begins
|
|
261
|
+
2. **onInputDelta** - Called multiple times as chunks arrive
|
|
262
|
+
3. **onInputAvailable** - Complete input is parsed and validated
|
|
263
|
+
4. Tool's **execute** function runs
|
|
264
|
+
5. **onOutput** - Tool has completed successfully
|
|
265
|
+
|
|
266
|
+
### Hook Parameters
|
|
267
|
+
|
|
268
|
+
All hooks receive a parameter object with these common properties:
|
|
269
|
+
|
|
270
|
+
- `toolCallId` (string): Unique identifier for this specific tool call
|
|
271
|
+
- `abortSignal` (AbortSignal): Signal for detecting if the operation should be cancelled
|
|
272
|
+
|
|
273
|
+
Additionally:
|
|
274
|
+
- `onInputStart`, `onInputDelta`, and `onInputAvailable` receive `messages` (array): The conversation messages at the time of the tool call
|
|
275
|
+
- `onInputDelta` receives `inputTextDelta` (string): The incremental text chunk
|
|
276
|
+
- `onInputAvailable` receives `input`: The validated input data (typed according to `inputSchema`)
|
|
277
|
+
- `onOutput` receives `output`: The tool's return value (typed according to `outputSchema`) and `toolName` (string): The name of the tool
|
|
278
|
+
|
|
279
|
+
### Error Handling
|
|
280
|
+
|
|
281
|
+
Hook errors are caught and logged automatically, but do not prevent tool execution from continuing. If a hook throws an error, it will be logged to the console but will not fail the tool call.
|
|
282
|
+
|
|
152
283
|
## Related
|
|
153
284
|
|
|
154
|
-
- [
|
|
285
|
+
- [MCP Overview](/docs/v1/mcp/overview)
|
|
155
286
|
- [Using Tools with Agents](/docs/v1/agents/using-tools)
|
|
156
|
-
- [Tool
|
|
157
|
-
- [
|
|
287
|
+
- [Tool Streaming](/docs/v1/streaming/tool-streaming)
|
|
288
|
+
- [Request Context](/docs/v1/server-db/request-context#accessing-values-with-tools)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: createDocumentChunkerTool() | Tools & MCP
|
|
2
|
+
title: "Reference: createDocumentChunkerTool() | Tools & MCP"
|
|
3
3
|
description: Documentation for the Document Chunker Tool in Mastra, which splits documents into smaller chunks for efficient processing and retrieval.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Reference: createGraphRAGTool() | Tools & MCP
|
|
2
|
+
title: "Reference: createGraphRAGTool() | Tools & MCP"
|
|
3
3
|
description: Documentation for the Graph RAG Tool in Mastra, which enhances RAG by building a graph of semantic relationships between documents.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -10,13 +10,13 @@ The `createGraphRAGTool()` creates a tool that enhances RAG by building a graph
|
|
|
10
10
|
## Usage Example
|
|
11
11
|
|
|
12
12
|
```typescript
|
|
13
|
-
import { openai } from "@ai-sdk/openai";
|
|
14
13
|
import { createGraphRAGTool } from "@mastra/rag";
|
|
14
|
+
import { ModelRouterEmbeddingModel } from "@mastra/core/llm";
|
|
15
15
|
|
|
16
16
|
const graphTool = createGraphRAGTool({
|
|
17
17
|
vectorStoreName: "pinecone",
|
|
18
18
|
indexName: "docs",
|
|
19
|
-
model:
|
|
19
|
+
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
20
20
|
graphOptions: {
|
|
21
21
|
dimension: 1536,
|
|
22
22
|
threshold: 0.7,
|
|
@@ -193,7 +193,7 @@ The default description focuses on:
|
|
|
193
193
|
const graphTool = createGraphRAGTool({
|
|
194
194
|
vectorStoreName: "pinecone",
|
|
195
195
|
indexName: "docs",
|
|
196
|
-
model:
|
|
196
|
+
model: new ModelRouterEmbeddingModel("openai/text-embedding-3-small"),
|
|
197
197
|
graphOptions: {
|
|
198
198
|
dimension: 1536,
|
|
199
199
|
threshold: 0.8, // Higher similarity threshold
|
|
@@ -209,7 +209,7 @@ const graphTool = createGraphRAGTool({
|
|
|
209
209
|
const graphTool = createGraphRAGTool({
|
|
210
210
|
vectorStoreName: "pinecone",
|
|
211
211
|
indexName: "docs",
|
|
212
|
-
model: openai
|
|
212
|
+
model: "openai/text-embedding-3-small ",
|
|
213
213
|
description:
|
|
214
214
|
"Analyze document relationships to find complex patterns and connections in our company's historical data",
|
|
215
215
|
});
|
|
@@ -223,7 +223,7 @@ This example shows how to customize the tool description for a specific use case
|
|
|
223
223
|
const graphTool = createGraphRAGTool({
|
|
224
224
|
vectorStoreName: "pinecone",
|
|
225
225
|
indexName: "docs",
|
|
226
|
-
model: openai
|
|
226
|
+
model: "openai/text-embedding-3-small ",
|
|
227
227
|
});
|
|
228
228
|
```
|
|
229
229
|
|
|
@@ -254,7 +254,7 @@ const response = await agent.generate(
|
|
|
254
254
|
For more information on request context, please see:
|
|
255
255
|
|
|
256
256
|
- [Agent Request Context](/docs/v1/server-db/request-context)
|
|
257
|
-
- [
|
|
257
|
+
- [Request Context](/docs/v1/server-db/request-context#accessing-values-with-tools)
|
|
258
258
|
|
|
259
259
|
## Related
|
|
260
260
|
|