Module: MCP::Methods

Defined in:
lib/mcp/methods.rb

Defined Under Namespace

Classes: MissingRequiredCapabilityError

Constant Summary collapse

INITIALIZE =
"initialize"
PING =
"ping"
LOGGING_SET_LEVEL =
"logging/setLevel"
PROMPTS_GET =
"prompts/get"
PROMPTS_LIST =
"prompts/list"
COMPLETION_COMPLETE =
"completion/complete"
RESOURCES_LIST =
"resources/list"
RESOURCES_READ =
"resources/read"
RESOURCES_TEMPLATES_LIST =
"resources/templates/list"
RESOURCES_SUBSCRIBE =
"resources/subscribe"
RESOURCES_UNSUBSCRIBE =
"resources/unsubscribe"
TOOLS_CALL =
"tools/call"
TOOLS_LIST =
"tools/list"
ROOTS_LIST =
"roots/list"
SAMPLING_CREATE_MESSAGE =
"sampling/createMessage"
NOTIFICATIONS_INITIALIZED =

Notification methods

"notifications/initialized"
NOTIFICATIONS_TOOLS_LIST_CHANGED =
"notifications/tools/list_changed"
NOTIFICATIONS_PROMPTS_LIST_CHANGED =
"notifications/prompts/list_changed"
NOTIFICATIONS_RESOURCES_LIST_CHANGED =
"notifications/resources/list_changed"
NOTIFICATIONS_RESOURCES_UPDATED =
"notifications/resources/updated"
NOTIFICATIONS_ROOTS_LIST_CHANGED =
"notifications/roots/list_changed"
NOTIFICATIONS_MESSAGE =
"notifications/message"
NOTIFICATIONS_PROGRESS =
"notifications/progress"
NOTIFICATIONS_CANCELLED =
"notifications/cancelled"

Class Method Summary collapse

Class Method Details

.ensure_capability!(method, capabilities) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mcp/methods.rb', line 48

def ensure_capability!(method, capabilities)
  case method
  when PROMPTS_GET, PROMPTS_LIST
    require_capability!(method, capabilities, :prompts)
  when NOTIFICATIONS_PROMPTS_LIST_CHANGED
    require_capability!(method, capabilities, :prompts)
    require_capability!(method, capabilities, :prompts, :listChanged)
  when RESOURCES_LIST, RESOURCES_TEMPLATES_LIST, RESOURCES_READ
    require_capability!(method, capabilities, :resources)
  when NOTIFICATIONS_RESOURCES_LIST_CHANGED
    require_capability!(method, capabilities, :resources)
    require_capability!(method, capabilities, :resources, :listChanged)
  when RESOURCES_SUBSCRIBE, RESOURCES_UNSUBSCRIBE, NOTIFICATIONS_RESOURCES_UPDATED
    require_capability!(method, capabilities, :resources)
    require_capability!(method, capabilities, :resources, :subscribe)
  when TOOLS_CALL, TOOLS_LIST
    require_capability!(method, capabilities, :tools)
  when NOTIFICATIONS_TOOLS_LIST_CHANGED
    require_capability!(method, capabilities, :tools)
    require_capability!(method, capabilities, :tools, :listChanged)
  when LOGGING_SET_LEVEL, NOTIFICATIONS_MESSAGE
    require_capability!(method, capabilities, :logging)
  when COMPLETION_COMPLETE
    require_capability!(method, capabilities, :completions)
  when ROOTS_LIST
    require_capability!(method, capabilities, :roots)
  when NOTIFICATIONS_ROOTS_LIST_CHANGED
    require_capability!(method, capabilities, :roots)
    require_capability!(method, capabilities, :roots, :listChanged)
  when SAMPLING_CREATE_MESSAGE
    require_capability!(method, capabilities, :sampling)
  when INITIALIZE, PING, NOTIFICATIONS_INITIALIZED, NOTIFICATIONS_PROGRESS, NOTIFICATIONS_CANCELLED
    # No specific capability required for initialize, ping, progress or cancelled
  end
end