@mastra/mcp-docs-server 0.13.39 → 0.13.40-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Freact.md +8 -8
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +8 -8
- package/.docs/organized/changelogs/create-mastra.md +3 -3
- package/.docs/organized/changelogs/mastra.md +13 -13
- package/.docs/raw/agents/adding-voice.mdx +1 -1
- package/.docs/raw/agents/agent-memory.mdx +1 -1
- package/.docs/raw/agents/guardrails.mdx +1 -1
- package/.docs/raw/agents/networks.mdx +1 -1
- package/.docs/raw/agents/overview.mdx +120 -64
- package/.docs/raw/agents/using-tools.mdx +138 -15
- 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/02-agent-tools-mcp/04-initializing-mcp-tools.md +2 -2
- package/.docs/raw/deployment/{server-deployment.mdx → building-mastra.mdx} +3 -3
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +2 -2
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +1 -1
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/cloudflare-deployer.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +1 -1
- package/.docs/raw/deployment/cloud-providers/index.mdx +6 -3
- package/.docs/raw/deployment/{serverless-platforms → cloud-providers}/netlify-deployer.mdx +1 -1
- 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/{mastra-cloud → deployment/mastra-cloud}/observability.mdx +2 -2
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/overview.mdx +3 -3
- package/.docs/raw/{mastra-cloud → deployment/mastra-cloud}/setting-up.mdx +3 -3
- package/.docs/raw/deployment/monorepo.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +5 -5
- package/.docs/raw/deployment/web-framework.mdx +1 -1
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +5 -1
- package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +1 -1
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +1 -1
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +1 -1
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +1 -1
- package/.docs/raw/frameworks/servers/express.mdx +1 -1
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +1 -1
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +1 -1
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +1 -1
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +1 -1
- package/.docs/raw/getting-started/installation.mdx +1 -1
- package/.docs/raw/getting-started/mcp-docs-server.mdx +1 -1
- package/.docs/raw/getting-started/project-structure.mdx +1 -1
- package/.docs/raw/getting-started/studio.mdx +2 -2
- package/.docs/raw/getting-started/templates.mdx +1 -1
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/{tools-mcp/mcp-overview.mdx → mcp/overview.mdx} +2 -2
- package/.docs/raw/mcp/publishing-mcp-server.mdx +137 -0
- package/.docs/raw/memory/conversation-history.mdx +1 -1
- package/.docs/raw/memory/memory-processors.mdx +1 -1
- package/.docs/raw/memory/overview.mdx +2 -2
- package/.docs/raw/memory/semantic-recall.mdx +2 -2
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +1 -1
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +150 -0
- package/.docs/raw/memory/storage/memory-with-pg.mdx +1 -1
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +1 -1
- package/.docs/raw/memory/threads-and-resources.mdx +1 -1
- package/.docs/raw/memory/working-memory.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/arize.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +2 -2
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/overview.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +1 -1
- package/.docs/raw/observability/logging.mdx +5 -5
- package/.docs/raw/observability/nextjs-tracing.mdx +1 -1
- package/.docs/raw/observability/otel-tracing.mdx +1 -1
- package/.docs/raw/observability/overview.mdx +1 -1
- package/.docs/raw/rag/overview.mdx +1 -1
- package/.docs/raw/rag/retrieval.mdx +1 -1
- package/.docs/raw/rag/vector-databases.mdx +1 -1
- package/.docs/raw/reference/agents/agent.mdx +1 -1
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +1 -1
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.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 +1 -1
- package/.docs/raw/reference/agents/getMemory.mdx +1 -1
- package/.docs/raw/reference/agents/getModel.mdx +1 -1
- package/.docs/raw/reference/agents/getScorers.mdx +1 -1
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +1 -1
- package/.docs/raw/reference/agents/getWorkflows.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/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/agents/network.mdx +1 -1
- 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 +2 -2
- package/.docs/raw/reference/client-js/agents.mdx +2 -2
- 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 +5 -5
- package/.docs/raw/reference/client-js/memory.mdx +1 -1
- 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 +2 -2
- package/.docs/raw/reference/client-js/vectors.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows.mdx +1 -1
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getAgents.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getLogs.mdx +1 -1
- package/.docs/raw/reference/core/getLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +2 -2
- package/.docs/raw/reference/core/getMCPServers.mdx +2 -2
- package/.docs/raw/reference/core/getMemory.mdx +1 -1
- package/.docs/raw/reference/core/getScorer.mdx +1 -1
- package/.docs/raw/reference/core/getScorerByName.mdx +1 -1
- package/.docs/raw/reference/core/getScorers.mdx +1 -1
- package/.docs/raw/reference/core/getServer.mdx +2 -2
- package/.docs/raw/reference/core/getStorage.mdx +1 -1
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getVectors.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listScorers.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/mastra-class.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +1 -1
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- 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 +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +1 -1
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-position.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/context-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/contextual-recall.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +1 -1
- package/.docs/raw/reference/evals/summarization.mdx +1 -1
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/after.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/else.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/events.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/if.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/start.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/then.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/until.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/while.mdx +1 -1
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +1 -1
- 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/getThreadsByResourceId.mdx +1 -1
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +1 -1
- package/.docs/raw/reference/memory/memory-class.mdx +1 -1
- package/.docs/raw/reference/memory/query.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/arize.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +1 -1
- package/.docs/raw/reference/observability/ai-tracing/span.mdx +1 -1
- package/.docs/raw/reference/observability/logging/pino-logger.mdx +2 -2
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +1 -1
- package/.docs/raw/reference/processors/language-detector.mdx +1 -1
- package/.docs/raw/reference/processors/moderation-processor.mdx +1 -1
- package/.docs/raw/reference/processors/pii-detector.mdx +1 -1
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +1 -1
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +1 -1
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +1 -1
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +1 -1
- 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 +1 -1
- 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 +1 -1
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +1 -1
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/scorers/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/scorers/bias.mdx +1 -1
- package/.docs/raw/reference/scorers/completeness.mdx +1 -1
- package/.docs/raw/reference/scorers/content-similarity.mdx +1 -1
- package/.docs/raw/reference/scorers/context-precision.mdx +1 -1
- package/.docs/raw/reference/scorers/context-relevance.mdx +1 -1
- package/.docs/raw/reference/scorers/create-scorer.mdx +1 -1
- package/.docs/raw/reference/scorers/faithfulness.mdx +1 -1
- package/.docs/raw/reference/scorers/hallucination.mdx +1 -1
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/scorers/mastra-scorer.mdx +1 -1
- package/.docs/raw/reference/scorers/noise-sensitivity.mdx +1 -1
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +1 -1
- package/.docs/raw/reference/scorers/run-experiment.mdx +1 -1
- package/.docs/raw/reference/scorers/textual-difference.mdx +1 -1
- package/.docs/raw/reference/scorers/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +1 -1
- package/.docs/raw/reference/scorers/toxicity.mdx +1 -1
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +1 -1
- package/.docs/raw/reference/storage/cloudflare.mdx +1 -1
- package/.docs/raw/reference/storage/dynamodb.mdx +1 -1
- package/.docs/raw/reference/storage/lance.mdx +1 -1
- package/.docs/raw/reference/storage/libsql.mdx +1 -1
- package/.docs/raw/reference/storage/mongodb.mdx +1 -1
- package/.docs/raw/reference/storage/mssql.mdx +1 -1
- package/.docs/raw/reference/storage/postgresql.mdx +1 -1
- package/.docs/raw/reference/storage/upstash.mdx +1 -1
- package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +1 -1
- package/.docs/raw/reference/templates/overview.mdx +1 -1
- package/.docs/raw/reference/tools/client.mdx +1 -1
- package/.docs/raw/reference/tools/create-tool.mdx +3 -4
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +1 -1
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +2 -2
- package/.docs/raw/reference/tools/mcp-client.mdx +9 -9
- package/.docs/raw/reference/tools/mcp-server.mdx +2 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +3 -3
- package/.docs/raw/reference/vectors/astra.mdx +1 -1
- package/.docs/raw/reference/vectors/chroma.mdx +1 -1
- package/.docs/raw/reference/vectors/couchbase.mdx +1 -1
- package/.docs/raw/reference/vectors/lance.mdx +1 -1
- package/.docs/raw/reference/vectors/libsql.mdx +1 -1
- package/.docs/raw/reference/vectors/mongodb.mdx +1 -1
- package/.docs/raw/reference/vectors/opensearch.mdx +1 -1
- package/.docs/raw/reference/vectors/pg.mdx +1 -1
- package/.docs/raw/reference/vectors/pinecone.mdx +1 -1
- package/.docs/raw/reference/vectors/qdrant.mdx +1 -1
- package/.docs/raw/reference/vectors/s3vectors.mdx +1 -1
- package/.docs/raw/reference/vectors/turbopuffer.mdx +1 -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 +1 -1
- package/.docs/raw/reference/voice/cloudflare.mdx +1 -1
- package/.docs/raw/reference/voice/composite-voice.mdx +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/.docs/raw/reference/voice/voice.addTools.mdx +1 -1
- package/.docs/raw/reference/voice/voice.answer.mdx +1 -1
- package/.docs/raw/reference/voice/voice.close.mdx +1 -1
- package/.docs/raw/reference/voice/voice.connect.mdx +1 -1
- 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 +1 -1
- package/.docs/raw/reference/voice/voice.off.mdx +1 -1
- package/.docs/raw/reference/voice/voice.on.mdx +1 -1
- package/.docs/raw/reference/voice/voice.send.mdx +1 -1
- package/.docs/raw/reference/voice/voice.speak.mdx +1 -1
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/start.mdx +1 -1
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +1 -1
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +1 -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 +1 -1
- 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 +1 -1
- package/.docs/raw/scorers/{off-the-shelf-scorers.mdx → built-in-scorers.mdx} +7 -5
- package/.docs/raw/scorers/custom-scorers.mdx +16 -16
- package/.docs/raw/scorers/{evals-old-api → evals-legacy}/custom-eval.mdx +1 -1
- package/.docs/raw/scorers/{evals-old-api → evals-legacy}/overview.mdx +13 -13
- package/.docs/raw/scorers/{evals-old-api → evals-legacy}/running-in-ci.mdx +5 -5
- package/.docs/raw/scorers/{evals-old-api → evals-legacy}/textual-evals.mdx +7 -7
- package/.docs/raw/scorers/overview.mdx +5 -5
- package/.docs/raw/server-db/custom-api-routes.mdx +1 -1
- package/.docs/raw/server-db/mastra-client.mdx +2 -2
- package/.docs/raw/server-db/{production-server.mdx → mastra-server.mdx} +2 -2
- package/.docs/raw/server-db/middleware.mdx +30 -30
- package/.docs/raw/server-db/runtime-context.mdx +3 -3
- package/.docs/raw/server-db/storage.mdx +1 -1
- package/.docs/raw/streaming/events.mdx +1 -1
- package/.docs/raw/streaming/overview.mdx +1 -1
- package/.docs/raw/streaming/tool-streaming.mdx +1 -1
- package/.docs/raw/streaming/workflow-streaming.mdx +1 -1
- package/.docs/raw/voice/overview.mdx +1 -1
- package/.docs/raw/voice/speech-to-speech.mdx +1 -1
- package/.docs/raw/voice/speech-to-text.mdx +1 -1
- package/.docs/raw/voice/text-to-speech.mdx +1 -1
- package/.docs/raw/workflows/agents-and-tools.mdx +2 -2
- package/.docs/raw/workflows/control-flow.mdx +7 -1
- package/.docs/raw/workflows/error-handling.mdx +4 -4
- package/.docs/raw/workflows/human-in-the-loop.mdx +160 -210
- package/.docs/raw/workflows/inngest-workflow.mdx +1 -1
- package/.docs/raw/workflows/overview.mdx +11 -2
- package/.docs/raw/workflows/snapshots.mdx +4 -4
- package/.docs/raw/workflows/suspend-and-resume.mdx +72 -215
- package/.docs/raw/workflows-legacy/control-flow.mdx +1 -1
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +1 -1
- package/.docs/raw/workflows-legacy/error-handling.mdx +1 -1
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +1 -1
- package/.docs/raw/workflows-legacy/overview.mdx +1 -1
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +1 -1
- package/.docs/raw/workflows-legacy/steps.mdx +1 -1
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +1 -1
- package/.docs/raw/workflows-legacy/variables.mdx +1 -1
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
- package/.docs/raw/deployment/serverless-platforms/index.mdx +0 -55
- package/.docs/raw/reference/agents/listTools.mdx +0 -69
- package/.docs/raw/reference/core/listAgents.mdx +0 -35
- package/.docs/raw/tools-mcp/advanced-usage.mdx +0 -128
- package/.docs/raw/tools-mcp/overview.mdx +0 -88
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Using Agents | Agents
|
|
2
|
+
title: "Using Agents | Agents"
|
|
3
3
|
description: Overview of agents in Mastra, detailing their capabilities and how they interact with tools, workflows, and external systems.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -177,9 +177,9 @@ export const mastra = new Mastra({
|
|
|
177
177
|
});
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
##
|
|
180
|
+
## Calling an agent
|
|
181
181
|
|
|
182
|
-
You can call agents from workflow steps, tools, the Mastra Client
|
|
182
|
+
You can call agents from workflow steps, tools, or the Mastra Client. Get a reference by calling `.getAgent()` on your `mastra` or `mastraClient` instance, depending on your setup:
|
|
183
183
|
|
|
184
184
|
```typescript showLineNumbers copy
|
|
185
185
|
const testAgent = mastra.getAgent("testAgent");
|
|
@@ -187,12 +187,71 @@ const testAgent = mastra.getAgent("testAgent");
|
|
|
187
187
|
|
|
188
188
|
:::info
|
|
189
189
|
|
|
190
|
-
`mastra.getAgent()` is preferred over
|
|
191
|
-
|
|
192
|
-
See [Calling agents](/examples/agents/calling-agents) for more information.
|
|
190
|
+
`mastra.getAgent()` is preferred over directly importing an agent in to your file, since it provides access to the Mastra instance configuration (logger, telemetry, storage, registered agents, and vector stores).
|
|
193
191
|
|
|
194
192
|
:::
|
|
195
193
|
|
|
194
|
+
### From a workflow step
|
|
195
|
+
|
|
196
|
+
The `mastra` instance is passed as an argument to a workflow step’s `execute` function. It provides access to registered agents using `getAgent()`. Use this method to retrieve your agent, then call `generate()` with a prompt.
|
|
197
|
+
|
|
198
|
+
```typescript filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
199
|
+
const step1 = createStep({
|
|
200
|
+
// ...
|
|
201
|
+
execute: async ({ mastra }) => {
|
|
202
|
+
|
|
203
|
+
const agent = mastra.getAgent("testAgent");
|
|
204
|
+
const response = await agent.generate("Help me organize my day");
|
|
205
|
+
|
|
206
|
+
console.log(response.text);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### From a tool
|
|
212
|
+
|
|
213
|
+
The `mastra` instance is available within a tool’s `execute` function. Use `getAgent()` to retrieve a registered agent and call `generate()` with a prompt.
|
|
214
|
+
|
|
215
|
+
```typescript filename="src/mastra/tools/test-tool.ts" showLineNumbers copy
|
|
216
|
+
export const testTool = createTool({
|
|
217
|
+
// ...
|
|
218
|
+
execute: async ({ mastra }) => {
|
|
219
|
+
|
|
220
|
+
const agent = mastra.getAgent("testAgent");
|
|
221
|
+
const response = await agent.generate("Help me organize my day");
|
|
222
|
+
|
|
223
|
+
console.log(response!.text);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Using HTTP or curl
|
|
229
|
+
|
|
230
|
+
You can interact with a registered agent by sending a `POST` request to your Mastra application's `/generate` endpoint. Include a `messages` array of role/content pairs.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
curl -X POST http://localhost:4111/api/agents/testAgent/generate \
|
|
234
|
+
-H "Content-Type: application/json" \
|
|
235
|
+
-d '{
|
|
236
|
+
"messages": [
|
|
237
|
+
{
|
|
238
|
+
"role": "user",
|
|
239
|
+
"content": "Help me organize my day"
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}'| jq -r '.text'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Example output**
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
1. What time do you plan to start your day?
|
|
249
|
+
2. Do you have any specific tasks or appointments scheduled for today?
|
|
250
|
+
3. Are there any personal goals or activities you want to include (e.g., exercise, reading, hobbies)?
|
|
251
|
+
4. How much time do you want to allocate for work versus personal time?
|
|
252
|
+
5. Do you have any deadlines or priorities that need to be addressed?
|
|
253
|
+
```
|
|
254
|
+
|
|
196
255
|
## Generating responses
|
|
197
256
|
|
|
198
257
|
Agents can return results in two ways: generating the full output before returning it or streaming tokens in real time. Choose the approach that fits your use case: generate for short, internal responses or debugging, and stream to deliver pixels to end users as quickly as possible.
|
|
@@ -361,59 +420,6 @@ const response = await testAgentThatDoesntSupportStructuredOutput.generate(
|
|
|
361
420
|
console.log(response.object);
|
|
362
421
|
```
|
|
363
422
|
|
|
364
|
-
## Working with images
|
|
365
|
-
|
|
366
|
-
Agents can analyze and describe images by processing both the visual content and any text within them. To enable image analysis, pass an object with `type: 'image'` and the image URL in the `content` array. You can combine image content with text prompts to guide the agent's analysis.
|
|
367
|
-
|
|
368
|
-
```typescript showLineNumbers copy
|
|
369
|
-
const response = await testAgent.generate([
|
|
370
|
-
{
|
|
371
|
-
role: "user",
|
|
372
|
-
content: [
|
|
373
|
-
{
|
|
374
|
-
type: "image",
|
|
375
|
-
image: "https://placebear.com/cache/395-205.jpg",
|
|
376
|
-
mimeType: "image/jpeg",
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
type: "text",
|
|
380
|
-
text: "Describe the image in detail, and extract all the text in the image.",
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
},
|
|
384
|
-
]);
|
|
385
|
-
|
|
386
|
-
console.log(response.text);
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
For a detailed guide to creating and configuring tools, see the [Tools Overview](../tools-mcp/overview) page.
|
|
390
|
-
|
|
391
|
-
### Using `maxSteps`
|
|
392
|
-
|
|
393
|
-
The `maxSteps` parameter controls the maximum number of sequential LLM calls an agent can make. Each step includes generating a response, executing any tool calls, and processing the result. Limiting steps helps prevent infinite loops, reduce latency, and control token usage for agents that use tools. The default is 1, but can be increased:
|
|
394
|
-
|
|
395
|
-
```typescript showLineNumbers copy
|
|
396
|
-
const response = await testAgent.generate("Help me organize my day", {
|
|
397
|
-
maxSteps: 5,
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
console.log(response.text);
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### Using `onStepFinish`
|
|
404
|
-
|
|
405
|
-
You can monitor the progress of multi-step operations using the `onStepFinish` callback. This is useful for debugging or providing progress updates to users.
|
|
406
|
-
|
|
407
|
-
`onStepFinish` is only available when streaming or generating text without structured output.
|
|
408
|
-
|
|
409
|
-
```typescript showLineNumbers copy
|
|
410
|
-
const response = await testAgent.generate("Help me organize my day", {
|
|
411
|
-
onStepFinish: ({ text, toolCalls, toolResults, finishReason, usage }) => {
|
|
412
|
-
console.log({ text, toolCalls, toolResults, finishReason, usage });
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
423
|
## Using tools
|
|
418
424
|
|
|
419
425
|
Agents can use tools to go beyond language generation, enabling structured interactions with external APIs and services. Tools allow agents to access data and perform clearly defined operations in a reliable, repeatable way.
|
|
@@ -425,7 +431,7 @@ export const testAgent = new Agent({
|
|
|
425
431
|
});
|
|
426
432
|
```
|
|
427
433
|
|
|
428
|
-
> See [Using Tools](
|
|
434
|
+
> See [Using Tools](/docs/agents/using-tools) for more information.
|
|
429
435
|
|
|
430
436
|
## Using `RuntimeContext`
|
|
431
437
|
|
|
@@ -450,13 +456,63 @@ export const testAgent = new Agent({
|
|
|
450
456
|
|
|
451
457
|
> See [Runtime Context](/docs/server-db/runtime-context) for more information.
|
|
452
458
|
|
|
459
|
+
## Using `maxSteps`
|
|
460
|
+
|
|
461
|
+
The `maxSteps` parameter controls the maximum number of sequential LLM calls an agent can make. Each step includes generating a response, executing any tool calls, and processing the result. Limiting steps helps prevent infinite loops, reduce latency, and control token usage for agents that use tools. The default is 5, but can be increased:
|
|
462
|
+
|
|
463
|
+
```typescript showLineNumbers copy
|
|
464
|
+
const response = await testAgent.generate("Help me organize my day", {
|
|
465
|
+
maxSteps: 10,
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
console.log(response.text);
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
## Using `onStepFinish`
|
|
472
|
+
|
|
473
|
+
You can monitor the progress of multi-step operations using the `onStepFinish` callback. This is useful for debugging or providing progress updates to users.
|
|
474
|
+
|
|
475
|
+
`onStepFinish` is only available when streaming or generating text without structured output.
|
|
476
|
+
|
|
477
|
+
```typescript showLineNumbers copy
|
|
478
|
+
const response = await testAgent.generate("Help me organize my day", {
|
|
479
|
+
onStepFinish: ({ text, toolCalls, toolResults, finishReason, usage }) => {
|
|
480
|
+
console.log({ text, toolCalls, toolResults, finishReason, usage });
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
## Working with images
|
|
486
|
+
|
|
487
|
+
Agents can analyze and describe images by processing both the visual content and any text within them. To enable image analysis, pass an object with `type: 'image'` and the image URL in the `content` array. You can combine image content with text prompts to guide the agent's analysis.
|
|
488
|
+
|
|
489
|
+
```typescript showLineNumbers copy
|
|
490
|
+
const response = await testAgent.generate([
|
|
491
|
+
{
|
|
492
|
+
role: "user",
|
|
493
|
+
content: [
|
|
494
|
+
{
|
|
495
|
+
type: "image",
|
|
496
|
+
image: "https://placebear.com/cache/395-205.jpg",
|
|
497
|
+
mimeType: "image/jpeg",
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
type: "text",
|
|
501
|
+
text: "Describe the image in detail, and extract all the text in the image.",
|
|
502
|
+
},
|
|
503
|
+
],
|
|
504
|
+
},
|
|
505
|
+
]);
|
|
506
|
+
|
|
507
|
+
console.log(response.text);
|
|
508
|
+
```
|
|
509
|
+
|
|
453
510
|
## Testing with Studio
|
|
454
511
|
|
|
455
512
|
Use [Studio](/docs/getting-started/studio) to test agents with different messages, inspect tool calls and responses, and debug agent behavior.
|
|
456
513
|
|
|
457
514
|
## Related
|
|
458
515
|
|
|
459
|
-
- [Using Tools](
|
|
460
|
-
- [Agent Memory](
|
|
461
|
-
- [Runtime Context](/
|
|
462
|
-
- [Calling Agents](/examples/agents/calling-agents)
|
|
516
|
+
- [Using Tools](/docs/agents/using-tools)
|
|
517
|
+
- [Agent Memory](/docs/agents/agent-memory)
|
|
518
|
+
- [Runtime Context](/docs/server-db/runtime-context)
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Using Tools | Agents
|
|
2
|
+
title: "Using Tools | Agents"
|
|
3
3
|
description: Learn how to create tools and add them to agents to extend capabilities beyond text generation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Using Tools
|
|
7
7
|
|
|
8
|
-
Agents use tools to call APIs, query databases, or run custom functions from your codebase.
|
|
8
|
+
Agents use tools to call APIs, query databases, or run custom functions from your codebase. Tool give agents capabilities beyond language generation by providing structured access to data and performing clearly defined operations. You can also load tools from remote [MCP servers](/docs/mcp/overview) to expand an agent’s capabilities.
|
|
9
|
+
|
|
10
|
+
Each tool typically defines:
|
|
11
|
+
|
|
12
|
+
- **Inputs:** What information the tool needs to run (defined with an `inputSchema`).
|
|
13
|
+
- **Outputs:** The structure of the data the tool returns (defined with an `outputSchema`).
|
|
14
|
+
- **Execution Logic:** The code that performs the tool's action.
|
|
15
|
+
- **Description:** Text that helps the agent understand what the tool does and when to use it.
|
|
16
|
+
|
|
17
|
+
You can also load tools from remote [MCP servers](/docs/mcp/overview) to expand an agent's capabilities.
|
|
18
|
+
|
|
19
|
+
Use [Studio](/docs/getting-started/studio) to test tools with different inputs, inspect execution results, and verify tool behavior.
|
|
9
20
|
|
|
10
21
|
## When to use tools
|
|
11
22
|
|
|
@@ -13,6 +24,8 @@ Use tools when an agent needs additional context or information from remote reso
|
|
|
13
24
|
|
|
14
25
|
## Creating a tool
|
|
15
26
|
|
|
27
|
+
When creating tools, keep descriptions simple and focused on what the tool does, emphasizing its primary use case. Descriptive schema names can also help guide the agent on how to use the tool.
|
|
28
|
+
|
|
16
29
|
This example shows how to create a tool that fetches weather data from an API. When the agent calls the tool, it provides the required input as defined by the tool’s `inputSchema`. The tool accesses this data through its `context` argument, which in this example includes the `location` used in the weather API query.
|
|
17
30
|
|
|
18
31
|
```typescript {14,16} title="src/mastra/tools/weather-tool.ts" showLineNumbers copy
|
|
@@ -21,7 +34,7 @@ import { z } from "zod";
|
|
|
21
34
|
|
|
22
35
|
export const weatherTool = createTool({
|
|
23
36
|
id: "weather-tool",
|
|
24
|
-
description: "Fetches weather for a location",
|
|
37
|
+
description: "Fetches weather for a location.",
|
|
25
38
|
inputSchema: z.object({
|
|
26
39
|
location: z.string(),
|
|
27
40
|
}),
|
|
@@ -41,7 +54,9 @@ export const weatherTool = createTool({
|
|
|
41
54
|
|
|
42
55
|
## Adding tools to an agent
|
|
43
56
|
|
|
44
|
-
To make a tool available to an agent, add it to
|
|
57
|
+
To make a tool available to an agent, add it to `tools`. Mentioning available tools and their general purpose in the agent's system prompt helps the agent decide when to call a tool and when not to.
|
|
58
|
+
|
|
59
|
+
An agent can use multiple tools to handle more complex tasks by delegating specific parts to individual tools. The agent decides which tools to use based on the user's message, the agent's instructions, and the tool descriptions and schemas.
|
|
45
60
|
|
|
46
61
|
```typescript {9,11} title="src/mastra/agents/weather-agent.ts" showLineNumbers copy
|
|
47
62
|
import { openai } from "@ai-sdk/openai";
|
|
@@ -62,7 +77,7 @@ export const weatherAgent = new Agent({
|
|
|
62
77
|
|
|
63
78
|
The agent uses the tool’s `inputSchema` to infer what data the tool expects. In this case, it extracts `London` as the `location` from the message and makes it available to the tool’s context.
|
|
64
79
|
|
|
65
|
-
```typescript {5}
|
|
80
|
+
```typescript {5} showLineNumbers copy
|
|
66
81
|
import { mastra } from "./mastra";
|
|
67
82
|
|
|
68
83
|
const agent = mastra.getAgent("weatherAgent");
|
|
@@ -70,25 +85,133 @@ const agent = mastra.getAgent("weatherAgent");
|
|
|
70
85
|
const result = await agent.generate("What's the weather in London?");
|
|
71
86
|
```
|
|
72
87
|
|
|
73
|
-
## Using
|
|
88
|
+
## Using `RuntimeContext`
|
|
89
|
+
|
|
90
|
+
Use [RuntimeContext](/docs/server-db/runtime-context) to access request-specific values. This lets you conditionally adjust behavior based on the context of the request.
|
|
91
|
+
|
|
92
|
+
```typescript title="src/mastra/tools/test-tool.ts" showLineNumbers
|
|
93
|
+
export type UserTier = {
|
|
94
|
+
"user-tier": "enterprise" | "pro";
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const advancedTools = () => {
|
|
98
|
+
// ...
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const baseTools = () => {
|
|
102
|
+
// ...
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const testTool = createTool({
|
|
106
|
+
// ...
|
|
107
|
+
execute: async ({ runtimeContext }) => {
|
|
108
|
+
const userTier = runtimeContext.get("user-tier") as UserTier["user-tier"];
|
|
109
|
+
|
|
110
|
+
return userTier === "enterprise"
|
|
111
|
+
? advancedTools
|
|
112
|
+
: baseTools;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
> See [Runtime Context](/docs/server-db/runtime-context) for more information.
|
|
118
|
+
|
|
119
|
+
## Cancelling tool execution with `AbortSignal`
|
|
120
|
+
|
|
121
|
+
When you initiate an agent interaction using `.generate()` or `.stream()`, you can provide an `AbortSignal`. Mastra automatically forwards this signal to any tool executions that occur during that interaction.
|
|
122
|
+
|
|
123
|
+
```typescript showLineNumbers
|
|
124
|
+
const controller = new AbortController();
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
const result = await agent.generate("What's the weather in London?", {
|
|
128
|
+
abortSignal: controller.signal
|
|
129
|
+
});
|
|
130
|
+
console.log(result.text);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error.name === "AbortError") {
|
|
133
|
+
console.log("Agent generation was aborted.");
|
|
134
|
+
} else {
|
|
135
|
+
console.error(error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This allows you to cancel long-running operations within your tools, such as network requests or intensive computations, if the parent agent call is aborted.
|
|
141
|
+
|
|
142
|
+
You access the `abortSignal` in the second parameter of the tool's `execute` function.
|
|
143
|
+
|
|
144
|
+
```typescript {3} title="src/mastra/tools/weather-tool.ts" showLineNumbers
|
|
145
|
+
export const weatherTool = createTool({
|
|
146
|
+
// ...
|
|
147
|
+
execute: async ({ context }, { abortSignal }) => {
|
|
148
|
+
const { location } = context
|
|
149
|
+
const response = await fetch(`https://wttr.in/${location}?format=3`, {
|
|
150
|
+
signal: abortSignal
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (abortSignal?.aborted) {
|
|
154
|
+
throw new Error("Aborted");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const weather = await response.text();
|
|
158
|
+
return { weather };
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## AI SDK Tool Format
|
|
164
|
+
|
|
165
|
+
Mastra maintains compatibility with the tool format used by the Vercel AI SDK (`ai` package). You can define tools using the `tool` function from the `ai` package and use them directly within your Mastra agents alongside tools created with Mastra's `createTool`.
|
|
166
|
+
|
|
167
|
+
First, ensure you have the `ai` package installed:
|
|
168
|
+
|
|
169
|
+
```bash copy
|
|
170
|
+
npm install ai
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Here's an example of a tool defined using the Vercel AI SDK format:
|
|
174
|
+
|
|
175
|
+
```typescript title="src/mastra/tools/vercel-weather-tool.ts" copy
|
|
176
|
+
import { tool } from "ai";
|
|
177
|
+
import { z } from "zod";
|
|
178
|
+
|
|
179
|
+
export const vercelWeatherTool = tool({
|
|
180
|
+
description: "Fetches weather for a location.",
|
|
181
|
+
parameters: z.object({
|
|
182
|
+
location: z.string(),
|
|
183
|
+
}),
|
|
184
|
+
execute: async ({ location }) => {
|
|
185
|
+
|
|
186
|
+
const response = await fetch(`https://wttr.in/${location}?format=3`);
|
|
187
|
+
const weather = await response.text();
|
|
74
188
|
|
|
75
|
-
|
|
189
|
+
return { weather };
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
```
|
|
76
193
|
|
|
77
|
-
|
|
194
|
+
You can then add this tool to your Mastra agent just like any other tool:
|
|
78
195
|
|
|
79
|
-
```typescript {
|
|
196
|
+
```typescript {3-4,11} title="src/mastra/agents/test-agent.ts" showLineNumbers copy
|
|
197
|
+
import { Agent } from "@mastra/core/agent";
|
|
198
|
+
import { openai } from "@ai-sdk/openai";
|
|
80
199
|
import { weatherTool } from "../tools/weather-tool";
|
|
81
|
-
import {
|
|
200
|
+
import { vercelWeatherTool } from "../tools/vercel-weather-tool";
|
|
82
201
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
202
|
+
|
|
203
|
+
export const testAgent = new Agent({
|
|
204
|
+
name: "weather-agent",
|
|
205
|
+
instructions: "You are a helpful weather assistant.",
|
|
206
|
+
model: openai("gpt-4o-mini"),
|
|
207
|
+
tools: { weatherTool, vercelWeatherTool }
|
|
86
208
|
});
|
|
87
209
|
```
|
|
88
210
|
|
|
211
|
+
Mastra supports both tool formats, allowing you to mix and match as needed.
|
|
212
|
+
|
|
89
213
|
## Related
|
|
90
214
|
|
|
91
|
-
- [
|
|
92
|
-
- [Agent Memory](./agent-memory)
|
|
215
|
+
- [Agent Memory](/docs/agents/agent-memory)
|
|
93
216
|
- [Runtime Context](/docs/server-db/runtime-context)
|
|
94
217
|
- [Calling Agents](/examples/agents/calling-agents)
|
package/.docs/raw/auth/auth0.mdx
CHANGED
package/.docs/raw/auth/clerk.mdx
CHANGED
package/.docs/raw/auth/index.mdx
CHANGED
package/.docs/raw/auth/jwt.mdx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Discord Community | Community
|
|
2
|
+
title: "Discord Community | Community"
|
|
3
3
|
description: Information about the Mastra Discord community and MCP bot.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,4 +9,4 @@ The Discord server has over 1000 members and serves as the main discussion forum
|
|
|
9
9
|
|
|
10
10
|
## Discord MCP Bot
|
|
11
11
|
|
|
12
|
-
In addition to community members, we have an (experimental!) Discord bot that can also help answer questions. It uses [Model Context Protocol (MCP)](/docs/
|
|
12
|
+
In addition to community members, we have an (experimental!) Discord bot that can also help answer questions. It uses [Model Context Protocol (MCP)](/docs/mcp/overview). You can ask it a question with `/ask` (either in public channels or DMs) and clear history (in DMs only) with `/cleardm`.
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Once you have the configuration set up, you need to initialize the MCP tools:
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
|
-
const mcpTools = await mcp.
|
|
6
|
+
const mcpTools = await mcp.getTools();
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
This asynchronous call fetches all the available tools from the configured MCP servers. The `
|
|
9
|
+
This asynchronous call fetches all the available tools from the configured MCP servers. The `getTools()` method connects to each server specified in your configuration, retrieves the available tools, and returns them in a format that can be used by your Mastra agent.
|
|
10
10
|
|
|
11
11
|
The `mcpTools` object will contain all the tools provided by the MCP servers you've configured. We'll add these tools to our agent in the next step.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
description: "Learn how to
|
|
2
|
+
title: "Building Mastra | Deployment"
|
|
3
|
+
description: "Learn how to build a Mastra server with build settings and deployment options."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Building Mastra
|
|
7
7
|
|
|
8
8
|
Mastra runs as a standard Node.js server and can be deployed across a wide range of environments.
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "AWS Lambda | Deployment
|
|
2
|
+
title: "AWS Lambda | Deployment"
|
|
3
3
|
description: "Deploy your Mastra applications to AWS Lambda using Docker containers and the AWS Lambda Web Adapter."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -214,7 +214,7 @@ Once deployed, test your Lambda function:
|
|
|
214
214
|
2. Visit the URL in your browser to see your Mastra's server home screen
|
|
215
215
|
3. Test your agents and workflows using the generated API endpoints
|
|
216
216
|
|
|
217
|
-
For more information about available API endpoints, see the [Server documentation](/docs/deployment/
|
|
217
|
+
For more information about available API endpoints, see the [Server documentation](/docs/deployment/building-mastra).
|
|
218
218
|
|
|
219
219
|
## Connecting your client
|
|
220
220
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Cloud Providers | Deployment
|
|
2
|
+
title: "Cloud Providers | Deployment"
|
|
3
3
|
description: "Deploy your Mastra applications to popular cloud providers."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,10 +9,13 @@ Standalone Mastra applications can be deployed to popular cloud providers, see o
|
|
|
9
9
|
|
|
10
10
|
- [Amazon EC2](/docs/deployment/cloud-providers/amazon-ec2)
|
|
11
11
|
- [AWS Lambda](/docs/deployment/cloud-providers/aws-lambda)
|
|
12
|
-
- [Digital Ocean](/docs/deployment/cloud-providers/digital-ocean)
|
|
13
12
|
- [Azure App Services](/docs/deployment/cloud-providers/azure-app-services)
|
|
13
|
+
- [Cloudflare](/docs/deployment/cloud-providers/cloudflare-deployer)
|
|
14
|
+
- [Digital Ocean](/docs/deployment/cloud-providers/digital-ocean)
|
|
15
|
+
- [Netlify](/docs/deployment/cloud-providers/netlify-deployer)
|
|
16
|
+
- [Vercel](/docs/deployment/cloud-providers/vercel-deployer)
|
|
14
17
|
|
|
15
|
-
For self-hosted Node.js server deployment, see the [Creating A Mastra Server](/docs/deployment/
|
|
18
|
+
For self-hosted Node.js server deployment, see the [Creating A Mastra Server](/docs/deployment/building-mastra) guide.
|
|
16
19
|
|
|
17
20
|
## Prerequisites
|
|
18
21
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Navigating the Dashboard | Mastra Cloud
|
|
2
|
+
title: "Navigating the Dashboard | Mastra Cloud"
|
|
3
3
|
description: Details of each feature available in Mastra Cloud
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import { MastraCloudCallout } from "@site/src/components/MastraCloudCallout";
|
|
|
7
7
|
|
|
8
8
|
# Navigating the Dashboard
|
|
9
9
|
|
|
10
|
-
This page explains how to navigate the Mastra Cloud dashboard, where you can configure your project, view deployment details, and interact with agents and workflows using the built-in [Studio](/docs/mastra-cloud/dashboard#studio).
|
|
10
|
+
This page explains how to navigate the Mastra Cloud dashboard, where you can configure your project, view deployment details, and interact with agents and workflows using the built-in [Studio](/docs/deployment/mastra-cloud/dashboard#studio).
|
|
11
11
|
|
|
12
12
|
<MastraCloudCallout />
|
|
13
13
|
|
|
@@ -97,4 +97,4 @@ Each MCP Server includes API endpoints for HTTP and SSE, along with IDE configur
|
|
|
97
97
|
|
|
98
98
|
## Next steps
|
|
99
99
|
|
|
100
|
-
- [Understanding Tracing and Logs](/docs/mastra-cloud/observability)
|
|
100
|
+
- [Understanding Tracing and Logs](/docs/deployment/mastra-cloud/observability)
|