KosmoKrator

productivity

Google Calendar Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Manual OAuth token auth

Lua Namespace

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

Agent-Facing Lua Docs

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

Google Calendar — Lua API Reference

list_events

List events on a Google Calendar.

Parameters

NameTypeRequiredDescription
calendar_idstringyesCalendar identifier (use "primary" for the user’s main calendar)
timeMinstringnoLower bound for event start time (RFC 3339, e.g., "2026-04-06T00:00:00Z")
timeMaxstringnoUpper bound for event end time (RFC 3339, e.g., "2026-04-13T00:00:00Z")
maxResultsintegernoMaximum number of events to return (default: 250, max: 2500)
qstringnoFree text search to find events matching the query
orderBystringnoSort order: "startTime" (requires timeMin/timeMax) or "updated"

Examples

-- List events for the coming week
local result = app.integrations["google-calendar"].list_events({
  calendar_id = "primary",
  timeMin = "2026-04-06T00:00:00Z",
  timeMax = "2026-04-13T00:00:00Z",
  orderBy = "startTime"
})

for _, event in ipairs(result.items or {}) do
  print(event.summary .. " at " .. (event.start.dateTime or event.start.date))
end
-- Search for events matching a keyword
local result = app.integrations["google-calendar"].list_events({
  calendar_id = "primary",
  q = "standup"
})

get_event

Get details of a specific calendar event.

Parameters

NameTypeRequiredDescription
calendar_idstringyesCalendar identifier
event_idstringyesThe unique event identifier

Example

local event = app.integrations["google-calendar"].get_event({
  calendar_id = "primary",
  event_id = "abc123def456"
})
print(event.summary)
print(event.description or "")

create_event

Create a new event on a Google Calendar.

Parameters

NameTypeRequiredDescription
calendar_idstringyesCalendar identifier (use "primary" for the user’s main calendar)
summarystringyesTitle of the event
startobjectyesStart time: { dateTime = "...", timeZone = "..." } or { date = "2026-04-06" }
endobjectyesEnd time (same format as start)
descriptionstringnoDescription or notes (can contain HTML)
attendeesarraynoList of attendee objects: { { email = "[email protected]" } }
locationstringnoLocation text or video call URL

Examples

-- Create a timed event
local event = app.integrations["google-calendar"].create_event({
  calendar_id = "primary",
  summary = "Team Standup",
  start = {
    dateTime = "2026-04-06T10:00:00+02:00",
    timeZone = "Europe/Amsterdam"
  },
  ["end"] = {
    dateTime = "2026-04-06T10:30:00+02:00",
    timeZone = "Europe/Amsterdam"
  },
  description = "Daily team sync",
  attendees = {
    { email = "[email protected]" },
    { email = "[email protected]" }
  },
  location = "https://meet.google.com/abc-defg-hij"
})
print("Created event: " .. event.id)
-- Create an all-day event
local event = app.integrations["google-calendar"].create_event({
  calendar_id = "primary",
  summary = "Company Offsite",
  start = { date = "2026-04-10" },
  ["end"] = { date = "2026-04-12" }
})

list_calendars

List all calendars on the user’s account.

Parameters

NameTypeRequiredDescription
maxResultsintegernoMaximum number of calendars to return (default: 250)

Example

local result = app.integrations["google-calendar"].list_calendars()
for _, cal in ipairs(result.items or {}) do
  print(cal.id .. ": " .. cal.summary)
end

get_calendar

Get details of a specific calendar.

Parameters

NameTypeRequiredDescription
calendar_idstringyesCalendar identifier

Example

local cal = app.integrations["google-calendar"].get_calendar({
  calendar_id = "primary"
})
print(cal.summary .. " (" .. cal.timeZone .. ")")

list_colors

Get the available color definitions for events and calendars.

Parameters

None.

Example

local colors = app.integrations["google-calendar"].list_colors()
for id, color in pairs(colors.event or {}) do
  print("Event color " .. id .. ": " .. color.background)
end

get_current_user

Get the authenticated user’s profile information.

Parameters

None.

Example

local user = app.integrations["google-calendar"].get_current_user()
print("Connected as: " .. user.name .. " (" .. user.email .. ")")

Multi-Account Usage

If you have multiple Google Calendar accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations["google-calendar"].list_events({ calendar_id = "primary" })

