{"record":{"id":"f5ecf687be7fb18f","repo":"ComposioHQ/composio","slug":"failed-to-validate-list-options","errorCode":null,"errorMessage":"Failed to validate list options","messagePattern":"Failed to validate list options","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/MCP.ts","lineNumber":187,"sourceCode":"   *\n   * // Filter by toolkit\n   * const githubServers = await composio.experimental.mcp.list({\n   *   toolkits: ['github', 'slack']\n   * });\n   *\n   * // Filter by name\n   * const namedServers = await composio.experimental.mcp.list({\n   *   name: 'personal'\n   * });\n   * ```\n   */\n  async list(\n    options: MCPListParams,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<MCPListResponse> {\n    const { data: params, error } = MCPListParamsSchema.safeParse(options);\n    if (error) {\n      throw new ValidationError('Failed to validate list options', {\n        cause: error,\n      });\n    }\n\n    const listParams = {\n      page_no: params.page,\n      limit: params.limit,\n      toolkits: params.toolkits?.length > 0 ? params.toolkits.join(',') : undefined,\n      auth_config_ids: params.authConfigs?.length > 0 ? params.authConfigs.join(',') : undefined,\n      name: params.name,\n    };\n    const listResponse = await withCancellation(\n      () => this.client.mcp.list(listParams, requestOptions),\n      requestOptions?.signal\n    );\n\n    const transformedListResponse = transform(listResponse)\n      .with(MCPListResponseSchema)","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/MCP.ts#L169-L205","documentation":"The options object passed to mcpConfigs.list() failed Zod validation against MCPListParamsSchema before the request was made. Typical causes are wrong pagination field types or unsupported filter keys.","triggerScenarios":"Calling list/listResponse with e.g. page as a string, negative page numbers, or unknown properties rejected by MCPListParamsSchema.","commonSituations":"Passing query-string-derived values (always strings) straight into list(); using an options shape copied from a different SDK version; spreading extra filters the schema strict-rejects.","solutions":["Check error.cause for the failing field","Coerce pagination values to numbers before calling list()","Pass only documented MCPListParams fields"],"exampleFix":"// before\nawait mcp.configs.list({ page: req.query.page });\n// after\nawait mcp.configs.list({ page: Number(req.query.page ?? 1) });","handlingStrategy":"validation","validationCode":"const page = Number(options?.page ?? 1);\nif (!Number.isInteger(page) || page < 1) throw new Error('invalid page');\nawait mcp.configs.list({ page });","typeGuard":"const isMcpListParams = (o: unknown): o is MCPListParams =>\n  MCPListParamsSchema.safeParse(o).success;","tryCatchPattern":"try { await mcp.configs.list(opts); } catch (e) { if (e instanceof ValidationError && /list options/.test(e.message)) { opts = { page: 1 }; await mcp.configs.list(opts); return; } throw e; }","preventionTips":["Coerce query params to numbers before calling list()","Pass only documented fields","Default page when source data is untrusted"],"tags":["mcp","pagination","zod","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}