List Drive Items
list_drive_itemsLists files and folders from Google Drive, including shared drives. Filter by type, order, or search shared drive containers.
Instructions
Lists files/folders or shared drive containers, supporting shared drives.
If drive_id is specified, lists items within that shared drive. folder_id is then relative to that drive (or use drive_id as folder_id for root).
If drive_id is not specified, lists items from user's "My Drive" and accessible shared drives (if include_items_from_all_drives is True).
Set resource_type to "shared_drives" to list shared drive containers instead of folder contents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | No | The user's Google email address. Required. | user@gmail.com |
| folder_id | No | The ID of the Google Drive folder. Defaults to 'root'. For a shared drive, this can be the shared drive's ID to list its root, or a folder ID within that shared drive. | root |
| page_size | No | The maximum number of items to return. Defaults to 100. | |
| page_token | No | Page token from a previous response's nextPageToken to retrieve the next page of results. | |
| drive_id | No | ID of the shared drive. If provided, the listing is scoped to this drive. | |
| include_items_from_all_drives | No | Whether items from all accessible shared drives should be included if `drive_id` is not set. Defaults to True. | |
| corpora | No | Corpus to query ('user', 'drive', 'allDrives'). If `drive_id` is set and `corpora` is None, 'drive' is used. If None and no `drive_id`, API defaults apply. | |
| file_type | No | Restrict results to a specific file type. Accepts a friendly name ('folder', 'document'/'doc', 'spreadsheet'/'sheet', 'presentation'/'slides', 'form', 'drawing', 'pdf', 'shortcut', 'script', 'site', 'jam'/'jamboard') or any raw MIME type string (e.g. 'application/pdf'). Defaults to None (all types). | |
| detailed | No | Whether to include size, modified time, and link in results. Defaults to True. | |
| order_by | No | Sort order. Comma-separated list of sort keys with optional 'desc' modifier. Valid keys: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', 'viewedByMeTime'. Example: 'modifiedTime desc' or 'folder,modifiedTime desc,name'. Defaults to None (Drive API default ordering). | |
| resource_type | No | What to list. Use "items" for folder contents or "shared_drives" for shared drive containers. Defaults to "items". | items |
| query | No | Shared drive query used only when resource_type="shared_drives", e.g. "name contains 'Engineering'". | |
| include_organizers | No | When resource_type="shared_drives", include principals with the organizer role. This costs one extra permissions.list API call per shared drive returned. Defaults to False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |