Skip to main content

File System Tools

Category: filesystem · 18 tools

Read, write, search, and manage files and directories.

Core Operations

ToolParametersDescription
fs.read_filepath, encoding?Read file contents
fs.write_filepath, content, encoding?Write content to file (creates parent dirs)
fs.append_filepath, content, encoding?Append content to file
fs.delete_filepathDelete a file
fs.delete_dirpath, force?Delete a directory recursively
fs.existspathCheck if file or directory exists
fs.statpathGet file info (size, modified date, type)
fs.list_dirpath, recursive?List files and directories
fs.create_dirpath, recursive?Create a directory
fs.movepath, new_pathMove or rename file/directory
fs.copypath, new_pathCopy file or directory

Advanced Operations

ToolParametersDescription
fs.read_file_rangepath, start_line, end_lineRead specific line range
fs.searchpath, query, recursive?Search for text in files
fs.replace_in_filepath, search, replaceFind and replace text
fs.globpattern, cwd?Find files matching glob pattern
fs.treepath, depth?Get directory tree representation

Batch Operations

ToolParametersDescription
fs.batch_readpaths, encoding?, continueOnError?Read multiple files at once
fs.batch_writefiles, encoding?, atomic?, createDirs?Write multiple files atomically

Examples

Reading Files

// AI automatically uses fs.read_file
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Show me the contents of package.json' }],
model: 'gpt-4o',
});

Searching Code

// AI uses fs.search or fs.glob
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Find all files that import React' }],
model: 'gpt-4o',
});

Batch Operations

// AI uses fs.batch_read for efficiency
const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Read all the config files in this project' }],
model: 'gpt-4o',
});