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