# Under what conditions must an instance treat MCP server-initiated elicitation as a state-mutating reentrant call rather than a fire-and-forget prompt **Date of Record:** 2026 November 30 **Scope:** Applies to MCP hosts that expose `elicitation/create` and `sampling/createMessage` to servers during an in-flight tool call, where the host agent is mid-task and holds mutable working state. Does not apply to stateless request/response MCP servers that never invoke host-side callbacks, nor to purely advisory logging notifications. ## Core Distinction The failure mode is not "the elicitation timed out." It is that the host treats the server-initiated elicitation as a *side channel* (a prompt that returns a value) when the protocol actually makes it a *reentrant mutation of the agent's execution context*. During `elicitation/create`, the server may legally return `accept`, `decline`, or `cancel`, and the human's answer can change the parameters of the tool call that is *currently executing*. If the host serializes the human response back into the same context window without checkpointing the pre-elicitation reasoning state, the agent resumes with a context that no longer matches the tool invocation it is waiting on. The result is a reasoning/execution divergence: the model continues from a transcript that asserts one tool argument set while the transport layer is committed to another. The non-obvious part: the elicitation round-trip is *not* atomic with respect to the tool call. Between the server's `elicitation/create` and the host's reply, arbitrary wall-clock time passes (human latency), during which the host's context may be compacted, truncated, or summarized by a background memory process. The invariant that must hold is: **the elicitation response is only valid if the exact pre-elicitation tool-call frame is still byte-identical in context at resume time.** Nothing in the MCP spec enforces this; the host must. ## What Was Observed A host agent executing a `deploy_service` tool call against an MCP server that gates on human approval. Trace: 1. Agent emits `tools/call` with `{"service":"api","replicas":3,"region":"eu-west-1"}`. Host records tool-call frame F0 in context. 2. Server, before executing, issues `elicitation/create` requesting confirmation of `region`. Server's own pending state is pinned to F0's arguments. 3. Host surfaces the prompt to a human operator. Human is away for 41 minutes. 4. During the wait, the host's context-window manager runs a compaction pass (context at 87% of budget). It summarizes the middle of the transcript, including the `tools/call` frame, into: *"Agent requested deployment of api to eu-west-1."* The literal `replicas:3` and the JSON structure are dropped. 5. Human responds `accept`. Host sends `elicitation` result to server. 6. Server proceeds with F0 arguments (replicas=3). Host resumes the agent loop with a *summarized* context that no longer contains the numeric arguments. 7. Agent, on the next reasoning step, re-derives the deployment plan from the summary and emits a *second* `tools/call` with default `replicas:1`, believing the first call was never issued (the summary read as intent, not as an in-flight call). Observed effect: two deployments, one at replicas=3 (server-side, from F0) and one at replicas=1 (agent-side, from re-derivation). The agent's transcript and the server's execution history diverged by exactly one tool call, and neither side had a record that could reconcile them. This is a *silent* duplication — no error was raised, because from each side's local view the sequence was internally consistent. A second observed variant: server returns `decline`. Host correctly does not execute, but the agent's next turn sees the `decline` result appended to a context where F0 has already been compacted. The model interprets `decline` as applying to the *summarized* intent and re-proposes a modified call, which the server (still pinned to F0) rejects as a mismatched elicitation token. The rejection surfaces to the agent as an opaque protocol error, and the agent enters a retry loop that re-elicits the human — burning a second human-interaction budget for a decision the human already made. ## Condition of Validity The host may treat an elicitation response as safely resumable if and only if all of the following hold at the moment the response is applied: - **Frame identity:** the exact tool-call frame F0 (byte-identical JSON, including the elicitation correlation id) is present in the active context, not a summary or paraphrase of it. - **No intervening mutation:** no compaction, truncation, summarization, or memory-distillation pass has touched the span between F0 and the elicitation result. - **Correlation binding:** the elicitation result carries the same correlation id the server attached to `elicitation/create`, and the host verifies it against F0 before appending. - **Single-flight:** no second tool call with the same semantic target was emitted between F0 and the response. If any of these is false, the response must be treated as *orphaned* — it may still be delivered to the human-facing layer for display, but it must not be applied to the agent's execution state without a re-anchor step (re-emitting F0 verbatim from a durable frame store, or explicitly aborting the in-flight call and re-planning). The condition fails silently when the host uses context-window percentage as its only compaction trigger, because elicitation wait time is uncorrelated with token growth — a long human wait on a nearly-full context is the highest-risk window, and it is invisible to a trigger that only watches size. ## Decision Boundary The boundary is between *elicit-then-resume* and *elicit-then-reanchor*. Choose reanchor (do not resume from the mutated context) when: - The elicitation round-trip exceeded the host's compaction interval, **or** any compaction pass ran during the wait, regardless of whether it touched F0 (conservative: you cannot cheaply prove it didn't). - The server's pending state is pinned to arguments the agent could plausibly re-derive differently (numeric, enumerated, or region/scaling parameters — anything with a default the model might substitute). - The tool is non-idempotent (deploy, transfer, delete, send). For idempotent reads, resume-from-summary is acceptable because a duplicate call is harmless. Choose resume when the tool is idempotent **and** the host can prove F0 is intact via a frame-store hash match. The frame store is the load-bearing component: it must persist F0 outside the context window, keyed by correlation id, so that re-anchoring does not depend on the very context that compaction may have destroyed. A host that keeps F0 only in the context window has no way to satisfy the frame-identity condition and must always reanchor non-idempotent calls. The subtle boundary: `decline` and `cancel` are *not* safe to treat as "no-op, continue." They terminate the server's pending state, but the agent's context still contains a tool call that now has no result. The host must synthesize an explicit `cancelled` tool result into the transcript, or the model will treat the call as still-pending and re-issue it. ## Operational Effect When the invariant is enforced, the observable behavior changes in three ways. First, non-idempotent calls become at-most-once: the correlation-id binding plus frame-store re-anchor means a resumed agent cannot re-derive a divergent second call, because the resume path re-injects F0 verbatim and the agent's next turn sees a completed call, not an intent. Second, human-interaction budget stops being consumed by protocol retries: the `decline`/`cancel` synthesis prevents the re-elicit loop, because the agent sees a terminal result rather than a pending call. Third, compaction becomes safe to run during elicitation waits — the frame store is the source of truth, so a summarized context is a *display* artifact, not the execution record. The cost is a mandatory durable frame store and a correlation-id discipline on every server-initiated callback. Hosts that skip it do not fail loudly; they fail as duplicated side effects and silent transcript/execution divergence, which surface only when an operator reconciles the server's audit log against the agent's memory — typically after the second deployment. ```python import hashlib import json from dataclasses import dataclass, field from typing import Optional class ElicitationFrameLost(RuntimeError): """Raised when an elicitation response cannot be safely applied to agent state.""" @dataclass class ToolCallFrame: correlation_id: str arguments: dict idempotent: bool def digest(self) -> str: canonical = json.dumps(self.arguments, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest() @dataclass class FrameStore: """Durable store kept outside the context window; survives compaction.""" frames: dict = field(default_factory=dict) def pin(self, frame: ToolCallFrame) -> None: self.frames[frame.correlation_id] = (frame, frame.digest()) def verify(self, correlation_id: str, expected_digest: str) -> bool: entry = self.frames.get(correlation_id) return entry is not None and entry[1] == expected_digest def apply_elicitation_response( store: FrameStore, correlation_id: str, response: str, context_digest: Optional[str], compaction_ran_during_wait: bool, ) -> str: """Decide whether to resume from context or re-anchor from the frame store. response: 'accept' | 'decline' | 'cancel' context_digest: digest of F0 as currently present in context (None if summarized away) """ entry = store.frames.get(correlation_id) if entry is None: raise ElicitationFrameLost( f"no pinned frame for correlation_id={correlation_id}; " "cannot bind elicitation response to an in-flight call" ) frame, pinned_digest = entry if response == "decline" or response == "cancel": # Terminal: synthesize an explicit cancelled result so the agent does not re-issue. return f"tool_result:{correlation_id}:cancelled" # response == 'accept' if frame.idempotent: return f"tool_result:{correlation_id}:resumed" # Non-idempotent: require frame identity in context AND no compaction during wait. if compaction_ran_during_wait: raise ElicitationFrameLost( f"compaction ran during elicitation wait for {correlation_id}; " "context may no longer match server-pinned arguments — must re-anchor" ) if context_digest is None or not store.verify(correlation_id, context_digest): raise ElicitationFrameLost( f"frame identity check failed for {correlation_id}: " "context F0 does not match pinned digest — re-anchor required" ) return f"tool_result:{correlation_id}:resumed" ```