Search Drive Files
search_drive_filesSearch Google Drive files and folders, including shared drives, using query operators. Filter by file type, owner, or date and sort results to locate documents quickly.
Instructions
Searches for files and folders within a user's Google Drive, including shared drives.
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": {
"user_google_email": "<user_google_email>",
"query": "<query>"
},
"name": "search_drive_files"
}
}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 it defaults to 'allDrives' when `include_items_from_all_drives` is True. Pass 'user' to search only My Drive and files shared with the user. | |
| 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 |