Skip to main content
Glama
mfa-servicenow-mcp

mfa-servicenow-mcp

by jshsakura

sn_aggregate

Calculate COUNT, SUM, AVG, MIN, or MAX statistics for any ServiceNow table, with optional grouping, returning aggregate results without fetching individual records.

Instructions

Run COUNT/SUM/AVG/MIN/MAX on any table with optional group_by. Returns stats without fetching records.

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": "sn_aggregate"
  }
}

Input Schema

NameRequiredDescriptionDefault
fieldNoField for SUM/AVG/MIN/MAX
queryNoEncoded query, not SQL: active=true^priority=1.
tableYes
group_byNoGroup by field
aggregateNoCOUNT, SUM, AVG, MIN, MAXCOUNT
group_limitNoMax groups listed, largest first. The rest are counted, not listed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.25.8
    • addedInput schema / properties / group_limit
      Added value: +{
      +  "default": 200,
      +  "description": "Max groups listed, largest first. The rest are counted, not listed.",
      +  "type": "integer"
      +}
    • addedInput schema / properties / query / description
      Added value: +"Encoded query, not SQL: active=true^priority=1."
  2. First observedv1.18.41

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden; it does disclose the key behavioral trait that results are statistics rather than records, which is genuinely useful. It says nothing about read-only safety, permission requirements, or whether the aggregate silently ignores nulls, so the behavioral picture is only partially filled in.

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?

Two short sentences, the capability is front-loaded, and the non-obvious behavioral point (no record retrieval) is placed second. No filler or redundant restatement of the tool name.

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

Completeness3/5

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

There is no output schema, so the description is the only source for return-shape information, and 'Returns stats' is vague about whether results are keyed by group and how truncated groups appear. The group_limit parameter partially compensates, but an agent cannot fully predict the response structure from the description alone.

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?

Schema description coverage is 83%, so the schema already documents field, query, group_by, aggregate, and group_limit. The description only restates the aggregate function list and the optionality of group_by, adding no format or syntax detail (e.g., encoded query syntax) beyond what the schema provides. Baseline 3 is appropriate.

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?

Names a specific operation (COUNT/SUM/AVG/MIN/MAX) against a specific resource (any table) with an optional group_by, and the phrase 'without fetching records' implicitly separates it from record-returning siblings like sn_query. It stops short of naming the sibling explicitly, so differentiation requires a small inference.

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?

'Returns stats without fetching records' implies the usage context: reach for this instead of sn_query when only aggregates are needed. There is no explicit when-not guidance, no prerequisites (e.g., table must exist / permissions), and no named alternative, so usage must be inferred.

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