$ recombobulate _
home / tips / lower-the-mcp-tool-search-threshold-to-save-tokens
lower-the-mcp-tool-search-threshold-to-save-tokens

Every MCP server you configure adds tool definitions to your context window, even when you're not using them. When those definitions exceed 10% of your context, Claude Code automatically defers them and loads tools on-demand via tool search. But you can trigger this earlier.

export ENABLE_TOOL_SEARCH=auto:5

Setting the threshold to auto:5 means tool search kicks in when MCP tool descriptions exceed just 5% of your context window. Deferred tools only enter context when actually used, so a lower threshold means fewer idle definitions eating your tokens.

This is especially useful if you have several MCP servers configured but only use one or two in a given session. Instead of paying for all those tool definitions on every message, only the tools Claude actually calls get loaded.

You can check what's consuming your context space at any time:

> /context

This shows you exactly how much space tool definitions, system prompts, and conversation history are taking up.

For maximum savings, combine this with disabling unused MCP servers via /mcp and preferring CLI tools like gh or aws that don't add persistent tool definitions at all.

Set a lower tool search threshold and stop paying for tools you're not using.


via Claude Code Docs — Costs

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Filter Test Output with a PreToolUse Hook to Cut Token Costs

A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.

bagwaa @bagwaa · 3 hours ago
0
Move Specialised CLAUDE.md Instructions into Skills to Shrink Context

CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.

bagwaa @bagwaa · 3 hours ago
0
Use prompt.id to Trace All Activity from a Single User Prompt

Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.

bagwaa @bagwaa · 3 hours ago