Repository navigation
mcp: label resultType on results that bypass the dispatcher - #1226
Merged
guglielmo-san merged 6 commits intoSep 14, 2026
Conversation
roncodingenthusiast
force-pushed
the
ronald/gh-1225/stamp-resulttype-on-mrtr-results
branch
from
September 1, 2026 21:47
4480282 to
3593e94
Compare
roncodingenthusiast
force-pushed
the
ronald/gh-1225/stamp-resulttype-on-mrtr-results
branch
2 times, most recently
from
September 1, 2026 21:56
8005597 to
87e1f29
Compare
roncodingenthusiast
marked this pull request as ready for review
September 2, 2026 19:05
roncodingenthusiast
force-pushed
the
ronald/gh-1225/stamp-resulttype-on-mrtr-results
branch
2 times, most recently
from
September 2, 2026 19:26
e6a3678 to
9d15c1a
Compare
Protocol revision 2026-07-28 requires resultType on every result. CallToolResult, GetPromptResult and ReadResourceResult hold it in an unexported field, since they can be complete or input_required and so cannot embed completeResultWithType as the seven types in modelcontextprotocol#1060 do. Only handleMultiRoundTripResult writes that field, and it runs inside Server.callTool, getPrompt and readResource. A receiving middleware that returns a result instead of calling next -- an auth, rate limit or entitlement gate -- never reaches it, so the response ships without the field and strict clients reject it as malformed. Move the choice of complete versus input_required into setMultiRoundTripResultType, and call it from both places that need it. setCompleteResultType, which now labels results it did not before, is renamed annotateResultType and picks a branch by type switch. It reads inputRequests() rather than assuming complete, which matters because setResultType is unexported: populating InputRequests is a middleware's only way to ask for input, and labeling it complete would make a conforming client drop the elicitation. Recomputing is safe because a result that did reach the dispatcher was labeled from the same test. Embedding completeResultWithType instead would label every result complete and clobber input_required, breaking multi-round-trip flows. A middleware can also return a typed nil, which satisfies Result, and annotating one panics. That panic predates this change; it happened one frame further on, in annotateServerInfo. Result gains isNil, matching what Params already does, and ServerSession.handle skips annotation for a nil result. Result is sealed by isResult, so adding an unexported method to it is not a breaking change. ServerSession.handle still gates on the request's _meta while handleMultiRoundTripResult gates on the session's negotiated version, so a session that negotiated 2026-07-28 and sends no _meta gets no resultType from a short-circuited request. Only a client that mixes protocol versions can reach that, so TestServerSessionHandle_ResultTypeGate records it rather than changing behavior to cover it. Also correct ten comments naming an exported ResultType field and ResultTypeComplete/ResultTypeInputRequired constants, none of which exist. Two were unresolvable [CallToolResult.ResultType] doc links and now point at [CallToolResult.NeedsInput]. The exported API is unchanged and the conformance goldens do not move. Fixes modelcontextprotocol#1225 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
roncodingenthusiast
force-pushed
the
ronald/gh-1225/stamp-resulttype-on-mrtr-results
branch
from
September 2, 2026 19:31
9d15c1a to
7ef0cb3
Compare
Applies ASD-STE100 Simplified Technical English to the comments touched in the resultType labeling change: complete sentences with explicit subjects, no -ing verb clauses, and "must" instead of "should" for the InputRequests requirement.
…ulttype-on-mrtr-results
This comment was marked as resolved.
This comment was marked as resolved.
…ulttype-on-mrtr-results
handleMultiRoundTripResult also labeled resultType, so the field was set in two places under two different conditions: the session's negotiated version there, and the request's _meta in ServerSession.handle. The dispatcher read the field it had just set. callTool used it to keep a nil Content as "null", and readResource used it to return early before the nil Contents error. Both now test InputRequests directly, which is what the label was derived from, so neither depends on the labeling. handleMultiRoundTripResult is left only rejecting a result that carries both content and input requests, so rename it to validateMultiRoundTripResult and drop the now-unused session parameter. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@guglielmo-san anything else needed for this? I have a small patch I made to my MCP so i am trying to figure when this will be release so i can remove the customization on my end |
…ulttype-on-mrtr-results
guglielmo-san
approved these changes
Sep 14, 2026
Contributor
|
@roncodingenthusiast thank you for the contribution! As we just released v1.8.0, this code change will be included in next release that will happen in ~2 months |
jmrplens
added a commit
to jmrplens/gitlab-mcp-server
that referenced
this pull request
Sep 28, 2026
… the three go-sdk defects behind them (#1032) Issue 961 tracks four behaviours of go-sdk v1.8.0 that decide what a caller of this server sees when it is refused or when a subscription ends. None of them can be fixed here, and each retires on a go-sdk release, so this layer does the local half: it records the three that had no entry in `docs/development/upstream-bugs.md`, corrects what the documentation said about a refused listen and about a client whose session is gone, and pins today's behaviour of the three that had no test, so the go-sdk bump that changes one fails in its own pull request and says what to update. The issue stays open until go-sdk ships the fixes. ## The pins Each is a new test file in a transport module, driving the real binary, and each failure message names the register row, the tenant policy row and every page the change has to update. - **Item 1, `resultType` on a result a middleware makes** (`test/e2e/http/result_type_test.go`). The rate limiter's refusal of a `tools/call` at 2026-07-28 carries no `resultType`, while the call served just before it carries `"complete"`. The 2026-07-28 schema says a server implementing it MUST send the field, and its rule that a client reads an absent one as complete covers only a server of an earlier revision, so until the bump this server breaks that MUST on every rate-limited `tools/call`. Upstream fixed it in e40f35d ([modelcontextprotocol/go-sdk#1226](modelcontextprotocol/go-sdk#1226)), four commits after the v1.8.0 tag. I ran the test against a go-sdk that contains e40f35d and it failed with its message. - **Item 3, no new session after a 404** (`test/e2e/http/session_not_found_test.go`). A go-sdk client on 2025-11-25 against `--stateless=false`, on each path the gate's 404 can meet it: a call under another credential on a live session, and, after the session idles out under `--session-timeout`, a call, the standalone stream and a notification. It holds what each path does today and that no second `initialize` is ever sent. - **Item 4, no `notifications/cancelled` for a listen the server ends** (`test/e2e/stdio/listen_end_test.go`). A listen on stdio at 2026-07-28 whose issue starts answering 404 after the acknowledgment: the listen's own result carries `resource_gone` with status 404, and no cancellation arrives before it or before the answer to a later call. A cancellation naming the listen fails the test on arrival with its message, rather than leaving it to time out, and the change has to keep the watch-end on the result (PAT-005). Item 2 already had its pin, `TestListenRefusal_BeforeTheAcknowledgment_UnseenByTheModernSDKClient`, from #1011. ## What the item 3 pins found The gate writes a JSON-RPC error body on every refusal, and it can name the request only when the request carries an id. That splits what a go-sdk v1.8.0 client does with the 404 in two: - A **call** carries an id, so go-sdk decodes the body before it looks at the status: the call fails with the gate's own message, the connection is kept, and the client sends every later call on the dead session ID. The message says the session "does not belong to the presented credential" even when the session simply expired, because the gate has one message for every session it will not serve. - The **standalone stream's GET** and every **notification** carry no id, the body then carries none either, go-sdk cannot decode it, and the client fails the connection with `ErrSessionMissing`. When the server ends a session, the stream ends with it and its reconnect is what meets the 404, so a default client whose session expires or is evicted fails within a couple of seconds without making a call. Neither starts a new session. The idle timeout is what makes this ordinary: every long-lived Go SDK client of a stateful deployment meets it after 30 minutes of silence, as well as after an eviction, a restart or a request to another replica. I ran the same tests against the head of [modelcontextprotocol/go-sdk#1300](modelcontextprotocol/go-sdk#1300) (d3d7b33), which starts a new session on `ErrSessionMissing`: | go-sdk client | a call | the stream after the session ends | a notification after the session ends | | --- | --- | --- | --- | | v1.8.0 | the body's error, connection kept, dead session | `ErrSessionMissing`, connection failed | `ErrSessionMissing`, connection failed | | head of the go-sdk pull request | the body's error, connection kept, dead session | new session, calls served | new session, notification resent | So the pull request reaches this server's 404 wherever the 404 names no request, which covers a default client, and misses a call, which is what a client with the stream disabled, a call made before the stream reconnects, or a live session under another credential meets. With `MCPGODEBUG=noprotocolerrorbody=1` the call path takes the other path too, so the body decoding is the only thing in the way there. Row 68 records the table. I posted this measurement on that pull request, with a review offering the change to `checkResponse` that makes a call recover too, and the top of the stack records both in row 68. ## Records and documentation - `docs/development/upstream-bugs.md`: rows 66 to 68 in the summary and a section for each under the go-sdk heading, in the five-field format, read off the trackers on 2026-09-27. The branch wrote them as 61 to 63; the joint client-go merge request landed on `main` first and took 61 to 65, so they follow it, and the ADR, the e2e README and the pins' fix messages cite the new numbers. Rows 66 and 68 record their workaround as "none taken" and name the register row that declines it. Every other go-sdk link was read again the same day: only [modelcontextprotocol/go-sdk#1209](modelcontextprotocol/go-sdk#1209) had moved, with a comment reporting that the pull request under row 9 leaves part of that defect open, which row 9 now says. v1.8.0 is still the newest tag, 24 commits behind `main`. Row 10 names its new pin. Where this branch and `main` both rewrote a paragraph of the register (the dated re-verification, row 9's review state, the go-sdk index), both are kept, and the filing date of [modelcontextprotocol/go-sdk#1299](modelcontextprotocol/go-sdk#1299) reads 2026-09-25, as the tracker records it, in both. - `docs/reference/capabilities/subscriptions.md` and the site's subscriptions page in English and Spanish: a refused `subscriptions/listen` at 2026-07-28 is the JSON-RPC error answering the listen, sent before any acknowledgment, not a stream closing. Any client that reads the response sees it; the Go SDK client never does, and since it records the URI as subscribed before sending, a second `Subscribe` to it sends nothing until `Unsubscribe`. The pages now also name the listen's own refusals (the listen-stream ceilings), this server's own rate limit apart from the GitLab one, and what a refusal costs. - `docs/guides/http-server-mode.md`, the site's HTTP server page in English and Spanish, and ADR-0020: where they said a client re-initializes after its session is terminated or expires, they now say a client that follows the 2025-11-25 transport does and the Go SDK client does not. - `test/e2e/README.md`: the transport modules now also hold pins of go-sdk behaviour against the real binary, which fail on a dependency bump rather than on a change of ours. ## Not in this layer - The comment on `checkSessionOwnership` in `cmd/server/auth_gate.go`, which said the 404 self-heals: the top of the stack corrects it to say the 404 heals only for a client that follows the 2025-11-25 MUST, and that a go-sdk v1.8.0 client keeps the dead session on a call and fails the connection on its stream or a notification. Whether the refusal's text, "This session does not belong to the presented credential", ought to differ for a session the server no longer holds (idle timeout, eviction, restart), since today a client's own expired session is described as somebody else's, is a change to ADM-007's declared text and to this layer's pin, which quotes it, and is left for a change of its own. - The pin of item 2 in `internal/tenancy/channels_integration_test.go`, whose failure message names only the tenant policy specification and `Carriages()`. The release that retires F-21 will also have to update row 67 of `upstream-bugs.md`, `docs/reference/capabilities/subscriptions.md` and both site subscriptions pages. That file belongs to the lane that rewrites `internal/tenancy`, so the message is theirs to widen. - The paragraph about the transport modules in `CLAUDE.md`, which described every case as a shipped defect: the top of the stack adds that the modules also hold the go-sdk pins of rows 10, 66 and 68. - The bump itself, and the retirements that follow each release, which are gated upstream. ## Verification - The pins pass on go-sdk v1.8.0. Against the head of the go-sdk pull request above, which carries e40f35d, the item 1 pin fails, and the item 3 stream and notification cases fail on the second `initialize` while the call cases pass, each with its message. The call cases skip under `MCPGODEBUG=noprotocolerrorbody=1`, which turns off the decoding they pin. - Both transport modules in full on the branch, each on its own as the Makefile runs them: `test/e2e/http` passed in 273 s and `test/e2e/stdio` in 114 s. - On this layer as stacked on `main`: `go build ./...`, `go vet ./...`, the e2e compile of `./test/e2e/gitlab/...`, and `go vet` of the e2e, `httpe2e`, `stdioe2e` and `orbitlive` trees, all through rgo. No production Go code changes. - The freshness artifacts (the testing reference and the rest) are refreshed once at the top of the stack. Part of #961.
jmrplens
added a commit
to jmrplens/libgen-mcp
that referenced
this pull request
Sep 30, 2026
Revision 2026-07-28 requires resultType on every result. go-sdk v1.8.0 sets it on a tools/call result only inside its own tool dispatcher, and the rate limiter and the per-caller ceiling answer a refused call from a receiving middleware before that dispatcher runs, so every refusal went to a 2026-07-28 client without the field while the call served just before it carried "complete". RefusalResult now takes the request it refuses. When the request names 2026-07-28 or later in its _meta, the same test the SDK applies, the refusal is built in its wire form with resultType "complete" and read back through CallToolResult.UnmarshalJSON, the one public way to set the unexported field. An earlier revision gets no field, as the SDK does for its own results. Upstream fixed this in e40f35d (modelcontextprotocol/go-sdk#1226), which no release carries yet. A unit test pins the SDK's current behavior on a bare server, so the bump that brings the fix fails there and says to remove the workaround. The new docs/development/upstream-bugs.md records the entry.
jmrplens
added a commit
to jmrplens/libgen-mcp
that referenced
this pull request
Sep 30, 2026
…28 (#274) ## What was wrong Revision 2026-07-28 requires `resultType` on every result. go-sdk v1.8.0 sets it on a `tools/call` result only inside its own tool dispatcher, and this server refuses a call from two receiving middlewares, the rate limiter and the per-caller ceiling on downloads and reads, before that dispatcher runs. Every such refusal therefore reached a 2026-07-28 client without `resultType`, while the call served just before it carried `"complete"`. The schema's rule that a client reads an absent field as complete covers only servers of earlier revisions, so these refusals broke a MUST. ## What changed - `toolutil.RefusalResult` takes the request it refuses. When that request names 2026-07-28 or later in its `_meta` (the same test the SDK applies), the refusal is built with `resultType: "complete"`. The SDK keeps the field unexported, so the refusal is written in its wire form and read back through `CallToolResult.UnmarshalJSON`, the one public way to set it. A client of an earlier revision gets no field, as it does from the SDK's own dispatcher. - Upstream fixed this in e40f35d ([modelcontextprotocol/go-sdk#1226](modelcontextprotocol/go-sdk#1226)), which no release carries yet. The new `docs/development/upstream-bugs.md` records the entry and what retires the workaround. ## Tests - `TestRateLimitedToolCall_ResultTypeFollowsTheRevision` (`test/e2e/http`) drives the real binary at 2026-07-28 and 2025-11-25 and asserts the limiter's refusal carries the same `resultType` as the call the dispatcher served before it. It fails on the previous code. - `TestTheCeilingRefusalCarriesResultTypeAtTheModernRevision` (`cmd/server`) covers the ceiling's refusal. - A revision table in `internal/toolutil` covers every request shape `RefusalResult` can be handed, including a typed-nil params value. - `TestSDKLeavesAMiddlewareMadeToolResultUnlabeled` pins the SDK's current behavior on a bare server; the go-sdk bump that ships e40f35d fails there and names what to remove. `go test ./...`, `go test -race` on the two touched packages, `make test-e2e-http`, `make test-e2e-stdio`, `make cover-check` (95.3%), lint with every build tag and the godoc audit pass.
jmrplens
added a commit
to jmrplens/gitlab-mcp-server
that referenced
this pull request
Oct 1, 2026
…7-28 requires (#1120) Revision 2026-07-28 requires `resultType` on every result. go-sdk v1.8.0 sets it on a `tools/call` result only inside its own tool dispatcher, because such a result can also be `input_required`, so a result a receiving middleware returns in the dispatcher's place goes out without it. Two middlewares here do exactly that: the rate limiter refuses a `tools/call` with a tool error (the ToolError channel of tenancy row RTC-001), and the held-call ceiling does the same (row HLD-011). The rate limiter's refusal reached a 2026-07-28 client with no `resultType`, while the call served just before carried `"complete"`. The held-call ceiling's had the same defect wherever a 2026-07-28 call reaches it, which the gate makes nearly never: at that revision the gate takes the slot of a POST itself, or refuses it, before the SDK reads it, stateful HTTP refuses the revision at the transport, and stdio is not counted, so its label is defensive. That is the defect recorded as row 66 of `docs/development/upstream-bugs.md` and as finding F-20 of the tenant policy specification, and upstream fixed it in e40f35d ([modelcontextprotocol/go-sdk#1226](modelcontextprotocol/go-sdk#1226)), which no tag carries yet: v1.8.0 is still the newest on 2026-10-01. Both records said the field could not be set from outside the SDK, because its setter is unexported. That was wrong. `CallToolResult.UnmarshalJSON` is public and copies the wire `resultType` into the unexported field (`mcp/protocol.go` in v1.8.0). I found the technique in the sibling project libgen-mcp, which labels its own refusals this way: jmrplens/libgen-mcp@af1cdef `toolutil.LabelForRevision` (`internal/toolutil/result_type.go`) takes the request and the result. When the request names 2026-07-28 or later in its `_meta`, compared as a string, the result is written with every field it has plus the `resultType` the SDK's dispatcher would have given it, and read back through `UnmarshalJSON`. That label is `"input_required"` when the result carries `InputRequests`, which is how the dispatcher decides it, since labeled `"complete"` a result asking for input would tell a client that trusts the label to drop the requests; it is `"complete"` otherwise, which is what both refusals get. The fields decoding rebuilds rather than keeps are then put back as they were: a nil content would come back empty, an empty map of requests, the SDK's load-shedding answer, would not come back at all, a sampling request would come back as another type, and a number past float64's exact range would come back rounded. So on the wire the copy is the result plus its label. An earlier revision gets the result as it is. The `_meta` test is the one v1.8.0 applies to the results it labels once the middleware chain returns (`validateRequestMeta` in `mcp/shared.go`, then `setCompleteResultType`), and the one e40f35d applies to every result. v1.8.0's tool dispatcher reads instead the revision the session recorded when it began (`clientSupportsMultiRoundTrip` in `mcp/mrtr.go`), and the two differ only where that revision and a request's `_meta` disagree: a client negotiated down from 2026-07-28 gets the dispatcher's label and not this one, which its revision does not require, and a client that negotiated an earlier revision and then names 2026-07-28 in a request's `_meta`, which v1.8.0 accepts over stdio, gets this label and not the dispatcher's, which is what that revision requires and what e40f35d sends. The params are read by their concrete type, because a typed nil behind the `Params` interface panics in `GetMeta`. A nil result stays nil, and a result that cannot make the round trip is handed back unlabeled; no refusal this server makes is one. I looked for every result a receiving middleware builds by the type checker's view rather than by name: every return, assignment and declaration in `internal/...` and `cmd/server` that hands a concrete type to something typed `mcp.Result`. Two are tool results, and both are labeled now: the rate limiter's refusal, where it leaves the middleware in `attachRateLimitFunc`, and the held-call ceiling's in `heldRequestsRefusal`. No middleware here builds a `GetPromptResult` or a `ReadResourceResult`. The two empty completions are `CompleteResult`, which the SDK labels after the middleware chain returns; `clientcompat` rewrites a tool or prompt result as a struct copy of what the dispatcher labeled, so the copy keeps the field; and `gatewaycompat` rewrites only listings, which the SDK labels after the chain too. Every refusal keeps its text, its error flag and its channel, and `make check-tenancy` is green on them. `TestSDK_MiddlewareToolResult_GoesOutUnlabeled` in `internal/toolutil` pins the SDK's own behavior on a bare server over the in-memory transport: a result the dispatcher makes carries `"complete"` and one a middleware makes carries nothing. I ran it against go-sdk at e40f35d and it fails there with a message naming row 66 and everything the bump has to retire: the two files, the call at each refusal and the parameter `heldRequestsRefusal` gained for it, the two middleware tests that read the refusal before the SDK labels it (they fail once the refusals are returned as built) and the helpers they borrow, and every comment and page that speaks of the label. So the bump that brings the fix cannot land without retiring this. `TestLabelForRevision_OverTheSDK_ReachesTheWireAsTheServedCallDoes` beside it drives the workaround through the same server, and `TestLabelForRevision_EachResult_GoesOutAsItWasBesideTheDispatchersLabel` holds the copy to the result it was made from, for results asking for input and for the fields decoding would rebuild. The pin in `test/e2e/http` that asserted the absence on the real binary is now `TestRateLimitedToolCall_EachRevision_CarriesTheResultTypeTheServedCallDoes`: at 2026-07-28 the limiter's refusal carries `"complete"`, as the served call does, and at 2025-11-25 neither carries the field. It fails on the code before this change and passes on a binary built against e40f35d, where the SDK labels the refusal with the same value. In the tenant policy register, RTC-001 no longer carries F-20 and records issue 961 in `Decided`, which is how the register marks a finding its issue answered. F-20 stays in the findings list as issue 961's and joins the answered set the register's test names, and the specification's paragraph on answered findings says so. F-21 stays carried, since issue 961 stays open for it and for F-22 and F-24. Row 66 of `docs/development/upstream-bugs.md` now records the workaround, where it lives, the revision test and the unit pin that fails on the bump, and its summary row reads Workaround "Yes, until the bump that carries it". The entry stays open until that bump. `CLAUDE.md` and `test/e2e/README.md` named `result_type_test.go` as the pin of row 66 that fails on a dependency bump; they now say the pin of a defect the server works around is the unit test, and what the e2e test holds instead. No other page, on the site in either language included, said the refused call carries no `resultType`. What I ran on the branch, rebased on main at dec3a09, remotely unless noted: - `go test -shuffle=on` over `internal/toolutil`, `internal/tenancy` and `cmd/server`: all pass, statement coverage 100.0% in each. - gobco: `internal/toolutil` 3742/3742 conditions. `internal/tenancy` 408/408 and no uncovered condition in `held.go` (the 42 open ones in `cmd/server` are in files this change does not touch), measured on the first revision of the branch; the code of both is unchanged since. - gremlins on `result_type.go`: 11 killed, 0 lived, 0 not covered, 0 timed out. On the first revision, whose `rate_limit.go` and `held.go` are unchanged since: `rate_limit.go` had no living mutant and one not covered, the constant initializer `defaultThrottleWindow = 10 * time.Second` (no statement counter), which, applied by hand, fails `TestRateLimiter_RefusalIsReportedAndSelfSuppressed`; `held.go` 23 killed, 0 lived, 0 not covered, 0 timed out; `decisions_allow.go` has no mutant. - `golangci-lint run --build-tags e2e` on the three packages and `--build-tags httpe2e` on `test/e2e/http`: clean. - `make check-tenancy`, `make check-test-goroutines`, `make check-test-subtests` and `make check-test-file-names`: pass. - `make test-e2e-http`: 607 tests, 7 skipped (the balancer and proxy cases, for want of Docker in the container), none failed. - The e2e compile (`go test -tags e2e -c ./test/e2e/gitlab/...`). - Locally: `gen_testing_docs -skip-coverage` and `gen_stats`, both with `--check` clean, `format_md_tables --check`, `markdownlint-cli2` on the changed pages, and `scripts/check-em-dash.sh` on the diff and on this description. Related to #961
jmrplens
added a commit
to jmrplens/gitlab-mcp-server
that referenced
this pull request
Dec 4, 2026
Moves `github.com/modelcontextprotocol/go-sdk` from v1.8.0 to v1.9.0 (released 2026-11-30, no new protocol revision) and takes in everything the release changes for this server: the pins that fail on it, the workarounds it makes unnecessary, and the pages that describe the old behaviour. The dependency sweep in #1985 held go-sdk at v1.8.0 for this change. ## What v1.9.0 changes, and what changed here | go-sdk change | Here | | --- | --- | | A handler or middleware error with no JSON-RPC code goes out as `-32603` with its text, no longer as code 0 ([#1407](modelcontextprotocol/go-sdk#1407)) | Correct per JSON-RPC, adopted. The carried-channel tests in `internal/tenancy` expect `-32603` (plain error and load shedding at 2025-11-25); the Refusal channels section of the tenant policy spec, `Validate`'s "no code" reason, the `CodedError` comment and the subscriptions page (EN and ES) say so | | `-32022` (unsupported protocol version) is answered with HTTP 400 in both eras | Correct per the transport spec, adopted. `sdkStatus` maps it in both eras; the spec says which statuses an in-band error takes. No register row emits `-32022` | | A typed nil result from a middleware is answered `null` at 2026-07-28 instead of ending the process | The test is renamed `TestTypedNilResult_FromAMiddleware_IsAnsweredNullInBothEras` and still runs each era in a child process; the spec keeps "a refusal is always an error" with the new reason | | Results a middleware returns are labeled with `resultType` like the dispatcher's ([#1226](modelcontextprotocol/go-sdk#1226), for [#1225](modelcontextprotocol/go-sdk#1225)) | Workaround retired: `internal/toolutil/result_type.go` and its tests are deleted, and the rate limiter, `heldRequestsRefusal` (its `req` parameter dropped) and both toolvisibility middlewares return their refusals as built. RTC-001, AUT-007, AUT-008 and the F-20 paragraph say the SDK labels them. `test/e2e/http/result_type_test.go` and the fine-grained e2e case still hold the label on the wire, and pass | | The client's `Ping` fails locally on a 2026-07-28 session, which removed ping ([#1378](modelcontextprotocol/go-sdk#1378)) | Test-only: `pingWithin` in `cmd/server` asks `server/discover` on such a session. The server's keepalive stays off; nothing in production changes | | The client passes the input requests of a multi round-trip result through its own receiving middleware as `elicitation/create` ([#1479](modelcontextprotocol/go-sdk#1479)) | Test-only: `callAs` in `language_test.go` counts the `elicitation/create` requests the server sends at the transport | | The multi round-trip interaction is chosen by the negotiated version, and input requests answered on a session negotiated below 2026-07-28 are fulfilled by the SDK with `elicitation/create` ([#1266](modelcontextprotocol/go-sdk#1266), for [#1258](modelcontextprotocol/go-sdk#1258)) | `internal/elicitation.FlowFromRequest` keeps reading the version the request states (the SDK exposes no negotiated one per request, and reconciles the two), with its comment rewritten. `test/e2e/stdio/elicitation_declared_version_test.go` is no longer a pin of an SDK defect: it asserts the legacy flow, a first question sent as `elicitation/create`, and a result with no `resultType` or `inputRequests`, and a second case accepts the title and the description and checks that the third question asks for the labels, so the SDK's fulfillment carries every answer and the signed state. The elicitation page (EN and ES) says the negotiated version decides | | Streamed POST responses are kept alive by the SDK, committing the headers after an interval of silence ([#1477](modelcontextprotocol/go-sdk#1477), for [#1262](modelcontextprotocol/go-sdk#1262)) | `streamableHTTPOptions` passes `StreamKeepAlive: sseKeepAliveInterval` (25 s), and `sseAwareWriter` no longer heartbeats a POST response, so a stream never carries two; it still clears the write deadline and keeps the standalone GET alive. A silent tool call now gets bytes on the wire before its result. The unit and e2e keep-alive tests assert that; the HTTP server, remote deployment and troubleshooting pages (EN and ES) drop the "a silent tool call gets no keep-alive" advice, and the spec notes that a keep-alive committed POST takes a protocol error as an event at 200 | | `MCPGODEBUG` switches removed, among them `customresnotfounderrcode` and `noprotocolerrorbody` | `subscriptions.isResourceNotFound` compares against `jsonrpc.CodeInvalidParams` (no deprecated variable, no `nolint`, and `internal/subscriptions` no longer imports `mcp`); the dead `noprotocolerrorbody` skip in `session_not_found_test.go` is gone | | `mcp.HasParams` ([#1269](modelcontextprotocol/go-sdk#1269), for [#1261](modelcontextprotocol/go-sdk#1261)) | Adopted: `mcpotel.paramsOf` and the e2e harness drop their reflect checks | | Notifications go to each session on a goroutine of their own ([#1228](modelcontextprotocol/go-sdk#1228)) and `_meta` is cloned per session ([#1490](modelcontextprotocol/go-sdk#1490)) | Already allowed for by `sessionOwners.sendingMiddleware`; its comments, ADR-0020 (whose "what in the go-sdk this rests on" section is re-verified against v1.9.0) and the resource hot spots page say it is released | | A second listen on a URI no longer clobbers the first ([#1360](modelcontextprotocol/go-sdk#1360), for [#1359](modelcontextprotocol/go-sdk#1359)); `Subscribe` awaits the listen in the background and clears its entry when it ends ([#1283](modelcontextprotocol/go-sdk#1283), for [#1169](modelcontextprotocol/go-sdk#1169)) | The resubscribe caveat in the e2e harness (on `TrySubscribe`, `Subscription.Close` and the subscription's cleanup) is retired; the subscriptions and troubleshooting pages (EN and ES) describe the v1.9.0 client. A resubscribe during the earlier listen's teardown is now something a client does, and it exposed a race in `sessionBridge`: the unsubscribe released the last hold and stopped the watch with nothing held between the two, so a resubscribe joining in that gap was acknowledged on a stopped watch. The subscribes and unsubscribes of one watch now run under a lock per session and URI (a waiting subscribe gives up with its request), pinned by `TestSessionBridge_ResubscribeDuringTeardown_KeepsTheWatch`, which fails without it | | The cancellation reason reaches the handler as the context's cause ([#1255](modelcontextprotocol/go-sdk#1255), for [#1254](modelcontextprotocol/go-sdk#1254)) | Not logged: it is text the client writes. The `wasCancelled` comment says so instead of saying it cannot be read | Version mentions move to v1.9.0 in CLAUDE.md, the Copilot and agent instructions, the architecture, HTTP server, subscriptions and troubleshooting pages (EN and ES), the tenancy package, ADR-0020 and ADR-0027. `docs/development/upstream-bugs.md` records every go-sdk row that shipped in v1.9.0 and what it retired; the rows still open upstream (malformed messages, `notifications/cancelled` for a listen, the client after a 404) keep their pins, which pass. CLAUDE.md and `test/e2e/README.md` now name two go-sdk pins, `listen_end_test.go` and `session_not_found_test.go`. ## Upstream changes this release ships Ours: [#1266](modelcontextprotocol/go-sdk#1266), [#1267](modelcontextprotocol/go-sdk#1267) (stdio at 2026-07-28; HTTP still answers a cancelled call), [#1255](modelcontextprotocol/go-sdk#1255), [#1268](modelcontextprotocol/go-sdk#1268), [#1269](modelcontextprotocol/go-sdk#1269), [#1360](modelcontextprotocol/go-sdk#1360), [#1490](modelcontextprotocol/go-sdk#1490), [#1273](modelcontextprotocol/go-sdk#1273), [#1274](modelcontextprotocol/go-sdk#1274). Others' that this server tracked: [#1477](modelcontextprotocol/go-sdk#1477), [#1242](modelcontextprotocol/go-sdk#1242), [#1464](modelcontextprotocol/go-sdk#1464), [#1524](modelcontextprotocol/go-sdk#1524), [#1226](modelcontextprotocol/go-sdk#1226), [#1283](modelcontextprotocol/go-sdk#1283). ## Left for a decision - **Request id on spans** ([#1464](modelcontextprotocol/go-sdk#1464)): `Request.GetID` makes `jsonrpc.request.id` recordable, but the id is the client's own value and the telemetry page and the collector privacy suite promise no client-controlled value on a span. Not adopted. - **Per-session resource updates** ([#1524](modelcontextprotocol/go-sdk#1524)): `ServerSession.NotifyResourceUpdated` could deliver to an owner's 2026-07-28 sessions directly; legacy `resources/subscribe` sessions still need the sending middleware, so this is an optimisation, not a retirement. - **`OnRequestSummary`** and the opt-in `MCPGODEBUG=demotesessionlifecyclelog=1` are not used. ## Verification Run on the branch, through the remote runner unless noted: - `go build ./...`, `go vet -tags e2e,stdioe2e,httpe2e ./...` - `go test ./internal/... ./cmd/... -count=1`: green except `cmd/orbit_fixtures`, which reads git and fails only because the remote copy is not a repository (it passes in CI) - stdio and HTTP transport e2e modules against a binary built from the branch: both green - `golangci-lint`, `govulncheck`, `check-tenancy`, `check-supply-chain`, the 1:1 audit scopes (`sdk`, `paths`, `grants`, `required`, `params`, `routes`, `enums`), `check-audit-1to1-baseline`, `check-testing-docs`, `check-md-tables`, `check-doc-links`, `check-doc-tool-names`, `check-e2e-static` and the test-shape, i18n, escaping, action-id, godoc and surface-quality gates - locally: `check-file-headers`, `check-em-dash`, `check-dco`, `check-pr-description`, the site's `i18n:check`, `build` and `lint`, markdownlint on the changed Markdown - The branch is rebased on main after #1985 landed, with client-go v3.60.0 and the rest of that sweep, and again after #1987 (R-ROUTE wave 4, 38 new actions) landed. Wave 4 uses none of the helpers this bump retires, and only the testing reference needed regenerating. On the tree rebased onto #1987: `go build`, `go vet` with every e2e tag, the unit suite (with the request inventory recorded from it, which comes out unchanged), both transport e2e modules, `golangci-lint`, `govulncheck`, the seven 1:1 scopes, the baseline, `check-supply-chain`, `check-tenancy`, the generated-artifact gates CI runs, the local gates and the site gates. All pass - `go test -race` over `cmd/server` and `internal/subscriptions` - The release rehearsal (`release.yml` dispatched on dc520bb, before the rebase onto #1987) passed every job. That includes the Docker GitLab e2e gate, which drives the real binary through the go-sdk `ClientSession` this bump changes, the race gates, the reproducible build and every publisher's dry run. Dispatched again on the rebased head 6f9fcfd, it passed all 20 jobs. --------- Signed-off-by: José M. Requena Plens <mail@jmrp.io>
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.
Fixes #1225. See the issue comment.
The bug
2026-07-28requiresresultTypeon every result.CallToolResult,GetPromptResult, andReadResourceResultkeepresultTypein an unexported field. Each of these results can becompleteorinput_required, so it cannot embedcompleteResultWithTypethe way the seven types in #1060 do.Only
handleMultiRoundTripResultsets that field. It runs insideServer.callTool,getPrompt, andreadResource. Some middleware returns a result directly instead of callingnext— for example, an auth, rate-limit, or entitlement gate. That middleware never reacheshandleMultiRoundTripResult. The response then ships without the field, and strict clients reject it.The fix
The choice between
completeandinput_requirednow happens insidesetMultiRoundTripResultType. Both call sites that need this choice call that function.setCompleteResultTypenow labels results it did not label before, so it is renamedannotateResultType. The new function picks a branch with a type switch.Reading matters here.
setResultTypeis unexported, so settingInputRequestsis the only way for middleware to ask for input. If the code always labels resultscomplete, the response ships as{"resultType":"complete","inputRequests":{...}}. A client that trusts the discriminator then drops the elicitation request.Recomputing the label every time is safe. A result that did reach the dispatcher already carries the same label from that test. This also covers one edge case: a handler that returns
InputRequestsagain after the shim's single reinvocation. Before this fix, that case shipped with noresultType.Embedding
completeResultWithTypeinstead is not an option: it labels everythingcompleteand overwritesinput_required, breaking multi-round-trip flows.Skip nil results. Middleware can return a typed nil value, which satisfies the
Resultinterface.handlenow checks for that case before it calls the labeling function. Before this change, that same case also panicked, one frame later inannotateServerInfoand thenGetMeta.Checks
TestServerSessionHandle_SetsResultTypeWhenMiddlewareShortCircuitsfails on all three methods before the first change. Its fourth case fails if labeling overwrites a populatedInputRequests.TestServerSessionHandle_ResultTypeGaterecords which requests carryresultType, including one known gap. See "Separate from this PR" below.TestServerSessionHandle_NilResultFromMiddlewarepanics without the nil check.TestServerSessionHandle_SetsResultTypeOnNewProtocolalso pass before this change. They close a gap in mcp: include resultType on new-protocol responses #1060, which added only three cases, and only forinput_required.go doc -all ./mcp, with comments stripped, is identical before and after this change.tools/calland the short-circuitedtools/callboth now returnresultType: "complete".I could not run
./scripts/conformance.sh. CONTRIBUTING.md names that script, but the repo only hasclient-conformance.shandserver-conformance.sh. Both scripts need GNUtimeout, and macOS does not include it.Also here
Ten comments named an exported
ResultTypefield andResultTypeComplete/ResultTypeInputRequiredconstants. None of those exist. Two of the comments were[CallToolResult.ResultType]doc links, and those links cannot resolve. They now point at[CallToolResult.NeedsInput]instead, because an unexported field is also not a valid link target.