MCP Model Input: Sampling Migration and Stateless MRTR
MCP 2026-07-28 deprecates Sampling for new designs and removes the server-to-client request channel. If an existing workflow still needs the client's model, the server returns an inputrequired result and the client retries the original request with the model output. The reasoning loop becomes explicit, bounded, and stateless at the protocol layer. Explain why Sampling is deprecated in MCP 2026-07-28 and choose the direct model integration default for new servers. Implement a compatibility workflow that carries sampling/createMessage through Multi Round-Trip Requests (MRTR). Put the protocol revision and client capabilities in every request meta object. Return resultType: "inputrequired" and retry the original method with a fresh JSON-RPC id. Integrity-protect requestState and bind it to the principal, method, arguments, and expiry. Bound model-assisted loops with capability checks, approval, response validation, and a round limit. A tool such as summarizerepo needs two kinds of work: Deterministic work: list files, read allowed files, validate paths, and assemble content. Model work: choose representative files and synthesize the summary. You now have two valid architectures. This is the current default. The server owns model selection, credentials, budgets, retries, and observability. It returns one ordinary tools/call result to the MCP client. Choose this when the server is already a hosted service or when predictable model behavior matters more than using the host's model. Sampling still exists during its…
MCP Model Input: Sampling Migration and Stateless MRTR: MCP 2026-07-28 deprecates Sampling for new designs and removes the server-to-client request channel.…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.