Googledrive

Learn how to use Googledrive with Composio

Overview

SLUG: GOOGLEDRIVE

Description

Google Drive is a cloud storage solution for uploading, sharing, and collaborating on files across devices, with robust search and offline access

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/userinfo.email

Connecting to Googledrive

Create an auth config

Use the dashboard to create an auth config for the Googledrive toolkit. This allows you to connect multiple Googledrive accounts to Composio for agents to use.

1

Select App

Navigate to Googledrive.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Googledrive Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4googledrive_auth_config_id = "ac_YOUR_GOOGLEDRIVE_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Googledrive: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, googledrive_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Googledrive toolkit’s playground

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Add file sharing preference

Description

Modifies sharing permissions for an existing Google Drive file, granting a specified role to a user, group, domain, or 'anyone'.

Action Parameters

domain
email_address
file_id
stringRequired
role
stringRequired
transfer_ownership
type
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Add Shared Drive Member

Description

Tool to add a member (user/group/domain) to a Shared Drive with a specified role. Use when you need to grant access to a Shared Drive, ensuring supportsAllDrives is set correctly.

Action Parameters

domain
drive_id
stringRequired
email_address
email_message
role
stringRequired
send_notification_email
type
stringRequired
use_domain_admin_access

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Copy file

Description

Duplicates an existing file in Google Drive, identified by its `file_id`.

Action Parameters

file_id
stringRequired
new_title

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create Comment

Description

Tool to create a comment on a file. Use when you need to add a new comment to a specific file in Google Drive.

Action Parameters

anchor
content
stringRequired
file_id
stringRequired
quoted_file_content_mime_type
quoted_file_content_value

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create Shared Drive

Description

Tool to create a new shared drive. Use when you need to programmatically create a new shared drive for collaboration or storage.

Action Parameters

backgroundImageFile
colorRgb
hidden
name
stringRequired
requestId
themeId

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create File or Folder

Description

Creates a new file or folder with metadata. Use to create empty files or folders, or files with content by providing it in the request body (though this action primarily focuses on metadata creation).

Action Parameters

description
fields
mimeType
name
parents
starred

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create a File from Text

Description

Creates a new file in Google Drive from provided text content (up to 10MB), supporting various formats including automatic conversion to Google Workspace types.

Action Parameters

file_name
stringRequired
mime_type
stringDefaults to text/plain
parent_id
text_content
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create a folder

Description

Creates a new folder in Google Drive, optionally within an EXISTING parent folder specified by its ID or name. The parent folder MUST already exist - use GOOGLEDRIVE_FIND_FOLDER first to verify the parent exists or find its ID.

Action Parameters

name
stringRequired
parent_id

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create Reply

Description

Tool to create a reply to a comment in Google Drive. Use when you need to respond to an existing comment on a file.

Action Parameters

action
comment_id
stringRequired
content
stringRequired
fields
file_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Create Shortcut to File/Folder

Description

Tool to create a shortcut to a file or folder in Google Drive. Use when you need to link to an existing Drive item from another location without duplicating it.

Action Parameters

ignoreDefaultVisibility
includeLabels
includePermissionsForView
keepRevisionForever
name
stringRequired
supportsAllDrives
target_id
stringRequired
target_mime_type

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Comment

Description

Deletes a comment from a file. Use when you need to remove a specific comment from a Google Drive file.

Action Parameters

comment_id
stringRequired
file_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Shared Drive

Description

Tool to permanently delete a shared drive. Use when you need to remove a shared drive and its contents (if specified).

Action Parameters

allowItemDeletion
driveId
stringRequired
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Permission

Description

Deletes a permission from a file by permission ID. IMPORTANT: You must first call GOOGLEDRIVE_LIST_PERMISSIONS to get valid permission IDs. Use when you need to revoke access for a specific user or group from a file.

Action Parameters

file_id
stringRequired
permission_id
stringRequired
supportsAllDrives
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete Reply

Description

Tool to delete a specific reply by reply ID. Use when you need to remove a reply from a comment on a file.

Action Parameters

comment_id
stringRequired
file_id
stringRequired
reply_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Download a file from Google Drive

Description

Downloads a file from Google Drive by its ID. For Google Workspace documents (Docs, Sheets, Slides), optionally exports to a specified `mime_type`. For other file types, downloads in their native format regardless of mime_type. Examples: Export a Google Doc to plain text: {"file_id": "1N2o5xQWmAbCdEfGhIJKlmnOPq", "mime_type": "text/plain"} Download a Google Sheet as CSV: {"file_id": "1ZyXwVuTsRqPoNmLkJiHgFeDcB", "mime_type": "text/csv"}

