Exception: MCP::Client::InputRequiredError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mcp/client.rb

Overview

Raised when a server answers with a SEP-2322 Multi Round-Trip input_required result instead of a final result. The result is not an error on the wire: it asks the client to fulfill the server's inputRequests (a map of id => { "method" => ..., "params" => ... } request objects with sampling/createMessage, roots/list, or elicitation/create shapes) and re-issue the original request with inputResponses plus the echoed opaque requestState. With handlers registered through on_elicitation, on_sampling, or on_roots, the resume loop runs automatically; this error surfaces when no matching handler exists (manual driving via input_requests and the input_responses:/request_state: kwargs), or when the round cap is exhausted. https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2322

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, input_requests:, request_state: nil, result: nil) ⇒ InputRequiredError

Returns a new instance of InputRequiredError.



78
79
80
81
82
83
# File 'lib/mcp/client.rb', line 78

def initialize(message, input_requests:, request_state: nil, result: nil)
  super(message)
  @input_requests = input_requests
  @request_state = request_state
  @result = result
end

Instance Attribute Details

#input_requestsObject (readonly)

Returns the value of attribute input_requests.



76
77
78
# File 'lib/mcp/client.rb', line 76

def input_requests
  @input_requests
end

#request_stateObject (readonly)

Returns the value of attribute request_state.



76
77
78
# File 'lib/mcp/client.rb', line 76

def request_state
  @request_state
end

#resultObject (readonly)

Returns the value of attribute result.



76
77
78
# File 'lib/mcp/client.rb', line 76

def result
  @result
end