{"record":{"id":"d2e1e6f040de886e","repo":"vercel/ai","slug":"server-does-not-support-resources","errorCode":null,"errorMessage":"Server does not support resources","messagePattern":"Server does not support resources","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":733,"sourceCode":"        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`,\n          });\n        }\n        break;\n      default:\n        throw new MCPClientError({\n          message: `Unsupported method: ${method}`,\n        });\n    }\n  }","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L715-L751","documentation":"MCPClientError thrown by assertCapability when 'resources/list', 'resources/read', or 'resources/templates/list' is requested but the server did not advertise the `resources` capability during initialize. The client validates `this.serverCapabilities.resources` before dispatching, avoiding a guaranteed server-side rejection.","triggerScenarios":"Calling client.listResources(), client.readResource(), or listResourceTemplates() against a server whose initialize result lacks `capabilities.resources`, or before init() has populated serverCapabilities.","commonSituations":"Using a tools-only MCP server (the most common server type, e.g. filesystem or database tool servers) and assuming it also exposes resources; connecting to a minimal server implementation; stale client code written for a server that later dropped resource support.","solutions":["Check the server's advertised capabilities in the initialize response before calling resource methods","Await client.init() before any resources/* request so capabilities are negotiated","Use a server that implements the resources capability, or migrate to tool-based access if that is all the server offers","Guard resource calls behind a capability check in application code"],"exampleFix":"// before\nawait client.init();\nconst resources = await client.listResources({ params: {} });\n\n// after\nawait client.init();\nif (!serverAdvertisesResources) {\n  throw new Error('This MCP server does not expose resources; use tools instead');\n}\nconst resources = await client.listResources({ params: {} });","handlingStrategy":"try-catch","validationCode":"await client.init();\nconst resourcesSupported = !!initResult.capabilities?.resources;\nif (!resourcesSupported) throw new Error('Server does not expose resources');","typeGuard":"function isResourcesUnsupported(error: unknown): error is MCPClientError {\n  return MCPClientError.isInstance(error) && error.message.includes('does not support resources');\n}","tryCatchPattern":"try {\n  const resources = await client.listResources({ params: {} });\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.includes('does not support resources')) {\n    // degrade gracefully: skip resource UI or use tools\n  } else {\n    throw error;\n  }\n}","preventionTips":["Check the server's advertised resources capability before building resource-dependent features","Initialize the client before any resources/* request","Prefer tools-only servers to expose data via tools when resources are unavailable"],"tags":["mcp","capability-negotiation","resources","client"],"backgroundTag":"mcp-unsupported-capability","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}