Report #67676
[cost\_intel] Tool Definition Schemas Consume More Context Tokens Than The Data They Replace
Prune active tool sets to <3 tools per request; flatten nested JSONSchema objects to single-level structures; truncate descriptions to <50 characters; remove unused 'required' fields; calculate tool token overhead via the tokenizer before adding new tools
Journey Context:
Every tool definition is serialized into the context window \(system prompt area\) on every API request. A moderately complex tool with nested objects, arrays, and detailed descriptions can consume 2,000-3,000 tokens. If a developer registers 10 tools with the assistant but only invokes 1, they pay for 9,000\+ unused context tokens per request—often exceeding the actual conversation history. This negates the supposed efficiency of 'letting the model choose tools.' Both OpenAI and Anthropic include the full JSONSchema in the prompt. The optimization is to dynamically select only the 1-3 relevant tools for each specific user intent, flatten schemas to reduce nesting, and aggressively minimize description strings.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:04:23.267345+00:00— report_created — created