Skip to content

v0.8.12 — one release, closing out the "promises not kept" family

Choose a tag to compare

@activeing123 activeing123 released this 03 Oct 03:40
· 186 commits to main since this release

mcptoon 0.8.12 — one release, closing out the "promises not kept" family

Added

  • mcptoon retrieve <handle> — the CLI's half of compression. Every --smart output can end
    with full text: mcptoon_retrieve handle=<id>, but that handle was only redeemable from an MCP
    session: mcptoon_retrieve is a native MCP tool and the CLI had no counterpart. A shell user (or
    an agent driving the CLI, which is how most of mcptoon is used) was told exactly how to get their
    data back and then had no command to run. Now mcptoon retrieve <handle> reads the same store and
    prints the same original; mcptoon retrieve --list shows what the store holds. A miss exits 1
    with the specific reason (bad-handle / never-stored / expired / unreadable), so
    mcptoon retrieve <typo> && … cannot look like it worked.
  • The failure sentences now live in one place (ccr.RETRIEVE_NOTICES + ccr.retrieve_notice).
    The MCP tool and the CLI answer the same question, so a second copy would be a drift waiting to
    happen — and the empty-handle path in native_tools already had one, which is how the new
    agreement test caught it.

Fixed

  • --json is never char-truncated. The 4,000-character default cap lived in
    output.render and applied to every format, so a JSON payload past it came back with
    ... [truncated, N chars total, use --full] glued on — which is not a shorter
    document, it is invalid JSON
    . Measured: mcptoon install --list --json was 4,048
    bytes and json.loads raised JSONDecodeError; mcptoon install --list --json | jq
    fails outright. The default cap now applies only to the formats a human reads in a
    terminal (compact / mcptoon / slim / raw); --json and --toon are returned
    whole, so json.loads and toon_decode both round-trip. An explicit --max-chars N
    still truncates anything, because there the user asked.
  • --head N, --max-chars N and --full are no longer silently ignored. These are
    documented global output flags, but several handlers never received them and
    output.head() only understood lists — so on a mapping-shaped payload it did nothing.
    Measured before the fix: install --list --head 1 printed all 3 servers, skills list --head 2 printed all 421 skills, install --list --max-chars 500 changed nothing.
    head() now caps a mapping of records too (first N keys in sorted order, so "the
    first N servers" is deterministic rather than file-order), and every handler that
    renders a record collection — install, skills list, health, discover, import,
    config, stats, report, usage, footer-facts, retrieve — accepts and forwards
    the flags. --head N is now the format-agnostic way to shrink a large payload: it cuts
    records, not bytes, so the result stays valid in every format.
  • --full was a lie for mcptoon install. _cmd_install never received full, so the
    truncation notice "use --full" pointed at a flag that changed nothing. Measured: install --list
    with and without --full produced byte-identical stdout (4,048 bytes, notice still present);
    with the fix the same command returns 49,876 bytes and no notice.
  • --raw was never wired to the safety screen. The CREDENTIAL_LEAK / TOOL_POISONING fix
    hint says "use --raw to bypass" verbatim, but --raw only set the output format — the screen
    still blocked the result, so the advertised escape hatch did nothing. --raw now reaches the
    router as skip_poisoning_check=True, on both the call and call --auto paths; the default
    call still screens.
  • --smart on mcptoon install printed a compressed view with no way back. output.render
    was a second compression entry point next to compressor.compress_with_ccr, and the two had
    drifted: the formatter discarded the stats, so a payload could come back cut with no retrieve
    handle and nothing saying it had been cut. Measured on this machine, mcptoon install --list
    is 32,835 bytes and does compress, so this was a reachable path, not a theoretical one.
    _cmd_install's six render sites now go through _render_result — the same path mcptoon call
    uses — so the compressed view carries full text: mcptoon_retrieve handle=<id>.
  • output.render(fmt="smart") no longer compresses. It has no server:tool to key a handle
    on, so it cannot honour the contract that makes compression safe: whatever it hides must be
    fetchable. It previously compressed and appended an "original not stored" admission — honest
    about the loss, but still a loss, and a second entry point. There is one entry point now:
    callers that want compression call compress_with_ccr; callers that reach the formatter get
    their payload whole. Anyone relying on render(fmt="smart") to shrink a payload should call
    compress_with_ccr instead.

Tests

  • New tests/test_machine_readable_output.py pins the two promises above. It checks that
    --json/--toon are not char-truncated while compact/slim/mcptoon still are, that an
    explicit --max-chars still wins, that head() caps a mapping of records in sorted order
    without reshaping a mapping of lists, that the CLI's --json actually parses, and that
    --head/--max-chars shrink the payload. The flag-forwarding rule is checked
    structurally — it enumerates every output.render( site in cli.py, walks back to the
    enclosing def, and fails if any site drops a global flag — because reading the code to
    answer the equivalent reachability question was wrong twice in this repo.
  • New tests/test_next_step_works.py pins the three promises above, grouped by the promise rather
    than by module: what the output tells the user to do next, and whether doing it works. It checks
    that _cmd_install accepts and forwards full, that --raw reaches skip_poisoning_check on
    both routing paths while a normal call still screens, that mcptoon retrieve returns the original
    byte-identically, and that the CLI and the MCP tool answer every failure status with the same
    sentence.
  • New tests/test_smart_reachability.py pins the rule structurally rather than by inspection:
    it enumerates every render( call site in the package, walks back to the enclosing def, and
    fails if a fmt=fmt call has no fmt guard in between — i.e. if anything can hand "smart"
    to a formatter that cannot return what it dropped. It also asserts output.render is not a
    compression entry point and that compress_with_ccr is. This exists because reachability was
    stated wrongly twice from reading the code (first missing that auto_smart_enabled() makes
    call default to smart, then missing the elif fmt == "json" branches); the third answer came
    from a script, so the script is the durable form.