REA tools filling Claude Code's context
Unofficial guide. This site is an independent community guide and is not affiliated with the REA project. For authoritative docs see the official REA website and the morluto/rea GitHub repository. Commands here are taken from the official README/docs (checked 2026-10-25); REA changes quickly, so verify against the official docs.
Short answer: if REA fills Claude Code's context or autocompact keeps thrashing, add "REA_MCP_INPUT_SCHEMA_PROFILE": "compact" under mcpServers.rea.env in ~/.claude.json, then restart Claude Code. That cuts advertised schema size (~496 KB → ~290 KB for 172 tools).
Changed in rea-agents 6.8.0 (2026-10-25): compact is now the default (PR #5975), so on 6.8.0 you don't need to set it. In our 2026-10-25 run, 6.8.0's tools/list was byte-for-byte the same size with no variable and with compact (229 tools), and about 21% larger with REA_MCP_INPUT_SCHEMA_PROFILE=full. If you pinned an older version, rerun npx -y rea-agents@latest setup --client claude_code; if context is still tight, try the other fixes below.
Symptom
After adding REA, Claude Code warns about context size, "too many tools", or autocompact thrashing — especially when pointed at a third-party Anthropic-compatible endpoint (e.g. DeepSeek via ANTHROPIC_BASE_URL).
Cause
Claude Code turns tool search off when ANTHROPIC_BASE_URL is not first-party, so every REA tool definition is sent with every request (#2019). The docs measured ~496 KB with the default profile vs ~290 KB with compact (172 tools).
Fixes
- Add
"REA_MCP_INPUT_SCHEMA_PROFILE": "compact"to theenvofmcpServers.reain~/.claude.json, then restart Claude Code. - Make Claude Code assume the model's real window: set
CLAUDE_CODE_MAX_CONTEXT_TOKENS(DeepSeek's guide uses a[1m]model suffix). - If the endpoint supports
tool_referenceblocks,ENABLE_TOOL_SEARCH=truerestores deferred loading.
Related guides
- MCP setup for Claude Code & Cursor
- REA with Windsurf, Gemini CLI, VS Code & more
- Troubleshooting & FAQ
Sources: client-configuration.md#claude-code · issue #2019
Want almost no tool overhead? See REA vs leanrea.
FAQ
What is REA_MCP_INPUT_SCHEMA_PROFILE?
An environment variable on the REA MCP server that chooses how detailed each tool's input schema is when advertised to the client. The compact value shrinks schema size so Claude Code (and other agents) spend less context on tool definitions.
How do I fix REA filling Claude Code's context?
In ~/.claude.json, under mcpServers.rea, set env.REA_MCP_INPUT_SCHEMA_PROFILE to compact, restart Claude Code, and retry. If you use a non-Anthropic ANTHROPIC_BASE_URL (e.g. DeepSeek), also consider CLAUDE_CODE_MAX_CONTEXT_TOKENS or ENABLE_TOOL_SEARCH when the endpoint supports tool_reference.