MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / executeReadTool

Method executeReadTool

src/mcp/tools.ts:3478–3500  ·  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

3476 * path validation already ran in {@link execute} before routing here.
3477 */
3478 async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
3479 try {
3480 return await this.dispatchTool(toolName, args);
3481 } catch (err) {
3482 if (err instanceof NotIndexedError) {
3483 return this.textResult(err.message);
3484 }
3485 if (err instanceof WslSharedIndexError) {
3486 return this.textResult(wslSharedIndexGuidance(err));
3487 }
3488 if (err instanceof PathRefusalError) {
3489 return this.errorResult(err.message);
3490 }
3491 if (isDatabaseOpenFailure(err)) {
3492 return this.errorResult(databaseOpenFailureText(err));
3493 }
3494 return this.errorResult(
3495 `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` +
3496 'This is an internal codegraph error — retry the call once; if it persists, ' +
3497 'continue without codegraph for this task.'
3498 );
3499 }
3500 }
3501
3502 /**
3503 * Pure dispatch over the read tools — the switch, with no gate, no notices, no

Callers 5

executeMethod · 0.95
serveFunction · 0.80
query-pool.test.tsFile · 0.80

Calls 6

dispatchToolMethod · 0.95
textResultMethod · 0.95
errorResultMethod · 0.95
isDatabaseOpenFailureFunction · 0.90
wslSharedIndexGuidanceFunction · 0.85
databaseOpenFailureTextFunction · 0.85

Tested by

no test coverage detected