Fixed
- A base64 blob inside a container was sliced in half.
compressor.pystates, in its own
comment, that a truncated base64 blob is not "smaller context" but a corrupted image the
model can no longer reason about — and invariant 5 promises such payloads are never
compressed. The guard that enforced that promise lived inis_compressible, which inspects
only the top-level type, so a blob sitting inside a list of records never reached it.
Measured:[{"id": i, "image": <400-char blob>}]came back with the blob cut to 121
characters ending in an ellipsis, and decoding it yields garbage. Same for a nested array,
for adata:URI inside a record, and for a blob among eight dictionary keys. The check now
runs per string at every depth. - The binary alphabet contained every space, so punctuation-free prose was exempt from
compression._BASE64_REallowed all whitespace, and its comment claimed "prose/JSON does
not match the alphabet above in the first place" — false, because the alphabet holds every
letter, every digit and (then) every space. A 400-character run of text with no punctuation
was classified as binary and silently skipped. Spaces and tabs are now evidence against a
blob while\r\nstill counts for MIME-wrapped base64. The length floor also moves from 256
to 64 characters, because the check now runs per string, where the strings that matter live:
at a 120-character budget a 121..255-character blob was still being sliced. Known gap,
stated rather than hidden: base64url tokens containing-or_, and JWTs (which contain
.), do not match the alphabet and can still be cut. compress()could return an edited object while reportingapplied: False. A payload
can be changed without getting smaller: a 121-character string becomes 120 characters plus
the ellipsis — same length, same token count, different bytes. Any caller treating the flag
as "nothing happened" was handed modified data with no notice, and one caller did exactly
that.applied: Falsenow means the returned object is the input, untouched, with the
counters zeroed so the stats cannot describe cuts that were not made.output.render(fmt="smart")dropped data silently. It rendered the crushed payload while
discardingcompress()'s stats entirely (crushed, _stats = ...), so not even the fact that
something had been cut left a mark: 50 records became 8, a 300-character description became
121 characters, and the output carried neither a retrieve handle nor any statement that the
rest was gone. It also rendered the crushed form when compression had not helped at all. This
formatter has noserver:toolto key a handle on, so it cannot offer a way back — which makes
the notice mandatory, not optional. It now appends the same "original not stored — this view
is all there is" line thatcompress_with_ccrappends when its store refuses, and returns the
original untouched when nothing was applied. Reachability, corrected twice after the release.
The first draft said the default format wasjsonand this was therefore only a public-entry-point
defect — wrong:auto_smart_enabled()is true, somcptoon callreally does default to smart
(safe, becausecallroutes throughcompress_with_ccr, which carries a handle). The second draft
said "every other command that is passed--smart" — also wrong, and this time in the direction of
overstating. Mapping all 21output.rendercall sites incli.pyshows the format whitelists in
manifest/inspect/search/health-check/usage/discover/importalready send
smart down their prose branch; the sites that can receive it unfiltered are the six in
_cmd_install(--list,--remove,--url,--npm,--pip, and install-by-name). So the
silent path wasmcptoon install … --smart, a narrow but genuinely reachable one.- A property defined by
anyOf/oneOfcollapsed to{}. That is JSON Schema for "any
value" — the least informative thingschema_simplifier.pycan emit, for a property that is
frequently required. The remove list at the top of the module never said combinators
vanish; the code simply had no branch for them. Branch types are now kept (a union is written
as the JSON Schema array form) and object structure inside an alternative survives, so
{"anyOf": [{"type": "string"}, {"type": "number"}]}reads asstring | numberinstead of
nothing. A branch'srequiredis copied forallOf(a conjunction, where it really is
mandatory) but deliberately not foranyOf/oneOf, where it belongs to one
alternative — telling an agent a parameter is mandatory when the schema does not say so is
worse than saying nothing.
Changed
- Two docstrings claimed more than the code does, and both now state their real caliber.
compressor.py's "the output is always JSON-serialisable" is true ofjson.dumps, which
emitsNaNandInfinityas bare tokens that JavaScript'sJSON.parserejects; they are
left alone on purpose, because rewriting them asnullwould destroy a value.
schema_simplifier.py's "the result is always a prefix of the original" was false for
multi-line descriptions: sentences are re-joined with single spaces and a leading markdown
marker is stripped, so the words and their order survive but the whitespace between them does
not. The property that actually matters — no sentence is skipped over to grab a shorter later
one — holds and is now pinned by a test. output.render(fmt="smart")output is now the JSON body plus a trailing notice line, matching
compress_with_ccr. A caller parsing it must read line 0, as the smart-format tests already did.
Tests
- The suite grows by the property tests that pin the six behaviours above: base64 intact at four
container depths, the 121..255 band, prose-without-punctuation still compressed, wrapped base64
still detected,applied: Falsereturning the identical object with zeroed counters, the
non-finite-number limit, a 22-shape description corpus checked against both budgets, the
no-skipped-sentence property, six combinator shapes, and the retirement of the 334KB claim.