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