* 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>)
| 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 |
no test coverage detected