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

Function toolUseSearchText

source code/utils/transcriptSearch.ts:136–166  ·  view source on GitHub ↗
(input: unknown)

Source from the content-addressed store, hash-verified

134 * Same duck-type strategy as toolResultSearchText — known field names,
135 * unknown → empty. Under-count > phantom. */
136export function toolUseSearchText(input: unknown): string {
137 if (!input || typeof input !== 'object') return ''
138 const o = input as Record<string, unknown>
139 const parts: string[] = []
140 // renderToolUseMessage typically shows one or two of these as the
141 // primary argument. tool_name itself is in the "⏺ Bash(...)" chrome,
142 // handled by under-count (the overlay matches it but we don't count it).
143 for (const k of [
144 'command',
145 'pattern',
146 'file_path',
147 'path',
148 'prompt',
149 'description',
150 'query',
151 'url',
152 'skill', // SkillTool
153 ]) {
154 const v = o[k]
155 if (typeof v === 'string') parts.push(v)
156 }
157 // args[] (Tmux/TungstenTool), files[] (SendUserFile) — tool-use
158 // renders the joined array as the primary display. Under-count > skip.
159 for (const k of ['args', 'files']) {
160 const v = o[k]
161 if (Array.isArray(v) && v.every(x => typeof x === 'string')) {
162 parts.push((v as string[]).join(' '))
163 }
164 }
165 return parts.join('\n')
166}
167
168/** Duck-type the tool's native Out for searchable text. Known shapes:
169 * {stdout,stderr} (Bash/Shell), {content} (Grep), {file:{content}} (Read),

Callers 1

computeSearchTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected