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