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: OAuth browser flowoauth2_authorization_code. 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
OAuth token oauth
yes
Google Account
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.google_docs_add_bullets
Write write
Add bullet or numbered list formatting to a range in a Google Docs document. Default preset is BULLET_DISC_CIRCLE_SQUARE. Use NUMBERED_DECIMAL_ALPHA_ROMAN for numbered lists.
Apply formatting to a text range in a Google Docs document. Supports bold, italic, underline, strikethrough, fontSize (points), fontFamily, foregroundColor (hex like "#FF0000"), and link (URL).
Get the content of a Google Docs document. Returns plain text by default, or a structured outline with character indexes when format is "structured". The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
Get a simplified structure of a Google Docs document showing heading hierarchy, paragraph indexes, and table positions. Essential before performing index-based editing operations. The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
Find all occurrences of text in a Google Docs document with their start/end indexes. Useful before format_text or delete_range operations. The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
Use these parameter tables when building CLI payloads without calling integrations:schema first.
google_docs.google_docs_add_bullets
Add bullet or numbered list formatting to a range in a Google Docs document. Default preset is BULLET_DISC_CIRCLE_SQUARE. Use NUMBERED_DECIMAL_ALPHA_ROMAN for numbered lists.
Apply formatting to a text range in a Google Docs document. Supports bold, italic, underline, strikethrough, fontSize (points), fontFamily, foregroundColor (hex like "#FF0000"), and link (URL).
Get the content of a Google Docs document. Returns plain text by default, or a structured outline with character indexes when format is "structured". The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
"text" (default, plain text) or "structured" (outline with character indexes for editing).
google_docs.google_docs_get_structure
Get a simplified structure of a Google Docs document showing heading hierarchy, paragraph indexes, and table positions. Essential before performing index-based editing operations. The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
Find all occurrences of text in a Google Docs document with their start/end indexes. Useful before format_text or delete_range operations. The document ID is the long string in the URL: docs.google.com/document/d/{documentId}/edit
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.