(private readonly config: Config)
| 540 | static readonly Name = 'search_file_content'; // Keep static name |
| 541 | |
| 542 | constructor(private readonly config: Config) { |
| 543 | super( |
| 544 | GrepTool.Name, |
| 545 | 'SearchText', |
| 546 | 'Searches for a regular expression pattern within the content of files in a specified directory (or current working directory). Can filter files by a glob pattern. Returns the lines containing matches, along with their file paths and line numbers.', |
| 547 | Kind.Search, |
| 548 | { |
| 549 | properties: { |
| 550 | pattern: { |
| 551 | description: |
| 552 | "The regular expression (regex) pattern to search for within file contents (e.g., 'function\\s+myFunction', 'import\\s+\\{.*\\}\\s+from\\s+.*').", |
| 553 | type: 'string', |
| 554 | }, |
| 555 | path: { |
| 556 | description: |
| 557 | 'Optional: The absolute path to the directory to search within. If omitted, searches the current working directory.', |
| 558 | type: 'string', |
| 559 | }, |
| 560 | include: { |
| 561 | description: |
| 562 | "Optional: A glob pattern to filter which files are searched (e.g., '*.js', '*.{ts,tsx}', 'src/**'). If omitted, searches all files (respecting potential global ignores).", |
| 563 | type: 'string', |
| 564 | }, |
| 565 | }, |
| 566 | required: ['pattern'], |
| 567 | type: 'object', |
| 568 | }, |
| 569 | ); |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * Checks if a path is within the root directory and resolves it. |
nothing calls this directly
no outgoing calls
no test coverage detected