Skip to content

File & Search Tools

Read, write, edit files and search code

The File & Search category includes 9 tools for reading, writing, and editing files, searching code, and working with structured data.

Read the contents of a file.

ParameterTypeRequiredDescription
pathstringYesThe path to the file to read

Write content to a file. Intelligently extracts stdout from shell_command output when used as input.

ParameterTypeRequiredDescription
file_pathstringYesFile path to write to
contentstringYesContent to write

Edit a file by finding and replacing text. Supports exact match or regex patterns.

ParameterTypeRequiredDescription
pathstringYesAbsolute path to the file
old_stringstringYesText to find (or regex pattern)
new_stringstringYesReplacement text
regexboolNoTreat old_string as regex (default: false)
replace_allboolNoReplace all occurrences (default: false)

Extract text from a PDF file or URL. Returns plain text with page markers.

ParameterTypeRequiredDescription
pathstringYesLocal file path or HTTP/HTTPS URL
max_pagesintNoMax pages to extract (default: all)
max_charsintNoMax characters to return (default: 100000)

Get a structured directory tree view as JSON.

ParameterTypeRequiredDescription
pathstringYesRoot directory to scan
max_depthintNoMax depth to traverse (default: 3)

Find files by name pattern using glob matching.

ParameterTypeRequiredDescription
patternstringYesGlob pattern (e.g., *.go, test_*.py)
search_pathstringNoDirectory to search from
max_resultsintNoMax results (default: 50)

Search for text patterns in files. Uses ripgrep when available for fast results.

ParameterTypeRequiredDescription
patternstringYesSearch pattern (literal string)
search_pathstringNoDirectory or file to search
include_globsstring[]NoFile patterns to include
case_sensitiveboolNoCase-sensitive search (default: false)
max_resultsintNoMax results (default: 50)

Parse a diff or patch and add line numbers to each change line. Useful for referencing specific lines in code reviews.

ParameterTypeRequiredDescription
diff_contentstringYesThe diff or patch content

Filter JSON data to include only specified fields. Supports dot notation for nested fields (e.g., user.name, items.price).

ParameterTypeRequiredDescription
json_datastringYesJSON string to filter
fields_to_extractstring[]YesFields to extract (dot notation for nested)