( msg: MessageWithoutProgress, )
| 32 | } |
| 33 | |
| 34 | function getToolUseInfo( |
| 35 | msg: MessageWithoutProgress, |
| 36 | ): { messageId: string; toolUseId: string; toolName: string } | null { |
| 37 | if (msg.type === 'assistant' && msg.message.content[0]?.type === 'tool_use') { |
| 38 | const content = msg.message.content[0] |
| 39 | return { |
| 40 | messageId: msg.message.id, |
| 41 | toolUseId: content.id, |
| 42 | toolName: content.name, |
| 43 | } |
| 44 | } |
| 45 | return null |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Groups tool uses by message.id (same API response) if the tool supports grouped rendering. |