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.
This commit is contained in:
Koichi ITO 2025-11-10 16:24:15 +09:00
commit dd458b1fb7
4 changed files with 8 additions and 1 deletions

View file

@ -151,11 +151,12 @@ Set `stateless: true` in `MCP::Server::Transports::StreamableHTTPTransport.new`
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true) transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true)
``` ```
### Unsupported Features ( to be implemented in future versions ) ### Unsupported Features (to be implemented in future versions)
- Log Level - Log Level
- Resource subscriptions - Resource subscriptions
- Completions - Completions
- Elicitation
### Usage ### Usage

View file

@ -21,6 +21,7 @@ module MCP
ROOTS_LIST = "roots/list" ROOTS_LIST = "roots/list"
SAMPLING_CREATE_MESSAGE = "sampling/createMessage" SAMPLING_CREATE_MESSAGE = "sampling/createMessage"
ELICITATION_CREATE = "elicitation/create"
# Notification methods # Notification methods
NOTIFICATIONS_INITIALIZED = "notifications/initialized" NOTIFICATIONS_INITIALIZED = "notifications/initialized"
@ -76,6 +77,8 @@ module MCP
require_capability!(method, capabilities, :roots, :listChanged) require_capability!(method, capabilities, :roots, :listChanged)
when SAMPLING_CREATE_MESSAGE when SAMPLING_CREATE_MESSAGE
require_capability!(method, capabilities, :sampling) require_capability!(method, capabilities, :sampling)
when ELICITATION_CREATE
require_capability!(method, capabilities, :elicitation)
when INITIALIZE, PING, NOTIFICATIONS_INITIALIZED, NOTIFICATIONS_PROGRESS, NOTIFICATIONS_CANCELLED when INITIALIZE, PING, NOTIFICATIONS_INITIALIZED, NOTIFICATIONS_PROGRESS, NOTIFICATIONS_CANCELLED
# No specific capability required for initialize, ping, progress or cancelled # No specific capability required for initialize, ping, progress or cancelled
end end

View file

@ -80,6 +80,7 @@ module MCP
Methods::RESOURCES_UNSUBSCRIBE => ->(_) {}, Methods::RESOURCES_UNSUBSCRIBE => ->(_) {},
Methods::COMPLETION_COMPLETE => ->(_) {}, Methods::COMPLETION_COMPLETE => ->(_) {},
Methods::LOGGING_SET_LEVEL => ->(_) {}, Methods::LOGGING_SET_LEVEL => ->(_) {},
Methods::ELICITATION_CREATE => ->(_) {},
} }
@transport = transport @transport = transport
end end

View file

@ -74,6 +74,8 @@ module MCP
ensure_capability_raises_error_for Methods::SAMPLING_CREATE_MESSAGE, required_capability_name: "sampling" ensure_capability_raises_error_for Methods::SAMPLING_CREATE_MESSAGE, required_capability_name: "sampling"
ensure_capability_raises_error_for Methods::ELICITATION_CREATE, required_capability_name: "elicitation"
# Methods and notifications of both server and client # Methods and notifications of both server and client
ensure_capability_does_not_raise_for Methods::PING ensure_capability_does_not_raise_for Methods::PING
ensure_capability_does_not_raise_for Methods::NOTIFICATIONS_PROGRESS ensure_capability_does_not_raise_for Methods::NOTIFICATIONS_PROGRESS