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

  1. Upgrade @composio/core
  2. Read error.cause ZodError to pinpoint the failing field
  3. Confirm the MCP server id is valid and fully provisioned before retrieval
  4. 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

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.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/237ef4fda2ba3659. Report an issue: GitHub.