search_content
Search large files for text patterns without loading entire content into memory. Find functions, classes, errors, log entries, or count matches with regex and fuzzy options.
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. Regex and fuzzy are mutually exclusive: regex=true
disables fuzzy automatically (explicit fuzzy=true yields a warning in
the response). 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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"absolute_file_path": "<absolute_file_path>",
"pattern": "<pattern>"
},
"name": "search_content"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fuzzy | No | Enable fuzzy matching to handle typos and whitespace differences. Omit (null) for auto: fuzzy on for text search, off for regex. Explicit true together with regex=true is ignored and a warning is returned. | |
| regex | No | Enable regex pattern matching (e.g., r'error.*timeout'). Disables fuzzy matching. | |
| invert | No | Return lines that do NOT match the pattern (like grep -v) | |
| pattern | Yes | Text pattern to find (e.g., 'class User', 'ERROR', or regex like r'\d{3}-\d{4}') | |
| count_only | No | Return only the match count, not content. Efficient for large files. | |
| max_results | No | Maximum results to return (1-500) | |
| context_lines | No | Lines of context before/after each match | |
| case_sensitive | No | Match exact case when true (default: false for case-insensitive) | |
| absolute_file_path | Yes | Absolute path to target file |