Skip to main content

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 offset and limit
  • images: supports png, jpeg, gif, webp
  • large images: auto-resized when tools.read.auto_resize_images=true

Default text truncation rules:

  • up to 2000 lines
  • 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 file
  • content: text to write
  • append: when true, appends instead of overwriting
  • auto-creates parent directories

Path resolution

  • both tools resolve relative paths to their configured cwd
  • cwd can be configured separately for read and write
  • 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
}
  • Exec for generating or processing files