listFolderContents
Lists files and subfolders in a Google Drive folder, with optional recursive traversal and pagination for large directories. Use 'root' to browse the top level.
Instructions
Lists files and subfolders within a Drive folder. Use folderId='root' to browse the top-level of the Drive. With depth omitted or 1, returns a single {folders, files, truncated, truncationReason?} page capped by maxResults; truncated reports when Drive has more pages. With depth 2 through 10 or 'all', returns a flat breadth-first {entries, count, truncated, truncationReason?, unreadable, apiCalls} tree; each entry has path and parentIds. A node is listed once, using its first-discovered BFS path, while parentIds preserves multiple discovered parent edges. Shortcuts include shortcutDetails.targetId but are never expanded. Recursive calls cap output with maxItems (default 500, maximum 5000), report every truncation, and use maxResults only for the single depth-1 page. Use getFilePath for the inverse, upward path lookup.
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": {
"folderId": "<folderId>"
},
"name": "listFolderContents"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | How many levels to list: 1 (default) through 10, or 'all'. | |
| folderId | Yes | ID of the folder to list contents of. Use "root" for the root Drive folder. | |
| maxItems | No | Hard cap across a recursive traversal. Defaults to 500; only valid when depth is greater than 1. | |
| maxResults | No | Maximum number of items to return at depth 1. Ignored for recursive traversal. | |
| includeFiles | No | Whether to include files in results. | |
| includeSubfolders | No | Whether to include subfolders in results. |