{"record":{"id":"01a52b3fef5ef1b2","repo":"vercel/ai","slug":"modern-mcp-result-is-missing-resulttype","errorCode":null,"errorMessage":"Modern MCP result is missing resultType","messagePattern":"Modern MCP result is missing resultType","errorType":"exception","errorClass":"MCPClientError","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-client.ts","lineNumber":862,"sourceCode":"        rejectAndCleanup(error);\n      };\n\n      this.responseHandlers.set(messageId, response => {\n        if (signal?.aborted) {\n          cleanup();\n          return rejectWithAbortError();\n        }\n\n        if (response instanceof Error) {\n          return rejectAndCleanup(response);\n        }\n\n        try {\n          if (\n            this.protocolEra === 'modern' &&\n            response.result.resultType == null\n          ) {\n            throw new MCPClientError({\n              message: 'Modern MCP result is missing resultType',\n            });\n          }\n          if (response.result.resultType === 'input_required') {\n            throw new MCPClientError({\n              message:\n                'Server requested additional input, but multi round-trip requests are not supported yet',\n            });\n          }\n\n          const result = resultSchema.parse(response.result);\n          cleanup();\n          resolve(result);\n        } catch (error) {\n          const parseError = MCPClientError.isInstance(error)\n            ? error\n            : new MCPClientError({\n                message: 'Failed to parse server response',","sourceCodeStart":844,"sourceCodeEnd":880,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-client.ts#L844-L880","documentation":"MCPClientError thrown inside DefaultMCPClient.request when the negotiated protocol era is 'modern' but the server's response result lacks a `resultType` field. The modern MCP protocol requires results to be tagged with resultType so the client can distinguish normal results from input-required (elicitation) results. A missing resultType means the server is not conforming to the modern protocol shape the client negotiated.","triggerScenarios":"Sending any request (tools/call, resources/read, prompts/get, etc.) to a server that negotiated the modern protocol but returns legacy-shaped results without `resultType` — typically a server that claims modern protocol support in initialize but implements an older result format.","commonSituations":"Server version drift: server upgraded or downgraded so its advertised protocol no longer matches its actual response shape; a proxy or middleware rewriting/stripping result envelopes; mixing a modern-era client with a partially compliant server implementation.","solutions":["Upgrade or fix the MCP server so its responses include `resultType` as required by the negotiated modern protocol","Pin the client and server to compatible MCP protocol versions (verify the version negotiated in initialize)","Remove any proxy/middleware that alters response bodies, or fix it to pass results through unchanged","If the server is actually legacy, configure the client to negotiate the legacy protocol era instead"],"exampleFix":"// before: mismatched versions\nnew DefaultMCPClient({ url: mcpUrl, protocolVersion: '2026-xx-modern' });\n\n// after: match server's actual protocol support\nnew DefaultMCPClient({ url: mcpUrl, protocolVersion: serverSupportedProtocolVersion });","handlingStrategy":"validation","validationCode":"const negotiated = initResult.protocolVersion; // from initialize\nif (!isModernEra(negotiated) && serverAdvertisesModern) {\n  throw new Error('Server/client protocol era mismatch; align protocol versions');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await client.callTool({ name, arguments });\n} catch (error) {\n  if (MCPClientError.isInstance(error) && error.message.includes('missing resultType')) {\n    // server is not conforming to the negotiated modern protocol:\n    // pin compatible versions or downgrade negotiation\n  } else {\n    throw error;\n  }\n}","preventionTips":["Keep client and server MCP protocol versions aligned; test after any server upgrade","Avoid proxies that rewrite response bodies","Verify server conformance to the negotiated protocol in integration tests"],"tags":["mcp","protocol-version","response-shape","compatibility"],"backgroundTag":"protocol-version-mismatch","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}