MCPcopy
hub / github.com/colbymchenry/codegraph / executeReadTool

Method executeReadTool

src/mcp/tools.ts:1418–1434  ·  view source on GitHub ↗

* Run a single read tool to completion and return its raw ToolResult, * classifying expected failures the same way execute's catch does so * the SHAPE is identical whether dispatch runs in-process or on a worker: * NotIndexed → success-shaped guidance, PathRefusal → clean er

(toolName: string, args: Record<string, unknown>)

Source from the content-addressed store, hash-verified

1416 * path validation already ran in {@link execute} before routing here.
1417 */
1418 async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
1419 try {
1420 return await this.dispatchTool(toolName, args);
1421 } catch (err) {
1422 if (err instanceof NotIndexedError) {
1423 return this.textResult(err.message);
1424 }
1425 if (err instanceof PathRefusalError) {
1426 return this.errorResult(err.message);
1427 }
1428 return this.errorResult(
1429 `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` +
1430 'This is an internal codegraph error — retry the call once; if it persists, ' +
1431 'continue without codegraph for this task.'
1432 );
1433 }
1434 }
1435
1436 /**
1437 * Pure dispatch over the read tools — the switch, with no gate, no notices, no

Callers 2

executeMethod · 0.95
serveFunction · 0.80

Calls 3

dispatchToolMethod · 0.95
textResultMethod · 0.95
errorResultMethod · 0.95

Tested by

no test coverage detected