( tool: Tool, input: Record<string, unknown>, toolUseID: string, requestId: string, )
| 92 | } |
| 93 | |
| 94 | function buildRequiresActionDetails( |
| 95 | tool: Tool, |
| 96 | input: Record<string, unknown>, |
| 97 | toolUseID: string, |
| 98 | requestId: string, |
| 99 | ): RequiresActionDetails { |
| 100 | // Per-tool summary methods may throw on malformed input; permission |
| 101 | // handling must not break because of a bad description. |
| 102 | let description: string |
| 103 | try { |
| 104 | description = |
| 105 | tool.getActivityDescription?.(input) ?? |
| 106 | tool.getToolUseSummary?.(input) ?? |
| 107 | tool.userFacingName(input) |
| 108 | } catch { |
| 109 | description = tool.name |
| 110 | } |
| 111 | return { |
| 112 | tool_name: tool.name, |
| 113 | action_description: description, |
| 114 | tool_use_id: toolUseID, |
| 115 | request_id: requestId, |
| 116 | input, |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | type PendingRequest<T> = { |
| 121 | resolve: (result: T) => void |
no test coverage detected