Skip to content

Commit cdb6731

Browse files
committed
Misc docs updates
1 parent 091a719 commit cdb6731

File tree

3 files changed

+140
-104
lines changed

3 files changed

+140
-104
lines changed

docs/advanced-usage/available-tools/read-file.md

Lines changed: 83 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ image: /img/social-share.jpg
2020
The `read_file` tool examines the contents of files in a project. It allows Roo to understand code, configuration files, documentation, and now images to provide better assistance.
2121

2222
:::info Multi-File Support
23-
The `read_file` tool can read multiple files simultaneously when the `maxConcurrentFileReads` setting is greater than 1. This significantly improves efficiency for tasks requiring analysis of multiple related files.
23+
The `read_file` tool accepts multiple files via the `args` format. Concurrency and per‑request limits are configured in the UI; the backend tool doesn’t hard‑enforce a file count cap. Some models may use a simplified single‑file variant.
2424

2525
**Note:** When reading files (even single files), the LLM will see a message encouraging multi-file reads: "Reading multiple files at once is more efficient for the LLM. If other files are relevant to your current task, please read them simultaneously."
2626
:::
@@ -43,7 +43,7 @@ While the single-file parameters (`path`, `start_line`, `end_line`) are still su
4343

4444
### Enhanced Format (Multi-File)
4545

46-
When `maxConcurrentFileReads` is set to a value greater than 1 (found in Settings > Context > "Concurrent file reads limit"), the tool accepts an `args` parameter containing multiple file entries:
46+
The tool also accepts an `args` parameter containing multiple file entries. Concurrency is UI‑configured; the backend accepts multiple files regardless of that setting. Some models may use a simple single‑file tool.
4747

4848
- `args` (required): Container for multiple file specifications
4949
- `file` (required): Individual file specification
@@ -72,22 +72,22 @@ This tool reads the content of a specified file and returns it with line numbers
7272

7373
- Displays file content with line numbers for easy reference
7474
- Can read specific portions of files by specifying line ranges
75-
- Extracts readable text from PDF and DOCX files
76-
- **Image support**: Displays images in multiple formats (PNG, JPG, JPEG, GIF, WebP, SVG, BMP, ICO, TIFF)
75+
- Extracts readable text from PDF, DOCX, XLSX, and IPYNB files
76+
- **Image support**: Displays images in multiple formats (PNG, JPG, JPEG, GIF, WebP, SVG, BMP, ICO, TIFF/TIF, AVIF)
7777
- **Intelligent reading**: Token-budget aware reading that auto-truncates to fit remaining budget instead of failing
7878
- **Large file preview**: Returns a 100KB preview for very large files to enable quick inspection
7979
- **Graceful error recovery**: Recovers from stream errors and guides you to use line_range for targeted reads
8080
- Automatically truncates large text files when no line range is specified, showing the beginning of the file
81-
- Provides method summaries with line ranges for truncated large code files
81+
- Appends `list_code_definition_names` for a code structure overview when content is truncated by line limits
8282
- Efficiently streams only requested line ranges for better performance
8383
- Makes it easy to discuss specific parts of code with line numbering
84-
- **Multi-file support**: Read multiple files simultaneously with batch approval (when `maxConcurrentFileReads` > 1)
84+
- **Multi-file support**: Read multiple files simultaneously with batch approval
8585

8686
---
8787

8888
## Multi-File Capabilities
8989

90-
When the `maxConcurrentFileReads` setting is greater than 1, the `read_file` tool gains enhanced capabilities:
90+
Multi-file reads are supported. Concurrency and per‑request limits are configured in Settings; the backend tool doesn’t hard‑enforce a file count cap and behavior may be constrained by model/tool selection:
9191

9292
### Configuration
9393
- **Location**: Settings > Context > "Concurrent file reads limit"
@@ -96,7 +96,7 @@ When the `maxConcurrentFileReads` setting is greater than 1, the `read_file` too
9696
- **Default**: 5
9797

9898
### Batch Processing
99-
- Read up to 100 files in a single request (configurable, default 5)
99+
- UI‑configurable limit up to 100 files per request (default 5). Backend doesn’t hard‑enforce a cap; actual behavior may be constrained by model/tool.
100100
- Parallel processing for improved performance
101101
- Batch approval interface for user consent
102102

@@ -116,13 +116,14 @@ When the `maxConcurrentFileReads` setting is greater than 1, the `read_file` too
116116

117117
## Limitations
118118

119-
- **Large files**: For extremely large files, the tool provides a preview and guides you to use line_range for targeted reading
120-
- For binary files (except PDF, DOCX, and supported image formats), may return content that isn't human-readable
121-
- **Multi-file mode**: Requires `maxConcurrentFileReads` > 1 in settings
122-
- **Image files**: Returns base64-encoded data URLs which may be large for high-resolution images
123-
- Default max single image size: 20MB
119+
- **Large files**: For extremely large files, the tool may return a preview and will guide you to use `line_range` for targeted reading.
120+
- **Binary files**: Except for PDF, DOCX, XLSX, IPYNB, and supported image formats, content may not be humanreadable.
121+
- **UI/model constraints**: Concurrency limits and per‑request file counts are configured in the UI; the backend tool doesn’t hard‑enforce a cap.
122+
- **Image files**: Images are provided as base64 data URLs. High‑resolution images can be large.
123+
- Default max single image size: 5MB
124124
- Default max total image size: 20MB
125-
- **Token budget**: Automatically truncates content to fit remaining token budget to prevent context overruns
125+
- **Unsupported binary formats**: Returns a `<binary_file format="ext">Binary file - content not displayed</binary_file>` placeholder.
126+
- **Token budget**: Content may be truncated to fit remaining token budget; notices indicate how to proceed.
126127

