( mcpClients: MCPServerConnection[], tools: Tools, model: string, messages: Message[] | undefined, )
| 1611 | |
| 1612 | // Exported for compact.ts / reactiveCompact.ts — single source of truth for the gate. |
| 1613 | export 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 | |
| 1640 | function getCriticalSystemReminderAttachment( |
| 1641 | toolUseContext: ToolUseContext, |
no test coverage detected