Token Efficiency Encyclopedia

Structured Tool Output

Use JSON, XML, or other tight schemas for inter-step communication instead of natural language. Avoid verbose wrappers that add tokens without adding information.

How It Works

Tool outputs are defined by a strict schema with required fields, fixed keys, and no free-form prose. The consuming agent parses the output deterministically without needing to interpret natural language descriptions.

Benefits

Example

Instead of:

The search found 3 results. The first result is in file.py at line 10,
where the function foo is defined. The second result is in bar.py...

Return:

{
  "matches": [
    {"file": "file.py", "line": 10, "symbol": "foo"},
    {"file": "bar.py", "line": 25, "symbol": "bar"}
  ]
}

See Also

Tools