跪拜 Guibai
← All articles
JavaScript · Programmers · Artificial Intelligence

The Silent Failure of MCP Elicitation: A User's 'Decline' Still Deletes Your Data

By AI前端工程狮 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A well-formed Elicitation response can be a refusal, and treating it as mere form data deletes data without any error. Any MCP integration using Elicitation for destructive operations must check `action` first, or an explicit "no" from a user gets silently converted into a successful deletion.

Summary

A developer tests MCP Elicitation, the protocol feature that lets a server tool pause and ask the client for user input. The test implements a delete-note tool with a confirmation form and exercises three response actions: `accept`, `decline`, and `cancel`. When the server code correctly checks `action === "accept"`, refusals leave data intact. But when that check is omitted, a `decline` or `cancel` still deletes the note, and the tool reports success; no error appears anywhere in the logs. The protocol delivers a complete, well-formed response, and whether that response means "no" is entirely up to the developer's code.

Beyond the action check, the test reveals three more traps. The SDK validates `content` for `accept` responses against `requestedSchema`, throwing `-32602` for a type mismatch, but it never validates `decline`/`cancel` where content is empty. Capability declaration has a backward-compatibility fallback: an empty `elicitation: {}` silently enables form mode, so a typo doesn't fail. URL elicitation is a separate capability with its own lock. The author concludes with a diagnostic table and a set of server- and client-side guidelines.

Takeaways
— `ElicitResult` returns one of three `action` values: `accept`, `decline`, or `cancel`; only `accept` indicates consent.
— For `decline` and `cancel`, the `content` field is empty, so reading `answer.content.confirm` yields `undefined`; the action field is the only reliable signal.
— Ignoring the `action` check deletes data even when the user clicks `decline` or presses Esc, and the tool reports success with no error or warning.
— The SDK validates `content` only for `accept` responses against the declared `requestedSchema`; a mismatch throws `-32602 InvalidParams`. This validation does not cover `decline` or `cancel`.
— An empty capability declaration `elicitation: {}` is silently treated as supporting form mode due to a backward-compatibility fallback in `getSupportedElicitationModes()`, so a missing `form: {}` doesn't error.
— `form` and `url` are independent capabilities; declaring one does not enable the other. URL mode requires `elicitation: { url: {} }`.
— A correct server implementation needs two checks: first `action === "accept"`, then an explicit `confirm === true` comparison, not a truthiness check.
— The test ran on local Streamable HTTP with SDK 1.30 and a scripted client; URL mode's real browser callback and completion notification were not tested.
Conclusions

The protocol's design puts the burden of honoring refusal entirely on the application developer; a response that looks like valid form data can semantically be a "no".

The backward-compatibility fallback that turns `elicitation: {}` into form support is a time bomb: it keeps misconfigured clients running until the protocol tightens or the implementation changes.

Elicitation's danger compared to Sampling is that failure arrives as a complete, success-shaped response, so the only safeguard is discipline in checking `action` before reading `content`.

Concepts & terms
Elicitation
A Model Context Protocol feature that allows a server-side tool to pause during execution and ask the client side (typically the user) for input, returning an `ElicitResult` containing an `action` and `content`.
ElicitResult action
The three-valued field in an Elicitation response: `accept` (user consented and submitted), `decline` (user explicitly refused), or `cancel` (user dismissed the dialog). Only `accept` is consent; `content` is meaningful only for `accept`.
requestedSchema
A JSON Schema that the server declares with `elicitInput()` to define the expected shape of the user's input. For `accept` responses, the SDK validates `content` against it and throws error -32602 on mismatch.
From the discussion
Featured comments
GenTang

To add a distinction on capability declaration: the 2025-11-25 version explicitly states that elicitation: {} is equivalent to supporting only form, so this is a protocol-defined backward compatibility, not just the SDK's own fallback. Explicitly writing form: {} is clearer, but it's recommended to change "writing it wrong still doesn't error" to "a compatible form allowed by the spec," distinguishing it from not declaring elicitation at all. Official docs: https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#capabilities

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