search_content
Search large files for text patterns without loading full content. Find functions, errors, or log entries with support for fuzzy, regex, and case-insensitive matching.
Instructions
Search large files for text patterns without loading entire content into memory.
Use when finding functions, classes, errors, log entries, or counting
occurrences. Supports: fuzzy matching (handles typos/whitespace), regex
patterns, case-insensitive search, inverted matching (like grep -v), and
count-only mode. Returns ranked matches with line numbers and context
(lines truncated to 500 chars). When count_only=True, returns
{count, pattern, fuzzy_enabled, regex_enabled, case_sensitive, inverted}
instead of the full results structure.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| absolute_file_path | Yes | Absolute path to target file | |
| pattern | Yes | Text pattern to find (e.g., 'class User', 'ERROR', or regex like r'\d{3}-\d{4}') | |
| max_results | No | Maximum results to return (1-100) | |
| context_lines | No | Lines of context before/after each match | |
| fuzzy | No | Enable fuzzy matching to handle typos and whitespace differences (default: true) | |
| regex | No | Enable regex pattern matching (e.g., r'error.*timeout'). Disables fuzzy matching. | |
| case_sensitive | No | Match exact case when true (default: false for case-insensitive) | |
| invert | No | Return lines that do NOT match the pattern (like grep -v) | |
| count_only | No | Return only the match count, not content. Efficient for large files. |