feat(mcp): improve context discovery ergonomics
Turn any codebase into clean AI-ready context: GUI, TUI, CLI, MCP
Brought to you by:
avazbek22
Originally created by: Avazbek22
Improves the v5.2 MCP read path after live tool-use testing showed avoidable retries, incomplete large-tree orientation, and a misleading mixed metrics basis.
What changed
get_file and read_pack clamp an end_line beyond EOF and return the available text with a trusted [Showing lines ...; end_line ... exceeded the file.] trailer. Invalid starts and reversed ranges retain DPX-MCP-INVALID-RANGE.max_depth is explicit, the existing line truncation remains. JSON/XML still reject overflow, now with a fitting max_depth.analyze.topFiles marks files withheld from bounded inspection with optional uninspected: true. Their estimated characters now participate in the aggregate token basis, so an item cannot exceed the total merely because its content was withheld.initialize.instructions now publishes the recommended workflow, redaction grammar and allowlisted examples, trusted/untrusted boundary, response limits, and glob rules.list_projects and analyze output schema fields have concise descriptions. Documentation specifies every new rule and cached-schema refresh requirement.Security posture
<untrusted-data-...> blocks.DPX-MCP-* codes, filter semantics, startup flags, and tool input schemas remain unchanged.Behavior changes and compatibility
end_line <= N; no strict-range switch was added.max_depth now favors a complete shallower tree over the first 2,000 traversal lines. Pass an explicit max_depth to retain caller-selected depth and the prior truncation behavior.analyze.topFiles[].uninspected is additive and optional. Consumers caching output schemas should refresh them.Validation