MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isCollapsibleToolUse

Function isCollapsibleToolUse

src/utils/collapseReadSearch.ts:406–425  ·  view source on GitHub ↗

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

(
  msg: RenderableMessage,
  tools: Tools,
)

Source from the content-addressed store, hash-verified

404 * Type predicate: Check if a message is a collapsible tool use.
405 */
406function isCollapsibleToolUse(
407 msg: RenderableMessage,
408 tools: Tools,
409): msg is CollapsibleMessage {
410 if (msg.type === 'assistant') {
411 const content = msg.message.content[0]
412 return (
413 content?.type === 'tool_use' &&
414 isToolSearchOrRead(content.name, content.input, tools)
415 )
416 }
417 if (msg.type === 'grouped_tool_use') {
418 const firstContent = msg.messages[0]?.message.content[0]
419 return (
420 firstContent?.type === 'tool_use' &&
421 isToolSearchOrRead(msg.toolName, firstContent.input, tools)
422 )
423 }
424 return false
425}
426
427/**
428 * 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