127128
---
128129

@@ -138,8 +139,8 @@ When the `read_file` tool is invoked, it follows this process:
138139
4. **Content Processing**:
139140
- Adds line numbers to the content (e.g., "1 | const x = 13") where `1 |` is the line number.
140141
- For truncated files, adds truncation notice and method definitions
141-
- For special formats (PDF, DOCX), extracts readable text
142-
- For image formats, returns base64-encoded data URLs with MIME type
142+
- For special formats (PDF, DOCX, XLSX, IPYNB), extracts readable text
143+
- For image formats, the XML includes a `<notice>` with size; the actual image is attached to the tool result as a base64 data URL (no dimensions returned; MIME type is implied by the data URL)
143144

144145
---
145146

@@ -148,9 +149,9 @@ When the `read_file` tool is invoked, it follows this process:
148149
The tool uses a clear decision hierarchy to determine how to read a file:
149150

150151
1. **First Priority: Explicit Line Range**
151-
- If either `start_line` or `end_line` is provided, the tool always performs a range read
152-
- The implementation efficiently streams only the requested lines, making it suitable for processing large files
153-
- This takes precedence over all other options
152+
- Legacy single‑file format: both `start_line` and `end_line` must be provided for a range read; otherwise it reads normally.
153+
- Multi‑file `args` format: specify one or more `line_range` entries per file.
154+
- Range reads stream only the requested lines and bypass `maxReadFileLine`, taking precedence over other options.
154155

155156
2. **Second Priority: Token Budget Management**
156157
- The tool respects the remaining token budget to prevent context overruns
@@ -160,15 +161,15 @@ The tool uses a clear decision hierarchy to determine how to read a file:
160161
- Recovers gracefully from stream errors and suggests alternative approaches
161162

162163
3. **Third Priority: Automatic Truncation for Large Text Files**
163-
- This applies only when **all** of the following conditions are met:
164+
- Applies only when all of the following are true:
164165
- Neither `start_line` nor `end_line` is specified.
165-
- The file is identified as a text-based file (not binary like PDF/DOCX).
166-
- The file's total line count exceeds the `maxReadFileLine` setting (default: 500 lines).
166+
- The file is identified as a textbased file (not binary like PDF/DOCX/XLSX/IPYNB).
167+
- The files total line count exceeds the `maxReadFileLine` setting (configurable; UI default may be 500; backend uses `-1`—no line limit—when unset).
167168
- When automatic truncation occurs:
168-
- The tool reads only the *first* `maxReadFileLine` lines.
169-
- It appends a notice indicating truncation (e.g., `[Showing only 500 of 1200 total lines...]`).
170-
- For code files, it may also append a summary of source code definitions found within the truncated portion.
171-
- **Special Case - Definitions Only Mode**: When `maxReadFileLine` is set to `0`, the tool returns only source code definitions without any file content.
169+
- The tool reads only the first `maxReadFileLine` lines.
170+
- It appends a notice like: `Showing only X of Y total lines. Use line_range if you need to read more lines.`
171+
- For code files, it appends `list_code_definition_names` for a structure overview.
172+
- **Special Case DefinitionsOnly Mode**: When `maxReadFileLine` is `0`, the tool returns only code definitions without file content (plus a notice).
172173

173174
4. **Default Behavior: Read Entire File**
174175
- If neither an explicit range is given nor automatic truncation applies (e.g., the file is within the line limit, or it's a supported binary type), the tool reads the entire content.
@@ -246,7 +247,7 @@ When reading a large text file without specifying a line range, the tool automat
246247
...
247248
500 | Log entry 500...
248249
249-
[Showing only 500 of 1500 total lines. Use start_line and end_line to read specific ranges.]
250+
Showing only 500 of 1500 total lines. Use line_range to read specific sections.
250251
// Optional: Source code definitions summary might appear here for code files
251252
```
252253
*(Output shows the beginning lines up to the `maxReadFileLine` limit, plus a truncation notice. Use line ranges for full access.)*
@@ -302,9 +303,21 @@ If the file is excluded by rules in a `.rooignore` file:
302303
<read_file>
303304
<path>.env</path>
304305
</read_file>
306+
```
307+
308+
**Simulated Output (Error):**
309+
```xml
310+
<file>
311+
<path>.env</path>
312+
<error>Access denied by .rooignore rules</error>
313+
</file>
314+
```
315+
316+
---
317+
305318
### Intelligent Reading with Token Budget Management
306319

307-
When reading large files, the tool automatically manages token budgets to prevent context overruns:
320+
When reading large files, the tool automatically manages token budgets to prevent context overruns.
308321

309322
**Scenario:** Reading a very large file without specifying a line range.
310323

@@ -317,17 +330,20 @@ When reading large files, the tool automatically manages token budgets to preven
317330

318331
**Simulated Output (for a file exceeding token budget):**
319332
```
320-
[First 100KB of file content shown as preview...]
333+
Preview: Showing first …MB of …MB file. Use line_range to read specific sections.
334+
```
321335

322-
[File exceeds remaining token budget. Showing 100KB preview. Use line_range to read specific sections.]
336+
Alternative truncation notice:
337+
```
338+
File truncated to N of M characters due to context limitations. Use line_range to read specific sections.
323339
```
324340

325-
This intelligent behavior ensures that:
341+
This behavior ensures that:
326342
- Small files read completely with zero overhead
327-
- Large files auto-truncate to fit remaining token budget
343+
- Large files autotruncate to fit remaining token budget
328344
- Very large files provide a quick preview
329345
- You receive guidance to use `line_range` for targeted reads
330-
- Stream errors are recovered gracefully
346+
- Stream errors are handled gracefully
331347

332348
**Example with line_range for targeted reading:**
333349
```xml
@@ -338,20 +354,6 @@ This intelligent behavior ensures that:
338354
</read_file>
339355
```
340356

341-
---
342-
343-
```
344-
345-
**Simulated Output (Error):**
346-
```xml
347-
<file>
348-
<path>.env</path>
349-
<error>Access denied by .rooignore rules</error>
350-
</file>
351-
```
352-
353-
---
354-
355357
## Image Reading Examples
356358

357359
The `read_file` tool now supports reading and displaying images directly in the chat interface. This enables powerful visual analysis workflows.
@@ -367,15 +369,13 @@ The `read_file` tool now supports reading and displaying images directly in the
367369

368370
**Output:**
369371
```xml
370-
<image_content>
371-
<path>assets/logo.png</path>
372-
<mime_type>image/png</mime_type>
373-
<dimensions>width: 512, height: 512</dimensions>
374-
<data_url>data:image/png;base64,iVBORw0KGgoAAAANS...</data_url>
375-
</image_content>
372+
<file>
373+
<path>assets/logo.png</path>
374+
<notice>Image file (123 KB)</notice>
375+
</file>
376376
```
377377

378-
The image will be displayed directly in the chat interface, allowing Roo to analyze visual content.
378+
The image is displayed inline in the chat (base64 data URL attached to the tool result). No dimensions are returned; MIME type is implied by the data URL.
379379

380380
### OCR Workflow Example
381381

@@ -436,14 +436,15 @@ Compare these design mockups and provide feedback on:
436436
### Supported Image Formats
437437

438438
The tool supports the following image formats:
439-
- **PNG** - With dimension extraction
440-
- **JPG/JPEG** - Standard and progressive
441-
- **GIF** - Static and animated
442-
- **WebP** - Modern web format
443-
- **SVG** - Scalable vector graphics
444-
- **BMP** - Bitmap images
445-
- **ICO** - Icon files
446-
- **TIFF** - Tagged image format
439+
- PNG
440+
- JPG/JPEG
441+
- GIF
442+
- WebP
443+
- SVG
444+
- BMP
445+
- ICO
446+
- TIFF/TIF
447+
- AVIF
447448

448449
### Image Analysis Use Cases
449450

@@ -458,7 +459,7 @@ The tool supports the following image formats:
458459

459460
## Multi-File Examples
460461

461-
When `maxConcurrentFileReads` is set to a value greater than 1, you can read multiple files simultaneously using the enhanced XML format.
462+
You can read multiple files simultaneously using the enhanced XML format.
462463

463464
### Reading Multiple Complete Files
464465

@@ -641,3 +642,22 @@ You can read different types of files in a single request:
641642

642643
This allows Roo to analyze documentation, visual diagrams, configuration, and specifications all in one context.
643644

645+
---
646+
647+
## Troubleshooting
648+
649+
- Range read returns error
650+
- Cause: `start_line`/`end_line` invalid or `start_line > end_line`
651+
- Fix: Provide both `start_line` and `end_line` as positive integers with `start_line ≤ end_line`; or use `args` with one or more `line_range` entries.
652+
- Prevention: Prefer `line_range` in the multi‑file format for targeted reads.
653+
654+
- Large file returned a preview
655+
- Cause: File exceeded token budget or the large‑file tokenization threshold; a preview was returned.
656+
- Fix: Use `line_range` to request only the section you need; reduce requested ranges.
657+
- Prevention: Adjust `maxReadFileLine` in Settings, or prefer targeted ranges on large files.
658+
659+
- Image not displayed
660+
- Cause: Model may not support images, or image limits exceeded (5MB per image; 20MB total per request).
661+
- Fix: Switch to a vision‑capable model; reduce image size; request fewer/smaller images.
662+
- Prevention: Keep images within limits and use supported formats (PNG, JPG/JPEG, GIF, WebP, SVG, BMP, ICO, TIFF/TIF, AVIF).
663+

0 commit comments

Comments
 (0)