search_directory
Search for text patterns across all files in a directory, with options for file filtering, context lines, and fuzzy or regex matching. Automatically ignores common non-source directories.
Instructions
Search for a text pattern across all files in a directory.
Returns results grouped by file with line numbers and context. Use
include_pattern to filter by file extension (e.g. '*.py'). Automatically
ignores __pycache__, node_modules, and .git. Prefer fuzzy=False (default)
for multi-file search performance.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| absolute_dir_path | Yes | The absolute path to the directory to search. | |
| pattern | Yes | Text pattern to search for. | |
| include_pattern | No | fnmatch glob matched against file names (default: '*'). Examples: '*.py', '*.md', '*.ts'. | * |
| max_results | No | Total match cap across all files. Defaults to server config (100). | |
| context_lines | No | Lines of context before/after each match (default: 2). | |
| fuzzy | No | Enable fuzzy matching (default: false, expensive for many files). | |
| regex | No | Enable Python regex matching (default: false). | |
| case_sensitive | No | Case-sensitive search (default: false). | |
| invert | No | Return non-matching lines, like grep -v (default: false). | |
| include_hidden | No | Include dot-files and dot-dirs (default: false). |