Class: ActionMCP::Client::StreamableClient
- Defined in:
- lib/action_mcp/client/streamable_client.rb
Overview
MCP client using Server-Sent Events (SSE) transport
Defined Under Namespace
Classes: ConnectionError
Constant Summary collapse
- SSE_TIMEOUT =
10- ENDPOINT_TIMEOUT =
Seconds
5
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#post_url ⇒ Object
readonly
Returns the value of attribute post_url.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#sse_path ⇒ Object
readonly
Returns the value of attribute sse_path.
Attributes inherited from Base
#blueprint, #catalog, #connection_error, #logger, #prompt_book, #server, #server_capabilities, #toolbox, #transport
Instance Method Summary collapse
-
#initialize(url, connect: true, logger: ActionMCP.logger, **_options) ⇒ StreamableClient
constructor
A new instance of StreamableClient.
Methods inherited from Base
#connect, #disconnect, #initialized?, #inspect, #write_message
Methods included from Elicitation
#process_elicitation_request, #send_elicitation_response
Methods included from Roots
#roots_list_changed_notification
Methods included from Resources
#list_resource_templates, #list_resources, #read_resource, #subscribe_resource, #unsubscribe_resource
Methods included from Prompts
Methods included from Tools
Methods included from Messaging
#send_jsonrpc_error, #send_jsonrpc_notification, #send_jsonrpc_request, #send_jsonrpc_response
Constructor Details
#initialize(url, connect: true, logger: ActionMCP.logger, **_options) ⇒ StreamableClient
Returns a new instance of StreamableClient.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/action_mcp/client/streamable_client.rb', line 15 def initialize(url, connect: true, logger: ActionMCP.logger, **) gem "faraday", ">= 2.0" require "faraday" require "uri" super(logger: logger) @type = :sse setup_connection(url) @buffer = +"" @stop_requested = false @endpoint_received = false @endpoint_mutex = Mutex.new @endpoint_condition = ConditionVariable.new @connection_mutex = Mutex.new @connection_condition = ConditionVariable.new self.connect if connect end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
13 14 15 |
# File 'lib/action_mcp/client/streamable_client.rb', line 13 def base_url @base_url end |
#post_url ⇒ Object (readonly)
Returns the value of attribute post_url.
13 14 15 |
# File 'lib/action_mcp/client/streamable_client.rb', line 13 def post_url @post_url end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
13 14 15 |
# File 'lib/action_mcp/client/streamable_client.rb', line 13 def session @session end |
#sse_path ⇒ Object (readonly)
Returns the value of attribute sse_path.
13 14 15 |
# File 'lib/action_mcp/client/streamable_client.rb', line 13 def sse_path @sse_path end |