MCPcopy
hub / github.com/simstudioai/sim / parseMcpToolId

Function parseMcpToolId

apps/sim/lib/mcp/utils.ts:189–199  ·  view source on GitHub ↗
(toolId: string)

Source from the content-addressed store, hash-verified

187 * Parse MCP tool ID to extract server ID and tool name
188 */
189export function parseMcpToolId(toolId: string): { serverId: string; toolName: string } {
190 const parts = toolId.split('-')
191 if (parts.length < 3 || parts[0] !== 'mcp') {
192 throw new Error(`Invalid MCP tool ID format: ${toolId}. Expected: mcp-serverId-toolName`)
193 }
194
195 const serverId = `${parts[0]}-${parts[1]}`
196 const toolName = parts.slice(2).join('-')
197
198 return { serverId, toolName }
199}
200
201/**
202 * Generate a deterministic MCP server ID based on workspace and URL.

Callers 2

executeMcpToolFunction · 0.90
utils.test.tsFile · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected