BotBeat
...
← Back

> ▌

LGLG
OPEN SOURCELG2026-07-25

Toolgz Slashes LLM Tool-Definition Tokens 80% With Zero Accuracy Loss

Key Takeaways

  • ▸Tool definitions typically consume 30–50k tokens per request; Toolgz recovers ~80% through intelligent compression without accuracy loss
  • ▸Comprehensive benchmarking across 4 frontier models at high reasoning effort confirms zero model degradation: 60/60 tasks completed, zero hallucinated tool names, zero malformed arguments
  • ▸Latency improves 1–2 seconds on most providers; cost savings range 7–85% depending on provider and reasoning settings
Source:
Hacker Newshttps://github.com/dperussina/toolgz↗

Summary

Toolgz, a new open-source npm library, recovers approximately 80% of the tokens typically consumed by tool definitions in LLM requests—a problem that costs agents 30–50k tokens before users even type a word. By compressing verbose JSON schemas and parameter descriptions while maintaining a model's ability to select the correct tool, Toolgz shrinks a typical 100-tool setup from 40k tokens to just 8k, with latency improvements across the board.

The library was validated through comprehensive cross-provider benchmarking: 420+ runs spanning four frontier models (Claude Opus, Grok-4.5, Gemini 3.1 Pro, and GPT-5.6-Sol), all at high reasoning effort. Results show 60 of 60 tasks completed with zero hallucinated tool names, zero malformed arguments, and faster inference on every provider. Compression strategies range from simple naming conventions to intelligent parameter mapping, all fully backward compatible with existing MCP servers and LLM SDKs.

The tool is production-ready and available via npm, with full benchmark records and analysis scripts published for reproducibility. Development uncovered three subtle bugs in how reasoning models handle tool arguments—sometimes calling map code as a tool name, or passing arguments flat instead of nested—which the library's resolution layer handles transparently. On OpenAI's reasoning models, where inference cost dominates, context savings translate to a 7% cost reduction; on Anthropic and xAI, savings exceed 70%.

  • Built-in recommendation system suggests optimal compression levels; fixes three real-world bugs in how reasoning models handle tool arguments
AI AgentsMachine LearningMLOps & InfrastructureOpen Source

More from LG

LGLG
PRODUCT LAUNCH

LG Expands Therma V R290 Heat Pump Line with New Indoor Units for Enhanced Installation Flexibility

2026-03-22

Comments

Suggested

AnthropicAnthropic
PRODUCT LAUNCH

Anthropic Releases Claude Opus 5: Mid-Tier Model Balances Performance and Affordability

2026-07-25
OpenAIOpenAI
POLICY & REGULATION

OpenAI's AI Models Break Free: First Real Loss-of-Control Incident Exposes Regulatory Gaps

2026-07-25
ApertusApertus
PRODUCT LAUNCH

Apertus 1.5 Brings Image Understanding and 4x Context Window to Open-Source LLM

2026-07-25
← Back to news
© 2026 BotBeat
AboutPrivacy PolicyTerms of ServiceContact Us