itsm
ServiceNow CLI for Coding Agents
Use the ServiceNow CLI for coding agents with headless JSON commands, schema discovery, credentials, and permission controls.
10 functions 7 read 3 write Username and password auth
ServiceNow CLI for Coding Agents
Let coding agents discover schemas and execute integration functions through CLI commands or MCP.
Use this pattern when another coding agent needs exact commands and schema discovery. The ServiceNow CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# ServiceNow CLI for Coding Agents
kosmokrator integrations:configure servicenow --set username="$SERVICENOW_USERNAME" --set password="$SERVICENOW_PASSWORD" --set instance="$SERVICENOW_INSTANCE" --enable --read allow --write ask --json
kosmo integrations:call servicenow.servicenow_list_incidents '{"query":"example_query","limit":1}' --json Discovery Before Execution
Agents and scripts can inspect ServiceNow docs and schemas 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 Useful ServiceNow CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
servicenow.servicenow_list_incidents | Read | query, limit | List incidents from the ServiceNow incident table. Supports filtering via an encoded query string (sysparm_query) and a configurable result limit. |
servicenow.servicenow_get_incident | Read | id | Retrieve a single ServiceNow incident by its sys_id. Returns the full incident record. |
servicenow.servicenow_create_incident | Write | short_description, description, priority | Create a new ServiceNow incident. Provide a short description, an optional full description, and a priority level. |
servicenow.servicenow_update_incident | Write | id, fields | Update an existing ServiceNow incident. Provide the incident sys_id and the fields to update. |
servicenow.servicenow_list_tasks | Read | query, limit | List tasks from the ServiceNow task table. Supports filtering via an encoded query string and a configurable result limit. |
servicenow.servicenow_get_task | Read | id | Retrieve a single ServiceNow task by its sys_id. Returns the full task record. |
servicenow.servicenow_create_task | Write | short_description, description, assigned_to, priority | Create a new ServiceNow task. Provide a short description and optional additional fields. |
servicenow.servicenow_list_users | Read | query, limit | List users from the ServiceNow sys_user table. Supports filtering via an encoded query string and a configurable result limit. |
servicenow.servicenow_get_user | Read | id | Retrieve a single ServiceNow user by their sys_id. Returns the full user record. |
servicenow.servicenow_get_current_user | Read | none | Get the profile of the currently authenticated ServiceNow user. Useful for verifying credentials and retrieving the logged-in user's details. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.