feat: add opt-in GCF output format for the table tools - #4394
Open
blackwell-systems wants to merge 2 commits into
Open
feat: add opt-in GCF output format for the table tools#4394blackwell-systems wants to merge 2 commits into
blackwell-systems wants to merge 2 commits into
Conversation
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.
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in output format,
EQUIBLES_OUTPUT_FORMAT=gcf, that renders the table toolsas 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 andthe 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 materialisetheir 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-dashnulls, 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 carefulper-column formatting in
McpFormatis fully retained; the wire is just denser.Deliberately conservative
the header, that result falls back to the markdown table. Data pipes escaped by
MarkdownTable.EscapeCellare decoded back, not split into phantom columns.BlackwellSystems.Gcfis 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-tablesearch tools). The few tools that assemble multi-table output with the
StringBuilderhelpersstay 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:
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:
GPT-5.5, Gemini 2.5 Pro / 3.1 Pro / 3.5 Flash), 27 runs, 11 models, 4 providers; equal to or
better than JSON on every model. https://gcformat.com/guide/benchmarks
shapes what a transformer can represent, then validated by controlled from-scratch training
at 1.3B scale, measured causally rather than by an LLM judge. Four papers (2026, under review):
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
oqCLI; OmniRoute vendored it into itsgateway; 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=gcfread inGcfTable, hooked intoMarkdownTable.Render.BlackwellSystems.Gcfpackage reference (central version pin).decoding, formatting preserved verbatim, and that default markdown is unchanged
(
dotnet testgreen: 4,353 unit tests pass, CSharpier clean).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.