{"record":{"id":"e3bfb3dc5f513869","repo":"vercel/ai","slug":"server-does-not-support-tools","errorCode":null,"errorMessage":"Server does not support tools","messagePattern":"Server does not support tools","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":724,"sourceCode":"      : this.transport.send(message, options);\n  }\n\n  private assertCapability(method: string): void {\n    switch (method) {\n      case 'initialize':\n      case 'server/discover':\n        break;\n      case 'completion/complete':\n        if (!this.serverCapabilities.completions) {\n          throw new MCPClientError({\n            message: `Server does not support completions`,\n          });\n        }\n        break;\n      case 'tools/list':\n      case 'tools/call':\n        if (!this.serverCapabilities.tools) {\n          throw new MCPClientError({\n            message: `Server does not support tools`,\n          });\n        }\n        break;\n      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`,","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L706-L742","documentation":"MCPClientError thrown by DefaultMCPClient.assertCapability when a request method ('tools/list' or 'tools/call') is invoked but the MCP server did not advertise the `tools` capability during the initialize handshake. The client checks `this.serverCapabilities.tools` (captured from the initialize result at mcp-client.ts:660) before sending the request. It fails fast locally instead of sending a request the server will reject.","triggerScenarios":"Calling client.listTools(), client.tools(), or a tool call ('tools/call') against a server whose initialize result omits `capabilities.tools`. Also occurs when the client was never initialized properly so serverCapabilities remains the empty object {} (mcp-client.ts:424).","commonSituations":"Connecting to an MCP server that only exposes resources or prompts (e.g. a documentation server); pointing at an older/limited MCP server implementation that predates tool support; forgetting to call init() before using tools so capabilities were never negotiated; proxies/gateways that strip the capabilities object from the initialize response.","solutions":["Verify the MCP server actually supports tools by inspecting the capabilities object in its initialize response","Ensure client.init() is awaited before calling tools/list or tools/call so serverCapabilities is populated","Switch to a server implementation that advertises tool support, or remove the tool calls if the server only offers resources/prompts","If behind a proxy, check that it forwards the full initialize result unchanged"],"exampleFix":"// before: assumes tools exist\nconst client = new DefaultMCPClient({ url: mcpUrl });\nconst tools = await client.tools();\n\n// after: initialize first and handle unsupported capability\nconst client = new DefaultMCPClient({ url: mcpUrl });\nawait client.init();\ntry {\n  const tools = await client.tools();\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.includes('does not support tools')) {\n    // fall back to a non-tool integration\n  }\n}","handlingStrategy":"try-catch","validationCode":"await client.init();\n// inspect negotiated capabilities if exposed, or track them from the initialize result\nconst toolsSupported = !!initResult.capabilities?.tools;\nif (!toolsSupported) throw new Error('Server does not support tools');","typeGuard":"function supportsTools(error: unknown): error is MCPClientError {\n  return MCPClientError.isInstance(error) && error.message.includes('does not support tools');\n}","tryCatchPattern":"try {\n  const tools = await client.tools();\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.includes('does not support tools')) {\n    // fallback: use resources/prompts or surface a capability error\n  } else {\n    throw error;\n  }\n}","preventionTips":["Always await init() before any capability-scoped call","Verify server capabilities in the initialize response during onboarding of a new MCP server","Keep a capability matrix for the MCP servers you connect to"],"tags":["mcp","capability-negotiation","tools","client"],"backgroundTag":"mcp-unsupported-capability","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}