1Read file contents. Use this instead of `cat`, `head`, or `tail` commands. **Only works on files, not directories.**
2
3<when_to_use>
4Use View when:
5- Reading any file before editing
6- Examining code, configs, logs, or data files
7- Checking file contents after changes
8- Viewing images (PNG, JPEG, GIF, WebP supported)
9
10Do NOT use View when:
11- **Listing directory contents → use `ls`** (View fails on directories)
12- Finding files by name → use `glob`
13- Searching file contents → use `grep`
14</when_to_use>
15
16<parameters>
17- file_path: Path to file (required)
18- offset: Start line, 0-based (optional, for large files)
19- limit: Number of lines (default 2000)
20</parameters>
21
22<output>
23- Lines prefixed with "L123:" line numbers
24- Treat "Lxxx:" as metadata, not actual code
25- Long lines (>2000 chars) truncated
26- Binary files show error (except images)
27</output>
28
29<limits>
30- Max file size: 5MB
31- Default: 2000 lines
32- Hidden files readable
33</limits>
34
35<tips>
36- Always view before editing to get exact whitespace
37- For large files, use offset to read specific sections
38- Use with grep: find files first, then view relevant ones
39- Suggests similar filenames if file not found
40</tips>