Read file
read_fileRead a text file from a repository, optionally a line range, and from the working tree or a specific commit to compare before/after changes.
Instructions
Read a text file from the repository, optionally a line range, either from the working tree or at a specific commit (ref). Use ref to compare a file before and after a change. Output is capped; if truncated is true, request a later startLine.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Commit, branch or tag to read from. Omit to read the working tree. | |
| path | Yes | Repo-relative path, e.g. `src/index.ts`. | |
| endLine | No | Last line to return (inclusive). | |
| startLine | No | First line to return (1-based). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | Resolved commit SHA, or null for the working tree. | |
| path | Yes | ||
| content | Yes | ||
| endLine | Yes | Last line actually returned. | |
| isBinary | Yes | ||
| startLine | Yes | ||
| truncated | Yes | ||
| totalLines | Yes |