Repository navigation
mcpcompat/server: document and test declared client capabilities edge cases - #450
Merged
Merged
Conversation
… cases Follow-ups from the review of #448: - Document that {"elicitation":{}} means form-only support and how to check for form support, that only initialize-handshake capabilities are read (2026-07-28 carries them per request in _meta), and that Tasks is always nil because go-sdk does not carry it. - Cover the form-support rule with an integration test row, including a form-only case. - Add an end-to-end test that a session reaped and rehydrated under the same ID on one instance reports known=false. - Add a test that binds one session ID to two go-sdk sessions that both carry InitializeParams, so the initializedOn comparison is what reports the newer session's seeded capabilities as unknown. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
jhrozek
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #448, addressing the non-blocking notes from its approving review.
Summary
Documents three things a consumer of
DeclaredClientCapabilitiesneeds to know, and adds tests that pin the behavior the accessor depends on. There is no change to production behavior.Changes
mcpcompat/server
SessionWithClientCapabilities.DeclaredClientCapabilities:{"elicitation":{}}means form-only support, so form support isElicitation != nil && (Elicitation.Form != nil || Elicitation.URL == nil), notElicitation.Form != nilalone. URL-mode support isElicitation != nil && Elicitation.URL != nil._meta, and those are not reflected, soknown=falsethere does not mean the client lacks a capability.Tasksis always nil because go-sdk does not carry it, so nil means "not reported" rather than "not declared".TestClientSession_DeclaredCapabilitiesgains awantFormSupportedcolumn that applies the documented rule, plus a form-only row.TestDeclaredClientCapabilities_UnknownAfterReapAndRehydrateinitializes withelicitation.urland checksknown=true. It then closes the bound go-sdk session, which is the event the idle reaper produces, so there is no timer to make it flaky. It requests the same session ID again, which a rehydrated session serves, and checksknown=falsewith zero capabilities.TestDeclaredClientCapabilities_UnknownWhenReboundToSeededSessionbinds one session ID to two real go-sdk sessions that both carryInitializeParams.Implementation Notes
initializedOnand the end-to-end test alone cannot tell a pointer comparison from a nil check. The older unit case "initialize observed on a different session" does not pin it either: it uses zero-valueServerSessions, whoseInitializeParams()is nil, so it reportsknown=falseregardless. The new test is the only one that fails ifc.initializedOn.Load() != ssis replaced withc.initializedOn.Load() == nil._metanote is backed by go-sdk v1.8.0'sMetaKeyClientCapabilities(io.modelcontextprotocol/clientCapabilities) inmcp/protocol.go.Verification
task: lint reports0 issues.and all packages pass, includingmcpcompat/server.task license-check: exit 0.go test -race -count=20 -run 'DeclaredCapabilities|DeclaredClientCapabilities|FromGoSDKClientCapabilities' ./serverfrommcpcompat/: passes.initializedOncomparison fails the end-to-end test and the two existing rehydrate cases. Replacing it with a nil check fails onlyTestDeclaredClientCapabilities_UnknownWhenReboundToSeededSession.🤖 Generated with Claude Code