Search Drive Files
search_drive_filesSearch for files and folders in Google Drive using query operators. Filter by file type, drive, and sort results to quickly locate needed items.
Instructions
Searches for files and folders within a user's Google Drive, including shared drives.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | The user's Google email address. Required. | |
| query | Yes | The search query string. Supports Google Drive search operators. NOTE: Owner-based queries ('user@example.com' in owners) DO NOT WORK in Shared Drives because files are owned by the shared drive itself, not individual users. For recent files by a specific user in Shared Drives, search by modifiedTime and use order_by='modifiedTime desc' instead. | |
| page_size | No | The maximum number of files to return. Defaults to 10. | |
| 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 to search. If None, behavior depends on `corpora` and `include_items_from_all_drives`. | |
| include_items_from_all_drives | No | Whether shared drive items should be included in results. Defaults to True. This is effective when not specifying a `drive_id`. | |
| corpora | No | Bodies of items to query (e.g., 'user', 'domain', 'drive', 'allDrives'). If 'drive_id' is specified and 'corpora' is None, it defaults to 'drive'. Otherwise, Drive API default behavior applies. Prefer 'user' or 'drive' over 'allDrives' for efficiency. | |
| 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). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |