Skip to main content
Glama

Query ServiceNow Table

servicenow_query_records
Read-onlyIdempotent

Run 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

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results to return (1–100, default 20)
queryNoEncoded ServiceNow query string (e.g., 'state=1^priority=1^assigned_to=javascript:gs.getUserID()'). Leave empty to return all records.
tableYesServiceNow table name (e.g., incident, change_request, sys_user)
fieldsNoComma-separated list of fields to return. Leave empty for all fields.
offsetNoNumber of results to skip for pagination (default 0)
display_valueNoControls field value display: 'true' returns display values, 'false' returns raw values, 'all' returns bothall
response_formatNoOutput format: 'markdown' (default) for human-readable or 'json' for structured datamarkdown
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, openWorldHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds useful behavioral context about the expected return value ('List of matching records with pagination metadata') and query encoding, which goes beyond the annotations. No contradiction exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-organized: a one-line purpose, a usage note, an Args block, a Returns line, and examples. It is appropriately sized for a 7-parameter tool, though the Args block largely repeats the schema JSON. Still, the examples and usage guidance earn their place, and the structure is front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a generic query tool with many parameters and no output schema, the description covers the essential aspects: purpose, when to use, parameter semantics, return value, and examples. It does not discuss error handling (e.g., invalid table names) or edge cases, but these are less critical given the open-world annotation and the tool's flexible nature.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters. The description goes further by providing concrete examples of query strings (e.g., 'state=1^priority=1', 'assigned_to=CURRENT_USER') and clarifying subtle behaviors like display_value='all' returning both display and raw values. This adds contextual meaning beyond the schema's field descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Query records from any ServiceNow table using an encoded query string', clearly identifying the tool as a generic query operation. It differentiates from siblings by noting it is for 'ad-hoc queries on any table not covered by specialized tools', which is explicit and actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says 'Use this for ad-hoc queries on any table not covered by specialized tools', giving clear guidance on when to use it. The existence of many specialized sibling tools (e.g., servicenow_list_incidents, servicenow_list_changes) makes this exclusion meaningful, and the examples illustrate appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kylburns89/servicenow-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server