Skip to content

TOON Format

Token-Oriented Object Notation (TOON) is a compact data format designed for LLM consumption. Agentic Forge uses TOON to reduce token usage in tool results by 15-40%, scaling with data size.

Why TOON?

JSON is verbose. Every key repeats for every object in an array. TOON uses headers and delimiters instead:

JSON:

json
[{"name": "John", "email": "john@x.com", "status": "active"},
 {"name": "Jane", "email": "jane@x.com", "status": "pending"}]

TOON:

name|email|status
John|john@x.com|active
Jane|jane@x.com|pending

Benefits

BenefitDescription
15-40% token savingsMeasured across weather, search, and database results
LLM-friendlyModels understand TOON as well or better than JSON
TransparentConversion happens in Armory; MCP servers return JSON unchanged
Smart conversionOnly uses TOON when it's actually smaller than JSON

How It Works

TOON Format Flow
  1. Client sends X-Prefer-Format: toon header (or Accept: text/toon)
  2. Armory routes the tool call to the backend MCP server
  3. MCP server returns JSON (no changes needed)
  4. Armory converts JSON to TOON before returning to client

When TOON Helps Most

Data TypeSavingsExample
Uniform arrays40-50%Database rows, search results
Flat objects20-30%Weather data, API responses
Tabular data40-60%CSV-like data, listings

When to Use JSON

TOON is less effective for:

  • Deeply nested structures
  • Non-uniform arrays (objects with different keys)
  • Small responses (overhead may exceed savings)

Armory compares both formats and only uses TOON when it provides actual benefit.

Configuration

Enable TOON in Armory:

yaml
# armory.yaml
result_transformer:
  toon_enabled: true

Request TOON format from clients:

GET /mcp
X-Prefer-Format: toon

Building efficient AI agents