fix(mcp): advertise no elicitation capability when no handler is configured#1910
Merged
Merged
Conversation
…igured Connections without an elicitation handler advertised form-mode elicitation while rejecting every request that arrived, so spec- compliant servers chose elicitation over their fallback flows and the tool call failed mid-flight. The capability is now advertised only when it can be handled; without a handler, servers see no elicitation capability and fall back gracefully. Handler registration is gated on the advertisement because the SDK client throws when registering a handler for an undeclared capability. The deprecated instance-patch of handleElicitationRequest no longer receives requests unless the capability is declared explicitly; RPC tests migrated to the elicitationHandler option.
🦋 Changeset detectedLatest commit: 3e20ac8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
agents
@cloudflare/ai-chat
@cloudflare/codemode
create-think
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
This was referenced Jul 9, 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 #1903.
Problem
A connection without an elicitation handler advertised form-mode elicitation (
elicitation: {}) while rejecting every elicitation request that arrived — a leftover from before #1903, when the capability was hardcoded. Spec-compliant servers gate on client capabilities, so the false advertisement made them choose elicitation over their non-elicitation fallback flows, and the tool call then failed mid-flight with an opaque error.Fix
Complete the "capabilities follow the handler" rule from #1903: the elicitation capability is advertised only when it can be handled.
Agent.onElicitRequestoverride or theelicitationHandleroption):{ form: {}, url: {} }, unchanged.client.capabilities.elicitationdeclaration still wins wholesale.Handler registration is now gated on the advertisement — the MCP SDK client throws when registering a request handler for an undeclared capability.
Behavior change
Code relying on the deprecated pattern of instance-patching
handleElicitationRequeston a connection stops receiving elicitation requests (the capability is no longer advertised). That path was undocumented, broke across hibernation, and the client elicitation scenario was baselined as a known conformance failure until #1903 — migration isAgent.onElicitRequest, theelicitationHandleroption, or an explicit capability declaration. Called out in the changeset.Tests
elicitationHandleroption (which also exercises the new gate end-to-end — without the advertised capability the server refuses to elicit).npm run checkgreen.