File Management Toolset
Generated byAIcreate_directory
Creates a new directory at the specified relative path. The operation is restricted to remain inside the current working directory.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
directory_path |
String | Yes | The relative path of the directory to create. |
Notes
- The tool ensures the directory is created within the current working directory.
- It supports creating nested directories using
Dir.mkdir_p.
delete_file
Deletes a specified file by moving it to a .deleted_files/ folder with a ms-resolution timestamp prepended to the filename. This allows for file recovery if deletion was accidental.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path |
String | Yes | The path of the file to be deleted. |
Notes
- The tool preserves the directory structure in the
.deleted_files/folder. - Timestamps are added to filenames for easy identification and recovery.
find_files
Finds files and directories in a directory hierarchy by matching a glob pattern.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path |
String | No | The starting point from where this tool looks for files and directories matching the path pattern. Defaults to "." if not specified. |
expression |
String | Yes | The glob pattern expression with which to find matching files. Supports wildcards *, globstars **, branching {a,n}, character ranges [a-z] and negated ranges [^a-z]. |
max |
Number | No | Optional, maximum number of matches to return (default is 1000). |
sort |
Boolean | No | Optional, set to false to disable sorting (default is true). |
Notes
- The tool ensures the operation is performed securely within the allowed directory.
- It supports glob patterns for flexible file matching.
- New in 0.9.12 Supports
maxas a per-file match cap when a single directory at a given level yields many glob matches.
rename_or_move_file
Renames a specified file to a new name within the current directory, including support for moving a file to a different path within the current directory.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
source_path |
String | Yes | The current path of the file to be renamed. |
target_path |
String | Yes | The new name/path for the file. |
Notes
- The tool ensures the operation is performed securely within the allowed directory.
- It supports moving files to different paths within the current directory.
search_files
Searches files for lines containing a match to the given search pattern. Returns matching lines with line numbers, per-file match counts, and metadata about files that were skipped.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
files |
String | Yes | A single file path, or a glob pattern expression with which to find matching files. |
pattern |
String | Yes | The text or pattern to search for in each file. |
pattern_is_regex. |
Boolean | No | Optional, set to true to indicate pattern is a regular expression (default is false). |
max_files |
Number | No | Optional, maximum number of files to search within (default is 1000). |
Notes
- The tool ensures the operation is performed securely within the allowed directory.
- It supports both plain text and regex search patterns.
- New in 0.9.12 Returns a structured result including
matches(an array of per-file objects withfile,matches, andtruncatedfields),files_searchedcount,skipped_filescount, andskipped_sample(up to 10 names of files that were not searched, e.g. binary files or files over 2 MiB). - If a file exceeds the default 50 matching lines per file, its entry is marked
truncated; narrow the pattern to see more.