From dd458b1fb75eee17a50f5b25dde29449cabf96fb Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 10 Nov 2025 16:24:15 +0900 Subject: [PATCH] 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. --- README.md | 3 ++- lib/mcp/methods.rb | 3 +++ lib/mcp/server.rb | 1 + test/mcp/methods_test.rb | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fa651db..5d629767 100644 --- a/README.md +++ b/README.md @@ -151,11 +151,12 @@ Set `stateless: true` in `MCP::Server::Transports::StreamableHTTPTransport.new` 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 - Resource subscriptions - Completions +- Elicitation ### Usage diff --git a/lib/mcp/methods.rb b/lib/mcp/methods.rb index f30eaf2e..bf2982ff 100644 --- a/lib/mcp/methods.rb +++ b/lib/mcp/methods.rb @@ -21,6 +21,7 @@ module Methods ROOTS_LIST = "roots/list" SAMPLING_CREATE_MESSAGE = "sampling/createMessage" + ELICITATION_CREATE = "elicitation/create" # Notification methods NOTIFICATIONS_INITIALIZED = "notifications/initialized" @@ -76,6 +77,8 @@ def ensure_capability!(method, capabilities) require_capability!(method, capabilities, :roots, :listChanged) when SAMPLING_CREATE_MESSAGE require_capability!(method, capabilities, :sampling) + when ELICITATION_CREATE + require_capability!(method, capabilities, :elicitation) when INITIALIZE, PING, NOTIFICATIONS_INITIALIZED, NOTIFICATIONS_PROGRESS, NOTIFICATIONS_CANCELLED # No specific capability required for initialize, ping, progress or cancelled end diff --git a/lib/mcp/server.rb b/lib/mcp/server.rb index 3a2dd9fe..26896a0a 100644 --- a/lib/mcp/server.rb +++ b/lib/mcp/server.rb @@ -80,6 +80,7 @@ def initialize( Methods::RESOURCES_UNSUBSCRIBE => ->(_) {}, Methods::COMPLETION_COMPLETE => ->(_) {}, Methods::LOGGING_SET_LEVEL => ->(_) {}, + Methods::ELICITATION_CREATE => ->(_) {}, } @transport = transport end diff --git a/test/mcp/methods_test.rb b/test/mcp/methods_test.rb index 2022a2a7..0f765d97 100644 --- a/test/mcp/methods_test.rb +++ b/test/mcp/methods_test.rb @@ -74,6 +74,8 @@ def ensure_capability_does_not_raise_for(method, capabilities: {}) 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 ensure_capability_does_not_raise_for Methods::PING ensure_capability_does_not_raise_for Methods::NOTIFICATIONS_PROGRESS