MCPcopy Create free account
hub / github.com/Noumena-Network/code / getToolResultIds

Function getToolResultIds

src/services/compact/sessionMemoryCompact.ts:156–171  ·  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

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected