Class: ActionMCP::Server::TransportHandler

Inherits:
Object
  • Object
show all
Includes:
Capabilities, Elicitation, MessagingService, Prompts, Resources, ResponseCollector, Roots, Sampling, Tasks, Tools
Defined in:
lib/action_mcp/server/transport_handler.rb

Instance Attribute Summary collapse

Attributes included from ResponseCollector

#collected_responses

Attributes included from MessagingService

#messaging_mode

Instance Method Summary collapse

Methods included from ResponseCollector

#clear_collected_responses, #get_collected_responses, #get_last_response, #initialize_response_collector, #write_message

Methods included from Tasks

#send_task_status_notification, #send_tasks_cancel, #send_tasks_get, #send_tasks_list, #send_tasks_result, #send_tasks_resume

Methods included from Elicitation

#send_elicitation_request

Methods included from Roots

#send_roots_list

Methods included from Sampling

#send_sampling_create_message

Methods included from Resources

#send_resource_read, #send_resource_templates_list, #send_resources_list

Methods included from Prompts

#send_prompts_get, #send_prompts_list

Methods included from Tools

#send_tools_call, #send_tools_list

Methods included from Capabilities

#send_capabilities

Methods included from MessagingService

#send_jsonrpc_error, #send_jsonrpc_notification, #send_jsonrpc_request, #send_jsonrpc_response, #send_logging_message_notification, #send_progress_notification, #send_prompts_list_changed_notification, #send_resource_updated_notification, #send_resources_list_changed_notification, #send_tools_list_changed_notification

Constructor Details

#initialize(session, messaging_mode: :write) ⇒ TransportHandler

Returns a new instance of TransportHandler.

Parameters:

  • session (ActionMCP::Session)
  • messaging_mode (:write, :return) (defaults to: :write)

    The mode for message handling



27
28
29
30
31
# File 'lib/action_mcp/server/transport_handler.rb', line 27

def initialize(session, messaging_mode: :write)
  @session = session
  @messaging_mode = messaging_mode
  initialize_response_collector if messaging_mode == :return
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



9
10
11
# File 'lib/action_mcp/server/transport_handler.rb', line 9

def session
  @session
end

Instance Method Details

#send_pong(request_id) ⇒ Object



33
34
35
# File 'lib/action_mcp/server/transport_handler.rb', line 33

def send_pong(request_id)
  send_jsonrpc_response(request_id, result: {})
end