mcp: include resultType on new-protocol responses (#1060)

## Summary

- Add `resultType: "complete"` to non-MRTR server result responses for
2026-07-28 requests.
- Cover `server/discover`, list methods, and completion responses, and
update expected conformance/example output.

## Why

Fixes #1032. The 2026-07-28 schema requires `resultType` on result
objects, but only the MRTR-capable results were setting it.

## Validation

- `go test ./mcp -run
'Test(ServerSessionHandle|CompleteResult|ClientConnectDiscover|InMemory_E2E_Discover)'
-count=1` — passed\n- `go test ./mcp -count=1` — passed\n- `go test
./...` — passed\n- `go vet ./...` — passed

---------

Co-authored-by: ychampion <ychampion@users.noreply.github.com>
Co-authored-by: Guglielmo Colombo <guglielmoc@google.com>
This commit is contained in:
Yashas Gunderia 2026-07-13 17:21:19 +05:30 • committed by GitHub
commit dd79ca3d44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1893,7 +1893,14 @@ func (ss *ServerSession) handle(ctx context.Context, req *jsonrpc.Request) (any,
if validatedMeta.usesNewProtocol {
ss.setLevel(ctx, &SetLoggingLevelParams{Level: validatedMeta.logLevel})
}
return handleReceive(ctx, ss, req)
res, err := handleReceive(ctx, ss, req)
if err != nil {
return nil, err
}
if validatedMeta.usesNewProtocol {
setCompleteResultType(res)
}
return res, nil
}
// InitializeParams returns the InitializeParams provided during the client's