Read Workspace file
read_workspace_fileRead UTF-8 files or list directory entries from any saved Workspace revision without starting a run or modifying files.
Instructions
Read a file or list a directory in a saved revision of a Workspace: the Workspace's current_revision, a worker's saved_revision_id, or a changeset's base_revision, incoming_revision or result_revision. A file returns its UTF-8 text, up to 262144 bytes; a larger file is refused, and a binary file is refused with 415. A directory returns its entries one page at a time. No run starts and nothing changes.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"workspace_id": "<workspace_id>",
"path": "<path>"
},
"name": "read_workspace_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The file or directory path, relative to the Workspace root, for example src/main.go or / for the root. | |
| cursor | No | For a directory: next_cursor from the previous page. | |
| revision_id | No | The saved revision to read. Omitted, the Workspace's current revision. | |
| workspace_id | Yes | The Workspace UUID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | file or dir. | |
| path | Yes | The path that was read. | |
| size | No | The file's size in bytes. | |
| text | No | The file's UTF-8 text, for a file. | |
| entries | No | The directory's entries, for a directory. | |
| next_cursor | No | For a directory with more entries: pass it back as cursor to read the next page. | |
| revision_id | Yes | The saved revision that was read. | |
| workspace_id | Yes | The Workspace UUID. |