search_directory
Search for regex patterns in files within a specified directory, including optional recursive search, line context, and file inclusion/exclusion filters. Use to locate matches efficiently across multiple files.
Instructions
Search for regex patterns across all files in a directory.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
directory_path | Yes | Absolute path to the directory to search | |
exclude | No | Glob pattern for files/directories to exclude | |
include | No | Glob pattern for files to include (e.g., "*.ts", "*.js") | |
lines_after | No | Number of lines to show after each match | |
lines_before | No | Number of lines to show before each match | |
recursive | No | Search recursively in subdirectories | |
regexp | Yes | Regular expression pattern to search for |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"directory_path": {
"description": "Absolute path to the directory to search",
"type": "string"
},
"exclude": {
"description": "Glob pattern for files/directories to exclude",
"type": "string"
},
"include": {
"description": "Glob pattern for files to include (e.g., \"*.ts\", \"*.js\")",
"type": "string"
},
"lines_after": {
"description": "Number of lines to show after each match",
"minimum": 0,
"type": "integer"
},
"lines_before": {
"description": "Number of lines to show before each match",
"minimum": 0,
"type": "integer"
},
"recursive": {
"default": false,
"description": "Search recursively in subdirectories",
"type": "boolean"
},
"regexp": {
"description": "Regular expression pattern to search for",
"type": "string"
}
},
"required": [
"directory_path",
"regexp"
],
"type": "object"
}