Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Change register: record the guard route for sampling and roots

Jeremiah Lowind5ff8316020f
diff --git a/dev-docs/v4-notes/change-register.md b/dev-docs/v4-notes/change-register.md
index af6d36049..39ecabdbd 100644
--- a/dev-docs/v4-notes/change-register.md
+++ b/dev-docs/v4-notes/change-register.md
@@ -451,7 +451,7 @@ FastMCP 4 is a modern MCP toolkit, so the capabilities the modern protocol remov
The motivating failure is that the gate had become the default experience. `Client` now defaults to `mode="auto"`, which negotiates `2026-07-28` against a FastMCP server, so an unmodified `ctx.sample()` server failed on an ordinary client connection. Four shipped examples (`examples/sampling/`) were broken by that flip; they are deleted rather than ported, and remain available on `release/3.x`.
-Server-initiated sampling and roots are *requests* β€” the server sends one and blocks for the answer β€” which needs a back-channel the sessionless protocol does not have. Unlike elicitation, generation has no multi-round-trip replacement (an agentic loop would exhaust the round-trip budget). The migration is to call an LLM directly from the server for generation, and to accept paths as tool arguments (or via `InputRequiredResult.input_requests`, which still carries a `ListRootsRequest`) for roots.
+Server-initiated sampling and roots are *requests* β€” the server sends one and blocks for the answer β€” which needs a back-channel the sessionless protocol does not have. What the protocol removed is the *pushing*, not the asking: both capabilities remain reachable through the guard pattern, where a tool returns an `InputRequiredResult` whose `input_requests` map carries a `CreateMessageRequest` or a `ListRootsRequest`, the client answers it, and the tool re-runs and reads `ctx.input_responses`. `Client._drive_input_required()` dispatches those to the same `sampling_handler` / `roots` handler a handshake-era server would have pushed to, and `tests/conformance/server.py` exercises both routes. For roots that guard round is the recommended modern path. For generation it is available but usually the wrong tool β€” each round is a full request-response cycle, so an agentic loop exhausts the round-trip budget β€” and the recommended migration stays a direct LLM call from the server.
**What is deliberately kept.** Client-side `Client(sampling_handler=..., roots=...)` and the provider handlers (anthropic/openai/google_genai) stay: a FastMCP client must still answer a legacy server's requests, and removing them would break interop with older servers. `docs/clients/sampling.mdx` and `docs/clients/roots.mdx` stay as real documentation. Logging is untouched β€” `ctx.log`/`info`/`debug`/`warning`/`error` are notifications that ride the request's own stream and work on every era.