
Asking the user: elicitation and multi round-trip requests
Asking the user: elicitation and multi round-trip requests
Where you are: Module 1, lesson 5. You know the server primitives (L04). This lesson covers the one active client feature in revision 2026-07-28, elicitation, and the mechanism that carries it: multi round-trip requests (MRTR).
What changed in V2: the earlier lesson taught sampling, roots and elicitation as equal "client primitives". In 2026-07-28 sampling and roots are deprecated and servers no longer send requests to clients. See the sidebar.
What you will be able to do
- Explain how a server asks for input in 2026-07-28:
InputRequiredResult, then a retry withinputResponsesandrequestState. - Choose between form mode and URL mode, and refuse any design that collects secrets through a form.
- Handle all three user actions (
accept,decline,cancel) and the case where the client lacks the capability. - Run a server that asks for confirmation before a state change and drive both rounds by hand.
Elicitation in one paragraph
Elicitation lets a server ask the user for information in the middle of a request. The client decides how to show it and the user can refuse. Two modes (current, 2026-07-28):
- Form mode: the server sends a
messageand arequestedSchema; the client renders a form. The data passes through the client. - URL mode: the server sends a
messageand aurl; the user completes the interaction in a browser, outside the client. Data other than the URL does not pass through the client.
The client declares support on every request, in _meta:
{"_meta":{"io.modelcontextprotocol/clientCapabilities":{"elicitation":{"form":{},"url":{}}}}}
An empty "elicitation": {} means form mode only. Servers MUST NOT send a mode the client did not declare.
Never ask for secrets in a form
Servers MUST NOT use form mode to request "passwords, API keys, access tokens, or payment credentials", and MUST use URL mode for those interactions. A name or email is not categorically forbidden; the user must be able to review and decline.
URL mode rules: clients MUST NOT pre-fetch the URL or open it without explicit consent, and MUST show the full URL first. Servers MUST NOT put credentials or personal data in the URL, MUST NOT send pre-authenticated URLs, and MUST verify that whoever opens the URL is the user who triggered the request (otherwise a forwarded link becomes phishing). URL mode is not how the client authorises to your server (that is L13); it is how the server obtains something, such as a third-party OAuth grant, without the client or model seeing it.
Multi round-trip requests (current, 2026-07-28)
Before 2026-07-28, a server sent elicitation/create as its own JSON-RPC request to the client. That is removed: servers MUST NOT send requests on stdio or HTTP. Instead:
- The client sends a normal request (
tools/call,prompts/getorresources/read; only these three may get an input-required reply). - The server answers with
resultType: "input_required", aninputRequestsmap and, optionally, an opaquerequestState. - The client asks the user, then retries the original request with a new JSON-RPC
id, addinginputResponses(same keys) and echoingrequestStateexactly. - The server completes, or asks again.
Each round is independent, so any server instance can handle the retry: no shared session storage, no sticky load balancing.
Security rules: the client MUST NOT inspect or modify requestState; the server MUST treat it as attacker-controlled and, if it influences authorisation or business logic, protect its integrity (HMAC or AEAD) and reject state that fails verification. Servers SHOULD bind it to the principal, a short expiry and the originating request, and MUST NOT assume the client will answer or retry.
Worked example: confirm before releasing a reservation
Official Python SDK mcp 2.3.0. A resolver returns an Elicit marker; the SDK turns it into an InputRequiredResult for 2026-07-28 clients and injects the answer on the retry (2025-11-25 clients get a legacy mid-call request). Save as release_server.py in lab-l08:
from typing import Annotated
from pydantic import BaseModel, Field
from mcp.server.mcpserver import MCPServer, Elicit, Resolve, ElicitationResult, AcceptedElicitation
class Confirm(BaseModel):
confirm: bool = Field(description="Release the reservation?")
mcp = MCPServer("demo-orders", version="1.0.0")
def ask(sku: str):
return Elicit(f"Release the reservation for {sku}? This changes stock.", Confirm)
@mcp.tool(name="release_reservation")
def release_reservation(
sku: Annotated[str, Field(pattern=r"^[A-Z]{3}-\d{4}$")],
answer: Annotated[ElicitationResult[Confirm], Resolve(ask)],
) -> str:
"""Release a demo reservation after the user confirms."""
if isinstance(answer, AcceptedElicitation) and answer.data.confirm:
return f"Released reservation for {sku}."
return f"Nothing changed for {sku} ({answer.action})."
if __name__ == "__main__":
mcp.run("streamable-http", host="127.0.0.1", port=8795, streamable_http_path="/mcp")
answer is filled by the resolver, not the model, so it is not in the tool's inputSchema. Captured 2026-11-26 (requestState shortened).
Round 1: the client calls release_reservation with {"sku":"ELC-0002"} and declares {"elicitation":{"form":{}}} (the exact request is in the practice task). The reply:
{"jsonrpc":"2.0","id":2,"result":{"resultType":"input_required",
"inputRequests":{"__main__:ask":{"method":"elicitation/create","params":{
"mode":"form","message":"Release the reservation for ELC-0002? This changes stock.",
"requestedSchema":{"type":"object","properties":{"confirm":{"type":"boolean","title":"Confirm","description":"Release the reservation?"}},"required":["confirm"]}}}},
"requestState":"v1.JMczrwXc...Rhyvw"}}
The key __main__:ask is chosen by the SDK (module and resolver name); clients must treat keys as opaque. Round 2, the client retries with a new id:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"release_reservation",
"arguments":{"sku":"ELC-0002"},
"inputResponses":{"__main__:ask":{"action":"accept","content":{"confirm":true}}},
"requestState":"v1.JMczrwXc...Rhyvw",
"_meta":{ "...same as round 1..." }}}
The reply has "resultType":"complete", "isError":false and the text Released reservation for ELC-0002. Other outcomes from the same run:
{"action":"decline"}returnedNothing changed for ELC-0002 (decline).Your code must handle decline and cancel explicitly.- A tampered
requestStatereturned error-32602,"Invalid or expired requestState". - A request without the elicitation capability returned HTTP 400 with error
-32021(MissingRequiredClientCapability) anddata.requiredCapabilities, as the base protocol requires.
Practice task
- In
lab-l08, saverelease_server.pyand runuv run python release_server.py. - In a second terminal, send round 1:
U=http://127.0.0.1:8795/mcp
META='"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{"elicitation":{"form":{}}}}'
curl -s $U -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' -H 'Mcp-Method: tools/call' -H 'Mcp-Name: release_reservation' \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"release_reservation\",\"arguments\":{\"sku\":\"ELC-0002\"},$META}}"
- Copy the
requestStatevalue intoRS='...', then send round 2 with"id":2, the same arguments,"inputResponses":{"__main__:ask":{"action":"accept","content":{"confirm":true}}}and"requestState":"'"$RS"'". - Repeat round 2 with
"action":"cancel", then send round 1 again with"clientCapabilities":{}.
Check your result: round 1 has "resultType":"input_required" and one elicitation/create in form mode; the accepted retry returns Released reservation for ELC-0002. with "resultType":"complete"; the cancel retry returns Nothing changed for ELC-0002 (cancel).; and the request without the capability returns error code -32021.
Sidebar: deprecated and removed client features
| Feature | Status in 2026-07-28 | Migration path (deprecated features registry) |
|---|---|---|
Sampling (sampling/createMessage) | Deprecated (SEP-2577); earliest removal: first revision on or after 2027-07-28 | "Integrate directly with LLM provider APIs" |
Roots (roots/list) | Deprecated (SEP-2577) | "Pass directories or files via tool parameters, resource URIs, or server configuration" |
Logging (notifications/message) | Deprecated (SEP-2577); logging/setLevel removed | "Log to stderr for stdio transports; use OpenTelemetry for observability" |
| Server-initiated requests | Removed; replaced by MRTR | Return InputRequiredResult |
notifications/elicitation/complete, URL-mode elicitationId, error -32042 | Removed (all were new in 2025-11-25) | Retry the original request; correlate through requestState |
Deprecated features still work during the window; new servers should not add them. Roots only told a server where to work: enforce any boundary inside the server.
Check your understanding
-
A server needs the user's Stripe API key to finish a tool call. Form mode with a password-format field? No. Form mode MUST NOT request API keys, passwords, tokens or payment credentials. Use URL mode: an HTTPS page on your domain, the key stored server-side bound to the authenticated user, never returned to the client.
-
Your retry handler trusts
requestStateto carry"approved_amount": 50. What must you do? Treat it as attacker-controlled. Because it drives business logic, protect its integrity (HMAC or AEAD), bind it to principal, request and expiry, and reject failures. Better: keep the authoritative amount server-side. -
The client sends round 2 with the same JSON-RPC
idas round 1. Is that allowed? No. TheidMUST differ between the initial request and the retry; they are independent requests. The client MUST echorequestStateexactly and not reuse it on other requests.
Sources
- Elicitation: https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation
- Multi Round-Trip Requests: https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr
- Base protocol (
_meta,-32021): https://modelcontextprotocol.io/specification/2026-07-28/basic - Deprecated features: https://modelcontextprotocol.io/specification/2026-07-28/deprecated
- Changelog 2026-07-28: https://modelcontextprotocol.io/specification/2026-07-28/changelog
- Example run:
mcp2.3.0, captured 2026-11-26 (see PROTOCOL-NOTES.md)
