用途:查询嵌入在 node_modules/@mastra/*/dist/docs/ 中的 Mastra API 文档,这些文档与本地安装的版本一致,可用于核对 Agent、Workflow、Tool、Memory 等配置的准确 API 签名。由于 Mastra 处于活跃 beta 阶段、API 变动频繁,训练数据可能过时,因此优先查阅嵌入文档。
文档结构:node_modules/@mastra/core/dist/docs/ 下包含 SKILL.md(包概览与导出)、SOURCE_MAP.json(导出到文件的映射)以及按主题划分的功能文档目录(如 agents/、workflows/ 等)。
查询流程:1)在 SOURCE_MAP.json 中查找导出,例如 cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"Agent"',返回形如 { "Agent": { "types": "dist/agent/agent.d.ts", ... } };2)读取类型定义,如 cat node_modules/@mastra/core/dist/agent/agent.d.ts;3)查看主题文档,如 cat node_modules/@mastra/core/dist/docs/agents/01-overview.md。
常见包:@mastra/core 对应 node_modules/@mastra/core/dist/docs/,含 Agents、Workflows、Tools;@mastra/memory 对应 node_modules/@mastra/memory/dist/docs/,含 Memory 系统;@mastra/rag 对应 node_modules/@mastra/rag/dist/docs/,含 RAG 功能。
常用命令:ls node_modules/@mastra/ 列出已安装包;cat node_modules/@mastra/core/dist/docs/SOURCE_MAP.json | grep '"ExportName"' 查找导出;cat node_modules/@mastra/core/dist/[path-from-source-map] 读取类型定义;ls node_modules/@mastra/core/dist/docs/ 列出可用主题。
限制:仅适用于已安装 @mastra 相关包并存在嵌入文档的本地环境;其他安装方式、平台或收费信息暂未提供。