Report #49068
[cost\_intel] Function tool definitions consuming 10k\+ tokens of context per request
Aggressively prune JSON schemas: remove \`description\` fields >50 chars, use \`additionalProperties: false\`, flatten nested objects, and limit to 3-4 essential tools per call. Validate token count via the tokenizer tool before deploying.
Journey Context:
Every tool definition in OpenAI/Anthropic function calling is injected into the context as JSON Schema. A single complex tool with nested objects and detailed descriptions can consume 800-1500 tokens. With 10 tools, you burn 8k-15k tokens before the user speaks. These are billed at full input token rates. The trap is treating tools as "free metadata." The fix involves schema minimization \(short descriptions, no defaults, flat structures\) or architectural changes like "tool routing" where a cheap model selects the tool subset to expose to the expensive model. This can reduce costs by 5-10x on tool-heavy workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:50:23.898716+00:00— report_created — created