read_file | Read the complete contents of a file. Args:
path: Path to the file
encoding: File encoding (default: utf-8)
ctx: MCP context
Returns:
File contents as a string |
read_multiple_files | Read multiple files at once. Args:
paths: List of file paths to read
encoding: File encoding (default: utf-8)
ctx: MCP context
Returns:
Dictionary mapping file paths to contents or error messages |
write_file | Create a new file or overwrite an existing file with new content. Args:
path: Path to write to
content: Content to write
encoding: File encoding (default: utf-8)
create_dirs: Whether to create parent directories if they don't exist
ctx: MCP context
Returns:
Success or error message |
create_directory | Create a new directory or ensure a directory exists. Args:
path: Path to the directory
parents: Create parent directories if they don't exist
exist_ok: Don't raise an error if directory already exists
ctx: MCP context
Returns:
Success or error message |
list_directory | Get a detailed listing of files and directories in a path. Args:
path: Path to the directory
include_hidden: Whether to include hidden files (starting with .)
pattern: Optional glob pattern to filter entries
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Formatted directory listing |
move_file | Move or rename files and directories. Args:
source: Source path
destination: Destination path
overwrite: Whether to overwrite existing destination
ctx: MCP context
Returns:
Success or error message |
get_file_info | Retrieve detailed metadata about a file or directory. Args:
path: Path to the file or directory
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Formatted file information |
list_allowed_directories | Returns the list of directories that this server is allowed to access. Args:
ctx: MCP context
Returns:
List of allowed directories |
edit_file | Make line-based edits to a text file. Args:
path: Path to the file
edits: List of {oldText, newText} dictionaries
encoding: Text encoding (default: utf-8)
dry_run: If True, return diff but don't modify file
ctx: MCP context
Returns:
Git-style diff showing changes |
head_file | Read the first N lines of a text file. Args:
path: Path to the file
lines: Number of lines to read (default: 10)
encoding: Text encoding (default: utf-8)
ctx: MCP context
Returns:
First N lines of the file |
tail_file | Read the last N lines of a text file. Args:
path: Path to the file
lines: Number of lines to read (default: 10)
encoding: Text encoding (default: utf-8)
ctx: MCP context
Returns:
Last N lines of the file |
search_files | Recursively search for files and directories matching a pattern. Args:
path: Starting directory
pattern: Glob pattern to match against filenames
recursive: Whether to search subdirectories
exclude_patterns: Optional patterns to exclude
content_match: Optional text to search within files
max_results: Maximum number of results to return
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Search results |
directory_tree | Get a recursive tree view of files and directories. Args:
path: Root directory
max_depth: Maximum recursion depth
include_files: Whether to include files (not just directories)
pattern: Optional glob pattern to filter entries
exclude_patterns: Optional patterns to exclude
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Formatted directory tree |
calculate_directory_size | Calculate the total size of a directory recursively. Args:
path: Directory path
format: Output format ('human', 'bytes', or 'json')
ctx: MCP context
Returns:
Directory size information |
find_duplicate_files | Find duplicate files by comparing file sizes and contents. Args:
path: Starting directory
recursive: Whether to search subdirectories
min_size: Minimum file size to consider (bytes)
exclude_patterns: Optional patterns to exclude
max_files: Maximum number of files to scan
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Duplicate file information |
compare_files | Compare two text files and show differences. Args:
file1: First file path
file2: Second file path
encoding: Text encoding (default: utf-8)
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Comparison results |
find_large_files | Find files larger than the specified size. Args:
path: Starting directory
min_size_mb: Minimum file size in megabytes
recursive: Whether to search subdirectories
max_results: Maximum number of results to return
exclude_patterns: Optional patterns to exclude
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Large file information |
find_empty_directories | Find empty directories. Args:
path: Starting directory
recursive: Whether to search subdirectories
exclude_patterns: Optional patterns to exclude
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Empty directory information |
grep_files | Search for pattern in files, similar to grep. Args:
path: Starting directory or file path
pattern: Text or regex pattern to search for
is_regex: Whether to treat pattern as regex
case_sensitive: Whether search is case sensitive
whole_word: Match whole words only
include_patterns: Only include files matching these patterns
exclude_patterns: Exclude files matching these patterns
context_lines: Number of lines to show before AND after matches (like grep -C)
context_before: Number of lines to show BEFORE matches (like grep -B)
context_after: Number of lines to show AFTER matches (like grep -A)
results_offset: Start at Nth match (0-based, for pagination)
results_limit: Return at most this many matches (for pagination)
max_results: Maximum total matches to find during search
max_file_size_mb: Skip files larger than this size
recursive: Whether to search subdirectories
max_depth: Maximum directory depth to recurse
count_only: Only show match counts per file
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Search results |
read_file_lines | Read specific lines from a text file. Args:
path: Path to the file
offset: Line offset (0-based, starts at first line)
limit: Maximum number of lines to read (None for all remaining)
encoding: Text encoding (default: utf-8)
ctx: MCP context
Returns:
File content and metadata |
edit_file_at_line | Edit specific lines in a text file. Args:
path: Path to the file
line_edits: List of edits to apply. Each edit is a dict with:
- line_number: Line number to edit (0-based if relative_line_numbers=True, otherwise 1-based)
- action: "replace", "insert_before", "insert_after", "delete"
- content: New content for replace/insert operations (optional for delete)
- expected_content: (Optional) Expected content of the line being edited for verification
offset: Line offset (0-based) to start considering lines
limit: Maximum number of lines to consider
relative_line_numbers: Whether line numbers in edits are relative to offset
abort_on_verification_failure: Whether to abort all edits if any verification fails
encoding: Text encoding (default: utf-8)
dry_run: If True, returns what would be changed without modifying the file
ctx: MCP context
Returns:
Edit results summary |