@mastra/mcp-docs-server 0.0.0-error-handler-fix-20251020202607 → 0.0.0-execa-dynamic-import-20260304221256
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/course/01-first-agent/04-project-structure.md +19 -0
- package/.docs/course/01-first-agent/05-running-playground.md +19 -0
- package/.docs/course/01-first-agent/07-creating-your-agent.md +50 -0
- package/.docs/course/01-first-agent/08-exporting-your-agent.md +34 -0
- package/.docs/course/01-first-agent/09-testing-your-agent.md +12 -0
- package/.docs/course/01-first-agent/11-creating-transactions-tool.md +41 -0
- package/.docs/course/01-first-agent/12-connecting-tool-to-agent.md +29 -0
- package/.docs/course/01-first-agent/13-testing-your-tool.md +15 -0
- package/.docs/course/01-first-agent/15-installing-memory.md +13 -0
- package/.docs/course/01-first-agent/16-adding-memory-to-agent.md +33 -0
- package/.docs/course/01-first-agent/17-testing-memory.md +15 -0
- package/.docs/course/02-agent-tools-mcp/03-setting-up-mcp-configuration.md +21 -0
- package/.docs/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +11 -0
- package/.docs/course/02-agent-tools-mcp/05-updating-your-agent.md +20 -0
- package/.docs/course/02-agent-tools-mcp/07-what-is-zapier-mcp.md +23 -0
- package/.docs/course/02-agent-tools-mcp/08-getting-zapier-mcp-url.md +21 -0
- package/.docs/course/02-agent-tools-mcp/09-updating-mcp-config-zapier.md +29 -0
- package/.docs/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +29 -0
- package/.docs/course/02-agent-tools-mcp/12-troubleshooting-zapier.md +19 -0
- package/.docs/course/02-agent-tools-mcp/13-what-is-github-mcp.md +14 -0
- package/.docs/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +40 -0
- package/.docs/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +36 -0
- package/.docs/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +33 -0
- package/.docs/course/02-agent-tools-mcp/18-troubleshooting-github.md +17 -0
- package/.docs/course/02-agent-tools-mcp/20-updating-mcp-config-hackernews.md +36 -0
- package/.docs/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +38 -0
- package/.docs/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +43 -0
- package/.docs/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +45 -0
- package/.docs/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +78 -0
- package/.docs/course/02-agent-tools-mcp/32-conclusion.md +17 -0
- package/.docs/course/03-agent-memory/03-installing-memory.md +13 -0
- package/.docs/course/03-agent-memory/04-creating-basic-memory-agent.md +36 -0
- package/.docs/course/03-agent-memory/05-updating-mastra-export.md +18 -0
- package/.docs/course/03-agent-memory/07-understanding-memory-threads.md +49 -0
- package/.docs/course/03-agent-memory/08-configuring-conversation-history.md +36 -0
- package/.docs/course/03-agent-memory/09-using-memory-in-application.md +19 -0
- package/.docs/course/03-agent-memory/10-storage-configuration.md +29 -0
- package/.docs/course/03-agent-memory/12-handling-memory-frontend.md +62 -0
- package/.docs/course/03-agent-memory/13-vector-store-configuration.md +29 -0
- package/.docs/course/03-agent-memory/16-configuring-semantic-recall.md +42 -0
- package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +29 -0
- package/.docs/course/03-agent-memory/21-configuring-working-memory.md +64 -0
- package/.docs/course/03-agent-memory/22-custom-working-memory-templates.md +89 -0
- package/.docs/course/03-agent-memory/25-combining-memory-features.md +80 -0
- package/.docs/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -0
- package/.docs/course/03-agent-memory/27-creating-learning-assistant.md +103 -0
- package/.docs/course/04-workflows/01-introduction-to-workflows.md +44 -0
- package/.docs/course/04-workflows/02-understanding-steps.md +53 -0
- package/.docs/course/04-workflows/03-creating-your-first-step.md +57 -0
- package/.docs/course/04-workflows/04-creating-a-second-step.md +58 -0
- package/.docs/course/04-workflows/05-chaining-steps-together.md +57 -0
- package/.docs/course/04-workflows/06-registering-with-mastra.md +24 -0
- package/.docs/course/04-workflows/07-using-playground.md +58 -0
- package/.docs/course/04-workflows/08-running-workflows-programmatically.md +73 -0
- package/.docs/course/04-workflows/09-adding-a-third-step.md +68 -0
- package/.docs/course/04-workflows/10-updating-the-workflow.md +55 -0
- package/.docs/course/04-workflows/11-creating-an-ai-agent.md +66 -0
- package/.docs/course/04-workflows/12-using-agent-in-workflow.md +89 -0
- package/.docs/course/04-workflows/13-creating-ai-enhanced-workflow.md +72 -0
- package/.docs/course/04-workflows/14-understanding-parallel-execution.md +38 -0
- package/.docs/course/04-workflows/15-creating-parallel-steps.md +111 -0
- package/.docs/course/04-workflows/16-building-parallel-workflow.md +100 -0
- package/.docs/course/04-workflows/17-testing-parallel-performance.md +36 -0
- package/.docs/course/04-workflows/18-understanding-conditional-branching.md +61 -0
- package/.docs/course/04-workflows/19-creating-conditional-steps.md +124 -0
- package/.docs/course/04-workflows/20-building-conditional-workflow.md +55 -0
- package/.docs/course/04-workflows/21-testing-conditional-logic.md +58 -0
- package/.docs/docs/agents/adding-voice.md +349 -0
- package/.docs/docs/agents/agent-approval.md +588 -0
- package/.docs/docs/agents/agent-memory.md +209 -0
- package/.docs/docs/agents/guardrails.md +374 -0
- package/.docs/docs/agents/network-approval.md +275 -0
- package/.docs/docs/agents/networks.md +299 -0
- package/.docs/docs/agents/overview.md +304 -0
- package/.docs/docs/agents/processors.md +622 -0
- package/.docs/docs/agents/structured-output.md +273 -0
- package/.docs/docs/agents/supervisor-agents.md +304 -0
- package/.docs/docs/agents/using-tools.md +248 -0
- package/.docs/docs/build-with-ai/mcp-docs-server.md +238 -0
- package/.docs/docs/build-with-ai/skills.md +35 -0
- package/.docs/docs/community/contributing-templates.md +3 -0
- package/.docs/docs/community/discord.md +9 -0
- package/.docs/docs/community/licensing.md +66 -0
- package/.docs/docs/deployment/cloud-providers.md +15 -0
- package/.docs/docs/deployment/mastra-server.md +122 -0
- package/.docs/docs/deployment/monorepo.md +142 -0
- package/.docs/docs/deployment/overview.md +62 -0
- package/.docs/docs/deployment/studio.md +247 -0
- package/.docs/docs/deployment/web-framework.md +52 -0
- package/.docs/docs/deployment/workflow-runners.md +9 -0
- package/.docs/docs/evals/built-in-scorers.md +47 -0
- package/.docs/docs/evals/custom-scorers.md +519 -0
- package/.docs/docs/evals/overview.md +141 -0
- package/.docs/docs/evals/running-in-ci.md +124 -0
- package/.docs/docs/getting-started/build-with-ai.md +68 -0
- package/.docs/docs/getting-started/manual-install.md +226 -0
- package/.docs/docs/getting-started/project-structure.md +60 -0
- package/.docs/docs/getting-started/start.md +28 -0
- package/.docs/docs/getting-started/studio.md +101 -0
- package/.docs/docs/index.md +43 -0
- package/.docs/docs/mastra-cloud/deployment.md +77 -0
- package/.docs/docs/mastra-cloud/observability.md +38 -0
- package/.docs/docs/mastra-cloud/overview.md +23 -0
- package/.docs/docs/mastra-cloud/setup.md +42 -0
- package/.docs/docs/mastra-cloud/studio.md +24 -0
- package/.docs/docs/mcp/overview.md +373 -0
- package/.docs/docs/mcp/publishing-mcp-server.md +95 -0
- package/.docs/docs/memory/memory-processors.md +314 -0
- package/.docs/docs/memory/message-history.md +260 -0
- package/.docs/docs/memory/observational-memory.md +255 -0
- package/.docs/docs/memory/overview.md +45 -0
- package/.docs/docs/memory/semantic-recall.md +288 -0
- package/.docs/docs/memory/storage.md +261 -0
- package/.docs/docs/memory/working-memory.md +400 -0
- package/.docs/docs/observability/datasets/overview.md +198 -0
- package/.docs/docs/observability/datasets/running-experiments.md +274 -0
- package/.docs/docs/observability/logging.md +99 -0
- package/.docs/docs/observability/overview.md +70 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +209 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +272 -0
- package/.docs/docs/observability/tracing/exporters/braintrust.md +111 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +127 -0
- package/.docs/docs/observability/tracing/exporters/datadog.md +187 -0
- package/.docs/docs/observability/tracing/exporters/default.md +209 -0
- package/.docs/docs/observability/tracing/exporters/laminar.md +100 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +213 -0
- package/.docs/docs/observability/tracing/exporters/langsmith.md +198 -0
- package/.docs/docs/observability/tracing/exporters/otel.md +476 -0
- package/.docs/docs/observability/tracing/exporters/posthog.md +148 -0
- package/.docs/docs/observability/tracing/exporters/sentry.md +208 -0
- package/.docs/docs/observability/tracing/overview.md +1112 -0
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +300 -0
- package/.docs/docs/rag/chunking-and-embedding.md +183 -0
- package/.docs/docs/rag/graph-rag.md +215 -0
- package/.docs/docs/rag/overview.md +72 -0
- package/.docs/docs/rag/retrieval.md +515 -0
- package/.docs/docs/rag/vector-databases.md +645 -0
- package/.docs/docs/server/auth/auth0.md +220 -0
- package/.docs/docs/server/auth/better-auth.md +220 -0
- package/.docs/docs/server/auth/clerk.md +132 -0
- package/.docs/docs/server/auth/composite-auth.md +234 -0
- package/.docs/docs/server/auth/custom-auth-provider.md +513 -0
- package/.docs/docs/server/auth/firebase.md +272 -0
- package/.docs/docs/server/auth/jwt.md +110 -0
- package/.docs/docs/server/auth/simple-auth.md +180 -0
- package/.docs/docs/server/auth/supabase.md +117 -0
- package/.docs/docs/server/auth/workos.md +186 -0
- package/.docs/docs/server/auth.md +38 -0
- package/.docs/docs/server/custom-adapters.md +378 -0
- package/.docs/docs/server/custom-api-routes.md +267 -0
- package/.docs/docs/server/mastra-client.md +243 -0
- package/.docs/docs/server/mastra-server.md +71 -0
- package/.docs/docs/server/middleware.md +225 -0
- package/.docs/docs/server/request-context.md +471 -0
- package/.docs/docs/server/server-adapters.md +547 -0
- package/.docs/docs/streaming/events.md +237 -0
- package/.docs/docs/streaming/overview.md +175 -0
- package/.docs/docs/streaming/tool-streaming.md +175 -0
- package/.docs/docs/streaming/workflow-streaming.md +109 -0
- package/.docs/docs/voice/overview.md +959 -0
- package/.docs/docs/voice/speech-to-speech.md +102 -0
- package/.docs/docs/voice/speech-to-text.md +79 -0
- package/.docs/docs/voice/text-to-speech.md +83 -0
- package/.docs/docs/workflows/agents-and-tools.md +166 -0
- package/.docs/docs/workflows/control-flow.md +822 -0
- package/.docs/docs/workflows/error-handling.md +360 -0
- package/.docs/docs/workflows/human-in-the-loop.md +215 -0
- package/.docs/docs/workflows/overview.md +370 -0
- package/.docs/docs/workflows/snapshots.md +238 -0
- package/.docs/docs/workflows/suspend-and-resume.md +205 -0
- package/.docs/docs/workflows/time-travel.md +309 -0
- package/.docs/docs/workflows/workflow-state.md +181 -0
- package/.docs/docs/workspace/filesystem.md +164 -0
- package/.docs/docs/workspace/overview.md +239 -0
- package/.docs/docs/workspace/sandbox.md +65 -0
- package/.docs/docs/workspace/search.md +243 -0
- package/.docs/docs/workspace/skills.md +169 -0
- package/.docs/guides/agent-frameworks/ai-sdk.md +140 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +1499 -0
- package/.docs/guides/build-your-ui/assistant-ui.md +156 -0
- package/.docs/guides/build-your-ui/copilotkit.md +289 -0
- package/.docs/guides/deployment/amazon-ec2.md +130 -0
- package/.docs/guides/deployment/aws-lambda.md +248 -0
- package/.docs/guides/deployment/azure-app-services.md +114 -0
- package/.docs/guides/deployment/cloudflare.md +99 -0
- package/.docs/guides/deployment/digital-ocean.md +168 -0
- package/.docs/guides/deployment/inngest.md +682 -0
- package/.docs/guides/deployment/netlify.md +77 -0
- package/.docs/guides/deployment/vercel.md +120 -0
- package/.docs/guides/getting-started/astro.md +398 -0
- package/.docs/guides/getting-started/electron.md +504 -0
- package/.docs/guides/getting-started/express.md +251 -0
- package/.docs/guides/getting-started/hono.md +190 -0
- package/.docs/guides/getting-started/next-js.md +347 -0
- package/.docs/guides/getting-started/nuxt.md +497 -0
- package/.docs/guides/getting-started/quickstart.md +67 -0
- package/.docs/guides/getting-started/sveltekit.md +296 -0
- package/.docs/guides/getting-started/vite-react.md +425 -0
- package/.docs/guides/guide/ai-recruiter.md +226 -0
- package/.docs/guides/guide/chef-michel.md +211 -0
- package/.docs/guides/guide/code-review-bot.md +226 -0
- package/.docs/guides/guide/dev-assistant.md +307 -0
- package/.docs/guides/guide/docs-manager.md +238 -0
- package/.docs/guides/guide/github-actions-pr-description.md +236 -0
- package/.docs/guides/guide/notes-mcp-server.md +416 -0
- package/.docs/guides/guide/research-assistant.md +348 -0
- package/.docs/guides/guide/research-coordinator.md +416 -0
- package/.docs/guides/guide/stock-agent.md +132 -0
- package/.docs/guides/guide/web-search.md +320 -0
- package/.docs/guides/guide/whatsapp-chat-bot.md +405 -0
- package/.docs/guides/index.md +22 -0
- package/.docs/guides/migrations/agentnetwork.md +97 -0
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +112 -0
- package/.docs/guides/migrations/network-to-supervisor.md +261 -0
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +404 -0
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +57 -0
- package/.docs/guides/migrations/upgrade-to-v1/client.md +337 -0
- package/.docs/guides/migrations/upgrade-to-v1/deployment.md +37 -0
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +239 -0
- package/.docs/guides/migrations/upgrade-to-v1/mastra.md +143 -0
- package/.docs/guides/migrations/upgrade-to-v1/mcp.md +97 -0
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +285 -0
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +119 -0
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +68 -0
- package/.docs/guides/migrations/upgrade-to-v1/rag.md +42 -0
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +553 -0
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +180 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +412 -0
- package/.docs/guides/migrations/upgrade-to-v1/vectors.md +87 -0
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +30 -0
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +341 -0
- package/.docs/guides/migrations/vnext-to-standard-apis.md +362 -0
- package/.docs/models/embeddings.md +161 -0
- package/.docs/models/gateways/azure-openai.md +128 -0
- package/.docs/models/gateways/custom-gateways.md +545 -0
- package/.docs/models/gateways/netlify.md +93 -0
- package/.docs/models/gateways/openrouter.md +222 -0
- package/.docs/models/gateways/vercel.md +235 -0
- package/.docs/models/gateways.md +14 -0
- package/.docs/models/index.md +286 -0
- package/.docs/models/providers/302ai.md +134 -0
- package/.docs/models/providers/abacus.md +125 -0
- package/.docs/models/providers/agentrouter.md +90 -0
- package/.docs/models/providers/aihubmix.md +113 -0
- package/.docs/models/providers/alibaba-cn.md +135 -0
- package/.docs/models/providers/alibaba.md +111 -0
- package/.docs/models/providers/amazon-bedrock.md +33 -0
- package/.docs/models/providers/anthropic.md +154 -0
- package/.docs/models/providers/azure.md +33 -0
- package/.docs/models/providers/bailing.md +72 -0
- package/.docs/models/providers/baseten.md +79 -0
- package/.docs/models/providers/berget.md +78 -0
- package/.docs/models/providers/cerebras.md +101 -0
- package/.docs/models/providers/chutes.md +137 -0
- package/.docs/models/providers/cloudferro-sherlock.md +74 -0
- package/.docs/models/providers/cloudflare-ai-gateway.md +33 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +109 -0
- package/.docs/models/providers/cohere.md +33 -0
- package/.docs/models/providers/cortecs.md +91 -0
- package/.docs/models/providers/deepinfra.md +112 -0
- package/.docs/models/providers/deepseek.md +88 -0
- package/.docs/models/providers/evroc.md +83 -0
- package/.docs/models/providers/fastrouter.md +84 -0
- package/.docs/models/providers/fireworks-ai.md +83 -0
- package/.docs/models/providers/firmware.md +86 -0
- package/.docs/models/providers/friendli.md +77 -0
- package/.docs/models/providers/github-models.md +125 -0
- package/.docs/models/providers/google-vertex.md +33 -0
- package/.docs/models/providers/google.md +161 -0
- package/.docs/models/providers/groq.md +107 -0
- package/.docs/models/providers/helicone.md +161 -0
- package/.docs/models/providers/huggingface.md +90 -0
- package/.docs/models/providers/iflowcn.md +84 -0
- package/.docs/models/providers/inception.md +72 -0
- package/.docs/models/providers/inference.md +79 -0
- package/.docs/models/providers/io-intelligence.md +87 -0
- package/.docs/models/providers/io-net.md +87 -0
- package/.docs/models/providers/jiekou.md +131 -0
- package/.docs/models/providers/kilo.md +333 -0
- package/.docs/models/providers/kimi-for-coding.md +100 -0
- package/.docs/models/providers/kuae-cloud-coding-plan.md +71 -0
- package/.docs/models/providers/llama.md +77 -0
- package/.docs/models/providers/lmstudio.md +73 -0
- package/.docs/models/providers/lucidquery.md +72 -0
- package/.docs/models/providers/meganova.md +89 -0
- package/.docs/models/providers/minimax-cn-coding-plan.md +102 -0
- package/.docs/models/providers/minimax-cn.md +102 -0
- package/.docs/models/providers/minimax-coding-plan.md +102 -0
- package/.docs/models/providers/minimax.md +104 -0
- package/.docs/models/providers/mistral.md +124 -0
- package/.docs/models/providers/moark.md +72 -0
- package/.docs/models/providers/modelscope.md +77 -0
- package/.docs/models/providers/moonshotai-cn.md +76 -0
- package/.docs/models/providers/moonshotai.md +76 -0
- package/.docs/models/providers/morph.md +73 -0
- package/.docs/models/providers/nano-gpt.md +103 -0
- package/.docs/models/providers/nebius.md +116 -0
- package/.docs/models/providers/nova.md +72 -0
- package/.docs/models/providers/novita-ai.md +154 -0
- package/.docs/models/providers/nvidia.md +141 -0
- package/.docs/models/providers/ollama-cloud.md +103 -0
- package/.docs/models/providers/ollama.md +33 -0
- package/.docs/models/providers/openai.md +193 -0
- package/.docs/models/providers/opencode-go.md +73 -0
- package/.docs/models/providers/opencode.md +100 -0
- package/.docs/models/providers/ovhcloud.md +83 -0
- package/.docs/models/providers/perplexity-agent.md +113 -0
- package/.docs/models/providers/perplexity.md +101 -0
- package/.docs/models/providers/poe.md +184 -0
- package/.docs/models/providers/privatemode-ai.md +75 -0
- package/.docs/models/providers/qihang-ai.md +79 -0
- package/.docs/models/providers/qiniu-ai.md +146 -0
- package/.docs/models/providers/requesty.md +90 -0
- package/.docs/models/providers/scaleway.md +84 -0
- package/.docs/models/providers/siliconflow-cn.md +142 -0
- package/.docs/models/providers/siliconflow.md +140 -0
- package/.docs/models/providers/stackit.md +78 -0
- package/.docs/models/providers/stepfun.md +73 -0
- package/.docs/models/providers/submodel.md +79 -0
- package/.docs/models/providers/synthetic.md +96 -0
- package/.docs/models/providers/togetherai.md +116 -0
- package/.docs/models/providers/upstage.md +73 -0
- package/.docs/models/providers/venice.md +95 -0
- package/.docs/models/providers/vivgrid.md +106 -0
- package/.docs/models/providers/vultr.md +75 -0
- package/.docs/models/providers/wandb.md +80 -0
- package/.docs/models/providers/xai.md +141 -0
- package/.docs/models/providers/xiaomi.md +71 -0
- package/.docs/models/providers/zai-coding-plan.md +80 -0
- package/.docs/models/providers/zai.md +79 -0
- package/.docs/models/providers/zenmux.md +165 -0
- package/.docs/models/providers/zhipuai-coding-plan.md +79 -0
- package/.docs/models/providers/zhipuai.md +79 -0
- package/.docs/models/providers.md +88 -0
- package/.docs/reference/agents/agent.md +141 -0
- package/.docs/reference/agents/generate.md +186 -0
- package/.docs/reference/agents/generateLegacy.md +173 -0
- package/.docs/reference/agents/getDefaultGenerateOptions.md +36 -0
- package/.docs/reference/agents/getDefaultOptions.md +34 -0
- package/.docs/reference/agents/getDefaultStreamOptions.md +36 -0
- package/.docs/reference/agents/getDescription.md +21 -0
- package/.docs/reference/agents/getInstructions.md +34 -0
- package/.docs/reference/agents/getLLM.md +37 -0
- package/.docs/reference/agents/getMemory.md +34 -0
- package/.docs/reference/agents/getModel.md +34 -0
- package/.docs/reference/agents/getTools.md +29 -0
- package/.docs/reference/agents/getVoice.md +34 -0
- package/.docs/reference/agents/listAgents.md +35 -0
- package/.docs/reference/agents/listScorers.md +34 -0
- package/.docs/reference/agents/listTools.md +34 -0
- package/.docs/reference/agents/listWorkflows.md +34 -0
- package/.docs/reference/agents/network.md +170 -0
- package/.docs/reference/ai-sdk/chat-route.md +82 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +53 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +37 -0
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +55 -0
- package/.docs/reference/ai-sdk/network-route.md +74 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +231 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +79 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +76 -0
- package/.docs/reference/ai-sdk/with-mastra.md +63 -0
- package/.docs/reference/ai-sdk/workflow-route.md +79 -0
- package/.docs/reference/auth/auth0.md +73 -0
- package/.docs/reference/auth/better-auth.md +71 -0
- package/.docs/reference/auth/clerk.md +36 -0
- package/.docs/reference/auth/firebase.md +80 -0
- package/.docs/reference/auth/jwt.md +26 -0
- package/.docs/reference/auth/supabase.md +33 -0
- package/.docs/reference/auth/workos.md +84 -0
- package/.docs/reference/cli/create-mastra.md +137 -0
- package/.docs/reference/cli/mastra.md +336 -0
- package/.docs/reference/client-js/agents.md +437 -0
- package/.docs/reference/client-js/error-handling.md +16 -0
- package/.docs/reference/client-js/logs.md +24 -0
- package/.docs/reference/client-js/mastra-client.md +63 -0
- package/.docs/reference/client-js/memory.md +221 -0
- package/.docs/reference/client-js/observability.md +72 -0
- package/.docs/reference/client-js/telemetry.md +20 -0
- package/.docs/reference/client-js/tools.md +44 -0
- package/.docs/reference/client-js/vectors.md +79 -0
- package/.docs/reference/client-js/workflows.md +199 -0
- package/.docs/reference/configuration.md +752 -0
- package/.docs/reference/core/addGateway.md +42 -0
- package/.docs/reference/core/getAgent.md +21 -0
- package/.docs/reference/core/getAgentById.md +21 -0
- package/.docs/reference/core/getDeployer.md +22 -0
- package/.docs/reference/core/getGateway.md +38 -0
- package/.docs/reference/core/getGatewayById.md +41 -0
- package/.docs/reference/core/getLogger.md +22 -0
- package/.docs/reference/core/getMCPServer.md +47 -0
- package/.docs/reference/core/getMCPServerById.md +55 -0
- package/.docs/reference/core/getMemory.md +50 -0
- package/.docs/reference/core/getScorer.md +54 -0
- package/.docs/reference/core/getScorerById.md +54 -0
- package/.docs/reference/core/getServer.md +22 -0
- package/.docs/reference/core/getStorage.md +22 -0
- package/.docs/reference/core/getStoredAgentById.md +89 -0
- package/.docs/reference/core/getTelemetry.md +22 -0
- package/.docs/reference/core/getVector.md +22 -0
- package/.docs/reference/core/getWorkflow.md +42 -0
- package/.docs/reference/core/listAgents.md +21 -0
- package/.docs/reference/core/listGateways.md +40 -0
- package/.docs/reference/core/listLogs.md +38 -0
- package/.docs/reference/core/listLogsByRunId.md +36 -0
- package/.docs/reference/core/listMCPServers.md +55 -0
- package/.docs/reference/core/listMemory.md +56 -0
- package/.docs/reference/core/listScorers.md +29 -0
- package/.docs/reference/core/listStoredAgents.md +93 -0
- package/.docs/reference/core/listVectors.md +22 -0
- package/.docs/reference/core/listWorkflows.md +21 -0
- package/.docs/reference/core/mastra-class.md +66 -0
- package/.docs/reference/core/mastra-model-gateway.md +153 -0
- package/.docs/reference/core/setLogger.md +26 -0
- package/.docs/reference/core/setStorage.md +27 -0
- package/.docs/reference/datasets/addItem.md +37 -0
- package/.docs/reference/datasets/addItems.md +35 -0
- package/.docs/reference/datasets/compareExperiments.md +52 -0
- package/.docs/reference/datasets/create.md +51 -0
- package/.docs/reference/datasets/dataset.md +82 -0
- package/.docs/reference/datasets/datasets-manager.md +94 -0
- package/.docs/reference/datasets/delete.md +25 -0
- package/.docs/reference/datasets/deleteExperiment.md +27 -0
- package/.docs/reference/datasets/deleteItem.md +27 -0
- package/.docs/reference/datasets/deleteItems.md +29 -0
- package/.docs/reference/datasets/get.md +31 -0
- package/.docs/reference/datasets/getDetails.md +47 -0
- package/.docs/reference/datasets/getExperiment.md +30 -0
- package/.docs/reference/datasets/getItem.md +33 -0
- package/.docs/reference/datasets/getItemHistory.md +31 -0
- package/.docs/reference/datasets/list.md +31 -0
- package/.docs/reference/datasets/listExperimentResults.md +39 -0
- package/.docs/reference/datasets/listExperiments.md +33 -0
- package/.docs/reference/datasets/listItems.md +46 -0
- package/.docs/reference/datasets/listVersions.md +33 -0
- package/.docs/reference/datasets/startExperiment.md +62 -0
- package/.docs/reference/datasets/startExperimentAsync.md +43 -0
- package/.docs/reference/datasets/update.md +48 -0
- package/.docs/reference/datasets/updateItem.md +38 -0
- package/.docs/reference/deployer/cloudflare.md +79 -0
- package/.docs/reference/deployer/netlify.md +80 -0
- package/.docs/reference/deployer/vercel.md +116 -0
- package/.docs/reference/deployer.md +100 -0
- package/.docs/reference/evals/answer-relevancy.md +105 -0
- package/.docs/reference/evals/answer-similarity.md +99 -0
- package/.docs/reference/evals/bias.md +120 -0
- package/.docs/reference/evals/completeness.md +136 -0
- package/.docs/reference/evals/content-similarity.md +101 -0
- package/.docs/reference/evals/context-precision.md +196 -0
- package/.docs/reference/evals/context-relevance.md +531 -0
- package/.docs/reference/evals/create-scorer.md +270 -0
- package/.docs/reference/evals/faithfulness.md +114 -0
- package/.docs/reference/evals/hallucination.md +213 -0
- package/.docs/reference/evals/keyword-coverage.md +128 -0
- package/.docs/reference/evals/mastra-scorer.md +123 -0
- package/.docs/reference/evals/noise-sensitivity.md +675 -0
- package/.docs/reference/evals/prompt-alignment.md +614 -0
- package/.docs/reference/evals/run-evals.md +179 -0
- package/.docs/reference/evals/scorer-utils.md +326 -0
- package/.docs/reference/evals/textual-difference.md +113 -0
- package/.docs/reference/evals/tone-consistency.md +119 -0
- package/.docs/reference/evals/tool-call-accuracy.md +533 -0
- package/.docs/reference/evals/toxicity.md +123 -0
- package/.docs/reference/harness/harness-class.md +760 -0
- package/.docs/reference/index.md +277 -0
- package/.docs/reference/logging/pino-logger.md +117 -0
- package/.docs/reference/memory/clone-utilities.md +199 -0
- package/.docs/reference/memory/cloneThread.md +142 -0
- package/.docs/reference/memory/createThread.md +68 -0
- package/.docs/reference/memory/deleteMessages.md +38 -0
- package/.docs/reference/memory/getThreadById.md +24 -0
- package/.docs/reference/memory/listThreads.md +145 -0
- package/.docs/reference/memory/memory-class.md +147 -0
- package/.docs/reference/memory/observational-memory.md +577 -0
- package/.docs/reference/memory/recall.md +91 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +131 -0
- package/.docs/reference/observability/tracing/configuration.md +178 -0
- package/.docs/reference/observability/tracing/exporters/arize.md +141 -0
- package/.docs/reference/observability/tracing/exporters/braintrust.md +93 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +163 -0
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +138 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +116 -0
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +174 -0
- package/.docs/reference/observability/tracing/exporters/laminar.md +78 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +134 -0
- package/.docs/reference/observability/tracing/exporters/langsmith.md +108 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +199 -0
- package/.docs/reference/observability/tracing/exporters/posthog.md +92 -0
- package/.docs/reference/observability/tracing/exporters/sentry.md +184 -0
- package/.docs/reference/observability/tracing/instances.md +107 -0
- package/.docs/reference/observability/tracing/interfaces.md +743 -0
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +144 -0
- package/.docs/reference/observability/tracing/spans.md +224 -0
- package/.docs/reference/processors/batch-parts-processor.md +61 -0
- package/.docs/reference/processors/language-detector.md +82 -0
- package/.docs/reference/processors/message-history-processor.md +85 -0
- package/.docs/reference/processors/moderation-processor.md +104 -0
- package/.docs/reference/processors/pii-detector.md +108 -0
- package/.docs/reference/processors/processor-interface.md +521 -0
- package/.docs/reference/processors/prompt-injection-detector.md +72 -0
- package/.docs/reference/processors/semantic-recall-processor.md +117 -0
- package/.docs/reference/processors/system-prompt-scrubber.md +80 -0
- package/.docs/reference/processors/token-limiter-processor.md +115 -0
- package/.docs/reference/processors/tool-call-filter.md +85 -0
- package/.docs/reference/processors/tool-search-processor.md +111 -0
- package/.docs/reference/processors/unicode-normalizer.md +62 -0
- package/.docs/reference/processors/working-memory-processor.md +152 -0
- package/.docs/reference/rag/chunk.md +221 -0
- package/.docs/reference/rag/database-config.md +261 -0
- package/.docs/reference/rag/document.md +114 -0
- package/.docs/reference/rag/embeddings.md +92 -0
- package/.docs/reference/rag/extract-params.md +168 -0
- package/.docs/reference/rag/graph-rag.md +111 -0
- package/.docs/reference/rag/metadata-filters.md +216 -0
- package/.docs/reference/rag/rerank.md +75 -0
- package/.docs/reference/rag/rerankWithScorer.md +80 -0
- package/.docs/reference/server/create-route.md +262 -0
- package/.docs/reference/server/express-adapter.md +176 -0
- package/.docs/reference/server/fastify-adapter.md +90 -0
- package/.docs/reference/server/hono-adapter.md +162 -0
- package/.docs/reference/server/koa-adapter.md +127 -0
- package/.docs/reference/server/mastra-server.md +298 -0
- package/.docs/reference/server/register-api-route.md +249 -0
- package/.docs/reference/server/routes.md +306 -0
- package/.docs/reference/storage/cloudflare-d1.md +218 -0
- package/.docs/reference/storage/cloudflare.md +88 -0
- package/.docs/reference/storage/composite.md +235 -0
- package/.docs/reference/storage/convex.md +161 -0
- package/.docs/reference/storage/dynamodb.md +282 -0
- package/.docs/reference/storage/lance.md +131 -0
- package/.docs/reference/storage/libsql.md +135 -0
- package/.docs/reference/storage/mongodb.md +262 -0
- package/.docs/reference/storage/mssql.md +157 -0
- package/.docs/reference/storage/overview.md +121 -0
- package/.docs/reference/storage/postgresql.md +526 -0
- package/.docs/reference/storage/upstash.md +160 -0
- package/.docs/reference/streaming/ChunkType.md +292 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +182 -0
- package/.docs/reference/streaming/agents/stream.md +255 -0
- package/.docs/reference/streaming/agents/streamLegacy.md +142 -0
- package/.docs/reference/streaming/workflows/observeStream.md +42 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +61 -0
- package/.docs/reference/streaming/workflows/stream.md +88 -0
- package/.docs/reference/streaming/workflows/timeTravelStream.md +142 -0
- package/.docs/reference/templates/overview.md +194 -0
- package/.docs/reference/tools/create-tool.md +285 -0
- package/.docs/reference/tools/document-chunker-tool.md +89 -0
- package/.docs/reference/tools/graph-rag-tool.md +182 -0
- package/.docs/reference/tools/mcp-client.md +965 -0
- package/.docs/reference/tools/mcp-server.md +1271 -0
- package/.docs/reference/tools/vector-query-tool.md +459 -0
- package/.docs/reference/vectors/astra.md +121 -0
- package/.docs/reference/vectors/chroma.md +264 -0
- package/.docs/reference/vectors/convex.md +300 -0
- package/.docs/reference/vectors/couchbase.md +226 -0
- package/.docs/reference/vectors/duckdb.md +318 -0
- package/.docs/reference/vectors/elasticsearch.md +189 -0
- package/.docs/reference/vectors/lance.md +220 -0
- package/.docs/reference/vectors/libsql.md +305 -0
- package/.docs/reference/vectors/mongodb.md +295 -0
- package/.docs/reference/vectors/opensearch.md +99 -0
- package/.docs/reference/vectors/pg.md +408 -0
- package/.docs/reference/vectors/pinecone.md +168 -0
- package/.docs/reference/vectors/qdrant.md +222 -0
- package/.docs/reference/vectors/s3vectors.md +277 -0
- package/.docs/reference/vectors/turbopuffer.md +157 -0
- package/.docs/reference/vectors/upstash.md +294 -0
- package/.docs/reference/vectors/vectorize.md +147 -0
- package/.docs/reference/voice/azure.md +148 -0
- package/.docs/reference/voice/cloudflare.md +83 -0
- package/.docs/reference/voice/composite-voice.md +121 -0
- package/.docs/reference/voice/deepgram.md +79 -0
- package/.docs/reference/voice/elevenlabs.md +98 -0
- package/.docs/reference/voice/google-gemini-live.md +378 -0
- package/.docs/reference/voice/google.md +228 -0
- package/.docs/reference/voice/mastra-voice.md +311 -0
- package/.docs/reference/voice/murf.md +122 -0
- package/.docs/reference/voice/openai-realtime.md +203 -0
- package/.docs/reference/voice/openai.md +88 -0
- package/.docs/reference/voice/playai.md +80 -0
- package/.docs/reference/voice/sarvam.md +126 -0
- package/.docs/reference/voice/speechify.md +75 -0
- package/.docs/reference/voice/voice.addInstructions.md +55 -0
- package/.docs/reference/voice/voice.addTools.md +67 -0
- package/.docs/reference/voice/voice.answer.md +54 -0
- package/.docs/reference/voice/voice.close.md +51 -0
- package/.docs/reference/voice/voice.connect.md +94 -0
- package/.docs/reference/voice/voice.events.md +37 -0
- package/.docs/reference/voice/voice.getSpeakers.md +129 -0
- package/.docs/reference/voice/voice.listen.md +164 -0
- package/.docs/reference/voice/voice.off.md +54 -0
- package/.docs/reference/voice/voice.on.md +111 -0
- package/.docs/reference/voice/voice.send.md +65 -0
- package/.docs/reference/voice/voice.speak.md +157 -0
- package/.docs/reference/voice/voice.updateConfig.md +60 -0
- package/.docs/reference/workflows/run-methods/cancel.md +86 -0
- package/.docs/reference/workflows/run-methods/restart.md +33 -0
- package/.docs/reference/workflows/run-methods/resume.md +59 -0
- package/.docs/reference/workflows/run-methods/start.md +58 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +67 -0
- package/.docs/reference/workflows/run-methods/timeTravel.md +142 -0
- package/.docs/reference/workflows/run.md +59 -0
- package/.docs/reference/workflows/step.md +119 -0
- package/.docs/reference/workflows/workflow-methods/branch.md +25 -0
- package/.docs/reference/workflows/workflow-methods/commit.md +17 -0
- package/.docs/reference/workflows/workflow-methods/create-run.md +63 -0
- package/.docs/reference/workflows/workflow-methods/dountil.md +25 -0
- package/.docs/reference/workflows/workflow-methods/dowhile.md +25 -0
- package/.docs/reference/workflows/workflow-methods/foreach.md +118 -0
- package/.docs/reference/workflows/workflow-methods/map.md +93 -0
- package/.docs/reference/workflows/workflow-methods/parallel.md +21 -0
- package/.docs/reference/workflows/workflow-methods/sleep.md +35 -0
- package/.docs/reference/workflows/workflow-methods/sleepUntil.md +35 -0
- package/.docs/reference/workflows/workflow-methods/then.md +21 -0
- package/.docs/reference/workflows/workflow.md +157 -0
- package/.docs/reference/workspace/daytona-sandbox.md +580 -0
- package/.docs/reference/workspace/e2b-sandbox.md +289 -0
- package/.docs/reference/workspace/filesystem.md +255 -0
- package/.docs/reference/workspace/gcs-filesystem.md +174 -0
- package/.docs/reference/workspace/local-filesystem.md +343 -0
- package/.docs/reference/workspace/local-sandbox.md +301 -0
- package/.docs/reference/workspace/s3-filesystem.md +177 -0
- package/.docs/reference/workspace/sandbox.md +87 -0
- package/.docs/reference/workspace/workspace-class.md +244 -0
- package/CHANGELOG.md +659 -4
- package/LICENSE.md +15 -0
- package/README.md +63 -125
- package/dist/index.d.ts.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/prompts/migration.d.ts +6 -0
- package/dist/prompts/migration.d.ts.map +1 -0
- package/dist/stdio.js +1253 -293
- package/dist/stdio.js.map +1 -0
- package/dist/tools/course.d.ts.map +1 -1
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/embedded-docs.d.ts +276 -0
- package/dist/tools/embedded-docs.d.ts.map +1 -0
- package/dist/tools/migration.d.ts +40 -0
- package/dist/tools/migration.d.ts.map +1 -0
- package/dist/utils.d.ts +0 -54
- package/dist/utils.d.ts.map +1 -1
- package/package.json +22 -21
- package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +0 -9
- package/.docs/organized/changelogs/%40internal%2Fplayground.md +0 -3
- package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +0 -302
- package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +0 -49
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +0 -31
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +0 -87
- package/.docs/organized/changelogs/%40mastra%2Flance.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Frag.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Freact.md +0 -247
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +0 -149
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +0 -195
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +0 -265
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +0 -302
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +0 -302
- package/.docs/organized/changelogs/create-mastra.md +0 -302
- package/.docs/organized/changelogs/mastra.md +0 -302
- package/.docs/organized/code-examples/a2a.md +0 -208
- package/.docs/organized/code-examples/agent.md +0 -1333
- package/.docs/organized/code-examples/agui.md +0 -173
- package/.docs/organized/code-examples/ai-elements.md +0 -47
- package/.docs/organized/code-examples/ai-sdk-useChat.md +0 -369
- package/.docs/organized/code-examples/ai-sdk-v5.md +0 -203
- package/.docs/organized/code-examples/assistant-ui.md +0 -28
- package/.docs/organized/code-examples/bird-checker-with-express.md +0 -223
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +0 -347
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +0 -241
- package/.docs/organized/code-examples/client-side-tools.md +0 -59
- package/.docs/organized/code-examples/crypto-chatbot.md +0 -87
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +0 -564
- package/.docs/organized/code-examples/fireworks-r1.md +0 -148
- package/.docs/organized/code-examples/heads-up-game.md +0 -252
- package/.docs/organized/code-examples/mcp-configuration.md +0 -556
- package/.docs/organized/code-examples/mcp-registry-registry.md +0 -50
- package/.docs/organized/code-examples/memory-per-resource-example.md +0 -222
- package/.docs/organized/code-examples/memory-todo-agent.md +0 -152
- package/.docs/organized/code-examples/memory-with-context.md +0 -155
- package/.docs/organized/code-examples/memory-with-libsql.md +0 -190
- package/.docs/organized/code-examples/memory-with-pg.md +0 -211
- package/.docs/organized/code-examples/memory-with-processors.md +0 -594
- package/.docs/organized/code-examples/memory-with-upstash.md +0 -254
- package/.docs/organized/code-examples/openapi-spec-writer.md +0 -567
- package/.docs/organized/code-examples/quick-start.md +0 -156
- package/.docs/organized/code-examples/stock-price-tool.md +0 -111
- package/.docs/organized/code-examples/weather-agent.md +0 -576
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +0 -147
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +0 -99
- package/.docs/organized/code-examples/workflow-with-memory.md +0 -381
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +0 -160
- package/.docs/organized/code-examples/workflow-with-suspend-resume.md +0 -182
- package/.docs/raw/agents/adding-voice.mdx +0 -290
- package/.docs/raw/agents/agent-memory.mdx +0 -158
- package/.docs/raw/agents/guardrails.mdx +0 -342
- package/.docs/raw/agents/networks.mdx +0 -235
- package/.docs/raw/agents/overview.mdx +0 -425
- package/.docs/raw/agents/using-tools.mdx +0 -95
- package/.docs/raw/auth/auth0.mdx +0 -235
- package/.docs/raw/auth/clerk.mdx +0 -142
- package/.docs/raw/auth/firebase.mdx +0 -285
- package/.docs/raw/auth/index.mdx +0 -19
- package/.docs/raw/auth/jwt.mdx +0 -101
- package/.docs/raw/auth/supabase.mdx +0 -128
- package/.docs/raw/auth/workos.mdx +0 -198
- package/.docs/raw/community/contributing-templates.mdx +0 -193
- package/.docs/raw/community/discord.mdx +0 -12
- package/.docs/raw/community/licensing.mdx +0 -71
- package/.docs/raw/course/01-first-agent/04-project-structure.md +0 -17
- package/.docs/raw/course/01-first-agent/05-running-playground.md +0 -19
- package/.docs/raw/course/01-first-agent/07-creating-your-agent.md +0 -51
- package/.docs/raw/course/01-first-agent/08-exporting-your-agent.md +0 -33
- package/.docs/raw/course/01-first-agent/09-testing-your-agent.md +0 -12
- package/.docs/raw/course/01-first-agent/11-creating-transactions-tool.md +0 -41
- package/.docs/raw/course/01-first-agent/12-connecting-tool-to-agent.md +0 -29
- package/.docs/raw/course/01-first-agent/13-testing-your-tool.md +0 -15
- package/.docs/raw/course/01-first-agent/15-installing-memory.md +0 -13
- package/.docs/raw/course/01-first-agent/16-adding-memory-to-agent.md +0 -33
- package/.docs/raw/course/01-first-agent/17-testing-memory.md +0 -15
- package/.docs/raw/course/02-agent-tools-mcp/03-setting-up-mcp-configuration.md +0 -21
- package/.docs/raw/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +0 -11
- package/.docs/raw/course/02-agent-tools-mcp/05-updating-your-agent.md +0 -20
- package/.docs/raw/course/02-agent-tools-mcp/07-what-is-zapier-mcp.md +0 -14
- package/.docs/raw/course/02-agent-tools-mcp/08-getting-zapier-mcp-url.md +0 -16
- package/.docs/raw/course/02-agent-tools-mcp/09-updating-mcp-config-zapier.md +0 -17
- package/.docs/raw/course/02-agent-tools-mcp/10-updating-agent-instructions-zapier.md +0 -29
- package/.docs/raw/course/02-agent-tools-mcp/12-troubleshooting-zapier.md +0 -17
- package/.docs/raw/course/02-agent-tools-mcp/13-what-is-github-mcp.md +0 -14
- package/.docs/raw/course/02-agent-tools-mcp/14-getting-github-mcp-url.md +0 -35
- package/.docs/raw/course/02-agent-tools-mcp/15-updating-mcp-config-github.md +0 -20
- package/.docs/raw/course/02-agent-tools-mcp/16-updating-agent-instructions-github.md +0 -33
- package/.docs/raw/course/02-agent-tools-mcp/18-troubleshooting-github.md +0 -17
- package/.docs/raw/course/02-agent-tools-mcp/20-updating-mcp-config-hackernews.md +0 -26
- package/.docs/raw/course/02-agent-tools-mcp/21-updating-agent-instructions-hackernews.md +0 -38
- package/.docs/raw/course/02-agent-tools-mcp/26-updating-mcp-config-filesystem.md +0 -33
- package/.docs/raw/course/02-agent-tools-mcp/27-updating-agent-instructions-filesystem.md +0 -45
- package/.docs/raw/course/02-agent-tools-mcp/31-enhancing-memory-configuration.md +0 -76
- package/.docs/raw/course/02-agent-tools-mcp/32-conclusion.md +0 -17
- package/.docs/raw/course/03-agent-memory/03-installing-memory.md +0 -13
- package/.docs/raw/course/03-agent-memory/04-creating-basic-memory-agent.md +0 -36
- package/.docs/raw/course/03-agent-memory/05-updating-mastra-export.md +0 -18
- package/.docs/raw/course/03-agent-memory/07-understanding-memory-threads.md +0 -14
- package/.docs/raw/course/03-agent-memory/08-configuring-conversation-history.md +0 -37
- package/.docs/raw/course/03-agent-memory/09-using-memory-in-application.md +0 -19
- package/.docs/raw/course/03-agent-memory/10-storage-configuration.md +0 -30
- package/.docs/raw/course/03-agent-memory/12-handling-memory-frontend.md +0 -62
- package/.docs/raw/course/03-agent-memory/13-vector-store-configuration.md +0 -27
- package/.docs/raw/course/03-agent-memory/16-configuring-semantic-recall.md +0 -41
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +0 -28
- package/.docs/raw/course/03-agent-memory/21-configuring-working-memory.md +0 -63
- package/.docs/raw/course/03-agent-memory/22-custom-working-memory-templates.md +0 -89
- package/.docs/raw/course/03-agent-memory/25-combining-memory-features.md +0 -80
- package/.docs/raw/course/03-agent-memory/26-updating-mastra-export-comprehensive.md +0 -32
- package/.docs/raw/course/03-agent-memory/27-creating-learning-assistant.md +0 -103
- package/.docs/raw/course/04-workflows/01-introduction-to-workflows.md +0 -44
- package/.docs/raw/course/04-workflows/02-understanding-steps.md +0 -53
- package/.docs/raw/course/04-workflows/03-creating-your-first-step.md +0 -57
- package/.docs/raw/course/04-workflows/04-creating-a-second-step.md +0 -58
- package/.docs/raw/course/04-workflows/05-chaining-steps-together.md +0 -57
- package/.docs/raw/course/04-workflows/06-registering-with-mastra.md +0 -24
- package/.docs/raw/course/04-workflows/07-using-playground.md +0 -58
- package/.docs/raw/course/04-workflows/08-running-workflows-programmatically.md +0 -77
- package/.docs/raw/course/04-workflows/09-adding-a-third-step.md +0 -70
- package/.docs/raw/course/04-workflows/10-updating-the-workflow.md +0 -55
- package/.docs/raw/course/04-workflows/11-creating-an-ai-agent.md +0 -67
- package/.docs/raw/course/04-workflows/12-using-agent-in-workflow.md +0 -91
- package/.docs/raw/course/04-workflows/13-creating-ai-enhanced-workflow.md +0 -75
- package/.docs/raw/course/04-workflows/14-understanding-parallel-execution.md +0 -38
- package/.docs/raw/course/04-workflows/15-creating-parallel-steps.md +0 -115
- package/.docs/raw/course/04-workflows/16-building-parallel-workflow.md +0 -100
- package/.docs/raw/course/04-workflows/17-testing-parallel-performance.md +0 -40
- package/.docs/raw/course/04-workflows/18-understanding-conditional-branching.md +0 -61
- package/.docs/raw/course/04-workflows/19-creating-conditional-steps.md +0 -128
- package/.docs/raw/course/04-workflows/20-building-conditional-workflow.md +0 -60
- package/.docs/raw/course/04-workflows/21-testing-conditional-logic.md +0 -58
- package/.docs/raw/deployment/cloud-providers/amazon-ec2.mdx +0 -115
- package/.docs/raw/deployment/cloud-providers/aws-lambda.mdx +0 -273
- package/.docs/raw/deployment/cloud-providers/azure-app-services.mdx +0 -137
- package/.docs/raw/deployment/cloud-providers/digital-ocean.mdx +0 -206
- package/.docs/raw/deployment/cloud-providers/index.mdx +0 -52
- package/.docs/raw/deployment/monorepo.mdx +0 -107
- package/.docs/raw/deployment/overview.mdx +0 -82
- package/.docs/raw/deployment/server-deployment.mdx +0 -86
- package/.docs/raw/deployment/serverless-platforms/cloudflare-deployer.mdx +0 -87
- package/.docs/raw/deployment/serverless-platforms/index.mdx +0 -52
- package/.docs/raw/deployment/serverless-platforms/netlify-deployer.mdx +0 -94
- package/.docs/raw/deployment/serverless-platforms/vercel-deployer.mdx +0 -109
- package/.docs/raw/deployment/web-framework.mdx +0 -63
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +0 -675
- package/.docs/raw/frameworks/agentic-uis/assistant-ui.mdx +0 -125
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +0 -108
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +0 -341
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +0 -165
- package/.docs/raw/frameworks/servers/express.mdx +0 -208
- package/.docs/raw/frameworks/web-frameworks/astro.mdx +0 -519
- package/.docs/raw/frameworks/web-frameworks/next-js.mdx +0 -336
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +0 -461
- package/.docs/raw/frameworks/web-frameworks/vite-react.mdx +0 -242
- package/.docs/raw/getting-started/installation.mdx +0 -316
- package/.docs/raw/getting-started/mcp-docs-server.mdx +0 -183
- package/.docs/raw/getting-started/project-structure.mdx +0 -72
- package/.docs/raw/getting-started/templates.mdx +0 -70
- package/.docs/raw/index.mdx +0 -58
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -100
- package/.docs/raw/mastra-cloud/observability.mdx +0 -52
- package/.docs/raw/mastra-cloud/overview.mdx +0 -71
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -92
- package/.docs/raw/memory/conversation-history.mdx +0 -23
- package/.docs/raw/memory/memory-processors.mdx +0 -136
- package/.docs/raw/memory/overview.mdx +0 -119
- package/.docs/raw/memory/semantic-recall.mdx +0 -226
- package/.docs/raw/memory/threads-and-resources.mdx +0 -94
- package/.docs/raw/memory/working-memory.mdx +0 -378
- package/.docs/raw/observability/ai-tracing/exporters/braintrust.mdx +0 -81
- package/.docs/raw/observability/ai-tracing/exporters/cloud.mdx +0 -120
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +0 -168
- package/.docs/raw/observability/ai-tracing/exporters/langfuse.mdx +0 -121
- package/.docs/raw/observability/ai-tracing/exporters/langsmith.mdx +0 -88
- package/.docs/raw/observability/ai-tracing/exporters/otel.mdx +0 -253
- package/.docs/raw/observability/ai-tracing/overview.mdx +0 -565
- package/.docs/raw/observability/ai-tracing/processors/sensitive-data-filter.mdx +0 -274
- package/.docs/raw/observability/logging.mdx +0 -113
- package/.docs/raw/observability/nextjs-tracing.mdx +0 -109
- package/.docs/raw/observability/otel-tracing.mdx +0 -190
- package/.docs/raw/observability/overview.mdx +0 -66
- package/.docs/raw/rag/chunking-and-embedding.mdx +0 -208
- package/.docs/raw/rag/overview.mdx +0 -87
- package/.docs/raw/rag/retrieval.mdx +0 -543
- package/.docs/raw/rag/vector-databases.mdx +0 -529
- package/.docs/raw/reference/agents/agent.mdx +0 -230
- package/.docs/raw/reference/agents/generate.mdx +0 -577
- package/.docs/raw/reference/agents/generateLegacy.mdx +0 -528
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +0 -67
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +0 -67
- package/.docs/raw/reference/agents/getDescription.mdx +0 -34
- package/.docs/raw/reference/agents/getInstructions.mdx +0 -67
- package/.docs/raw/reference/agents/getLLM.mdx +0 -74
- package/.docs/raw/reference/agents/getMemory.mdx +0 -67
- package/.docs/raw/reference/agents/getModel.mdx +0 -67
- package/.docs/raw/reference/agents/getScorers.mdx +0 -67
- package/.docs/raw/reference/agents/getTools.mdx +0 -67
- package/.docs/raw/reference/agents/getVoice.mdx +0 -67
- package/.docs/raw/reference/agents/getWorkflows.mdx +0 -67
- package/.docs/raw/reference/agents/listAgents.mdx +0 -68
- package/.docs/raw/reference/agents/network.mdx +0 -290
- package/.docs/raw/reference/auth/auth0.mdx +0 -117
- package/.docs/raw/reference/auth/clerk.mdx +0 -71
- package/.docs/raw/reference/auth/firebase.mdx +0 -128
- package/.docs/raw/reference/auth/jwt.mdx +0 -41
- package/.docs/raw/reference/auth/supabase.mdx +0 -62
- package/.docs/raw/reference/auth/workos.mdx +0 -128
- package/.docs/raw/reference/cli/create-mastra.mdx +0 -177
- package/.docs/raw/reference/cli/mastra.mdx +0 -258
- package/.docs/raw/reference/client-js/agents.mdx +0 -220
- package/.docs/raw/reference/client-js/error-handling.mdx +0 -23
- package/.docs/raw/reference/client-js/logs.mdx +0 -29
- package/.docs/raw/reference/client-js/mastra-client.mdx +0 -157
- package/.docs/raw/reference/client-js/memory.mdx +0 -130
- package/.docs/raw/reference/client-js/observability.mdx +0 -76
- package/.docs/raw/reference/client-js/telemetry.mdx +0 -25
- package/.docs/raw/reference/client-js/tools.mdx +0 -49
- package/.docs/raw/reference/client-js/vectors.mdx +0 -84
- package/.docs/raw/reference/client-js/workflows-legacy.mdx +0 -143
- package/.docs/raw/reference/client-js/workflows.mdx +0 -175
- package/.docs/raw/reference/core/getAgent.mdx +0 -43
- package/.docs/raw/reference/core/getAgentById.mdx +0 -43
- package/.docs/raw/reference/core/getAgents.mdx +0 -35
- package/.docs/raw/reference/core/getDeployer.mdx +0 -35
- package/.docs/raw/reference/core/getLogger.mdx +0 -35
- package/.docs/raw/reference/core/getLogs.mdx +0 -92
- package/.docs/raw/reference/core/getLogsByRunId.mdx +0 -84
- package/.docs/raw/reference/core/getMCPServer.mdx +0 -49
- package/.docs/raw/reference/core/getMCPServers.mdx +0 -35
- package/.docs/raw/reference/core/getMemory.mdx +0 -35
- package/.docs/raw/reference/core/getScorer.mdx +0 -75
- package/.docs/raw/reference/core/getScorerByName.mdx +0 -75
- package/.docs/raw/reference/core/getScorers.mdx +0 -42
- package/.docs/raw/reference/core/getServer.mdx +0 -35
- package/.docs/raw/reference/core/getStorage.mdx +0 -35
- package/.docs/raw/reference/core/getTelemetry.mdx +0 -35
- package/.docs/raw/reference/core/getVector.mdx +0 -43
- package/.docs/raw/reference/core/getVectors.mdx +0 -35
- package/.docs/raw/reference/core/getWorkflow.mdx +0 -48
- package/.docs/raw/reference/core/getWorkflows.mdx +0 -43
- package/.docs/raw/reference/core/mastra-class.mdx +0 -143
- package/.docs/raw/reference/core/setLogger.mdx +0 -47
- package/.docs/raw/reference/core/setStorage.mdx +0 -39
- package/.docs/raw/reference/core/setTelemetry.mdx +0 -35
- package/.docs/raw/reference/deployer/cloudflare.mdx +0 -91
- package/.docs/raw/reference/deployer/deployer.mdx +0 -165
- package/.docs/raw/reference/deployer/netlify.mdx +0 -20
- package/.docs/raw/reference/deployer/vercel.mdx +0 -46
- package/.docs/raw/reference/evals/answer-relevancy.mdx +0 -190
- package/.docs/raw/reference/evals/bias.mdx +0 -195
- package/.docs/raw/reference/evals/completeness.mdx +0 -184
- package/.docs/raw/reference/evals/content-similarity.mdx +0 -185
- package/.docs/raw/reference/evals/context-position.mdx +0 -198
- package/.docs/raw/reference/evals/context-precision.mdx +0 -196
- package/.docs/raw/reference/evals/context-relevancy.mdx +0 -197
- package/.docs/raw/reference/evals/contextual-recall.mdx +0 -197
- package/.docs/raw/reference/evals/faithfulness.mdx +0 -200
- package/.docs/raw/reference/evals/hallucination.mdx +0 -227
- package/.docs/raw/reference/evals/keyword-coverage.mdx +0 -186
- package/.docs/raw/reference/evals/prompt-alignment.mdx +0 -248
- package/.docs/raw/reference/evals/summarization.mdx +0 -214
- package/.docs/raw/reference/evals/textual-difference.mdx +0 -172
- package/.docs/raw/reference/evals/tone-consistency.mdx +0 -190
- package/.docs/raw/reference/evals/toxicity.mdx +0 -173
- package/.docs/raw/reference/index.mdx +0 -12
- package/.docs/raw/reference/legacyWorkflows/after.mdx +0 -89
- package/.docs/raw/reference/legacyWorkflows/afterEvent.mdx +0 -79
- package/.docs/raw/reference/legacyWorkflows/commit.mdx +0 -33
- package/.docs/raw/reference/legacyWorkflows/createRun.mdx +0 -76
- package/.docs/raw/reference/legacyWorkflows/else.mdx +0 -68
- package/.docs/raw/reference/legacyWorkflows/events.mdx +0 -305
- package/.docs/raw/reference/legacyWorkflows/execute.mdx +0 -110
- package/.docs/raw/reference/legacyWorkflows/if.mdx +0 -108
- package/.docs/raw/reference/legacyWorkflows/resume.mdx +0 -158
- package/.docs/raw/reference/legacyWorkflows/resumeWithEvent.mdx +0 -133
- package/.docs/raw/reference/legacyWorkflows/snapshots.mdx +0 -207
- package/.docs/raw/reference/legacyWorkflows/start.mdx +0 -87
- package/.docs/raw/reference/legacyWorkflows/step-class.mdx +0 -100
- package/.docs/raw/reference/legacyWorkflows/step-condition.mdx +0 -137
- package/.docs/raw/reference/legacyWorkflows/step-function.mdx +0 -93
- package/.docs/raw/reference/legacyWorkflows/step-options.mdx +0 -69
- package/.docs/raw/reference/legacyWorkflows/step-retries.mdx +0 -196
- package/.docs/raw/reference/legacyWorkflows/suspend.mdx +0 -70
- package/.docs/raw/reference/legacyWorkflows/then.mdx +0 -72
- package/.docs/raw/reference/legacyWorkflows/until.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/watch.mdx +0 -124
- package/.docs/raw/reference/legacyWorkflows/while.mdx +0 -168
- package/.docs/raw/reference/legacyWorkflows/workflow.mdx +0 -234
- package/.docs/raw/reference/memory/Memory.mdx +0 -206
- package/.docs/raw/reference/memory/createThread.mdx +0 -119
- package/.docs/raw/reference/memory/deleteMessages.mdx +0 -60
- package/.docs/raw/reference/memory/getThreadById.mdx +0 -46
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +0 -78
- package/.docs/raw/reference/memory/getThreadsByResourceIdPaginated.mdx +0 -109
- package/.docs/raw/reference/memory/query.mdx +0 -174
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -182
- package/.docs/raw/reference/observability/ai-tracing/configuration.mdx +0 -234
- package/.docs/raw/reference/observability/ai-tracing/exporters/braintrust.mdx +0 -112
- package/.docs/raw/reference/observability/ai-tracing/exporters/cloud-exporter.mdx +0 -176
- package/.docs/raw/reference/observability/ai-tracing/exporters/console-exporter.mdx +0 -148
- package/.docs/raw/reference/observability/ai-tracing/exporters/default-exporter.mdx +0 -196
- package/.docs/raw/reference/observability/ai-tracing/exporters/langfuse.mdx +0 -116
- package/.docs/raw/reference/observability/ai-tracing/exporters/langsmith.mdx +0 -112
- package/.docs/raw/reference/observability/ai-tracing/exporters/otel.mdx +0 -361
- package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +0 -651
- package/.docs/raw/reference/observability/ai-tracing/processors/sensitive-data-filter.mdx +0 -178
- package/.docs/raw/reference/observability/ai-tracing/span.mdx +0 -371
- package/.docs/raw/reference/observability/logging/pino-logger.mdx +0 -148
- package/.docs/raw/reference/observability/otel-tracing/otel-config.mdx +0 -117
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-ax.mdx +0 -81
- package/.docs/raw/reference/observability/otel-tracing/providers/arize-phoenix.mdx +0 -120
- package/.docs/raw/reference/observability/otel-tracing/providers/braintrust.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/dash0.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/index.mdx +0 -22
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +0 -73
- package/.docs/raw/reference/observability/otel-tracing/providers/laminar.mdx +0 -41
- package/.docs/raw/reference/observability/otel-tracing/providers/langfuse.mdx +0 -84
- package/.docs/raw/reference/observability/otel-tracing/providers/langsmith.mdx +0 -48
- package/.docs/raw/reference/observability/otel-tracing/providers/langwatch.mdx +0 -43
- package/.docs/raw/reference/observability/otel-tracing/providers/new-relic.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/signoz.mdx +0 -40
- package/.docs/raw/reference/observability/otel-tracing/providers/traceloop.mdx +0 -40
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +0 -111
- package/.docs/raw/reference/processors/language-detector.mdx +0 -154
- package/.docs/raw/reference/processors/moderation-processor.mdx +0 -145
- package/.docs/raw/reference/processors/pii-detector.mdx +0 -153
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +0 -130
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +0 -145
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +0 -136
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +0 -114
- package/.docs/raw/reference/rag/chunk.mdx +0 -445
- package/.docs/raw/reference/rag/database-config.mdx +0 -334
- package/.docs/raw/reference/rag/document.mdx +0 -131
- package/.docs/raw/reference/rag/embeddings.mdx +0 -168
- package/.docs/raw/reference/rag/extract-params.mdx +0 -254
- package/.docs/raw/reference/rag/graph-rag.mdx +0 -186
- package/.docs/raw/reference/rag/metadata-filters.mdx +0 -347
- package/.docs/raw/reference/rag/rerank.mdx +0 -213
- package/.docs/raw/reference/rag/rerankWithScorer.mdx +0 -213
- package/.docs/raw/reference/scorers/answer-relevancy.mdx +0 -209
- package/.docs/raw/reference/scorers/answer-similarity.mdx +0 -423
- package/.docs/raw/reference/scorers/bias.mdx +0 -225
- package/.docs/raw/reference/scorers/completeness.mdx +0 -209
- package/.docs/raw/reference/scorers/content-similarity.mdx +0 -195
- package/.docs/raw/reference/scorers/context-precision.mdx +0 -343
- package/.docs/raw/reference/scorers/context-relevance.mdx +0 -599
- package/.docs/raw/reference/scorers/create-scorer.mdx +0 -495
- package/.docs/raw/reference/scorers/faithfulness.mdx +0 -233
- package/.docs/raw/reference/scorers/hallucination.mdx +0 -247
- package/.docs/raw/reference/scorers/keyword-coverage.mdx +0 -224
- package/.docs/raw/reference/scorers/mastra-scorer.mdx +0 -182
- package/.docs/raw/reference/scorers/noise-sensitivity.mdx +0 -766
- package/.docs/raw/reference/scorers/prompt-alignment.mdx +0 -614
- package/.docs/raw/reference/scorers/run-experiment.mdx +0 -216
- package/.docs/raw/reference/scorers/textual-difference.mdx +0 -204
- package/.docs/raw/reference/scorers/tone-consistency.mdx +0 -208
- package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +0 -567
- package/.docs/raw/reference/scorers/toxicity.mdx +0 -224
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +0 -104
- package/.docs/raw/reference/storage/cloudflare.mdx +0 -95
- package/.docs/raw/reference/storage/dynamodb.mdx +0 -196
- package/.docs/raw/reference/storage/lance.mdx +0 -101
- package/.docs/raw/reference/storage/libsql.mdx +0 -74
- package/.docs/raw/reference/storage/mssql.mdx +0 -112
- package/.docs/raw/reference/storage/postgresql.mdx +0 -305
- package/.docs/raw/reference/storage/upstash.mdx +0 -91
- package/.docs/raw/reference/streaming/ChunkType.mdx +0 -854
- package/.docs/raw/reference/streaming/agents/MastraModelOutput.mdx +0 -321
- package/.docs/raw/reference/streaming/agents/stream.mdx +0 -698
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +0 -515
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +0 -49
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +0 -118
- package/.docs/raw/reference/streaming/workflows/stream.mdx +0 -125
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -144
- package/.docs/raw/reference/templates/overview.mdx +0 -228
- package/.docs/raw/reference/tools/client.mdx +0 -336
- package/.docs/raw/reference/tools/create-tool.mdx +0 -130
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +0 -141
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +0 -262
- package/.docs/raw/reference/tools/mcp-client.mdx +0 -830
- package/.docs/raw/reference/tools/mcp-server.mdx +0 -1079
- package/.docs/raw/reference/tools/vector-query-tool.mdx +0 -604
- package/.docs/raw/reference/vectors/astra.mdx +0 -258
- package/.docs/raw/reference/vectors/chroma.mdx +0 -422
- package/.docs/raw/reference/vectors/couchbase.mdx +0 -345
- package/.docs/raw/reference/vectors/lance.mdx +0 -451
- package/.docs/raw/reference/vectors/libsql.mdx +0 -355
- package/.docs/raw/reference/vectors/mongodb.mdx +0 -309
- package/.docs/raw/reference/vectors/opensearch.mdx +0 -200
- package/.docs/raw/reference/vectors/pg.mdx +0 -632
- package/.docs/raw/reference/vectors/pinecone.mdx +0 -286
- package/.docs/raw/reference/vectors/qdrant.mdx +0 -236
- package/.docs/raw/reference/vectors/s3vectors.mdx +0 -386
- package/.docs/raw/reference/vectors/turbopuffer.mdx +0 -249
- package/.docs/raw/reference/vectors/upstash.mdx +0 -354
- package/.docs/raw/reference/vectors/vectorize.mdx +0 -298
- package/.docs/raw/reference/voice/azure.mdx +0 -218
- package/.docs/raw/reference/voice/cloudflare.mdx +0 -154
- package/.docs/raw/reference/voice/composite-voice.mdx +0 -144
- package/.docs/raw/reference/voice/deepgram.mdx +0 -166
- package/.docs/raw/reference/voice/elevenlabs.mdx +0 -218
- package/.docs/raw/reference/voice/google-gemini-live.mdx +0 -629
- package/.docs/raw/reference/voice/google.mdx +0 -203
- package/.docs/raw/reference/voice/mastra-voice.mdx +0 -413
- package/.docs/raw/reference/voice/murf.mdx +0 -253
- package/.docs/raw/reference/voice/openai-realtime.mdx +0 -376
- package/.docs/raw/reference/voice/openai.mdx +0 -169
- package/.docs/raw/reference/voice/playai.mdx +0 -163
- package/.docs/raw/reference/voice/sarvam.mdx +0 -260
- package/.docs/raw/reference/voice/speechify.mdx +0 -147
- package/.docs/raw/reference/voice/voice.addInstructions.mdx +0 -72
- package/.docs/raw/reference/voice/voice.addTools.mdx +0 -83
- package/.docs/raw/reference/voice/voice.answer.mdx +0 -69
- package/.docs/raw/reference/voice/voice.close.mdx +0 -56
- package/.docs/raw/reference/voice/voice.connect.mdx +0 -123
- package/.docs/raw/reference/voice/voice.events.mdx +0 -85
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +0 -298
- package/.docs/raw/reference/voice/voice.listen.mdx +0 -201
- package/.docs/raw/reference/voice/voice.off.mdx +0 -74
- package/.docs/raw/reference/voice/voice.on.mdx +0 -132
- package/.docs/raw/reference/voice/voice.send.mdx +0 -81
- package/.docs/raw/reference/voice/voice.speak.mdx +0 -206
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +0 -92
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +0 -58
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +0 -137
- package/.docs/raw/reference/workflows/run-methods/start.mdx +0 -134
- package/.docs/raw/reference/workflows/run-methods/watch.mdx +0 -74
- package/.docs/raw/reference/workflows/run.mdx +0 -104
- package/.docs/raw/reference/workflows/step.mdx +0 -155
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +0 -48
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +0 -30
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +0 -65
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +0 -52
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +0 -52
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +0 -60
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +0 -43
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +0 -43
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +0 -70
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +0 -61
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +0 -61
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +0 -44
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +0 -66
- package/.docs/raw/reference/workflows/workflow.mdx +0 -132
- package/.docs/raw/scorers/custom-scorers.mdx +0 -473
- package/.docs/raw/scorers/evals-old-api/custom-eval.mdx +0 -26
- package/.docs/raw/scorers/evals-old-api/overview.mdx +0 -106
- package/.docs/raw/scorers/evals-old-api/running-in-ci.mdx +0 -85
- package/.docs/raw/scorers/evals-old-api/textual-evals.mdx +0 -58
- package/.docs/raw/scorers/off-the-shelf-scorers.mdx +0 -48
- package/.docs/raw/scorers/overview.mdx +0 -138
- package/.docs/raw/server-db/custom-api-routes.mdx +0 -67
- package/.docs/raw/server-db/local-dev-playground.mdx +0 -233
- package/.docs/raw/server-db/mastra-client.mdx +0 -274
- package/.docs/raw/server-db/middleware.mdx +0 -173
- package/.docs/raw/server-db/production-server.mdx +0 -91
- package/.docs/raw/server-db/runtime-context.mdx +0 -190
- package/.docs/raw/server-db/storage.mdx +0 -514
- package/.docs/raw/streaming/events.mdx +0 -223
- package/.docs/raw/streaming/overview.mdx +0 -177
- package/.docs/raw/streaming/tool-streaming.mdx +0 -143
- package/.docs/raw/streaming/workflow-streaming.mdx +0 -124
- package/.docs/raw/tools-mcp/advanced-usage.mdx +0 -128
- package/.docs/raw/tools-mcp/mcp-overview.mdx +0 -370
- package/.docs/raw/tools-mcp/overview.mdx +0 -93
- package/.docs/raw/voice/overview.mdx +0 -944
- package/.docs/raw/voice/speech-to-speech.mdx +0 -105
- package/.docs/raw/voice/speech-to-text.mdx +0 -86
- package/.docs/raw/voice/text-to-speech.mdx +0 -90
- package/.docs/raw/workflows/control-flow.mdx +0 -265
- package/.docs/raw/workflows/error-handling.mdx +0 -213
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -359
- package/.docs/raw/workflows/input-data-mapping.mdx +0 -107
- package/.docs/raw/workflows/overview.mdx +0 -277
- package/.docs/raw/workflows/snapshots.mdx +0 -250
- package/.docs/raw/workflows/suspend-and-resume.mdx +0 -298
- package/.docs/raw/workflows/using-with-agents-and-tools.mdx +0 -350
- package/.docs/raw/workflows-legacy/control-flow.mdx +0 -776
- package/.docs/raw/workflows-legacy/dynamic-workflows.mdx +0 -237
- package/.docs/raw/workflows-legacy/error-handling.mdx +0 -185
- package/.docs/raw/workflows-legacy/nested-workflows.mdx +0 -354
- package/.docs/raw/workflows-legacy/overview.mdx +0 -180
- package/.docs/raw/workflows-legacy/runtime-variables.mdx +0 -154
- package/.docs/raw/workflows-legacy/steps.mdx +0 -113
- package/.docs/raw/workflows-legacy/suspend-and-resume.mdx +0 -404
- package/.docs/raw/workflows-legacy/variables.mdx +0 -316
- package/dist/chunk-TUAHUTTB.js +0 -356
- package/dist/prepare-docs/code-examples.d.ts +0 -5
- package/dist/prepare-docs/code-examples.d.ts.map +0 -1
- package/dist/prepare-docs/copy-raw.d.ts +0 -2
- package/dist/prepare-docs/copy-raw.d.ts.map +0 -1
- package/dist/prepare-docs/package-changes.d.ts +0 -5
- package/dist/prepare-docs/package-changes.d.ts.map +0 -1
- package/dist/prepare-docs/prepare.d.ts +0 -2
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/prepare-docs/prepare.js +0 -1
- package/dist/tools/__tests__/test-setup.d.ts +0 -5
- package/dist/tools/__tests__/test-setup.d.ts.map +0 -1
- package/dist/tools/blog.d.ts +0 -22
- package/dist/tools/blog.d.ts.map +0 -1
- package/dist/tools/changes.d.ts +0 -22
- package/dist/tools/changes.d.ts.map +0 -1
- package/dist/tools/examples.d.ts +0 -28
- package/dist/tools/examples.d.ts.map +0 -1
- /package/.docs/{raw/course → course}/01-first-agent/01-introduction-to-mastra.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/02-what-is-mastra.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/03-verifying-installation.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/06-understanding-system-prompts.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/10-understanding-tools.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/14-understanding-memory.md +0 -0
- /package/.docs/{raw/course → course}/01-first-agent/18-conclusion.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/01-introduction-to-mcp.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/02-installing-mcp.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/06-testing-mcp-setup.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/11-testing-zapier-integration.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/17-testing-github-integration.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/19-what-is-hackernews-mcp.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/22-testing-hackernews-integration.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/23-troubleshooting-hackernews.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/24-what-is-filesystem-mcp.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/25-creating-notes-directory.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/28-testing-filesystem-integration.md +0 -0
- /package/.docs/{raw/course → course}/02-agent-tools-mcp/29-troubleshooting-filesystem.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/01-understanding-memory.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/02-why-memory-matters.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/06-testing-memory-agent.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/11-testing-conversation-history.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/14-what-is-semantic-recall.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/15-how-semantic-recall-works.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/17-testing-semantic-recall.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/19-what-is-working-memory.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/20-how-working-memory-works.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/23-testing-working-memory.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/24-working-memory-in-practice.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/28-testing-memory-enhanced-agents.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/29-memory-best-practices.md +0 -0
- /package/.docs/{raw/course → course}/03-agent-memory/30-conclusion.md +0 -0
- /package/.docs/{raw/course → course}/04-workflows/22-conclusion.md +0 -0
package/dist/stdio.js
CHANGED
|
@@ -1,15 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { fromPackageRoot, prepare, getMatchingPaths, blogPostSchema } from './chunk-TUAHUTTB.js';
|
|
3
2
|
import * as fs from 'fs';
|
|
4
3
|
import { existsSync, mkdirSync } from 'fs';
|
|
5
4
|
import * as os2 from 'os';
|
|
6
5
|
import os2__default from 'os';
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
6
|
+
import * as path5 from 'path';
|
|
7
|
+
import path5__default, { dirname } from 'path';
|
|
9
8
|
import fs3 from 'fs/promises';
|
|
10
9
|
import { MCPServer } from '@mastra/mcp';
|
|
11
10
|
import { z } from 'zod';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { getPackageInfo } from 'local-pkg';
|
|
12
13
|
|
|
14
|
+
var LOG_LEVEL_PRIORITY = {
|
|
15
|
+
debug: 0,
|
|
16
|
+
info: 1,
|
|
17
|
+
warn: 2,
|
|
18
|
+
error: 3,
|
|
19
|
+
none: 4
|
|
20
|
+
// none = disable all logs
|
|
21
|
+
};
|
|
22
|
+
function mapToLogLevel(level) {
|
|
23
|
+
switch (level) {
|
|
24
|
+
case "debug":
|
|
25
|
+
return "debug";
|
|
26
|
+
case "info":
|
|
27
|
+
case "notice":
|
|
28
|
+
return "info";
|
|
29
|
+
case "warning":
|
|
30
|
+
return "warn";
|
|
31
|
+
case "error":
|
|
32
|
+
case "critical":
|
|
33
|
+
case "alert":
|
|
34
|
+
case "emergency":
|
|
35
|
+
return "error";
|
|
36
|
+
default:
|
|
37
|
+
return "info";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
var currentLogLevel = "debug";
|
|
41
|
+
function setLogLevel(level) {
|
|
42
|
+
currentLogLevel = level;
|
|
43
|
+
}
|
|
44
|
+
function shouldLog(level) {
|
|
45
|
+
const mappedLevel = mapToLogLevel(level);
|
|
46
|
+
return LOG_LEVEL_PRIORITY[mappedLevel] >= LOG_LEVEL_PRIORITY[currentLogLevel];
|
|
47
|
+
}
|
|
13
48
|
var writeErrorLog = (message, data) => {
|
|
14
49
|
const now = /* @__PURE__ */ new Date();
|
|
15
50
|
const timestamp = now.toISOString();
|
|
@@ -20,9 +55,9 @@ var writeErrorLog = (message, data) => {
|
|
|
20
55
|
...data ? typeof data === "object" ? data : { data } : {}
|
|
21
56
|
};
|
|
22
57
|
try {
|
|
23
|
-
const cacheDir =
|
|
58
|
+
const cacheDir = path5.join(os2.homedir(), ".cache", "mastra", "mcp-docs-server-logs");
|
|
24
59
|
fs.mkdirSync(cacheDir, { recursive: true });
|
|
25
|
-
const logFile =
|
|
60
|
+
const logFile = path5.join(cacheDir, `${hourTimestamp}.log`);
|
|
26
61
|
fs.appendFileSync(logFile, JSON.stringify(logMessage) + "\n", "utf8");
|
|
27
62
|
} catch (err) {
|
|
28
63
|
console.error("Failed to write to log file:", err);
|
|
@@ -31,6 +66,7 @@ var writeErrorLog = (message, data) => {
|
|
|
31
66
|
function createLogger(server2) {
|
|
32
67
|
const sendLog = async (level, message, data) => {
|
|
33
68
|
if (!server2) return;
|
|
69
|
+
if (!shouldLog(level)) return;
|
|
34
70
|
try {
|
|
35
71
|
const sdkServer = server2.getServer();
|
|
36
72
|
if (!sdkServer) return;
|
|
@@ -102,169 +138,226 @@ function createLogger(server2) {
|
|
|
102
138
|
};
|
|
103
139
|
}
|
|
104
140
|
var logger = createLogger();
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
141
|
+
|
|
142
|
+
// src/prompts/migration.ts
|
|
143
|
+
var migrationPrompts = [
|
|
144
|
+
{
|
|
145
|
+
name: "upgrade-to-v1",
|
|
146
|
+
version: "v1",
|
|
147
|
+
description: "Get a guided migration plan for upgrading from Mastra v0.x to v1.0. Provides step-by-step instructions for handling all breaking changes.",
|
|
148
|
+
arguments: [
|
|
149
|
+
{
|
|
150
|
+
name: "area",
|
|
151
|
+
description: "Optional: Focus on a specific area (e.g., agent, tools, workflows, memory, storage, voice). The tool will check if a migration guide exists for this area and suggest alternatives if not found. If not provided, gives an overview of all changes.",
|
|
152
|
+
required: false
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "migration-checklist",
|
|
158
|
+
version: "v1",
|
|
159
|
+
description: "Get a comprehensive checklist for migrating to Mastra v1.0. Lists all breaking changes that need to be addressed."
|
|
116
160
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
];
|
|
162
|
+
var migrationPromptMessages = {
|
|
163
|
+
listPrompts: async () => migrationPrompts,
|
|
164
|
+
getPromptMessages: async ({ name, args }) => {
|
|
165
|
+
const prompt = migrationPrompts.find((p) => p.name === name);
|
|
166
|
+
if (!prompt) {
|
|
167
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
122
168
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return "Mastra.ai Blog Posts:\n\n" + blogLinks.join("\n");
|
|
126
|
-
}
|
|
127
|
-
function validateBlogUrl(url) {
|
|
128
|
-
try {
|
|
129
|
-
const inputUrl = new URL(url);
|
|
130
|
-
const baseUrl = new URL(BLOG_BASE_URL);
|
|
131
|
-
return inputUrl.hostname === baseUrl.hostname;
|
|
132
|
-
} catch {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async function fetchBlogPost(url) {
|
|
137
|
-
void logger.debug(`Fetching blog post: ${url}`);
|
|
138
|
-
if (!validateBlogUrl(url)) {
|
|
139
|
-
void logger.error(`Rejected request to unauthorized domain: ${url}`);
|
|
140
|
-
return `URL must be from the same domain as ${BLOG_BASE_URL}`;
|
|
141
|
-
}
|
|
142
|
-
const response = await fetch(url);
|
|
143
|
-
if (!response.ok) {
|
|
144
|
-
if (response.status === 429) {
|
|
145
|
-
throw new Error("Rate limit exceeded");
|
|
169
|
+
if (name === "upgrade-to-v1") {
|
|
170
|
+
return getUpgradeToV1Messages(args?.area);
|
|
146
171
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const blogPosts = await fetchBlogPosts();
|
|
150
|
-
blogList = `Here are available blog posts:
|
|
151
|
-
|
|
152
|
-
${blogPosts}`;
|
|
153
|
-
} catch (e) {
|
|
154
|
-
void logger.error(
|
|
155
|
-
`Blog post not found or failed to fetch: ${url}, and failed to fetch blog post listing as fallback.`,
|
|
156
|
-
e
|
|
157
|
-
);
|
|
158
|
-
blogList = "Additionally, the list of available blog posts could not be fetched at this time.";
|
|
172
|
+
if (name === "migration-checklist") {
|
|
173
|
+
return getMigrationChecklistMessages();
|
|
159
174
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
${blogList}`;
|
|
175
|
+
throw new Error(`No message handler for prompt: ${name}`);
|
|
163
176
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
177
|
+
};
|
|
178
|
+
function getUpgradeToV1Messages(area) {
|
|
179
|
+
if (area) {
|
|
180
|
+
return [
|
|
181
|
+
{
|
|
182
|
+
role: "user",
|
|
183
|
+
content: {
|
|
184
|
+
type: "text",
|
|
185
|
+
text: `I need help migrating my Mastra ${area} code from v0.x to v1.0. Use the mastraMigration tool to:
|
|
186
|
+
|
|
187
|
+
1. If packages aren't already at the 'latest' tag, upgrade packages to the 'latest' tag and do an install of the new packages.
|
|
188
|
+
2. First, try to get the specific migration guide for "${area}" using path: "upgrade-to-v1/${area}"
|
|
189
|
+
3. If that doesn't exist, try the alternate form (singular/plural):
|
|
190
|
+
- If "${area}" ends with 's', try without the 's' (e.g., "agents" \u2192 "agent")
|
|
191
|
+
- If "${area}" doesn't end with 's', try adding 's' (e.g., "agent" \u2192 "agents")
|
|
192
|
+
4. If the guide exists, walk me through the changes step by step
|
|
193
|
+
5. If neither form exists, list available migration guides in "upgrade-to-v1/" and suggest which ones might be relevant to "${area}"
|
|
194
|
+
6. After you find the guide, collect all the codemod calls to run to codemods. These callouts are marked with "> **Codemod:**" in the docs. Run the codemods with "npx @mastra/codemod@latest <codemod-name> <path>" to automate all those changes. Afterwards, help me with any remaining manual changes needed.`
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
];
|
|
172
198
|
}
|
|
173
|
-
return
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
role: "user",
|
|
202
|
+
content: {
|
|
203
|
+
type: "text",
|
|
204
|
+
text: `I need to migrate my Mastra project from v0.x to v1.0. Use the mastraMigration tool to:
|
|
205
|
+
|
|
206
|
+
1. If packages aren't already at the 'latest' tag, upgrade packages to the 'latest' tag and do an install of the new packages.
|
|
207
|
+
2. First, list all available migration guides with path: "upgrade-to-v1/"
|
|
208
|
+
2. Give me a high-level overview of what changed in each area
|
|
209
|
+
3. Find relevant migration areas to focus on based on my project's codebase and confirm the list with me
|
|
210
|
+
4. After the areas are confirmed, check the migration guides for callouts to codemods. These callouts are marked with "> **Codemod:**" in the docs. Run the codemods with "npx @mastra/codemod@latest v1" to automate all those changes. Afterwards, help me with any remaining manual changes needed.
|
|
211
|
+
|
|
212
|
+
After the areas are confirmed, we'll go through each one systematically.`
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
];
|
|
174
216
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
217
|
+
function getMigrationChecklistMessages() {
|
|
218
|
+
return [
|
|
219
|
+
{
|
|
220
|
+
role: "user",
|
|
221
|
+
content: {
|
|
222
|
+
type: "text",
|
|
223
|
+
text: `Create a comprehensive migration checklist for upgrading from Mastra v0.x to v1.0. Use the mastraMigration tool to:
|
|
224
|
+
|
|
225
|
+
1. List all available migration guides (path: "upgrade-to-v1/")
|
|
226
|
+
2. For each guide, extract the key breaking changes
|
|
227
|
+
3. Present them as a checklist I can work through
|
|
228
|
+
|
|
229
|
+
Format the checklist with:
|
|
230
|
+
- [ ] checkbox items for each breaking change
|
|
231
|
+
- Brief description of what needs to change
|
|
232
|
+
- Reference to the specific migration guide
|
|
233
|
+
|
|
234
|
+
Group the checklist by area (Agents, Tools, Workflows, etc.) so I can tackle one area at a time.`
|
|
192
235
|
}
|
|
193
|
-
return content;
|
|
194
|
-
} catch (error) {
|
|
195
|
-
void logger.error("Failed to execute mastraBlog tool", error);
|
|
196
|
-
throw error;
|
|
197
236
|
}
|
|
198
|
-
|
|
199
|
-
};
|
|
200
|
-
function encodePackageName(name) {
|
|
201
|
-
return encodeURIComponent(name);
|
|
237
|
+
];
|
|
202
238
|
}
|
|
203
|
-
|
|
204
|
-
|
|
239
|
+
var mdFileCache = /* @__PURE__ */ new Map();
|
|
240
|
+
var __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
241
|
+
function fromPackageRoot(relative) {
|
|
242
|
+
return path5__default.resolve(__dirname$1, `../`, relative);
|
|
205
243
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const files = await fs3.readdir(changelogsDir);
|
|
211
|
-
return files.filter((f) => f.endsWith(".md")).map((f) => ({
|
|
212
|
-
name: decodePackageName(f.replace(".md", "")),
|
|
213
|
-
path: f
|
|
214
|
-
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
215
|
-
} catch {
|
|
216
|
-
return [];
|
|
244
|
+
async function* walkMdFiles(dir) {
|
|
245
|
+
if (mdFileCache.has(dir)) {
|
|
246
|
+
for (const file of mdFileCache.get(dir)) yield file;
|
|
247
|
+
return;
|
|
217
248
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
${availablePackages}`;
|
|
249
|
+
const filesInDir = [];
|
|
250
|
+
const entries = await fs3.readdir(dir, { withFileTypes: true });
|
|
251
|
+
for (const entry of entries) {
|
|
252
|
+
const fullPath = path5__default.join(dir, entry.name);
|
|
253
|
+
if (entry.isDirectory()) {
|
|
254
|
+
for await (const file of walkMdFiles(fullPath)) {
|
|
255
|
+
filesInDir.push(file);
|
|
256
|
+
yield file;
|
|
257
|
+
}
|
|
258
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
259
|
+
filesInDir.push(fullPath);
|
|
260
|
+
yield fullPath;
|
|
261
|
+
}
|
|
232
262
|
}
|
|
263
|
+
mdFileCache.set(dir, filesInDir);
|
|
233
264
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
var changesTool = {
|
|
240
|
-
name: "mastraChanges",
|
|
241
|
-
description: `Get changelog information for Mastra.ai packages. ${packagesListing}`,
|
|
242
|
-
parameters: changesInputSchema,
|
|
243
|
-
execute: async (args) => {
|
|
244
|
-
void logger.debug("Executing mastraChanges tool", { package: args.package });
|
|
265
|
+
async function searchDocumentContent(keywords, baseDir) {
|
|
266
|
+
if (keywords.length === 0) return [];
|
|
267
|
+
const fileScores = /* @__PURE__ */ new Map();
|
|
268
|
+
for await (const filePath of walkMdFiles(baseDir)) {
|
|
269
|
+
let content;
|
|
245
270
|
try {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
271
|
+
content = await fs3.readFile(filePath, "utf-8");
|
|
272
|
+
} catch {
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
const lines = content.split("\n");
|
|
276
|
+
lines.forEach((lineText) => {
|
|
277
|
+
const lowerLine = lineText.toLowerCase();
|
|
278
|
+
for (const keyword of keywords) {
|
|
279
|
+
if (lowerLine.includes(keyword.toLowerCase())) {
|
|
280
|
+
const relativePath = path5__default.relative(baseDir, filePath).replace(/\\/g, "/");
|
|
281
|
+
if (!fileScores.has(relativePath)) {
|
|
282
|
+
fileScores.set(relativePath, {
|
|
283
|
+
path: relativePath,
|
|
284
|
+
keywordMatches: /* @__PURE__ */ new Set(),
|
|
285
|
+
totalMatches: 0,
|
|
286
|
+
titleMatches: 0,
|
|
287
|
+
pathRelevance: calculatePathRelevance(relativePath, keywords)
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
const score = fileScores.get(relativePath);
|
|
291
|
+
score.keywordMatches.add(keyword);
|
|
292
|
+
score.totalMatches++;
|
|
293
|
+
if (lowerLine.includes("#") || lowerLine.includes("title")) {
|
|
294
|
+
score.titleMatches++;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
250
297
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const validFiles = Array.from(fileScores.values()).sort((a, b) => calculateFinalScore(b, keywords.length) - calculateFinalScore(a, keywords.length)).slice(0, 10);
|
|
301
|
+
return validFiles.map((score) => score.path);
|
|
302
|
+
}
|
|
303
|
+
function calculatePathRelevance(filePath, keywords) {
|
|
304
|
+
let relevance = 0;
|
|
305
|
+
const pathLower = filePath.toLowerCase();
|
|
306
|
+
if (pathLower.startsWith("reference/")) relevance += 2;
|
|
307
|
+
keywords.forEach((keyword) => {
|
|
308
|
+
if (pathLower.includes(keyword.toLowerCase())) relevance += 3;
|
|
309
|
+
});
|
|
310
|
+
const highValueDirs = ["rag", "memory", "agents", "workflows"];
|
|
311
|
+
if (highValueDirs.some((dir) => pathLower.includes(dir))) {
|
|
312
|
+
relevance += 1;
|
|
313
|
+
}
|
|
314
|
+
return relevance;
|
|
315
|
+
}
|
|
316
|
+
function calculateFinalScore(score, totalKeywords) {
|
|
317
|
+
const allKeywordsBonus = score.keywordMatches.size === totalKeywords ? 10 : 0;
|
|
318
|
+
return score.totalMatches * 1 + score.titleMatches * 3 + score.pathRelevance * 2 + score.keywordMatches.size * 5 + allKeywordsBonus;
|
|
319
|
+
}
|
|
320
|
+
function extractKeywordsFromPath(docPath) {
|
|
321
|
+
const cleanPath = docPath.replace(/\.md$/, "");
|
|
322
|
+
const fileName = cleanPath.split("/").pop() || "";
|
|
323
|
+
const keywords = /* @__PURE__ */ new Set();
|
|
324
|
+
const splitParts = fileName.split(/[-_]|(?=[A-Z])/);
|
|
325
|
+
splitParts.forEach((keyword) => {
|
|
326
|
+
if (keyword.length > 2) {
|
|
327
|
+
keywords.add(keyword.toLowerCase());
|
|
256
328
|
}
|
|
329
|
+
});
|
|
330
|
+
return Array.from(keywords);
|
|
331
|
+
}
|
|
332
|
+
function normalizeKeywords(keywords) {
|
|
333
|
+
return Array.from(new Set(keywords.flatMap((k) => k.split(/\s+/).filter(Boolean)).map((k) => k.toLowerCase())));
|
|
334
|
+
}
|
|
335
|
+
async function getMatchingPaths(path7, queryKeywords, baseDir) {
|
|
336
|
+
const pathKeywords = extractKeywordsFromPath(path7);
|
|
337
|
+
const allKeywords = normalizeKeywords([...pathKeywords, ...queryKeywords || []]);
|
|
338
|
+
if (allKeywords.length === 0) {
|
|
339
|
+
return "";
|
|
257
340
|
}
|
|
258
|
-
|
|
341
|
+
const suggestedPaths = await searchDocumentContent(allKeywords, baseDir);
|
|
342
|
+
if (suggestedPaths.length === 0) {
|
|
343
|
+
return "";
|
|
344
|
+
}
|
|
345
|
+
const pathList = suggestedPaths.map((path8) => `- ${path8}`).join("\n");
|
|
346
|
+
return `Here are some paths that might be relevant based on your query:
|
|
347
|
+
|
|
348
|
+
${pathList}`;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// src/tools/course.ts
|
|
259
352
|
var _courseLessonSchema = z.object({
|
|
260
353
|
lessonName: z.string().describe("Name of the specific lesson to start. It must match the exact lesson name.")
|
|
261
354
|
});
|
|
262
355
|
var _confirmationSchema = z.object({
|
|
263
356
|
confirm: z.boolean().optional().describe("Set to true to confirm this action")
|
|
264
357
|
});
|
|
265
|
-
var courseDir = fromPackageRoot(".docs/
|
|
358
|
+
var courseDir = fromPackageRoot(".docs/course");
|
|
266
359
|
var introductionPrompt = `
|
|
267
|
-
This is a course to help a new user learn about Mastra, the open-source AI Agent framework built in
|
|
360
|
+
This is a course to help a new user learn about Mastra, the open-source AI Agent framework built in TypeScript.
|
|
268
361
|
The following is the introduction content, please provide this text to the user EXACTLY as written below. Do not provide any other text or instructions:
|
|
269
362
|
|
|
270
363
|
# Welcome to the Mastra Course!
|
|
@@ -291,14 +384,13 @@ This helps the project grow and reach more developers like you!
|
|
|
291
384
|
Type "start mastra course" and let's get started with your first lesson!
|
|
292
385
|
`;
|
|
293
386
|
var lessonPrompt = `
|
|
294
|
-
This is a course to help a new user learn about Mastra, the open-source AI Agent framework built in
|
|
387
|
+
This is a course to help a new user learn about Mastra, the open-source AI Agent framework built in TypeScript.
|
|
295
388
|
Please help the user through the steps of the course by walking them through the content and following the course
|
|
296
389
|
to write the initial version of the code for them. The goal is to show them how the code works and explain it as they go
|
|
297
390
|
as the course goes on. Each lesson is broken up into steps. You should return the content of the step and ask the user
|
|
298
391
|
to move to the next step when they are ready. If the step contains instructions to write code, you should write the code
|
|
299
392
|
for the user when possible. You should always briefly explain the step before writing the code. Please ensure to
|
|
300
|
-
return any text in markdown blockquotes exactly as written in your response. When the user ask about their course progress or course status,
|
|
301
|
-
make sure to include the course status url in your response. This is important.
|
|
393
|
+
return any text in markdown blockquotes exactly as written in your response. When the user ask about their course progress or course status, make sure to include the course status URL in your response. This is important.
|
|
302
394
|
`;
|
|
303
395
|
function wrapContentInPrompt(content, _isFirstStep = false) {
|
|
304
396
|
let wrappedContent = `${lessonPrompt}
|
|
@@ -309,11 +401,11 @@ Here is the content for this step: <StepContent>${content}</StepContent>`;
|
|
|
309
401
|
When you're ready to continue, use the \`nextMastraCourseStep\` tool to move to the next step.`;
|
|
310
402
|
}
|
|
311
403
|
async function getDeviceIdPath() {
|
|
312
|
-
const cacheDir =
|
|
404
|
+
const cacheDir = path5__default.join(os2__default.homedir(), ".cache", "mastra");
|
|
313
405
|
if (!existsSync(cacheDir)) {
|
|
314
406
|
mkdirSync(cacheDir, { recursive: true });
|
|
315
407
|
}
|
|
316
|
-
return
|
|
408
|
+
return path5__default.join(cacheDir, ".device_id");
|
|
317
409
|
}
|
|
318
410
|
async function getDeviceCredentials() {
|
|
319
411
|
try {
|
|
@@ -363,13 +455,13 @@ async function readCourseStep(lessonName, stepName, _isFirstStep = false) {
|
|
|
363
455
|
if (!lessonDir) {
|
|
364
456
|
throw new Error(`Lesson "${lessonName}" not found.`);
|
|
365
457
|
}
|
|
366
|
-
const lessonPath =
|
|
458
|
+
const lessonPath = path5__default.join(courseDir, lessonDir);
|
|
367
459
|
const files = await fs3.readdir(lessonPath);
|
|
368
460
|
const stepFile = files.find((f) => f.endsWith(".md") && f.replace(/^\d+-/, "").replace(".md", "") === stepName);
|
|
369
461
|
if (!stepFile) {
|
|
370
462
|
throw new Error(`Step "${stepName}" not found in lesson "${lessonName}".`);
|
|
371
463
|
}
|
|
372
|
-
const filePath =
|
|
464
|
+
const filePath = path5__default.join(courseDir, lessonDir, stepFile);
|
|
373
465
|
try {
|
|
374
466
|
const content = await fs3.readFile(filePath, "utf-8");
|
|
375
467
|
return wrapContentInPrompt(content);
|
|
@@ -415,11 +507,11 @@ async function saveCourseState(state, deviceId) {
|
|
|
415
507
|
}
|
|
416
508
|
}
|
|
417
509
|
async function getCourseStatePath() {
|
|
418
|
-
const stateDirPath =
|
|
510
|
+
const stateDirPath = path5__default.join(os2__default.homedir(), ".cache", "mastra", "course");
|
|
419
511
|
if (!existsSync(stateDirPath)) {
|
|
420
512
|
mkdirSync(stateDirPath, { recursive: true });
|
|
421
513
|
}
|
|
422
|
-
return
|
|
514
|
+
return path5__default.join(stateDirPath, "state.json");
|
|
423
515
|
}
|
|
424
516
|
async function loadCourseState() {
|
|
425
517
|
const statePath = await getCourseStatePath();
|
|
@@ -437,7 +529,7 @@ async function scanCourseContent() {
|
|
|
437
529
|
const lessonDirs = await fs3.readdir(courseDir);
|
|
438
530
|
const lessons = await Promise.all(
|
|
439
531
|
lessonDirs.filter((dir) => !dir.startsWith(".")).sort((a, b) => a.localeCompare(b)).map(async (lessonDir) => {
|
|
440
|
-
const lessonPath =
|
|
532
|
+
const lessonPath = path5__default.join(courseDir, lessonDir);
|
|
441
533
|
const lessonStats = await fs3.stat(lessonPath);
|
|
442
534
|
if (!lessonStats.isDirectory()) return null;
|
|
443
535
|
const lessonName = lessonDir.replace(/^\d+-/, "");
|
|
@@ -462,7 +554,7 @@ async function scanCourseContent() {
|
|
|
462
554
|
);
|
|
463
555
|
const validLessons = lessons.filter((lesson) => lesson !== null);
|
|
464
556
|
return {
|
|
465
|
-
currentLesson: validLessons.length > 0 ? validLessons[0]
|
|
557
|
+
currentLesson: validLessons.length > 0 ? validLessons[0]?.name ?? "" : "",
|
|
466
558
|
lessons: validLessons
|
|
467
559
|
};
|
|
468
560
|
}
|
|
@@ -498,7 +590,7 @@ async function mergeCourseStates(currentState, newState) {
|
|
|
498
590
|
});
|
|
499
591
|
let currentLesson = currentState.currentLesson;
|
|
500
592
|
if (!mergedLessons.some((lesson) => lesson.name === currentLesson) && mergedLessons.length > 0) {
|
|
501
|
-
currentLesson = mergedLessons[0]
|
|
593
|
+
currentLesson = mergedLessons[0]?.name ?? "";
|
|
502
594
|
}
|
|
503
595
|
return {
|
|
504
596
|
currentLesson,
|
|
@@ -507,7 +599,7 @@ async function mergeCourseStates(currentState, newState) {
|
|
|
507
599
|
}
|
|
508
600
|
var startMastraCourse = {
|
|
509
601
|
name: "startMastraCourse",
|
|
510
|
-
description: "Starts the Mastra Course. If the user is not registered, they will be prompted to register first. Otherwise, it will start at the first lesson or pick up where they last left off. ALWAYS ask the user for their email address if they are not registered. DO NOT assume their email address, they must confirm their email and that they want to register.",
|
|
602
|
+
description: "[\u{1F393} COURSE] Starts the Mastra Course. If the user is not registered, they will be prompted to register first. Otherwise, it will start at the first lesson or pick up where they last left off. ALWAYS ask the user for their email address if they are not registered. DO NOT assume their email address, they must confirm their email and that they want to register.",
|
|
511
603
|
parameters: z.object({
|
|
512
604
|
email: z.string().email().optional().describe("Email address for registration if not already registered. ")
|
|
513
605
|
}),
|
|
@@ -604,7 +696,7 @@ When you've completed this step, use the \`nextMastraCourseStep\` tool to contin
|
|
|
604
696
|
};
|
|
605
697
|
var getMastraCourseStatus = {
|
|
606
698
|
name: "getMastraCourseStatus",
|
|
607
|
-
description: "Gets the current status of the Mastra Course, including which lessons and steps have been completed",
|
|
699
|
+
description: "[\u{1F393} COURSE] Gets the current status of the Mastra Course, including which lessons and steps have been completed",
|
|
608
700
|
parameters: z.object({}),
|
|
609
701
|
execute: async (_args) => {
|
|
610
702
|
try {
|
|
@@ -681,7 +773,7 @@ Course status url: https://mastra.ai/course/${deviceId}`;
|
|
|
681
773
|
};
|
|
682
774
|
var startMastraCourseLesson = {
|
|
683
775
|
name: "startMastraCourseLesson",
|
|
684
|
-
description: "Starts a specific lesson in the Mastra Course. If the lesson has been started before, it will resume from the first incomplete step",
|
|
776
|
+
description: "[\u{1F393} COURSE] Starts a specific lesson in the Mastra Course. If the lesson has been started before, it will resume from the first incomplete step",
|
|
685
777
|
parameters: _courseLessonSchema,
|
|
686
778
|
execute: async (args) => {
|
|
687
779
|
try {
|
|
@@ -724,7 +816,7 @@ When you've completed this step, use the \`nextMastraCourseStep\` tool to contin
|
|
|
724
816
|
};
|
|
725
817
|
var nextMastraCourseStep = {
|
|
726
818
|
name: "nextMastraCourseStep",
|
|
727
|
-
description: "Advances to the next step in the current Mastra Course lesson. If all steps in the current lesson are completed, it will move to the next lesson",
|
|
819
|
+
description: "[\u{1F393} COURSE] Advances to the next step in the current Mastra Course lesson. If all steps in the current lesson are completed, it will move to the next lesson",
|
|
728
820
|
parameters: z.object({}),
|
|
729
821
|
execute: async (_args) => {
|
|
730
822
|
try {
|
|
@@ -745,19 +837,23 @@ var nextMastraCourseStep = {
|
|
|
745
837
|
if (currentStepIndex === -1) {
|
|
746
838
|
return "No step is currently in progress. Please start a step first using the `startMastraCourse` tool.";
|
|
747
839
|
}
|
|
748
|
-
currentLesson.steps[currentStepIndex]
|
|
840
|
+
if (currentLesson.steps[currentStepIndex]?.status) {
|
|
841
|
+
currentLesson.steps[currentStepIndex].status = 2;
|
|
842
|
+
}
|
|
749
843
|
const nextStepIndex = currentLesson.steps.findIndex(
|
|
750
844
|
(step, index) => index > currentStepIndex && step.status !== 2
|
|
751
845
|
);
|
|
752
846
|
if (nextStepIndex !== -1) {
|
|
753
|
-
currentLesson.steps[nextStepIndex]
|
|
847
|
+
if (currentLesson.steps[nextStepIndex]) {
|
|
848
|
+
currentLesson.steps[nextStepIndex].status = 1;
|
|
849
|
+
}
|
|
754
850
|
await saveCourseState(courseState, deviceId);
|
|
755
851
|
const nextStep = currentLesson.steps[nextStepIndex];
|
|
756
|
-
const stepContent = await readCourseStep(currentLessonName, nextStep
|
|
757
|
-
return `\u{1F389} Step "${currentLesson.steps[currentStepIndex]
|
|
852
|
+
const stepContent = await readCourseStep(currentLessonName, nextStep?.name ?? "Unknown Step");
|
|
853
|
+
return `\u{1F389} Step "${currentLesson.steps[currentStepIndex]?.name ?? "Unknown Step"}" completed!
|
|
758
854
|
|
|
759
855
|
\u{1F4D8} Continuing Lesson: ${currentLessonName}
|
|
760
|
-
\u{1F4DD} Next Step: ${nextStep
|
|
856
|
+
\u{1F4DD} Next Step: ${nextStep?.name ?? "Unknown Step"}
|
|
761
857
|
|
|
762
858
|
${stepContent}
|
|
763
859
|
|
|
@@ -768,17 +864,17 @@ When you've completed this step, use the \`nextMastraCourseStep\` tool to contin
|
|
|
768
864
|
const nextLesson = courseState.lessons.find((lesson, index) => index > currentLessonIndex && lesson.status !== 2);
|
|
769
865
|
if (nextLesson) {
|
|
770
866
|
courseState.currentLesson = nextLesson.name;
|
|
771
|
-
if (nextLesson.steps.length > 0) {
|
|
867
|
+
if (nextLesson.steps.length > 0 && nextLesson.steps[0]) {
|
|
772
868
|
nextLesson.steps[0].status = 1;
|
|
773
869
|
}
|
|
774
870
|
nextLesson.status = 1;
|
|
775
871
|
await saveCourseState(courseState, deviceId);
|
|
776
872
|
const firstStep = nextLesson.steps[0];
|
|
777
|
-
const stepContent = await readCourseStep(nextLesson.name, firstStep
|
|
873
|
+
const stepContent = await readCourseStep(nextLesson.name, firstStep?.name ?? "Unknown Step");
|
|
778
874
|
return `\u{1F389} Congratulations! You've completed the "${currentLessonName}" lesson!
|
|
779
875
|
|
|
780
876
|
\u{1F4D8} Starting New Lesson: ${nextLesson.name}
|
|
781
|
-
\u{1F4DD} First Step: ${firstStep
|
|
877
|
+
\u{1F4DD} First Step: ${firstStep?.name ?? "Unknown Step"}
|
|
782
878
|
|
|
783
879
|
${stepContent}
|
|
784
880
|
|
|
@@ -795,7 +891,7 @@ If you'd like to review any lesson, use the \`startMastraCourseLesson\` tool wit
|
|
|
795
891
|
};
|
|
796
892
|
var clearMastraCourseHistory = {
|
|
797
893
|
name: "clearMastraCourseHistory",
|
|
798
|
-
description: "Clears all Mastra Course progress history and starts over from the beginning. This action cannot be undone",
|
|
894
|
+
description: "[\u{1F393} COURSE] Clears all Mastra Course progress history and starts over from the beginning. This action cannot be undone",
|
|
799
895
|
parameters: _confirmationSchema,
|
|
800
896
|
execute: async (args) => {
|
|
801
897
|
try {
|
|
@@ -817,7 +913,7 @@ var clearMastraCourseHistory = {
|
|
|
817
913
|
}
|
|
818
914
|
}
|
|
819
915
|
};
|
|
820
|
-
var docsBaseDir = fromPackageRoot(".docs/
|
|
916
|
+
var docsBaseDir = fromPackageRoot(".docs/");
|
|
821
917
|
async function listDirContents(dirPath) {
|
|
822
918
|
try {
|
|
823
919
|
void logger.debug(`Listing directory contents: ${dirPath}`);
|
|
@@ -827,8 +923,8 @@ async function listDirContents(dirPath) {
|
|
|
827
923
|
for (const entry of entries) {
|
|
828
924
|
if (entry.isDirectory()) {
|
|
829
925
|
dirs.push(entry.name + "/");
|
|
830
|
-
} else if (entry.isFile() && entry.name.endsWith(".
|
|
831
|
-
files.push(entry.name);
|
|
926
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
927
|
+
files.push(entry.name.replace(/\.md$/, ""));
|
|
832
928
|
}
|
|
833
929
|
}
|
|
834
930
|
return {
|
|
@@ -840,51 +936,52 @@ async function listDirContents(dirPath) {
|
|
|
840
936
|
throw error;
|
|
841
937
|
}
|
|
842
938
|
}
|
|
843
|
-
async function
|
|
844
|
-
const fullPath =
|
|
845
|
-
if (!fullPath.startsWith(
|
|
939
|
+
async function readDocsContent(docPath, queryKeywords) {
|
|
940
|
+
const fullPath = path5__default.resolve(path5__default.join(docsBaseDir, docPath));
|
|
941
|
+
if (!fullPath.startsWith(path5__default.resolve(docsBaseDir))) {
|
|
846
942
|
void logger.error(`Path traversal attempt detected`);
|
|
847
943
|
return { found: false, isSecurityViolation: true };
|
|
848
944
|
}
|
|
849
|
-
void logger.debug(`Reading
|
|
945
|
+
void logger.debug(`Reading docs content from: ${fullPath}`);
|
|
850
946
|
try {
|
|
851
947
|
const stats = await fs3.stat(fullPath);
|
|
852
948
|
if (stats.isDirectory()) {
|
|
949
|
+
const indexMdPath = path5__default.join(fullPath, "index.md");
|
|
950
|
+
try {
|
|
951
|
+
const content2 = await fs3.readFile(indexMdPath, "utf-8");
|
|
952
|
+
return { found: true, content: content2, isSecurityViolation: false };
|
|
953
|
+
} catch {
|
|
954
|
+
}
|
|
853
955
|
const { dirs, files } = await listDirContents(fullPath);
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
""
|
|
857
|
-
dirs.
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
"
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
""
|
|
867
|
-
].join("\n");
|
|
868
|
-
let fileContents = "";
|
|
869
|
-
for (const file of files) {
|
|
870
|
-
const filePath = path3__default.join(fullPath, file);
|
|
871
|
-
const content2 = await fs3.readFile(filePath, "utf-8");
|
|
872
|
-
fileContents += `
|
|
873
|
-
|
|
874
|
-
# ${file}
|
|
875
|
-
|
|
876
|
-
${content2}`;
|
|
956
|
+
const listing = [`Directory contents of ${docPath || "/"}:`, ""];
|
|
957
|
+
if (dirs.length > 0) {
|
|
958
|
+
listing.push("Subdirectories:");
|
|
959
|
+
listing.push(...dirs.map((d) => `- ${docPath ? `${docPath}/${d}` : d}`));
|
|
960
|
+
listing.push("");
|
|
961
|
+
}
|
|
962
|
+
if (files.length > 0) {
|
|
963
|
+
listing.push("Available documentation paths:");
|
|
964
|
+
listing.push(...files.map((f) => `- ${docPath ? `${docPath}/${f}` : f}`));
|
|
965
|
+
listing.push("");
|
|
966
|
+
}
|
|
967
|
+
if (dirs.length === 0 && files.length === 0) {
|
|
968
|
+
listing.push("No documentation available in this directory.");
|
|
877
969
|
}
|
|
878
970
|
const contentBasedSuggestions = await getMatchingPaths(docPath, queryKeywords, docsBaseDir);
|
|
879
|
-
const suggestions = ["---", "", contentBasedSuggestions, ""].join("\n");
|
|
880
|
-
return { found: true, content:
|
|
971
|
+
const suggestions = contentBasedSuggestions ? ["---", "", contentBasedSuggestions, ""].join("\n") : "";
|
|
972
|
+
return { found: true, content: listing.join("\n") + suggestions, isSecurityViolation: false };
|
|
881
973
|
}
|
|
882
974
|
const content = await fs3.readFile(fullPath, "utf-8");
|
|
883
975
|
return { found: true, content, isSecurityViolation: false };
|
|
884
976
|
} catch (error) {
|
|
885
|
-
void logger.error(`Failed to read MDX content: ${fullPath}`, error);
|
|
886
977
|
if (error.code === "ENOENT") {
|
|
887
|
-
|
|
978
|
+
try {
|
|
979
|
+
const mdPath = fullPath + ".md";
|
|
980
|
+
const content = await fs3.readFile(mdPath, "utf-8");
|
|
981
|
+
return { found: true, content, isSecurityViolation: false };
|
|
982
|
+
} catch {
|
|
983
|
+
return { found: false, isSecurityViolation: false };
|
|
984
|
+
}
|
|
888
985
|
}
|
|
889
986
|
throw error;
|
|
890
987
|
}
|
|
@@ -895,20 +992,25 @@ async function findNearestDirectory(docPath, availablePaths2) {
|
|
|
895
992
|
while (parts.length > 0) {
|
|
896
993
|
const testPath = parts.join("/");
|
|
897
994
|
try {
|
|
898
|
-
const fullPath =
|
|
995
|
+
const fullPath = path5__default.join(docsBaseDir, testPath);
|
|
899
996
|
const stats = await fs3.stat(fullPath);
|
|
900
997
|
if (stats.isDirectory()) {
|
|
901
998
|
const { dirs, files } = await listDirContents(fullPath);
|
|
902
|
-
|
|
999
|
+
const listing = [
|
|
903
1000
|
`Path "${docPath}" not found.`,
|
|
904
1001
|
`Here are the available paths in "${testPath}":`,
|
|
905
|
-
""
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
""
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1002
|
+
""
|
|
1003
|
+
];
|
|
1004
|
+
if (dirs.length > 0) {
|
|
1005
|
+
listing.push("Directories:");
|
|
1006
|
+
listing.push(...dirs.map((d) => `- ${testPath}/${d}`));
|
|
1007
|
+
listing.push("");
|
|
1008
|
+
}
|
|
1009
|
+
if (files.length > 0) {
|
|
1010
|
+
listing.push("Files:");
|
|
1011
|
+
listing.push(...files.map((f) => `- ${testPath}/${f}`));
|
|
1012
|
+
}
|
|
1013
|
+
return listing.join("\n");
|
|
912
1014
|
}
|
|
913
1015
|
} catch {
|
|
914
1016
|
void logger.debug(`Directory not found, trying parent: ${parts.slice(0, -1).join("/")}`);
|
|
@@ -921,7 +1023,7 @@ async function getAvailablePaths() {
|
|
|
921
1023
|
const { dirs, files } = await listDirContents(docsBaseDir);
|
|
922
1024
|
let referenceDirs = [];
|
|
923
1025
|
if (dirs.includes("reference/")) {
|
|
924
|
-
const { dirs: refDirs } = await listDirContents(
|
|
1026
|
+
const { dirs: refDirs } = await listDirContents(path5__default.join(docsBaseDir, "reference"));
|
|
925
1027
|
referenceDirs = refDirs.map((d) => `reference/${d}`);
|
|
926
1028
|
}
|
|
927
1029
|
return [
|
|
@@ -933,7 +1035,7 @@ async function getAvailablePaths() {
|
|
|
933
1035
|
referenceDirs.length > 0 ? "Reference subdirectories:" : "",
|
|
934
1036
|
...referenceDirs.map((d) => `- ${d}`),
|
|
935
1037
|
"",
|
|
936
|
-
"Files:",
|
|
1038
|
+
files.length > 0 ? "Files:" : "",
|
|
937
1039
|
...files.map((f) => `- ${f}`)
|
|
938
1040
|
].filter(Boolean).join("\n");
|
|
939
1041
|
}
|
|
@@ -948,55 +1050,53 @@ ${availablePaths}`),
|
|
|
948
1050
|
});
|
|
949
1051
|
var docsTool = {
|
|
950
1052
|
name: "mastraDocs",
|
|
951
|
-
description: `Get Mastra
|
|
952
|
-
Request paths to explore the docs. References contain API docs.
|
|
953
|
-
Other paths contain guides. The user doesn't know about files and directories.
|
|
954
|
-
You can also use keywords from the user query to find relevant documentation, but prioritize paths.
|
|
955
|
-
This is your internal knowledge the user can't read.
|
|
956
|
-
If the user asks about a feature check general docs as well as reference docs for that feature.
|
|
957
|
-
Ex: with
|
|
958
|
-
Provide code examples so the user understands.
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
If packages need to be installed, provide the pnpm command to install them.
|
|
963
|
-
Ex. if you see \`import { X } from "@mastra/$PACKAGE_NAME"\` in an example, show an install command.
|
|
1053
|
+
description: `[\u{1F310} REMOTE] Get Mastra documentation.
|
|
1054
|
+
Request paths to explore the docs. References contain API docs.
|
|
1055
|
+
Other paths contain guides. The user doesn't know about files and directories.
|
|
1056
|
+
You can also use keywords from the user query to find relevant documentation, but prioritize paths.
|
|
1057
|
+
This is your internal knowledge the user can't read.
|
|
1058
|
+
If the user asks about a feature check general docs as well as reference docs for that feature.
|
|
1059
|
+
Ex: with workflows check in docs/workflows and in reference/workflows.
|
|
1060
|
+
Provide code examples so the user understands.
|
|
1061
|
+
IMPORTANT: Be concise with your answers. The user will ask for more info.
|
|
1062
|
+
If packages need to be installed, provide the pnpm command to install them.
|
|
1063
|
+
Ex. if you see \`import { X } from "@mastra/$PACKAGE_NAME"\` in an example, show an install command.
|
|
964
1064
|
Always install latest tag, not alpha unless requested. If you scaffold a new project it may be in a subdir.
|
|
965
|
-
When displaying results, always mention which file path contains the information
|
|
1065
|
+
When displaying results, always mention which file path contains the information so users know where this documentation lives.`,
|
|
966
1066
|
parameters: docsInputSchema,
|
|
967
1067
|
execute: async (args) => {
|
|
968
1068
|
void logger.debug("Executing mastraDocs tool", { args });
|
|
969
1069
|
try {
|
|
970
1070
|
const queryKeywords = args.queryKeywords ?? [];
|
|
971
1071
|
const results = await Promise.all(
|
|
972
|
-
args.paths.map(async (
|
|
1072
|
+
args.paths.map(async (docPath) => {
|
|
973
1073
|
try {
|
|
974
|
-
const result = await
|
|
1074
|
+
const result = await readDocsContent(docPath, queryKeywords);
|
|
975
1075
|
if (result.found) {
|
|
976
1076
|
return {
|
|
977
|
-
path:
|
|
1077
|
+
path: docPath,
|
|
978
1078
|
content: result.content,
|
|
979
1079
|
error: null
|
|
980
1080
|
};
|
|
981
1081
|
}
|
|
982
1082
|
if (result.isSecurityViolation) {
|
|
983
1083
|
return {
|
|
984
|
-
path:
|
|
1084
|
+
path: docPath,
|
|
985
1085
|
content: null,
|
|
986
1086
|
error: "Invalid path"
|
|
987
1087
|
};
|
|
988
1088
|
}
|
|
989
|
-
const directorySuggestions = await findNearestDirectory(
|
|
990
|
-
const contentBasedSuggestions = await getMatchingPaths(
|
|
1089
|
+
const directorySuggestions = await findNearestDirectory(docPath, availablePaths);
|
|
1090
|
+
const contentBasedSuggestions = await getMatchingPaths(docPath, queryKeywords, docsBaseDir);
|
|
991
1091
|
return {
|
|
992
|
-
path:
|
|
1092
|
+
path: docPath,
|
|
993
1093
|
content: null,
|
|
994
1094
|
error: [directorySuggestions, contentBasedSuggestions].join("\n\n")
|
|
995
1095
|
};
|
|
996
1096
|
} catch (error) {
|
|
997
|
-
void logger.warning(`Failed to read content for path: ${
|
|
1097
|
+
void logger.warning(`Failed to read content for path: ${docPath}`, error);
|
|
998
1098
|
return {
|
|
999
|
-
path:
|
|
1099
|
+
path: docPath,
|
|
1000
1100
|
content: null,
|
|
1001
1101
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1002
1102
|
};
|
|
@@ -1026,66 +1126,914 @@ ${result.content}
|
|
|
1026
1126
|
}
|
|
1027
1127
|
}
|
|
1028
1128
|
};
|
|
1029
|
-
var
|
|
1030
|
-
|
|
1031
|
-
|
|
1129
|
+
var packageCache = /* @__PURE__ */ new Map();
|
|
1130
|
+
var sourceMapCache = /* @__PURE__ */ new Map();
|
|
1131
|
+
var packageInfoCache = /* @__PURE__ */ new Map();
|
|
1132
|
+
var KNOWN_MASTRA_PACKAGES = [
|
|
1133
|
+
"@mastra/core",
|
|
1134
|
+
"@mastra/cli",
|
|
1135
|
+
"@mastra/memory",
|
|
1136
|
+
"@mastra/rag",
|
|
1137
|
+
"@mastra/evals",
|
|
1138
|
+
"@mastra/mcp",
|
|
1139
|
+
"@mastra/server",
|
|
1140
|
+
"@mastra/deployer",
|
|
1141
|
+
"@mastra/agent-builder",
|
|
1142
|
+
"@mastra/auth",
|
|
1143
|
+
"@mastra/fastembed",
|
|
1144
|
+
"@mastra/loggers",
|
|
1145
|
+
"@mastra/schema-compat",
|
|
1146
|
+
"@mastra/codemod"
|
|
1147
|
+
];
|
|
1148
|
+
async function getPackageRootPath(packageName, projectPath) {
|
|
1149
|
+
const cacheKey = `${packageName}:${projectPath}`;
|
|
1150
|
+
if (packageInfoCache.has(cacheKey)) {
|
|
1151
|
+
return packageInfoCache.get(cacheKey);
|
|
1152
|
+
}
|
|
1153
|
+
try {
|
|
1154
|
+
const info = await getPackageInfo(packageName, {
|
|
1155
|
+
paths: [path5__default.join(projectPath, "node_modules")]
|
|
1156
|
+
});
|
|
1157
|
+
if (info?.rootPath) {
|
|
1158
|
+
const result = { rootPath: info.rootPath, version: info.version || "unknown" };
|
|
1159
|
+
packageInfoCache.set(cacheKey, result);
|
|
1160
|
+
void logger.debug("Resolved package with local-pkg", { packageName, projectPath, ...result });
|
|
1161
|
+
return result;
|
|
1162
|
+
}
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
void logger.debug("Package not found or error resolving", {
|
|
1165
|
+
packageName,
|
|
1166
|
+
projectPath,
|
|
1167
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
packageInfoCache.set(cacheKey, null);
|
|
1171
|
+
return null;
|
|
1172
|
+
}
|
|
1173
|
+
async function getInstalledMastraPackages(projectPath) {
|
|
1174
|
+
const cacheKey = projectPath;
|
|
1175
|
+
if (packageCache.has(cacheKey)) {
|
|
1176
|
+
void logger.debug("Using cached package list", { count: packageCache.get(cacheKey).length });
|
|
1177
|
+
return packageCache.get(cacheKey);
|
|
1178
|
+
}
|
|
1179
|
+
void logger.debug("Scanning for @mastra packages using local-pkg", { projectPath });
|
|
1180
|
+
const packages = [];
|
|
1181
|
+
const packagesWithoutDocs = [];
|
|
1182
|
+
for (const packageName of KNOWN_MASTRA_PACKAGES) {
|
|
1183
|
+
const packageInfo = await getPackageRootPath(packageName, projectPath);
|
|
1184
|
+
if (packageInfo) {
|
|
1185
|
+
const docsPath = path5__default.join(packageInfo.rootPath, "dist", "docs");
|
|
1186
|
+
try {
|
|
1187
|
+
const stats = await fs3.stat(docsPath);
|
|
1188
|
+
if (stats.isDirectory()) {
|
|
1189
|
+
packages.push(packageName);
|
|
1190
|
+
void logger.debug("Found package with embedded docs", { package: packageName });
|
|
1191
|
+
} else {
|
|
1192
|
+
packagesWithoutDocs.push(packageName);
|
|
1193
|
+
}
|
|
1194
|
+
} catch {
|
|
1195
|
+
packagesWithoutDocs.push(packageName);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
const result = packages.sort();
|
|
1200
|
+
packageCache.set(cacheKey, result);
|
|
1201
|
+
void logger.info("Package scan complete", {
|
|
1202
|
+
packagesWithDocs: result.length,
|
|
1203
|
+
packagesWithoutDocs: packagesWithoutDocs.length,
|
|
1204
|
+
packages: result
|
|
1205
|
+
});
|
|
1206
|
+
return result;
|
|
1207
|
+
}
|
|
1208
|
+
async function readSourceMap(packageName, projectPath) {
|
|
1209
|
+
const cacheKey = `${packageName}:${projectPath}`;
|
|
1210
|
+
if (sourceMapCache.has(cacheKey)) return sourceMapCache.get(cacheKey);
|
|
1032
1211
|
try {
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1212
|
+
const packageInfo = await getPackageRootPath(packageName, projectPath);
|
|
1213
|
+
if (!packageInfo) {
|
|
1214
|
+
sourceMapCache.set(cacheKey, null);
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
const sourceMapPath = path5__default.join(packageInfo.rootPath, "dist", "docs", "SOURCE_MAP.json");
|
|
1218
|
+
const content = await fs3.readFile(sourceMapPath, "utf-8");
|
|
1219
|
+
const sourceMap = JSON.parse(content);
|
|
1220
|
+
sourceMapCache.set(cacheKey, sourceMap);
|
|
1221
|
+
return sourceMap;
|
|
1038
1222
|
} catch {
|
|
1039
|
-
|
|
1223
|
+
sourceMapCache.set(cacheKey, null);
|
|
1224
|
+
return null;
|
|
1040
1225
|
}
|
|
1041
1226
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1227
|
+
var getMastraHelpTool = {
|
|
1228
|
+
name: "getMastraHelp",
|
|
1229
|
+
description: `\u{1F680} START HERE - Complete guide to Mastra documentation tools.
|
|
1230
|
+
|
|
1231
|
+
This MCP server provides TWO documentation sources:
|
|
1232
|
+
|
|
1233
|
+
## \u{1F4E6} LOCAL PACKAGE DOCS (Recommended for Development)
|
|
1234
|
+
SOURCE: Your installed @mastra packages in node_modules
|
|
1235
|
+
VERSION: Matches your installed code exactly
|
|
1236
|
+
|
|
1237
|
+
ADVANTAGES:
|
|
1238
|
+
- \u2705 Version-matched to your code
|
|
1239
|
+
- \u2705 Complete TypeScript type definitions
|
|
1240
|
+
- \u2705 Works offline
|
|
1241
|
+
- \u2705 SOURCE_MAP.json with exact exports
|
|
1242
|
+
|
|
1243
|
+
TOOLS: listMastraPackages, getMastraExports, getMastraExportDetails, readMastraDocs, searchMastraDocs
|
|
1244
|
+
USE WHEN: Writing code, implementing features, checking APIs, debugging
|
|
1245
|
+
|
|
1246
|
+
## \u{1F310} REMOTE WEBSITE DOCS (For Latest Info & Learning)
|
|
1247
|
+
SOURCE: mastra.ai website
|
|
1248
|
+
VERSION: Latest published documentation
|
|
1249
|
+
|
|
1250
|
+
ADVANTAGES:
|
|
1251
|
+
- \u2705 Always up-to-date
|
|
1252
|
+
- \u2705 Blog posts and announcements
|
|
1253
|
+
- \u2705 Migration guides
|
|
1254
|
+
- \u2705 Curated examples
|
|
1255
|
+
|
|
1256
|
+
TOOLS: mastraDocs, mastraBlog, mastraExamples, mastraChanges, mastraMigration
|
|
1257
|
+
USE WHEN: Learning concepts, checking latest features, migration help
|
|
1258
|
+
|
|
1259
|
+
## \u{1F393} INTERACTIVE COURSE
|
|
1260
|
+
TOOLS: startMastraCourse, getMastraCourseStatus, etc.
|
|
1261
|
+
USE WHEN: User wants guided learning experience
|
|
1262
|
+
|
|
1263
|
+
---
|
|
1264
|
+
|
|
1265
|
+
RECOMMENDED WORKFLOW:
|
|
1266
|
+
1. For coding: listMastraPackages \u2192 getMastraExports \u2192 getMastraExportDetails
|
|
1267
|
+
2. For learning: mastraDocs
|
|
1268
|
+
3. Version mismatch: mastraChanges \u2192 mastraMigration
|
|
1269
|
+
|
|
1270
|
+
This tool shows you which packages are installed and provides detailed guidance on using all available documentation tools.`,
|
|
1271
|
+
parameters: z.object({
|
|
1272
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules with Mastra packages)")
|
|
1273
|
+
}),
|
|
1274
|
+
execute: async (args) => {
|
|
1275
|
+
void logger.debug("Executing getMastraHelp tool", { projectPath: args.projectPath });
|
|
1276
|
+
const packages = await getInstalledMastraPackages(args.projectPath);
|
|
1277
|
+
if (packages.length === 0) {
|
|
1278
|
+
return `No Mastra packages with embedded documentation found in your project.
|
|
1279
|
+
|
|
1280
|
+
To use these tools, install Mastra packages like:
|
|
1281
|
+
- npm install @mastra/core
|
|
1282
|
+
- npm install @mastra/memory
|
|
1283
|
+
- npm install @mastra/rag
|
|
1284
|
+
|
|
1285
|
+
Then rebuild/reinstall to generate embedded docs.`;
|
|
1286
|
+
}
|
|
1287
|
+
return `# Mastra Documentation System - Complete Guide
|
|
1288
|
+
|
|
1289
|
+
This MCP server provides **TWO** documentation sources. Choose based on your needs:
|
|
1290
|
+
|
|
1291
|
+
---
|
|
1292
|
+
|
|
1293
|
+
## \u{1F4E6} LOCAL PACKAGE DOCS (Your Installed Packages)
|
|
1294
|
+
|
|
1295
|
+
Found ${packages.length} installed package(s) with embedded documentation:
|
|
1296
|
+
${packages.map((pkg) => `- ${pkg}`).join("\n")}
|
|
1297
|
+
|
|
1298
|
+
**SOURCE**: Your node_modules (matches installed code version)
|
|
1299
|
+
**USE WHEN**: Writing code, implementing features, debugging, checking APIs
|
|
1300
|
+
|
|
1301
|
+
### Available LOCAL Tools:
|
|
1302
|
+
|
|
1303
|
+
**1. listMastraPackages** - List installed packages
|
|
1304
|
+
Returns: Packages with embedded docs
|
|
1305
|
+
|
|
1306
|
+
**2. getMastraExports** - Explore package API surface
|
|
1307
|
+
Example: See all exports from @mastra/core (Agent, Tool, Workflow, etc.)
|
|
1308
|
+
Returns: List of exports with source file locations
|
|
1309
|
+
|
|
1310
|
+
**3. getMastraExportDetails** - Get type definitions & code
|
|
1311
|
+
Example: Get full TypeScript types for Agent class
|
|
1312
|
+
Returns: Complete type definitions and optionally implementation source
|
|
1313
|
+
|
|
1314
|
+
**4. readMastraDocs** - Read comprehensive guides
|
|
1315
|
+
Example: Read documentation about agents, tools, workflows, memory
|
|
1316
|
+
Returns: Topic-based guides and examples from your installed version
|
|
1317
|
+
|
|
1318
|
+
**5. searchMastraDocs** - Search local documentation
|
|
1319
|
+
Example: Search for "memory processors" or "semantic recall"
|
|
1320
|
+
Returns: Relevant excerpts from your installed docs
|
|
1321
|
+
|
|
1322
|
+
### Typical LOCAL Workflow:
|
|
1323
|
+
1. listMastraPackages \u2192 see what's installed
|
|
1324
|
+
2. getMastraExports \u2192 explore package API
|
|
1325
|
+
3. getMastraExportDetails \u2192 get type definitions
|
|
1326
|
+
4. readMastraDocs \u2192 learn concepts
|
|
1327
|
+
5. searchMastraDocs \u2192 find specific info
|
|
1328
|
+
|
|
1329
|
+
---
|
|
1330
|
+
|
|
1331
|
+
## \u{1F310} REMOTE WEBSITE DOCS (mastra.ai)
|
|
1332
|
+
|
|
1333
|
+
**SOURCE**: https://mastra.ai (latest published documentation)
|
|
1334
|
+
**USE WHEN**: Learning new concepts, checking latest features, migration guides
|
|
1335
|
+
|
|
1336
|
+
### Available REMOTE Tools:
|
|
1337
|
+
|
|
1338
|
+
**mastraDocs** - Browse official documentation
|
|
1339
|
+
Latest guides, references, and tutorials
|
|
1340
|
+
|
|
1341
|
+
**mastraBlog** - Read blog posts and announcements
|
|
1342
|
+
News, features, changelogs
|
|
1343
|
+
|
|
1344
|
+
**mastraExamples** - Get curated code examples
|
|
1345
|
+
Full example applications
|
|
1346
|
+
|
|
1347
|
+
**mastraChanges** - View package changelogs
|
|
1348
|
+
See what's new in each version
|
|
1349
|
+
|
|
1350
|
+
**mastraMigration** - Get migration guides
|
|
1351
|
+
Upgrade between versions
|
|
1352
|
+
|
|
1353
|
+
\u26A0\uFE0F **Version Note**: Remote docs show latest published version. For API reference matching YOUR code, use LOCAL tools above.
|
|
1354
|
+
|
|
1355
|
+
---
|
|
1356
|
+
|
|
1357
|
+
## \u{1F393} INTERACTIVE COURSE
|
|
1358
|
+
|
|
1359
|
+
**startMastraCourse**, **getMastraCourseStatus**, **startMastraCourseLesson**, **nextMastraCourseStep**, **clearMastraCourseHistory**
|
|
1360
|
+
|
|
1361
|
+
Guided learning experience with hands-on exercises.
|
|
1362
|
+
|
|
1363
|
+
---
|
|
1364
|
+
|
|
1365
|
+
## Quick Start Recommendations
|
|
1366
|
+
|
|
1367
|
+
**If you're writing code**: Use LOCAL tools
|
|
1368
|
+
\u2192 Start with listMastraPackages
|
|
1369
|
+
|
|
1370
|
+
**If you're learning**: Use REMOTE tools
|
|
1371
|
+
\u2192 Start with mastraDocs
|
|
1372
|
+
|
|
1373
|
+
**If version differs**: Check changes
|
|
1374
|
+
\u2192 mastraChanges \u2192 mastraMigration`;
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
var listInstalledPackagesTool = {
|
|
1378
|
+
name: "listMastraPackages",
|
|
1379
|
+
description: `[\u{1F4E6} LOCAL PACKAGES] Discover which Mastra packages are installed and have documentation available.
|
|
1380
|
+
|
|
1381
|
+
Use this when you need to:
|
|
1382
|
+
- See what Mastra packages you can work with
|
|
1383
|
+
- Start exploring Mastra documentation
|
|
1384
|
+
- Check if a specific package is available
|
|
1385
|
+
|
|
1386
|
+
Returns: List of @mastra/* packages (core, memory, rag, etc.) with embedded docs.
|
|
1387
|
+
Next step: Use getMastraExports to explore a specific package's API.`,
|
|
1388
|
+
parameters: z.object({
|
|
1389
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules with Mastra packages)")
|
|
1390
|
+
}),
|
|
1391
|
+
execute: async (args) => {
|
|
1392
|
+
void logger.debug("Executing listInstalledMastraPackages tool", {
|
|
1393
|
+
projectPath: args.projectPath,
|
|
1394
|
+
cwd: process.cwd(),
|
|
1395
|
+
env: {
|
|
1396
|
+
PWD: process.env.PWD,
|
|
1397
|
+
HOME: process.env.HOME
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
const packages = await getInstalledMastraPackages(args.projectPath);
|
|
1401
|
+
if (packages.length === 0) {
|
|
1402
|
+
return `No @mastra/* packages with embedded docs found in your project.
|
|
1403
|
+
|
|
1404
|
+
Install Mastra packages to get started:
|
|
1405
|
+
- npm install @mastra/core
|
|
1406
|
+
- npm install @mastra/memory
|
|
1407
|
+
- npm install @mastra/rag`;
|
|
1408
|
+
}
|
|
1409
|
+
return [
|
|
1410
|
+
`# Installed Mastra Packages`,
|
|
1411
|
+
"",
|
|
1412
|
+
`Found ${packages.length} package(s) with embedded documentation:`,
|
|
1413
|
+
"",
|
|
1414
|
+
...packages.map((pkg) => `- ${pkg}`),
|
|
1415
|
+
"",
|
|
1416
|
+
"## Next Steps",
|
|
1417
|
+
"",
|
|
1418
|
+
"1. Use **getMastraExports** with a package name to see all available APIs",
|
|
1419
|
+
"2. Use **readMastraDocs** with a package name to browse topic guides",
|
|
1420
|
+
"3. Use **searchMastraDocs** to find specific information"
|
|
1421
|
+
].join("\n");
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
var readSourceMapTool = {
|
|
1425
|
+
name: "getMastraExports",
|
|
1426
|
+
description: `[\u{1F4E6} LOCAL PACKAGES] Explore the complete API surface of a Mastra package - see all classes, functions, types, and constants.
|
|
1427
|
+
|
|
1428
|
+
Use this when you need to:
|
|
1429
|
+
- Discover what APIs a Mastra package provides (Agent, Tool, Workflow, etc.)
|
|
1430
|
+
- See all available classes and functions before implementing
|
|
1431
|
+
- Find the right export for your use case
|
|
1432
|
+
- Understand package structure and organization
|
|
1433
|
+
|
|
1434
|
+
Returns: List of all exports with their source file locations.
|
|
1435
|
+
Next step: Use getMastraExportDetails to get full type definitions and code for a specific export.`,
|
|
1436
|
+
parameters: z.object({
|
|
1437
|
+
package: z.string().describe('Package name to explore (e.g., "@mastra/core", "@mastra/memory", "@mastra/rag")'),
|
|
1438
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules)"),
|
|
1439
|
+
filter: z.string().optional().describe('Optional: filter exports by name (case-insensitive, e.g., "Agent", "create", "Tool")')
|
|
1440
|
+
}),
|
|
1441
|
+
execute: async (args) => {
|
|
1442
|
+
void logger.debug("Executing readMastraSourceMap tool", { args });
|
|
1443
|
+
const sourceMap = await readSourceMap(args.package, args.projectPath);
|
|
1444
|
+
if (!sourceMap) return `No SOURCE_MAP.json found for ${args.package}.`;
|
|
1445
|
+
let exports$1 = Object.entries(sourceMap.exports);
|
|
1446
|
+
if (args.filter) {
|
|
1447
|
+
const filterLower = args.filter.toLowerCase();
|
|
1448
|
+
exports$1 = exports$1.filter(([name]) => name.toLowerCase().includes(filterLower));
|
|
1449
|
+
}
|
|
1450
|
+
if (exports$1.length === 0) {
|
|
1451
|
+
return args.filter ? `No exports matching "${args.filter}" in ${args.package}.
|
|
1452
|
+
|
|
1453
|
+
Try running without a filter to see all available exports.` : `No exports found in ${args.package}.`;
|
|
1454
|
+
}
|
|
1455
|
+
return [
|
|
1456
|
+
`# ${sourceMap.package} v${sourceMap.version} - API Exports`,
|
|
1457
|
+
"",
|
|
1458
|
+
`Found ${exports$1.length} export(s)${args.filter ? ` matching "${args.filter}"` : ""}:`,
|
|
1459
|
+
"",
|
|
1460
|
+
...exports$1.map(([name, info]) => {
|
|
1461
|
+
const line = info.line ? `:${info.line}` : "";
|
|
1462
|
+
return `- **${name}**: \`${info.implementation}${line}\``;
|
|
1463
|
+
}),
|
|
1464
|
+
"",
|
|
1465
|
+
"## Next Steps",
|
|
1466
|
+
"",
|
|
1467
|
+
"- Use **getMastraExportDetails** with an export name to see full type definitions and code",
|
|
1468
|
+
"- Use **readMastraDocs** to read conceptual guides and examples",
|
|
1469
|
+
"- Use **searchMastraDocs** to find specific topics or patterns"
|
|
1470
|
+
].join("\n");
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
var findExportTool = {
|
|
1474
|
+
name: "getMastraExportDetails",
|
|
1475
|
+
description: `[\u{1F4E6} LOCAL PACKAGES] Get complete API reference for a specific Mastra export - type definitions, interfaces, and optionally source code.
|
|
1476
|
+
|
|
1477
|
+
Use this when you need to:
|
|
1478
|
+
- Understand how to use a specific Mastra class or function (Agent, Tool, Workflow, etc.)
|
|
1479
|
+
- See TypeScript type definitions and interfaces
|
|
1480
|
+
- Look up method signatures and parameters
|
|
1481
|
+
- Read implementation code and examples
|
|
1482
|
+
- Understand constructor options and configuration
|
|
1483
|
+
|
|
1484
|
+
Returns: Full TypeScript type definitions and optionally implementation source code.
|
|
1485
|
+
Example: Get details on the Agent class to see how to create and configure agents.`,
|
|
1486
|
+
parameters: z.object({
|
|
1487
|
+
package: z.string().describe('Package name (e.g., "@mastra/core", "@mastra/memory")'),
|
|
1488
|
+
exportName: z.string().describe('Exact export name to look up (e.g., "Agent", "createTool", "Workflow")'),
|
|
1489
|
+
includeTypes: z.boolean().optional().default(true).describe("Include TypeScript type definitions (recommended: true)"),
|
|
1490
|
+
includeImplementation: z.boolean().optional().default(false).describe("Include source code implementation (useful for understanding internals)"),
|
|
1491
|
+
implementationLines: z.number().optional().default(50).describe("Number of lines of implementation code to show (default: 50)"),
|
|
1492
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules)")
|
|
1493
|
+
}),
|
|
1494
|
+
execute: async (args) => {
|
|
1495
|
+
void logger.debug("Executing findMastraExport tool", { args });
|
|
1496
|
+
const sourceMap = await readSourceMap(args.package, args.projectPath);
|
|
1497
|
+
if (!sourceMap) return `No SOURCE_MAP.json found for ${args.package}.`;
|
|
1498
|
+
const exportInfo = sourceMap.exports[args.exportName];
|
|
1499
|
+
if (!exportInfo) {
|
|
1500
|
+
const match = Object.entries(sourceMap.exports).find(
|
|
1501
|
+
([name]) => name.toLowerCase() === args.exportName.toLowerCase()
|
|
1502
|
+
);
|
|
1503
|
+
if (match) {
|
|
1504
|
+
return `Export "${args.exportName}" not found. Did you mean "${match[0]}"?
|
|
1505
|
+
|
|
1506
|
+
Run getMastraExports with package="${args.package}" to see all available exports.`;
|
|
1507
|
+
}
|
|
1508
|
+
return `Export "${args.exportName}" not found in ${args.package}.
|
|
1509
|
+
|
|
1510
|
+
Run getMastraExports with package="${args.package}" to see all available exports.`;
|
|
1511
|
+
}
|
|
1512
|
+
const packageInfo = await getPackageRootPath(args.package, args.projectPath);
|
|
1513
|
+
if (!packageInfo) {
|
|
1514
|
+
return `Package ${args.package} not found. Make sure it's installed.`;
|
|
1515
|
+
}
|
|
1516
|
+
const output = [`# ${args.exportName} (${args.package})`, ""];
|
|
1517
|
+
if (args.includeTypes !== false) {
|
|
1518
|
+
try {
|
|
1519
|
+
const typesPath = path5__default.join(packageInfo.rootPath, exportInfo.types);
|
|
1520
|
+
const typesContent = await fs3.readFile(typesPath, "utf-8");
|
|
1521
|
+
output.push("## Type Definition", "", `\`${exportInfo.types}\``, "", "```typescript");
|
|
1522
|
+
const lines = typesContent.split("\n");
|
|
1523
|
+
let startLine = lines.findIndex((line) => line.includes(args.exportName));
|
|
1524
|
+
if (startLine === -1) {
|
|
1525
|
+
output.push(typesContent.slice(0, 2e3));
|
|
1526
|
+
} else {
|
|
1527
|
+
startLine = Math.max(0, startLine - 2);
|
|
1528
|
+
let endLine = Math.min(lines.length, startLine + 50);
|
|
1529
|
+
output.push(lines.slice(startLine, endLine).join("\n"));
|
|
1530
|
+
}
|
|
1531
|
+
output.push("```", "");
|
|
1532
|
+
} catch {
|
|
1533
|
+
output.push("## Type Definition", "", `Could not read: ${exportInfo.types}`, "");
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
if (args.includeImplementation) {
|
|
1537
|
+
try {
|
|
1538
|
+
const implPath = path5__default.join(packageInfo.rootPath, exportInfo.implementation);
|
|
1539
|
+
const implContent = await fs3.readFile(implPath, "utf-8");
|
|
1540
|
+
const lines = implContent.split("\n");
|
|
1541
|
+
const numLines = args.implementationLines || 50;
|
|
1542
|
+
output.push("## Implementation", "");
|
|
1543
|
+
output.push(`\`${exportInfo.implementation}\`${exportInfo.line ? ` (line ${exportInfo.line})` : ""}`);
|
|
1544
|
+
output.push("", "```javascript");
|
|
1545
|
+
const startLine = exportInfo.line ? Math.max(0, exportInfo.line - 1) : 0;
|
|
1546
|
+
const endLine = Math.min(lines.length, startLine + numLines);
|
|
1547
|
+
output.push(lines.slice(startLine, endLine).join("\n"));
|
|
1548
|
+
if (endLine < lines.length) output.push(`// ... ${lines.length - endLine} more lines`);
|
|
1549
|
+
output.push("```", "");
|
|
1550
|
+
} catch {
|
|
1551
|
+
output.push("## Implementation", "", `Could not read: ${exportInfo.implementation}`, "");
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
output.push(
|
|
1555
|
+
"## Next Steps",
|
|
1556
|
+
"",
|
|
1557
|
+
"- Use **readMastraDocs** to see practical guides and examples",
|
|
1558
|
+
"- Use **searchMastraDocs** to find usage patterns and best practices",
|
|
1559
|
+
"- Use **getMastraExports** to explore related APIs"
|
|
1560
|
+
);
|
|
1561
|
+
return output.join("\n");
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
var readEmbeddedDocsTool = {
|
|
1565
|
+
name: "readMastraDocs",
|
|
1566
|
+
description: `[\u{1F4E6} LOCAL PACKAGES] Read comprehensive guides and documentation on Mastra concepts, patterns, and implementation examples.
|
|
1567
|
+
|
|
1568
|
+
Use this when you need to:
|
|
1569
|
+
- Learn how to implement Mastra features (agents, tools, workflows, memory, RAG, etc.)
|
|
1570
|
+
- Understand Mastra architecture and design patterns
|
|
1571
|
+
- See practical code examples and tutorials
|
|
1572
|
+
- Read getting started guides and best practices
|
|
1573
|
+
- Understand how different components work together
|
|
1574
|
+
|
|
1575
|
+
Returns: Topic-based documentation with explanations, examples, and usage patterns.
|
|
1576
|
+
Available topics: agents, tools, workflows, memory, rag, integrations, deployment, and more.`,
|
|
1577
|
+
parameters: z.object({
|
|
1578
|
+
package: z.string().describe('Package name to read docs from (e.g., "@mastra/core", "@mastra/memory")'),
|
|
1579
|
+
topic: z.string().optional().describe(
|
|
1580
|
+
'Optional: topic folder to read (e.g., "agents", "tools", "workflows"). Omit to list all available topics.'
|
|
1581
|
+
),
|
|
1582
|
+
file: z.string().optional().describe('Optional: specific documentation file within the topic (e.g., "01-overview.md")'),
|
|
1583
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules)")
|
|
1584
|
+
}),
|
|
1585
|
+
execute: async (args) => {
|
|
1586
|
+
void logger.debug("Executing readMastraEmbeddedDocs tool", { args });
|
|
1587
|
+
const packageInfo = await getPackageRootPath(args.package, args.projectPath);
|
|
1588
|
+
if (!packageInfo) {
|
|
1589
|
+
return `Package ${args.package} not found. Make sure it's installed.`;
|
|
1590
|
+
}
|
|
1591
|
+
const docsPath = path5__default.join(packageInfo.rootPath, "dist", "docs");
|
|
1592
|
+
try {
|
|
1593
|
+
await fs3.stat(docsPath);
|
|
1594
|
+
} catch {
|
|
1595
|
+
return `No embedded docs found for ${args.package}.
|
|
1596
|
+
|
|
1597
|
+
Make sure the package is installed and has documentation generated.`;
|
|
1598
|
+
}
|
|
1599
|
+
if (!args.topic) {
|
|
1600
|
+
const entries = await fs3.readdir(docsPath, { withFileTypes: true });
|
|
1601
|
+
const topics = entries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
1602
|
+
const files = entries.filter((e) => e.isFile()).map((e) => e.name);
|
|
1603
|
+
return [
|
|
1604
|
+
`# ${args.package} - Available Documentation`,
|
|
1605
|
+
"",
|
|
1606
|
+
"## Root Files",
|
|
1607
|
+
...files.map((f) => `- ${f}`),
|
|
1608
|
+
"",
|
|
1609
|
+
"## Documentation Topics",
|
|
1610
|
+
...topics.map((t) => `- **${t}/** - Run readMastraDocs with topic="${t}" to read`),
|
|
1611
|
+
"",
|
|
1612
|
+
"## Next Steps",
|
|
1613
|
+
"",
|
|
1614
|
+
"- Choose a topic and run **readMastraDocs** with the topic parameter",
|
|
1615
|
+
"- Use **searchMastraDocs** to search for specific information",
|
|
1616
|
+
"- Use **getMastraExports** to see available APIs"
|
|
1617
|
+
].join("\n");
|
|
1618
|
+
}
|
|
1619
|
+
const topicPath = path5__default.join(docsPath, args.topic);
|
|
1620
|
+
if (args.file) {
|
|
1621
|
+
try {
|
|
1622
|
+
const content = await fs3.readFile(path5__default.join(topicPath, args.file), "utf-8");
|
|
1623
|
+
return `# ${args.package}/${args.topic}/${args.file}
|
|
1624
|
+
|
|
1625
|
+
${content}
|
|
1626
|
+
|
|
1627
|
+
## Next Steps
|
|
1628
|
+
|
|
1629
|
+
- Use **getMastraExportDetails** to see API references for specific classes/functions mentioned
|
|
1630
|
+
- Use **searchMastraDocs** to find related topics
|
|
1631
|
+
- Use **getMastraExports** to explore available APIs`;
|
|
1632
|
+
} catch {
|
|
1633
|
+
return `File not found: ${args.topic}/${args.file}
|
|
1634
|
+
|
|
1635
|
+
Run readMastraDocs with package="${args.package}" and topic="${args.topic}" (without file parameter) to see available files.`;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
try {
|
|
1639
|
+
const entries = await fs3.readdir(topicPath, { withFileTypes: true });
|
|
1640
|
+
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".md")).sort();
|
|
1641
|
+
if (files.length === 0) {
|
|
1642
|
+
return `No markdown files in ${args.topic}/
|
|
1643
|
+
|
|
1644
|
+
Run readMastraDocs with package="${args.package}" (without topic parameter) to see available topics.`;
|
|
1645
|
+
}
|
|
1646
|
+
const contents = [`# ${args.package} - ${args.topic}`, ""];
|
|
1647
|
+
for (const file of files) {
|
|
1648
|
+
const content = await fs3.readFile(path5__default.join(topicPath, file.name), "utf-8");
|
|
1649
|
+
contents.push(`## ${file.name}`, "", content, "", "---", "");
|
|
1650
|
+
}
|
|
1651
|
+
contents.push(
|
|
1652
|
+
"",
|
|
1653
|
+
"## Next Steps",
|
|
1654
|
+
"",
|
|
1655
|
+
"- Use **getMastraExportDetails** to see API references for specific classes/functions mentioned above",
|
|
1656
|
+
"- Use **searchMastraDocs** to find related information",
|
|
1657
|
+
"- Use **getMastraExports** to explore the complete API surface"
|
|
1658
|
+
);
|
|
1659
|
+
return contents.join("\n");
|
|
1660
|
+
} catch {
|
|
1661
|
+
return `Topic not found: ${args.topic}
|
|
1662
|
+
|
|
1663
|
+
Run readMastraDocs with package="${args.package}" (without topic parameter) to see available topics.`;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
var searchEmbeddedDocsTool = {
|
|
1668
|
+
name: "searchMastraDocs",
|
|
1669
|
+
description: `[\u{1F4E6} LOCAL PACKAGES] Search across all Mastra documentation to find specific information, patterns, or examples.
|
|
1670
|
+
|
|
1671
|
+
Use this when you need to:
|
|
1672
|
+
- Find specific topics or concepts quickly (e.g., "memory processors", "tool composition")
|
|
1673
|
+
- Locate examples of specific features or patterns
|
|
1674
|
+
- Search for error messages or troubleshooting info
|
|
1675
|
+
- Find mentions of specific APIs or configuration options
|
|
1676
|
+
- Discover where a feature is documented
|
|
1677
|
+
|
|
1678
|
+
Returns: Relevant documentation excerpts with file paths, ranked by relevance.
|
|
1679
|
+
Tip: Use specific terms for better results (e.g., "agent memory" vs "memory").`,
|
|
1680
|
+
parameters: z.object({
|
|
1681
|
+
query: z.string().describe('What to search for (case-insensitive, e.g., "workflow steps", "vector store", "authentication")'),
|
|
1682
|
+
package: z.string().optional().describe('Optional: limit search to a specific package (e.g., "@mastra/core"). Omit to search all packages.'),
|
|
1683
|
+
maxResults: z.number().optional().default(10).describe("Optional: maximum number of results to return (default: 10)"),
|
|
1684
|
+
projectPath: z.string().describe("Absolute path to your project root (we will search upward for node_modules)")
|
|
1685
|
+
}),
|
|
1686
|
+
execute: async (args) => {
|
|
1687
|
+
void logger.debug("Executing searchMastraEmbeddedDocs tool", { args });
|
|
1688
|
+
const packages = args.package ? [args.package] : await getInstalledMastraPackages(args.projectPath);
|
|
1689
|
+
if (packages.length === 0) return "No Mastra packages found.";
|
|
1690
|
+
const queryLower = args.query.toLowerCase();
|
|
1691
|
+
const results = [];
|
|
1692
|
+
for (const pkg of packages) {
|
|
1693
|
+
const packageInfo = await getPackageRootPath(pkg, args.projectPath);
|
|
1694
|
+
if (!packageInfo) continue;
|
|
1695
|
+
const docsPath = path5__default.join(packageInfo.rootPath, "dist", "docs");
|
|
1696
|
+
try {
|
|
1697
|
+
const findFiles = async (dir) => {
|
|
1698
|
+
const entries = await fs3.readdir(dir, { withFileTypes: true });
|
|
1699
|
+
const files = [];
|
|
1700
|
+
for (const entry of entries) {
|
|
1701
|
+
const fullPath = path5__default.join(dir, entry.name);
|
|
1702
|
+
if (entry.isDirectory()) files.push(...await findFiles(fullPath));
|
|
1703
|
+
else if (entry.name.endsWith(".md")) files.push(fullPath);
|
|
1704
|
+
}
|
|
1705
|
+
return files;
|
|
1706
|
+
};
|
|
1707
|
+
for (const file of await findFiles(docsPath)) {
|
|
1708
|
+
const content = await fs3.readFile(file, "utf-8");
|
|
1709
|
+
if (!content.toLowerCase().includes(queryLower)) continue;
|
|
1710
|
+
const lines = content.split("\n");
|
|
1711
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1712
|
+
if (lines[i]?.toLowerCase().includes(queryLower)) {
|
|
1713
|
+
const start = Math.max(0, i - 1);
|
|
1714
|
+
const end = Math.min(lines.length, i + 3);
|
|
1715
|
+
const excerpt = lines.slice(start, end).join("\n").slice(0, 300);
|
|
1716
|
+
const contentLower = content.toLowerCase();
|
|
1717
|
+
const occurrences = contentLower.split(queryLower).length - 1;
|
|
1718
|
+
results.push({
|
|
1719
|
+
pkg,
|
|
1720
|
+
file: path5__default.relative(docsPath, file),
|
|
1721
|
+
excerpt,
|
|
1722
|
+
score: occurrences
|
|
1723
|
+
});
|
|
1724
|
+
break;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
} catch {
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
results.sort((a, b) => b.score - a.score);
|
|
1732
|
+
const topResults = results.slice(0, args.maxResults || 10);
|
|
1733
|
+
if (topResults.length === 0) {
|
|
1734
|
+
return `No results found for "${args.query}".
|
|
1735
|
+
|
|
1736
|
+
Try:
|
|
1737
|
+
- Using different search terms
|
|
1738
|
+
- Searching for broader topics
|
|
1739
|
+
- Using **listMastraPackages** to see available packages
|
|
1740
|
+
- Using **readMastraDocs** to browse documentation by topic`;
|
|
1741
|
+
}
|
|
1742
|
+
return [
|
|
1743
|
+
`# Search Results: "${args.query}"`,
|
|
1744
|
+
"",
|
|
1745
|
+
`Found ${results.length} result(s), showing top ${topResults.length}:`,
|
|
1746
|
+
"",
|
|
1747
|
+
...topResults.map((r, i) => `## ${i + 1}. ${r.pkg} - ${r.file}
|
|
1748
|
+
|
|
1749
|
+
\`\`\`
|
|
1750
|
+
${r.excerpt}
|
|
1751
|
+
\`\`\`
|
|
1752
|
+
`),
|
|
1753
|
+
"",
|
|
1754
|
+
"## Next Steps",
|
|
1755
|
+
"",
|
|
1756
|
+
"- Use **readMastraDocs** with a package and topic to read full documentation",
|
|
1757
|
+
"- Use **getMastraExportDetails** to see API details for mentioned classes/functions",
|
|
1758
|
+
"- Refine your search with more specific terms if needed"
|
|
1759
|
+
].join("\n");
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
var embeddedDocsTools = {
|
|
1763
|
+
getMastraHelp: getMastraHelpTool,
|
|
1764
|
+
listMastraPackages: listInstalledPackagesTool,
|
|
1765
|
+
getMastraExports: readSourceMapTool,
|
|
1766
|
+
getMastraExportDetails: findExportTool,
|
|
1767
|
+
readMastraDocs: readEmbeddedDocsTool,
|
|
1768
|
+
searchMastraDocs: searchEmbeddedDocsTool
|
|
1769
|
+
};
|
|
1770
|
+
var migrationsBaseDir = fromPackageRoot(".docs/guides/migrations");
|
|
1771
|
+
function parseSections(content) {
|
|
1772
|
+
const lines = content.split("\n");
|
|
1773
|
+
const sections = [];
|
|
1774
|
+
let currentSection = null;
|
|
1775
|
+
let inFrontmatter = false;
|
|
1776
|
+
let contentStarted = false;
|
|
1777
|
+
for (let index = 0; index < lines.length; index++) {
|
|
1778
|
+
const line = lines[index];
|
|
1779
|
+
if (index === 0 && line === "---") {
|
|
1780
|
+
inFrontmatter = true;
|
|
1781
|
+
continue;
|
|
1782
|
+
}
|
|
1783
|
+
if (inFrontmatter && line === "---") {
|
|
1784
|
+
inFrontmatter = false;
|
|
1785
|
+
continue;
|
|
1786
|
+
}
|
|
1787
|
+
if (inFrontmatter) continue;
|
|
1788
|
+
contentStarted = true;
|
|
1789
|
+
const headingMatch = line?.match(/^(#{2,3})\s+(.+)$/);
|
|
1790
|
+
if (headingMatch && contentStarted) {
|
|
1791
|
+
if (currentSection) {
|
|
1792
|
+
currentSection.endLine = index - 1;
|
|
1793
|
+
sections.push(currentSection);
|
|
1794
|
+
}
|
|
1795
|
+
const level = headingMatch[1]?.length ?? 0;
|
|
1796
|
+
currentSection = {
|
|
1797
|
+
title: headingMatch[2] || "Untitled",
|
|
1798
|
+
level,
|
|
1799
|
+
content: line + "\n",
|
|
1800
|
+
startLine: index,
|
|
1801
|
+
endLine: index
|
|
1802
|
+
};
|
|
1803
|
+
} else if (currentSection) {
|
|
1804
|
+
currentSection.content += line + "\n";
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
if (currentSection) {
|
|
1808
|
+
currentSection.endLine = lines.length - 1;
|
|
1809
|
+
sections.push(currentSection);
|
|
1810
|
+
}
|
|
1811
|
+
return sections;
|
|
1812
|
+
}
|
|
1813
|
+
async function discoverMigrations(baseDir, relativePath = "") {
|
|
1814
|
+
const migrations = [];
|
|
1815
|
+
const fullPath = path5__default.join(baseDir, relativePath);
|
|
1045
1816
|
try {
|
|
1817
|
+
const entries = await fs3.readdir(fullPath, { withFileTypes: true });
|
|
1818
|
+
for (const entry of entries) {
|
|
1819
|
+
const entryRelativePath = path5__default.join(relativePath, entry.name);
|
|
1820
|
+
if (entry.isDirectory()) {
|
|
1821
|
+
migrations.push({
|
|
1822
|
+
path: entryRelativePath,
|
|
1823
|
+
type: "directory"
|
|
1824
|
+
});
|
|
1825
|
+
const subMigrations = await discoverMigrations(baseDir, entryRelativePath);
|
|
1826
|
+
migrations.push(...subMigrations);
|
|
1827
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
1828
|
+
const cleanName = entry.name.replace(/\.md$/, "");
|
|
1829
|
+
migrations.push({
|
|
1830
|
+
path: relativePath ? path5__default.join(relativePath, cleanName) : cleanName,
|
|
1831
|
+
type: "file"
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
} catch (error) {
|
|
1836
|
+
void logger.error(`Failed to discover migrations in ${fullPath}`, error);
|
|
1837
|
+
}
|
|
1838
|
+
return migrations;
|
|
1839
|
+
}
|
|
1840
|
+
async function listDirectoryContents(dirPath = "") {
|
|
1841
|
+
try {
|
|
1842
|
+
const fullPath = path5__default.join(migrationsBaseDir, dirPath);
|
|
1843
|
+
const resolvedPath = path5__default.resolve(fullPath);
|
|
1844
|
+
const resolvedBaseDir = path5__default.resolve(migrationsBaseDir);
|
|
1845
|
+
if (!resolvedPath.startsWith(resolvedBaseDir)) {
|
|
1846
|
+
return "Invalid path";
|
|
1847
|
+
}
|
|
1848
|
+
const entries = await fs3.readdir(fullPath, { withFileTypes: true });
|
|
1849
|
+
const directories = [];
|
|
1850
|
+
const files = [];
|
|
1851
|
+
for (const entry of entries) {
|
|
1852
|
+
if (entry.isDirectory()) {
|
|
1853
|
+
directories.push(entry.name);
|
|
1854
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
1855
|
+
files.push(entry.name.replace(/\.md$/, ""));
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
const output = [];
|
|
1859
|
+
const currentPath = dirPath || "migrations";
|
|
1860
|
+
output.push(`# ${currentPath}`);
|
|
1861
|
+
output.push("");
|
|
1862
|
+
if (directories.length > 0) {
|
|
1863
|
+
output.push("**Directories:**");
|
|
1864
|
+
directories.sort().forEach((dir) => {
|
|
1865
|
+
const nextPath = dirPath ? `${dirPath}/${dir}` : dir;
|
|
1866
|
+
output.push(`- **${dir}/** - Explore with \`{ path: "${nextPath}/" }\``);
|
|
1867
|
+
});
|
|
1868
|
+
output.push("");
|
|
1869
|
+
}
|
|
1870
|
+
if (files.length > 0) {
|
|
1871
|
+
output.push("**Migration Guides:**");
|
|
1872
|
+
files.sort().forEach((file) => {
|
|
1873
|
+
const filePath = dirPath ? `${dirPath}/${file}` : file;
|
|
1874
|
+
output.push(`- **${file}** - Get with \`{ path: "${filePath}" }\``);
|
|
1875
|
+
});
|
|
1876
|
+
output.push("");
|
|
1877
|
+
}
|
|
1878
|
+
if (directories.length === 0 && files.length === 0) {
|
|
1879
|
+
output.push("No migrations found in this directory.");
|
|
1880
|
+
}
|
|
1881
|
+
output.push("---");
|
|
1882
|
+
output.push("");
|
|
1883
|
+
output.push("**Actions:**");
|
|
1884
|
+
output.push("- Navigate to a directory by setting `path` to directory name with trailing `/`");
|
|
1885
|
+
output.push("- View a migration guide by setting `path` to the guide name");
|
|
1886
|
+
output.push("- List sections in a guide with `listSections: true`");
|
|
1887
|
+
output.push("- Search all guides with `queryKeywords`");
|
|
1888
|
+
return output.join("\n");
|
|
1889
|
+
} catch (error) {
|
|
1890
|
+
if (error.code === "ENOENT") {
|
|
1891
|
+
return `Directory "${dirPath}" not found. Use \`{}\` to see top-level migrations.`;
|
|
1892
|
+
}
|
|
1893
|
+
throw error;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
async function readMigrationContent(migrationPath) {
|
|
1897
|
+
try {
|
|
1898
|
+
const cleanPath = migrationPath.replace(/\.(mdx|md)$/, "");
|
|
1899
|
+
const filePath = path5__default.join(migrationsBaseDir, cleanPath + ".md");
|
|
1900
|
+
const resolvedPath = path5__default.resolve(filePath);
|
|
1901
|
+
const resolvedBaseDir = path5__default.resolve(migrationsBaseDir);
|
|
1902
|
+
if (!resolvedPath.startsWith(resolvedBaseDir)) {
|
|
1903
|
+
void logger.error("Path traversal attempt detected");
|
|
1904
|
+
return null;
|
|
1905
|
+
}
|
|
1046
1906
|
const content = await fs3.readFile(filePath, "utf-8");
|
|
1047
1907
|
return content;
|
|
1048
|
-
} catch {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1908
|
+
} catch (error) {
|
|
1909
|
+
void logger.error(`Failed to read migration: ${migrationPath}`, error);
|
|
1910
|
+
return null;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
async function getSectionHeaders(migrationPath) {
|
|
1914
|
+
const content = await readMigrationContent(migrationPath);
|
|
1915
|
+
if (!content) return [];
|
|
1916
|
+
const sections = parseSections(content);
|
|
1917
|
+
return sections.map((s) => ({ title: s.title, level: s.level }));
|
|
1918
|
+
}
|
|
1919
|
+
async function getSections(migrationPath, sectionTitles) {
|
|
1920
|
+
const content = await readMigrationContent(migrationPath);
|
|
1921
|
+
if (!content) {
|
|
1922
|
+
const availableMigrations = await discoverMigrations(migrationsBaseDir);
|
|
1923
|
+
const paths = availableMigrations.filter((m) => m.type === "file").map((m) => `- ${m.path}`);
|
|
1924
|
+
return `Migration "${migrationPath}" not found.
|
|
1053
1925
|
|
|
1054
|
-
Available
|
|
1055
|
-
${
|
|
1926
|
+
Available migrations:
|
|
1927
|
+
${paths.join("\n")}`;
|
|
1928
|
+
}
|
|
1929
|
+
if (!sectionTitles || sectionTitles.length === 0) {
|
|
1930
|
+
return content;
|
|
1931
|
+
}
|
|
1932
|
+
const sections = parseSections(content);
|
|
1933
|
+
const requestedSections = sections.filter(
|
|
1934
|
+
(s) => sectionTitles.some((title) => s.title.toLowerCase().includes(title.toLowerCase()))
|
|
1935
|
+
);
|
|
1936
|
+
if (requestedSections.length === 0) {
|
|
1937
|
+
const availableHeaders = sections.map((s) => `${"#".repeat(s.level)} ${s.title}`).join("\n");
|
|
1938
|
+
return `Requested sections not found in "${migrationPath}".
|
|
1056
1939
|
|
|
1057
|
-
|
|
1940
|
+
Available sections:
|
|
1941
|
+
${availableHeaders}`;
|
|
1058
1942
|
}
|
|
1943
|
+
return requestedSections.map((s) => s.content).join("\n---\n\n");
|
|
1059
1944
|
}
|
|
1060
|
-
var
|
|
1061
|
-
var
|
|
1062
|
-
var
|
|
1063
|
-
|
|
1064
|
-
|
|
1945
|
+
var initialMigrations = await discoverMigrations(migrationsBaseDir);
|
|
1946
|
+
var migrationFiles = initialMigrations.filter((m) => m.type === "file");
|
|
1947
|
+
var migrationsListing = migrationFiles.length > 0 ? "\n\nExample migration paths:\n" + migrationFiles.slice(0, 5).map((m) => `- ${m.path}`).join("\n") + "\n..." : "\n\nNo migrations available. Run the documentation preparation script first.";
|
|
1948
|
+
var migrationInputSchema = z.object({
|
|
1949
|
+
path: z.string().optional().describe(
|
|
1950
|
+
'Path to the migration guide (e.g., "upgrade-to-v1/agent", "agentnetwork"). If not provided, lists all available migrations.' + migrationsListing
|
|
1065
1951
|
),
|
|
1066
|
-
|
|
1067
|
-
"
|
|
1068
|
-
)
|
|
1952
|
+
sections: z.array(z.string()).optional().describe(
|
|
1953
|
+
"Specific section titles to fetch from the migration guide. If not provided, returns the entire guide. Use this after exploring section headers."
|
|
1954
|
+
),
|
|
1955
|
+
listSections: z.boolean().optional().describe("Set to true to list all section headers in a migration guide without fetching full content."),
|
|
1956
|
+
queryKeywords: z.array(z.string()).optional().describe("Keywords to search across all migration guides. Use this to find guides related to specific topics.")
|
|
1069
1957
|
});
|
|
1070
|
-
var
|
|
1071
|
-
name: "
|
|
1072
|
-
description: `Get
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1958
|
+
var migrationTool = {
|
|
1959
|
+
name: "mastraMigration",
|
|
1960
|
+
description: `[\u{1F310} REMOTE] Get migration guidance for Mastra version upgrades and breaking changes.
|
|
1961
|
+
|
|
1962
|
+
This tool works like a file browser - navigate through directories to find migration guides:
|
|
1963
|
+
|
|
1964
|
+
**Step 1: List top-level migrations**
|
|
1965
|
+
- Call with no parameters: \`{}\`
|
|
1966
|
+
- Shows all top-level migration guides and directories
|
|
1967
|
+
|
|
1968
|
+
**Step 2: Navigate into a directory**
|
|
1969
|
+
- Add trailing slash to explore: \`{ path: "upgrade-to-v1/" }\`
|
|
1970
|
+
- Lists all migration guides in that directory
|
|
1971
|
+
|
|
1972
|
+
**Step 3: View a migration guide**
|
|
1973
|
+
- Without trailing slash: \`{ path: "upgrade-to-v1/agent" }\`
|
|
1974
|
+
- Returns the full migration guide content
|
|
1975
|
+
|
|
1976
|
+
**Step 4: Explore guide sections (optional)**
|
|
1977
|
+
- List sections: \`{ path: "upgrade-to-v1/agent", listSections: true }\`
|
|
1978
|
+
- Get specific sections: \`{ path: "upgrade-to-v1/agent", sections: ["Voice methods"] }\`
|
|
1979
|
+
|
|
1980
|
+
**Alternative: Search by keywords**
|
|
1981
|
+
- \`{ queryKeywords: ["RuntimeContext", "pagination"] }\`
|
|
1982
|
+
|
|
1983
|
+
**Examples:**
|
|
1984
|
+
1. List top-level: \`{}\`
|
|
1985
|
+
2. Navigate to upgrade-to-v1: \`{ path: "upgrade-to-v1/" }\`
|
|
1986
|
+
3. Get agent guide: \`{ path: "upgrade-to-v1/agent" }\`
|
|
1987
|
+
4. List guide sections: \`{ path: "upgrade-to-v1/agent", listSections: true }\`
|
|
1988
|
+
5. Search: \`{ queryKeywords: ["RuntimeContext"] }\`
|
|
1989
|
+
|
|
1990
|
+
**Tip:** Paths ending with \`/\` list directory contents. Paths without \`/\` fetch the migration guide.`,
|
|
1991
|
+
parameters: migrationInputSchema,
|
|
1077
1992
|
execute: async (args) => {
|
|
1078
|
-
void logger.debug("Executing
|
|
1993
|
+
void logger.debug("Executing mastraMigration tool", { args });
|
|
1079
1994
|
try {
|
|
1080
|
-
if (
|
|
1081
|
-
const
|
|
1082
|
-
return [
|
|
1995
|
+
if (args.queryKeywords && args.queryKeywords.length > 0) {
|
|
1996
|
+
const suggestions = await getMatchingPaths("", args.queryKeywords, migrationsBaseDir);
|
|
1997
|
+
return [
|
|
1998
|
+
"# Migration Guide Search Results",
|
|
1999
|
+
"",
|
|
2000
|
+
suggestions || "No migration guides found matching your keywords.",
|
|
2001
|
+
"",
|
|
2002
|
+
"---",
|
|
2003
|
+
"",
|
|
2004
|
+
"To see all available migrations, call with no parameters."
|
|
2005
|
+
].join("\n");
|
|
1083
2006
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
2007
|
+
if (args.path) {
|
|
2008
|
+
if (args.path.endsWith("/")) {
|
|
2009
|
+
const dirPath = args.path.slice(0, -1);
|
|
2010
|
+
return await listDirectoryContents(dirPath);
|
|
2011
|
+
}
|
|
2012
|
+
if (args.listSections) {
|
|
2013
|
+
const headers = await getSectionHeaders(args.path);
|
|
2014
|
+
if (headers.length === 0) {
|
|
2015
|
+
return await listDirectoryContents();
|
|
2016
|
+
}
|
|
2017
|
+
return [
|
|
2018
|
+
`# ${args.path} - Section Headers`,
|
|
2019
|
+
"",
|
|
2020
|
+
"Available sections in this migration guide:",
|
|
2021
|
+
"",
|
|
2022
|
+
...headers.map((h) => `${"#".repeat(h.level)} ${h.title}`),
|
|
2023
|
+
"",
|
|
2024
|
+
"---",
|
|
2025
|
+
"",
|
|
2026
|
+
'To get specific sections, provide their titles in the "sections" parameter.'
|
|
2027
|
+
].join("\n");
|
|
2028
|
+
}
|
|
2029
|
+
const content = await getSections(args.path, args.sections);
|
|
2030
|
+
return `# ${args.path}
|
|
2031
|
+
|
|
2032
|
+
${content}`;
|
|
2033
|
+
}
|
|
2034
|
+
return await listDirectoryContents();
|
|
1087
2035
|
} catch (error) {
|
|
1088
|
-
void logger.error("Failed to execute
|
|
2036
|
+
void logger.error("Failed to execute mastraMigration tool", error);
|
|
1089
2037
|
throw error;
|
|
1090
2038
|
}
|
|
1091
2039
|
}
|
|
@@ -1093,29 +2041,21 @@ var examplesTool = {
|
|
|
1093
2041
|
|
|
1094
2042
|
// src/index.ts
|
|
1095
2043
|
var server;
|
|
1096
|
-
if (process.env.REBUILD_DOCS_ON_START === "true") {
|
|
1097
|
-
void logger.info("Rebuilding docs on start");
|
|
1098
|
-
try {
|
|
1099
|
-
await prepare();
|
|
1100
|
-
void logger.info("Docs rebuilt successfully");
|
|
1101
|
-
} catch (error) {
|
|
1102
|
-
void logger.error("Failed to rebuild docs", error);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
2044
|
server = new MCPServer({
|
|
1106
2045
|
name: "Mastra Documentation Server",
|
|
1107
2046
|
version: JSON.parse(await fs3.readFile(fromPackageRoot(`package.json`), "utf8")).version,
|
|
1108
2047
|
tools: {
|
|
1109
|
-
mastraBlog: blogTool,
|
|
1110
2048
|
mastraDocs: docsTool,
|
|
1111
|
-
|
|
1112
|
-
mastraChanges: changesTool,
|
|
2049
|
+
mastraMigration: migrationTool,
|
|
1113
2050
|
startMastraCourse,
|
|
1114
2051
|
getMastraCourseStatus,
|
|
1115
2052
|
startMastraCourseLesson,
|
|
1116
2053
|
nextMastraCourseStep,
|
|
1117
|
-
clearMastraCourseHistory
|
|
1118
|
-
|
|
2054
|
+
clearMastraCourseHistory,
|
|
2055
|
+
// Embedded docs tools for reading docs from installed packages
|
|
2056
|
+
...embeddedDocsTools
|
|
2057
|
+
},
|
|
2058
|
+
prompts: migrationPromptMessages
|
|
1119
2059
|
});
|
|
1120
2060
|
Object.assign(logger, createLogger(server));
|
|
1121
2061
|
async function runServer() {
|
|
@@ -1129,6 +2069,24 @@ async function runServer() {
|
|
|
1129
2069
|
}
|
|
1130
2070
|
|
|
1131
2071
|
// src/stdio.ts
|
|
2072
|
+
function parseLogLevel() {
|
|
2073
|
+
const args = process.argv.slice(2);
|
|
2074
|
+
const logLevelIndex = args.indexOf("--log-level");
|
|
2075
|
+
if (logLevelIndex === -1 || logLevelIndex === args.length - 1) {
|
|
2076
|
+
return void 0;
|
|
2077
|
+
}
|
|
2078
|
+
const level = args[logLevelIndex + 1];
|
|
2079
|
+
const validLevels = ["debug", "info", "warn", "error", "none"];
|
|
2080
|
+
if (validLevels.includes(level)) {
|
|
2081
|
+
return level;
|
|
2082
|
+
}
|
|
2083
|
+
console.error(`Invalid log level: ${level}. Valid levels: ${validLevels.join(", ")}`);
|
|
2084
|
+
return void 0;
|
|
2085
|
+
}
|
|
2086
|
+
var logLevel = parseLogLevel();
|
|
2087
|
+
if (logLevel) {
|
|
2088
|
+
setLogLevel(logLevel);
|
|
2089
|
+
}
|
|
1132
2090
|
runServer().catch((error) => {
|
|
1133
2091
|
const errorMessage = "Fatal error running server";
|
|
1134
2092
|
console.error(errorMessage, error);
|
|
@@ -1141,3 +2099,5 @@ runServer().catch((error) => {
|
|
|
1141
2099
|
});
|
|
1142
2100
|
process.exit(1);
|
|
1143
2101
|
});
|
|
2102
|
+
//# sourceMappingURL=stdio.js.map
|
|
2103
|
+
//# sourceMappingURL=stdio.js.map
|