Use the Google Drive CLI from KosmoKrator to call Google Drive tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Google Drive can be configured headlessly with `kosmokrator integrations:configure google-drive`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure google-drive --set access_token="$GOOGLE_DRIVE_ACCESS_TOKEN" --enable --read allow --write ask --jsonkosmokrator integrations:doctor google-drive --jsonkosmokrator integrations:status --json
Credentials
Authentication type: Manual OAuth tokenoauth2_manual_token. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
access_token
GOOGLE_DRIVE_ACCESS_TOKEN
Secret secret
yes
Access Token
url
GOOGLE_DRIVE_URL
URL url
no
API Base URL
Call Google Drive Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Google Drive.
google-drive.gdrive_list_files
Read read
List files and folders in Google Drive. Supports search queries (q), pagination, spaces (drive, appDataFolder, photos), and trashed filtering.
Parameters
pageSize, pageToken, q, spaces, trashed, corpora, fields
Get metadata for a specific file or folder in Google Drive by its ID. Returns properties like name, mimeType, size, createdTime, modifiedTime, and parents.
Create a new file in Google Drive. Creates the file metadata (name, mimeType, parent folder). For simple file creation without content upload, use uploadType "resumable" or "multipart" via the Google Drive API directly.
List changes to files and folders in Google Drive. Use pageToken from the initial startPageToken to begin tracking, then pass the returned next page token for subsequent requests.
Maximum number of files to return per page (default: 100, max: 1000).
pageToken
string
no
Token for the next page of results, from a previous list response.
q
string
no
Query string for filtering files. E.g., "mimeType = 'application/vnd.google-apps.folder'" to list only folders, or "name contains 'report'" to search by name.
spaces
string
no
Comma-separated list of spaces to query: "drive", "appDataFolder", "photos". Defaults to "drive".
trashed
boolean
no
Whether to include trashed files. Set to true to only show trashed files, false to exclude them.
corpora
string
no
Source of files to list: "user" (default), "domain", "allDrives", or "drive". Use "drive" with driveId parameter.
fields
string
no
Fields to include in the response (partial response). E.g., "files(id,name,mimeType,modifiedTime)".
google-drive.gdrive_get_file
Get metadata for a specific file or folder in Google Drive by its ID. Returns properties like name, mimeType, size, createdTime, modifiedTime, and parents.
Fields to include in the response. E.g., "id,name,mimeType,size,modifiedTime,parents,webContentLink,webViewLink". Defaults to all fields.
google-drive.gdrive_create_file
Create a new file in Google Drive. Creates the file metadata (name, mimeType, parent folder). For simple file creation without content upload, use uploadType "resumable" or "multipart" via the Google Drive API directly.
ID of the parent folder. If omitted, the folder is created in the root of Google Drive.
google-drive.gdrive_list_changes
List changes to files and folders in Google Drive. Use pageToken from the initial startPageToken to begin tracking, then pass the returned next page token for subsequent requests.
Fields to include in the response. Defaults to "user,storageQuota".
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.