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

Function isCollapsibleToolUse

src/utils/collapseReadSearch.ts:434–454  ·  view source on GitHub ↗

* Type predicate: Check if a message is a collapsible tool use.

(
  msg: RenderableMessage,
  tools: Tools,
  behavior?: CollapseBehavior,
)

Source from the content-addressed store, hash-verified

432 * Type predicate: Check if a message is a collapsible tool use.
433 */
434function isCollapsibleToolUse(
435 msg: RenderableMessage,
436 tools: Tools,
437 behavior?: CollapseBehavior,
438): msg is CollapsibleMessage {
439 if (msg.type === 'assistant') {
440 const content = msg.message.content[0]
441 return (
442 content?.type === 'tool_use' &&
443 isToolSearchOrRead(content.name, content.input, tools, behavior)
444 )
445 }
446 if (msg.type === 'grouped_tool_use') {
447 const firstContent = msg.messages[0]?.message.content[0]
448 return (
449 firstContent?.type === 'tool_use' &&
450 isToolSearchOrRead(msg.toolName, firstContent.input, tools, behavior)
451 )
452 }
453 return false
454}
455
456/**
457 * Type predicate: Check if a message is a tool result for collapsible tools.

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls 1

isToolSearchOrReadFunction · 0.85

Tested by

no test coverage detected