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:
parent
b9e6fc5a66
commit
7f4aa4a0ce
1 changed files with 355 additions and 218 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue