Merge pull request #230 from koic/fix_logging_set_level

Fix `logging/setLevel` to return empty hash per MCP specification
This commit is contained in:
Koichi ITO 2026-02-19 02:52:51 +09:00 • committed by GitHub
commit b8f1cc92e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -362,6 +362,8 @@ module MCP
end
@logging_message_notification = logging_message_notification
{}
end
def list_tools(request)

View file

@ -810,6 +810,24 @@ module MCP
assert_instrumentation_data({ method: "resources/templates/list" })
end
test "#configure_logging_level returns empty hash on success" do
response = @server.handle(
{
jsonrpc: "2.0",
id: 1,
method: "logging/setLevel",
params: {
level: "info",
},
},
)
assert_equal "2.0", response[:jsonrpc]
assert_equal 1, response[:id]
assert_empty(response[:result])
refute response.key?(:error)
end
test "#configure_logging_level returns an error object when invalid log level is provided" do
server = Server.new(
tools: [TestTool],