KosmoKrator

analytics

Opsgenie CLI for AI Agents

Use the Opsgenie CLI from KosmoKrator to call Opsgenie tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Opsgenie CLI Setup

Opsgenie can be configured headlessly with `kosmokrator integrations:configure opsgenie`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure opsgenie --set api_key="$OPSGENIE_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor opsgenie --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
api_key OPSGENIE_API_KEY Secret secret yes API Key

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call opsgenie.opsgenie_list_alerts '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json
Provider shortcut
kosmo integrations:opsgenie opsgenie_list_alerts '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs opsgenie --json
kosmo integrations:docs opsgenie.opsgenie_list_alerts --json
kosmo integrations:schema opsgenie.opsgenie_list_alerts --json
kosmo integrations:search "Opsgenie" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

opsgenie.opsgenie_list_alerts

List Opsgenie alerts. Optionally filter by query, status, or priority. Returns alert IDs, messages, statuses, and priorities.

Read read
Parameters
query, limit, offset, sort, order
Generic call
kosmo integrations:call opsgenie.opsgenie_list_alerts '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_list_alerts '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json

opsgenie.opsgenie_get_alert

Get full details of a specific Opsgenie alert by its ID. Returns message, description, priority, status, tags, and recipients.

Read read
Parameters
alert_id
Generic call
kosmo integrations:call opsgenie.opsgenie_get_alert '{"alert_id":"example_alert_id"}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_get_alert '{"alert_id":"example_alert_id"}' --json

opsgenie.opsgenie_create_alert

Create a new Opsgenie alert. Specify message, priority (P1–P5), and optional description, alias, tags, teams, or recipients.

Write write
Parameters
message, alias, description, priority, teams, visibleTo, actions, tags, details, entity, source, user, note
Generic call
kosmo integrations:call opsgenie.opsgenie_create_alert '{"message":"example_message","alias":"example_alias","description":"example_description","priority":"example_priority","teams":"example_teams","visibleTo":"example_visibleTo","actions":"example_actions","tags":"example_tags"}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_create_alert '{"message":"example_message","alias":"example_alias","description":"example_description","priority":"example_priority","teams":"example_teams","visibleTo":"example_visibleTo","actions":"example_actions","tags":"example_tags"}' --json

opsgenie.opsgenie_list_incidents

List Opsgenie incidents. Optionally filter by query, status, or priority. Returns incident IDs, messages, statuses, and priorities.

Read read
Parameters
query, limit, offset, sort, order
Generic call
kosmo integrations:call opsgenie.opsgenie_list_incidents '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_list_incidents '{"query":"example_query","limit":1,"offset":1,"sort":"example_sort","order":"example_order"}' --json

opsgenie.opsgenie_get_incident

Get full details of a specific Opsgenie incident by its ID. Returns message, description, priority, status, impacted services, and responders.

Read read
Parameters
incident_id
Generic call
kosmo integrations:call opsgenie.opsgenie_get_incident '{"incident_id":"example_incident_id"}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_get_incident '{"incident_id":"example_incident_id"}' --json

opsgenie.opsgenie_list_teams

List all Opsgenie teams. Returns team IDs, names, and descriptions.

Read read
Parameters
none
Generic call
kosmo integrations:call opsgenie.opsgenie_list_teams '{}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_list_teams '{}' --json

opsgenie.opsgenie_get_current_user

Get the currently authenticated Opsgenie user. Useful for verifying credentials and identifying the connected account.

Read read
Parameters
none
Generic call
kosmo integrations:call opsgenie.opsgenie_get_current_user '{}' --json
Shortcut
kosmo integrations:opsgenie opsgenie_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

opsgenie.opsgenie_list_alerts 5 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_list_alerts --json
ParameterTypeRequiredDescription
query string no Search query to filter alerts (e.g., "status:open AND priority:P1").
limit integer no Maximum number of alerts to return (default: 20, max: 100).
offset integer no Offset for pagination (default: 0).
sort string no Sort field (e.g., "createdAt", "updatedAt").
order string no Sort order: "asc" or "desc" (default: "desc").
opsgenie.opsgenie_get_alert 1 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_get_alert --json
ParameterTypeRequiredDescription
alert_id string yes The Opsgenie alert ID.
opsgenie.opsgenie_create_alert 13 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_create_alert --json
ParameterTypeRequiredDescription
message string yes Alert message text.
alias string no Client-defined identifier for the alert (used for deduplication).
description string no Detailed description of the alert.
priority string no Alert priority: "P1", "P2", "P3", "P4", or "P5". Defaults to "P3".
teams array no List of team names to route the alert to (e.g., ["ops", "engineering"]).
visibleTo array no List of teams/users the alert will be visible to without sending notifications.
actions array no Custom actions available on the alert (e.g., ["Restart", "ScaleUp"]).
tags array no List of tags for the alert (e.g., ["production", "critical"]).
details object no Key-value map of additional alert details.
entity string no Entity field used to specify the domain of the alert.
source string no Source field of the alert (e.g., "monitoring", "custom").
user string no Display name of the request owner.
note string no Additional note to add to the alert.
opsgenie.opsgenie_list_incidents 5 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_list_incidents --json
ParameterTypeRequiredDescription
query string no Search query to filter incidents (e.g., "status:open AND priority:P1").
limit integer no Maximum number of incidents to return (default: 20, max: 100).
offset integer no Offset for pagination (default: 0).
sort string no Sort field (e.g., "createdAt", "updatedAt").
order string no Sort order: "asc" or "desc" (default: "desc").
opsgenie.opsgenie_get_incident 1 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_get_incident --json
ParameterTypeRequiredDescription
incident_id string yes The Opsgenie incident ID.
opsgenie.opsgenie_list_teams 0 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_list_teams --json
ParameterTypeRequiredDescription
No parameters.
opsgenie.opsgenie_get_current_user 0 parameters
Schema command
kosmo integrations:schema opsgenie.opsgenie_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.