* Get all tool use IDs from a single message (handles grouped tool uses).
(msg: RenderableMessage)
| 450 | * Get all tool use IDs from a single message (handles grouped tool uses). |
| 451 | */ |
| 452 | function getToolUseIdsFromMessage(msg: RenderableMessage): string[] { |
| 453 | if (msg.type === 'assistant') { |
| 454 | const content = msg.message.content[0] |
| 455 | if (content?.type === 'tool_use') { |
| 456 | return [content.id] |
| 457 | } |
| 458 | } |
| 459 | if (msg.type === 'grouped_tool_use') { |
| 460 | return msg.messages |
| 461 | .map(m => { |
| 462 | const content = m.message.content[0] |
| 463 | return content.type === 'tool_use' ? content.id : '' |
| 464 | }) |
| 465 | .filter(Boolean) |
| 466 | } |
| 467 | return [] |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Get all tool use IDs from a collapsed read/search group. |
no outgoing calls
no test coverage detected