Use the Google Docs CLI from KosmoKrator to call Google Docs tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Google Docs can be configured headlessly with `kosmokrator integrations:configure google-docs`.
# 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-docs --set access_token="$GOOGLE_DOCS_ACCESS_TOKEN" --enable --read allow --write ask --jsonkosmokrator integrations:doctor google-docs --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_DOCS_ACCESS_TOKEN
Secret secret
yes
Access Token
url
GOOGLE_DOCS_URL
URL url
no
Docs API URL
Call Google Docs 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 Docs.
google-docs.gdocs_list_documents
Read read
List Google Docs documents visible to the authenticated user. Returns document IDs, names, owners, and modification times. Supports pagination and custom Drive API query filters.
Get the full content and structure of a Google Docs document by its ID. Returns the document title, body content (paragraphs, text runs), and styling information.
Send batch update requests to a Google Docs document. Supports inserting text, updating text styles, creating paragraphs, and other document modifications. Each request in the array is a Google Docs API request object.
List all permissions (sharing settings) for a Google Docs document. Returns who has access, their roles (owner, writer, reader), and their email addresses.
Get the authenticated Google user's profile information. Returns user ID, email address, display name, and profile picture URL. Use this to verify which Google account is being used.
Use these parameter tables when building CLI payloads without calling integrations:schema first.
google-docs.gdocs_list_documents
List Google Docs documents visible to the authenticated user. Returns document IDs, names, owners, and modification times. Supports pagination and custom Drive API query filters.
Maximum number of documents to return per page (default: 100, max: 1000).
pageToken
string
no
Token for the next page of results, from a previous response.
q
string
no
Drive API query string for filtering. Defaults to mimeType="application/vnd.google-apps.document". Example: "name contains 'report' and modifiedTime > '2025-01-01'".
google-docs.gdocs_get_document
Get the full content and structure of a Google Docs document by its ID. Returns the document title, body content (paragraphs, text runs), and styling information.
Send batch update requests to a Google Docs document. Supports inserting text, updating text styles, creating paragraphs, and other document modifications. Each request in the array is a Google Docs API request object.
Array of Google Docs API request objects. Each request is an object with one key (e.g., insertText, updateTextStyle, createParagraphBullets). See Google Docs API reference for all request types.
google-docs.gdocs_list_permissions
List all permissions (sharing settings) for a Google Docs document. Returns who has access, their roles (owner, writer, reader), and their email addresses.
The ID of the permission to retrieve. Obtain this from gdocs_list_permissions.
google-docs.gdocs_get_current_user
Get the authenticated Google user's profile information. Returns user ID, email address, display name, and profile picture URL. Use this to verify which Google account is being used.
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.