KosmoKrator

productivity

Google Drive Activity Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.google_drive_activity.*. Use lua_read_doc("integrations.google-drive-activity") 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 Drive Activity workflow without starting an interactive agent session.

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

Workflow file

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

workflow.lua
local google_drive_activity = app.integrations.google_drive_activity
local result = google_drive_activity.query({})

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

MCP-only Lua

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

Google Drive Activity tools are exposed under app.integrations.google_drive_activity. Google’s Drive Activity v2 REST API currently exposes one method, activity.query, so this package focuses on making that request shape reliable and easy for agents to use.

Use it to inspect audit and activity history for Drive files, folders, shared drives, or ancestors.

Example

local activity = app.integrations.google_drive_activity.google_drive_activity_activity_query({
  item_name = "items/file-id",
  page_size = 10,
  filter = 'time >= "2026-01-01T00:00:00Z"',
  consolidation_strategy = {
    legacy = {}
  }
})

Use ancestor_name = "items/folder-id" to query activity under a folder or shared drive ancestor. Use page_token with the response nextPageToken to continue a long result set.

The tool accepts first-class snake_case arguments for the common QueryDriveActivityRequest fields and sends Google’s expected camelCase body fields:

  • item_name -> itemName
  • ancestor_name -> ancestorName
  • page_size -> pageSize
  • page_token -> pageToken
  • filter -> filter
  • consolidation_strategy -> consolidationStrategy

For less common or newly added request fields, pass a body object using Google’s exact schema. First-class arguments override matching fields in body.

Returned data is the parsed JSON response from the Drive Activity API, normally an activities array and optional nextPageToken.

Raw agent markdown
# Google Drive Activity

Google Drive Activity tools are exposed under `app.integrations.google_drive_activity`. Google's Drive Activity v2 REST API currently exposes one method, `activity.query`, so this package focuses on making that request shape reliable and easy for agents to use.

Use it to inspect audit and activity history for Drive files, folders, shared drives, or ancestors.

## Example

```lua
local activity = app.integrations.google_drive_activity.google_drive_activity_activity_query({
  item_name = "items/file-id",
  page_size = 10,
  filter = 'time >= "2026-01-01T00:00:00Z"',
  consolidation_strategy = {
    legacy = {}
  }
})
```

Use `ancestor_name = "items/folder-id"` to query activity under a folder or shared drive ancestor. Use `page_token` with the response `nextPageToken` to continue a long result set.

The tool accepts first-class snake_case arguments for the common QueryDriveActivityRequest fields and sends Google's expected camelCase body fields:

- `item_name` -> `itemName`
- `ancestor_name` -> `ancestorName`
- `page_size` -> `pageSize`
- `page_token` -> `pageToken`
- `filter` -> `filter`
- `consolidation_strategy` -> `consolidationStrategy`

For less common or newly added request fields, pass a `body` object using Google's exact schema. First-class arguments override matching fields in `body`.

Returned data is the parsed JSON response from the Drive Activity API, normally an `activities` array and optional `nextPageToken`.
Metadata-derived Lua example
local result = app.integrations.google_drive_activity.query({})
print(result)

Functions

query Write

Activity Query (POST /v2/activity:query).

Lua path
app.integrations.google_drive_activity.query
Full name
google-drive-activity.google_drive_activity_activity_query
ParameterTypeRequiredDescription
No parameters.