( toolName: string, )
| 157 | * detectCodeIndexingFromMcpTool('mcp__filesystem__read') // returns undefined |
| 158 | */ |
| 159 | export function detectCodeIndexingFromMcpTool( |
| 160 | toolName: string, |
| 161 | ): CodeIndexingTool | undefined { |
| 162 | // MCP tool names follow the format: mcp__serverName__toolName |
| 163 | if (!toolName.startsWith('mcp__')) { |
| 164 | return undefined |
| 165 | } |
| 166 | |
| 167 | const parts = toolName.split('__') |
| 168 | if (parts.length < 3) { |
| 169 | return undefined |
| 170 | } |
| 171 | |
| 172 | const serverName = parts[1] |
| 173 | if (!serverName) { |
| 174 | return undefined |
| 175 | } |
| 176 | |
| 177 | for (const { pattern, tool } of MCP_SERVER_PATTERNS) { |
| 178 | if (pattern.test(serverName)) { |
| 179 | return tool |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | return undefined |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Detects if an MCP server name corresponds to a code indexing tool. |
nothing calls this directly
no outgoing calls
no test coverage detected