Search File Contents
search_contentSearch files in a directory for a case-sensitive substring. Returns matching lines with two lines of context; supports file pattern and result limit.
Instructions
Grep-like search: find a text query across files in a directory, returning matching lines with 2 lines of context before/after.
Args:
directory (string): Base directory to search within.
query (string): Text to search for (case-sensitive, literal substring match).
file_pattern (string, optional): Glob to limit which files are searched (e.g. "**/*.js"). Default: all files.
max_results (number, optional): Cap on returned matches. Default: 50.
Returns: matching lines with file path, line number, and surrounding context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Text to search for (literal substring, case-sensitive) | |
| directory | Yes | Base directory to search within | |
| max_results | No | Maximum matches to return | |
| file_pattern | No | Glob to limit searched files, e.g. "**/*.js" |