( toolName: string, mcpClients: MCPServerConnection[], )
| 281 | | undefined |
| 282 | |
| 283 | function findMcpServerConnection( |
| 284 | toolName: string, |
| 285 | mcpClients: MCPServerConnection[], |
| 286 | ): MCPServerConnection | undefined { |
| 287 | if (!toolName.startsWith('mcp__')) { |
| 288 | return undefined |
| 289 | } |
| 290 | |
| 291 | const mcpInfo = mcpInfoFromString(toolName) |
| 292 | if (!mcpInfo) { |
| 293 | return undefined |
| 294 | } |
| 295 | |
| 296 | // mcpInfo.serverName is normalized (e.g., "claude_ai_Slack"), but client.name |
| 297 | // is the original name (e.g., "claude.ai Slack"). Normalize both for comparison. |
| 298 | return mcpClients.find( |
| 299 | client => normalizeNameForMCP(client.name) === mcpInfo.serverName, |
| 300 | ) |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Extracts the MCP server transport type from a tool name. |
no test coverage detected