mcp: add Cacheable fields to DiscoverResult (#1022)
This PR add the Cacheable fields to the DiscoverResult, as it was added
later
(8e4c2322ca)
This commit is contained in:
parent
7f4aa4a0ce
commit
a817f61412
4 changed files with 17 additions and 19 deletions
|
|
@ -1129,6 +1129,7 @@ func (x *DiscoverParams) SetProgressToken(t any) { setProgressToken(x, t) }
|
|||
|
||||
type DiscoverResult struct {
|
||||
Meta `json:"_meta,omitempty"`
|
||||
Cacheable
|
||||
// The versions of the Model Context Protocol that the server supports.
|
||||
SupportedVersions []string `json:"supportedVersions"`
|
||||
// The server's capabilities.
|
||||
|
|
|
|||
|
|
@ -869,12 +869,14 @@ func (s *Server) discover(_ context.Context, req *ServerRequest[*DiscoverParams]
|
|||
ClientInfo: req.ClientInfo(),
|
||||
}
|
||||
})
|
||||
return &DiscoverResult{
|
||||
res := &DiscoverResult{
|
||||
SupportedVersions: versions,
|
||||
Capabilities: s.capabilities(),
|
||||
ServerInfo: s.impl,
|
||||
Instructions: s.opts.Instructions,
|
||||
}, nil
|
||||
}
|
||||
res.setDefaultCacheableValues()
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// filterSupportedVersions returns the subset of [supportedProtocolVersions]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ supports, its capabilities, and its identity.
|
|||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": {
|
||||
"ttlMs": 0,
|
||||
"cacheScope": "public",
|
||||
"supportedVersions": [
|
||||
"2026-07-28",
|
||||
"2025-11-25",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ func ExampleLoggingTransport() {
|
|||
}
|
||||
|
||||
// Output:
|
||||
// read: {"jsonrpc":"2.0","id":1,"result":{"supportedVersions":["2026-07-28","2025-11-25","2025-06-18","2025-03-26","2024-11-05"],"capabilities":{"logging":{}},"serverInfo":{"name":"server","version":"v0.0.1"}}}
|
||||
// read: {"jsonrpc":"2.0","id":1,"result":{"ttlMs":0,"cacheScope":"public","supportedVersions":["2026-07-28","2025-11-25","2025-06-18","2025-03-26","2024-11-05"],"capabilities":{"logging":{}},"serverInfo":{"name":"server","version":"v0.0.1"}}}
|
||||
// write: {"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{"roots":{"listChanged":true}},"io.modelcontextprotocol/clientInfo":{"name":"client","version":"v0.0.1"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue