Skip to content

feat: add opt-in GCF output format for the table tools - #4394

Open
blackwell-systems wants to merge 2 commits into
daniel3303:mainfrom
blackwell-systems:feat/gcf-output-format
Open

feat: add opt-in GCF output format for the table tools#4394
blackwell-systems wants to merge 2 commits into
daniel3303:mainfrom
blackwell-systems:feat/gcf-output-format

Conversation

@blackwell-systems

Copy link
Copy Markdown

Summary

Adds an opt-in output format, EQUIBLES_OUTPUT_FORMAT=gcf, that renders the table tools
as a Graph Compact Format generic wire instead of a markdown table.
GCF factors the column names into a single header and drops the per-cell | padding and
the separator row, so the response uses fewer tokens when it crosses the LLM boundary.

It hooks a single seam: MarkdownTable.Render, where the table tools already materialise
their rows. So it covers every tool that renders through it (short data, holdings, insider
trading, congress, FRED, COT, government contracts, FDA, …) with no per-tool changes.

It preserves your formatting exactly

This is the important part: GCF here reuses the exact cells the markdown table would
show
. The compact-USD ($1.23B), comma-grouped counts, adaptive-decimal prices, em-dash
nulls, split-adjusted values — all of it is emitted verbatim. GCF only changes the framing
(the | padding and the separator row), never the values a model reads. So the careful
per-column formatting in McpFormat is fully retained; the wire is just denser.

Deliberately conservative

  • Opt-in and additive. Default output is markdown, unchanged unless the variable is set.
  • Never dropped or garbled. If any row does not split into the same number of cells as
    the header, that result falls back to the markdown table. Data pipes escaped by
    MarkdownTable.EscapeCell are decoded back, not split into phantom columns.
  • Lossless. The GCF wire round-trips back to the same cell values.
  • Zero new footprint. BlackwellSystems.Gcf is a zero-dependency package (netstandard2.0),
    pinned exact via central package management.

Scope note: this covers the tools that render through MarkdownTable.Render (the single-table
search tools). The few tools that assemble multi-table output with the StringBuilder helpers
stay markdown-only for now; the same seam extends to them later if you want.

Measured on the tools' table shapes

o200k tokenizer, GCF vs the current markdown table, lossless round-trip verified:

  • Short-volume style (comma columns): ~15% fewer tokens
  • Holdings style (institution + shares + compact-USD value): ~13–14% fewer tokens

The win is the markdown framing (| per cell + the separator row); it scales with row count.

Why GCF, beyond size

The harder question than size is whether a model reads the compact form as accurately as the
table. GCF is designed and evaluated for that:

GCF is already in production across observability, developer tooling, and network automation:
Chrome DevTools MCP (Google) merged it
as an experimental format; Speakeasy (customers include Google, Verizon,
Mistral AI) ships it in their oq CLI; OmniRoute vendored it into its
gateway; NetClaw benchmarked it against TOON on
real network data and replaced TOON; and many others across the MCP and agent ecosystem.

The change

  • EQUIBLES_OUTPUT_FORMAT=gcf read in GcfTable, hooked into MarkdownTable.Render.
  • BlackwellSystems.Gcf package reference (central version pin).
  • Unit tests: the encode + lossless round-trip, the column-mismatch fallback, escaped-pipe
    decoding, formatting preserved verbatim, and that default markdown is unchanged
    (dotnet test green: 4,353 unit tests pass, CSharpier clean).
  • README documents the variable.

GCF is open source and MIT-licensed. Format, spec, SDKs, and benchmarks: https://gcformat.com
Happy to adjust the variable name or extend to the multi-table tools; reproducible numbers and
harness on request.

Set EQUIBLES_OUTPUT_FORMAT=gcf to emit Graph Compact Format instead of
markdown for the MarkdownTable.Render tools. GCF factors the column names
into one header and drops the per-cell padding and separator row, ~13-16%
fewer tokens (o200k) on the tools' table shapes, losslessly.

Hooked at the single MarkdownTable.Render seam, so it covers every tool
that renders through it with no per-tool changes. It reuses the exact cells
the markdown table would show, so all number/price/date/em-dash formatting
is preserved verbatim. Any row that does not match the header column shape
falls back to markdown, so a result is never dropped or garbled. Default
output is unchanged. BlackwellSystems.Gcf is zero-dependency, pinned exact.
@CLAassistant

CLAassistant commented Aug 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

- GcfTable.TryEncode now decodes the wire and compares it against the input
  records (order-insensitive on keys), so a cell the encoder could mis-render —
  e.g. a digit-only string that must stay a string rather than decode as a
  number — is caught and the markdown table is kept.
- MarkdownTable.Render uses GCF only when the whole message is smaller than the
  markdown table it replaces, so a tiny table is never enlarged.
- Tests for both: a digit-only cell round-trips as a string, and a one-row
  one-column table falls back to markdown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants