ComposioHQ/composio · error · ValidationError

Failed to parse MCP create response

Error message

Failed to parse MCP create response

What it means

transformMcpCreateResponse validates the backend's MCP-server create payload against a Zod schema; if safeParse fails, a ValidationError is thrown with the Zod issues as cause. It signals the API response shape does not match the SDK's expectations — usually a backend/API version mismatch.

Source

Thrown at ts/packages/core/src/utils/transformers/mcp.ts:41

  McpRetrieveResponse as McpRetrieveResponseRaw,
} from '@composio/client/resources/mcp';

/**
 * Transform MCP create response from snake_case to camelCase
 */
export function transformMcpCreateResponse(
  response: CustomCreateResponseRaw | McpCreateResponseRaw
): CustomCreateResponse {
  const result = CustomCreateResponseSchema.safeParse({
    id: response.id,
    name: response.name,
    createdAt: (response as unknown as Record<string, unknown>).created_at,
    updatedAt: (response as unknown as Record<string, unknown>).updated_at,
    status: (response as unknown as Record<string, unknown>).status,
  });

  if (!result.success) {
    throw new ValidationError('Failed to parse MCP create response', {
      cause: result.error,
    });
  }

  return result.data;
}

/**
 * Transform MCP list response from snake_case to camelCase
 */
export function transformMcpListResponse(response: McpListResponseRaw): McpListResponse {
  const transformedItems = response.items?.map(item => ({
    id: item.id,
    name: item.name,
    createdAt: item.created_at,
    updatedAt: item.updated_at,
    status: (item as unknown as Record<string, unknown>).status,
  }));

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Upgrade @composio/core to the latest version to realign with the backend contract
  2. Check error.cause (ZodError) to see exactly which fields failed
  3. Verify baseURL points to the intended environment (production vs staging/self-hosted)
  4. Report the Zod issues with the raw response to Composio if versions are current
Defensive patterns

Strategy: try-catch

Try / catch

try { const mcp = await composio.mcp.create(payload); } catch (e) { if (e instanceof ValidationError && /MCP create/.test(e.message)) { console.error('Contract mismatch', e.cause); } throw e; }

Prevention

When it happens

Trigger: Calling composio.mcp.create(...) (or any flow that routes through transformMcpCreateResponse) against a backend that returns unexpected/missing fields such as id, created_at, status, or toolkits.

Common situations: SDK version behind or ahead of the deployed backend; proxy stripping fields; using a self-hosted/staging backend URL with a different contract; generated client drift.

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/f57f67970cd27ab1. Report an issue: GitHub.