{"record":{"id":"5769a224ed4481a4","repo":"ComposioHQ/composio","slug":"failed-to-parse-mcp-generate-url-response","errorCode":null,"errorMessage":"Failed to parse MCP generate URL response","messagePattern":"Failed to parse MCP generate URL response","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/transformers/mcp.ts","lineNumber":158,"sourceCode":"  }\n\n  return result.data;\n}\n\n/**\n * Transform MCP generate URL response from snake_case to camelCase\n */\nexport function transformMcpGenerateUrlResponse(\n  response: GenerateURLResponseRaw\n): GenerateURLResponse {\n  const result = GenerateURLResponseSchema.safeParse({\n    connectedAccountUrls: response.connected_account_urls,\n    userIdsUrl: response.user_ids_url,\n    mcpUrl: response.mcp_url,\n  });\n\n  if (!result.success) {\n    throw new ValidationError('Failed to parse MCP generate URL response', {\n      cause: result.error,\n    });\n  }\n\n  return result.data;\n}\n","sourceCodeStart":140,"sourceCodeEnd":165,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/transformers/mcp.ts#L140-L165","documentation":"transformMcpGenerateUrlResponse validates the generated MCP connection URLs (connectedAccountUrls, userIdsUrl, mcpUrl); failure throws ValidationError with the Zod parse error as cause.","triggerScenarios":"Generating MCP URLs (e.g. composio.mcp.generateUrl / getMcpUrl flows) when the backend response omits or malforms connected_account_urls, user_ids_url, or mcp_url.","commonSituations":"Backend contract change; no connected accounts/user ids in scope returning a different envelope; SDK behind backend version.","solutions":["Upgrade @composio/core","Inspect error.cause to identify the missing/malformed URL field","Ensure the request included valid toolkits/connected-account parameters","Report with the raw response if on latest"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const urls = await composio.mcp.generateUrl(/* ... */); } catch (e) { if (e instanceof ValidationError) { /* inspect e.cause for missing URL field */ } throw e; }","preventionTips":["Pass valid toolkits/connected-account parameters when generating URLs","Upgrade SDK when backend URL endpoints change","Log the failing field from ZodError issues"],"tags":["mcp","validation","zod","urls"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}