{"record":{"id":"dc338a87f47d5486","repo":"vercel/ai","slug":"unsupported-method-method","errorCode":null,"errorMessage":"Unsupported method: ${method}","messagePattern":"Unsupported method: (.+?)","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":747,"sourceCode":"      case 'resources/list':\n      case 'resources/read':\n      case 'resources/templates/list':\n        if (!this.serverCapabilities.resources) {\n          throw new MCPClientError({\n            message: `Server does not support resources`,\n          });\n        }\n        break;\n      case 'prompts/list':\n      case 'prompts/get':\n        if (!this.serverCapabilities.prompts) {\n          throw new MCPClientError({\n            message: `Server does not support prompts`,\n          });\n        }\n        break;\n      default:\n        throw new MCPClientError({\n          message: `Unsupported method: ${method}`,\n        });\n    }\n  }\n\n  private async request<T extends z.ZodType<object>>({\n    request,\n    resultSchema,\n    options,\n  }: {\n    request: Request;\n    resultSchema: T;\n    options?: RequestOptions;\n  }): Promise<z.infer<T>> {\n    return new Promise((resolve, reject) => {\n      if (this.isClosed) {\n        return reject(\n          new MCPClientError({","sourceCodeStart":729,"sourceCodeEnd":765,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L729-L765","documentation":"MCPClientError thrown by the default branch of assertCapability when a request method is passed that the client does not recognize as one of the supported MCP methods (tools/*, resources/*, prompts/*). It is a client-side guard indicating a programming error or an unsupported/newer MCP method name rather than a server problem.","triggerScenarios":"Calling client.request() (or an internal helper) with a method string outside the supported set, e.g. a typo like 'tool/list', a new spec method the SDK has not implemented (sampling/logging), or an empty method value.","commonSituations":"Hand-rolling an MCP method call through the client's generic request path; upgrading the MCP spec and using a newly introduced method against an older SDK; typos in method names when writing custom tooling around the client.","solutions":["Use the documented public APIs (listTools, callTool, listResources, readResource, listPrompts, etc.) instead of the generic request path","Fix the method name spelling/namespace (e.g. 'tools/list' not 'tool/list')","Check the SDK version supports the method; upgrade packages/mcp if a newer MCP spec method is needed","Add a switch/mapping in your code that only dispatches known-supported methods"],"exampleFix":"// before\nclass, do not hand-roll: await (client as any).request({ method: 'tool/list', params: {} });\n\n// after\nconst tools = await client.listTools();","handlingStrategy":"validation","validationCode":"const SUPPORTED_METHODS = ['tools/list','tools/call','resources/list','resources/read','resources/templates/list','prompts/list','prompts/get'];\nif (!SUPPORTED_METHODS.includes(method)) {\n  throw new Error(`Method not supported by this SDK: ${method}`);\n}","typeGuard":"function isSupportedMethod(m: string): m is 'tools/list' | 'tools/call' | 'resources/list' | 'resources/read' | 'resources/templates/list' | 'prompts/list' | 'prompts/get' {\n  return ['tools/list','tools/call','resources/list','resources/read','resources/templates/list','prompts/list','prompts/get'].includes(m);\n}","tryCatchPattern":"try {\n  await client.request({ method, params });\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.startsWith('Unsupported method:')) {\n    // fix method name or use public API wrappers\n  } else {\n    throw error;\n  }\n}","preventionTips":["Use the typed public methods (listTools, callTool, listResources, ...) instead of raw request","Copy method names exactly from the MCP spec ('tools/list', not 'tool/list')","Upgrade the SDK when adopting newly spec'd MCP methods"],"tags":["mcp","unsupported-method","api-misuse","client"],"backgroundTag":"unsupported-method","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}