server-tools changedagents-and-tools/tool-use/server-tools
Nearest release: v2.1.319, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+41added
Lines−41removed
From line
37
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits18to this page, all time
The whole hunk
from line 37, old and new numbered
/
from line 37
3737 -H "content-type: application/json" \
3838 -d '{
3939 "model": "claude-opus-5-5",
40 "max_tokens": 1024,
40 "max_tokens": 4096,
4141 "messages": [
4242 {
4343 "role": "user",
from line 50
5050
5151 ```bash CLI
5252 # Initial request. If "stop_reason" in the output is "pause_turn", re-run with
53 # the assistant content appended to messages (see the SDK tabs).
53 # the assistant content appended to messages.
5454 ant messages create <<'YAML'
5555 model: claude-opus-5-5
56 max_tokens: 1024
56 max_tokens: 4096
5757 tools:
5858 - {type: web_search_20250305, name: web_search, max_uses: 10}
5959 messages:
from line 67
6767 # Initial request with web search
6868 response = client.messages.create(
6969 model="claude-opus-5-5",
70 max_tokens=1024,
70 max_tokens=4096,
7171 messages=[
7272 {
7373 "role": "user",
from line 91
9191 # Send the continuation request
9292 continuation = client.messages.create(
9393 model="claude-opus-5-5",
94 max_tokens=1024,
94 max_tokens=4096,
9595 messages=messages,
9696 tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}],
9797 )
from line 107
107107 // Initial request with web search
108108 const response = await client.messages.create({
109109 model: "claude-opus-5-5",
110 max_tokens: 1024,
110 max_tokens: 4096,
111111 messages: [
112112 {
113113 role: "user",
from line 139
139139 // Send the continuation request
140140 const continuation = await client.messages.create({
141141 model: "claude-opus-5-5",
142 max_tokens: 1024,
142 max_tokens: 4096,
143143 messages,
144144 tools: [
145145 {
from line 162
162162 var parameters = new MessageCreateParams
163163 {
164164 Model = Model.ClaudeOpus5_5,
165 MaxTokens = 1024,
165 MaxTokens = 4096,
166166 Messages = [
167167 new UserMessageParam
168168 {
from line 180
180180 var continuationParams = new MessageCreateParams
181181 {
182182 Model = Model.ClaudeOpus5_5,
183 MaxTokens = 1024,
183 MaxTokens = 4096,
184184 Messages = [
185185 new UserMessageParam
186186 {
from line 214
214214
215215 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
216216 Model: anthropic.ModelClaudeOpus5_5,
217 MaxTokens: 1024,
217 MaxTokens: 4096,
218218 Messages: []anthropic.MessageParam{
219219 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for comprehensive information about quantum computing breakthroughs in 2025")),
220220 },
from line 228
228228 // Pass the paused response back as-is so Claude can continue the turn
229229 continuation, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
230230 Model: anthropic.ModelClaudeOpus5_5,
231 MaxTokens: 1024,
231 MaxTokens: 4096,
232232 Messages: []anthropic.MessageParam{
233233 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for comprehensive information about quantum computing breakthroughs in 2025")),
234234 response.ToParam(),
from line 253
253253
254254 MessageCreateParams params = MessageCreateParams.builder()
255255 .model(Model.CLAUDE_OPUS_5_5)
256 .maxTokens(1024L)
256 .maxTokens(4096L)
257257 .addUserMessage("Search for comprehensive information about quantum computing breakthroughs in 2025")
258258 .addTool(WebSearchTool20250305.builder()
259259 .maxUses(10L)
from line 266
266266 && response.stopReason().get().equals(StopReason.PAUSE_TURN)) {
267267 MessageCreateParams continuationParams = MessageCreateParams.builder()
268268 .model(Model.CLAUDE_OPUS_5_5)
269 .maxTokens(1024L)
269 .maxTokens(4096L)
270270 .addUserMessage("Search for comprehensive information about quantum computing breakthroughs in 2025")
271271 .addMessage(response)
272272 .addTool(WebSearchTool20250305.builder()
from line 286
286286 $client = new Client();
287287
288288 $response = $client->messages->create(
289 maxTokens: 1024,
289 maxTokens: 4096,
290290 messages: [
291291 [
292292 'role' => 'user',
from line 316
316316 ];
317317
318318 $continuation = $client->messages->create(
319 maxTokens: 1024,
319 maxTokens: 4096,
320320 messages: $messages,
321321 model: 'claude-opus-5-5',
322322 tools: [
from line 339
339339
340340 response = client.messages.create(
341341 model: Anthropic::Model::CLAUDE_OPUS_5_5,
342 max_tokens: 1024,
342 max_tokens: 4096,
343343 messages: [
344344 {
345345 role: "user",
from line 370
370370
371371 continuation = client.messages.create(
372372 model: Anthropic::Model::CLAUDE_OPUS_5_5,
373 max_tokens: 1024,
373 max_tokens: 4096,
374374 messages: messages,
375375 tools: [
376376 {
from line 496
496496 To give Claude more input, send it as a separate user message after the turn completes.
497497</Warning>
498498
499**How this differs from `pause_turn`:** A [`pause_turn` response](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#the-server-side-loop-and-pause-turn) can also end with a `server_tool_use` block that has not run, but it never leaves a client `tool_use` block waiting on you, so you continue it by re-sending the assistant content as-is. A response that leaves a client `tool_use` block waiting on you never has a `stop_reason` of `pause_turn`: when Claude stops to call your tools, `stop_reason` is `tool_use`, and you continue it by sending the client `tool_result` blocks rather than by re-sending the response. In both cases the API runs the pending server tool at the start of the next request.
499**How this differs from `pause_turn`:** A [`pause_turn` response](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#the-server-side-loop-and-pause-turn) can also end with a `server_tool_use` block that has not run, but it never leaves a client `tool_use` block waiting on you, so you continue it by re-sending the assistant content as-is. A response that leaves a client `tool_use` block waiting on you never has a `stop_reason` of `pause_turn`: when Claude stops to call your tools, `stop_reason` is `tool_use`, and you continue it by sending the response back with a new user message that holds the client `tool_result` blocks. In both cases the API runs the pending server tool at the start of the next request.
500500
501501The following example enables web fetch together with a user-defined `run_command` tool and handles the mixed response:
502502
from line 504
504504 ```bash cURL
505505 # If "stop_reason" is "tool_use" and a server_tool_use block has no matching
506506 # result block, that call is not finished. Run the client tools, then POST
507 # again with one more user message containing only their tool_result blocks
508 # and the same tools array (see the SDK tabs).
507 # again with the assistant content, one more user message containing only their
508 # tool_result blocks, and the same tools array.
509509 curl https://api.anthropic.com/v1/messages \
510510 -H "x-api-key: $ANTHROPIC_API_KEY" \
511511 -H "anthropic-version: 2026-10-21" \
from line 512
512512 -H "content-type: application/json" \
513513 -d '{
514514 "model": "claude-opus-5-5",
515 "max_tokens": 1024,
515 "max_tokens": 4096,
516516 "messages": [
517517 {
518518 "role": "user",
from line 536
536536
537537 ```bash CLI
538538 # If "stop_reason" is "tool_use" and a server_tool_use block has no matching
539 # result block, run the client tools and re-run with a user message of only
540 # their tool_result blocks appended (see the SDK tabs).
539 # result block, run the client tools and re-run with the assistant content and
540 # a user message of only their tool_result blocks appended.
541541 ant messages create <<'YAML'
542542 model: claude-opus-5-5
543 max_tokens: 1024
543 max_tokens: 4096
544544 messages:
545545 - role: user
546546 content: "Summarize https://example.com/article and run uname -a to tell me what system this is on."
from line 581
581581 ]
582582
583583 response = client.messages.create(
584 model="claude-opus-5-5", max_tokens=1024, tools=tools, messages=messages
584 model="claude-opus-5-5", max_tokens=4096, tools=tools, messages=messages
585585 )
586586
587587 tool_results = [
from line 600
600600 # Send back only the client tool_result blocks, with the same tools.
601601 continuation = client.messages.create(
602602 model="claude-opus-5-5",
603 max_tokens=1024,
603 max_tokens=4096,
604604 tools=tools,
605605 messages=[
606606 *messages,
from line 644
644644
645645 const response = await client.messages.create({
646646 model: "claude-opus-5-5",
647 max_tokens: 1024,
647 max_tokens: 4096,
648648 tools: [webFetchTool, runCommandTool],
649649 messages
650650 });
from line 666
666666 // Send back only the client tool_result blocks, with the same tools.
667667 const continuation = await client.messages.create({
668668 model: "claude-opus-5-5",
669 max_tokens: 1024,
669 max_tokens: 4096,
670670 tools: [webFetchTool, runCommandTool],
671671 messages: [
672672 ...messages,
from line 712
712712 var response = await client.Messages.Create(new MessageCreateParams
713713 {
714714 Model = Model.ClaudeOpus5_5,
715 MaxTokens = 1024,
715 MaxTokens = 4096,
716716 Tools = tools,
717717 Messages = [userMessage]
718718 });
from line 738
738738 var continuation = await client.Messages.Create(new MessageCreateParams
739739 {
740740 Model = Model.ClaudeOpus5_5,
741 MaxTokens = 1024,
741 MaxTokens = 4096,
742742 Tools = tools,
743743 Messages =
744744 [
from line 785
785785
786786 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
787787 Model: anthropic.ModelClaudeOpus5_5,
788 MaxTokens: 1024,
788 MaxTokens: 4096,
789789 Tools: tools,
790790 Messages: []anthropic.MessageParam{userMessage},
791791 })
from line 807
807807 // Send back only the client tool_result blocks, with the same tools.
808808 continuation, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
809809 Model: anthropic.ModelClaudeOpus5_5,
810 MaxTokens: 1024,
810 MaxTokens: 4096,
811811 Tools: tools,
812812 Messages: []anthropic.MessageParam{
813813 userMessage,
from line 844
844844
845845 Message response = client.messages().create(MessageCreateParams.builder()
846846 .model(Model.CLAUDE_OPUS_5_5)
847 .maxTokens(1024L)
847 .maxTokens(4096L)
848848 .addTool(WebFetchTool20250910.builder()
849849 .maxUses(5L)
850850 .build())
from line 871
871871 // Send back only the client tool_result blocks, with the same tools.
872872 Message continuation = client.messages().create(MessageCreateParams.builder()
873873 .model(Model.CLAUDE_OPUS_5_5)
874 .maxTokens(1024L)
874 .maxTokens(4096L)
875875 .addTool(WebFetchTool20250910.builder()
876876 .maxUses(5L)
877877 .build())
from line 909
909909 $userMessage = ['role' => 'user', 'content' => 'Summarize https://example.com/article and run uname -a to tell me what system this is on.'];
910910
911911 $response = $client->messages->create(
912 maxTokens: 1024,
912 maxTokens: 4096,
913913 messages: [$userMessage],
914914 model: 'claude-opus-5-5',
915915 tools: $tools,
from line 931
931931 // A server_tool_use block with no result block in this response is not finished; its result arrives in a later response.
932932 // Send back only the client tool_result blocks, with the same tools.
933933 $continuation = $client->messages->create(
934 maxTokens: 1024,
934 maxTokens: 4096,
935935 messages: [
936936 $userMessage,
937937 ['role' => 'assistant', 'content' => $response->content],
from line 971
971971 }
972972
973973 response = client.messages.create(
974 model: "claude-opus-5-5",
975 max_tokens: 1024,
974 model: Anthropic::Model::CLAUDE_OPUS_5_5,
975 max_tokens: 4096,
976976 tools: tools,
977977 messages: [user_message]
978978 )
from line 993
993993 # A server_tool_use block with no result block in this response is not finished; its result arrives in a later response.
994994 # Send back only the client tool_result blocks, with the same tools.
995995 continuation = client.messages.create(
996 model: "claude-opus-5-5",
997 max_tokens: 1024,
996 model: Anthropic::Model::CLAUDE_OPUS_5_5,
997 max_tokens: 4096,
998998 tools: tools,
999999 messages: [
10001000 user_message,
from line 1088
10881088
10891089Server-tool events stream as part of the normal server-sent events (SSE) flow. A `server_tool_use` block that Claude calls directly streams like a client `tool_use` block: a `content_block_start` event followed by `input_json_delta` events. The result block arrives complete in a single `content_block_start` event, with no deltas.
10901090
1091See [Streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for the full event reference. Individual tool pages document tool-specific event names where they differ.
1091See [Streaming messages](https://platform.claude.com/docs/en/build-with-claude/streaming) for the full event reference. Individual tool pages document tool-specific event names where they differ.
10921092
10931093## Batch requests
10941094
No line in this hunk matches that.