{"record":{"id":"ca9823a4cd513cb9","repo":"vercel/ai","slug":"server-does-not-support-completions","errorCode":null,"errorMessage":"Server does not support completions","messagePattern":"Server does not support completions","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":716,"sourceCode":"  }\n\n  private send(\n    message: JSONRPCMessage,\n    options?: MCPTransportSendOptions,\n  ): Promise<void> {\n    return options == null\n      ? this.transport.send(message)\n      : 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`,","sourceCodeStart":698,"sourceCodeEnd":734,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L698-L734","documentation":"Thrown by assertCapability (called from request) when the application attempts a completion/complete request but the server's initialize response did not advertise the 'completions' capability. The client checks declared server capabilities before sending capability-gated requests.","triggerScenarios":"Calling client.completion() (or sending method 'completion/complete') against a server whose result.capabilities.completions is absent or falsy.","commonSituations":"MCP servers commonly omit completions support; developers assume argument autocompletion is universally available; connecting to a minimal or older server that never implemented completions.","solutions":["Check client.getServerCapabilities().completions before calling completion() and degrade gracefully if absent.","Use an MCP server that implements the completions capability if autocompletion is required.","Update the MCP server to a version that advertises completions.","Wrap completion calls in try/catch on MCPClientError and fall back to static prompt/argument suggestions."],"exampleFix":"// before\nconst res = await client.completion({ ref: { type: 'ref/prompt', name: 'greet' }, argument: { name: 'q', value: 'a' } });\n// after\nconst caps = client.getServerCapabilities();\nif (caps.completions) {\n  const res = await client.completion({ ref: { type: 'ref/prompt', name: 'greet' }, argument: { name: 'q', value: 'a' } });\n} else {\n  const res = fallbackSuggestions();\n}","handlingStrategy":"type-guard","validationCode":"const caps = client.getServerCapabilities();\nif (!caps?.completions) {\n  // skip completion calls or use static suggestions\n}","typeGuard":"function supportsCompletions(client: { getServerCapabilities(): { completions?: boolean } | undefined }): boolean {\n  return client.getServerCapabilities()?.completions === true;\n}","tryCatchPattern":"try {\n  const res = await client.completion({ ref, argument });\n} catch (e) {\n  if (MCPClientError.isInstance(e) && e.message === 'Server does not support completions') {\n    // fall back to no-op suggestions\n  } else throw e;\n}","preventionTips":["Always feature-detect with getServerCapabilities() before capability-gated calls","Treat completions as optional per the MCP spec","Provide static fallback suggestions in UI when the server lacks completions"],"tags":["mcp","capability","completions","feature-detection"],"backgroundTag":"missing-server-capability","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}