Find Files
find_filesSearch for files by name or path glob under a directory when you know the pattern but not the location. Optionally match directories or include hidden and ignored entries.
Instructions
Find files whose name or path matches a glob under a directory. Use when you know a name or path pattern but not the location. Do not use it for file contents; use search_text instead. To browse a folder, use list. Matches files; type: "directory" or "any" also matches directories. Skips hidden entries, .gitignore matches, and build folders unless includeHidden or includeIgnored. Scanning stops at 10,000 matches (stoppedReason maxResults) or the time limit (FS_TOOL_TIMEOUT_MS, default 5 s; stoppedReason timeout) and still returns what it found. path must be an existing directory; a file path is rejected. maxResults sizes a page, not the scan; page on with nextCursor. Returns root, results[{ path }], totalMatches, and filesScanned. When set, it adds nextCursor, stoppedReason, skippedInaccessible, excludedDirs (total and first 5), and resourceUri (all kept matches). Paths are relative to root when unambiguous, otherwise absolute.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>"
},
"name": "find_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Existing directory to search under. Required with several roots. Patterns with / match from here. | |
| type | No | What to match. Directory results end in /. | file |
| cursor | No | Opaque pagination cursor. Pass it unchanged for the next page. Pages come from one snapshot taken on the first call. It lasts 5 min past its last page; on refusal, retry without it. | |
| sortBy | No | name: by file name across folders, ties by path. Sorts the first 10,000 kept matches before paging. | path |
| exclude | No | Globs for entries to leave out, with everything under a matching folder. Without / a pattern matches a name at any depth (vendor, *.test.ts); with / it matches the path relative to path. | |
| pattern | Yes | Glob. Without / it matches file names at any depth (*.ts). With / it matches paths relative to path (src/**/*.ts). | |
| maxDepth | No | Max directory depth. 0 scans only the base directory. Omit for no limit. | |
| maxResults | No | Files per page; totalMatches counts all kept matches. | |
| includeHidden | No | Include hidden items (starting with .) | |
| includeIgnored | No | Include ignored items (node_modules, .git, etc). |