Skip to content

text-read

Read a text file or directory listing from the local filesystem.

Category: Read-only

Parameters

filePath (required)
Absolute path to the file or directory to read.
offset (required)
1-indexed line number to start reading from. Use 1 to start from the beginning. Pass a larger value to continue reading past a previous result.
limit (optional)
Maximum number of lines to return. Defaults to 2000.

File output

Lines are returned with line-number prefixes:

1: package com.example
2:
3: fun main() {
4:     println("Hello")
5: }

A footer is appended describing the result:

  • End of file: (End of file - total N lines)
  • More lines available: (Showing lines M-N. Use offset=N+1 to continue.)
  • Byte limit reached: (Output capped at 50 KB. Showing lines M-N. Use offset=N+1 to continue.)

Limits: At most 2000 lines and 50 KB per call. Lines longer than 2000 characters are truncated. Binary files (detected by extension or content sampling) are rejected.

Directory output

When filePath points to a directory, returns one entry per line with a trailing / for subdirectories, sorted alphabetically. The same offset/limit parameters apply to the entry list.

Suggestions on error

If a path is not found, the tool checks the parent directory for similarly named entries and includes them in the error message as suggestions.