MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / trackResolvedToolUseId

Method trackResolvedToolUseId

src/cli/structuredIO.ts:177–189  ·  view source on GitHub ↗

* Records a tool_use ID as resolved so that late/duplicate control_response * messages for the same tool are ignored by the orphan handler.

(request: SDKControlRequest)

Source from the content-addressed store, hash-verified

175 * messages for the same tool are ignored by the orphan handler.
176 */
177 private trackResolvedToolUseId(request: SDKControlRequest): void {
178 const inner = request.request as { subtype?: string; tool_use_id?: string }
179 if (inner.subtype === 'can_use_tool') {
180 this.resolvedToolUseIds.add(inner.tool_use_id as string)
181 if (this.resolvedToolUseIds.size > MAX_RESOLVED_TOOL_USE_IDS) {
182 // Evict the oldest entry (Sets iterate in insertion order)
183 const first = this.resolvedToolUseIds.values().next().value
184 if (first !== undefined) {
185 this.resolvedToolUseIds.delete(first)
186 }
187 }
188 }
189 }
190
191 /** Flush pending internal events. No-op for non-remote IO. Overridden by RemoteIO. */
192 flushInternalEvents(): Promise<void> {

Callers 3

injectControlResponseMethod · 0.95
processLineMethod · 0.95
abortedMethod · 0.95

Calls 3

nextMethod · 0.80
deleteMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected