get_logic_blueprint
Retrieve the core logic blueprint of your project to plan modifications or review architecture. Use for intentional core changes, not minor tweaks.
Instructions
仅在涉及项目核心逻辑变更、新增功能、跨文件流程修改,或用户明确要求“查看项目逻辑”、“查看当前项目实现”时调用。 警告:对于调整简单参数、常数、阈值、纯 UI 颜色/样式微调、补充注释、变量重命名、局部语法 Bug 修复等不涉及核心逻辑变动的操作,严禁调用此工具。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| intent | Yes | 用户意图:'view' 表示仅查看,'modify' 表示重构。 |
Implementation Reference
- src/index.ts:14-34 (registration)Registers the 'get_logic_blueprint' tool with the MCP server, including its description and input schema (intent: 'view' or 'modify').
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "get_logic_blueprint", description: TOOL_DESCRIPTION, inputSchema: { type: "object", properties: { intent: { type: "string", enum: ["view", "modify"], description: "用户意图:'view' 表示仅查看,'modify' 表示重构。" } }, required: ["intent"] } } ] }; }); - src/index.ts:37-77 (handler)Handles the 'get_logic_blueprint' tool call. Validates intent, generates a timestamped filename under 'vibelogic-plans/', and constructs a prompt instructing the LLM to perform architecture analysis and output a Mermaid diagram.
server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name !== "get_logic_blueprint") { throw new Error(`Unknown tool: ${request.params.name}`); } const args = request.params.arguments; const intent = args?.intent as "view" | "modify"; if (!intent) { throw new Error("Missing required arguments."); } const now = new Date(); const pad = (value: number) => value.toString().padStart(2, "0"); const timestamp = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`; const target_file = `vibelogic-plans/arch-${timestamp}.md`; let finalPrompt = ` 你已成功触发 VibeLogic 架构审计引擎。 请立即结合你当前工作区已读取的业务代码和用户需求,执行架构分析任务。 【目标导出文件】 ${target_file} 【出图规范与约束(必须严格遵守)】 ${MERMAID_VISUAL_PROTOCOL} `; if (intent === "modify" || intent === "view") { finalPrompt += `\n【文件导出与执行规范】\n` + LOGIC_CHANGE_SOP.replace("${target_file}", target_file); } return { content: [ { type: "text", text: finalPrompt } ] }; }); - src/index.ts:20-30 (schema)Input schema definition for the 'get_logic_blueprint' tool: requires an 'intent' parameter which can be 'view' or 'modify'.
inputSchema: { type: "object", properties: { intent: { type: "string", enum: ["view", "modify"], description: "用户意图:'view' 表示仅查看,'modify' 表示重构。" } }, required: ["intent"] } - src/prompts.ts:2-3 (helper)Tool description constant used in the tool registration, acting as a guard to prevent accidental invocation for trivial changes.
export const TOOL_DESCRIPTION = `仅在涉及项目核心逻辑变更、新增功能、跨文件流程修改,或用户明确要求“查看项目逻辑”、“查看当前项目实现”时调用。 警告:对于调整简单参数、常数、阈值、纯 UI 颜色/样式微调、补充注释、变量重命名、局部语法 Bug 修复等不涉及核心逻辑变动的操作,严禁调用此工具。`; - src/prompts.ts:6-32 (helper)Mermaid visual protocol constant used by the handler to enforce strict diagram output rules (format, shapes, abstraction level).
export const MERMAID_VISUAL_PROTOCOL = `一、 角色与核心任务 你是一位顶级跨文件架构审计师。你的任务是分析业务代码,通过 Mermaid.js 输出架构协作图。严禁输出任何解释性文字。 输出内容将用于 .md 文件预览,必须确保 Mermaid 语法纯净、可直接渲染,不得混入解释性文字、CSS classDef 或非 Mermaid 内容。 二、 强力降噪与高维抽象(防节点爆炸) 1、高维抽象:将底层逻辑合并为高层级的模块,展示系统的“骨架”。 2、强力降噪:只画核心数据流、跨文件接口调用、DB 操作。忽略样板代码和琐碎工具函数。 3、如果是多个文件,每个文件放在独立的 subgraph 中;只有1个文件则直接画在主流程中。 4、节点控制:多个文件时每个 subgraph 内部节点严禁超过 15 个;单文件节点总数不超过 20 个。 5、【致命语义底线】:节点的主标题和补充说明中,【绝对禁止】出现具体函数名或底层 API,必须翻译为“业务动作”(如“保存用户数据”)。 6、必须保留的核心骨架:核心入口、战略级决策点、跨模块交互、关键状态变更。 三、 跨文件层级展示协议 1、【致命语法底线】:subgraph 的 ID 只能使用英文字母和下划线!显示名称放在方括号+双引号 ["..."] 中。正确示例:subgraph file_auth_ts["auth.ts"] 2、主业务流必须穿梭于各个 subgraph 之间,清晰展示协作关系。 四、 视觉架构与排版协议(绝对死锁) 1、强制引擎:代码前两行必须严格为: %%{init: {"flowchart": {"curve": "linear"}}}%% flowchart TD 2、节点形状与双行规范: - 普通节点:节点纯英文ID("<b>主标题</b><br/><small>细节补充说明</small>") - 判断节点:节点纯英文ID{"<b>主标题</b><br/><small>细节补充说明</small>"} 【致命警告】必须使用 <br/> 换行并包含 <small>!绝对严禁嵌套多层括号! 3、连线文字极简,绝对禁止在连线文字中使用花括号 {}! 五、 语法底线与颜色工程 1、节点 ID 必须包含文件特征前缀且仅限纯英文或数字。 2、严禁使用 stateDiagram、sequenceDiagram、严禁使用曲线。 3、添加类名后缀::::start,:::process,:::check,:::error。 【致命底线 — 严禁输出 CSS】:绝对禁止在代码末尾输出任何 classDef 定义语句!`; - src/prompts.ts:35-50 (helper)Logic change SOP constant used by the handler instructing the LLM to create a Markdown file with the Mermaid diagram and a confirmation message.
export const LOGIC_CHANGE_SOP = ` 由于用户的意图涉及逻辑变更或架构审计,你必须执行以下流程: 1. 【文件创建】:你必须使用你的文件系统工具(如 create_file),在当前项目根目录下的 'vibelogic-plans' 文件夹中创建一个新的 Markdown 文件。 2. 【文件名】:文件名由工具返回的 'target_file' 参数指定(请确保包含该时间戳)。 3. 【文件内容】: - 顶部为生成的 Mermaid 架构图(严格遵守视觉协议)。 - 下方为“架构思考 (Thinking)”与“施工清单 (Action Plan)”。 4. 【结束语】:文件创建成功后,请一字不差地输出以下死锁确认语: **“✨ 架构蓝图已生成至 \${target_file}。请点击该文件并按 [Cmd/Ctrl + Shift + V] 开启预览,或在专业的转换器中查看最佳渲染效果。”** 警告:除非用户要求,否则不要在聊天框中输出完整的 Mermaid 代码,只需输出上述确认语。 【优雅降级】:如果因为权限或环境问题导致无法创建 Markdown 文件,请直接在聊天框内输出 Mermaid 代码块与施工清单,并附带一条错误提示说明文件创建失败。 `;