ComposioHQ/composio · error · ValidationError
Failed to parse MCP retrieve response
Error message
Failed to parse MCP retrieve response
What it means
transformMcpRetrieveResponse validates a single MCP server's retrieved payload (toolkits, authConfigIds, commands, mcpUrl, etc.) against Zod; failure throws ValidationError with the parse error as cause.
Source
Thrown at ts/packages/core/src/utils/transformers/mcp.ts:95
export function transformMcpRetrieveResponse(
response: McpRetrieveResponseRaw
): McpRetrieveResponse {
const result = McpRetrieveResponseSchema.safeParse({
id: response.id,
name: response.name,
createdAt: response.created_at,
updatedAt: response.updated_at,
status: (response as unknown as Record<string, unknown>).status,
toolkits: response.toolkits,
tools: response.allowed_tools,
managedAuthViaComposio: response.managed_auth_via_composio,
authConfigIds: response.auth_config_ids,
mcpUrl: response.mcp_url,
commands: response.commands,
});
if (!result.success) {
throw new ValidationError('Failed to parse MCP retrieve response', {
cause: result.error,
});
}
return result.data;
}
/**
* Transform MCP delete response from snake_case to camelCase
*/
export function transformMcpDeleteResponse(response: McpDeleteResponseRaw): McpDeleteResponse {
const result = McpDeleteResponseSchema.safeParse({
id: (response as unknown as Record<string, unknown>).id,
deleted: (response as unknown as Record<string, unknown>).deleted,
message: (response as unknown as Record<string, unknown>).message,
});
if (!result.success) {View on GitHub (pinned to 64b1b85502)
Solutions
- Upgrade @composio/core
- Read error.cause ZodError to pinpoint the failing field
- Confirm the MCP server id is valid and fully provisioned before retrieval
- Report contract drift with the raw JSON if versions are aligned
Defensive patterns
Strategy: try-catch
Try / catch
try { const server = await composio.mcp.get(id); } catch (e) { if (e instanceof ValidationError && e.cause) { /* log issues, verify id, upgrade */ } throw e; } Prevention
- Validate MCP ids before retrieval
- Upgrade @composio/core alongside backend changes
- Capture raw responses in debug logs for contract-drift reports
When it happens
Trigger: Retrieving an MCP server by id (composio.mcp.get/retrieve) where the backend response contains fields in unexpected types/shapes, e.g. commands not matching the expected schema.
Common situations: Version skew between SDK transformer and backend; newly introduced MCP server states or command formats; self-hosted backend with divergent contract.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse MCP create response
- Failed to parse MCP list response
- Invalid parameters passed to create mcp config
- Failed to validate list options
- Failed to validate update params
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/237ef4fda2ba3659.
Report an issue: GitHub.