mcp: update return meta in DiscoverResult (SEP-2575) (#1097)
This PR implements the latest changes introduced by https://github.com/modelcontextprotocol/modelcontextprotocol/pull/3002
This commit is contained in:
parent
fa548d7401
commit
5cb8339210
1 changed files with 210 additions and 68 deletions
|
|
@ -662,11 +662,13 @@ func TestClientConnectDiscover(t *testing.T) {
|
|||
name: "discover success skips initialize",
|
||||
discoverHandler: func() (Result, error) {
|
||||
return &DiscoverResult{
|
||||
Meta: Meta{
|
||||
MetaKeyServerInfo: &Implementation{Name: "discoverServer", Version: "v1.0.0"},
|
||||
},
|
||||
SupportedVersions: []string{protocolVersion20260728},
|
||||
Capabilities: &ServerCapabilities{
|
||||
Tools: &ToolCapabilities{ListChanged: true},
|
||||
},
|
||||
ServerInfo: &Implementation{Name: "discoverServer", Version: "v1.0.0"},
|
||||
}, nil
|
||||
},
|
||||
wantInitialize: false,
|
||||
|
|
@ -695,9 +697,11 @@ func TestClientConnectDiscover(t *testing.T) {
|
|||
name: "no overlapping supported version falls back to initialize",
|
||||
discoverHandler: func() (Result, error) {
|
||||
return &DiscoverResult{
|
||||
Meta: Meta{
|
||||
MetaKeyServerInfo: &Implementation{Name: "discoverServer", Version: "v1.0.0"},
|
||||
},
|
||||
SupportedVersions: []string{otherVersionsOnly},
|
||||
Capabilities: &ServerCapabilities{},
|
||||
ServerInfo: &Implementation{Name: "discoverServer", Version: "v1.0.0"},
|
||||
}, nil
|
||||
},
|
||||
wantInitialize: true,
|
||||
|
|
@ -885,9 +889,11 @@ func TestInMemory_E2E_DiscoverFallback_NoOverlap(t *testing.T) {
|
|||
return func(ctx context.Context, method string, req Request) (Result, error) {
|
||||
if method == methodDiscover {
|
||||
return &DiscoverResult{
|
||||
Meta: Meta{
|
||||
MetaKeyServerInfo: &Implementation{Name: "vpre-like-server", Version: "v1"},
|
||||
},
|
||||
SupportedVersions: []string{protocolVersion20251125},
|
||||
Capabilities: &ServerCapabilities{},
|
||||
ServerInfo: &Implementation{Name: "vpre-like-server", Version: "v1"},
|
||||
}, nil
|
||||
}
|
||||
return next(ctx, method, req)
|
||||
|
|
|
|||
Loading…
Reference in a new issue