KosmoKrator

productivity

Google Drive CLI for AI Agents

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.

6 functions 4 read 2 write Manual OAuth token auth

Google Drive CLI Setup

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 --json
kosmokrator integrations:doctor google-drive --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
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.

kosmo integrations:call google-drive.gdrive_list_files '{
  "pageSize": 1,
  "pageToken": "example_pageToken",
  "q": "example_q",
  "spaces": "example_spaces",
  "trashed": true,
  "corpora": "example_corpora",
  "fields": "example_fields"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:google-drive gdrive_list_files '{
  "pageSize": 1,
  "pageToken": "example_pageToken",
  "q": "example_q",
  "spaces": "example_spaces",
  "trashed": true,
  "corpora": "example_corpora",
  "fields": "example_fields"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs google-drive --json
kosmo integrations:docs google-drive.gdrive_list_files --json
kosmo integrations:schema google-drive.gdrive_list_files --json
kosmo integrations:search "Google Drive" --json
kosmo integrations:list --json

All CLI Functions

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

Generic CLI call

kosmo integrations:call google-drive.gdrive_list_files '{"pageSize":1,"pageToken":"example_pageToken","q":"example_q","spaces":"example_spaces","trashed":true,"corpora":"example_corpora","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_list_files '{"pageSize":1,"pageToken":"example_pageToken","q":"example_q","spaces":"example_spaces","trashed":true,"corpora":"example_corpora","fields":"example_fields"}' --json

google-drive.gdrive_get_file

Read read

Get metadata for a specific file or folder in Google Drive by its ID. Returns properties like name, mimeType, size, createdTime, modifiedTime, and parents.

Parameters
fileId, fields

Generic CLI call

kosmo integrations:call google-drive.gdrive_get_file '{"fileId":"example_fileId","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_get_file '{"fileId":"example_fileId","fields":"example_fields"}' --json

google-drive.gdrive_create_file

Write write

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.

Parameters
name, mimeType, parents, description

Generic CLI call

kosmo integrations:call google-drive.gdrive_create_file '{"name":"example_name","mimeType":"example_mimeType","parents":"example_parents","description":"example_description"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_create_file '{"name":"example_name","mimeType":"example_mimeType","parents":"example_parents","description":"example_description"}' --json

google-drive.gdrive_create_folder

Write write

Create a new folder in Google Drive. Optionally specify a parent folder to nest it inside.

Parameters
name, parentId

Generic CLI call

kosmo integrations:call google-drive.gdrive_create_folder '{"name":"example_name","parentId":"example_parentId"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_create_folder '{"name":"example_name","parentId":"example_parentId"}' --json

google-drive.gdrive_list_changes

Read read

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.

Parameters
pageSize, pageToken, fields

Generic CLI call

kosmo integrations:call google-drive.gdrive_list_changes '{"pageSize":1,"pageToken":"example_pageToken","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_list_changes '{"pageSize":1,"pageToken":"example_pageToken","fields":"example_fields"}' --json

google-drive.gdrive_get_current_user

Read read

Get information about the authenticated Google Drive user, including display name, email address, and storage quota (usage, limit).

Parameters
fields

Generic CLI call

kosmo integrations:call google-drive.gdrive_get_current_user '{"fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:google-drive gdrive_get_current_user '{"fields":"example_fields"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

google-drive.gdrive_list_files

List files and folders in Google Drive. Supports search queries (q), pagination, spaces (drive, appDataFolder, photos), and trashed filtering.

Operation
Read read
Schema command
kosmo integrations:schema google-drive.gdrive_list_files --json
ParameterTypeRequiredDescription
pageSize integer no 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.

Operation
Read read
Schema command
kosmo integrations:schema google-drive.gdrive_get_file --json
ParameterTypeRequiredDescription
fileId string yes The ID of the file or folder.
fields string no 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.

Operation
Write write
Schema command
kosmo integrations:schema google-drive.gdrive_create_file --json
ParameterTypeRequiredDescription
name string yes The name of the file (e.g., "Report.pdf").
mimeType string no The MIME type of the file (e.g., "text/plain", "application/pdf"). If not set, Google Drive will try to auto-detect.
parents array no List of parent folder IDs to add the file to. If not specified, the file is placed in the root folder.
description string no A short description of the file.

google-drive.gdrive_create_folder

Create a new folder in Google Drive. Optionally specify a parent folder to nest it inside.

Operation
Write write
Schema command
kosmo integrations:schema google-drive.gdrive_create_folder --json
ParameterTypeRequiredDescription
name string yes The name of the new folder.
parentId string no 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.

Operation
Read read
Schema command
kosmo integrations:schema google-drive.gdrive_list_changes --json
ParameterTypeRequiredDescription
pageSize integer no Maximum number of changes to return per page (default: 100, max: 1000).
pageToken string no The token for continuing a previous list request. Use the startPageToken for the initial request.
fields string no Fields to include in the response. E.g., "changes(fileId,file(name,mimeType)),nextPageToken,newStartPageToken".

google-drive.gdrive_get_current_user

Get information about the authenticated Google Drive user, including display name, email address, and storage quota (usage, limit).

Operation
Read read
Schema command
kosmo integrations:schema google-drive.gdrive_get_current_user --json
ParameterTypeRequiredDescription
fields string no 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.