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

Function accumulateToolUses

src/utils/streamlinedTransform.ts:109–124  ·  view source on GitHub ↗

* Count tool uses in an assistant message and add to existing counts.

(
  message: SDKAssistantMessage,
  counts: ToolCounts,
)

Source from the content-addressed store, hash-verified

107 * Count tool uses in an assistant message and add to existing counts.
108 */
109function accumulateToolUses(
110 message: SDKAssistantMessage,
111 counts: ToolCounts,
112): void {
113 const content = message.message.content
114 if (!Array.isArray(content)) {
115 return
116 }
117
118 for (const block of content) {
119 if (block.type === 'tool_use' && 'name' in block) {
120 const category = categorizeToolName(block.name as string)
121 counts[category]++
122 }
123 }
124}
125
126/**
127 * Create a stateful transformer that accumulates tool counts between text messages.

Callers 1

Calls 1

categorizeToolNameFunction · 0.85

Tested by

no test coverage detected