MCPcopy
hub / github.com/codeaashu/claude-code / collectCompactableToolIds

Function collectCompactableToolIds

src/services/compact/microCompact.ts:226–241  ·  view source on GitHub ↗

* Walk messages and collect tool_use IDs whose tool name is in * COMPACTABLE_TOOLS, in encounter order. Shared by both microcompact paths.

(messages: Message[])

Source from the content-addressed store, hash-verified

224 * COMPACTABLE_TOOLS, in encounter order. Shared by both microcompact paths.
225 */
226function collectCompactableToolIds(messages: Message[]): string[] {
227 const ids: string[] = []
228 for (const message of messages) {
229 if (
230 message.type === 'assistant' &&
231 Array.isArray(message.message.content)
232 ) {
233 for (const block of message.message.content) {
234 if (block.type === 'tool_use' && COMPACTABLE_TOOLS.has(block.name)) {
235 ids.push(block.id)
236 }
237 }
238 }
239 }
240 return ids
241}
242
243// Prefix-match because promptCategory.ts sets the querySource to
244// 'repl_main_thread:outputStyle:<style>' when a non-default output style

Callers 2

cachedMicrocompactPathFunction · 0.85

Calls 2

hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected