(mcpClients: MCPServerConnection[])
| 577 | } |
| 578 | |
| 579 | function getMcpInstructions(mcpClients: MCPServerConnection[]): string | null { |
| 580 | const connectedClients = mcpClients.filter( |
| 581 | (client): client is ConnectedMCPServer => client.type === 'connected', |
| 582 | ) |
| 583 | |
| 584 | const clientsWithInstructions = connectedClients.filter( |
| 585 | client => client.instructions, |
| 586 | ) |
| 587 | |
| 588 | if (clientsWithInstructions.length === 0) { |
| 589 | return null |
| 590 | } |
| 591 | |
| 592 | const instructionBlocks = clientsWithInstructions |
| 593 | .map(client => { |
| 594 | return `## ${client.name} |
| 595 | ${client.instructions}` |
| 596 | }) |
| 597 | .join('\n\n') |
| 598 | |
| 599 | return `# MCP Server Instructions |
| 600 | |
| 601 | The following MCP servers have provided instructions for how to use their tools and resources: |
| 602 | |
| 603 | ${instructionBlocks}` |
| 604 | } |
| 605 | |
| 606 | export async function computeEnvInfo( |
| 607 | modelId: string, |
no outgoing calls
no test coverage detected