ComposioHQ/composio · error · ValidationError

Invalid parameters passed to create mcp config

Error message

Invalid parameters passed to create mcp config

What it means

The mcpConfigs.create() arguments failed validation against MCPConfigCreationParamsSchema. The SDK validates the MCP server config (name, toolkits, auth config ids, etc.) before sending it, and attaches the Zod error as cause.

Source

Thrown at ts/packages/core/src/models/MCP.ts:95

   *  }
   * });
   *
   * const server = await composio.mcpConfig.create("personal-mcp-server", {
   *   toolkits: [{ toolkit: "gmail", authConfigId: "ac_243434343" }],
   *   allowedTools: ["GMAIL_FETCH_EMAILS"],
   *   manuallyManageConnections: false
   *  }
   * });
   * ```
   */
  async create(
    name: string,
    mcpConfig: MCPConfigCreationParams,
    requestOptions?: ComposioRequestOptions
  ): Promise<MCPConfigCreateResponse> {
    const config = MCPConfigCreationParamsSchema.safeParse(mcpConfig);
    if (config.error) {
      throw new ValidationError('Invalid parameters passed to create mcp config', {
        cause: config.error,
      });
    }

    const toolkits: string[] = [];
    const auth_config_ids: string[] = [];
    const custom_tools: string[] = config.data.allowedTools ?? [];

    // extract all the toolkits, authconfigs, and allowed tools to separate slugs
    config.data.toolkits.forEach(toolkit => {
      if (typeof toolkit === 'string') {
        toolkits.push(toolkit);
      } else if (toolkit.toolkit) {
        toolkits.push(toolkit.toolkit);
      } else if (toolkit.authConfigId) {
        auth_config_ids.push(toolkit.authConfigId);
      }
    });

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Read error.cause (ZodError.issues) for the exact failing fields
  2. Align the object with MCPConfigCreationParamsSchema (e.g. toolkits: string[], correct auth shapes)
  3. Use the SDK's exported types (satisfies MCPConfigCreationParams) for compile-time checks

Example fix

// before
await mcp.configs.create('srv', { toolkits: 'github', auths: [123] });
// after
await mcp.configs.create('srv', { toolkits: ['github'] });
Defensive patterns

Strategy: type-guard

Validate before calling

import { MCPConfigCreationParamsSchema } from '@composio/core';
const r = MCPConfigCreationParamsSchema.safeParse(config);
if (!r.success) throw new Error(JSON.stringify(r.error.issues, null, 2));
await mcp.configs.create(name, config);

Type guard

const isMcpConfig = (c: unknown): c is MCPConfigCreationParams =>
  MCPConfigCreationParamsSchema.safeParse(c).success;

Try / catch

try { await mcp.configs.create(name, cfg); } catch (e) { if (e instanceof ValidationError && /create mcp config/.test(e.message)) { fixFromZod(e.cause); return; } throw e; }

Prevention

When it happens

Trigger: Calling composio.mcp.configs.create(name, config) with an invalid config object — unknown keys, wrong types for toolkits/auths, or missing required fields per MCPConfigCreationParamsSchema.

Common situations: Hand-building the config from backend API docs instead of SDK types; version drift after the MCP config schema changed; passing tool names where toolkit ids are expected.

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