Query ServiceNow Table
servicenow_query_recordsRun ad-hoc queries on any ServiceNow table using encoded query strings, with options for fields, limits, and pagination.
Instructions
Query records from any ServiceNow table using an encoded query string.
Use this for ad-hoc queries on any table not covered by specialized tools.
Args:
table (string): ServiceNow table name (e.g., incident, change_request, sys_user, cmdb_ci)
query (string): Encoded query string (e.g., 'state=1^priority=1', 'assigned_to=CURRENT_USER'). Leave empty for all records.
fields (string): Comma-separated field list (e.g., 'sys_id,number,short_description'). Empty = all fields.
limit (number): Max records to return (1–100, default 20)
offset (number): Pagination offset (default 0)
display_value ('true'|'false'|'all'): 'all' returns both display values and raw values (default)
response_format ('markdown'|'json'): Output format
Returns: List of matching records with pagination metadata
Examples:
"Find all P1 incidents" → table="incident", query="priority=1^state!=7"
"List active users in IT" → table="sys_user", query="active=true^department.name=IT"
"Get open problems" → table="problem", query="state!=4"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results to return (1–100, default 20) | |
| query | No | Encoded ServiceNow query string (e.g., 'state=1^priority=1^assigned_to=javascript:gs.getUserID()'). Leave empty to return all records. | |
| table | Yes | ServiceNow table name (e.g., incident, change_request, sys_user) | |
| fields | No | Comma-separated list of fields to return. Leave empty for all fields. | |
| offset | No | Number of results to skip for pagination (default 0) | |
| display_value | No | Controls field value display: 'true' returns display values, 'false' returns raw values, 'all' returns both | all |
| response_format | No | Output format: 'markdown' (default) for human-readable or 'json' for structured data | markdown |