> ## Documentation Index
> Fetch the complete documentation index at: https://docs.danubeai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Call Tools

> Execute multiple tools in a single request

## Overview

Execute up to 10 tool calls in a single request. Each call is executed independently — a failure in one does not affect others. Results are returned in the same order as the input calls.

**Auth:** Requires API key (`danube-api-key` header). API key permissions are checked per tool.

## Body Parameters

<ParamField body="calls" type="array" required>
  Array of tool calls (1-10 items)

  <Expandable title="Tool call object">
    <ParamField body="tool_id" type="string" required>
      The tool UUID to execute
    </ParamField>

    <ParamField body="tool_input" type="object" default={{}}>
      Input parameters for the tool
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="results" type="array">
  Array of results in the same order as the input calls

  <Expandable title="Result object">
    <ResponseField name="tool_id" type="string">
      The tool that was executed
    </ResponseField>

    <ResponseField name="success" type="boolean">
      Whether the tool executed successfully
    </ResponseField>

    <ResponseField name="result" type="any">
      Tool output (varies by tool)
    </ResponseField>

    <ResponseField name="error" type="string">
      Error message if the call failed
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.danubeai.com/v1/tools/call/batch" \
    -H "danube-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "calls": [
        {
          "tool_id": "tool_weather_001",
          "tool_input": {"city": "San Francisco"}
        },
        {
          "tool_id": "tool_weather_001",
          "tool_input": {"city": "New York"}
        }
      ]
    }'
  ```

  ```python Python SDK theme={null}
  from danube import DanubeClient

  with DanubeClient(api_key="dk_...") as client:
      results = client.tools.batch_execute([
          {"tool_id": "tool_weather_001", "parameters": {"city": "San Francisco"}},
          {"tool_id": "tool_weather_001", "parameters": {"city": "New York"}},
      ])
      for r in results:
          print(f"{r.tool_id}: {'ok' if r.success else r.error}")
  ```

  ```typescript TypeScript SDK theme={null}
  import { DanubeClient } from 'danube';

  const client = new DanubeClient({ apiKey: 'dk_...' });
  const results = await client.tools.batchExecute([
    { toolId: 'tool_weather_001', toolInput: { city: 'San Francisco' } },
    { toolId: 'tool_weather_001', toolInput: { city: 'New York' } },
  ]);
  for (const r of results) {
    console.log(`${r.toolId}: ${r.success ? 'ok' : r.error}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "results": [
      {
        "tool_id": "tool_weather_001",
        "success": true,
        "result": {
          "temperature": "18C",
          "condition": "Partly cloudy"
        },
        "error": null
      },
      {
        "tool_id": "tool_weather_001",
        "success": true,
        "result": {
          "temperature": "5C",
          "condition": "Clear"
        },
        "error": null
      }
    ]
  }
  ```
</ResponseExample>

## MCP Tool

This endpoint is also available as the `batch_execute_tools` MCP tool:

```python theme={null}
result = await mcp.call_tool("batch_execute_tools", {
    "calls": [
        {"tool_id": "tool_weather_001", "tool_input": {"city": "San Francisco"}},
        {"tool_id": "tool_weather_001", "tool_input": {"city": "New York"}}
    ]
})
```
