Skip to main content
Glama
jschuller

ServiceNow MCP Server

by jschuller

Aggregate Records

aggregate_records
Read-onlyIdempotent

Aggregate ServiceNow records using COUNT, SUM, AVG, MIN, MAX with filters and GROUP BY via the Stats API.

Instructions

Aggregate records using COUNT, AVG, MIN, MAX, SUM with optional GROUP BY via the Stats API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoInclude record count in results
queryNoEncoded query string to filter records before aggregation
havingNoPost-aggregation filter (e.g., 'COUNT>5')
group_byNoComma-separated fields to group results by (e.g., 'priority,state')
avg_fieldsNoComma-separated fields to average (e.g., 'reassignment_count,reopen_count')
max_fieldsNoComma-separated fields to find maximum values
min_fieldsNoComma-separated fields to find minimum values
sum_fieldsNoComma-separated fields to sum
table_nameYesThe ServiceNow table name (e.g., 'incident', 'cmdb_ci')

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. First observedv0.5.1

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare the tool as readOnly, idempotent, and non-destructive, and the description does not contradict these traits. The description adds 'via the Stats API' but does not describe side effects, response format, or other behavioral details beyond what annotations provide.

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?

The description is a single, focused sentence that directly states the operation, supported aggregate functions, optional grouping, and underlying API. It contains no redundant words or unnecessary detail.

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?

Given the rich input schema and readOnly/idempotent annotations, the description is sufficient to select and invoke the tool for aggregate queries. It does not describe the exact Stats API response shape, but no output schema is provided and the input semantics are fully covered by the schema.

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

Parameters3/5

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

The input schema has 100% description coverage, including examples for fields like group_by and avg_fields, so the tool description adds little parameter-level meaning. The description's aggregate function list maps naturally to count/avg_fields/max_fields/min_fields/sum_fields, but this is already evident from the schema.

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 clearly identifies the action (aggregate), the target (records), and the supported operations (COUNT, AVG, MIN, MAX, SUM with optional GROUP BY). It is specific enough to distinguish this from sibling tools like list_records, get_record, create_record, update_record, and delete_record.

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?

The description implies use for summary statistics rather than raw record retrieval by mentioning aggregate functions and the Stats API. However, it does not explicitly contrast this with list_records/get_record or state when not to use the tool, so the guidance is only implicit.

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