|
| 1 | +const DEFAULT_LINE_LIMIT = 2000 |
| 2 | +const MAX_LINE_LENGTH = 2000 |
| 3 | + |
| 4 | +const descriptionForAgent = `Reads a file from the local filesystem. You can access any file directly by using this tool. |
| 5 | +Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned. |
| 6 | +
|
| 7 | +Usage: |
| 8 | +- The file_path parameter must be an absolute path, not a relative path |
| 9 | +- By default, it reads up to ${DEFAULT_LINE_LIMIT} lines starting from the beginning of the file |
| 10 | +- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters |
| 11 | +- Any lines longer than ${MAX_LINE_LENGTH} characters will be truncated |
| 12 | +- Results are returned using cat -n format, with line numbers starting at 1 |
| 13 | +- This tool allows Cline to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as Cline is a multimodal LLM. |
| 14 | +- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. |
| 15 | +- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/Temporary_Screenshots/2026-09-08/Screenshot.png |
| 16 | +- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.` |
| 17 | + |
| 18 | +export const readToolDefinition = { |
| 19 | + name: "Read", |
| 20 | + descriptionForAgent: descriptionForAgent, |
| 21 | + inputSchema: { |
| 22 | + type: "object", |
| 23 | + properties: { |
| 24 | + file_path: { |
| 25 | + type: "string", |
| 26 | + description: "The absolute path to the file to read", |
| 27 | + }, |
| 28 | + offset: { |
| 29 | + type: "number", |
| 30 | + description: "The line number to start reading from. Only provide if the file is too large to read at once", |
| 31 | + optional: true, |
| 32 | + }, |
| 33 | + limit: { |
| 34 | + type: "number", |
| 35 | + description: "The number of lines to read. Only provide if the file is too large to read at once.", |
| 36 | + optional: true, |
| 37 | + }, |
| 38 | + }, |
| 39 | + required: ["file_path"], |
| 40 | + }, |
| 41 | +} |
0 commit comments