Skip to main content

Module read_files

Module read_files 

Source
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§

ReadBudgetReport
Budget accounting for one call. Byte counts are rendered (numbered) text.
ReadFileRevision
Revision receipt for one successful file read. revision is opaque to MCP callers and may be supplied to ApplyPatch as a compare-and-swap guard.
ReadFilesOutcome
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 honest isError: true only when nothing was read or an error goes beyond a missing file (security, policy, session).
ReadLineRange

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_detailed with an explicit budget instead of the environment, for embedding and deterministic tests.