Skip to content

file_read

Gate: ungated · belongs to file · read

Read a text file from the workspace. This tool never calls the gate — reading inside a folder the workspace owns changes nothing and reaches nothing outside it. Confinement is what protects you here, not a prompt: the path is resolved against the workspace root first, and a path that escapes is a hard error. See the file kind.

Input

FieldTypeRequiredNotes
pathstringyesWorkspace-relative path, e.g. notes/todo.md.

Output

The file's contents as text, capped at 1 MiB. A larger file is truncated at that cap rather than refused.

From JavaScript

const text = await nocturn.fs.readFile("notes/todo.md");

Notes

The node-ish shim works too: require("fs").readFileSync("notes/todo.md") routes to the same tool.