grep_regex
Search files or directories using regex patterns with options for case sensitivity, whole words, context display, file extensions, and result limits. Invert matches to exclude patterns.
Instructions
Search using a direct regex pattern
Input Schema
Name | Required | Description | Default |
---|---|---|---|
case_sensitive | No | Whether the search should be case sensitive | |
context_lines | No | Number of context lines to show before/after matches | |
file_extensions | No | Only search files with these extensions (e.g., ['js', 'ts']) | |
invert_match | No | Show lines that don't match the pattern | |
max_results | No | Maximum number of results to return | |
pattern | Yes | Regular expression pattern to search for | |
show_context | No | Show surrounding lines for context | |
target | Yes | File or directory path to search in | |
whole_words | No | Match whole words only |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"case_sensitive": {
"default": false,
"description": "Whether the search should be case sensitive",
"type": "boolean"
},
"context_lines": {
"default": 2,
"description": "Number of context lines to show before/after matches",
"type": "number"
},
"file_extensions": {
"description": "Only search files with these extensions (e.g., ['js', 'ts'])",
"items": {
"type": "string"
},
"type": "array"
},
"invert_match": {
"default": false,
"description": "Show lines that don't match the pattern",
"type": "boolean"
},
"max_results": {
"description": "Maximum number of results to return",
"type": "number"
},
"pattern": {
"description": "Regular expression pattern to search for",
"type": "string"
},
"show_context": {
"default": false,
"description": "Show surrounding lines for context",
"type": "boolean"
},
"target": {
"description": "File or directory path to search in",
"type": "string"
},
"whole_words": {
"default": false,
"description": "Match whole words only",
"type": "boolean"
}
},
"required": [
"pattern",
"target"
],
"type": "object"
}