List
listDisplay a directory's contents as a name tree, walking up to a chosen depth, so you can see what a folder holds.
Instructions
List a directory inside the roots as a name tree, walking up to maxDepth levels. Use when you need to see what a folder holds. Do not use it to find files by name or glob; use find_files instead, read or search_text for contents, stat for one path. Skips hidden entries, .gitignore matches, and build and tool folders unless includeHidden or includeIgnored is set, naming the ignore-rule folders it hid. At most 20,000 entries are kept. A timeout returns a partial result with stoppedReason. Errors: NOT_DIRECTORY for a file, ACCESS_DENIED outside the roots. Returns tree text, entries[{name, relativePath, type, size?}], totals, unexpandedDirectories, and skippedInaccessible. A cut result adds nextCursor (about 5 min) and resourceUri (about 60 s).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Directory to list (default: the only root; required with several roots) | |
| 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 | Order within each directory, after directories (size: largest file first; sizes appear only with includeSizes) | name |
| 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. | |
| maxDepth | No | Levels to walk; 1 = direct children. Directories at the limit are shown, not expanded. | |
| maxEntries | No | Entries per page; changing it keeps a cursor valid | |
| includeSizes | No | Show file sizes and a totals line in the tree (stats every file, slower on big trees) | |
| includeHidden | No | Include hidden items (starting with .) | |
| includeIgnored | No | Include .gitignore matches and build and tool folders (node_modules, .git, dist, build, out, tmp, coverage) |