Merge pull request #119 from koic/add_title_to_server_info

Add `title` to `serverInfo`
This commit is contained in:
Koichi ITO 2025-08-30 02:01:53 +09:00 • committed by GitHub
commit b982074daa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,6 +69,7 @@ module MCP
@server = Server.new(
name: @server_name,
title: "Example Server Display Name",
version: "1.2.3",
instructions: "Optional instructions for the client",
tools: [@tool, @tool_that_raises],
@ -140,6 +141,7 @@ module MCP
},
serverInfo: {
name: @server_name,
title: "Example Server Display Name",
version: "1.2.3",
},
instructions: "Optional instructions for the client",
@ -769,6 +771,18 @@ module MCP
assert_equal Configuration::DEFAULT_PROTOCOL_VERSION, response[:result][:protocolVersion]
end
test "server uses default title when not configured" do
server = Server.new(name: "test_server")
request = {
jsonrpc: "2.0",
method: "initialize",
id: 1,
}
response = server.handle(request)
assert_nil response[:result][:serverInfo][:title]
end
test "server uses default version when not configured" do
server = Server.new(name: "test_server")
request = {