Skip to main content

Output Format Optimization

Output Format Optimization controls how Willow formats tool outputs before they are sent to the model. It is configured from Monitor > Tokens, on the Optimize view.

Use this setting when tool responses are a major source of token usage. It works alongside Token Usage Analytics: analytics shows where output tokens are coming from, and output-format optimization changes how structured tool output is represented.

Token Optimization Settings side panel showing the Tool Output Format dropdown, a Playground action, a Format Comparison summary, and Save Changes

Configure the output format

  1. Open Monitor > Tokens.
  2. Select the Optimize view.
  3. Select Output Format at the top right of the view. The Token Optimization Settings panel opens.
  4. Set Tool Output Format.
  5. Use Playground to test formats before changing production behavior.
  6. Select Save Changes.

The button is labelled with the current format, for example Output Format: Default, so you can see the active setting without opening the panel.

Format changes apply to subsequent tool calls. Existing log entries and previous tool outputs are not rewritten.

Format options

The panel's Format Comparison block summarizes the same guidance next to the dropdown.

FormatUse when
Default (no conversion)Recommended starting point. Willow keeps the tool's native output, usually compact JSON.
JSON (Compact)You need guaranteed JSON structure with minimal whitespace.
JSON (Pretty)You are debugging and want readable JSON. It uses 20-30% more tokens than other formats.
CSVTool output is an array of objects with consistent fields. Saves roughly 20-30% against JSON (Compact).
YAMLYou want more human-readable output and can accept token usage similar to pretty JSON.
TOONOutput is tabular and you want a compact table-oriented representation. Saves roughly 20-50% against JSON (Compact).

Do not switch formats only because one looks shorter in a synthetic example. Test with real tool responses whenever possible.

Token Optimization Settings panel with the Tool Output Format dropdown open showing Default (no conversion), JSON (Compact), JSON (Pretty), CSV, YAML, and TOON

Playground

The Playground opens as a side panel with two tabs.

Real Data

Real Data tests formats against recent tool responses. Use this first because it reflects your organization's actual MCP usage. You can filter by MCP server before testing.

Token Optimization Playground showing Real Data testing with recent tool responses

Custom Test

Custom Test lets you paste text, JSON, or representative tool output and run Test All Formats. Use it when you are evaluating a new tool or do not yet have enough recorded responses.

Token Optimization Playground showing Custom Test input and Test All Formats action

Choosing a format

SituationRecommended starting point
Mixed or unknown output shapesDefault
APIs that always return JSON objectsJSON Compact
Large lists of similar recordsCSV or TOON
Debugging a tool responseJSON Pretty, then switch back after debugging
Human-readable intermediate outputYAML

If conversion fails, Willow should continue returning the original tool output rather than blocking the tool call.