Report #26796
[cost\_intel] Tool definition schemas bloat context by 5-10x more than the tokens they save in output
Minimize schema descriptions to 50 chars max; use enums instead of prose descriptions; truncate tool descriptions aggressively; use a 'tool router' cheap model to select tools, then call expensive model with only relevant tools; cache tool definitions in system prompt blocks
Journey Context:
Every tool defined in a request has its full JSON Schema injected into the context. A single well-documented tool with nested objects can consume 2000\+ tokens. With 10 tools, that's 20K tokens per request before user input. Developers auto-generate schemas from TypeScript definitions, preserving verbose JSDoc comments that tokenize heavily. The trap is thinking tools are 'registered' once like in a web framework; actually, they're resent on every turn. Alternatives include using terse schemas with external documentation references, or hierarchical routing \(cheap model picks tool category, expensive model executes\). This matters because 20K extra input tokens on Claude 3 Opus costs $0.30 per request—often more than the actual work.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:22:31.532787+00:00— report_created — created