KosmoKrator

monitoring

Sentry Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API token auth

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.

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.sentry_list_projects({
  query = "example_query"
})
print(result)

Functions

sentry_list_projects

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

Operation
Read read
Full name
sentry.sentry_list_projects
ParameterTypeRequiredDescription
query string no Filter projects by name or slug.

sentry_get_project

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

Operation
Read read
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").

sentry_list_issues

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

Operation
Read read
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).

sentry_get_issue

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

Operation
Read read
Full name
sentry.sentry_get_issue
ParameterTypeRequiredDescription
issue_id string yes The Sentry issue ID (e.g., "1234567890").

sentry_list_releases

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

Operation
Read read
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).

sentry_create_issue

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.

Operation
Write write
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.

sentry_get_current_user

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.

Operation
Read read
Full name
sentry.sentry_get_current_user
ParameterTypeRequiredDescription
No parameters.