# Connect EMQX Agents to Google Drive

The Google Drive connector lets EMQX Agents manage files, folders, permissions, comments, replies, and shared drives. Use it to store agent output, organize files, manage collaboration, and retrieve documents for a workflow.

## Common Use Cases

- Upload a generated report and share it with a team.
- Search a Drive folder for the latest device specification.
- Add a comment to a file after completing an analysis.
- Move processed files to an archive folder.

Example chat prompt:

```text
Use the operations-drive connector to find the latest weekly device report, add a comment summarizing the unresolved issues, and do not change file permissions.
```

## Prerequisites

Before adding the connector, prepare:

- A Google account with access to Google Drive.
- Permission to authorize Composio to view, create, edit, and delete Google Drive files.
- Access to the files, folders, and shared drives required by the workflow.

## Add a Google Drive Connector

1. In the left navigation menu, click **Connectors**.
2. On the **Available** tab, locate **Google Drive** and click **Add**.
3. Enter a descriptive connector name.
4. Click **Confirm**. The Google authorization flow opens in a dialog.
5. Select the Google account to connect, or click **Use another account**.
6. If Google asks you to sign in to Composio again, review the information and click **Continue**.
7. Review the access requested by Composio. The authorization includes permission to:
   - View, create, edit, and delete all Google Drive files available to the authorized account.
   - View your primary Google Account email address and associate you with your personal information on Google.
8. Click **Continue** to grant access.
9. Wait for Composio to display the successful connection message and return you to EMQX Agents.
10. On the **Added** tab, verify that the connector status is **Authorized**.

Google may show permissions that were granted previously. Review the requested access before continuing. For a managed Google Workspace account, organization policies may prevent you from authorizing third-party applications.

## Supported Tools

### Files and Folders

| Tool | Access | Description |
|---|---|---|
| `GOOGLEDRIVE_COPY_FILE_ADVANCED` | Write | Copies a file with options such as name and parent folder. |
| `GOOGLEDRIVE_CREATE_FILE` | Write | Creates a file or folder from file metadata. |
| `GOOGLEDRIVE_CREATE_FILE_FROM_TEXT` | Write | Creates a Drive file from text content. |
| `GOOGLEDRIVE_CREATE_FOLDER` | Write | Creates a folder. |
| `GOOGLEDRIVE_GOOGLE_DRIVE_DELETE_FOLDER_OR_FILE_ACTION` | Destructive | Permanently deletes a file or folder. |
| `GOOGLEDRIVE_MOVE_FILE` | Write | Moves a file between folders. |
| `GOOGLEDRIVE_RESUMABLE_UPLOAD` | Write | Uploads a large file by using a resumable upload. |
| `GOOGLEDRIVE_TRASH_FILE` | Destructive | Moves a file to trash. |
| `GOOGLEDRIVE_UNTRASH_FILE` | Write | Restores a file from trash. |
| `GOOGLEDRIVE_UPDATE_FILE_PUT` | Write | Updates file metadata such as name, description, or parent folder. |
| `GOOGLEDRIVE_UPLOAD_FILE` | Write | Uploads a file to Google Drive. |
| `GOOGLEDRIVE_UPLOAD_UPDATE_FILE` | Write | Uploads new content to update a Drive file. |

### Read and Search

| Tool | Access | Description |
|---|---|---|
| `GOOGLEDRIVE_DOWNLOAD_FILE` | Read | Downloads a file by file ID. |
| `GOOGLEDRIVE_DOWNLOAD_FILE_OPERATION` | Read | Downloads a file through a Drive download operation. |
| `GOOGLEDRIVE_EXPORT_GOOGLE_WORKSPACE_FILE` | Read | Exports a Google Workspace file in a selected format. |
| `GOOGLEDRIVE_FIND_FILE` | Read | Searches for files and folders by name, content, or other criteria. |
| `GOOGLEDRIVE_FIND_FOLDER` | Read | Searches for folders by name, modification time, or other criteria. |
| `GOOGLEDRIVE_GET_ABOUT` | Read | Gets current user, storage quota, and supported import and export format information. |
| `GOOGLEDRIVE_GET_FILE_METADATA` | Read | Gets file metadata. |
| `GOOGLEDRIVE_LIST_CHILDREN_V2` | Read | Lists child files and folders in a folder. |

