Loading lesson page...
MCP Sampling — Server-Requested LLM Completions and Agent Loops
BuildPython (stdlibsampling harness)Most MCP servers are dumb executors: take arguments, run code, return content. Sampling lets a server flip direction: it asks the client's LLM to make a decision. This enables server-hosted agent loops without the server owning any model c...