mcp: structured JSON from eval/hol_load, output truncation, built-in timing#163
Merged
jrh13 merged 3 commits intojrh13:masterfrom Apr 9, 2026
Merged
mcp: structured JSON from eval/hol_load, output truncation, built-in timing#163jrh13 merged 3 commits intojrh13:masterfrom
jrh13 merged 3 commits intojrh13:masterfrom
Conversation
…timing
eval now returns structured JSON:
{success, output, output_truncated, full_output_chars, time_seconds}
Large outputs are truncated to max_output_chars (default 4000, configurable
in hol-mcp.toml and per-call).
hol_load now returns quiet structured JSON:
{success, file, time_seconds} (plus error on failure)
Intermediate val bindings are suppressed. Use eval with needs for verbose output.
Built-in timing on all eval/hol_load calls via _eval_raw returning
(output, elapsed_seconds) tuples.
Also: add hol_interrupt smoke test (all 14 tools now covered), bump all deps
(mcp 1.27, starlette 1.0, cryptography 46.0.6, etc.), fix README test counts.
Breaking change: eval and hol_load return types changed from raw strings
to JSON. All tests and smoke tests updated.
this was a typo, and now it matches the unit test.
Owner
|
All looks great, thanks! |
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.
Reduces LLM context window bloat from the MCP server by making
evalandhol_loadreturn structured, truncated JSON instead of raw strings.Motivation
During the AES-GCM formalization, I found that large outputs from
evalandhol_loadfill up the context window quickly---the S-box precomputation dumps ~15K chars,needsprints every intermediatevalbinding (~10K chars), and largeletbindings print full values. All this noise leaves less room for actual reasoning.Changes
evalreturns structured JSON{ "success": true, "output": "val it : thm = |- 1 + 1 = 2", "output_truncated": false, "full_output_chars": 42, "time_seconds": 0.003 }max_output_charsparameter (default 4000, configurable per-call and inhol-mcp.toml)successfield uses heuristic error detection (checks forError:,Exception:,Failure, andUnbound)time (...)hol_loadreturns quiet structured JSON{"success": true, "file": "Library/words.ml", "time_seconds": 0.45}hol_loadis meant for loading known-good files, so intermediatevalbindings are suppressed entirely.If it fails, an
errorfield is included, and you can debug by usingevalwithneeds "file.ml"to get the full output.Other
hol_statusnow includesmax_output_charsin its responsehol-mcp.tomlgains amax_output_charsconfig keyNote on truncation safety
Truncation is purely cosmetic. It is implemented in Python after all output has been read from the HOL Light subprocess. Specifically, this does not break pipes or
SIGPIPE.