KosmoKrator

productivity

Google Apps Script Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.google_apps_script.*. Use lua_read_doc("integrations.google-apps-script") 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 Apps Script workflow without starting an interactive agent session.

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

Workflow file

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

workflow.lua
local google_apps_script = app.integrations.google_apps_script
local result = google_apps_script.projects_get_content({})

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_apps_script, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.google_apps_script.default.* or app.integrations.google_apps_script.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Google Apps Script, 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 Apps Script

Google Apps Script tools are exposed under app.integrations.google_apps_script. This package is generated from Google’s official Apps Script v1 Discovery document and exposes 16 REST methods.

Use it for automation workflows: create script projects, get and update source content, manage deployments and versions, inspect metrics and process history, and run deployed script functions.

Each method-specific tool accepts Discovery path parameters as top-level arguments, known query parameters as top-level shortcuts or inside query, and request resources inside body. Pass script IDs, deployment IDs, and version numbers exactly as returned by Apps Script or Drive.

Examples

local project = app.integrations.google_apps_script.google_apps_script_projects_get({
  scriptId = "script-id"
})

local content = app.integrations.google_apps_script.google_apps_script_projects_get_content({
  scriptId = "script-id"
})

local execution = app.integrations.google_apps_script.google_apps_script_scripts_run({
  scriptId = "script-id",
  body = {
    function = "main",
    parameters = { "argument" }
  }
})

Returned data is the parsed JSON response from the Apps Script API. Empty successful responses return { success = true, status = <http_status> }.

Apps Script execution uses the OAuth scopes required by the script itself. Project content and deployment operations require Apps Script API access and permissions on the target script project.

Raw agent markdown
# Google Apps Script

Google Apps Script tools are exposed under `app.integrations.google_apps_script`. This package is generated from Google's official Apps Script v1 Discovery document and exposes 16 REST methods.

Use it for automation workflows: create script projects, get and update source content, manage deployments and versions, inspect metrics and process history, and run deployed script functions.

Each method-specific tool accepts Discovery path parameters as top-level arguments, known query parameters as top-level shortcuts or inside `query`, and request resources inside `body`. Pass script IDs, deployment IDs, and version numbers exactly as returned by Apps Script or Drive.

## Examples

```lua
local project = app.integrations.google_apps_script.google_apps_script_projects_get({
  scriptId = "script-id"
})

local content = app.integrations.google_apps_script.google_apps_script_projects_get_content({
  scriptId = "script-id"
})

local execution = app.integrations.google_apps_script.google_apps_script_scripts_run({
  scriptId = "script-id",
  body = {
    function = "main",
    parameters = { "argument" }
  }
})
```

Returned data is the parsed JSON response from the Apps Script API. Empty successful responses return `{ success = true, status = <http_status> }`.

Apps Script execution uses the OAuth scopes required by the script itself. Project content and deployment operations require Apps Script API access and permissions on the target script project.
Metadata-derived Lua example
local result = app.integrations.google_apps_script.projects_get_content({})
print(result)

Functions

projects_get_content Read

Projects Get Content (GET /v1/projects/{scriptId}/content).

Lua path
app.integrations.google_apps_script.projects_get_content
Full name
google-apps-script.google_apps_script_projects_get_content
ParameterTypeRequiredDescription
No parameters.
projects_get Read

Projects Get (GET /v1/projects/{scriptId}).

Lua path
app.integrations.google_apps_script.projects_get
Full name
google-apps-script.google_apps_script_projects_get
ParameterTypeRequiredDescription
No parameters.
projects_create Write

Projects Create (POST /v1/projects).

Lua path
app.integrations.google_apps_script.projects_create
Full name
google-apps-script.google_apps_script_projects_create
ParameterTypeRequiredDescription
No parameters.
projects_update_content Write

Projects Update Content (PUT /v1/projects/{scriptId}/content).

Lua path
app.integrations.google_apps_script.projects_update_content
Full name
google-apps-script.google_apps_script_projects_update_content
ParameterTypeRequiredDescription
No parameters.
projects_get_metrics Read

Projects Get Metrics (GET /v1/projects/{scriptId}/metrics).

Lua path
app.integrations.google_apps_script.projects_get_metrics
Full name
google-apps-script.google_apps_script_projects_get_metrics
ParameterTypeRequiredDescription
No parameters.
projects_deployments_delete Write

Projects Deployments Delete (DELETE /v1/projects/{scriptId}/deployments/{deploymentId}).

Lua path
app.integrations.google_apps_script.projects_deployments_delete
Full name
google-apps-script.google_apps_script_projects_deployments_delete
ParameterTypeRequiredDescription
No parameters.
projects_deployments_create Write

Projects Deployments Create (POST /v1/projects/{scriptId}/deployments).

Lua path
app.integrations.google_apps_script.projects_deployments_create
Full name
google-apps-script.google_apps_script_projects_deployments_create
ParameterTypeRequiredDescription
No parameters.
projects_deployments_update Write

Projects Deployments Update (PUT /v1/projects/{scriptId}/deployments/{deploymentId}).

Lua path
app.integrations.google_apps_script.projects_deployments_update
Full name
google-apps-script.google_apps_script_projects_deployments_update
ParameterTypeRequiredDescription
No parameters.
projects_deployments_list Read

Projects Deployments List (GET /v1/projects/{scriptId}/deployments).

Lua path
app.integrations.google_apps_script.projects_deployments_list
Full name
google-apps-script.google_apps_script_projects_deployments_list
ParameterTypeRequiredDescription
No parameters.
projects_deployments_get Read

Projects Deployments Get (GET /v1/projects/{scriptId}/deployments/{deploymentId}).

Lua path
app.integrations.google_apps_script.projects_deployments_get
Full name
google-apps-script.google_apps_script_projects_deployments_get
ParameterTypeRequiredDescription
No parameters.
projects_versions_create Write

Projects Versions Create (POST /v1/projects/{scriptId}/versions).

Lua path
app.integrations.google_apps_script.projects_versions_create
Full name
google-apps-script.google_apps_script_projects_versions_create
ParameterTypeRequiredDescription
No parameters.
projects_versions_list Read

Projects Versions List (GET /v1/projects/{scriptId}/versions).

Lua path
app.integrations.google_apps_script.projects_versions_list
Full name
google-apps-script.google_apps_script_projects_versions_list
ParameterTypeRequiredDescription
No parameters.
projects_versions_get Read

Projects Versions Get (GET /v1/projects/{scriptId}/versions/{versionNumber}).

Lua path
app.integrations.google_apps_script.projects_versions_get
Full name
google-apps-script.google_apps_script_projects_versions_get
ParameterTypeRequiredDescription
No parameters.
processes_list_processes Read

Processes List Script Processes (GET /v1/processes:listScriptProcesses).

Lua path
app.integrations.google_apps_script.processes_list_processes
Full name
google-apps-script.google_apps_script_processes_list_script_processes
ParameterTypeRequiredDescription
No parameters.
processes_list Read

Processes List (GET /v1/processes).

Lua path
app.integrations.google_apps_script.processes_list
Full name
google-apps-script.google_apps_script_processes_list
ParameterTypeRequiredDescription
No parameters.
run Write

Scripts Run (POST /v1/scripts/{scriptId}:run).

Lua path
app.integrations.google_apps_script.run
Full name
google-apps-script.google_apps_script_scripts_run
ParameterTypeRequiredDescription
No parameters.