MCPcopy Create free account
hub / github.com/Noumena-Network/code / getToolUseIdsFromMessage

Function getToolUseIdsFromMessage

src/utils/collapseReadSearch.ts:481–497  ·  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

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

Callers 2

collapseReadSearchGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected