KosmoKrator

itsm

ServiceNow CLI for AI Agents

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

10 functions 7 read 3 write Username and password auth

ServiceNow CLI Setup

ServiceNow can be configured headlessly with `kosmokrator integrations:configure servicenow`.

# 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 servicenow --set username="$SERVICENOW_USERNAME" --set password="$SERVICENOW_PASSWORD" --set instance="$SERVICENOW_INSTANCE" --enable --read allow --write ask --json
kosmokrator integrations:doctor servicenow --json
kosmokrator integrations:status --json

Credentials

Authentication type: Username and password basic. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
username SERVICENOW_USERNAME Text string yes Username
password SERVICENOW_PASSWORD Secret secret yes Password
instance SERVICENOW_INSTANCE Text string yes Instance Name

Call ServiceNow Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call servicenow.servicenow_list_incidents '{
  "query": "example_query",
  "limit": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:servicenow servicenow_list_incidents '{
  "query": "example_query",
  "limit": 1
}' --json

Agent Discovery Commands

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

kosmo integrations:docs servicenow --json
kosmo integrations:docs servicenow.servicenow_list_incidents --json
kosmo integrations:schema servicenow.servicenow_list_incidents --json
kosmo integrations:search "ServiceNow" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to ServiceNow.

servicenow.servicenow_list_incidents

Read read

List incidents from the ServiceNow incident table. Supports filtering via an encoded query string (sysparm_query) and a configurable result limit.

Parameters
query, limit

Generic CLI call

kosmo integrations:call servicenow.servicenow_list_incidents '{"query":"example_query","limit":1}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_list_incidents '{"query":"example_query","limit":1}' --json

servicenow.servicenow_get_incident

Read read

Retrieve a single ServiceNow incident by its sys_id. Returns the full incident record.

Parameters
id

Generic CLI call

kosmo integrations:call servicenow.servicenow_get_incident '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_get_incident '{"id":"example_id"}' --json

servicenow.servicenow_create_incident

Write write

Create a new ServiceNow incident. Provide a short description, an optional full description, and a priority level.

Parameters
short_description, description, priority

Generic CLI call

kosmo integrations:call servicenow.servicenow_create_incident '{"short_description":"example_short_description","description":"example_description","priority":"example_priority"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_create_incident '{"short_description":"example_short_description","description":"example_description","priority":"example_priority"}' --json

servicenow.servicenow_update_incident

Write write

Update an existing ServiceNow incident. Provide the incident sys_id and the fields to update.

Parameters
id, fields

Generic CLI call

kosmo integrations:call servicenow.servicenow_update_incident '{"id":"example_id","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_update_incident '{"id":"example_id","fields":"example_fields"}' --json

servicenow.servicenow_list_tasks

Read read

List tasks from the ServiceNow task table. Supports filtering via an encoded query string and a configurable result limit.

Parameters
query, limit

Generic CLI call

kosmo integrations:call servicenow.servicenow_list_tasks '{"query":"example_query","limit":1}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_list_tasks '{"query":"example_query","limit":1}' --json

servicenow.servicenow_get_task

Read read

Retrieve a single ServiceNow task by its sys_id. Returns the full task record.

Parameters
id

Generic CLI call

kosmo integrations:call servicenow.servicenow_get_task '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_get_task '{"id":"example_id"}' --json

servicenow.servicenow_create_task

Write write

Create a new ServiceNow task. Provide a short description and optional additional fields.

Parameters
short_description, description, assigned_to, priority

Generic CLI call

kosmo integrations:call servicenow.servicenow_create_task '{"short_description":"example_short_description","description":"example_description","assigned_to":"example_assigned_to","priority":"example_priority"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_create_task '{"short_description":"example_short_description","description":"example_description","assigned_to":"example_assigned_to","priority":"example_priority"}' --json

servicenow.servicenow_list_users

Read read

List users from the ServiceNow sys_user table. Supports filtering via an encoded query string and a configurable result limit.

Parameters
query, limit

Generic CLI call

kosmo integrations:call servicenow.servicenow_list_users '{"query":"example_query","limit":1}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_list_users '{"query":"example_query","limit":1}' --json

