(toolString: string)
| 17 | * names typically don't contain double underscores. |
| 18 | */ |
| 19 | export function mcpInfoFromString(toolString: string): { |
| 20 | serverName: string |
| 21 | toolName: string | undefined |
| 22 | } | null { |
| 23 | const parts = toolString.split('__') |
| 24 | const [mcpPart, serverName, ...toolNameParts] = parts |
| 25 | if (mcpPart !== 'mcp' || !serverName) { |
| 26 | return null |
| 27 | } |
| 28 | // Join all parts after server name to preserve double underscores in tool names |
| 29 | const toolName = |
| 30 | toolNameParts.length > 0 ? toolNameParts.join('__') : undefined |
| 31 | return { serverName, toolName } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Generates the MCP tool/command name prefix for a given server |
no outgoing calls
no test coverage detected