Skip to content

Commit 91a1eb6

Browse files
committed
Add Elicitation skeleton
The MCP 2025-06-18 specification includes a feature called Elicitation: https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation Like Log Level, an implementation is expected to be provided in the near future. This PR adds Elicitation as a skeleton implementation for now.
1 parent 400a56e commit 91a1eb6

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,12 @@ server.define_tool(name: "new_tool") { |**args| { result: "ok" } }
146146
server.notify_tools_list_changed
147147
```
148148

149-
### Unsupported Features ( to be implemented in future versions )
149+
### Unsupported Features (to be implemented in future versions)
150150

151151
- Log Level
152152
- Resource subscriptions
153153
- Completions
154+
- Elicitation
154155

155156
### Usage
156157

lib/mcp/methods.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module Methods
2121

2222
ROOTS_LIST = "roots/list"
2323
SAMPLING_CREATE_MESSAGE = "sampling/createMessage"
24+
ELICITATION_CREATE = "elicitation/create"
2425

2526
# Notification methods
2627
NOTIFICATIONS_INITIALIZED = "notifications/initialized"
@@ -76,6 +77,8 @@ def ensure_capability!(method, capabilities)
7677
require_capability!(method, capabilities, :roots, :listChanged)
7778
when SAMPLING_CREATE_MESSAGE
7879
require_capability!(method, capabilities, :sampling)
80+
when ELICITATION_CREATE
81+
require_capability!(method, capabilities, :elicitation)
7982
when INITIALIZE, PING, NOTIFICATIONS_INITIALIZED, NOTIFICATIONS_PROGRESS, NOTIFICATIONS_CANCELLED
8083
# No specific capability required for initialize, ping, progress or cancelled
8184
end

lib/mcp/server.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def initialize(
8080
Methods::RESOURCES_UNSUBSCRIBE => ->(_) {},
8181
Methods::COMPLETION_COMPLETE => ->(_) {},
8282
Methods::LOGGING_SET_LEVEL => ->(_) {},
83+
Methods::ELICITATION_CREATE => ->(_) {},
8384
}
8485
@transport = transport
8586
end

test/mcp/methods_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def ensure_capability_does_not_raise_for(method, capabilities: {})
7474

7575
ensure_capability_raises_error_for Methods::SAMPLING_CREATE_MESSAGE, required_capability_name: "sampling"
7676

77+
ensure_capability_raises_error_for Methods::ELICITATION_CREATE, required_capability_name: "elicitation"
78+
7779
# Methods and notifications of both server and client
7880
ensure_capability_does_not_raise_for Methods::PING
7981
ensure_capability_does_not_raise_for Methods::NOTIFICATIONS_PROGRESS

0 commit comments

Comments
 (0)