Skip to main content
Glama

Query a table

table_query
Read-onlyIdempotent

Query ServiceNow tables using encoded filters, page records with limit/offset and nextOffset, and select fields to keep result sets small.

Instructions

Query any table with an encoded query (e.g. active=true^priority=1). Returns records, paged with limit/offset; nextOffset says where to continue. Pass fields to keep results small. Password fields are redacted. A misspelt field in the query may be ignored by ServiceNow, so check the results.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "table": "<table>"
    },
    "name": "table_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum records to return. Defaults to the configured default, capped at maxRecords.
queryNoEncoded query, e.g. active=true^priority<=2. Omit for all records.
tableYesTable name, e.g. incident or cmdb_ci_server.
fieldsNoField names to return (dot-walking allowed, e.g. caller_id.name). Default: all.
offsetNoRecords to skip (paging). Use nextOffset from the previous result.
orderByNoSort order.
instanceNoInstance alias from the config (see instance_list). Defaults to the default instance.
displayValueNoraw = stored values, display = labels, both (default) = value and label when they differ.
includeTotalNoInclude the total number of matching records (total) in the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive, but the description adds genuine operational context: results are paged with limit/offset, nextOffset indicates continuation, password fields are redacted, and ServiceNow may silently ignore a misspelt query field. That last warning is a non-obvious failure mode the agent would otherwise miss. Return record shape is not described, but with no output schema that is a modest gap rather than a serious one.

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

Conciseness5/5

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

Five short sentences, each carrying distinct information: query shape first, then paging, then payload trimming, then redaction, then the misspelt-field caveat. No repetition of the schema, no filler.

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 9-parameter, nested-object, no-output-schema tool, the description covers the mechanics an agent most needs: query encoding, paging continuation, field selection, redaction, and the silent-typo hazard. It stops short of describing the result envelope (records/nextOffset/total layout), which would have made it fully self-sufficient.

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 coverage is 100%, so baseline would be 3, but the description adds meaning the schema does not: it links offset paging to 'nextOffset from the previous result' as a workflow, and reinforces fields as a payload-size lever. It does not explain instance, displayValue, or includeTotal beyond the schema text.

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

Purpose4/5

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

States a specific verb and resource ('Query any table with an encoded query') with a concrete query example, so an agent immediately knows this is arbitrary-table retrieval. It does not differentiate itself from siblings such as table_find or table_get, leaving the agent to infer which retrieval tool to pick.

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

Usage Guidelines3/5

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

Usage context is implied rather than stated: encoded query syntax with an example and the advice to 'pass fields to keep results small' tells the agent how to call it, but there is no explicit when-to-use versus table_find, table_get, or table_aggregate. Exclusions and alternatives are absent.

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