Add structured MCP tool outputs - #411
Closed
Lauritz-Timm wants to merge 3 commits into
Closed
Conversation
This was referenced Jul 30, 2026
Lauritz-Timm
force-pushed
the
feat/mcp-structured-output
branch
2 times, most recently
from
July 30, 2026 19:20
9ec8b44 to
9f0586a
Compare
This was referenced Jul 30, 2026
Lauritz-Timm
force-pushed
the
feat/mcp-structured-output
branch
from
August 4, 2026 19:01
9f0586a to
7afbf99
Compare
9 tasks
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 direct typed MCP output for recall, topic listing, and statistics.
Motivation
Modern clients can consume typed results directly instead of parsing prose. The previous generic structured envelope duplicated complete payloads, increased token use, and provided a weak contract.
Changes
output/memory.rsschemarsinstead of maintaining handwritten schema JSONToolSpeccatalogstructuredContentCompatibility and safety
MCP
2024-11-05clients receive the same full text and no structured fields. Newer supported revisions receive typed output for exactly the three discovery tools. This changes transport shape, not retrieval ranking.Validation
cargo test -p icm-mcp --locked --offline cargo clippy -p icm-mcp --all-targets --locked --offline -- -D warnings cargo fmt --all -- --checkFocused regressions validate real emitted Rust DTO values against their generated schemas and cover the three-schema allowlist, direct typed values, concise modern text, exact legacy text, hint preservation, text-only omission, and a large-fixture duplication saving.
The evaluation measured recall wire tokens falling from 1,411 to 619 (-56.1%) while Hit@3, Recall@3, nDCG@3, ordering parity, and required-field coverage remained at 100%.