Give Your Agent Fewer Tools
Every tool you hand an agent costs accuracy and context. Give each job a short named list, merge the overlaps, and test the allowlist like a lock.
The tools an agent can reach are part of the foundation, along with the code it reads. A crooked tool list shapes every step the same way a crooked codebase does.
When an agent misbehaves, the first thing I reach for is the prompt. More often the problem is the tool list. It's long, half the tools overlap, and some of them can do far more than the job needs. The agent isn't confused about what I asked. It's confused about which of forty similar things to pick up.
More tools, lower accuracy
Every tool definition goes into the context window. Its name, its description, its parameters. Load a dozen MCP servers and the agent starts each task carrying hundreds of definitions it will never use. That's context spent before the first step, and the rest of the session runs closer to the point where models get worse at following instructions.
The bigger cost is choice. The more tools a single call can see, the more often the model picks the wrong one. Two tools with similar names and similar descriptions collide. search_records and find_records and query all look like reasonable answers to "look this up." The model guesses, and a wrong guess looks like a reasoning failure even though the cause is the list.
Current models can handle a lot. Fifty to a hundred tools is fine for most, and some handle a couple hundred. That number is a ceiling, not a target. My bots need five or six tools each. Staying small matters more than staying under the limit.
Three habits keep the list honest:
- One tool per action a person would name. "Create an issue" is a tool. "Call the REST endpoint" is not. If your organization has three hundred APIs, don't register three hundred tools. Converting an API one-to-one into tools gives the agent your internal structure instead of the job.
- Merge overlaps. If two tools do nearly the same thing, keep one. If they differ in an important way, make the names and descriptions say how.
- Split by mode. A planning pass needs read tools. A fix pass needs write tools in one place. Give each mode its own set instead of giving everything to every mode.
When the work really does need a big catalog, load tools on demand: an index the agent searches, with the full definition pulled in when it picks one. Don't put the whole catalog in the prompt up front.
Read before write
The second split that matters is reading versus acting. Reading is cheap to get wrong. Writing is not.
So I hand out write tools one at a time. A bot that triages issues gets read access to the tracker and one write: create or comment on an issue. A bot that drafts outreach gets nothing that sends. It posts its draft to a review channel, and a person sends it. The write a bot needs is the job itself, and nothing else.
This also limits what a bad input can do. An agent that reads text from the outside world and also holds a broad set of write tools is one prompt injection away from doing something you never asked for. The fewer write tools in the room, the smaller that risk. I'll come back to that in the piece on the front door.
Shell access is a tool list too
Most of my bots don't use MCP at all. They work through the shell: gh, curl, a few Node and Python scripts. That makes the allowlist the tool list, and shell allowlists leak in ways that aren't obvious.
Allowing Bash allows anything. Allowing curl allows reading, posting and sending data anywhere, all with the same command. Allowing python3 allows any program. A deny list is weaker still. If you deny git push by prefix, git -C /some/dir push doesn't start with git push, and it goes through.
Chained commands make it worse. true && X, echo | X, $(X), bash -c "X", env X, find -exec, node -e, an npm run script that does X. Every one of those is a way to run a command the list meant to block.
The fix I use is to replace broad commands with named scripts. Instead of allowing curl, I allow bots-discord post --channel <name>, a small script that only posts to channels on its own list. Instead of python3 dedup.py, a bin called bots-dedup. Allow rules then match one fixed spelling, and the risky part (which URL, which channel) lives in code I can test, not in whatever the model typed. When I counted, one of my bot skills had 69 raw curl calls in it. Each one was an allowlist hole and a paragraph of instructions that a script could replace.
Test the list like a lock
An allowlist you haven't tried to break is a guess. Before a list goes live, I run a probe: a throwaway session with the bot's exact flags, asked to run each denied command in every chained, nested and disguised form I know. Pass means every one is refused.
That catches the leaks you can think of. It won't catch everything. An allowed interpreter or an allowed npm run can run what the list denies, so an allowlist is not a sandbox. If the bot's job really needs a broad interpreter, the boundary belongs in a container or a separate OS user, not in a list of strings.
The probe also needs the opposite check. A list that's too tight fails quietly. If the agent is missing the one tool it needs, it doesn't error. It stops acting and starts talking: it prints the code it would have written, or describes the issue it would have filed, and the run looks fine. So after any change to a bot's list, I run one pass in shadow mode and check three things in the log: it did its usual reads, nothing it needs was refused, and it didn't end as prose with no actions.
Load only the servers the job uses
MCP servers have the same problem one level up. By default, a Claude Code session loads every server configured for the user and the project. My own setup has more than a dozen: databases, CRM, chat, docs, payments. A bot that only reads GitHub issues was starting each pass with all of them in reach.
Now each bot passes --mcp-config with its own file and --strict-mcp-config, so it gets only the servers it names. The default is an empty file. When a bot does need a server, its read tools are listed by exact name, and a write tool goes only to the bot whose job is that write.
Pin the harness
The tool list isn't only yours. The agent harness ships its own tools and its own system prompt, and both change between releases. Tools get renamed, added and removed. If your fleet updates itself, its behavior can shift overnight with no change on your side and no record of why.
So I pin one version of the harness under a fixed path, turn off auto-update, and log the version in every pass report. When a bot starts acting strangely, the first question is whether the version changed. Upgrading becomes a deliberate step: bump the version in one place, read the release notes for tool changes, run the probe and one shadow pass per bot, then restart the loops.
The order I'd do it in
- Inventory. For each agent, list the servers it loads and the commands it actually runs.
- Strict MCP by default. Empty server list unless the job names one.
- Pin and log the harness version.
- Wrap the shell calls in named scripts.
- Write the probe.
- Write each list, smallest agent first, then one shadow pass each.
None of this is clever. It's the same thing as removing the deprecated helper from the codebase so the agent stops copying it. You take away the wrong choices before the agent gets a chance to make them.
How you know it's working
- Agents running with permissions skipped: trending to zero.
- MCP servers loaded per pass: down to the ones each agent uses.
- Probe results: every denied form refused, for every agent, after every list or version change.
- Passes that end with no actions: flat or falling after a list change. A jump means the list got too tight.
- Harness version in every pass report: 100%, so a behavior change can be traced to a release or ruled out.
- Raw
curlcalls left in the skills: falling toward zero as scripts replace them.