Class: RubyMCP::Requests

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_mcp/requests.rb

Defined Under Namespace

Classes: CompletionComplete, Initialize, LoggingSetLevel, NotificationsInitialized, Ping, PromptsGet, PromptsList, ResourcesList, ResourcesRead

Class Method Summary collapse

Class Method Details

.parse(json) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ruby_mcp/requests.rb', line 3

def self.parse(json)
  parsed = JSON.parse(json)
  case parsed.fetch("method")
  when "initialize"
    Initialize
  when "notifications/initialized"
    NotificationsInitialized
  when "ping"
    Ping
  when "prompts/get"
    PromptsGet
  when "prompts/list"
    PromptsList
  when "completion/complete"
    CompletionComplete
  when "resources/list"
    ResourcesList
  when "resources/read"
    ResourcesRead
  when "logging/setLevel"
    LoggingSetLevel
  else
    Request
  end.new(parsed)
end