Report #37757
[cost\_intel] Tool schema bloat consumes more tokens than the tool execution saves
Strip description fields <50 chars, remove default values from schema, collapse nested anyOf to single type, keep schema <200 lines; measure with tiktoken before deploy
Journey Context:
Each tool definition is injected into the system prompt as JSON schema. Anthropic's docs note that complex tools can add thousands of tokens to the context window. A common antipattern is verbose descriptions or using JSON Schema features like 'default' or complex nesting which expand the tokenized representation significantly. For a Claude 3.5 Sonnet call with 10 tools averaging 500 tokens each, that's 5k tokens \($0.015/input\) just for tools, versus a simpler 50-token schema \($0.0015\). The fix is aggressive schema minimalism: remove descriptions that don't change behavior, flatten types, and validate token count with tiktoken or the API's tokenizer before shipping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:51:00.791421+00:00— report_created — created