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

Function getMcpInstructionsDeltaAttachment

src/utils/attachments.ts:1613–1638  ·  view source on GitHub ↗
(
  mcpClients: MCPServerConnection[],
  tools: Tools,
  model: string,
  messages: Message[] | undefined,
)

Source from the content-addressed store, hash-verified

1611
1612// Exported for compact.ts / reactiveCompact.ts — single source of truth for the gate.
1613export function getMcpInstructionsDeltaAttachment(
1614 mcpClients: MCPServerConnection[],
1615 tools: Tools,
1616 model: string,
1617 messages: Message[] | undefined,
1618): Attachment[] {
1619 if (!isMcpInstructionsDeltaEnabled()) return []
1620
1621 // The chrome SearchExtraTools hint is client-authored and SearchExtraTools-conditional;
1622 // actual server `instructions` are unconditional. Decide the chrome part
1623 // here, pass it into the pure diff as a synthesized entry.
1624 const clientSide: ClientSideInstruction[] = []
1625 if (
1626 isSearchExtraToolsEnabledOptimistic() &&
1627 isSearchExtraToolsToolAvailable(tools)
1628 ) {
1629 clientSide.push({
1630 serverName: CLAUDE_IN_CHROME_MCP_SERVER_NAME,
1631 block: CHROME_SEARCH_EXTRA_TOOLS_INSTRUCTIONS,
1632 })
1633 }
1634
1635 const delta = getMcpInstructionsDelta(mcpClients, messages ?? [], clientSide)
1636 if (!delta) return []
1637 return [{ type: 'mcp_instructions_delta', ...delta }]
1638}
1639
1640function getCriticalSystemReminderAttachment(
1641 toolUseContext: ToolUseContext,

Callers 3

getAttachmentsFunction · 0.85
compactConversationFunction · 0.85

Calls 5

getMcpInstructionsDeltaFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected