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.



84
85
86
87
88
89
# File 'lib/mcp/client.rb', line 84

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_requests ⇒ Object (readonly)

Returns the value of attribute input_requests.



82
83
84
# File 'lib/mcp/client.rb', line 82

def input_requests
  @input_requests
end

#request_state ⇒ Object (readonly)

Returns the value of attribute request_state.



82
83
84
# File 'lib/mcp/client.rb', line 82

def request_state
  @request_state
end

#result ⇒ Object (readonly)

Returns the value of attribute result.



82
83
84
# File 'lib/mcp/client.rb', line 82

def result
  @result
end