-- Explicit default (portable across setups)
app.integrations["google-calendar"].default.list_events({ calendar_id = "primary" })

-- Named accounts
app.integrations["google-calendar"].work.list_events({ calendar_id = "primary" })
app.integrations["google-calendar"].personal.list_events({ calendar_id = "primary" })

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Google Calendar — Lua API Reference

## list_events

List events on a Google Calendar.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendar_id` | string | yes | Calendar identifier (use `"primary"` for the user's main calendar) |
| `timeMin` | string | no | Lower bound for event start time (RFC 3339, e.g., `"2026-04-06T00:00:00Z"`) |
| `timeMax` | string | no | Upper bound for event end time (RFC 3339, e.g., `"2026-04-13T00:00:00Z"`) |
| `maxResults` | integer | no | Maximum number of events to return (default: 250, max: 2500) |
| `q` | string | no | Free text search to find events matching the query |
| `orderBy` | string | no | Sort order: `"startTime"` (requires timeMin/timeMax) or `"updated"` |

### Examples

```lua
-- List events for the coming week
local result = app.integrations["google-calendar"].list_events({
  calendar_id = "primary",
  timeMin = "2026-04-06T00:00:00Z",
  timeMax = "2026-04-13T00:00:00Z",
  orderBy = "startTime"
})

for _, event in ipairs(result.items or {}) do
  print(event.summary .. " at " .. (event.start.dateTime or event.start.date))
end
```

```lua
-- Search for events matching a keyword
local result = app.integrations["google-calendar"].list_events({
  calendar_id = "primary",
  q = "standup"
})
```

---

## get_event

Get details of a specific calendar event.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendar_id` | string | yes | Calendar identifier |
| `event_id` | string | yes | The unique event identifier |

### Example

```lua
local event = app.integrations["google-calendar"].get_event({
  calendar_id = "primary",
  event_id = "abc123def456"
})
print(event.summary)
print(event.description or "")
```

---

## create_event

Create a new event on a Google Calendar.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendar_id` | string | yes | Calendar identifier (use `"primary"` for the user's main calendar) |
| `summary` | string | yes | Title of the event |
| `start` | object | yes | Start time: `{ dateTime = "...", timeZone = "..." }` or `{ date = "2026-04-06" }` |
| `end` | object | yes | End time (same format as start) |
| `description` | string | no | Description or notes (can contain HTML) |
| `attendees` | array | no | List of attendee objects: `{ { email = "[email protected]" } }` |
| `location` | string | no | Location text or video call URL |

### Examples

```lua
-- Create a timed event
local event = app.integrations["google-calendar"].create_event({
  calendar_id = "primary",
  summary = "Team Standup",
  start = {
    dateTime = "2026-04-06T10:00:00+02:00",
    timeZone = "Europe/Amsterdam"
  },
  ["end"] = {
    dateTime = "2026-04-06T10:30:00+02:00",
    timeZone = "Europe/Amsterdam"
  },
  description = "Daily team sync",
  attendees = {
    { email = "[email protected]" },
    { email = "[email protected]" }
  },
  location = "https://meet.google.com/abc-defg-hij"
})
print("Created event: " .. event.id)
```

```lua
-- Create an all-day event
local event = app.integrations["google-calendar"].create_event({
  calendar_id = "primary",
  summary = "Company Offsite",
  start = { date = "2026-04-10" },
  ["end"] = { date = "2026-04-12" }
})
```

---

## list_calendars

List all calendars on the user's account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `maxResults` | integer | no | Maximum number of calendars to return (default: 250) |

### Example

```lua
local result = app.integrations["google-calendar"].list_calendars()
for _, cal in ipairs(result.items or {}) do
  print(cal.id .. ": " .. cal.summary)
end
```

---

## get_calendar

Get details of a specific calendar.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendar_id` | string | yes | Calendar identifier |

### Example

```lua
local cal = app.integrations["google-calendar"].get_calendar({
  calendar_id = "primary"
})
print(cal.summary .. " (" .. cal.timeZone .. ")")
```

---

## list_colors

Get the available color definitions for events and calendars.

### Parameters

None.

### Example

```lua
local colors = app.integrations["google-calendar"].list_colors()
for id, color in pairs(colors.event or {}) do
  print("Event color " .. id .. ": " .. color.background)
end
```

