* 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>)
| 3317 | * path validation already ran in {@link execute} before routing here. |
| 3318 | */ |
| 3319 | async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> { |
| 3320 | try { |
| 3321 | return await this.dispatchTool(toolName, args); |
| 3322 | } catch (err) { |
| 3323 | if (err instanceof NotIndexedError) { |
| 3324 | return this.textResult(err.message); |
| 3325 | } |
| 3326 | if (err instanceof WslSharedIndexError) { |
| 3327 | return this.textResult(wslSharedIndexGuidance(err)); |
| 3328 | } |
| 3329 | if (err instanceof PathRefusalError) { |
| 3330 | return this.errorResult(err.message); |
| 3331 | } |
| 3332 | if (isDatabaseOpenFailure(err)) { |
| 3333 | return this.errorResult(databaseOpenFailureText(err)); |
| 3334 | } |
| 3335 | return this.errorResult( |
| 3336 | `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` + |
| 3337 | 'This is an internal codegraph error — retry the call once; if it persists, ' + |
| 3338 | 'continue without codegraph for this task.' |
| 3339 | ); |
| 3340 | } |
| 3341 | } |
| 3342 | |
| 3343 | /** |
| 3344 | * Pure dispatch over the read tools — the switch, with no gate, no notices, no |
no test coverage detected