MCPcopy Create free account
hub / github.com/codeaashu/claude-code / getToolResultIds

Function getToolResultIds

src/services/compact/sessionMemoryCompact.ts:155–170  ·  view source on GitHub ↗

* Check if a message contains tool_result blocks and return their tool_use_ids

(message: Message)

Source from the content-addressed store, hash-verified

153 * Check if a message contains tool_result blocks and return their tool_use_ids
154 */
155function getToolResultIds(message: Message): string[] {
156 if (message.type !== 'user') {
157 return []
158 }
159 const content = message.message.content
160 if (!Array.isArray(content)) {
161 return []
162 }
163 const ids: string[] = []
164 for (const block of content) {
165 if (block.type === 'tool_result') {
166 ids.push(block.tool_use_id)
167 }
168 }
169 return ids
170}
171
172/**
173 * Check if a message contains tool_use blocks with any of the given ids

Callers 1

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected