How to Handle Several Tool Calls in One Claude Reply
Ask Claude something that needs two lookups, and it doesn't have to ask for them one at a time: one reply can hold several tool calls. Your code then runs them all and sends every result back together. This guide asks about two days' opening hours at once, with real output from anthropic 2.14.0.
Syntax
calls = [block for block in response.content if block.type == "tool_use"]
results = [
{"type": "tool_result", "tool_use_id": call.id, "content": <result of the call>}
for call in calls
]
messages.append({"role": "assistant", "content": response.content})
messages.append({"role": "user", "content": results})
| Part | What it means |
|---|---|
calls | Every tool_use block in Claude's reply, in order |
results | One tool_result per call, each with its call's id |
{"role": "user", "content": results} | One user message that carries all the results |
Anthropic's parallel tool use page: "By default, Claude may call multiple tools in a single response." And: "Whichever strategy you use, return one tool_result for each tool_use block, all together in the next user message."
What It Costs
The Claude API is paid: Claude Opus 5.5 costs $4 per million input tokens and $20 per million output tokens. Two calls in one reply need one round trip instead of two. The run below made two requests, 1,035 input and 175 output tokens in all, about $0.008.
Prerequisites
- A Claude API key, in a
.envfile asANTHROPIC_API_KEY=.... - The Anthropic Python SDK in a uv project. This guide uses anthropic 2.14.0, added with
uv add anthropic, on Python 3.15.2.
Step 1: Write the Tool
Create parallel_tools.py with the café's opening hours and the function that looks one day up:
import anthropic
client = anthropic.Anthropic()
OPENING_HOURS = {
"Monday": "closed",
"Tuesday": "7:30 to 18:00",
"Wednesday": "7:30 to 18:00",
"Thursday": "7:30 to 18:00",
"Friday": "7:30 to 18:00",
"Saturday": "8:00 to 16:00",
"Sunday": "9:00 to 14:00",
}
def get_opening_hours(day: str) -> str:
return OPENING_HOURS.get(day.capitalize(), "no opening hours for that day")
The tool takes one day. A question about two days needs two calls.
Step 2: Ask About Two Days
Add the tool's definition and a question that covers two days:
tools = [
{
"name": "get_opening_hours",
"description": (
"Get the café's opening hours for one day of the week. "
"Use it whenever someone asks when the café is open."
),
"input_schema": {
"type": "object",
"properties": {
"day": {"type": "string", "description": "A day of the week, such as Monday."},
},
"required": ["day"],
},
}
]
messages = [{"role": "user", "content": "When is the café open on Saturday and Sunday?"}]
Step 3: Run Every Call and Send the Results Together
Add the loop. It collects all the calls in a reply, runs each one, and sends every result back in one message:
response = client.messages.create(
model="claude-opus-5-5", max_tokens=1024, tools=tools, messages=messages
)
while response.stop_reason == "tool_use":
calls = [block for block in response.content if block.type == "tool_use"]
print(f"Claude asked for {len(calls)} tool calls in one reply")
messages.append({"role": "assistant", "content": response.content})
results = []
for call in calls:
hours = get_opening_hours(**call.input)
print(f" {call.name}({call.input}) returned {hours!r}")
results.append({"type": "tool_result", "tool_use_id": call.id, "content": hours})
messages.append({"role": "user", "content": results})
response = client.messages.create(
model="claude-opus-5-5", max_tokens=1024, tools=tools, messages=messages
)
print("Claude:", response.content[-1].text)
callskeeps only thetool_useblocks of the reply, however many there are.for call in callsruns them one after another. The API doesn't set an order: you could also run them at the same time.- Every result goes into the one
resultslist, and that list becomes oneusermessage.
The complete script:
import anthropic
client = anthropic.Anthropic()
OPENING_HOURS = {
"Monday": "closed",
"Tuesday": "7:30 to 18:00",
"Wednesday": "7:30 to 18:00",
"Thursday": "7:30 to 18:00",
"Friday": "7:30 to 18:00",
"Saturday": "8:00 to 16:00",
"Sunday": "9:00 to 14:00",
}
def get_opening_hours(day: str) -> str:
return OPENING_HOURS.get(day.capitalize(), "no opening hours for that day")
tools = [
{
"name": "get_opening_hours",
"description": (
"Get the café's opening hours for one day of the week. "
"Use it whenever someone asks when the café is open."
),
"input_schema": {
"type": "object",
"properties": {
"day": {"type": "string", "description": "A day of the week, such as Monday."},
},
"required": ["day"],
},
}
]
messages = [{"role": "user", "content": "When is the café open on Saturday and Sunday?"}]
response = client.messages.create(
model="claude-opus-5-5", max_tokens=1024, tools=tools, messages=messages
)
while response.stop_reason == "tool_use":
calls = [block for block in response.content if block.type == "tool_use"]
print(f"Claude asked for {len(calls)} tool calls in one reply")
messages.append({"role": "assistant", "content": response.content})
results = []
for call in calls:
hours = get_opening_hours(**call.input)
print(f" {call.name}({call.input}) returned {hours!r}")
results.append({"type": "tool_result", "tool_use_id": call.id, "content": hours})
messages.append({"role": "user", "content": results})
response = client.messages.create(
model="claude-opus-5-5", max_tokens=1024, tools=tools, messages=messages
)
print("Claude:", response.content[-1].text)

Step 4: Run It
uv run --env-file .env parallel_tools.py
Claude asked for 2 tool calls in one reply
get_opening_hours({'day': 'Saturday'}) returned '8:00 to 16:00'
get_opening_hours({'day': 'Sunday'}) returned '9:00 to 14:00'
Claude: The café's weekend hours are:
- **Saturday:** 8:00 to 16:00
- **Sunday:** 9:00 to 14:00

Claude's first reply held two tool_use blocks, one per day. The loop ran both and sent both results back in one message, so Claude answered in the next reply: one round trip for two lookups.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Running only the first call, response.content[0] | 400: `tool_use` ids were found without `tool_result` blocks immediately after, naming the call that got no result | Run every tool_use block in the reply |
One user message per result | The API accepts it, but Anthropic's docs say it "teaches" Claude to avoid parallel calls | Send all the results in one user message |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
`tool_use` ids were found without `tool_result` blocks immediately after | A call in the reply got no result | Answer every call, each with its own tool_use_id |
| Claude calls one tool per reply when it could call two | The conversation sent earlier results in separate messages | Send each reply's results together, as this script does |
FAQ
Do I have to run the calls in order?
No. Anthropic's documentation says the API "doesn't prescribe an execution order": you can run them one after another, as here, or at the same time. Each result is matched to its call by tool_use_id, not by position.
Can I make Claude call only one tool per reply?
Yes. Anthropic's documentation describes disable_parallel_tool_use inside tool_choice: with {"type": "auto", "disable_parallel_tool_use": True}, Claude calls at most one tool in each response.
What if one of the calls fails?
Send its result with "is_error": True, alongside the others, as How to Tell Claude a Tool Failed with is_error shows. Every call still needs a result.
Conclusion
Asked about Saturday and Sunday, Claude put two get_opening_hours calls in one reply. Running both and sending both tool_result blocks in one user message got the answer in a single round trip.
Additional Resources
- Parallel tool use — several calls in one reply, formatting the results, and turning it off.
- Handle tool calls — the
tool_resultblock and its rules.
