Expand description
Implementation of the ReadFiles tool.
Reads one or many files with line numbers and optional line ranges. Every
call is bounded by a response budget (ReadResponseBudget): an item over
budget returns its head at a line boundary plus the exact next range to
request, and an unchanged, still-guarded repeat in the same thread returns a
compact marker instead of resending identical content.
Structs§
- Read
Budget Report - Budget accounting for one call. Byte counts are rendered (numbered) text.
- Read
File Revision - Revision receipt for one successful file read.
revisionis opaque to MCP callers and may be supplied toApplyPatchas a compare-and-swap guard. - Read
Files Outcome - Complete result of one batched read. The MCP adapter keeps a batch with
partial successes a SUCCESS when every per-file error is just a missing
path (exploratory guesses are normal for remote models; the errors stay
visible inline and in structured
missing_files), and returns an honestisError: trueonly when nothing was read or an error goes beyond a missing file (security, policy, session). - Read
Line Range
Functions§
- handle_
tool_ call - Text-only library API. Direct callers always receive content: unchanged
repeats are compacted only for MCP callers through
handle_tool_call_detailed. - handle_
tool_ call_ detailed - handle_
tool_ call_ with_ budget handle_tool_call_detailedwith an explicit budget instead of the environment, for embedding and deterministic tests.