KosmoKrator

productivity

Google Docs Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Google Docs KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.google_docs.*. Use lua_read_doc("integrations.google-docs") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic Google Docs workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.google_docs.documents_get({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("google-docs"))' --json
kosmo integrations:lua --eval 'print(docs.read("google-docs.documents_get"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local google_docs = app.integrations.google_docs
local result = google_docs.documents_get({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.google_docs, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.google_docs.default.* or app.integrations.google_docs.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Google Docs, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Google Docs

Google Docs tools are exposed under app.integrations.google_docs. This package is generated from Google’s official Docs API v1 Discovery document and exposes 3 REST methods.

Coverage

  • Source: https://docs.googleapis.com/$discovery/rest?version=v1
  • Read tools: 1
  • Write tools: 2
  • Base URL: https://docs.googleapis.com

Usage Notes

Pass documentId path parameters as top-level arguments. Query parameters can be passed as top-level shortcuts or inside query. Create and batch update methods accept the official JSON request object inside body.

The Docs API does not list documents or manage permissions; use the Google Drive integration for file discovery and ACL operations.

Tools

  • google_docs_documents_get - GET /v1/documents/{documentId}
  • google_docs_documents_batch_update - POST /v1/documents/{documentId}:batchUpdate
  • google_docs_documents_create - POST /v1/documents

Examples

local doc = app.integrations.google_docs.google_docs_documents_get({ documentId = "1AbC..." })

local result = app.integrations.google_docs.google_docs_documents_batch_update({
  documentId = "1AbC...",
  body = { requests = { { insertText = { location = { index = 1 }, text = "Hello" } } } }
})

Responses are decoded Google Docs JSON responses.

Raw agent markdown
# Google Docs

Google Docs tools are exposed under `app.integrations.google_docs`. This package is generated from Google's official Docs API v1 Discovery document and exposes 3 REST methods.

## Coverage

- Source: `https://docs.googleapis.com/$discovery/rest?version=v1`
- Read tools: 1
- Write tools: 2
- Base URL: `https://docs.googleapis.com`

## Usage Notes

Pass `documentId` path parameters as top-level arguments. Query parameters can be passed as top-level shortcuts or inside `query`. Create and batch update methods accept the official JSON request object inside `body`.

The Docs API does not list documents or manage permissions; use the Google Drive integration for file discovery and ACL operations.

## Tools

- `google_docs_documents_get` - GET /v1/documents/{documentId}
- `google_docs_documents_batch_update` - POST /v1/documents/{documentId}:batchUpdate
- `google_docs_documents_create` - POST /v1/documents

## Examples

```lua
local doc = app.integrations.google_docs.google_docs_documents_get({ documentId = "1AbC..." })

local result = app.integrations.google_docs.google_docs_documents_batch_update({
  documentId = "1AbC...",
  body = { requests = { { insertText = { location = { index = 1 }, text = "Hello" } } } }
})
```

Responses are decoded Google Docs JSON responses.
Metadata-derived Lua example
local result = app.integrations.google_docs.documents_get({})
print(result)

Functions

documents_get Read

Documents Get (GET /v1/documents/{documentId}).

Lua path
app.integrations.google_docs.documents_get
Full name
google-docs.google_docs_documents_get
ParameterTypeRequiredDescription
No parameters.
documents_batch_update Write

Documents Batch Update (POST /v1/documents/{documentId}:batchUpdate).

Lua path
app.integrations.google_docs.documents_batch_update
Full name
google-docs.google_docs_documents_batch_update
ParameterTypeRequiredDescription
No parameters.
documents_create Write

Documents Create (POST /v1/documents).

Lua path
app.integrations.google_docs.documents_create
Full name
google-docs.google_docs_documents_create
ParameterTypeRequiredDescription
No parameters.