Skip to main content

Crate agentkit_tool_fs

Crate agentkit_tool_fs 

Source
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§

CreateDirectoryTool
Creates a directory and any missing parent directories.
DeleteTool
Deletes a file or directory.
FileSystemToolPolicy
Policy governing session-scoped filesystem access rules.
FileSystemToolResources
Session-scoped resource state for filesystem tools.
ListDirectoryTool
Lists entries in a directory.
MoveTool
Moves or renames a file or directory.
ReadFileTool
Reads a UTF-8 text file, optionally limited to a 1-based inclusive line range.
ReplaceInFileTool
Replaces exact text within a UTF-8 file.
WriteFileTool
Writes UTF-8 text to a file, creating parent directories if needed.

Enums§

FileSystemToolError
Errors specific to filesystem tool operations.

Functions§

registry
Creates a ToolRegistry pre-populated with all filesystem tools.