Lesson 07.08 · Phase 07 · Model Context Protocol
Sampling and elicitation
Sometimes a server needs something only the client side has: an answer from the user, or a completion from the client's model. In the stateless protocol the server doesn't call back. It returns "input required" with a signed note to itself, and the client retries the original request with the answers attached.
Learning objectives
- Implement Multi Round-Trip Requests (MRTR): an inputrequired result with inputRequests and requestState, and a client that fulfils them and retries with inputResponses.
- Use elicitation in form mode for missing non-sensitive details and URL mode for anything involving credentials, and handle accept, decline and cancel.
- Explain sampling, why it's deprecated in 2026-07-28, and its migration path.
- Treat requestState as attacker-controlled: sign it, bind it to the user, the request and a short expiry, and enforce single use where it matters.
A model calls bookroom(room="Atlas", date="2026-12-03"). The server needs the number of attendees, which the model didn't send and shouldn't guess. Returning an error makes the model invent a number on its next turn. What the server really wants is to ask the person.
Loading the full lesson…