{"record":{"id":"04c20aae72275faa","repo":"vercel/ai","slug":"server-does-not-support-prompts","errorCode":null,"errorMessage":"Server does not support prompts","messagePattern":"Server does not support prompts","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":741,"sourceCode":"        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  }\n\n  private async request<T extends z.ZodType<object>>({\n    request,\n    resultSchema,\n    options,\n  }: {\n    request: Request;\n    resultSchema: T;","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L723-L759","documentation":"MCPClientError thrown by assertCapability when 'prompts/list' or 'prompts/get' is requested but the server did not advertise the `prompts` capability during the initialize handshake. The client checks `this.serverCapabilities.prompts` before dispatching the request.","triggerScenarios":"Calling client.listPrompts() or a prompts/get request against a server whose initialize result omits `capabilities.prompts`, or calling before init() so serverCapabilities is still {}.","commonSituations":"Pointing prompt-template UI code at a tools-only MCP server (most MCP servers implement tools but not prompts); server was updated/rolled back and dropped prompt support; client connected to the wrong endpoint URL.","solutions":["Confirm the server advertises `prompts` in its initialize capabilities","Call and await init() before prompts/* requests","Use a server that implements the prompts capability, or refactor to retrieve prompts another way (e.g. resources or a local template store)","Verify you are connecting to the intended MCP server URL"],"exampleFix":"// before\nconst prompts = await client.listPrompts({ params: {} });\n\n// after\nawait client.init();\ntry {\n  const prompts = await client.listPrompts({ params: {} });\n} catch (error) {\n  if (MCPClientError.isInstance(error)) {\n    // handle prompts unsupported: fall back to local prompt templates\n  }\n}","handlingStrategy":"try-catch","validationCode":"await client.init();\nconst promptsSupported = !!initResult.capabilities?.prompts;\nif (!promptsSupported) throw new Error('Server does not expose prompts');","typeGuard":"function isPromptsUnsupported(error: unknown): error is MCPClientError {\n  return MCPClientError.isInstance(error) && error.message.includes('does not support prompts');\n}","tryCatchPattern":"try {\n  const prompts = await client.listPrompts({ params: {} });\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.includes('does not support prompts')) {\n    // fall back to local prompt templates\n  } else {\n    throw error;\n  }\n}","preventionTips":["Confirm prompt support in the initialize handshake before wiring prompt UI","Await client init before prompts/* calls","Maintain local fallback prompt templates for servers without prompts capability"],"tags":["mcp","capability-negotiation","prompts","client"],"backgroundTag":"mcp-unsupported-capability","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}