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

Method executeReadTool

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

3299 * path validation already ran in {@link execute} before routing here.
3300 */
3301 async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
3302 try {
3303 return await this.dispatchTool(toolName, args);
3304 } catch (err) {
3305 if (err instanceof NotIndexedError) {
3306 return this.textResult(err.message);
3307 }
3308 if (err instanceof WslSharedIndexError) {
3309 return this.textResult(wslSharedIndexGuidance(err));
3310 }
3311 if (err instanceof PathRefusalError) {
3312 return this.errorResult(err.message);
3313 }
3314 if (isDatabaseOpenFailure(err)) {
3315 return this.errorResult(databaseOpenFailureText(err));
3316 }
3317 return this.errorResult(
3318 `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` +
3319 'This is an internal codegraph error — retry the call once; if it persists, ' +
3320 'continue without codegraph for this task.'
3321 );
3322 }
3323 }
3324
3325 /**
3326 * 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