Class: Explicit::MCPServer::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/explicit/mcp_server/router.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, version:, tools:) ⇒ Router

Returns a new instance of Router.



4
5
6
7
8
# File 'lib/explicit/mcp_server/router.rb', line 4

def initialize(name:, version:, tools:)
  @name = name
  @version = version
  @tools = tools.index_by { _1.request.get_mcp_tool_name }
end

Instance Method Details

#handle(request) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/explicit/mcp_server/router.rb', line 10

def handle(request)
  case request.method
  when "ping" then noop(request)
  when "initialize" then initialize_(request)
  when "notifications/initialized" then noop(request)
  when "tools/list" then tools_list(request)
  when "tools/call" then tools_call(request)
  else noop(request)
  end
end