MCPcopy Create free account
hub / github.com/WJX20/claude-code / getToolUseIdsFromMessage

Function getToolUseIdsFromMessage

src/utils/collapseReadSearch.ts:476–493  ·  view source on GitHub ↗

* Get all tool use IDs from a single message (handles grouped tool uses).

(msg: RenderableMessage)

Source from the content-addressed store, hash-verified

474 * Get all tool use IDs from a single message (handles grouped tool uses).
475 */
476function getToolUseIdsFromMessage(msg: RenderableMessage): string[] {
477 if (msg.type === 'assistant') {
478 const content = getFirstContentItem(msg.message?.content)
479 if (content && content.type === 'tool_use') {
480 return [(content as { id: string }).id]
481 }
482 }
483 if (msg.type === 'grouped_tool_use') {
484 return msg.messages
485 .map(m => {
486 const content = getFirstContentItem(m.message?.content)
487 if (!content) return ''
488 return content.type === 'tool_use' ? (content as { id: string }).id : ''
489 })
490 .filter(Boolean)
491 }
492 return []
493}
494
495/**
496 * Get all tool use IDs from a collapsed read/search group.

Callers 2

collapseReadSearchGroupsFunction · 0.85

Calls 1

getFirstContentItemFunction · 0.85

Tested by

no test coverage detected