Expand description
Filesystem tools for the tcode tool registry.
Why: AI coding loops (e.g. the ai-coding-bake-off L1 agentic loop) need the
agent to create, read, and patch files on the host filesystem. Providing typed
ToolExecutor implementations instead of raw shell-exec keeps error handling
structured, scoping to a working directory enforced, and path traversal
impossible.
What: ToolExecutor impls for the engineer’s filesystem surface —
ReadFileTool, WriteFileTool, EditTool, plus the batch-write and
exploration tools WriteFilesTool (#2681), GlobTool, GrepTool, and
ListDirTool (#1027) — each with an OpenAI-function-call schema and
registration helpers. EditTool (#2068) supports three edit wire formats —
SEARCH/REPLACE, unified-diff, and whole-file — selected per-model via
edit_format. The exploration tools give the engineer native file discovery
so it no longer shells out to find/grep/ls (the dominant bake-off
agent-turn sink). Errors use thiserror for clean structured error types.
Test: read.rs, write.rs, write_files.rs, glob.rs, grep.rs,
list_dir.rs, and edit.rs each carry tempdir-based unit tests;
edit_format carries its own matrix/application tests; registry_tests
verifies the tools appear in schemas() and dispatch through
dispatch_gated.
Re-exports§
pub use edit::EditTool;pub use glob::GlobTool;pub use grep::GrepTool;pub use list_dir::ListDirTool;pub use read::ReadFileTool;pub use write::WriteFileTool;pub use write_files::WRITE_FILES_TOOL_NAME;pub use write_files::WriteFilesTool;
Modules§
- edit
edittool — per-model edit-format selection (#2068).- edit_
format - Per-model edit-format selection for the
edittool (#2068, P1B-1). - glob
globtool — find files by glob pattern (e.g.**/*.py,src/*.rs).- grep
greptool — search file contents by regex across the project.- list_
dir list_dirtool — list the entries of a single directory.- read
read_filetool — read file contents, optionally limited to a line range.- write
write_filetool — create or overwrite a file, creating parent dirs as needed.- write_
files write_filestool — create or overwrite MANY files in a single call.
Enums§
- FsError
- Errors produced by filesystem tools.