Skip to content

Commit 9c39f29

Browse files
committed
docs: document repository-context tool modes
1 parent ecf653a commit 9c39f29

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

website/docs/v6/en/guide/tools.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,49 @@ evade it. Timeout and cancellation terminate the complete Unix process group.
7979
Large file changes replace full before/after event payloads with bounded
8080
previews and unified diff text plus hashes, sizes, and artifact references.
8181

82+
### Repository-context modes
83+
84+
Use `read.files` when the relevant paths are already known and one bounded
85+
response is cheaper than several tool turns:
86+
87+
```json
88+
{
89+
"files": [
90+
{ "path": "src/lib.rs" },
91+
{ "path": "src/config.rs", "offset": 40, "limit": 80 }
92+
],
93+
"max_output_bytes": 65536
94+
}
95+
```
96+
97+
The shared byte budget includes headers and the continuation text. Results
98+
stay in request order, and one unreadable member does not discard successful
99+
members. When `metadata.batch.truncated` is true, copy
100+
`metadata.batch.continuation` into the next call's `files` value; its offsets
101+
and remaining limits resume without repeating completed lines.
102+
103+
`grep.output_mode` selects the smallest useful result shape:
104+
105+
| Mode | Result |
106+
| -------------------- | ------------------------------------------------------------- |
107+
| `content` | Matching lines and optional context (default) |
108+
| `files_with_matches` | Lexically cursor-paginated matching paths |
109+
| `count` | Lexically cursor-paginated matching-line counts per file |
110+
| `summary` | Full-scan line and file totals without rendered match content |
111+
112+
Built-in workspace backends perform non-content scans without constructing
113+
discarded match text. S3 results set `metadata.search.truncated` and warn when
114+
the backend's object scan limit makes totals or paths incomplete.
115+
116+
`glob` keeps backend relevance or recency order by default. Set `sort: "path"`
117+
before cursor pagination when stable lexical pages are required.
118+
119+
For exact-string changes, call `edit` with `dry_run: true` to return the same
120+
before/after diff metadata without writing. Then apply the edit with
121+
`expected_replacements` set to the previewed count, and optionally add
122+
`max_replacements` as an independent upper bound. Dry runs advertise read-only
123+
capability and are safe for `batch` parallelization.
124+
82125
`batch` accepts at most 32 calls and applies at most 16-way concurrency. It
83126
fans out only when every child declares safe read-only, idempotent behavior;
84127
mutating and unknown tools are serialized. A partial batch identifies failed

0 commit comments

Comments
 (0)