---

## get_current_user

Get the authenticated user's profile information.

### Parameters

None.

### Example

```lua
local user = app.integrations["google-calendar"].get_current_user()
print("Connected as: " .. user.name .. " (" .. user.email .. ")")
```

---

## Multi-Account Usage

If you have multiple Google Calendar accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations["google-calendar"].list_events({ calendar_id = "primary" })

-- Explicit default (portable across setups)
app.integrations["google-calendar"].default.list_events({ calendar_id = "primary" })

-- Named accounts
app.integrations["google-calendar"].work.list_events({ calendar_id = "primary" })
app.integrations["google-calendar"].personal.list_events({ calendar_id = "primary" })
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.google_calendar.gcalendar_list_events({
  calendar_id = "example_calendar_id",
  timeMin = "example_timeMin",
  timeMax = "example_timeMax",
  maxResults = 1,
  q = "example_q",
  orderBy = "example_orderBy"
})
print(result)

Functions

gcalendar_list_events

List events on a Google Calendar. Returns events within a specified time range. Use "primary" as the calendar ID for the user's main calendar.

Operation
Read read
Full name
google-calendar.gcalendar_list_events
ParameterTypeRequiredDescription
calendar_id string yes Calendar identifier (use "primary" for the user's main calendar, or a specific calendar ID).
timeMin string no Lower bound (exclusive) for event start time, as an RFC 3339 timestamp (e.g., "2026-04-06T00:00:00Z").
timeMax string no Upper bound (exclusive) for event end time, as an RFC 3339 timestamp (e.g., "2026-04-13T00:00:00Z").
maxResults integer no Maximum number of events to return (default: 250, max: 2500).
q string no Free text search to find events matching the query string.
orderBy string no Sort order: "startTime" (requires timeMin/timeMax) or "updated".

gcalendar_get_event

Get details of a specific event on a Google Calendar. Returns the full event resource including summary, description, attendees, and timing.

Operation
Read read
Full name
google-calendar.gcalendar_get_event
ParameterTypeRequiredDescription
calendar_id string yes Calendar identifier (use "primary" for the user's main calendar).
event_id string yes The unique identifier of the event.

gcalendar_create_event

Create a new event on a Google Calendar. Requires at minimum a summary, start time, and end time. Supports adding attendees, location, and description.

Operation
Write write
Full name
google-calendar.gcalendar_create_event
ParameterTypeRequiredDescription
calendar_id string yes Calendar identifier (use "primary" for the user's main calendar).
summary string yes Title of the event (e.g., "Team Standup").
start object yes Start time of the event. An object with "dateTime" (RFC 3339) and "timeZone" (e.g., {"dateTime": "2026-04-06T10:00:00+02:00", "timeZone": "Europe/Amsterdam"}). For all-day events use "date" instead of "dateTime".
end object yes End time of the event. Same format as start. Must be after the start time.
description string no Description or notes for the event. Can contain HTML.
attendees array no List of attendee email objects, e.g., [{"email": "[email protected]"}].
location string no Location of the event (e.g., "Conference Room A" or a video call URL).

gcalendar_list_calendars

List all calendars on the user's Google Calendar account. Returns calendar IDs, summaries, and metadata for each calendar.

Operation
Read read
Full name
google-calendar.gcalendar_list_calendars
ParameterTypeRequiredDescription
maxResults integer no Maximum number of calendars to return (default: 250, max: 2500).

gcalendar_get_calendar

Get details of a specific Google Calendar by its ID. Returns the calendar resource including summary, description, time zone, and access settings.

Operation
Read read
Full name
google-calendar.gcalendar_get_calendar
ParameterTypeRequiredDescription
calendar_id string yes Calendar identifier (use "primary" for the user's main calendar, or a specific calendar email/ID).

gcalendar_list_colors

Get the available color definitions for Google Calendar events and calendars. Returns color palettes that can be used when creating or updating events and calendars.

Operation
Read read
Full name
google-calendar.gcalendar_list_colors
ParameterTypeRequiredDescription
No parameters.

gcalendar_get_current_user

Get the authenticated Google user's profile information, including name, email, and profile picture. Useful for verifying the connected account.

Operation
Read read
Full name
google-calendar.gcalendar_get_current_user
ParameterTypeRequiredDescription
No parameters.