Read
Read a file from the workspace and return its content as cat -n-style numbered lines.
Schema
Section titled “Schema”| Param | Type | Required | Default | Notes |
|---|---|---|---|---|
file_path | string | yes | — | Absolute or workspace-relative path. |
offset | number | no | 1 | 1-based line to start reading at. |
limit | number | no | 2000 | Maximum lines to return. |
Behaviour
Section titled “Behaviour”- Path goes through
Workspace.Resolvefirst. Any path that resolves outside the workspace is rejected. - Output format:
LINENO\tCONTENT\nper line — standardcat -nshape. - On success, the path is recorded in the session’s read-tracker. This is the gate that
Editand overwritingWritecheck. - If the target doesn’t exist or is a directory, returns an error result.
- If
offsetexceeds total line count, returns an error result.
Example response
Section titled “Example response”1 package main23 import "fmt"45 func main() { fmt.Println("hello") }Limits
Section titled “Limits”- Single lines must be ≤ 1 MiB (bufio.Scanner token cap). Minified JS/CSS with no newlines beyond that limit returns
bufio.Scanner: token too long. - Binary files with embedded NULs are not specifically detected — the scanner splits on
\nand garbage may be emitted. Read is intended for text. - Offsets < 1 are treated as 1.