Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

refactor(mcp): reuse wiringPath instead of reconstructing the graph path

Shrish Dwivedie235f9156097
diff --git a/src/mcp/tools.ts b/src/mcp/tools.ts
index 692ee8a5..d55fda1d 100644
--- a/src/mcp/tools.ts
+++ b/src/mcp/tools.ts
@@ -2,13 +2,12 @@
* The three MCP tools, as pure functions over the existing engine.
* `callTool` never throws — hosts get soft errors as isError content.
*/
-import { join } from 'node:path';
import { Graft } from '../engine.js';
import { formatAsk } from '../ask/ask.js';
import { formatCheckReport } from '../context/check.js';
import { formatGraphCheckReport } from '../graph/check.js';
import { formatBlastRadius } from '../claude/format.js';
-import { readGraph, GRAPH_FILE, GRAPH_DIR } from '../graph/write.js';
+import { readGraph, wiringPath } from '../graph/write.js';
import { contextDirFor } from '../context/node-file.js';
export interface ToolDef {
@@ -73,7 +72,7 @@ export function callTool(
case 'graft_blast_radius': {
const file = String(args.file ?? '');
if (!file) return { text: 'graft_blast_radius requires a file', isError: true };
- const w = readGraph(join(contextDirFor(root), GRAPH_DIR, GRAPH_FILE));
+ const w = readGraph(wiringPath(contextDirFor(root)));
if (!w) return { text: 'no graph found — run `graft build` first', isError: true };
const br = formatBlastRadius(w, file);
return { text: br ?? `no known dependents of ${file}`, isError: false };