Add title to serverInfo
Follow-up to #109. `title` has also been added to `serverInfo` and `clientInfo` by https://github.com/modelcontextprotocol/modelcontextprotocol/pull/663. Since `clientInfo` is not treated as product code, support is implemented only in `serverInfo`. See also https://modelcontextprotocol.io/specification/2025-06-18/schema#implementation.
This commit is contained in:
parent
9486c63545
commit
ef56280518
1 changed files with 19 additions and 1 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue