productivity
Google Docs CLI for Headless Automation
Use the Google Docs CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
14 functions 11 read 3 write OAuth browser flow auth
Google Docs 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 Docs CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Google Docs CLI for Headless Automation
kosmokrator integrations:configure google_docs --set access_token="$GOOGLE_DOCS_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call google_docs.google_docs_add_bullets '{"document_id":"example_document_id","start_index":1,"end_index":1,"preset":"example_preset"}' --json Discovery Before Execution
Agents and scripts can inspect Google Docs docs and schemas before choosing a function.
kosmo integrations:docs google_docs --json
kosmo integrations:docs google_docs.google_docs_add_bullets --json
kosmo integrations:schema google_docs.google_docs_add_bullets --json
kosmo integrations:search "Google Docs" --json
kosmo integrations:list --json Useful Google Docs CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
google_docs.google_docs_add_bullets | Write | document_id, start_index, end_index, preset | 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. |
google_docs.google_docs_create | Read | title | Create a new blank Google Docs document. Returns the document ID and URL. |
google_docs.google_docs_delete_range | Write | document_id, start_index, end_index | Delete content in a Google Docs document by index range. Use google_docs_get_structure first to find the correct indexes. |
google_docs.google_docs_format_text | Read | document_id, start_index, end_index, bold, italic, underline, strikethrough, font_size, font_family, foreground_color, link | 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). |
google_docs.google_docs_get | Read | document_id, format | 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 |
google_docs.google_docs_get_structure | Read | document_id | 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 |
google_docs.google_docs_insert_image | Read | document_id, image_url, index, width, height | Insert an image from a URL into a Google Docs document. Supports PNG, JPEG, and GIF. Optionally specify width and height in points. |
google_docs.google_docs_insert_page_break | Read | document_id, index | Insert a page break into a Google Docs document. Omit index or set to -1 to insert at end. |
google_docs.google_docs_insert_table | Read | document_id, rows, columns, index | Insert a table into a Google Docs document. Specify rows and columns. Omit index or set to -1 to insert at end. |
google_docs.google_docs_insert_text | Read | document_id, text, index | Insert text into a Google Docs document at a specific position or at the end. Omit index or set to -1 to append at end. |
google_docs.google_docs_remove_bullets | Write | document_id, start_index, end_index | Remove bullet or numbered list formatting from a range in a Google Docs document. |
google_docs.google_docs_replace_all | Read | document_id, find, replace, match_case | Find and replace all occurrences of text in a Google Docs document. No indexes needed — this is the simplest way to edit text. |
google_docs.google_docs_search_text | Read | document_id, query, match_case | 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 |
google_docs.google_docs_set_heading | Read | document_id, start_index, end_index, style | Set paragraph style (heading level) for a range in a Google Docs document. Valid styles: HEADING_1 through HEADING_6, TITLE, SUBTITLE, NORMAL_TEXT. |
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.