Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/mcp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def initialize(
Methods::PROMPTS_GET => method(:get_prompt),
Methods::INITIALIZE => method(:init),
Methods::PING => ->(_) { {} },
Methods::NOTIFICATIONS_INITIALIZED => ->(_) {},

# No op handlers for currently unsupported methods
Methods::RESOURCES_SUBSCRIBE => ->(_) {},
Expand Down
20 changes: 20 additions & 0 deletions test/mcp/server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ class ServerTest < ActiveSupport::TestCase
assert_instrumentation_data({ method: "unsupported_method" })
end

test "#handle notifications/initialized returns nil response" do
request = {
jsonrpc: "2.0",
method: "notifications/initialized",
}

assert_nil @server.handle(request)
assert_instrumentation_data({ method: "notifications/initialized" })
end

test "#handle_json notifications/initialized returns nil response" do
request = JSON.generate({
jsonrpc: "2.0",
method: "notifications/initialized",
})

assert_nil @server.handle_json(request)
assert_instrumentation_data({ method: "notifications/initialized" })
end

test "#handle tools/list returns available tools" do
request = {
jsonrpc: "2.0",
Expand Down