Skip to content

Filesystem Tools

All filesystem tools enforce the configured scope boundary. Paths outside scope return SCOPE_VIOLATION.

read_file

Read a text file with optional line range.

InputTypeRequiredDescription
pathstringyesRelative path from scope root
startLinenumbernoFirst line to read (1-based)
endLinenumbernoLast line to read (1-based)

Output: { content, lines, truncated, encoding }

Errors: SCOPE_VIOLATION, FILESYSTEM_ERROR (file not found, binary file)


write_file

Write a file atomically (temp file + rename).

InputTypeRequiredDescription
pathstringyesRelative path from scope root
contentstringyesFile content to write
encodingstringnoEncoding (default: utf-8)
createDirsbooleannoCreate parent directories (default: false)

Output: { path, bytes }

Errors: SCOPE_VIOLATION, FILESYSTEM_ERROR


list_directory

List directory entries with optional recursion and glob filtering.

InputTypeRequiredDescription
pathstringyesRelative path from scope root
recursivebooleannoRecurse into subdirectories (default: false)
depthnumbernoMax recursion depth
globstringnoGlob pattern to filter entries
includeHiddenbooleannoInclude hidden files (default: false)

Output: { entries: [{ name, path, type, size }], total, truncated }

Capped at 5,000 entries.


search_files

Search for a pattern across files (ripgrep-style).

InputTypeRequiredDescription
patternstringyesSearch pattern (literal or regex)
pathstringnoDirectory to search (default: scope root)
regexbooleannoTreat pattern as regex (default: false)
caseSensitivebooleannoCase-sensitive search (default: true)
contextLinesnumbernoLines of context around matches
globstringnoGlob filter for files

Output: { matches: [{ file, line, content, context }], totalMatches, filesSearched }


get_file_info

Return file metadata.

InputTypeRequiredDescription
pathstringyesRelative path from scope root

Output: { name, path, type, size, modified, mime, lines, isSymlink, symlinkTarget }

Released under the MIT License.