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

Method executeReadTool

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

3359 * path validation already ran in {@link execute} before routing here.
3360 */
3361 async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
3362 try {
3363 return await this.dispatchTool(toolName, args);
3364 } catch (err) {
3365 if (err instanceof NotIndexedError) {
3366 return this.textResult(err.message);
3367 }
3368 if (err instanceof WslSharedIndexError) {
3369 return this.textResult(wslSharedIndexGuidance(err));
3370 }
3371 if (err instanceof PathRefusalError) {
3372 return this.errorResult(err.message);
3373 }
3374 if (isDatabaseOpenFailure(err)) {
3375 return this.errorResult(databaseOpenFailureText(err));
3376 }
3377 return this.errorResult(
3378 `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` +
3379 'This is an internal codegraph error — retry the call once; if it persists, ' +
3380 'continue without codegraph for this task.'
3381 );
3382 }
3383 }
3384
3385 /**
3386 * 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