* Check if a message contains tool_result blocks and return their tool_use_ids
(message: Message)
| 153 | * Check if a message contains tool_result blocks and return their tool_use_ids |
| 154 | */ |
| 155 | function getToolResultIds(message: Message): string[] { |
| 156 | if (message.type !== 'user') { |
| 157 | return [] |
| 158 | } |
| 159 | const content = message.message.content |
| 160 | if (!Array.isArray(content)) { |
| 161 | return [] |
| 162 | } |
| 163 | const ids: string[] = [] |
| 164 | for (const block of content) { |
| 165 | if (block.type === 'tool_result') { |
| 166 | ids.push(block.tool_use_id) |
| 167 | } |
| 168 | } |
| 169 | return ids |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Check if a message contains tool_use blocks with any of the given ids |
no test coverage detected