Exception: MCPClient::Errors::UnsupportedProtocolVersionError
- Inherits:
-
ServerError
- Object
- StandardError
- MCPError
- ServerError
- MCPClient::Errors::UnsupportedProtocolVersionError
- Includes:
- ModernProtocolError
- Defined in:
- lib/mcp_client/errors.rb
Overview
-32022 UnsupportedProtocolVersion (MCP 2026-07-28): the server does not
implement the protocol version the request declared. supported lists
the versions it does implement so the client can retry with one.
Instance Attribute Summary
Attributes inherited from ServerError
Instance Method Summary collapse
-
#requested ⇒ String?
The protocol version the request asked for (data.requested).
-
#supported ⇒ Array<String>
Protocol versions the server supports (data.supported).
-
#supported_suffix ⇒ String
The versions the server named, phrased for a message about the rejection.
-
#well_formed? ⇒ Boolean
The schema types this error's data as
supported: string[]andrequested: string.
Methods included from ModernProtocolError
Methods inherited from ServerError
from_jsonrpc, #initialize, #modern_http_protocol_error?, #modern_protocol_error?, #modern_protocol_error_for_probe?, #protocol_error?
Methods inherited from MCPError
Constructor Details
This class inherits a constructor from MCPClient::Errors::ServerError
Instance Method Details
#requested ⇒ String?
Returns the protocol version the request asked for (data.requested).
394 395 396 |
# File 'lib/mcp_client/errors.rb', line 394 def requested data_member('requested') end |
#supported ⇒ Array<String>
Returns protocol versions the server supports (data.supported).
382 383 384 385 |
# File 'lib/mcp_client/errors.rb', line 382 def supported list = data_member('supported') list.is_a?(Array) ? list.grep(String) : [] end |
#supported_suffix ⇒ String
The versions the server named, phrased for a message about the rejection.
389 390 391 |
# File 'lib/mcp_client/errors.rb', line 389 def supported_suffix supported.empty? ? '' : " (server supports: #{supported.join(', ')})" end |
#well_formed? ⇒ Boolean
The schema types this error's data as supported: string[] and
requested: string. Both members, with those types, are what a
modern server's rejection carries and what a legacy endpoint emitting
a bare -32022 does not — so they are the whole test. Their length is
not: an empty supported means the server named no version this
client can retry with, which is a failed negotiation with a modern
server, not evidence of a legacy one.
406 407 408 409 410 411 |
# File 'lib/mcp_client/errors.rb', line 406 def well_formed? list = data_member('supported') return false unless list.is_a?(Array) && list.all?(String) requested.is_a?(String) end |