KosmoKrator

data

Neon Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.neon.*. Use lua_read_doc("integrations.neon") 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.

Neon — Lua API Reference

list_projects

List all Neon projects in the organization.

Parameters

None.

Example

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

for _, project in ipairs(result.projects) do
  print(project.name .. " (" .. project.region_id .. ")")
end

get_project

Get details for a specific Neon project.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID

Example

local result = app.integrations.neon.get_project({ project_id = "proj-abc123" })
local p = result.project
print(p.name .. " - " .. p.region_id .. " - " .. p.pg_version)

create_project

Create a new Neon project.

Parameters

NameTypeRequiredDescription
namestringyesProject name (e.g., "my-app-prod")
region_idstringnoRegion (e.g., "aws-us-east-2", "aws-eu-west-1")
pg_versionintegernoPostgres version (e.g., 16)
branch_namestringnoName for the initial branch (default: "main")
database_namestringnoName for the initial database (default: "neondb")

Common Regions

  • AWS US East: aws-us-east-2
  • AWS US West: aws-us-west-2
  • AWS EU West: aws-eu-west-1
  • AWS EU Central: aws-eu-central-1
  • AWS AP Southeast: aws-ap-southeast-1

Example

local result = app.integrations.neon.create_project({
  name = "my-app-prod",
  region_id = "aws-us-east-2",
  pg_version = 16
})

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

list_branches

List all branches in a Neon project.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID

Example

local result = app.integrations.neon.list_branches({ project_id = "proj-abc123" })

for _, branch in ipairs(result.branches) do
  print(branch.name .. " - " .. branch.status)
end

get_branch

Get details for a specific branch in a Neon project.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID
branch_idstringyesThe branch ID

Example

local result = app.integrations.neon.get_branch({
  project_id = "proj-abc123",
  branch_id = "br-xyz789"
})

print(result.branch.name .. " - primary: " .. tostring(result.branch.primary))

list_databases

List all databases in a Neon project branch.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID
branch_idstringyesThe branch ID

Example

local result = app.integrations.neon.list_databases({
  project_id = "proj-abc123",
  branch_id = "br-xyz789"
})

for _, db in ipairs(result.databases) do
  print(db.name .. " - owner: " .. db.owner_name)
end

get_current_user

Get the current authenticated Neon user information.

Parameters

None.

Example

local result = app.integrations.neon.get_current_user({})
print("User: " .. result.user.email)

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.neon.production.list_projects({})
app.integrations.neon.staging.list_projects({})

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

Raw agent markdown
# Neon — Lua API Reference

## list_projects

List all Neon projects in the organization.

### Parameters

None.

### Example

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

for _, project in ipairs(result.projects) do
  print(project.name .. " (" .. project.region_id .. ")")
end
```

---

## get_project

Get details for a specific Neon project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID |

### Example

```lua
local result = app.integrations.neon.get_project({ project_id = "proj-abc123" })
local p = result.project
print(p.name .. " - " .. p.region_id .. " - " .. p.pg_version)
```

---

## create_project

Create a new Neon project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Project name (e.g., `"my-app-prod"`) |
| `region_id` | string | no | Region (e.g., `"aws-us-east-2"`, `"aws-eu-west-1"`) |
| `pg_version` | integer | no | Postgres version (e.g., `16`) |
| `branch_name` | string | no | Name for the initial branch (default: `"main"`) |
| `database_name` | string | no | Name for the initial database (default: `"neondb"`) |

### Common Regions

- **AWS US East**: `aws-us-east-2`
- **AWS US West**: `aws-us-west-2`
- **AWS EU West**: `aws-eu-west-1`
- **AWS EU Central**: `aws-eu-central-1`
- **AWS AP Southeast**: `aws-ap-southeast-1`

### Example

```lua
local result = app.integrations.neon.create_project({
  name = "my-app-prod",
  region_id = "aws-us-east-2",
  pg_version = 16
})

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

---

## list_branches

List all branches in a Neon project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID |

### Example

```lua
local result = app.integrations.neon.list_branches({ project_id = "proj-abc123" })

for _, branch in ipairs(result.branches) do
  print(branch.name .. " - " .. branch.status)
end
```

---

## get_branch

Get details for a specific branch in a Neon project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID |
| `branch_id` | string | yes | The branch ID |

### Example

```lua
local result = app.integrations.neon.get_branch({
  project_id = "proj-abc123",
  branch_id = "br-xyz789"
})

print(result.branch.name .. " - primary: " .. tostring(result.branch.primary))
```

---

## list_databases

List all databases in a Neon project branch.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID |
| `branch_id` | string | yes | The branch ID |

### Example

```lua
local result = app.integrations.neon.list_databases({
  project_id = "proj-abc123",
  branch_id = "br-xyz789"
})

for _, db in ipairs(result.databases) do
  print(db.name .. " - owner: " .. db.owner_name)
end
```

---

## get_current_user

Get the current authenticated Neon user information.

### Parameters

None.

### Example

```lua
local result = app.integrations.neon.get_current_user({})
print("User: " .. result.user.email)
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.neon.production.list_projects({})
app.integrations.neon.staging.list_projects({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.neon.neon_list_projects({})
print(result)

Functions

neon_list_projects

List all Neon projects in the organization. Returns project IDs, names, region, and status.

Operation
Read read
Full name
neon.neon_list_projects
ParameterTypeRequiredDescription
No parameters.

neon_get_project

Get details for a specific Neon project by ID. Returns full project information including connection strings, branches, and settings.

Operation
Read read
Full name
neon.neon_get_project
ParameterTypeRequiredDescription
project_id string yes The project ID.

neon_create_project

Create a new Neon project. Requires a name. Optionally specify a region and Postgres version.

Operation
Write write
Full name
neon.neon_create_project
ParameterTypeRequiredDescription
name string yes The project name (e.g., "my-app-prod").
region_id string no Region where the project will be created (e.g., "aws-us-east-2", "aws-eu-west-1").
pg_version integer no Postgres version (e.g., 16).
branch_name string no Name for the initial branch (default: "main").
database_name string no Name for the initial database (default: "neondb").

neon_list_branches

List all branches in a Neon project. Returns branch IDs, names, status, and parent branch info.

Operation
Read read
Full name
neon.neon_list_branches
ParameterTypeRequiredDescription
project_id string yes The project ID.

neon_get_branch

Get details for a specific branch in a Neon project. Returns branch configuration, endpoints, and state.

Operation
Read read
Full name
neon.neon_get_branch
ParameterTypeRequiredDescription
project_id string yes The project ID.
branch_id string yes The branch ID.

neon_list_databases

List all databases in a Neon project branch. Returns database names, owners, and sizes.

Operation
Read read
Full name
neon.neon_list_databases
ParameterTypeRequiredDescription
project_id string yes The project ID.
branch_id string yes The branch ID.

neon_get_current_user

Get information about the current authenticated Neon user, including email, name, and organization membership.

Operation
Read read
Full name
neon.neon_get_current_user
ParameterTypeRequiredDescription
No parameters.