Expand description
Filesystem tools and session-scoped policies for agentkit.
This crate provides a set of tools that let an agent interact with the
local filesystem: reading, writing, replacing, moving, deleting files,
listing directories, and creating directories. All tools implement the
Tool trait and can be registered with a
ToolRegistry.
The crate also provides FileSystemToolResources and
FileSystemToolPolicy for enforcing session-scoped access rules such
as requiring a path to be read before it can be modified.
§Quick start
use agentkit_tool_fs::{registry, FileSystemToolPolicy, FileSystemToolResources};
// Get a registry with all seven filesystem tools.
let reg = registry();
assert_eq!(reg.specs().len(), 7);
// Optionally configure a policy to guard mutations.
let resources = FileSystemToolResources::new()
.with_policy(
FileSystemToolPolicy::new()
.require_read_before_write(true),
);Structs§
- Create
Directory Tool - Creates a directory and any missing parent directories.
- Delete
Tool - Deletes a file or directory.
- File
System Tool Policy - Policy governing session-scoped filesystem access rules.
- File
System Tool Resources - Session-scoped resource state for filesystem tools.
- List
Directory Tool - Lists entries in a directory.
- Move
Tool - Moves or renames a file or directory.
- Read
File Tool - Reads a UTF-8 text file, optionally limited to a 1-based inclusive line range.
- Replace
InFile Tool - Replaces exact text within a UTF-8 file.
- Write
File Tool - Writes UTF-8 text to a file, creating parent directories if needed.
Enums§
- File
System Tool Error - Errors specific to filesystem tool operations.
Functions§
- registry
- Creates a
ToolRegistrypre-populated with all filesystem tools.