The Fan-Out Problem: Why Grouping API Tools Isn't Enough
AI agents need fewer tools, not more. But grouping endpoints together creates a hidden trap, and the fix is simpler than you'd think.
If you've connected a real REST API to an AI agent, you've hit the tool-bloat problem. A typical SaaS API has 30-200 endpoints. Map them 1:1 to MCP tools and your agent is swimming in a flat list. Latency goes up, accuracy goes down, and half the tool calls are the agent picking the wrong one.
The obvious fix is grouping. Merge related endpoints into a single tool with an action field:
customers (tool)
โโ action: find
โโ action: search
โโ action: create
โโ action: update
โโ action: delete
Clean. The agent sees 5 tools instead of 50. Everyone wins.
Until you hit the fan-out problem.
What fan-out looks like
Take a real-world API โ say a CRM or an e-commerce backend. The "customers" resource is massive. It touches everything. If you naively group every endpoint that relates to customers under one tool, you get:
customers (tool)
โโ action: find
โโ action: search
โโ action: create
โโ action: update
โโ action: delete
โโ action: list_orders
โโ action: list_invoices
โโ action: merge_duplicates
โโ action: archive
โโ action: export
โโ action: import
โโ action: add_note
โโ action: assign_agent
โโ action: update_subscription
โโ action: send_email
โโ action: get_activity_log
โโ action: ... (you get the point)
Fan-out is the number of actions stuffed under one parent tool. And when that number gets high, you've recreated the original problem one level deeper. The agent is now scanning a giant action enum instead of a giant tool list. Same confusion, different shelf.
The grouping win disappears.
Why 8 is the right cap
This isn't arbitrary. LLMs read tool schemas linearly. Name, description, parameter list, action enum. When the action list is short (3-5 items), the agent scans it in one glance and picks the right action. When it's long (15+ items), the agent does what it does with the flat tool list. It guesses, sometimes wrong.
We landed on a maximum of 8 actions per grouped tool. Here's the reasoning:
- Skimmability. 8 items fit in the agent's attention window without scrolling. The description + action list is digestible in one pass.
- Forced clarity. Capping at 8 forces the optimizer to find meaningful sub-groupings. Instead of one bloated
customers tool, you get: