( content: BetaContentBlock[], toolName: string, )
| 13 | * Extract tool use block from message content by tool name. |
| 14 | */ |
| 15 | export function extractToolUseBlock( |
| 16 | content: BetaContentBlock[], |
| 17 | toolName: string, |
| 18 | ): Extract<BetaContentBlock, { type: 'tool_use' }> | null { |
| 19 | const block = content.find(b => b.type === 'tool_use' && b.name === toolName) |
| 20 | if (!block || block.type !== 'tool_use') { |
| 21 | return null |
| 22 | } |
| 23 | return block |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Parse and validate classifier response from tool use block. |
no outgoing calls
no test coverage detected