mcp: cap negotiated protocolVersion in legacy initialize to protocolVersion20251125 (#1051)
Fixes #1033
This commit is contained in:
parent
224a240875
commit
ec564f9ccb
1 changed files with 3 additions and 5 deletions
|
|
@ -57,15 +57,13 @@ func negotiatedVersion(clientVersion string) string {
|
|||
// In general, prefer to use the clientVersion, but if we don't support the
|
||||
// client's version, use the latest version.
|
||||
//
|
||||
// This handles the case where a new spec version is released, and the SDK
|
||||
// does not support it yet.
|
||||
// Cap the supported versions at the legacy protocolVersion20251125, as this
|
||||
// method is used by the initialize method which is deprecated in
|
||||
// version protocolVersion20260728.
|
||||
if !slices.Contains(supportedProtocolVersions, clientVersion) {
|
||||
return protocolVersion20251125
|
||||
if slices.Contains(supportedProtocolVersions, clientVersion) && clientVersion < protocolVersion20260728 {
|
||||
return clientVersion
|
||||
}
|
||||
return clientVersion
|
||||
return protocolVersion20251125
|
||||
}
|
||||
|
||||
// negotiateMutuallySupportedVersion returns a protocol version that is supported
|
||||
|
|
|
|||
Loading…
Reference in a new issue