Skip to main content
Glama
ppiotis
by ppiotis

Group by and aggregate

group_by
Read-onlyIdempotent

Aggregate CSV rows by one or more columns and calculate counts, sums, means, min, max, median, or distinct counts. Filter, sort, and limit results for grouped insights.

Instructions

GROUP BY one or more columns with aggregations (count, sum, mean, min, max, median, count_distinct). Sorted by the first metric descending unless 'sort' is given.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYes
fileYesCSV path relative to the allowed directory (CSV_INSIGHTS_DIR), e.g. 'sales/2026-q3.csv'
sortNo
limitNo
whereNoRow filters, all must match (AND)
metricsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so safety and idempotency are covered. The description adds non-annotation behavioral context by disclosing the default sort order: results are sorted by the first metric descending unless 'sort' is given.

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, front-loaded with the core operation and followed immediately by the default ordering rule. Every word earns its place, and there is no filler.

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

Completeness2/5

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

For a tool with six parameters, nested objects, no output schema, and low schema description coverage, the description is too thin. It omits guidance on filters, limits, return shape, and how metrics aliases work, leaving important context to be inferred.

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

Parameters2/5

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

Schema description coverage is only 33%, so the description carries a heavy burden it does not meet. It restates the aggregation enum and explains the default sort behavior, but says nothing about the file, by, where, limit, or metrics alias parameters, nor about how nested filters work.

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 states a specific operation — GROUP BY on columns with aggregations — and names the available aggregation functions. It clearly distinguishes this tool's core purpose, though it does not explicitly differentiate it from similar siblings like pivot_table or query_csv.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no exclusions, and no mention of alternatives such as pivot_table or query_csv. The description implies a grouped-aggregation use case but leaves the agent to infer when this tool is preferable.

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