mcp: add 2026-07-28 to the supported protocol versions (#1020)

This PR adds the protocol version `2026-07-28` to the list of supported
protocol versions and fixes legacy tests hardcoding the legacy protocol
version for those use cases.
This commit is contained in:
Guglielmo Colombo 2026-06-24 12:02:56 +02:00 • committed by GitHub
commit 7f4aa4a0ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -143,6 +143,31 @@ func incTool(_ context.Context, _ *CallToolRequest, args incInput) (*CallToolRes
return nil, incOutput{args.X + 1}, nil
}
// confirmThenGreet exercises the multi-round-trip pattern in
// conformance fixtures.
func confirmThenGreet(_ context.Context, req *CallToolRequest, _ struct{}) (*CallToolResult, any, error) {
if len(req.Params.InputResponses) == 0 {
return &CallToolResult{
InputRequests: InputRequestMap{
"who": &ElicitParams{
Message: "What is your name?",
RequestedSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"name": {Type: "string"},
},
},
},
},
RequestState: "step=1",
}, nil, nil
}
name := req.Params.InputResponses["who"].(*ElicitResult).Content["name"].(string)
return &CallToolResult{
Content: []Content{&TextContent{Text: "hello " + name}},
}, nil, nil
}
var iconObj = Icon{
Source: "foobar",
MIMEType: "image/png",
@ -193,6 +218,11 @@ func runServerTest(t *testing.T, test *conformanceTest) {
Title: "contentTool",
Description: "return resourceLink content with Icon",
}, contentTool)
case "confirmThenGreet":
AddTool(s, &Tool{
Name: "confirmThenGreet",
Description: "ask the user for their name via elicitation, then greet them",
}, confirmThenGreet)
default:
t.Fatalf("unknown tool %q", tn)
}