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

Function getToolSummaryText

source code/utils/streamlinedTransform.ts:75–106  ·  view source on GitHub ↗

* Generate a summary text for tool counts.

(counts: ToolCounts)

Source from the content-addressed store, hash-verified

73 * Generate a summary text for tool counts.
74 */
75function getToolSummaryText(counts: ToolCounts): string | undefined {
76 const parts: string[] = []
77
78 // Use similar phrasing to collapseReadSearch.ts
79 if (counts.searches > 0) {
80 parts.push(
81 `searched ${counts.searches} ${counts.searches === 1 ? 'pattern' : 'patterns'}`,
82 )
83 }
84 if (counts.reads > 0) {
85 parts.push(`read ${counts.reads} ${counts.reads === 1 ? 'file' : 'files'}`)
86 }
87 if (counts.writes > 0) {
88 parts.push(
89 `wrote ${counts.writes} ${counts.writes === 1 ? 'file' : 'files'}`,
90 )
91 }
92 if (counts.commands > 0) {
93 parts.push(
94 `ran ${counts.commands} ${counts.commands === 1 ? 'command' : 'commands'}`,
95 )
96 }
97 if (counts.other > 0) {
98 parts.push(`${counts.other} other ${counts.other === 1 ? 'tool' : 'tools'}`)
99 }
100
101 if (parts.length === 0) {
102 return undefined
103 }
104
105 return capitalize(parts.join(', '))
106}
107
108/**
109 * Count tool uses in an assistant message and add to existing counts.

Callers 1

Calls 1

capitalizeFunction · 0.85

Tested by

no test coverage detected