Skip to main content

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

Pass absolute paths so file operations are predictable regardless of the working directory.
Check for existing files before write to avoid data loss.
Limit file operations to a known workspace so the agent can’t touch sensitive paths.

JSON

JSON files

CSV

CSV files

Shell

Shell commands