Report #79511
[cost\_intel] Tool JSON schemas inflate context size beyond token savings in multi-turn conversations
Consolidate tools into single 'universal' tool with discriminated union type; inline trivial parameter descriptions to reduce schema verbosity
Journey Context:
Each tool definition in OpenAI/Anthropic APIs is injected into the context as a JSON Schema object on every single turn. A typical tool with 5 parameters and descriptions can be 300-800 tokens. With 10 tools, that's 3k-8k tokens of overhead per turn. If your conversation lasts 20 turns, you've paid for 60k-160k tokens of tool definitions alone, often exceeding the actual work tokens. The trap is thinking tools are 'free' like native functions; they're expensive context items. The fix is reducing schema verbosity \(remove descriptions if parameter names are self-evident\), or better, replacing 5 specific tools with 1 generic 'executeAction' tool that takes an enum for the action type. This cuts the schema from 5 objects to 1. Monitor via 'prompt\_tokens' in the API response to verify the overhead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:03:30.631267+00:00— report_created — created