Class: McpToolkit::Gateway::UpstreamCallError

Inherits:
Error
  • Object
show all
Defined in:
lib/mcp_toolkit/gateway/upstream_call_error.rb

Overview

Raised by McpToolkit::Gateway::Proxy when a proxied tools/call fails at the upstream. It carries the upstream failure detail so the CONSUMER can decide how to surface it:

* `jsonrpc_error` — the upstream's JSON-RPC error hash when the failure was a
protocol-level error response (so the consumer can relay it verbatim); nil
for transport/HTTP failures.
* `http_status`   — the HTTP status for a non-2xx response (nil otherwise).

The gem deliberately does NOT map this to a protocol/transport error class: that mapping lives in the consuming dispatcher, keeping the gateway transport-agnostic.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, jsonrpc_error: nil, http_status: nil) ⇒ UpstreamCallError

Returns a new instance of UpstreamCallError.



18
19
20
21
22
# File 'lib/mcp_toolkit/gateway/upstream_call_error.rb', line 18

def initialize(message, jsonrpc_error: nil, http_status: nil)
  super(message)
  @jsonrpc_error = jsonrpc_error
  @http_status = http_status
end

Instance Attribute Details

#http_statusObject (readonly)

Returns the value of attribute http_status.



16
17
18
# File 'lib/mcp_toolkit/gateway/upstream_call_error.rb', line 16

def http_status
  @http_status
end

#jsonrpc_errorObject (readonly)

Returns the value of attribute jsonrpc_error.



16
17
18
# File 'lib/mcp_toolkit/gateway/upstream_call_error.rb', line 16

def jsonrpc_error
  @jsonrpc_error
end