(private config: Config)
| 170 | static readonly Name: string = 'read_file'; |
| 171 | |
| 172 | constructor(private config: Config) { |
| 173 | super( |
| 174 | ReadFileTool.Name, |
| 175 | 'ReadFile', |
| 176 | `Reads and returns the content of a specified file. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images (PNG, JPG, GIF, WEBP, SVG, BMP), and PDF files. For text files, it can read specific line ranges.`, |
| 177 | Kind.Read, |
| 178 | { |
| 179 | properties: { |
| 180 | absolute_path: { |
| 181 | description: |
| 182 | "The absolute path to the file to read (e.g., '/home/user/project/file.txt'). Relative paths are not supported. You must provide an absolute path.", |
| 183 | type: 'string', |
| 184 | }, |
| 185 | offset: { |
| 186 | description: |
| 187 | "Optional: For text files, the 0-based line number to start reading from. Requires 'limit' to be set. Use for paginating through large files.", |
| 188 | type: 'number', |
| 189 | }, |
| 190 | limit: { |
| 191 | description: |
| 192 | "Optional: For text files, maximum number of lines to read. Use with 'offset' to paginate through large files. If omitted, reads the entire file (if feasible, up to a default limit).", |
| 193 | type: 'number', |
| 194 | }, |
| 195 | }, |
| 196 | required: ['absolute_path'], |
| 197 | type: 'object', |
| 198 | }, |
| 199 | ); |
| 200 | } |
| 201 | |
| 202 | protected override validateToolParams( |
| 203 | params: ReadFileToolParams, |
nothing calls this directly
no outgoing calls
no test coverage detected