KosmoKrator

productivity

Cal.com Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Cal.com KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.cal.*. Use lua_read_doc("integrations.cal") 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 Cal.com workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.cal.list_event_types({limit = 1, page = 1, team_id = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("cal"))' --json
kosmo integrations:lua --eval 'print(docs.read("cal.list_event_types"))' --json

Workflow file

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

workflow.lua
local cal = app.integrations.cal
local result = cal.list_event_types({limit = 1, page = 1, team_id = 1})

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

MCP-only Lua

If the script only needs configured MCP servers and does not need Cal.com, 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.

Cal.com Lua Reference

Namespace: cal

Cal.com tools target API v2. Tokens can be Cal.com API keys prefixed with cal_, managed-user access tokens, or OAuth access tokens.

Core Tools

local event_types = app.integrations.cal.list_event_types({ limit = 20 })
local event_type = app.integrations.cal.get_event_type({ id = 123 })
local bookings = app.integrations.cal.list_bookings({ status = "upcoming" })
local booking = app.integrations.cal.get_booking({ id = "booking_uid_or_id" })
local me = app.integrations.cal.get_current_user({})

Booking writes:

local created = app.integrations.cal.create_booking({
  event_type_id = 123,
  start = "2026-05-07T10:00:00Z",
  end = "2026-05-07T10:30:00Z",
  responses = {
    name = "Jane Example",
    email = "jane@example.test",
  },
})

local cancelled = app.integrations.cal.cancel_booking({
  booking_uid = "booking_uid",
  body = { cancellationReason = "No longer needed" },
})

local rescheduled = app.integrations.cal.reschedule_booking({
  booking_uid = "booking_uid",
  body = { start = "2026-05-08T10:00:00Z" },
})

Dedicated tools use snake_case parameters. Generic API tools pass bodies and query parameters through to Cal.com, so use Cal.com’s field names there.

Generic API

Use generic tools for Cal.com v2 endpoints without dedicated wrappers:

local slots = app.integrations.cal.api_get({
  path = "/slots",
  params = {
    eventTypeId = 123,
    start = "2026-05-07T00:00:00Z",
    end = "2026-05-08T00:00:00Z",
  },
})

local result = app.integrations.cal.api_post({
  path = "/bookings",
  body = {
    eventTypeId = 123,
    start = "2026-05-07T10:00:00Z",
    responses = { name = "Jane Example", email = "jane@example.test" },
  },
})

Generic write tools:

  • api_post({ path, body })
  • api_patch({ path, body })
  • api_delete({ path, body })

Multi-Account Usage

app.integrations.cal.default.list_bookings({})
app.integrations.cal.work.api_get({ path = "/me" })
Raw agent markdown
# Cal.com Lua Reference

Namespace: `cal`

Cal.com tools target API v2. Tokens can be Cal.com API keys prefixed with
`cal_`, managed-user access tokens, or OAuth access tokens.

## Core Tools

```lua
local event_types = app.integrations.cal.list_event_types({ limit = 20 })
local event_type = app.integrations.cal.get_event_type({ id = 123 })
local bookings = app.integrations.cal.list_bookings({ status = "upcoming" })
local booking = app.integrations.cal.get_booking({ id = "booking_uid_or_id" })
local me = app.integrations.cal.get_current_user({})
```

Booking writes:

```lua
local created = app.integrations.cal.create_booking({
  event_type_id = 123,
  start = "2026-05-07T10:00:00Z",
  end = "2026-05-07T10:30:00Z",
  responses = {
    name = "Jane Example",
    email = "jane@example.test",
  },
})

local cancelled = app.integrations.cal.cancel_booking({
  booking_uid = "booking_uid",
  body = { cancellationReason = "No longer needed" },
})

local rescheduled = app.integrations.cal.reschedule_booking({
  booking_uid = "booking_uid",
  body = { start = "2026-05-08T10:00:00Z" },
})
```

Dedicated tools use snake_case parameters. Generic API tools pass bodies and
query parameters through to Cal.com, so use Cal.com's field names there.

## Generic API

Use generic tools for Cal.com v2 endpoints without dedicated wrappers:

```lua
local slots = app.integrations.cal.api_get({
  path = "/slots",
  params = {
    eventTypeId = 123,
    start = "2026-05-07T00:00:00Z",
    end = "2026-05-08T00:00:00Z",
  },
})

local result = app.integrations.cal.api_post({
  path = "/bookings",
  body = {
    eventTypeId = 123,
    start = "2026-05-07T10:00:00Z",
    responses = { name = "Jane Example", email = "jane@example.test" },
  },
})
```

Generic write tools:

- `api_post({ path, body })`
- `api_patch({ path, body })`
- `api_delete({ path, body })`

## Multi-Account Usage

```lua
app.integrations.cal.default.list_bookings({})
app.integrations.cal.work.api_get({ path = "/me" })
```
Metadata-derived Lua example
local result = app.integrations.cal.list_event_types({limit = 1, page = 1, team_id = 1})
print(result)

Functions

list_event_types Read

List available event types (booking link templates) from Cal.com. Supports filtering by team and pagination.

Lua path
app.integrations.cal.list_event_types
Full name
cal.cal_list_event_types
ParameterTypeRequiredDescription
limit integer no Maximum number of event types to return per page.
page integer no Page number for pagination (starts at 1).
team_id integer no Filter event types belonging to a specific team by its ID.
get_event_type Read

Get detailed information about a specific event type from Cal.com by its ID.

Lua path
app.integrations.cal.get_event_type
Full name
cal.cal_get_event_type
ParameterTypeRequiredDescription
id integer yes The event type ID.
list_bookings Read

List bookings from Cal.com with optional filtering by status, event type, and pagination.

Lua path
app.integrations.cal.list_bookings
Full name
cal.cal_list_bookings
ParameterTypeRequiredDescription
limit integer no Maximum number of bookings to return per page.
page integer no Page number for pagination (starts at 1).
status string no Filter by booking status: "confirmed", "pending", "cancelled", or "rejected".
event_type_id integer no Filter bookings for a specific event type by its ID.
get_booking Read

Get detailed information about a specific booking from Cal.com by its ID or UID.

Lua path
app.integrations.cal.get_booking
Full name
cal.cal_get_booking
ParameterTypeRequiredDescription
id string yes The booking ID or UID.
create_booking Write

Create a new booking in Cal.com for a specific event type. Provide the event type, start/end times, and attendee information.

Lua path
app.integrations.cal.create_booking
Full name
cal.cal_create_booking
ParameterTypeRequiredDescription
event_type_id integer yes The event type ID to book.
start string yes Start time in ISO 8601 format (e.g., "2026-04-10T09:00:00Z").
end string yes End time in ISO 8601 format (e.g., "2026-04-10T09:30:00Z").
responses object yes Attendee responses. Must include "name" and "email". Example: {"name": "Jane Example", "email": "jane@example.test", "notes": "Optional notes."}.
cancel_booking Write

Cancel a Cal.com booking by booking UID.

Lua path
app.integrations.cal.cancel_booking
Full name
cal.cal_cancel_booking
ParameterTypeRequiredDescription
booking_uid string yes Booking UID.
body object no Optional cancellation payload such as reason.
reschedule_booking Write

Reschedule a Cal.com booking by booking UID.

Lua path
app.integrations.cal.reschedule_booking
Full name
cal.cal_reschedule_booking
ParameterTypeRequiredDescription
booking_uid string yes Booking UID.
body object yes Reschedule payload, usually including start and related booking fields.
get_current_user Read

Get the authenticated Cal.com user's profile information, including name, email, and time zone.

Lua path
app.integrations.cal.get_current_user
Full name
cal.cal_get_current_user
ParameterTypeRequiredDescription
No parameters.
api_get Read

Call any Cal.com v2 GET API endpoint.

Lua path
app.integrations.cal.api_get
Full name
cal.cal_api_get
ParameterTypeRequiredDescription
path string yes API path such as /bookings or /slots.
params object no Query parameters.
api_post Write

Call any Cal.com v2 POST API endpoint.

Lua path
app.integrations.cal.api_post
Full name
cal.cal_api_post
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.
api_patch Write

Call any Cal.com v2 PATCH API endpoint.

Lua path
app.integrations.cal.api_patch
Full name
cal.cal_api_patch
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.
api_delete Write

Call any Cal.com v2 DELETE API endpoint.

Lua path
app.integrations.cal.api_delete
Full name
cal.cal_api_delete
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.