You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specification/draft/client/sampling.mdx
+3-15Lines changed: 3 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,21 +37,9 @@ Applications **SHOULD**:
37
37
38
38
## Tools in Sampling
39
39
40
-
Servers can request that the client's LLM use tools during sampling by providing a `tools` array and optional `toolChoice` configuration in their sampling requests. This enables servers to implement agentic behaviors where the LLM can call tools, receive results, and continue the conversation—all within a single sampling request flow.
40
+
Servers can request that the client's LLM use tools during sampling by providing a `tools` array and optional `toolChoice` configuration in their sampling requests. This enables servers to implement agentic behaviors where the LLM can call tools, receive results, and continue the conversation - all within a single sampling request flow.
41
41
42
-
**Key capabilities:**
43
-
44
-
- Servers define tools with JSON schemas for inputs and outputs
45
-
- The LLM decides when and how to use tools (subject to `toolChoice` constraints)
46
-
- Multiple tools can be used in parallel
47
-
- Tool results are provided back to the LLM to inform subsequent responses
48
-
49
-
Clients **MUST** declare support for tool use via the `sampling.tools` capability to receive tool-enabled sampling requests. Servers **SHOULD NOT** send tool-enabled sampling requests to Clients that have not declared support for tool use via the `sampling.tools` capability.
50
-
51
-
<Info>
52
-
Tool use in sampling uses the same `Tool` type as regular MCP tool calls,
53
-
ensuring consistency across the protocol.
54
-
</Info>
42
+
Clients **MUST** declare support for tool use via the `sampling.tools` capability to receive tool-enabled sampling requests. Servers **MUST NOT** send tool-enabled sampling requests to Clients that have not declared support for tool use via the `sampling.tools` capability.
55
43
56
44
## Capabilities
57
45
@@ -441,7 +429,7 @@ This constraint ensures compatibility with provider APIs that use dedicated role
441
429
442
430
### Tool Use and Result Balance
443
431
444
-
When using tool use in sampling, messages **MUST** be properly balanced: every assistant message containing `ToolUseContent` blocks must be followed by a user message that consists entirely of `ToolResultContent` blocks, with each tool use (e.g. with `id: $id`) matched by a corresponding tool result (with `toolUseId: $id`), before any other message.
432
+
When using tool use in sampling, every assistant message containing `ToolUseContent` blocks **MUST** be followed by a user message that consists entirely of `ToolResultContent` blocks, with each tool use (e.g. with `id: $id`) matched by a corresponding tool result (with `toolUseId: $id`), before any other message.
0 commit comments