Google Drive

Google Drive

Google Drive API for managing files, folders, and shared drives

Active Verified

Capabilities (17)

Download File Content

Download binary content of a file. Do NOT use for Sheets/Docs/Slides.

download_file(file_id, mime_type?) -> binary
Required scopes:
https://www.googleapis.com/auth/drive.readonly

Create Folder

Create a new folder in Google Drive.

create_folder(name, parent_id?) -> Folder
Required scopes:
https://www.googleapis.com/auth/drive.file

Get File Details

Get metadata and details about a specific file including name, size, type, and sharing settings.

get_file(file_id) -> File
Required scopes:
https://www.googleapis.com/auth/drive.readonly

Share File

Share a file with specific users or make it publicly accessible.

share_file(file_id, email, role) -> Permission
Required scopes:
https://www.googleapis.com/auth/drive

Move Drive File

Reparent a Drive file to a different folder (or the root). The file ID, name, and content stay the same — only the location changes. Use for prompts like "move the Q2 report into the Archive folder".

move_file(file_id, target_folder_id) -> {id, parents}
Required scopes:
https://www.googleapis.com/auth/drive.file

Get Google Doc Content

Fetch the full structural content of a Google Doc — title, body, headers/footers, and paragraph indexes needed by insert_text_in_document. Read-only companion to `export_doc` (which returns rendered plain text or HTML).

get_document(document_id) -> document
Required scopes:
https://www.googleapis.com/auth/documents.readonly

Insert Text in Google Doc

Insert text at a specific location in a Google Doc. Uses the `documents.batchUpdate` endpoint with an `insertText` request. The `index` parameter is a 1-based body content offset (obtain via `get_document` and count characters up to the target location).

insert_text_in_document(document_id, text, index) -> {}
Required scopes:
https://www.googleapis.com/auth/documents

Append Text to Google Doc

Add text at the END of a Google Doc's body. Convenient wrapper around `insert_text_in_document` that computes the end-index for you (calls `get_document` first, sums content ranges). Use for "add a summary at the bottom" style prompts.

append_text_to_document(document_id, text) -> {}
Required scopes:
https://www.googleapis.com/auth/documents

Find & Replace in Google Doc

Find every occurrence of `find_text` in a Google Doc and replace it with `replace_text`. Uses the `documents.batchUpdate` endpoint with a `replaceAllText` request. Case sensitivity is controllable via `match_case`.

replace_text_in_document(document_id, find_text, replace_text, match_case?) -> {occurrences_changed}
Required scopes:
https://www.googleapis.com/auth/documents

Export Google-Native Document

Export a Google-native document (Docs, Sheets, Slides, Forms) to a downloadable format. Required for extracting text bodies from Google-native files — the regular `download_file` capability only works for blob files (PDF, DOCX, etc.). Choose mimeType based on source: Docs → text/plain, Sheets → text/csv, Slides → text/plain.

export_doc(file_id, mime_type) -> body
Required scopes:
https://www.googleapis.com/auth/drive.readonly

Copy Drive File

Duplicate an existing Drive file into a new one, optionally with a different name and/or destination folder. Enables template-based creation ("copy the Q2 report template and rename it Q3 report").

copy_file(file_id, new_name?, folder_id?) -> {id, webViewLink}
Required scopes:
https://www.googleapis.com/auth/drive.file

Delete Drive File

DESTRUCTIVE: trash a Drive file. The file moves to the user's Drive trash where it can be recovered for 30 days. Does NOT permanently delete — Drive's trash retention is the safety net. Requires user confirmation before dispatch.

delete_file(file_id) -> ok
Destructive
Required scopes:
https://www.googleapis.com/auth/drive

Search Files

Search for files in Google Drive using full-text search or metadata queries.

search_files(query, max_results?) -> {files: File[]}
Required scopes:
https://www.googleapis.com/auth/drive.readonly

Rename Drive File

Change a Drive file's display name. Does not affect the file's ID, shareable link, or content — only the visible name. Use for prompts like "rename that Doc to Q3 Report".

rename_file(file_id, new_name) -> {id, name}
Required scopes:
https://www.googleapis.com/auth/drive.file

List Files

List files and folders in Google Drive. Can filter by folder, file type, or search query.

list_files(folder_id?, query?, max_results?) -> {files: File[], nextPageToken?}
Required scopes:
https://www.googleapis.com/auth/drive.readonly

Create Google Doc

Create a new Google Doc, optionally pre-populated with plain text or HTML content. Returns the file id and shareable webViewLink. Preferred over `upload_file` when the user wants a Doc they can edit in Google Docs afterwards.

create_document(title, content?, folder_id?) -> {id, webViewLink}
Required scopes:
https://www.googleapis.com/auth/drive.file

Upload File to Drive

Upload arbitrary binary or text content to Drive as a new file. Unlike `create_document`, the file stays in its native format (PDF, CSV, PNG, etc.) — no conversion to Google Docs. Use for saving raw data, images, or exports.

upload_file(name, content, mime_type, folder_id?) -> {id, webViewLink, mimeType}
Required scopes:
https://www.googleapis.com/auth/drive.file

Authentication

  • Oauth2_authorization_code (Primary)