search_files
Search for files recursively in a specified directory using a glob-style name pattern. Excludes files based on optional patterns and respects .gitignore rules. Ideal for locating files within restricted directory roots.
Instructions
Search for files by name pattern in a directory recursively.
Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Glob-style pattern to match file names (e.g., '.py', 'test_') exclude (str, optional): Glob-style pattern to exclude file names
Returns: List[str] | str: List of matching absolute file paths, or error message if failed
Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Respects .gitignore files, and ignores hidden files and folders - Returns list for successful searches, string for errors
Input Schema
Name | Required | Description | Default |
---|---|---|---|
dir | Yes | ||
exclude | No | ||
pattern | Yes |