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
- charlie Marsh: rewrites beat external deps in the AI era — mohamedmansour · 2026-10-26
- OpenAI and Twitch launch Codex hackathon with $25,000 in prizes — OpenAIDevs · 2026-10-26
- Filtering secrets on the write path: why agent memory deserves more suspicion at ingest than retrieval — Classic-Being-7960 · 2026-10-26
- INT21's AI agent swarm rewrote Drama 3's inference runtime in Rust within one hour, beating SGLang-Omni — bingxu_ · 2026-10-26
- After OpenCode key leak: 5 practical rules for keeping keys away from agents — jacobholm_dev · 2026-10-26
- wandb 0.31.0 ships with 2x faster startup, adds JSON output for coding agents — wandb · 2026-10-26