search_files
Search files for patterns with regex, file type filtering, size constraints, and date filters. Exclude comments or string literals for cleaner code searches. Results can be formatted as text, JSON, or structured output with configurable sorting and grouping options.
Instructions
Advanced file and code search tool with comprehensive filtering and matching capabilities. Searches for patterns in files within allowed directories with support for regex patterns, file type filtering, size constraints, date filtering, and content preprocessing. When called without arguments, searches for common patterns in the current directory. Supports excluding comments and string literals for cleaner code searches. Results can be formatted as text, JSON, or structured output with configurable sorting and grouping options.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
caseSensitive | No | Whether search should be case sensitive | |
excludeComments | No | Whether to exclude comments from search (language-aware) | |
excludeExtensions | No | Array of file extensions to exclude | |
excludePatterns | No | Array of filename patterns to exclude (supports simple wildcards) | |
excludeStrings | No | Whether to exclude string literals from search | |
extensions | No | Array of file extensions to include (e.g., ['.js', '.ts', '.py']). Include the dot prefix | |
followSymlinks | No | Whether to follow symbolic links | |
groupByFile | No | Whether to group results by file | |
includeBinary | No | Whether to search in binary files | |
maxDepth | No | Maximum directory recursion depth. Unlimited if not specified | |
maxResults | No | Maximum number of match results to return | |
maxSize | No | Maximum file size in bytes | |
minSize | No | Minimum file size in bytes | |
modifiedAfter | No | Only include files modified after this date (ISO 8601 format) | |
modifiedBefore | No | Only include files modified before this date (ISO 8601 format) | |
multiline | No | Whether to enable multiline regex matching | |
outputFormat | No | Output format for results | text |
pattern | No | Search pattern - can be literal text or regex depending on regexMode. Defaults to searching for common file types if not specified | .* |
regexMode | No | Whether to treat pattern as a regular expression | |
searchPath | No | Directory path to search in. Must be within allowed directories. Defaults to first allowed directory if not specified | |
snippetLength | No | Length of text snippet around matches | |
sortBy | No | How to sort the results | relevance |
wordBoundary | No | Whether to match whole words only |