Rei-skills google-drive-automation
Automate Google Drive file operations (upload, download, search, share, organize) via Rube MCP (Composio). Upload/download files, manage folders, share with permissions, and search across drives pr...
git clone https://github.com/rootcastleco/rei-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/rootcastleco/rei-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/google-drive-automation" ~/.claude/skills/rootcastleco-rei-skills-google-drive-automation && rm -rf "$T"
skills/google-drive-automation/SKILL.mdGoogle Drive Automation via Rube MCP
Automate Google Drive workflows including file upload/download, search, folder management, sharing/permissions, and organization through Composio's Google Drive toolkit.
Prerequisites
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Google Drive connection via
with toolkitRUBE_MANAGE_CONNECTIONSgoogledrive - Always call
first to get current tool schemasRUBE_SEARCH_TOOLS
Setup
Get Rube MCP: Add
https://rube.app/mcp as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
- Verify Rube MCP is available by confirming
respondsRUBE_SEARCH_TOOLS - Call
with toolkitRUBE_MANAGE_CONNECTIONSgoogledrive - If connection is not ACTIVE, follow the returned auth link to complete Google OAuth
- Confirm connection status shows ACTIVE before running any workflows
Core Workflows
1. Upload and Download Files
When to use: User wants to upload files to or download files from Google Drive
Tool sequence:
- Locate target folder for upload [Prerequisite]GOOGLEDRIVE_FIND_FILE
- Upload a file (max 5MB) [Required]GOOGLEDRIVE_UPLOAD_FILE
- Upload large files [Fallback]GOOGLEDRIVE_RESUMABLE_UPLOAD
- Download a file by ID [Required]GOOGLEDRIVE_DOWNLOAD_FILE
- Track long-running downloads [Fallback]GOOGLEDRIVE_DOWNLOAD_FILE_OPERATION
- Verify file after upload/download [Optional]GOOGLEDRIVE_GET_FILE_METADATA
Key parameters:
: Object withfile_to_upload
,name
, andmimetype
(file must be in internal storage)s3key
: Target folder ID (optional; uploads to root if omitted)folder_to_upload_to
: ID of file to downloadfile_id
: Export format for Google Workspace files only (omit for native files)mime_type
Pitfalls:
requiresGOOGLEDRIVE_UPLOAD_FILE
; files must already be in internal storagefile_to_upload.s3key- For non-Google formats (Excel, PDF), do NOT set
; it causes errors for native filesmime_type - Download responses provide a temporary URL at
, not inline bytesdata.downloaded_file_content.s3url - Use
for files >5MB or when basic uploads failGOOGLEDRIVE_RESUMABLE_UPLOAD
2. Search and List Files
When to use: User wants to find specific files or browse Drive contents
Tool sequence:
- Search by name, content, type, date, or folder [Required]GOOGLEDRIVE_FIND_FILE
- Browse files with folder scoping [Alternative]GOOGLEDRIVE_LIST_FILES
- Enumerate shared drives [Optional]GOOGLEDRIVE_LIST_SHARED_DRIVES
- Get detailed file info [Optional]GOOGLEDRIVE_GET_FILE_METADATA
- Check storage quota and supported formats [Optional]GOOGLEDRIVE_GET_ABOUT
Key parameters:
: Drive query string (e.g., "name contains 'report'", "mimeType = 'application/pdf'")q
: Search scope ('user', 'domain', 'drive', 'allDrives')corpora
: Response fields to include (e.g., 'files(id,name,mimeType)')fields
: Sort key ('modifiedTime desc', 'name', 'quotaBytesUsed desc')orderBy
: Results per page (max 1000)pageSize
: Pagination cursor frompageTokennextPageToken
: Scope search to a specific folderfolder_id
Pitfalls:
- 403 PERMISSION_DENIED if OAuth scopes insufficient for shared drives
- Pagination required; files are in
; followresponse.data.files
until exhaustednextPageToken
may trigger 400; trycorpora="domain"
with"allDrives"includeItemsFromAllDrives=true- Query complexity limits: >5-10 OR clauses may error "The query is too complex"
- Wildcards (*) NOT supported in
; usename
for partial matchingcontains - 'My Drive' is NOT searchable by name; use
for root folderfolder_id='root' - User email searches: use
(NOT'user@example.com' in owners
)owner:user@example.com
3. Share Files and Manage Permissions
When to use: User wants to share files or manage access permissions
Tool sequence:
- Locate the file to share [Prerequisite]GOOGLEDRIVE_FIND_FILE
- Set sharing permission [Required]GOOGLEDRIVE_ADD_FILE_SHARING_PREFERENCE
- View current permissions [Optional]GOOGLEDRIVE_LIST_PERMISSIONS
- Inspect a specific permission [Optional]GOOGLEDRIVE_GET_PERMISSION
- Modify existing permission [Optional]GOOGLEDRIVE_UPDATE_PERMISSION
- Revoke access [Optional]GOOGLEDRIVE_DELETE_PERMISSION
Key parameters:
: ID of file to sharefile_id
: 'user', 'group', 'domain', or 'anyone'type
: 'owner', 'organizer', 'fileOrganizer', 'writer', 'commenter', 'reader'role
: Required for type='user' or 'group'email_address
: Required for type='domain'domain
: Required when role='owner'transfer_ownership
Pitfalls:
- Invalid type/email combinations trigger 4xx errors
- Using
or powerful roles is risky; get explicit user confirmationtype='anyone' - Org policies may block certain sharing types, causing 403
- Permission changes may take time to propagate
- Use
to resolve contact names to emails before sharingGMAIL_SEARCH_PEOPLE
4. Create and Organize Folders
When to use: User wants to create folder structures or move files between folders
Tool sequence:
- Check if folder already exists [Prerequisite]GOOGLEDRIVE_FIND_FILE
- Create a new folder [Required]GOOGLEDRIVE_CREATE_FOLDER
- Verify created folder [Optional]GOOGLEDRIVE_GET_FILE_METADATA
- Move files between folders [Optional]GOOGLEDRIVE_MOVE_FILE
- Update file metadata/parents [Alternative]GOOGLEDRIVE_UPDATE_FILE_PUT
Key parameters:
: Folder namename
: Parent folder ID (NOT name); omit for rootparent_id
: File to movefile_id
: Destination folder ID for moveadd_parents
: Source folder ID to remove fromremove_parents
Pitfalls:
requiresGOOGLEDRIVE_CREATE_FOLDER
as an ID, not a folder nameparent_id- Using
creates at top level; for nested paths, chain folder IDsparent_id="root"
returns ~100 items/page; followGOOGLEDRIVE_FIND_FILE
for large drivesnextPageToken- Move operations can leave items with multiple parents; use
for true movesremove_parents - Always verify parent folder exists before creating children
Common Patterns
ID Resolution
- File/folder name -> ID:
withGOOGLEDRIVE_FIND_FILE
parameterq - Root folder: Use
orfolder_id='root''root' in parents - Shared drive -> driveId:
GOOGLEDRIVE_LIST_SHARED_DRIVES - Contact name -> email:
(for sharing)GMAIL_SEARCH_PEOPLE
Query Syntax
Google Drive uses a specific query language:
- Name search:
or"name contains 'report'""name = 'exact.pdf'" - Type filter:
or"mimeType = 'application/pdf'""mimeType = 'application/vnd.google-apps.folder'" - Folder scoping:
"'FOLDER_ID' in parents" - Date filter:
"modifiedTime > '2024-01-01T00:00:00'" - Combine with
/and
/or
:not"name contains 'report' and trashed = false" - Boolean filters:
,"sharedWithMe = true"
,"starred = true""trashed = false"
Pagination
- Follow
until absent for complete resultsnextPageToken - Set
explicitly (default 100, max 1000)pageSize - De-duplicate results if running multiple searches
Export Formats
For Google Workspace files, set
mime_type to export:
- Docs:
,application/pdf
,text/plain
,text/htmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.document - Sheets:
,text/csvapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet - Slides:
,application/pdfapplication/vnd.openxmlformats-officedocument.presentationml.presentation
Known Pitfalls
- Internal storage required: Upload requires files in internal S3 storage (s3key)
- Export vs download: Set
ONLY for Google Workspace files; omit for native filesmime_type - Temporary URLs: Downloaded content via
is temporary; fetch promptlys3url - Query complexity: >5-10 OR clauses may error; split complex searches into multiple queries
- Shared drive scoping: Missing drive permissions yield empty results; verify access first
- No wildcards: Use
operator instead ofcontains
for partial name matching* - Folder creation chains: Always pass folder IDs (not names) as
parent_id - Multiple parents: Move operations may leave items with multiple parents; use
remove_parents - Rate limits: Heavy searches/exports can trigger 403/429; implement backoff
Quick Reference
| Task | Tool Slug | Key Params |
|---|---|---|
| Search files | | , , |
| List files | | , , |
| Upload file | | , |
| Resumable upload | | file data |
| Download file | | , (Workspace only) |
| File metadata | | , |
| Create folder | | , |
| Move file | | , , |
| Share file | | , , , |
| List permissions | | |
| Update permission | | file_id, permission_id |
| Delete permission | | file_id, permission_id |
| List shared drives | | |
| Drive info | | (none) |
| Create shortcut | | target file_id |
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
🏰 Rei Skills — Curated by Rootcastle Engineering & Innovation | Batuhan Ayrıbaş
Engineering Beyond Boundaries | admin@rootcastle.com