Skip to content

v1.108.70 — Bounded-source mode for get_symbol_source (#340)

Choose a tag to compare

@jgravelle jgravelle released this 22 Jun 13:45
· 30 commits to main since this release

Bounded-source mode for get_symbol_source (#340).

get_symbol_source always returned the full indexed body, which is fragile when a very large symbol or a heavy symbol_ids batch gets clipped by the MCP client or model context after a successful call, leaving the agent with a silently-partial implementation. Bounded mode gives callers a server-side truncation contract instead.

New optional params (default off; omit them and the response is byte-for-byte unchanged):

  • source_start_line / source_end_line — absolute file line numbers (same frame as line/end_line), clamped to the symbol body
  • max_source_lines — keep at most the first N lines of the (ranged) slice
  • max_source_bytes — UTF-8-safe per-symbol byte cap
  • max_total_source_bytes — batch cap; oversized symbols come back partial, never dropped

Truncation metadata on the slice when a bound shortens the body: source_truncated, source_range, source_total_range, source_total_lines, source_total_bytes, source_truncated_reason, source_is_bounded_view.

Contract: verify=true still hashes the full indexed body (a bounded entry is flagged source_is_bounded_view); context_lines combined with any bound is rejected so it can't expand past the bound; bounded params are hidden under compact_schemas (still callable) to protect the core_compact budget.

The source-retrieval analogue of search_symbols(token_budget=) from #328. New tests/test_v1_108_70.py (19); full suite 4690 passed / 10 skipped; CI green on Windows + Ubuntu, py3.10–3.13. Reported by @mmashwani.