search_in_file
Find text patterns in specific files using regex search with context lines and case sensitivity options to locate code sections and content efficiently.
Instructions
Search for patterns within a specific file using ripgrep. Like Ctrl+F but with regex support. Useful for finding specific sections in a known file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path to search within | |
| pattern | Yes | Regex pattern to search for | |
| caseInsensitive | No | Ignore case in search. Default: true | |
| contextLines | No | Lines of context before/after match | |
| literalString | No | Treat pattern as literal string, not regex | |
| wordBoundary | No | Match whole words only |
Input Schema (JSON Schema)
{
"properties": {
"caseInsensitive": {
"default": true,
"description": "Ignore case in search. Default: true",
"type": "boolean"
},
"contextLines": {
"default": 3,
"description": "Lines of context before/after match",
"type": "number"
},
"literalString": {
"default": false,
"description": "Treat pattern as literal string, not regex",
"type": "boolean"
},
"path": {
"description": "File path to search within",
"type": "string"
},
"pattern": {
"description": "Regex pattern to search for",
"type": "string"
},
"wordBoundary": {
"default": false,
"description": "Match whole words only",
"type": "boolean"
}
},
"required": [
"path",
"pattern"
],
"type": "object"
}