feat: add experimentalGcfFormat flag for GCF-encoded tool responses#2235
Open
blackwell-systems wants to merge 1 commit into
Open
feat: add experimentalGcfFormat flag for GCF-encoded tool responses#2235blackwell-systems wants to merge 1 commit into
blackwell-systems wants to merge 1 commit into
Conversation
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
Add
--experimentalGcfFormatas a hidden experimental flag alongside the existing--experimentalToonFormat. When enabled, tool responses encode structured data using GCF (Graph Compact Format) instead of formatted JSON. No changes to existing behavior or default output.Why
Benchmarked on Chrome DevTools data shapes
Data shapes verified from source code and test snapshots (
ConsoleMessageConcise,NetworkRequestConcise,HeapSnapshotFormatter.toJSON(),SnapshotFormatter.toJSON()):TOON increases token count on DOM snapshots (-4.6% to -17.2% vs JSON). GCF saves tokens on every data type.
Console message corruption
TOON's decoder crashes on console messages containing bracket-colon patterns, which are standard browser output:
10 of 20 console messages fail TOON round-trip. GCF: zero failures. While Chrome DevTools MCP encodes only (no decode), the structurally ambiguous output can affect downstream consumers.
LLM comprehension
GCF scores 100% on general structured data and 90.7% on adversarial payloads across GPT-4o, GPT-5.5, Claude, and Gemini. JSON scores 53.6%. TOON scores 68.5%. (1,700+ evaluations.)
Full eval data: GCF benchmarks
Data integrity
GCF verified lossless across 43 billion+ round-trips in 5 formats and 6 languages. Zero failures. Zero runtime dependencies.
Implementation
Mirrors the existing
experimentalToonFormatpattern exactly:useGcfparameter threaded throughhandle()→format()compactEncodehelper selects GCF, TOON, or null (formatted JSON)Changes
src/bin/chrome-devtools-mcp-cli-options.tsexperimentalGcfFormatflagsrc/third_party/index.tsgcfEncodefrom@blackwell-systems/gcfsrc/McpResponse.tsuseGcfparameter,compactEncodehelpersrc/ToolHandler.tsexperimentalGcfFormattohandle()package.json@blackwell-systems/gcf(pinned 2.1.2, zero deps)Links