Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

overview changedagents-and-tools/tool-use/overview

Nearest release: v2.1.304, published under 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+9added
Lines−107removed
From line 23 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits17to this page, all time

The whole hunk

from line 23, old and new numbered
/
lines
from line 23
2323 ```
2424 
2525 ```bash CLI
26 ant messages create --transform content --format yaml \
26 ant messages create \
2727 --model claude-opus-5-5 \
2828 --max-tokens 1024 \
2929 --tool '{type: web_search_20260209, name: web_search}' \
from line 142
142142 
143143Here's that round trip in full for a client tool. The first request defines a `get_weather` tool, and Claude answers the question by calling it: the response carries a `tool_use` block, your code runs the lookup, and a second request sends the result back in a `tool_result` block so Claude can reply with the answer.
144144 
145<CodeGroup>
146 ```bash cURL
147 # Claude replies with a tool_use block naming the tool and its arguments.
148 TOOLS='[
149 {
150 "name": "get_weather",
151 "description": "Get the current weather for a given location.",
152 "input_schema": {
153 "type": "object",
154 "properties": {
155 "location": {"type": "string", "description": "City and state, e.g. San Francisco, CA"}
156 },
157 "required": ["location"]
158 }
159 }
160 ]'
161 USER_MSG="What's the weather in San Francisco?"
162 RESPONSE=$(curl -s https://api.anthropic.com/v1/messages \
163 -H "x-api-key: $ANTHROPIC_API_KEY" \
164 -H "anthropic-version: 2023-06-01" \
165 -H "content-type: application/json" \
166 -d "$(jq -n --argjson tools "$TOOLS" --arg msg "$USER_MSG" '{
167 model: "claude-opus-5-5",
168 max_tokens: 1024,
169 tools: $tools,
170 # Ask for at most one tool call per turn.
171 tool_choice: {type: "auto", disable_parallel_tool_use: true},
172 messages: [{role: "user", content: $msg}]
173 }')")
174 TOOL_USE=$(echo "$RESPONSE" | jq '.content[] | select(.type == "tool_use")')
175 echo "Claude called $(echo "$TOOL_USE" | jq -r '.name') with $(echo "$TOOL_USE" | jq -c '.input')"
145<CodeGroup exclude="shell:cURL, shell:CLI">
146 <CodeGroupItem language="cURL">
147 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
148 </CodeGroupItem>
176149 
177 # Run the tool, then send the result back in a tool_result block.
178 # Claude uses the result to answer the original question.
179 WEATHER="15 degrees Celsius, partly cloudy"
180 curl -s https://api.anthropic.com/v1/messages \
181 -H "x-api-key: $ANTHROPIC_API_KEY" \
182 -H "anthropic-version: 2023-06-01" \
183 -H "content-type: application/json" \
184 -d "$(jq -n \
185 --argjson tools "$TOOLS" \
186 --arg msg "$USER_MSG" \
187 --argjson assistant "$(echo "$RESPONSE" | jq '.content')" \
188 --arg tool_use_id "$(echo "$TOOL_USE" | jq -r '.id')" \
189 --arg weather "$WEATHER" \
190 '{
191 model: "claude-opus-5-5",
192 max_tokens: 1024,
193 tools: $tools,
194 tool_choice: {type: "auto", disable_parallel_tool_use: true},
195 messages: [
196 {role: "user", content: $msg},
197 {role: "assistant", content: $assistant},
198 {role: "user", content: [
199 {type: "tool_result", tool_use_id: $tool_use_id, content: $weather}
200 ]}
201 ]
202 }')"
203 ```
204 
205 ```bash CLI
206 # ant reads the request body as YAML on stdin; jq carries the conversation
207 # state into the second request.
208 USER_MSG="What's the weather in San Francisco?"
209 MESSAGES=$(jq -n --arg msg "$USER_MSG" '[{role: "user", content: $msg}]')
210 call_api() {
211 {
212 cat <<'YAML'
213 model: claude-opus-5-5
214 max_tokens: 1024
215 # Ask for at most one tool call per turn.
216 tool_choice: {type: auto, disable_parallel_tool_use: true}
217 tools:
218 - name: get_weather
219 description: Get the current weather for a given location.
220 input_schema:
221 type: object
222 properties:
223 location: {type: string, description: "City and state, e.g. San Francisco, CA"}
224 required: [location]
225 YAML
226 printf 'messages: %s\n' "$MESSAGES"
227 } | ant messages create --format json
228 }
229 
230 # Claude replies with a tool_use block naming the tool and its arguments.
231 RESPONSE=$(call_api)
232 TOOL_USE=$(jq '.content[] | select(.type == "tool_use")' <<<"$RESPONSE")
233 echo "Claude called $(jq -r '.name' <<<"$TOOL_USE") with $(jq -c '.input' <<<"$TOOL_USE")"
234 
235 # Run the tool, then send the result back in a tool_result block.
236 WEATHER="15 degrees Celsius, partly cloudy"
237 MESSAGES=$(jq \
238 --argjson assistant "$(jq '.content' <<<"$RESPONSE")" \
239 --arg tool_use_id "$(jq -r '.id' <<<"$TOOL_USE")" \
240 --arg weather "$WEATHER" \
241 '. + [
242 {role: "assistant", content: $assistant},
243 {role: "user", content: [
244 {type: "tool_result", tool_use_id: $tool_use_id, content: $weather}
245 ]}
246 ]' <<<"$MESSAGES")
247 
248 # Claude uses the result to answer the original question.
249 call_api
250 ```
150 <CodeGroupItem language="CLI">
151 This workflow needs more logic than a single shell command. Use the [Claude SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) to run it.
152 </CodeGroupItem>
251153 
252154 ```python Python
253155 client = anthropic.Anthropic()
Feedback