Optimizing Oversized MCP Tool Schemas
Anoop_kathait · reddit · 2026-07-11
The author encountered a specific issue with a self-hosted AI agent (Hermes Agent): even sending a simple "hi" included the full JSON schema of all enabled tools and MCP servers, causing input tokens to spike past 20,000.
Their mitigation strategies included:
- Disabling unnecessary tools, reducing the active count from 25 to about 12.
- Adding a thin proxy in front of the heavy MCP scraping server to expose only a single scrapeurl tool, compressing the schema from 20,000 tokens to 200 tokens.
- Configuring an automatic fallback provider to avoid repeated retries within the same free quota or rate limit window.
- Lowering the max iterations per turn and implementing a hard stop, suspecting some consumption came from internal agent loops.
They are also exploring two further optimizations: lazy-loading MCP tool schemas and automatically rotating multiple free API keys before failing over to another provider.
Related event: MCP Tool Schema Overload Impairs Agent Accuracy(3 posts)→
More from coding & agent
- Gergely Orosz: Shipping 10x PRs With AI Agents, Sites Fill With Small Regressions — ducha_aiki · 2026-09-11
- Same Echo Maze prompt, three frontier models: all passed visually but shipped the same hidden bug — eyishazyer · 2026-09-11
- Astra storyboards plus Minimax H3 per-shot generation boost video success rates — Hailuo_AI · 2026-09-11
- Codex tip: use Sol with Astra and Luna sub-agents to save usage — pvncher · 2026-09-11
- agents-best-practices: a provider-neutral Agent Skill for designing and auditing agentic harnesses — tom_doerr · 2026-09-11
- Cognition's SWE-2 uses a KKT duality argument in RL to shift the effort Pareto curve — YouJiacheng · 2026-09-11