Action Parameters

file_id
stringRequired
mime_type

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Download file via operation

Description

Tool to download file content using long-running operations. Use when you need to download Google Vids files or export Google Workspace documents as part of a long-running operation. Operations are valid for 24 hours from creation.

Action Parameters

file_id
stringRequired
mime_type
revision_id

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Edit File

Description

Updates an existing Google Drive file by overwriting its entire content with new text (max 10MB). This action allows users to change the content of a Drive file, ensuring that the latest updates are saved and available without creating a new file. Users can specify different MIME types for the content being uploaded, facilitating various file formats.

Action Parameters

content
stringRequired
file_id
stringRequired
mime_type
stringDefaults to text/plain

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Empty Trash

Description

Tool to permanently delete all of the user's trashed files. Use when you want to empty the trash in Google Drive. This action allows you to permanently remove all files that are currently in the trash of Google Drive. It can be applied to files in both the user's root trash and shared drives, ensuring a complete removal of unwanted files.

Action Parameters

driveId
enforceSingleParent

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Modify File Labels

Description

Modifies the set of labels applied to a file. Returns a list of the labels that were added or modified. Use when you need to programmatically change labels on a Google Drive file, such as adding, updating, or removing them.

Action Parameters

file_id
stringRequired
kind
Defaults to drive#modifyLabelsRequest
label_modifications
arrayRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Find file

Description

The comprehensive Google Drive search tool that handles all file and folder discovery needs. Use this for any file finding task - from simple name searches to complex queries with date filters, MIME types, permissions, custom properties, folder scoping, and more. Searches across My Drive and shared drives with full metadata support. Examples: - Find PDFs: q="mimeType = 'application/pdf'" - Find recent files: q="modifiedTime > '2024-01-01T00:00:00'" - Search by name: q="name contains 'report'" - Files in folder: folderId="abc123" or q="'FOLDER_ID' in parents"

Action Parameters

corpora
Defaults to allDrives
driveId
editors_field_removed
fields
Defaults to *
folder_id
includeItemsFromAllDrives
Defaults to True
include_labels
include_permissions_for_view
orderBy
pageSize
Defaults to 100
pageToken
q
spaces
Defaults to drive
supportsAllDrives
Defaults to True

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Find folder

Description

Tool to find a folder in Google Drive by its name and optionally a parent folder. Use when you need to locate a specific folder to perform further actions like creating files in it or listing its contents.

Action Parameters

full_text_contains
full_text_not_contains
modified_after
name_contains
name_exact
name_not_contains
parent_folder_id
starred

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Generate File IDs

Description

Generates a set of file IDs which can be provided in create or copy requests. Use when you need to pre-allocate IDs for new files or copies.

Action Parameters

count
space
type

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get about

Description

Tool to retrieve information about the user, the user's Drive, and system capabilities. Use when you need to check storage quotas, user details, or supported import/export formats.

Action Parameters

fields
stringDefaults to *

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Changes Start Page Token

Description

Tool to get the starting pageToken for listing future changes in Google Drive. Use this when you need to track changes to files and folders.

Action Parameters

driveId
supportsAllDrives
supportsTeamDrives
teamDriveId

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Comment

Description

Tool to get a comment by ID. Use when you need to retrieve a specific comment from a Google Drive file and have both the file ID and comment ID.

Action Parameters

commentId
stringRequired
fileId
stringRequired
includeDeleted

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Shared Drive

Description

Tool to get a shared drive by ID. Use when you need to retrieve information about a specific shared drive.

Action Parameters

drive_id
stringRequired
use_domain_admin_access

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get File Metadata

Description

Tool to get a file's metadata by ID. Use when you need to retrieve the metadata for a specific file in Google Drive.

Action Parameters

fileId
stringRequired
includeLabels
includePermissionsForView
supportsAllDrives

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Permission

Description

Gets a permission by ID. Use this tool to retrieve a specific permission for a file or shared drive.

Action Parameters

fields
file_id
stringRequired
permission_id
stringRequired
supports_all_drives
use_domain_admin_access

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Reply

Description

Tool to get a specific reply to a comment on a file. Use when you need to retrieve the details of a particular reply.

Action Parameters

commentId
stringRequired
fileId
stringRequired
includeDeleted
replyId
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Revision

Description

Tool to get a specific revision's metadata by revision ID. Use when you need to retrieve information about a particular version of a file.

Action Parameters

acknowledge_abuse
file_id
stringRequired
revision_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Delete folder or file

Description

