* Check if a message contains tool_use blocks with any of the given ids
(message: Message, toolUseIds: Set<string>)
| 173 | * Check if a message contains tool_use blocks with any of the given ids |
| 174 | */ |
| 175 | function hasToolUseWithIds(message: Message, toolUseIds: Set<string>): boolean { |
| 176 | if (message.type !== 'assistant') { |
| 177 | return false |
| 178 | } |
| 179 | const content = message.message.content |
| 180 | if (!Array.isArray(content)) { |
| 181 | return false |
| 182 | } |
| 183 | return content.some( |
| 184 | block => block.type === 'tool_use' && toolUseIds.has(block.id), |
| 185 | ) |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Adjust the start index to ensure we don't split tool_use/tool_result pairs |
no test coverage detected