productivity
Google Drive CLI for Headless Automation
Use the Google Drive CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
15 functions 13 read 2 write OAuth browser flow auth
Google Drive CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Google Drive CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Google Drive CLI for Headless Automation
kosmokrator integrations:configure google_drive --set access_token="$GOOGLE_DRIVE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call google_drive.google_drive_copy '{"file_id":"example_file_id","name":"example_name","parent_id":"example_parent_id"}' --json Discovery Before Execution
Agents and scripts can inspect Google Drive docs and schemas before choosing a function.
kosmo integrations:docs google_drive --json
kosmo integrations:docs google_drive.google_drive_copy --json
kosmo integrations:schema google_drive.google_drive_copy --json
kosmo integrations:search "Google Drive" --json
kosmo integrations:list --json Useful Google Drive CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
google_drive.google_drive_copy | Read | file_id, name, parent_id | Duplicate a file in Google Drive. |
google_drive.google_drive_create_file | Write | name, type, parent_id | Create an empty Google Doc, Sheet, or Presentation in Google Drive. |
google_drive.google_drive_create_folder | Write | name, parent_id | Create a folder in Google Drive. |
google_drive.google_drive_delete | Read | file_id | Permanently delete a file from Google Drive (irreversible). |
google_drive.google_drive_move | Read | file_id, target_folder_id | Move a file to a different folder in Google Drive. |
google_drive.google_drive_rename | Read | file_id, name | Rename a file or folder in Google Drive. |
google_drive.google_drive_get_file | Read | file_id, export_as | Get file metadata by ID from Google Drive. For Google Docs/Sheets/Slides, use `export_as` to get content as text, csv, or markdown. |
google_drive.google_drive_list_permissions | Read | file_id | List all permissions (sharing settings) on a Google Drive file or folder. |
google_drive.google_drive_search_files | Read | query, max_results, page_token, order_by | Search for files in Google Drive using Drive query syntax (default: 20 results, max: 100). Trashed files are excluded by default. Drive query syntax examples: - By name: `name contains 'budget'` or `name = 'Q1 Report'` - By type: `mimeType = 'application/vnd.google-apps.spreadsheet'` (also: document, presentation, folder) - In folder: `'FOLDER_ID' in parents` - Recent: `modifiedTime > '2026-01-01'` - Shared with me: `sharedWithMe = true` - Starred: `starred = true` - By owner: `'[email protected]' in owners` - Combine: `name contains 'report' and mimeType = 'application/vnd.google-apps.spreadsheet'` |
google_drive.google_drive_share_file | Read | file_id, role, type, email, domain, notify | Share a Google Drive file or folder. Provide `fileId`, `role` ("reader", "writer", "commenter"), and one of: - `email`: share with a specific user (e.g., "[email protected]") - `domain`: share with an entire domain (e.g., "example.com") - `type` set to `"anyone"`: make accessible to anyone with the link (no email/domain needed) - `notify` (optional, default true): send email notification (only for email shares) |
google_drive.google_drive_unshare_file | Read | file_id, permission_id | Remove a permission from a Google Drive file or folder. Use google_drive_list_permissions first to find the permission ID. |
google_drive.google_drive_star | Read | file_id | Mark a file as starred/favorite in Google Drive. |
google_drive.google_drive_trash | Read | file_id | Move a file to trash in Google Drive (reversible). |
google_drive.google_drive_unstar | Read | file_id | Remove star from a file in Google Drive. |
google_drive.google_drive_untrash | Read | file_id | Restore a file from trash in Google Drive. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.