feat(mcp): optional limit on callers, callees, and impact#34
Merged
Conversation
Blast-radius queries had no per-call size lever: impact on a hot symbol returned every edge up to the fixed 500-per-direction cap (~9k tokens on this repo). An optional limit now truncates the edge list and appends a marker row reporting shown vs total. Omitting limit preserves the prior output byte-for-byte.
This was referenced Jul 17, 2026
Merged
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.
What
Adds an optional
limitargument to thecallers,callees, andimpactMCP tools. When set, the edge list is cut to the first N real edges and one marker row is appended reporting shown vs total (results limited to 5 of 79 edges). When omitted, output is byte-for-byte identical to before.Why
A tool-surface benchmark (receipts in
benchmarks/tool-surface/) measured the typed tools against a single bounded-search surface on the same 12-question set. Typed tools won on answers (11/12 vs 4/12) but had no per-call size lever:impacton a hot symbol emitted ~9,150 tokens andcallers~7,460 in one call, against the internal 500-per-direction safety cap only. An agent on a token budget needs to bound a blast-radius query the same way it bounds a search.Measured on this repo:
callers sync_repounbounded = 79 edges / 33,479 chars;limit: 5= 5 edges + marker / 2,267 chars.How
limit_edges(edges, Option<usize>)insrc/query/graph.rs: pure function, None passthrough, counts only real edges, drops any pre-existing cap marker on truncation, appends oneTRUNCATED_EDGE_KINDsentinel.src/mcp.rsdispatch for the three tools;limitadded to the shared symbol-tool schema (optional) and validated likedepth(absent ok, non-integer rejected).limit_edges_truncates_and_reports_shown_vs_total.Verification
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-features,cargo build --releaseall pass (Brigade receipts 20260717-1926*). Live MCP session confirmed omitted-limit output unchanged andlimit: 5behavior above.