Skip to content

files.read

Schema

Input = {
path: string,
maxChars?: number, // 100-2000000, default 200000
base64?: boolean, // default false — force base64 even for text
startLine?: number, // 1-based
endLine?: number,
}
Output = {
path: string,
mime: string,
encoding: 'utf8' | 'base64',
content: string,
size: number,
truncated: boolean,
lines?: number, // total line count, for text files
}

Binary detection is automatic: if base64 isn’t requested, the skill still switches to base64 encoding when the file’s extension doesn’t look textual and a byte-level sniff of the buffer thinks it’s binary. When startLine/endLine are given, only that slice of the file is returned (and still counted against maxChars) — useful for an agent reading one section of a long generated file without pulling the whole thing into context.

Example

Terminal window
curl -s -X POST http://localhost:4000/api/studio/skills/invoke \
-H 'content-type: application/json' -b cookies.txt \
-d '{"name":"files.read","input":{"path":"research/briefing.md","maxChars":2000}}'
{
"ok": true,
"output": {
"path": "research/briefing.md",
"mime": "text/markdown",
"encoding": "utf8",
"content": "# Research briefing\n\n...",
"size": 4821,
"truncated": false,
"lines": 96
}
}

Used everywhere a task needs a dependency’s earlier output as a real file, not just the truncated inline preview the runner already provides in-context.