Class: ActionMCP::Client::JsonRpcHandler

Inherits:
JsonRpcHandlerBase show all
Defined in:
lib/action_mcp/client/json_rpc_handler.rb

Instance Attribute Summary collapse

Attributes inherited from JsonRpcHandlerBase

#transport

Instance Method Summary collapse

Constructor Details

#initialize(transport, client) ⇒ JsonRpcHandler

Returns a new instance of JsonRpcHandler.



8
9
10
11
# File 'lib/action_mcp/client/json_rpc_handler.rb', line 8

def initialize(transport, client)
  super(transport)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/action_mcp/client/json_rpc_handler.rb', line 6

def client
  @client
end

Instance Method Details

#call(request) ⇒ Object

Handle client-side JSON-RPC requests/responses

Parameters:

  • request (JSON_RPC::Request, JSON_RPC::Notification, JSON_RPC::Response)


15
16
17
18
19
20
21
22
23
24
# File 'lib/action_mcp/client/json_rpc_handler.rb', line 15

def call(request)
  case request
  when JSON_RPC::Request
    handle_request(request)
  when JSON_RPC::Notification
    handle_notification(request)
  when JSON_RPC::Response
    handle_response(request)
  end
end