Share feedback
Answers are generated based on the documentation.

File Tool

Read, write, and edit individual files without exposing directory or search operations.

Overview

The file toolset is a focused subset of the filesystem toolset. It reuses the filesystem implementations and exposes only these tools:

ToolDescription
read_fileRead a whole file or a selected line range. Supports text and images.
write_fileCreate a file or completely overwrite an existing file.
edit_fileApply one or more exact text replacements to an existing file.

Use this toolset when an agent needs to work with known files but should not list directories, build directory trees, search file contents, or create and remove directories.

Configuration

toolsets:
  - type: file

The file toolset supports the filesystem toolset's path and editing options:

PropertyTypeDefaultDescription
post_editarray[]Commands to run after write_file or edit_file for matching paths.
allow_listarray[]Directories the tools may access. Empty means unrestricted.
deny_listarray[]Directories the tools must not access. Takes precedence over allow_list.

Paths resolve relative to the agent's working directory. Home-directory expansion, absolute paths, access controls, symlink protection, post-edit hooks, and .agentsignore handling behave exactly as documented for the filesystem toolset.

toolsets:
  - type: file
    allow_list:
      - "."
    deny_list:
      - ".env"
    post_edit:
      - path: "*.go"
        cmd: "gofmt -w ${file}"