All Agent Engineering

MCP form elicitation: route accept, decline and cancel

Request non-sensitive fields under the 2025-11-25 revision, check form support and handle the three actions.

AINavWritten / Updated
On this page

At a glance

MCP Elicitation lets a server request additional user information through the client during an interaction. This task asks for a non-sensitive label for a sample document and uses it only after acceptance. Decline and cancel remain distinct states. The example follows form mode in the 2025-11-25 revision; it is not a channel for passwords or API keys.

Runtime and applicability

Article type
Engineering practice
Verified
Applies to
  • MCP Use the cited documentation and version scope. Not tested.

Execution locations and responsibilities

  • MCP server request handler and client interaction UI The server defines fields and routes actions; the client controls review and data sharing.
Engineering workflow order
Engineering workflow order1. Check negotiated capability → 2. Send a flat form request → 3. Route the action before reading data. Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.1. Check negotiated capability2. Send a flat form request3. Route the action before reading data

Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.

When to use

  • Collect additional non-sensitive structured information when the client supports form mode.

When not to use

  • Do not collect credentials through form mode or send it to an unsupported client.

Client and server responsibilities

The client identifies the requesting server, lets the user review and edit the field, and provides decline and cancel controls. The server supplies a purpose and schema, then routes the returned action. The label field and its 1-to-40 length range are choices for this teaching application, not universal MCP limits. The server must bind the request to the actual client and user identity. A self-reported form identity is not an authenticated identity.

1. Check negotiated capability

Read the client’s initialization capabilities and confirm elicitation.form support. Servers must not send a mode the client does not support. For compatibility, elicitation: {} means form support only; it does not establish URL-mode support. Without a compatible capability, preserve the uncollected state and use another interaction path already available in the host.

2. Send a flat form request

The server sends elicitation/create when the interaction requires the label. The JSON below is an illustrative wire message, not an instruction to paste it into an unspecified SDK callback. Form schemas support a restricted subset of JSON Schema with flat objects and primitive properties. This example uses one string field and no nested object.

Example: a non-sensitive document label request
json
{
  "jsonrpc": "2.0",
  "id": 10,
  "method": "elicitation/create",
  "params": {
    "mode": "form",
    "message": "Choose the label for this sample document.",
    "requestedSchema": {
      "type": "object",
      "properties": {
        "label": {"type": "string", "minLength": 1, "maxLength": 40}
      },
      "required": ["label"]
    }
  }
}

3. Route the action before reading data

The three response actions
ActionHandling
acceptRead form content and validate it against requestedSchema before use
declineKeep the explicit refusal; do not write a default as if it were submitted
cancelStop collection without treating dismissal as consent

Handle the returned action as it is. Closing the dialog must not become accept. Validate accepted content before passing the label onward: user control and data validity are separate requirements. This task defines information collection and does not promise a write to an external system.

Sensitive interactions use another mode

The specification forbids form mode for passwords, API keys, access tokens and payment credentials. Such interactions must use URL mode, where the client clearly displays the target host and obtains consent before navigation. URL interaction is not implemented here. A form response is not proof of account authentication; sensitive authorization needs its own flow.

Completion and failure exits

  • The negotiated capability matches the mode; message explains the purpose and requestedSchema covers the needed field.
  • Accepted content passes validation; decline and cancel keep separate states and absent values are not guessed.
  • The client shows the server identity and supports review, editing, decline and cancel; no credential is requested.

The cited revision was read to check capability, modes, response actions and security requirements. No MCP server was connected, client UI launched or real user information collected. The JSON illustrates a protocol message; sending, UI and persistence must be integrated with the actual host interfaces.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Model Context Protocol · MCP 2025-11-25 Elicitation

Found an error? Tell us →