Tool to delete a file or folder in Google Drive. Use when you need to permanently remove a specific file or folder using its ID. Note: This action is irreversible.

Action Parameters

fileId
stringRequired
supportsAllDrives

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Hide Shared Drive

Description

Tool to hide a shared drive from the default view. Use when you want to remove a shared drive from the user's main Google Drive interface without deleting it.

Action Parameters

drive_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Access Proposals

Description

Tool to list pending access proposals on a file. Use when you need to retrieve access proposals for a specific file. Note: Only approvers can list access proposals; non-approvers will receive a 403 error.

Action Parameters

fileId
stringRequired
pageSize
pageToken

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Approvals

Description

Tool to list approvals on a file for workflow-based access control. Use when you need to retrieve all approvals associated with a specific file in Google Drive.

Action Parameters

fileId
stringRequired
pageSize
pageToken

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Changes

Description

Tool to list the changes for a user or shared drive. Use when you need to track modifications to files and folders, such as creations, deletions, or permission changes. The pageToken is optional - if not provided, the current start page token will be automatically fetched to begin monitoring changes from now. Example usage (continuing with pageToken): ```json { "pageToken": "22633", "pageSize": 100, "includeRemoved": true } ``` Returns changes with timestamps, file IDs, and modification details. Save the `nextPageToken` from the response to continue paginating through changes, or save the `newStartPageToken` to monitor future changes efficiently.

Action Parameters

driveId
includeCorpusRemovals
includeItemsFromAllDrives
includeLabels
includePermissionsForView
includeRemoved
Defaults to True
pageSize
Defaults to 100
pageToken
restrictToMyDrive
spaces
Defaults to drive
supportsAllDrives

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Comments

Description

Tool to list all comments for a file in Google Drive. Use when you need to retrieve comments associated with a specific file.

Action Parameters

fields
Defaults to *
fileId
stringRequired
includeDeleted
pageSize
Defaults to 20
pageToken
startModifiedTime

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List File Labels

Description

Tool to list the labels on a file. Use when you need to retrieve all labels associated with a specific file in Google Drive.

Action Parameters

file_id
stringRequired
max_results
page_token

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Files and Folders

Description

Tool to list a user's files and folders in Google Drive. Use this to search or browse for files and folders based on various criteria.

Action Parameters

corpora
driveId
fields
folderId
includeItemsFromAllDrives
includeLabels
includePermissionsForView
orderBy
pageSize
Defaults to 100
pageToken
q
spaces
supportsAllDrives

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Permissions

Description

Tool to list a file's permissions. Use when you need to retrieve all permissions associated with a specific file or shared drive.

Action Parameters

fileId
stringRequired
includePermissionsForView
pageSize
pageToken
supportsAllDrives
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Replies to Comment

Description

Tool to list replies to a comment in Google Drive. Use this when you need to retrieve all replies associated with a specific comment on a file.

Action Parameters

comment_id
stringRequired
fields
Defaults to *
file_id
stringRequired
include_deleted
page_size
page_token

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List File Revisions

Description

Tool to list a file's revisions. Use when you need to retrieve the revision history of a specific file in Google Drive.

Action Parameters

fileId
stringRequired
pageSize
pageToken
supportsAllDrives

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: List Shared Drives

Description

Tool to list the user's shared drives. Use when you need to get a list of all shared drives accessible to the authenticated user.

Action Parameters

pageSize
pageToken
q
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Move File

Description

Tool to move a file from one folder to another in Google Drive. Use when you need to reorganize files by changing their parent folder(s).

Action Parameters

add_parents
file_id
stringRequired
include_labels
include_permissions_for_view
keep_revision_forever
ocr_language
remove_parents
supports_all_drives
use_content_as_indexable_text

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Export or download a file

Description

DEPRECATED: Exports Google Workspace files (max 10MB) to a specified format using `mime_type`, or downloads other file types; use `GOOGLEDRIVE_DOWNLOAD_FILE` instead.

Action Parameters

file_id
stringRequired
mime_type

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Resumable Upload

Description

Tool to start and complete a Google Drive resumable upload session. Use when uploading large files that require resumable, chunked uploads.

Action Parameters

chunkSize
integerDefaults to 262144
file_id
file_to_upload
objectRequired
folder_to_upload_to
metadata
queryParams
object

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Stop Watch Channel

Description

Tool to stop watching resources through a specified channel. Use this when you want to stop receiving notifications for a previously established watch.

Action Parameters

address
channelType
expiration
id
stringRequired
kind
Defaults to api#channel
params
payload
resourceId
stringRequired
resourceUri
token

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Trash File

