| name | read-file |
| description | Read the contents of a file at a specified path. Supports text files with encoding detection. This skill should be used when the user wants to view, inspect, or read the contents of an existing file. |
Read File
Read the contents of a file and return the text output.
Usage
To read a file, execute the bundled script with the target file path:
python scripts/read_file.py <file_path>
Parameters
| Parameter | Type | Required | Description |
|---|
| file_path | string | Yes | Absolute or relative path to the file |
Behavior
- Attempts to read the file with UTF-8 encoding first, falls back to GBK if needed
- Returns the full file contents as a string
- Returns an error message if the file does not exist or cannot be read
- For large files (>10000 characters), only the first 10000 characters are returned with a truncation notice
Notes
- Always use absolute paths when possible to avoid ambiguity
- Binary files will return an error suggesting they cannot be read as text