Agents, Tool Use & MCP·Question 66 of 90Advanced

A tool call takes twenty minutes, or needs the user's answer halfway through. How do you model that over MCP now that the protocol is stateless?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Two problems, two mechanisms, and the stateless 2026-07-28 revision shapes both: with no session, nothing can live in one server instance's memory between requests.

Full worked answer with diagram

Two problems, two mechanisms, and the stateless 2026-07-28 revision shapes both: with no session, nothing can live in one server instance's memory between requests.

Needs input halfway: a multi round-trip request. The server does not hold the call open. It returns an input-required result carrying its questions and an opaque request state. The client asks the user, then re-issues the original call with the answers and the echoed state, and any instance behind the load balancer can finish it. The engineering lands in that state blob. It round-trips through the client, so sign or encrypt it, bind it to the user and the original arguments, and give it an expiry. Unsigned state lets a client forge the server's progress.

Takes twenty minutes: a task. Tasks arrived as an experimental feature in 2025-11-25 and became an extension in 2026-07-28. The server accepts the work and returns a durable task handle immediately. The client polls for status, fetches the result later, or cancels. A task can also pause in an input-required state, which combines the two patterns.

What makes the server side correct:

  • Durable task store, not memory. The status poll may land on a different instance from the one that started the work.
  • Idempotent creation. A client that times out and retries the create call must not start the job twice. Key it.
  • Task IDs are capabilities. Bind each to the principal that created it and make it unguessable, or polling becomes a way to read someone else's results.
  • Result retention. Results expire on a declared TTL so the store does not grow forever.

On the agent side, never let the model block. The harness either returns a tool result saying "task started, check back with this ID" and lets the agent keep working, or checkpoints the run and resumes on completion, the same suspend-and-resume shape as a human approval gate. Budget for a cold prompt cache when it comes back.

Worth sketching. The retry landing on a different instance is the whole point of carrying state in the payload.

sequenceDiagram
    participant H as Host
    participant P as User
    participant A as Server instance A
    participant B as Server instance B
    H->>A: tools/call book_trip
    A->>H: input required, questions + signed state
    H->>P: which seat class?
    P->>H: economy
    H->>B: same call + answers + echoed state
    B->>H: result, no session needed

What a good answer covers

  • Two problems, two mechanisms, and the stateless 2026-07-28 revision shapes both
  • Needs input halfway: a multi round-trip request
  • The server does not hold the call open
  • It returns an input-required result carrying its questions and an opaque request state
  • The client asks the user, then re-issues the original call with the answers and the echoed state, and…

Key terms: Takes twenty minutes: a task · Durable task store, not memory · Idempotent creation · Task IDs are capabilities · Result retention

Interviewer follow-ups to expect

  1. The user answers the elicitation an hour later and the signed state has expired. What should the server do?

  2. How does the agent decide between waiting on a task and continuing with other work?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep