{"record":{"id":"39cb1d44ace8c508","repo":"ComposioHQ/composio","slug":"failed-to-validate-update-params","errorCode":null,"errorMessage":"Failed to validate update params","messagePattern":"Failed to validate update params","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/MCP.ts","lineNumber":376,"sourceCode":"   *\n   * console.log(\"Updated server:\", fullyUpdatedServer.name);\n   * console.log(\"New tools:\", fullyUpdatedServer.allowedTools);\n   * ```\n   *\n   * @throws {ValidationError} When the update parameters are invalid or malformed\n   * @throws {Error} When the server ID doesn't exist or update fails\n   *\n   * @note Only provided fields will be updated. Omitted fields will retain their current values.\n   * @note When updating toolkits, the entire toolkit configuration is replaced, not merged.\n   */\n  async update(\n    serverId: string,\n    config: MCPUpdateParams,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<MCPItem> {\n    const { data: params, error } = MCPUpdateParamsSchema.safeParse(config);\n    if (error) {\n      throw new ValidationError('Failed to validate update params', {\n        cause: error,\n      });\n    }\n\n    const toolkits: string[] = [];\n    const auth_config_ids: string[] = [];\n    const custom_tools: string[] | undefined = params.allowedTools ?? undefined;\n\n    // extract all the toolkits, authconfigs, and allowed tools to separate slugs\n    params.toolkits?.forEach(toolkit => {\n      if (typeof toolkit === 'string') {\n        toolkits.push(toolkit);\n      } else if (toolkit.toolkit) {\n        toolkits.push(toolkit.toolkit);\n      } else if (toolkit.authConfigId) {\n        auth_config_ids.push(toolkit.authConfigId);\n      }\n    });","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/MCP.ts#L358-L394","documentation":"The config passed to mcpConfigs.update() failed validation against MCPUpdateParamsSchema. The SDK validates update payloads client-side and throws ValidationError with the Zod issues attached.","triggerScenarios":"Calling update(serverId, config) with invalid fields — wrong types for toolkits/auth config ids, missing required update fields, or keys not in MCPUpdateParamsSchema.","commonSituations":"Reusing a creation payload for update when the schemas differ; partial updates sent with undefined required fields; schema drift after upgrading @composio/core.","solutions":["Inspect error.cause issues list","Match the payload to MCPUpdateParamsSchema exactly","Type the payload against the exported MCPUpdateParams type"],"exampleFix":"// before\nawait mcp.configs.update(id, { toolkit: ['github'] });\n// after\nawait mcp.configs.update(id, { toolkits: ['github'] });","handlingStrategy":"type-guard","validationCode":"import { MCPUpdateParamsSchema } from '@composio/core';\nconst r = MCPUpdateParamsSchema.safeParse(config);\nif (!r.success) throw new Error(JSON.stringify(r.error.issues));\nawait mcp.configs.update(serverId, config);","typeGuard":"const isMcpUpdateParams = (c: unknown): c is MCPUpdateParams =>\n  MCPUpdateParamsSchema.safeParse(c).success;","tryCatchPattern":"try { await mcp.configs.update(id, cfg); } catch (e) { if (e instanceof ValidationError && /update params/.test(e.message)) { rebuildCfg(e.cause); return; } throw e; }","preventionTips":["Don't reuse create payloads for updates","Type update payloads with exported types","Diff create/update schemas when upgrading"],"tags":["mcp","zod","validation","typescript"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}