MCPcopy
hub / github.com/claude-code-best/claude-code / getDeferredToolsDeltaAttachment

Function getDeferredToolsDeltaAttachment

src/utils/attachments.ts:1509–1528  ·  view source on GitHub ↗
(
  tools: Tools,
  model: string,
  messages: Message[] | undefined,
  scanContext?: DeferredToolsDeltaScanContext,
)

Source from the content-addressed store, hash-verified

1507
1508// Exported for compact.ts — the gate must be identical at both call sites.
1509export function getDeferredToolsDeltaAttachment(
1510 tools: Tools,
1511 model: string,
1512 messages: Message[] | undefined,
1513 scanContext?: DeferredToolsDeltaScanContext,
1514): Attachment[] {
1515 if (!isDeferredToolsDeltaEnabled()) return []
1516 // These three checks mirror the sync parts of isSearchExtraToolsEnabled —
1517 // the attachment text says "available via SearchExtraTools", so SearchExtraTools
1518 // has to actually be in the request. The async auto-threshold check
1519 // is not replicated (would double-fire tengu_search_extra_tools_mode_decision);
1520 // in tst-auto below-threshold the attachment can fire while SearchExtraTools
1521 // is filtered out, but that's a narrow case and the tools announced
1522 // are directly callable anyway.
1523 if (!isSearchExtraToolsEnabledOptimistic()) return []
1524 if (!isSearchExtraToolsToolAvailable(tools)) return []
1525 const delta = getDeferredToolsDelta(tools, messages ?? [], scanContext)
1526 if (!delta) return []
1527 return [{ type: 'deferred_tools_delta', ...delta }]
1528}
1529
1530/**
1531 * Diff the current filtered agent pool against what's already been announced

Callers 3

getAttachmentsFunction · 0.85
compactConversationFunction · 0.85

Tested by

no test coverage detected