search_drive_files
Find files and folders in Google Drive and shared drives using search queries, filters, and pagination. Locate specific documents by type or drive to retrieve relevant results quickly.
Instructions
Searches for files and folders within a user's Google Drive, including shared drives.
Args:
user_google_email (str): The user's Google email address. Required.
query (str): The search query string. Supports Google Drive search operators.
page_size (int): The maximum number of files to return. Defaults to 10.
page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
drive_id (Optional[str]): ID of the shared drive to search. If None, behavior depends on corpora and include_items_from_all_drives.
include_items_from_all_drives (bool): Whether shared drive items should be included in results. Defaults to True. This is effective when not specifying a drive_id.
corpora (Optional[str]): 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 (Optional[str]): 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 (bool): Whether to include size, modified time, and link in results. Defaults to True.
Returns: str: A formatted list of found files/folders with their details (ID, name, type, and optionally size, modified time, link). Includes a nextPageToken line when more results are available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| corpora | No | ||
| detailed | No | ||
| drive_id | No | ||
| file_type | No | ||
| page_size | No | ||
| page_token | No | ||
| user_google_email | Yes | ||
| include_items_from_all_drives | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |