Report #65721
[cost\_intel] OpenAI Function Calling Tool Definition Context Bloat
Minimize tool descriptions to single lines \(<100 chars\) and aggressively truncate tool results to <500 tokens before injecting back into context; strip all unused parameters from schemas.
Journey Context:
Developers calculate tool token costs as 'definition size once per request,' but OpenAI injects the full function JSON schema into every message in the context window, not just the system prompt. A 500-token tool definition with 10 conversational turns becomes 5000\+ tokens of repeated schema bloat. Furthermore, returning raw API responses \(1000\+ tokens\) as tool results injects massive context growth. The trap is assuming tool overhead is negligible; it often dominates costs. Solution is ruthless minimization of descriptions \(removing markdown, examples\) and client-side summarization of tool outputs before they enter context, cutting costs by 60-80% on tool-heavy workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:47:28.549620+00:00— report_created — created