Search Files
file_searchSearch a directory tree for files and folders by glob name pattern or content regex; optionally use Spotlight (mdfind) for faster results.
Instructions
Recursively search a directory for files/directories matching a glob name pattern (*/? wildcards) and/or a content regex (text files only, size-capped). Set useMdfind:true to accelerate via Spotlight (mdfind -onlyin, requires an mdfindQuery) instead of walking the tree. Path is checked against MACCTL_ALLOWED_PATHS/MACCTL_DENIED_PATHS. Results are capped.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Root directory to search. | |
| maxDepth | No | Defaults to 10. | |
| useMdfind | No | Use `mdfind -onlyin <path> <mdfindQuery>` instead of a manual walk. | |
| maxResults | No | Defaults to 200. | |
| mdfindQuery | No | Required when useMdfind is true, e.g. "kMDItemFSName == '*.pdf'". | |
| namePattern | No | Glob pattern against entry names, e.g. "*.ts". | |
| contentPattern | No | A regular expression tested against file contents (utf8, size-capped). |