Google Drive
SDK reference for google drive operations
Overview
Google Drive file storage and management
- Category:
storage - Auth Required: Yes
- Supported Modes: standard, delegated
Operations
listFiles
List files in Google Drive
Arguments:
query(string, optional): Search query (Google Drive query syntax)pageSize(number, optional): Maximum number of files to return (default: 20)
Returns:
AdapterOperationResult - List of normalized files with count, query, and files array
Response Fields:
| Field | Type | Description |
|---|---|---|
count | number | Number of files returned |
query | string | Search query used (optional) |
files | GoogleDriveFileSummary[] | Array of file summaries |
files item fields (GoogleDriveFileSummary)
| Field | Type | Description |
|---|---|---|
id | string | File ID |
name | string | File name |
mimeType | string | MIME type |
mimeTypeReadable | string | Human-readable file type |
createdAt | string | ISO 8601 creation date |
modifiedAt | string | ISO 8601 modification date |
isFolder | boolean | Whether this is a folder |
Example:
createFile
Create a new file in Google Drive
Arguments:
name(string, required): Name of the filemimeType(string, required): MIME type of the filefolderId(string, optional): Parent folder ID (optional)
Returns:
AdapterOperationResult - Created file information
Response Fields:
| Field | Type | Description |
|---|---|---|
fileId | string | Created file ID |
name | string | File name |
mimeType | string | MIME type |
webViewLink | string | Web view URL (optional) |
Example:
createFolder
Create a new folder in Google Drive
Arguments:
name(string, required): Name of the folderparentFolderId(string, optional): Parent folder ID (optional)
Returns:
AdapterOperationResult - Created folder information
Response Fields:
| Field | Type | Description |
|---|---|---|
folderId | string | Created folder ID |
name | string | Folder name |
webViewLink | string | Web view URL (optional) |
Example:
getFileInfo
Get information about a file
Arguments:
fileId(string, required): ID of the file
Returns:
AdapterOperationResult - Normalized file info with id, name, mimeType, size, dates, owner, etc.
Response Fields:
| Field | Type | Description |
|---|---|---|
id | string | File ID |
name | string | File name |
mimeType | string | MIME type |
mimeTypeReadable | string | Human-readable file type |
size | number | File size in bytes |
createdAt | string | ISO 8601 creation date |
modifiedAt | string | ISO 8601 modification date |
webViewLink | `string | null` |
parents | string[] | Parent folder IDs |
owner | `GoogleDriveOwner | null` |
owner item fields (GoogleDriveOwner)
| Field | Type | Description |
|---|---|---|
name | string | Owner name |
email | string | Owner email |
| isFolder | boolean | Whether this is a folder |
| isTrashed | boolean | Whether file is in trash |
Example:
shareFile
Share a file with others
Arguments:
fileId(string, required): ID of the file to shareemail(string, optional): Email address to share with (optional)role(string, optional): Permission role: reader, writer, commenter (default: reader)
Returns:
AdapterOperationResult - Share result with link
Response Fields:
| Field | Type | Description |
|---|---|---|
fileId | string | Shared file ID |
permissionId | string | Created permission ID |
role | string | Permission role granted |
shared | boolean | Whether share succeeded |
Example:
downloadFile
Download a file from Google Drive. For Google Docs/Sheets, exports as PDF/XLSX. Returns base64-encoded data.
Arguments:
fileId(string, required): ID of the file to download
Returns:
AdapterOperationResult - File data (base64) and mimeType
Response Fields:
| Field | Type | Description |
|---|---|---|
data | string | Base64-encoded file content |
mimeType | string | MIME type of downloaded file |
Example:
moveFile
Move a file to a different folder
Arguments:
fileId(string, required): ID of the file to movefolderId(string, required): ID of the destination folder
Returns:
AdapterOperationResult - Updated file information
Response Fields:
| Field | Type | Description |
|---|---|---|
fileId | string | Moved file ID |
name | string | File name |
moved | boolean | Whether move succeeded |
Example:
deleteFile
Delete a file or folder. By default moves to trash; set permanently=true to delete forever.
Arguments:
fileId(string, required): ID of the file or folder to deletepermanently(boolean, optional): If true, permanently delete instead of moving to trash (default: false)
Returns:
AdapterOperationResult - Delete confirmation
Response Fields:
| Field | Type | Description |
|---|---|---|
fileId | string | Deleted file ID |
deleted | string | Deletion type: permanent or trash |
Example:
searchFiles
Search for files using Google Drive query syntax
Arguments:
query(string, required): Search query using Drive syntax (e.g., "name contains 'report'", "mimeType='application/pdf'")pageSize(number, optional): Maximum number of files to return (default: 20)
Returns:
AdapterOperationResult - List of normalized matching files
Response Fields:
| Field | Type | Description |
|---|---|---|
count | number | Number of files returned |
query | string | Search query used |
files | GoogleDriveFileSummary[] | Array of matching file summaries |
files item fields (GoogleDriveFileSummary)
| Field | Type | Description |
|---|---|---|
id | string | File ID |
name | string | File name |
mimeType | string | MIME type |
mimeTypeReadable | string | Human-readable file type |
createdAt | string | ISO 8601 creation date |
modifiedAt | string | ISO 8601 modification date |
isFolder | boolean | Whether this is a folder |
Example:
updateFile
Update file metadata (name, description)
Arguments:
fileId(string, required): ID of the file to updatename(string, optional): New name for the filedescription(string, optional): New description for the file
Returns:
AdapterOperationResult - Updated file information
Response Fields:
| Field | Type | Description |
|---|---|---|
fileId | string | Updated file ID |
name | string | File name |
updated | boolean | Whether update succeeded |
Example: