feat(mcp): per-call result size override via _meta annotation#6343
Merged
Conversation
bug-ops
force-pushed
the
feat/issue-3079/per-tool-result-size-override
branch
from
July 16, 2026 22:56
a2dbf52 to
a372fd3
Compare
MCP servers can now request a larger truncation threshold for a single tool call by annotating the result with _meta["zeph/maxResultSizeChars"], clamped server-side to the new [tools.overflow].max_per_call_override ceiling (default 128K). Absent or malformed annotations fall back to the existing global threshold unchanged. Includes a config migration (step 89) so existing on-disk configs surface the new key.
bug-ops
enabled auto-merge (squash)
July 17, 2026 00:24
bug-ops
force-pushed
the
feat/issue-3079/per-tool-result-size-override
branch
from
July 17, 2026 00:24
a372fd3 to
c393be9
Compare
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
_meta["zeph/maxResultSizeChars"], mirroring Claude Code's_meta["anthropic/maxResultSizeChars"]pattern.[tools.overflow].max_per_call_override(default 131072 = 128 KiB) — the MCP server can never exceed this ceiling and can only raise the effective limit above the existing globalthreshold, never lower it._metavalues fall back to exactly the prior global-threshold behavior (fail-closed, zero regression for servers that don't opt in).max_per_call_override = 0disables the feature entirely and logs atracing::warn!if misconfigured (0 < max_per_call_override <= threshold).migrate_overflow_max_per_call_override) so existing on-disk configs surface the new key via--migrate-config.Closes #3079
Design
Full architecture review chain: architect → critic (approved) → developer → tester/perf/security/impl-critic (parallel validation) → code review (2 rounds). See
.local/handoff/in this branch's history for the complete design and audit trail.Notable findings resolved during review:
config/default.tomlwas initially missed (onlycrates/zeph-core/config/default.tomlgot the new key) — caught by code review, fixed.zeph-sanitizer's independentmax_content_size(64 KiB default) further bounds the real effective ceiling below the documented 128 KiB.Test plan
_metaparsing (missing/non-numeric/negative/float/bool/overflow), M2 misconfiguration warning, E2EToolOutput→process_one_tool_resultpath--profile ci, nextest full workspace, rustdoc gate, gitleaks) — clean.local/testing/playbooks/mcp.mdupdated with 4 new scenarios (valid override, above-ceiling clamp, malformed/missing fallback, disabled-via-zero).local/testing/coverage-status.mdrow added (Status: Untested — pending live-session verification)