KosmoKrator

productivity

Microsoft To Do Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Microsoft To Do KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.microsoft_todo.*. Use lua_read_doc("integrations.microsoft-todo") 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 Microsoft To Do workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.microsoft_todo.list_lists({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("microsoft-todo"))' --json
kosmo integrations:lua --eval 'print(docs.read("microsoft-todo.list_lists"))' --json

Workflow file

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

workflow.lua
local microsoft_todo = app.integrations.microsoft_todo
local result = microsoft_todo.list_lists({})

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

MCP-only Lua

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

Microsoft To Do — Lua API Reference

list_lists

List all Microsoft To Do task lists for the authenticated user.

Parameters

None.

Response

Returns an object with lists (array) and count (number).

Each list contains:

  • id — unique list identifier
  • displayName — the list name
  • wellknownListName — e.g. "defaultList", "none"
  • isOwner — whether the user owns the list
  • isShared — whether the list is shared

Example

local result = app.integrations["microsoft-todo"].todo_list_lists({})

for _, list in ipairs(result.lists) do
  print(list.displayName .. " (" .. list.id .. ")")
end

get_list

Get a specific Microsoft To Do task list by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe unique identifier of the task list

Example

local result = app.integrations["microsoft-todo"].todo_get_list({
  id = "AQMkAGI1NzQz..."
})

print(result.displayName)

create_list

Create a new Microsoft To Do task list.

Parameters

NameTypeRequiredDescription
display_namestringyesThe name of the new task list

Example

local result = app.integrations["microsoft-todo"].todo_create_list({
  display_name = "Work Tasks"
})

print("Created list: " .. result.displayName .. " (ID: " .. result.id .. ")")

list_tasks

List all tasks in a Microsoft To Do task list.

Parameters

NameTypeRequiredDescription
list_idstringyesThe unique identifier of the task list

Response

Returns an object with tasks (array) and count (number).

Each task contains:

  • id — unique task identifier
  • title — task title
  • status"notStarted", "inProgress", "completed", "waitingOnOthers", "deferred"
  • body — body content object (may be null)
  • dueDateTime — due date object (may be null)
  • importance"low", "normal", "high"
  • createdDateTime — creation timestamp
  • lastModifiedDateTime — last modified timestamp

Example

local result = app.integrations["microsoft-todo"].todo_list_tasks({
  list_id = "AQMkAGI1NzQz..."
})

for _, task in ipairs(result.tasks) do
  local status = task.status or "unknown"
  print(task.title .. " [" .. status .. "]")
end

get_task

Get a specific task from a Microsoft To Do task list.

Parameters

NameTypeRequiredDescription
list_idstringyesThe unique identifier of the task list
idstringyesThe unique identifier of the task

Example

local result = app.integrations["microsoft-todo"].todo_get_task({
  list_id = "AQMkAGI1NzQz...",
  id = "AAMkAGI1NzQz..."
})

print(result.title)
print(result.status)
if result.dueDateTime then
  print("Due: " .. result.dueDateTime.dateTime)
end

create_task

Create a new task in a Microsoft To Do task list.

Parameters

NameTypeRequiredDescription
list_idstringyesThe unique identifier of the task list
titlestringyesThe title of the task
bodystringnoBody/content text for the task
due_datestringnoDue date in ISO 8601 format (e.g., "2026-04-30T00:00:00")
due_timezonestringnoTimezone for the due date (e.g., "UTC", "Europe/Amsterdam"). Defaults to "UTC"

Example

local result = app.integrations["microsoft-todo"].todo_create_task({
  list_id = "AQMkAGI1NzQz...",
  title = "Review pull request",
  body = "Check the new authentication module",
  due_date = "2026-04-30T17:00:00",
  due_timezone = "Europe/Amsterdam"
})

print("Created task: " .. result.title .. " (ID: " .. result.id .. ")")

get_current_user

Get the authenticated Microsoft user’s profile.

Parameters

None.

Response

Returns an object with:

  • id — user ID
  • displayName — user’s display name
  • mail — email address
  • userPrincipalName — UPN
  • jobTitle — job title
  • officeLocation — office location

Example

local result = app.integrations["microsoft-todo"].todo_get_current_user({})

print("Connected as: " .. result.displayName)
print("Email: " .. (result.mail or result.userPrincipalName))

Multi-Account Usage

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

-- Default account (always works)
app.integrations.microsoft_todo.list_lists({})

-- Explicit default (portable across setups)
app.integrations.microsoft_todo.default.list_lists({})

-- Named accounts
app.integrations.microsoft_todo.work.list_lists({})
app.integrations.microsoft_todo.personal.create_task({
  list_id = "...",
  title = "Book vacation"
})

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

Raw agent markdown
# Microsoft To Do — Lua API Reference

## list_lists

List all Microsoft To Do task lists for the authenticated user.

### Parameters

None.

### Response

Returns an object with `lists` (array) and `count` (number).

Each list contains:
- `id` — unique list identifier
- `displayName` — the list name
- `wellknownListName` — e.g. `"defaultList"`, `"none"`
- `isOwner` — whether the user owns the list
- `isShared` — whether the list is shared

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_list_lists({})

for _, list in ipairs(result.lists) do
  print(list.displayName .. " (" .. list.id .. ")")
end
```

---

## get_list

Get a specific Microsoft To Do task list by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The unique identifier of the task list |

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_get_list({
  id = "AQMkAGI1NzQz..."
})

print(result.displayName)
```

---

## create_list

Create a new Microsoft To Do task list.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `display_name` | string | yes | The name of the new task list |

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_create_list({
  display_name = "Work Tasks"
})

print("Created list: " .. result.displayName .. " (ID: " .. result.id .. ")")
```

---

## list_tasks

List all tasks in a Microsoft To Do task list.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | yes | The unique identifier of the task list |

### Response

Returns an object with `tasks` (array) and `count` (number).

Each task contains:
- `id` — unique task identifier
- `title` — task title
- `status` — `"notStarted"`, `"inProgress"`, `"completed"`, `"waitingOnOthers"`, `"deferred"`
- `body` — body content object (may be null)
- `dueDateTime` — due date object (may be null)
- `importance` — `"low"`, `"normal"`, `"high"`
- `createdDateTime` — creation timestamp
- `lastModifiedDateTime` — last modified timestamp

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_list_tasks({
  list_id = "AQMkAGI1NzQz..."
})

for _, task in ipairs(result.tasks) do
  local status = task.status or "unknown"
  print(task.title .. " [" .. status .. "]")
end
```

---

## get_task

Get a specific task from a Microsoft To Do task list.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | yes | The unique identifier of the task list |
| `id` | string | yes | The unique identifier of the task |

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_get_task({
  list_id = "AQMkAGI1NzQz...",
  id = "AAMkAGI1NzQz..."
})

print(result.title)
print(result.status)
if result.dueDateTime then
  print("Due: " .. result.dueDateTime.dateTime)
end
```

---

## create_task

Create a new task in a Microsoft To Do task list.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | yes | The unique identifier of the task list |
| `title` | string | yes | The title of the task |
| `body` | string | no | Body/content text for the task |
| `due_date` | string | no | Due date in ISO 8601 format (e.g., `"2026-04-30T00:00:00"`) |
| `due_timezone` | string | no | Timezone for the due date (e.g., `"UTC"`, `"Europe/Amsterdam"`). Defaults to `"UTC"` |

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_create_task({
  list_id = "AQMkAGI1NzQz...",
  title = "Review pull request",
  body = "Check the new authentication module",
  due_date = "2026-04-30T17:00:00",
  due_timezone = "Europe/Amsterdam"
})

print("Created task: " .. result.title .. " (ID: " .. result.id .. ")")
```

---

## get_current_user

Get the authenticated Microsoft user's profile.

### Parameters

None.

### Response

Returns an object with:
- `id` — user ID
- `displayName` — user's display name
- `mail` — email address
- `userPrincipalName` — UPN
- `jobTitle` — job title
- `officeLocation` — office location

### Example

```lua
local result = app.integrations["microsoft-todo"].todo_get_current_user({})

print("Connected as: " .. result.displayName)
print("Email: " .. (result.mail or result.userPrincipalName))
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.microsoft_todo.list_lists({})

-- Explicit default (portable across setups)
app.integrations.microsoft_todo.default.list_lists({})

-- Named accounts
app.integrations.microsoft_todo.work.list_lists({})
app.integrations.microsoft_todo.personal.create_task({
  list_id = "...",
  title = "Book vacation"
})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.microsoft_todo.list_lists({})
print(result)

Functions

list_lists Read

List all Microsoft To Do task lists for the authenticated user. Returns the list ID, display name, and well-known name for each list.

Lua path
app.integrations.microsoft_todo.list_lists
Full name
microsoft-todo.todo_list_lists
ParameterTypeRequiredDescription
No parameters.
get_list Read

Get a specific Microsoft To Do task list by its ID. Returns the list details including display name and well-known name.

Lua path
app.integrations.microsoft_todo.get_list
Full name
microsoft-todo.todo_get_list
ParameterTypeRequiredDescription
id string yes The unique identifier of the todo task list.
create_list Write

Create a new Microsoft To Do task list. Provide a display name for the list.

Lua path
app.integrations.microsoft_todo.create_list
Full name
microsoft-todo.todo_create_list
ParameterTypeRequiredDescription
display_name string yes The name of the new task list (e.g., "Shopping List", "Work Tasks").
list_tasks Read

List all tasks in a Microsoft To Do task list. Returns task titles, statuses, body content, and due dates.

Lua path
app.integrations.microsoft_todo.list_tasks
Full name
microsoft-todo.todo_list_tasks
ParameterTypeRequiredDescription
list_id string yes The unique identifier of the todo task list.
get_task Read

Get a specific task from a Microsoft To Do task list by its ID. Returns full task details including title, body, status, due date, and importance.

Lua path
app.integrations.microsoft_todo.get_task
Full name
microsoft-todo.todo_get_task
ParameterTypeRequiredDescription
list_id string yes The unique identifier of the todo task list.
id string yes The unique identifier of the task.
create_task Write

Create a new task in a Microsoft To Do task list. Provide a title, and optionally a body and due date.

Lua path
app.integrations.microsoft_todo.create_task
Full name
microsoft-todo.todo_create_task
ParameterTypeRequiredDescription
list_id string yes The unique identifier of the todo task list to add the task to.
title string yes The title of the task (e.g., "Buy groceries").
body string no Optional body/content text for the task.
due_date string no Optional due date in ISO 8601 format (e.g., "2026-04-30T00:00:00").
due_timezone string no Timezone for the due date (e.g., "UTC", "Europe/Amsterdam"). Defaults to "UTC".
get_current_user Read

Get the authenticated Microsoft user profile. Returns display name, email, and other account details. Useful for verifying which account is connected.

Lua path
app.integrations.microsoft_todo.get_current_user
Full name
microsoft-todo.todo_get_current_user
ParameterTypeRequiredDescription
No parameters.