vercel/ai · error · MCPClientError

Unsupported method: ${method}

Error message

Unsupported method: ${method}

What it means

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.

Source

Thrown at packages/mcp/src/tool/mcp-client.ts:747

      case 'resources/list':
      case 'resources/read':
      case 'resources/templates/list':
        if (!this.serverCapabilities.resources) {
          throw new MCPClientError({
            message: `Server does not support resources`,
          });
        }
        break;
      case 'prompts/list':
      case 'prompts/get':
        if (!this.serverCapabilities.prompts) {
          throw new MCPClientError({
            message: `Server does not support prompts`,
          });
        }
        break;
      default:
        throw new MCPClientError({
          message: `Unsupported method: ${method}`,
        });
    }
  }

  private async request<T extends z.ZodType<object>>({
    request,
    resultSchema,
    options,
  }: {
    request: Request;
    resultSchema: T;
    options?: RequestOptions;
  }): Promise<z.infer<T>> {
    return new Promise((resolve, reject) => {
      if (this.isClosed) {
        return reject(
          new MCPClientError({

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use the documented public APIs (listTools, callTool, listResources, readResource, listPrompts, etc.) instead of the generic request path
  2. Fix the method name spelling/namespace (e.g. 'tools/list' not 'tool/list')
  3. Check the SDK version supports the method; upgrade packages/mcp if a newer MCP spec method is needed
  4. Add a switch/mapping in your code that only dispatches known-supported methods

Example fix

// before
class, do not hand-roll: await (client as any).request({ method: 'tool/list', params: {} });

// after
const tools = await client.listTools();
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_METHODS = ['tools/list','tools/call','resources/list','resources/read','resources/templates/list','prompts/list','prompts/get'];
if (!SUPPORTED_METHODS.includes(method)) {
  throw new Error(`Method not supported by this SDK: ${method}`);
}

Type guard

function isSupportedMethod(m: string): m is 'tools/list' | 'tools/call' | 'resources/list' | 'resources/read' | 'resources/templates/list' | 'prompts/list' | 'prompts/get' {
  return ['tools/list','tools/call','resources/list','resources/read','resources/templates/list','prompts/list','prompts/get'].includes(m);
}

Try / catch

try {
  await client.request({ method, params });
} catch (error) {
  if (MCPClientError.isInstance(error) && error.message.startsWith('Unsupported method:')) {
    // fix method name or use public API wrappers
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/dc338a87f47d5486. Report an issue: GitHub.