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

Function getMcpInstructionsDeltaAttachment

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

Source from the content-addressed store, hash-verified

1557
1558// Exported for compact.ts / reactiveCompact.ts — single source of truth for the gate.
1559export function getMcpInstructionsDeltaAttachment(
1560 mcpClients: MCPServerConnection[],
1561 tools: Tools,
1562 model: string,
1563 messages: Message[] | undefined,
1564): Attachment[] {
1565 if (!isMcpInstructionsDeltaEnabled()) return []
1566
1567 // The chrome ToolSearch hint is client-authored and ToolSearch-conditional;
1568 // actual server `instructions` are unconditional. Decide the chrome part
1569 // here, pass it into the pure diff as a synthesized entry.
1570 const clientSide: ClientSideInstruction[] = []
1571 if (
1572 isToolSearchEnabledOptimistic() &&
1573 modelSupportsToolReference(model) &&
1574 isToolSearchToolAvailable(tools)
1575 ) {
1576 clientSide.push({
1577 serverName: CLAUDE_IN_CHROME_MCP_SERVER_NAME,
1578 block: CHROME_TOOL_SEARCH_INSTRUCTIONS,
1579 })
1580 }
1581
1582 const delta = getMcpInstructionsDelta(mcpClients, messages ?? [], clientSide)
1583 if (!delta) return []
1584 return [{ type: 'mcp_instructions_delta', ...delta }]
1585}
1586
1587function getCriticalSystemReminderAttachment(
1588 toolUseContext: ToolUseContext,

Callers 3

getAttachmentsFunction · 0.85
compactConversationFunction · 0.85

Calls 6

getMcpInstructionsDeltaFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected