Skip to main content
Glama
adaptive-pg-mcp (PostgreSQL)

adaptive-pg-mcp (PostgreSQL)

aggregate

Read-onlyIdempotent

Calculates count, sum, avg, min, or max over a table or view with optional filters and grouping, returning at most 1,000 groups.

Instructions

Computes count, sum, avg, min or max over one table or view, with an optional filter and grouping. Returns at most 1,000 groups.

Input Schema

NameRequiredDescriptionDefault
tableYesThe table or view to aggregate, by exact name.
whereNoConditions joined by AND. Omit to aggregate every row.
columnNoThe column to aggregate. Required except for count, which counts rows without it.
schemaNoThe schema, by exact name. Defaults to public.
databaseYesThe database to run on.
functionYesThe aggregate function.
group_byNoColumns to group and order by. Omit for one row.

Output Schema

NameRequiredDescriptionDefault
rowsYesThe result rows, each an array in column order.
columnsYesThe result columns, in order.
truncatedYesTrue when the row cap, the byte cap or limit cut off more rows.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world behavior, so the safety profile is covered. The description adds a genuine trait not present in the annotations or schema: results are capped at 1,000 groups, which matters for planning grouped queries. It stops short of describing ordering or behavior when the cap is hit.

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 sentences, zero waste, with the operation stated first and the result cap front-loaded as the second point. Nothing is padded or repeated.

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?

With an output schema present and full parameter coverage, the description only needs to frame the operation and any behavioral limits, which it does via the 1,000-group cap. It could go further on result ordering or the relationship to query_sql, but nothing essential for a correct call is missing.

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 100%, so every parameter, including the where-clause operators and the count-without-column case, is already documented in the schema. The description restates the function list and the optional filter/grouping at a high level without adding syntax or edge-case meaning. Baseline 3 applies.

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?

The description names a specific verb ('Computes') and the exact resource (count/sum/avg/min/max over one table or view), so the operation is unambiguous. It does not, however, distinguish itself from siblings like query_sql or execute_sql, which an agent could reasonably consider for the same task.

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 is only implied: the mention of 'one table or view' plus optional filter and grouping suggests when the tool fits, but there is no explicit 'use this instead of query_sql when you need aggregates' routing. No prerequisites, exclusions, or alternatives are named.

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