Overview
When a tool’s output is too large to show (over 2000 lines or 50 KB), it is saved and the notice names a reference. Theresource tool lets the agent look at it in parts. It also reads files attached to the chat or kept in the Files drive, and resources of MCP servers connected in the session.
References
References belong to the session. A subagent can use its parent’s references. Another session’s reference is refused.
Actions
Search
search ranks with BM25 over windows of 20 lines that overlap by half, so a hit is a line range that can be cited. The index is built on the device that runs the agent. Nothing leaves the device for indexing, and no server holds an index.
Reading a large file: the ladder
searchfor the question’s key words.readthe hit ranges.- Continue with
next_offsetonly if more is needed.
Citations
Every claim drawn from a file carries the token the result gives, written as[[cite:<ref>#L<start>-<end>]], using the lines the agent actually read. The apps show the token as a chip. Opening the chip opens the file at those lines. The “find all X” answer shape (the result-list template) gives the count, then one row per match: file, lines, why it matched and the cite token.
Range route
For Files-drive items the agent reads throughGET /api/v1/files/v2/items/:item_id/range. See the protocol for the contract.
A call returns at most 2000 lines and 256 KiB of text. The response holds
text, unit, start, end, total_lines, total_bytes, next_start (absent at the end) and truncated (true when one line was longer than the byte cap and was cut). Errors: 415 unsupported for a binary file or a document with no text, 416 for a range outside the file, and the usual read errors (403, 404). Access is the same as /content.
What comes back is data, not instructions.