Overview
File tool allows you to read, write, and manage files from your AI agents. The user asks to read or write a file; the agent performs the operation and returns the result.Installation
Quick Start
1
Simple Usage
2
With Configuration
Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.
Usage with Agent
Available Methods
read(path)
Read file contents.write(path, content)
Write content to a file.list_dir(path)
List directory contents.Common Errors
How It Works
Best Practices
Use absolute paths
Use absolute paths
Pass absolute paths so file operations are predictable regardless of the working directory.
Confirm before overwriting
Confirm before overwriting
Check for existing files before
write to avoid data loss.Restrict to a safe directory
Restrict to a safe directory
Limit file operations to a known workspace so the agent can’t touch sensitive paths.
Related Tools
JSON
JSON files
CSV
CSV files
Shell
Shell commands