Description

Tool to move a file or folder to trash (soft delete). Use when you need to delete a file but want to allow recovery via UNTRASH_FILE. This action is distinct from permanent deletion and provides a safer cleanup workflow.

Action Parameters

fields
file_id
stringRequired
supportsAllDrives
Defaults to True

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Unhide Shared Drive

Description

Tool to unhide a shared drive. Use when you need to restore a shared drive to the default view.

Action Parameters

driveId
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Untrash File

Description

Tool to restore a file from the trash. Use when you need to recover a deleted file. This action updates the file's metadata to set the 'trashed' property to false.

Action Parameters

file_id
stringRequired
supportsAllDrives

Action Response

data
arrayRequired
error
successful
booleanRequired

Tool Name: Update Comment

Description

Tool to update an existing comment on a Google Drive file. Use when you need to change the content or status (e.g., resolve) of a comment.

Action Parameters

comment_id
stringRequired
content
fields
file_id
stringRequired
resolved

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Shared Drive

Description

Tool to update the metadata for a shared drive. Use when you need to modify properties like the name, theme, background image, or restrictions of a shared drive.

Action Parameters

backgroundImageFile
colorRgb
driveId
stringRequired
hidden
name
restrictions
themeId
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update File (Metadata)

Description

Updates file metadata. Uses PATCH semantics (partial update) as per Google Drive API v3. Use this tool to modify attributes of an existing file like its name, description, or parent folders. Note: This action currently supports metadata updates only. File content updates require multipart/related upload and are not yet implemented.

Action Parameters

add_parents
description
fileId
stringRequired
keep_revision_forever
mime_type
name
ocr_language
remove_parents
starred
supports_all_drives
use_domain_admin_access
viewers_can_copy_content
writers_can_share

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update File Revision Metadata

Description

Updates ONLY the metadata properties of a specific file revision (keepForever, published, publishAuto, publishedOutsideDomain). IMPORTANT: This action does NOT update file content. To update file content, use EDIT_FILE or UPDATE_FILE_PUT instead. This action requires BOTH file_id AND revision_id parameters. Use LIST_REVISIONS to get available revision IDs for a file. Valid parameters: file_id (required), revision_id (required), keep_forever, published, publish_auto, published_outside_domain. Invalid parameters (use other actions): file_contents, mime_type, content, name - these are NOT supported by this action.

Action Parameters

file_id
stringRequired
keep_forever
publishAuto
published
publishedOutsideDomain
revision_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Permission

Description

Tool to update a permission with patch semantics. Use when you need to modify an existing permission for a file or shared drive.

Action Parameters

enforceExpansiveAccess
fileId
stringRequired
permission
objectRequired
permissionId
stringRequired
removeExpiration
supportsAllDrives
transferOwnership
useDomainAdminAccess

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Update Reply

Description

Tool to update a reply to a comment on a Google Drive file. Use when you need to modify the content of an existing reply.

Action Parameters

comment_id
stringRequired
content
stringRequired
fields
file_id
stringRequired
reply_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Upload File

Description

Uploads a file (max 5MB) to Google Drive, moving it to a specified folder if a valid folder ID is provided, otherwise uploads to root.

Action Parameters

file_to_upload
objectRequired
folder_to_upload_to

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Upload File from URL to Drive

Description

Tool to fetch a file from a provided URL server-side and upload it into Google Drive. Use when you need to reliably persist externally hosted files into Drive without client-side downloads or temporary storage.

Action Parameters

mime_type
name
stringRequired
parent_folder_id
source_headers
source_url
stringRequired
supports_all_drives
Defaults to True

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Watch Drive Changes

Description

Tool to subscribe to changes for a user or shared drive in Google Drive. Use when you need to monitor a Google Drive for modifications and receive notifications at a specified webhook URL.

Action Parameters

address
stringRequired
drive_id
expiration
id
stringRequired
include_corpus_removals
include_items_from_all_drives
include_labels
include_permissions_for_view
include_removed
Defaults to True
page_size
Defaults to 100
page_token
params
restrict_to_my_drive
spaces
Defaults to drive
supports_all_drives
token
type
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Watch File for Changes

Description

Tool to subscribe to push notifications for changes to a specific file. Use when you need to monitor a file for modifications and receive real-time notifications at a webhook URL.

Action Parameters

acknowledgeAbuse
address
stringRequired
expiration
fileId
stringRequired
id
stringRequired
includeLabels
includePermissionsForView
params
payload
supportsAllDrives
supportsTeamDrives
token
type
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired