Skip to content
AdminKit

Sampling (MCP)

What is Sampling (MCP)?

Sampling is a Model Context Protocol primitive letting a server ask the client to run a completion against the client's own LLM rather than needing its own model access, gated on the user explicitly reviewing and approving both the prompt and the result. AdminKit's guide to securing an MCP server covers that same consent requirement.

By AdminKit team, Netbase JSC · Updated

Sampling is a Model Context Protocol primitive — part of the protocol Anthropic introduced to standardize how applications connect context and tools to an LLM — that lets an MCP server ask the client to run a completion against the client’s own LLM, rather than the server needing its own model access — useful when a server’s tool needs an AI-generated judgment call partway through a task. The server asks through a sampling/createMessage request, an ordinary JSON-RPC 2.0 request that the client answers with a result carrying the generated message and the name of the model that produced it. The MCP specification requires that sampling requests go through the human in the loop: a client implementing sampling must let the user review and approve both the prompt being sent and the completion coming back before it’s used, rather than silently fulfilling the server’s request. This mirrors the consent requirement the specification places on ordinary tool calls, and for the same reason — a server a client didn’t fully vet could otherwise use sampling to generate and act on content the user never saw. MCP’s elicitation primitive, which lets a server pause mid-task to collect more input from the user instead, is gated under the same explicit-review requirement.

AdminKit groups sampling (MCP) under its AI agents & MCP cluster — browse the AdminKit glossary index for other related terms.

Frequently asked questions

What must happen before a sampling request's completion is used?

The user must explicitly review and approve both the prompt being sent and the completion coming back -- the specification requires this human-in-the-loop step, not silent fulfillment.

Why would a server use sampling instead of calling its own model?

Sampling lets a server ask the client to run a completion against the client's own LLM, so the server doesn't need its own model access at all.

How is sampling's consent requirement similar to elicitation's?

Both are gated on the same explicit-review requirement, letting the user see and approve a server's request before it takes effect.