### Permissions

| Tool | Access | Description |
|---|---|---|
| `GOOGLEDRIVE_CREATE_PERMISSION` | Write | Creates a permission for a file or shared drive. |
| `GOOGLEDRIVE_DELETE_PERMISSION` | Destructive | Deletes a permission from a file or shared drive. |
| `GOOGLEDRIVE_GET_PERMISSION_ID_FOR_EMAIL` | Read | Gets a Drive permission ID for an email address. |
| `GOOGLEDRIVE_LIST_ACCESS_PROPOSALS` | Read | Lists access proposals for a file. |
| `GOOGLEDRIVE_LIST_PERMISSIONS` | Read | Lists permissions for a file or shared drive. |

### Comments and Replies

| Tool | Access | Description |
|---|---|---|
| `GOOGLEDRIVE_CREATE_COMMENT` | Write | Creates a comment on a file. |
| `GOOGLEDRIVE_CREATE_REPLY` | Write | Replies to a file comment. |
| `GOOGLEDRIVE_DELETE_COMMENT` | Destructive | Deletes a comment. |
| `GOOGLEDRIVE_DELETE_REPLY` | Destructive | Deletes a comment reply. |
| `GOOGLEDRIVE_GET_COMMENT` | Read | Gets a file comment. |
| `GOOGLEDRIVE_GET_REPLY` | Read | Gets a comment reply. |
| `GOOGLEDRIVE_LIST_COMMENTS` | Read | Lists comments on a file. |
| `GOOGLEDRIVE_LIST_REPLIES` | Read | Lists replies to a comment. |
| `GOOGLEDRIVE_UPDATE_COMMENT` | Write | Updates a comment. |
| `GOOGLEDRIVE_UPDATE_REPLY` | Write | Updates a comment reply. |

### Shared Drives

| Tool | Access | Description |
|---|---|---|
| `GOOGLEDRIVE_CREATE_DRIVE` | Write | Creates a shared drive. |
| `GOOGLEDRIVE_DELETE_DRIVE` | Destructive | Deletes a shared drive. |
| `GOOGLEDRIVE_GET_DRIVE` | Read | Gets shared drive details. |
| `GOOGLEDRIVE_LIST_SHARED_DRIVES` | Read | Lists shared drives available to the authorized user. |
| `GOOGLEDRIVE_UPDATE_DRIVE` | Write | Updates a shared drive name, appearance, or restrictions. |

::: warning Important Notice
The permanent delete tool cannot be reversed through the Google Drive trash. Permission changes can expose or remove access to files. Review the file, folder, shared drive, and principal before these operations.
:::

## Use the Connector in a Chat

1. In the chat input area, click the connector icon.
2. Select the authorized **Google Drive** connector.
3. In the prompt, identify the external resource and operation that the agent should use.
4. Review the generated agent definition and confirm that it contains only the required tools.

## Permissions and Data Access

The connector uses the authorized Google account. File ownership, sharing settings, shared drive membership, and Google Workspace policies determine accessible resources and operations.

Do not include external service credentials or access tokens in the chat prompt or agent instructions.

## Limitations

- Google Drive API quotas and storage limits apply.
- Export formats depend on the Google Workspace file type.
- Shared drive operations can require organizer or administrator privileges.
- Large uploads can require resumable upload operations.

<!-- TODO: Confirm service-specific result size limits, file limits, API rate limits, plan restrictions, and unsupported resource types. -->

## Troubleshooting

| Symptom | Resolution |
|---|---|
| The connector remains **Unauthorized**. | Retry authorization, select the intended Google account, and click **Continue** to grant the requested access. For a managed Google Workspace account, verify that your administrator allows Composio. |
| A tool returns a permission error. | Verify that the authorized account can access the target file, folder, or shared drive and that the required Google permissions are still granted. Reauthorize the connector if necessary. |
| A required tool is unavailable. | Verify that the tool is supported and approved for this connector, then select the connector again in the chat. |
| Requests are rejected intermittently. | Check the external service status, API quota, rate limits, and account plan. |

## Related Links

- [Connectors](../connectors.md)
- [Start a Chat](../chats.md)
- [Manage Agents](../agents.md)
