MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isCollapsibleToolUse

Function isCollapsibleToolUse

source code/utils/collapseReadSearch.ts:408–427  ·  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

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