servicenow.servicenow_get_user

Read read

Retrieve a single ServiceNow user by their sys_id. Returns the full user record.

Parameters
id

Generic CLI call

kosmo integrations:call servicenow.servicenow_get_user '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_get_user '{"id":"example_id"}' --json

servicenow.servicenow_get_current_user

Read read

Get the profile of the currently authenticated ServiceNow user. Useful for verifying credentials and retrieving the logged-in user's details.

Parameters
none

Generic CLI call

kosmo integrations:call servicenow.servicenow_get_current_user '{}' --json

Provider shortcut

kosmo integrations:servicenow servicenow_get_current_user '{}' --json

Function Schemas

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

servicenow.servicenow_list_incidents

List incidents from the ServiceNow incident table. Supports filtering via an encoded query string (sysparm_query) and a configurable result limit.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_list_incidents --json
ParameterTypeRequiredDescription
query string no ServiceNow encoded query string to filter results (e.g. "priority=1^state=2"). See ServiceNow query operators for syntax.
limit integer no Maximum number of incidents to return (default: 20).

servicenow.servicenow_get_incident

Retrieve a single ServiceNow incident by its sys_id. Returns the full incident record.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_get_incident --json
ParameterTypeRequiredDescription
id string yes The sys_id of the incident to retrieve.

servicenow.servicenow_create_incident

Create a new ServiceNow incident. Provide a short description, an optional full description, and a priority level.

Operation
Write write
Schema command
kosmo integrations:schema servicenow.servicenow_create_incident --json
ParameterTypeRequiredDescription
short_description string yes A brief summary of the incident.
description string no A detailed description of the incident.
priority string no Priority level: "1" (critical), "2" (high), "3" (moderate), "4" (low), "5" (planning). Defaults to the system default if omitted.

servicenow.servicenow_update_incident

Update an existing ServiceNow incident. Provide the incident sys_id and the fields to update.

Operation
Write write
Schema command
kosmo integrations:schema servicenow.servicenow_update_incident --json
ParameterTypeRequiredDescription
id string yes The sys_id of the incident to update.
fields object yes An object of field names and their new values. Common fields: state, priority, short_description, description, work_notes, comments, assigned_to.

servicenow.servicenow_list_tasks

List tasks from the ServiceNow task table. Supports filtering via an encoded query string and a configurable result limit.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_list_tasks --json
ParameterTypeRequiredDescription
query string no ServiceNow encoded query string to filter results (e.g. "active=true^assigned_to=javascript:gs.getUserID()").
limit integer no Maximum number of tasks to return (default: 20).

servicenow.servicenow_get_task

Retrieve a single ServiceNow task by its sys_id. Returns the full task record.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_get_task --json
ParameterTypeRequiredDescription
id string yes The sys_id of the task to retrieve.

servicenow.servicenow_create_task

Create a new ServiceNow task. Provide a short description and optional additional fields.

Operation
Write write
Schema command
kosmo integrations:schema servicenow.servicenow_create_task --json
ParameterTypeRequiredDescription
short_description string yes A brief summary of the task.
description string no A detailed description of the task.
assigned_to string no The sys_id of the user to assign the task to.
priority string no Priority level: "1" (critical) through "5" (planning).

servicenow.servicenow_list_users

List users from the ServiceNow sys_user table. Supports filtering via an encoded query string and a configurable result limit.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_list_users --json
ParameterTypeRequiredDescription
query string no ServiceNow encoded query string to filter results (e.g. "active=true^department=IT").
limit integer no Maximum number of users to return (default: 20).

servicenow.servicenow_get_user

Retrieve a single ServiceNow user by their sys_id. Returns the full user record.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_get_user --json
ParameterTypeRequiredDescription
id string yes The sys_id of the user to retrieve.

servicenow.servicenow_get_current_user

Get the profile of the currently authenticated ServiceNow user. Useful for verifying credentials and retrieving the logged-in user's details.

Operation
Read read
Schema command
kosmo integrations:schema servicenow.servicenow_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.