Skip to main content
File operation tools allow agents to interact with the filesystem safely within the workspace boundary.

Available Tools

file_read

Read file contents

file_write

Write or create files

file_list

List directory contents

file_search

Search file contents with regex

file_read

Read the contents of a file within the workspace.

Parameters

path
string
required
Relative or absolute path to the file. Must be within workspace.

Example

{
  "path": "src/main.rs"
}

Response

Returns file contents as a string. Binary files are base64-encoded.

file_write

Write content to a file, creating it if it doesn’t exist.

Parameters

path
string
required
Relative or absolute path to the file. Must be within workspace.
content
string
required
Content to write to the file

Example

{
  "path": "output.txt",
  "content": "Hello, ZeroClaw!"
}

Response

Returns success confirmation with file path.

file_list

List files and directories within a path.

Parameters

path
string
Directory path (defaults to workspace root)
recursive
boolean
List recursively (default: false)

Example

{
  "path": "src",
  "recursive": true
}

Response

Returns list of files with metadata (name, size, type, modified time). Search for text patterns in files using regex.

Parameters

pattern
string
required
Regular expression pattern to search for
path
string
Directory to search (defaults to workspace root)
file_pattern
string
Glob pattern to filter files (e.g., “*.rs”)

Example

{
  "pattern": "fn main",
  "file_pattern": "*.rs"
}

Response

Returns matches with file path, line number, and matching text.

Security

All file operations are scoped to the workspace directory. Attempts to access files outside the workspace are blocked.

Path Validation

  • Resolves symlinks and checks canonical paths
  • Blocks .. traversal outside workspace
  • Rejects absolute paths outside workspace
  • Prevents access to sensitive system files

File Size Limits

  • Read: 10MB maximum file size
  • Write: 10MB maximum content size
  • List: 10,000 file maximum per directory

Configuration

[security]
file_read_enabled = true
file_write_enabled = true
max_file_size_mb = 10
workspace_path = "/home/user/agent-workspace"

Source Code

Build docs developers (and LLMs) love