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

Function hasToolUseWithIds

src/services/compact/sessionMemoryCompact.ts:176–187  ·  view source on GitHub ↗

* Check if a message contains tool_use blocks with any of the given ids

(message: Message, toolUseIds: Set<string>)

Source from the content-addressed store, hash-verified

174 * Check if a message contains tool_use blocks with any of the given ids
175 */
176function hasToolUseWithIds(message: Message, toolUseIds: Set<string>): boolean {
177 if (message.type !== 'assistant') {
178 return false
179 }
180 const content = message.message.content
181 if (!Array.isArray(content)) {
182 return false
183 }
184 return content.some(
185 block => block.type === 'tool_use' && toolUseIds.has(block.id),
186 )
187}
188
189/**
190 * Adjust the start index to ensure we don't split tool_use/tool_result pairs

Callers 1

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected