Sampling changedspecification/2026-07-28/client/sampling
Nearest release: v2.1.305, published under an hour before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 20 Oct 2026 20:02 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 20 Oct 2026 20:07 UTC.
Upstream edited
Recorded here
Lines+32added
Lines−34removed
From line
1
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits2to this page, all time
The whole hunk
from line 1, old and new numbered
/
from line 1
11# Sampling
22
3<div id="enable-section-numbers" />
3> [!WARNING]
4>
5> **Deprecated**: The Sampling feature is deprecated as of protocol version
6> `2026-07-28`
7> ([SEP-2577](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577)).
8> Under the [feature lifecycle policy](/community/feature-lifecycle), it remains
9> in the specification for at least twelve months after this revision's release
10> before it becomes eligible for removal. New implementations **SHOULD NOT**
11> adopt it; existing implementations **SHOULD** migrate to integrating directly
12> with LLM provider APIs. See the [deprecated features
13> registry](/specification/2026-07-28/deprecated).
414
5<Warning>
6 **Deprecated**: The Sampling feature is deprecated as of protocol version
7 `2026-07-28`
8 ([SEP-2577](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577)).
9 Under the [feature lifecycle policy](/community/feature-lifecycle), it remains
10 in the specification for at least twelve months after this revision's release
11 before it becomes eligible for removal. New implementations **SHOULD NOT**
12 adopt it; existing implementations **SHOULD** migrate to integrating directly
13 with LLM provider APIs. See the [deprecated features
14 registry](/specification/2026-07-28/deprecated).
15</Warning>
16
1715The Model Context Protocol (MCP) provides a standardized way for servers to request LLM
1816sampling ("completions" or "generations") from language models via clients. This flow
1917allows clients to maintain control over model access, selection, and permissions while
from line 28
3028their needs—the protocol itself does not mandate any specific user interaction
3129model.
3230
33<Warning>
34 For trust & safety and security, there **SHOULD** always
35 be a human in the loop with the ability to deny sampling requests.
31> [!WARNING]
32>
33> For trust & safety and security, there **SHOULD** always
34> be a human in the loop with the ability to deny sampling requests.
35>
36> Applications **SHOULD**:
37>
38> * Provide UI that makes it easy and intuitive to review sampling requests
39> * Allow users to view and edit prompts before sending
40> * Present generated responses for review before delivery
3641
37 Applications **SHOULD**:
38
39 * Provide UI that makes it easy and intuitive to review sampling requests
40 * Allow users to view and edit prompts before sending
41 * Present generated responses for review before delivery
42</Warning>
43
4442## Tools in Sampling
4543
4644Servers can request that the client's LLM use tools during sampling by providing a `tools` array and optional `toolChoice` configuration in their sampling requests. The tool definitions in the `tools` array are scoped to the sampling request — they don't need to correspond to registered tools. This enables servers to implement agentic behaviors where the LLM can call specially designated tools, receive results, and continue the conversation - all within a single sampling request flow.
from line 90
9290}
9391```
9492
95<Note>
96 The `includeContext` parameter values `"thisServer"` and `"allServers"` are
97 deprecated under the [feature lifecycle
98 policy](/community/feature-lifecycle#deprecating-a-feature)
99 ([SEP-2596](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2596));
100 they will be removed no later than the Sampling feature itself. Servers
101 **SHOULD** avoid using these values (e.g. can just omit `includeContext` since
102 it defaults to `"none"`), and **SHOULD NOT** use them unless the client
103 declares `sampling.context` capability. See the [deprecated features
104 registry](/specification/2026-07-28/deprecated).
105</Note>
93> [!NOTE]
94>
95> The `includeContext` parameter values `"thisServer"` and `"allServers"` are
96> deprecated under the [feature lifecycle
97> policy](/community/feature-lifecycle#deprecating-a-feature)
98> ([SEP-2596](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2596));
99> they will be removed no later than the Sampling feature itself. Servers
100> **SHOULD** avoid using these values (e.g. can just omit `includeContext` since
101> it defaults to `"none"`), and **SHOULD NOT** use them unless the client
102> declares `sampling.context` capability. See the [deprecated features
103> registry](/specification/2026-07-28/deprecated).
106104
107105## Protocol Messages
108106
No line in this hunk matches that.