← Blog

Claude API Parallel Tool Calls: Handling Guide

2026-11-14 · 5 min read · SubToAPI Team

What "parallel tool calls" means in the Claude API

When you give Claude multiple tools, it doesn't always ask for one at a time. If a single user request needs several independent pieces of information — say, current weather in three cities, or a stock price plus a currency conversion — Claude can return multiple tool_use blocks in one response. That's parallel tool calling: several tool requests issued together, which your application should execute (ideally concurrently) and then report back in a single follow-up message.

Handling this correctly means three things: parsing all tool_use blocks from the response (not just the first one), running each tool and capturing its result, and sending every result back as a tool_result block matched to the correct tool_use_id. Get the matching wrong and Claude either errors out or silently ignores results — the rest of this guide shows the pattern that works reliably.

How Claude's response looks with multiple tool calls

A response with parallel tool calls has stop_reason: "tool_use" and a content array containing more than one tool_use block, often alongside a text block:

{
  "stop_reason": "tool_use",
  "content": [
    { "type": "text", "text": "Let me check both." },
    { "type": "tool_use", "id": "toolu_01A", "name": "get_weather", "input": { "city": "Berlin" } },
    { "type": "tool_use", "id": "toolu_01B", "name": "get_weather", "input": { "city": "Lisbon" } }
  ]
}

Each block has its own id. That id is what you echo back in the tool_result, not the tool name — if you ask for weather in two cities with the same tool, the name alone can't disambiguate which result belongs to which call.

Step 1: collect every tool_use block

Don't assume there's only one. Filter the entire content array:

const toolUses = response.content.filter(block => block.type === "tool_use");

If toolUses.length is 1, you're in the simple case. If it's more than 1, you need to execute all of them before replying.

Step 2: run the tools concurrently

Tools are usually independent I/O calls (an HTTP request, a database query, a file read), so there's no reason to run them sequentially. Use Promise.all and keep each tool's execution isolated so one failure doesn't block the others:

async function runTool(name, input) {
  switch (name) {
    case "get_weather":
      return await fetchWeather(input.city);
    case "get_fx_rate":
      return await fetchFxRate(input.from, input.to);
    default:
      throw new Error(`Unknown tool: ${name}`);
  }
}

const results = await Promise.allSettled(
  toolUses.map(block => runTool(block.name, block.input))
);

Promise.allSettled instead of Promise.all matters here: if one tool throws, you still want the other results to come back successfully rather than failing the whole batch.

Step 3: build tool_result blocks in the same order

Map each result back to its tool_use_id. Failed calls still need a tool_result — Claude expects a response for every tool_use it issued, even if that response describes an error:

const toolResultBlocks = toolUses.map((block, i) => {
  const outcome = results[i];
  if (outcome.status === "fulfilled") {
    return {
      type: "tool_result",
      tool_use_id: block.id,
      content: JSON.stringify(outcome.value)
    };
  }
  return {
    type: "tool_result",
    tool_use_id: block.id,
    content: `Error: ${outcome.reason.message}`,
    is_error: true
  };
});

These blocks go into a single new user message appended to the conversation — not one message per tool. Claude reads the whole batch at once and continues the conversation from there.

Step 4: send it back in one request

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Weather in Berlin and Lisbon?" },
      { "role": "assistant", "content": [ /* original tool_use blocks */ ] },
      { "role": "user", "content": [ /* tool_result blocks, order doesn't matter */ ] }
    ],
    "tools": [ /* same tool definitions as before */ ]
  }'

This is the same pattern you'd use with the direct Anthropic API — SubToAPI exposes the Messages and tool-use format as-is, so you're not learning a different schema, just routing the request through a sub_live_... application key instead of a personal subscription token. The tools documentation and Messages reference cover the full request/response shape if you're setting this up for the first time.

Streaming with parallel tool calls

If you're streaming (/docs/streaming), parallel tool calls arrive as separate content_block_start/content_block_delta/content_block_stop sequences, one per block index. The input_json_delta events for each tool call are interleaved by index, not concatenated across tools — buffer the partial JSON per index and only parse it once that block's content_block_stop arrives. Mixing deltas from different indexes into one buffer is the most common streaming bug with parallel tool calls.

Common mistakes to avoid

If you're building this against SubToAPI, the request/response format matches what's shown above with no translation layer — check the quickstart to get a key, or see pricing if you're moving a team from individual subscriptions to a shared API setup. You can sign up and test parallel tool handling with the free trial before committing to a plan.

Questions

Does Claude always call tools in parallel when it can? No — it decides based on the prompt and tool definitions. Independent, clearly separable sub-tasks are more likely to trigger parallel calls; tightly dependent steps (where one tool's output feeds another) are usually requested one at a time.

What happens if I don't return a tool_result for every tool_use block? Claude's next response is undefined behavior in practice — it may re-request the missing tool, produce an incomplete answer, or error depending on the model. Always return one tool_result per tool_use_id received.

Can I limit how many tools Claude calls in parallel? There's no API parameter for this. Control it through prompt instructions (e.g., "call at most one tool at a time") or by designing tools so batching naturally happens inside a single tool call instead of across multiple ones.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →