KosmoKrator

analytics

Sentry Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.sentry.list_projects({query = "example_query"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("sentry"))' --json
kosmo integrations:lua --eval 'print(docs.read("sentry.list_projects"))' --json

Workflow file

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

workflow.lua
local sentry = app.integrations.sentry
local result = sentry.list_projects({query = "example_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.sentry, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.sentry.default.* or app.integrations.sentry.work.* when you configured named credential accounts.

MCP-only Lua

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

Sentry — Lua API Reference

list_projects

List all Sentry projects accessible to the authenticated user.

Parameters

NameTypeRequiredDescription
querystringnoFilter projects by name or slug

Example

local result = app.integrations.sentry.list_projects({})

for _, project in ipairs(result) do
  print(project.slug .. " (" .. project.organization.slug .. ") - " .. (project.platform or "unknown"))
end

get_project

Get detailed information about a specific Sentry project.

Parameters

NameTypeRequiredDescription
org_slugstringyesThe organization slug (e.g., "my-org")
project_slugstringyesThe project slug (e.g., "my-project")

Example

local result = app.integrations.sentry.get_project({
  org_slug = "my-org",
  project_slug = "my-project"
})

print("Project: " .. result.name)
print("Platform: " .. (result.platform or "unknown"))

list_issues

List issues (errors) for a specific Sentry project.

Parameters

NameTypeRequiredDescription
org_slugstringyesThe organization slug
project_slugstringyesThe project slug
querystringnoSearch query (e.g., "is:unresolved level:error")
sortstringnoSort order: "date", "freq", "new", "priority"
limitintegernoMax results (default: 25, max: 100)

Query Syntax

Common query filters:

  • is:unresolved — only unresolved issues
  • is:resolved — only resolved issues
  • level:error — error-level issues
  • level:fatal — fatal-level issues
  • assigned:me — issues assigned to current user
  • first_seen:-24h — issues first seen in last 24 hours

Multiple filters can be combined: is:unresolved level:error

Example

local result = app.integrations.sentry.list_issues({
  org_slug = "my-org",
  project_slug = "my-project",
  query = "is:unresolved level:error",
  sort = "freq",
  limit = 10
})

for _, issue in ipairs(result) do
  print(issue.shortId .. ": " .. issue.title .. " (" .. issue.count .. " events)")
end

get_issue

Get detailed information about a specific Sentry issue.

Parameters

NameTypeRequiredDescription
issue_idstringyesThe Sentry issue ID

Example

local result = app.integrations.sentry.get_issue({
  issue_id = "1234567890"
})

print("Title: " .. result.title)
print("Culprit: " .. result.culprit)
print("Level: " .. result.level)
print("Status: " .. result.status)
print("Events: " .. result.count)
print("Users affected: " .. result.userCount)

list_releases

List releases for a specific Sentry project.

Parameters

NameTypeRequiredDescription
org_slugstringyesThe organization slug
project_slugstringyesThe project slug
limitintegernoMax results (default: 25, max: 100)

Example

local result = app.integrations.sentry.list_releases({
  org_slug = "my-org",
  project_slug = "my-project",
  limit = 5
})

for _, release in ipairs(result) do
  print(release.version .. " — " .. (release.dateReleased or "not released"))
end

create_issue

Create a new issue (user report or crash report) in a Sentry project.

Parameters

NameTypeRequiredDescription
org_slugstringyesThe organization slug
project_slugstringyesThe project slug
titlestringyesShort description of the issue
messagestringnoFull error message or stacktrace
levelstringnoSeverity: "fatal", "error", "warning", "info", "debug"
tagsobjectnoKey-value tags (e.g., {environment = "production"})
extraobjectnoAdditional context data as key-value pairs

Example

local result = app.integrations.sentry.create_issue({
  org_slug = "my-org",
  project_slug = "my-project",
  title = "NullPointerException in UserController",
  message = "java.lang.NullPointerException\n  at UserController.java:42\n  at Router.dispatch(Router.java:15)",
  level = "error",
  tags = {
    environment = "production",
    version = "2.1.0"
  }
})

print("Created issue: " .. result.id)

get_current_user

Get the currently authenticated Sentry user.

Parameters

None.

Example

local result = app.integrations.sentry.get_current_user({})

print("Name: " .. result.name)
print("Email: " .. result.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.sentry.list_projects({})

-- Explicit default (portable across setups)
app.integrations.sentry.default.list_projects({})

-- Named accounts
app.integrations.sentry.work.list_issues({org_slug = "work-org", project_slug = "api"})
app.integrations.sentry.personal.list_projects({})

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

Raw agent markdown
# Sentry — Lua API Reference

## list_projects

List all Sentry projects accessible to the authenticated user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | string | no | Filter projects by name or slug |

### Example

```lua
local result = app.integrations.sentry.list_projects({})

for _, project in ipairs(result) do
  print(project.slug .. " (" .. project.organization.slug .. ") - " .. (project.platform or "unknown"))
end
```

---

## get_project

Get detailed information about a specific Sentry project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_slug` | string | yes | The organization slug (e.g., `"my-org"`) |
| `project_slug` | string | yes | The project slug (e.g., `"my-project"`) |

### Example

```lua
local result = app.integrations.sentry.get_project({
  org_slug = "my-org",
  project_slug = "my-project"
})

print("Project: " .. result.name)
print("Platform: " .. (result.platform or "unknown"))
```

---

## list_issues

List issues (errors) for a specific Sentry project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_slug` | string | yes | The organization slug |
| `project_slug` | string | yes | The project slug |
| `query` | string | no | Search query (e.g., `"is:unresolved level:error"`) |
| `sort` | string | no | Sort order: `"date"`, `"freq"`, `"new"`, `"priority"` |
| `limit` | integer | no | Max results (default: 25, max: 100) |

### Query Syntax

Common query filters:

- `is:unresolved` — only unresolved issues
- `is:resolved` — only resolved issues
- `level:error` — error-level issues
- `level:fatal` — fatal-level issues
- `assigned:me` — issues assigned to current user
- `first_seen:-24h` — issues first seen in last 24 hours

Multiple filters can be combined: `is:unresolved level:error`

### Example

```lua
local result = app.integrations.sentry.list_issues({
  org_slug = "my-org",
  project_slug = "my-project",
  query = "is:unresolved level:error",
  sort = "freq",
  limit = 10
})

for _, issue in ipairs(result) do
  print(issue.shortId .. ": " .. issue.title .. " (" .. issue.count .. " events)")
end
```

---

## get_issue

Get detailed information about a specific Sentry issue.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `issue_id` | string | yes | The Sentry issue ID |

### Example

```lua
local result = app.integrations.sentry.get_issue({
  issue_id = "1234567890"
})

print("Title: " .. result.title)
print("Culprit: " .. result.culprit)
print("Level: " .. result.level)
print("Status: " .. result.status)
print("Events: " .. result.count)
print("Users affected: " .. result.userCount)
```

---

## list_releases

List releases for a specific Sentry project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_slug` | string | yes | The organization slug |
| `project_slug` | string | yes | The project slug |
| `limit` | integer | no | Max results (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.sentry.list_releases({
  org_slug = "my-org",
  project_slug = "my-project",
  limit = 5
})

for _, release in ipairs(result) do
  print(release.version .. " — " .. (release.dateReleased or "not released"))
end
```

---

## create_issue

Create a new issue (user report or crash report) in a Sentry project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `org_slug` | string | yes | The organization slug |
| `project_slug` | string | yes | The project slug |
| `title` | string | yes | Short description of the issue |
| `message` | string | no | Full error message or stacktrace |
| `level` | string | no | Severity: `"fatal"`, `"error"`, `"warning"`, `"info"`, `"debug"` |
| `tags` | object | no | Key-value tags (e.g., `{environment = "production"}`) |
| `extra` | object | no | Additional context data as key-value pairs |

### Example

```lua
local result = app.integrations.sentry.create_issue({
  org_slug = "my-org",
  project_slug = "my-project",
  title = "NullPointerException in UserController",
  message = "java.lang.NullPointerException\n  at UserController.java:42\n  at Router.dispatch(Router.java:15)",
  level = "error",
  tags = {
    environment = "production",
    version = "2.1.0"
  }
})

print("Created issue: " .. result.id)
```

---

## get_current_user

Get the currently authenticated Sentry user.

### Parameters

None.

### Example

```lua
local result = app.integrations.sentry.get_current_user({})

print("Name: " .. result.name)
print("Email: " .. result.email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.sentry.list_projects({})

-- Explicit default (portable across setups)
app.integrations.sentry.default.list_projects({})

-- Named accounts
app.integrations.sentry.work.list_issues({org_slug = "work-org", project_slug = "api"})
app.integrations.sentry.personal.list_projects({})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.sentry.list_projects({query = "example_query"})
print(result)

Functions

list_projects Read

List all Sentry projects accessible to the authenticated user. Returns project slugs, organization slugs, and platforms for use in other Sentry tools.

Lua path
app.integrations.sentry.list_projects
Full name
sentry.sentry_list_projects
ParameterTypeRequiredDescription
query string no Filter projects by name or slug.
get_project Read

Get detailed information about a specific Sentry project, including its slug, platform, team assignments, and error statistics.

Lua path
app.integrations.sentry.get_project
Full name
sentry.sentry_get_project
ParameterTypeRequiredDescription
org_slug string yes The organization slug (e.g., "my-org").
project_slug string yes The project slug (e.g., "my-project").
list_issues Read

List issues (errors) for a specific Sentry project. Supports filtering by status, query, sorting, and time range. Returns issue IDs, titles, counts, and severity.

Lua path
app.integrations.sentry.list_issues
Full name
sentry.sentry_list_issues
ParameterTypeRequiredDescription
org_slug string yes The organization slug (e.g., "my-org").
project_slug string yes The project slug (e.g., "my-project").
query string no Search query to filter issues (e.g., "is:unresolved level:error").
sort string no Sort order: "date" (default), "freq", "new", "priority".
limit integer no Maximum number of issues to return (default: 25, max: 100).
get_issue Read

Get detailed information about a specific Sentry issue, including the error message, stacktrace, tags, event count, and affected users.

Lua path
app.integrations.sentry.get_issue
Full name
sentry.sentry_get_issue
ParameterTypeRequiredDescription
issue_id string yes The Sentry issue ID (e.g., "1234567890").
list_releases Read

List releases for a specific Sentry project. Returns version strings, deployment dates, authors, and commit information.

Lua path
app.integrations.sentry.list_releases
Full name
sentry.sentry_list_releases
ParameterTypeRequiredDescription
org_slug string yes The organization slug (e.g., "my-org").
project_slug string yes The project slug (e.g., "my-project").
limit integer no Maximum number of releases to return (default: 25, max: 100).
create_issue Write

Create a new issue (user report or crash report) in a Sentry project. Requires the error message and optional metadata like stacktrace, tags, and user context.

Lua path
app.integrations.sentry.create_issue
Full name
sentry.sentry_create_issue
ParameterTypeRequiredDescription
org_slug string yes The organization slug (e.g., "my-org").
project_slug string yes The project slug (e.g., "my-project").
title string yes Short description of the issue (the error message or title).
message string no Full error message or stacktrace.
level string no Severity level: "fatal", "error", "warning", "info", or "debug". Defaults to "error".
tags object no Key-value tags to attach to the issue (e.g., {"environment": "production", "version": "1.0.0"}).
extra object no Additional context data as key-value pairs.
get_current_user Read

Get the currently authenticated Sentry user. Returns user name, email, and organization memberships. Useful for verifying the connection and identifying which Sentry account is being used.

Lua path
app.integrations.sentry.get_current_user
Full name
sentry.sentry_get_current_user
ParameterTypeRequiredDescription
No parameters.