ENABLE_TOOL_SEARCH: Cut Claude Code's 45K-Token Tool Tax (2026)
By default Claude Code injects every registered tool definition into every turn — averaging about 45,000 tokens per turn just for tool descriptions. ENABLE_TOOL_SEARCH lazy-loads them instead.
Bleeding money on Claude Code or OpenClaw?
We apply the full cost checklist live and set up monitoring. See training and cost-audit options →
The fix: add "ENABLE_TOOL_SEARCH": "true" to the env block in ~/.claude/settings.json. Tool definitions then lazy-load — the model searches for the tools it needs instead of injecting every schema each turn. Per-turn context drops from ~45K to ~20K tokens, a 55% cut on the tool-schema portion of your prompt, typically $50-100/month at Sonnet rates, with no downside.
The one-line settings change
{
"env": {
"ENABLE_TOOL_SEARCH": "true"
}
}
Add that to ~/.claude/settings.json. A 926-session audit over 33 days totaled $1,619 — most of it was this tool-schema tax injected on every single turn.
Enabling it for OpenClaw
OpenClaw does not yet expose an identical flag under its own config, but any agent you wire to Claude through the OpenClaw gateway inherits the underlying Claude Code settings. Edit ~/.claude/settings.json, add the env block, then restart the gateway:
openclaw gateway restart
Check the next session’s token count to confirm the per-turn context dropped.
Stack it with the other fixes
ENABLE_TOOL_SEARCH cuts the input side of the bill (tool schemas). Pair it with Caveman Mode on the output side and you have recovered most of what a fresh session costs. Add compactThreshold and subagentModel in settings.json for another 30-50% on top. Auditing your MCP servers helps too — each enabled server adds 2-5K tokens per turn even when unused.
Related cost guides
- OpenClaw Costs Guide (all 10 fixes) — the full cost-optimization hub
- Caveman Mode for Claude Code — the output-side companion fix
- Restart Claude Code sessions at 200K tokens — stop paying for bloated context
Need help?
If you want every fix applied and verified with monitoring, we do the whole checklist live in one session. See training and cost-audit options →
Get guides like this in your inbox every Wednesday.
No spam. Unsubscribe anytime.
You'll probably need this again.
Press Cmd+D (Mac) or Ctrl+D (Windows) to bookmark this page.
Need OpenClaw fixed live?
Remote rescue sessions for gateway, auth, tunnel, VPS, and model access problems.
See Rescue Session