internal/mcp: update protocol versions
Update protocol versions to reflect that 2025-03-26 is supported, and add server logic to negotiate the supported version with the client. Update the client to set the protocol version, fixing what was probably a spec violation. +tests Change-Id: I564b591b3daf018dd54f5c7e5d8f2d2b1e4ff502 Reviewed-on: https://go-review.googlesource.com/c/tools/+/682516 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
This commit is contained in:
parent
1fead0ba64
commit
5ae2a9f222
1 changed files with 130 additions and 7 deletions
|
|
@ -634,9 +634,16 @@ func (ss *ServerSession) initialize(ctx context.Context, params *InitializeParam
|
|||
ss.mu.Unlock()
|
||||
}()
|
||||
|
||||
version := "2025-03-26" // preferred version
|
||||
switch v := params.ProtocolVersion; v {
|
||||
case "2024-11-05", "2025-03-26":
|
||||
version = v
|
||||
}
|
||||
|
||||
return &InitializeResult{
|
||||
// TODO(rfindley): support multiple protocol versions.
|
||||
ProtocolVersion: "2024-11-05",
|
||||
// TODO(rfindley): alter behavior when falling back to an older version:
|
||||
// reject unsupported features.
|
||||
ProtocolVersion: version,
|
||||
Capabilities: &serverCapabilities{
|
||||
Prompts: &promptCapabilities{
|
||||
ListChanged: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue