Search Drive Files
search_drive_filesSearch Google Drive for files and folders, including shared drives, using query strings, file types, and ordering options to quickly locate the content you need.
Instructions
Searches for files and folders within a user's Google Drive, including shared drives.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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. | |
| 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. | |
| detailed | No | Whether to include size, modified time, and link in results. Defaults to True. | |
| drive_id | No | ID of the shared drive to search. If None, behavior depends on `corpora` and `include_items_from_all_drives`. | |
| 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). | |
| 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). | |
| 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. | |
| include_trashed | No | Whether to include files in the trash. Defaults to False, matching the Drive web UI and `list_drive_items`. Ignored when `query` already contains its own `trashed` clause (`=` or `!=`), which always wins. | |
| user_google_email | Yes | The user's Google email address. Required. | |
| 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`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |