You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add release notes for v3.25.0
- Add documentation for new features:
- Slash commands with examples and screenshots
- Message queueing functionality
- Background editing (experimental feature)
- Update experimental features index to include background editing
- Update read-file tool documentation
- Update custom modes documentation
- Update Gemini provider documentation
- Update sidebars to include new documentation pages
- Add supporting images for all new features
description: Explore the read_file tool's capabilities for examining file contents, supporting line ranges, PDF/DOCX extraction, and experimental multi-file concurrent reading.
3
+
description: Explore the read_file tool's capabilities for examining file contents, supporting line ranges, PDF/DOCX extraction, image reading, and experimental multi-file concurrent reading.
4
4
keywords:
5
5
- read_file
6
6
- Roo Code tools
@@ -9,17 +9,21 @@ keywords:
9
9
- line numbers
10
10
- PDF extraction
11
11
- DOCX support
12
+
- image support
13
+
- OCR workflows
12
14
- code analysis
13
15
- VS Code AI
14
16
image: /img/social-share.jpg
15
17
---
16
18
17
19
# read_file
18
20
19
-
The `read_file` tool examines the contents of files in a project. It allows Roo to understand code, configuration files, and documentation to provide better assistance.
21
+
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.
20
22
21
23
:::info Multi-File Support
22
-
When the [Concurrent File Reads](/features/concurrent-file-reads) experimental feature is enabled, this tool can read multiple files simultaneously using an enhanced XML parameter format. This significantly improves efficiency for tasks requiring analysis of multiple related files.
24
+
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.
25
+
26
+
**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."
23
27
:::
24
28
25
29
---
@@ -38,20 +42,20 @@ The tool accepts parameters in two formats depending on your configuration:
38
42
While the single-file parameters (`path`, `start_line`, `end_line`) are still supported for backward compatibility, we recommend using the newer `args` format for consistency and future compatibility.
39
43
:::
40
44
41
-
### Enhanced Format (Multi-File - Experimental)
45
+
### Enhanced Format (Multi-File)
42
46
43
-
When [Concurrent File Reads](/features/concurrent-file-reads) is enabled, the tool accepts an `args` parameter containing multiple file entries:
47
+
When `maxConcurrentFileReads` is set to a value greater than 1 (found in Settings > Context > "Concurrent filereads limit"), the tool accepts an `args` parameter containing multiple file entries:
44
48
45
49
-`args` (required): Container for multiple file specifications
46
50
-`file` (required): Individual file specification
47
51
-`path` (required): The path of the file to read
48
-
-`line_range` (optional): Line range specification (e.g., "1-50" or "100-150")
52
+
-`line_range` (optional): Line range specification (e.g., "1-50" or "100-150"). Multiple `line_range` elements can be specified per file.
49
53
50
54
---
51
55
52
56
## What It Does
53
57
54
-
This tool reads the content of a specified file and returns it with line numbers for easy reference. It can read entire files or specific sections, and even extract text from PDFs and Word documents.
58
+
This tool reads the content of a specified file and returns it with line numbers for easy reference. It can read entire files or specific sections, extract text from PDFs and Word documents, and display images in various formats.
55
59
56
60
---
57
61
@@ -70,20 +74,27 @@ This tool reads the content of a specified file and returns it with line numbers
70
74
- Displays file content with line numbers for easy reference
71
75
- Can read specific portions of files by specifying line ranges
-**Description**: "Maximum number of files the 'read_file' tool can process concurrently. Higher values may speed up reading multiple small files but increase memory usage."
93
+
-**Range**: 1-100 (slider control)
94
+
-**Default**: 5
84
95
85
96
### Batch Processing
86
-
- Read up to 100 files in a single request (configurable, default 15)
97
+
- Read up to 100 files in a single request (configurable, default 5)
87
98
- Parallel processing for improved performance
88
99
- Batch approval interface for user consent
89
100
@@ -104,8 +115,11 @@ When the [Concurrent File Reads](/features/concurrent-file-reads) experimental f
104
115
## Limitations
105
116
106
117
- May not handle extremely large files efficiently without using line range parameters
107
-
- For binary files (except PDF and DOCX), may return content that isn't human-readable
108
-
-**Multi-file mode**: Requires experimental feature to be enabled and may have stability issues
118
+
- For binary files (except PDF, DOCX, and supported image formats), may return content that isn't human-readable
119
+
-**Multi-file mode**: Requires `maxConcurrentFileReads` > 1 in settings
120
+
-**Image files**: Returns base64-encoded data URLs which may be large for high-resolution images
121
+
- Default max single image size: 20MB
122
+
- Default max total image size: 20MB
109
123
110
124
---
111
125
@@ -122,6 +136,7 @@ When the `read_file` tool is invoked, it follows this process:
122
136
- Adds line numbers to the content (e.g., "1 | const x = 13") where `1 |` is the line number.
123
137
- For truncated files, adds truncation notice and method definitions
124
138
- For special formats (PDF, DOCX), extracts readable text
139
+
- For image formats, returns base64-encoded data URLs with MIME type
125
140
126
141
---
127
142
@@ -146,8 +161,9 @@ The tool uses a clear decision hierarchy to determine how to read a file:
146
161
-**Special Case - Definitions Only Mode**: When `maxReadFileLine` is set to `0`, the tool returns only source code definitions without any file content.
147
162
148
163
3.**Default Behavior: Read Entire File**
149
-
- 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.
150
-
- For supported formats like PDF and DOCX, it attempts to extract the full text content.
164
+
- 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.
165
+
- For supported formats like PDF and DOCX, it attempts to extract the full text content.
166
+
- For image formats, it returns a base64-encoded data URL that can be displayed in the chat interface.
151
167
152
168
---
153
169
@@ -246,7 +262,7 @@ When `maxReadFileLine` is set to `0` in user settings, the tool returns only sou
246
262
method validateUser
247
263
method generateToken
248
264
</list_code_definition_names>
249
-
<notice>Showing only 0 of 150 total lines. Use start_line and end_line to read specific ranges.</notice>
265
+
<notice>Showing only 0 of 150 total lines. Use line_range if you need to read more lines</notice>
250
266
</file>
251
267
```
252
268
*(This mode provides a quick overview of file structure without reading content.)*
@@ -279,15 +295,122 @@ If the file is excluded by rules in a `.rooignore` file:
279
295
```
280
296
281
297
**Simulated Output (Error):**
298
+
```xml
299
+
<file>
300
+
<path>.env</path>
301
+
<error>Access denied by .rooignore rules</error>
302
+
</file>
303
+
```
304
+
305
+
---
306
+
307
+
## Image Reading Examples
308
+
309
+
The `read_file` tool now supports reading and displaying images directly in the chat interface. This enables powerful visual analysis workflows.
The image will be displayed directly in the chat interface, allowing Roo to analyze visual content.
331
+
332
+
### OCR Workflow Example
333
+
334
+
Reading multiple images from a folder for text extraction:
335
+
336
+
**Input:**
337
+
```xml
338
+
<read_file>
339
+
<args>
340
+
<file>
341
+
<path>screenshots/page1.png</path>
342
+
</file>
343
+
<file>
344
+
<path>screenshots/page2.png</path>
345
+
</file>
346
+
<file>
347
+
<path>screenshots/page3.png</path>
348
+
</file>
349
+
</args>
350
+
</read_file>
351
+
```
352
+
353
+
**Usage:**
282
354
```
283
-
Error: Access denied by .rooignore rules
355
+
Please extract all text from these screenshot images and compile them into a single markdown document.
284
356
```
285
357
358
+
### Design Review Workflow
359
+
360
+
Analyzing multiple design mockups:
361
+
362
+
**Input:**
363
+
```xml
364
+
<read_file>
365
+
<args>
366
+
<file>
367
+
<path>designs/homepage-v1.jpg</path>
368
+
</file>
369
+
<file>
370
+
<path>designs/homepage-v2.jpg</path>
371
+
</file>
372
+
<file>
373
+
<path>designs/mobile-view.png</path>
374
+
</file>
375
+
</args>
376
+
</read_file>
377
+
```
378
+
379
+
**Usage:**
380
+
```
381
+
Compare these design mockups and provide feedback on:
382
+
1. Visual consistency
383
+
2. Mobile responsiveness
384
+
3. Accessibility concerns
385
+
4. UI/UX improvements
386
+
```
387
+
388
+
### Supported Image Formats
389
+
390
+
The tool supports the following image formats:
391
+
-**PNG** - With dimension extraction
392
+
-**JPG/JPEG** - Standard and progressive
393
+
-**GIF** - Static and animated
394
+
-**WebP** - Modern web format
395
+
-**SVG** - Scalable vector graphics
396
+
-**BMP** - Bitmap images
397
+
-**ICO** - Icon files
398
+
-**TIFF** - Tagged image format
399
+
400
+
### Image Analysis Use Cases
401
+
402
+
1.**Documentation Screenshots**: Extract text and create documentation from UI screenshots
403
+
2.**Error Debugging**: Analyze error screenshots to understand issues
404
+
3.**Design Reviews**: Compare mockups and provide visual feedback
405
+
4.**Diagram Analysis**: Understand architecture diagrams and flowcharts
406
+
5.**Code Screenshots**: Extract code from images when text isn't available
407
+
6.**UI Testing**: Verify visual elements and layouts
408
+
286
409
---
287
410
288
-
## Multi-File Examples (Experimental)
411
+
## Multi-File Examples
289
412
290
-
When the [Concurrent File Reads](/features/concurrent-file-reads) experimental feature is enabled, you can read multiple files simultaneously using the enhanced XML format.
413
+
When `maxConcurrentFileReads` is set to a value greater than 1, you can read multiple files simultaneously using the enhanced XML format.
291
414
292
415
### Reading Multiple Complete Files
293
416
@@ -444,8 +567,29 @@ When requesting multiple files, you'll see a batch approval interface that allow
444
567
445
568
The interface displays each file path clearly, making it easy to understand what Roo wants to access before granting permission.
446
569
447
-
---
570
+
### Mixed Content Types
571
+
572
+
You can read different types of files in a single request:
573
+
574
+
**Input:**
575
+
```xml
576
+
<read_file>
577
+
<args>
578
+
<file>
579
+
<path>README.md</path>
580
+
</file>
581
+
<file>
582
+
<path>architecture-diagram.png</path>
583
+
</file>
584
+
<file>
585
+
<path>config.json</path>
586
+
</file>
587
+
<file>
588
+
<path>requirements.pdf</path>
589
+
</file>
590
+
</args>
591
+
</read_file>
592
+
```
448
593
449
-
## Backward Compatibility
594
+
This allows Roo to analyze documentation, visual diagrams, configuration, and specifications all in one context.
450
595
451
-
The enhanced multi-file format is fully backward compatible. Existing single-file requests using the `path` parameter continue to work exactly as before, regardless of whether the experimental feature is enabled or disabled.
0 commit comments