Read & Write
read and write handle workspace file access. They are the most commonly used basic tools for code modification workflows and local automation.
read
read supports text and image files:
- text: reads by line, supports
offsetandlimit - images: supports
png,jpeg,gif,webp - large images: auto-resized when
tools.read.auto_resize_images=true
Default text truncation rules:
- up to
2000lines - up to
50KB
If the limit is reached, the result will include the offset to use for continued reading.
write
write writes text files with these capabilities:
path: target filecontent: text to writeappend: whentrue, appends instead of overwriting- auto-creates parent directories
Path resolution
- both tools resolve relative paths to their configured
cwd cwdcan be configured separately forreadandwrite- falls back to workspace path if not configured
Examples
Read first 200 lines:
{ "tool": "read", "path": "README.md", "limit": 200 }
Continue from line 201:
{ "tool": "read", "path": "README.md", "offset": 201, "limit": 200 }
Write to a file:
{
"tool": "write",
"path": "notes/plan.md",
"content": "# Plan\n\nShip the tool docs.\n"
}
Append content:
{
"tool": "write",
"path": "logs/run.txt",
"content": "done\n",
"append": true
}
Related
- Exec for generating or processing files