( parentMessage: AssistantMessage, toolName: string, )
| 28 | * Extracts the tool use ID from a parent message for a given tool name. |
| 29 | */ |
| 30 | export function getToolUseIDFromParentMessage( |
| 31 | parentMessage: AssistantMessage, |
| 32 | toolName: string, |
| 33 | ): string | undefined { |
| 34 | const toolUseBlock = parentMessage.message.content.find( |
| 35 | block => block.type === 'tool_use' && block.name === toolName, |
| 36 | ) |
| 37 | return toolUseBlock && toolUseBlock.type === 'tool_use' |
| 38 | ? toolUseBlock.id |
| 39 | : undefined |
| 40 | } |
no outgoing calls
no test coverage detected