Read one source file
read_file
Reads one text file from a site's source code by its exact path.
Scopecode:readRead only
Like list_files, it reads the preview branch of the site repository rather than the running container, so just after a generation the content can still be the version from before the agent edited it. Take the path from list_files, and the answer carries the file's path, size and content.
Binary files and files larger than 200 KB are refused rather than truncated, so read a narrower file instead. A read that fails on GitHub's side returns an error, never empty content, and a path that is not in the site answers That file was not found in this site! See Read a file.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
path |
string | Yes | The exact file path, for example app/page.tsx. A leading slash is ignored. |