Skip to content

fix(mcp): advertise no elicitation capability when no handler is configured#1910

Merged
mattzcarey merged 1 commit into
mainfrom
fix/no-elicitation-capability-without-handler
Jul 9, 2026
Merged

fix(mcp): advertise no elicitation capability when no handler is configured#1910
mattzcarey merged 1 commit into
mainfrom
fix/no-elicitation-capability-without-handler

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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.

  • With a handler (Agent.onElicitRequest override or the elicitationHandler option): { form: {}, url: {} }, unchanged.
  • Without one: no elicitation capability, so servers use their fallbacks instead of sending requests the agent can only reject.
  • An explicit client.capabilities.elicitation declaration 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 handleElicitationRequest on 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 is Agent.onElicitRequest, the elicitationHandler option, or an explicit capability declaration. Called out in the changeset.

Tests

  • Default-capability test updated: no handler → no elicitation capability advertised.
  • RPC elicitation tests migrated from instance-patching to the elicitationHandler option (which also exercises the new gate end-to-end — without the advertised capability the server refuses to elicit).
  • Full MCP suite (29 files / 516 tests) and npm run check green.

Open in Devin Review

…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-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3e20ac8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agents Patch
@cloudflare/agent-think Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1910

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1910

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1910

create-think

npm i https://pkg.pr.new/create-think@1910

hono-agents

npm i https://pkg.pr.new/hono-agents@1910

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1910

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1910

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1910

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1910

commit: 3e20ac8

@mattzcarey mattzcarey merged commit 9e1b733 into main Jul 9, 2026
8 checks passed
@mattzcarey mattzcarey deleted the fix/no-elicitation-capability-without-handler branch July 9, 2026 17:36
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant