Skip to main content
Glama

Filtrar, agrupar y totalizar un arreglo

array-filter-aggregate
Read-onlyIdempotent

Aplica condiciones where a un arreglo de objetos (campos con punto), agrupa por campos y calcula count, count_distinct, sum, avg, min y max. Sin expresiones ni eval. Cuándo: hay que transformar, comparar o revisar con exactitud datos estructurados (JSON, CSV, YAML, XML, arreglos). No para: agrupar objetos por el valor de una clave y devolver grupos y conteos (array-group-by). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Filters an array of objects with where-clauses (eq, ne, gt, gte, lt, lte, in, nin, contains, starts_with, ends_with, exists, is_null on dotted fields; all or any), then groups by fields and computes count, count_distinct, sum, avg, min and max. No expressions or eval. When: structured data (JSON, CSV, YAML, XML, arrays) has to be transformed, compared or checked exactly. [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
itemsYesArray of objects (array; required).
limitNoKeep at most this many groups (integer; optional; min 1; max 10000).
matchNoCombine conditions with all (AND) or any (OR) (optional; one of: all, any; default "all").all
orderNoSort order (optional; one of: asc, desc; default "desc").desc
whereNoConditions (array of object; optional; default []; up to 20 items).
sort_byNoSort groups by an aggregate name or group field (string; optional; up to 200 chars).
group_byNoFields to group by (array of string; optional; default []; up to 5 items).
aggregatesNoAggregates (default: count) (array of object; optional; default []; up to 20 items).

Output Schema

NameRequiredDescriptionDefault
totalNo
groupsNo
matchedNo
group_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / items / examples
      Added value: +[
      +  [
      +    {
      +      "a": {
      +        "b": 5
      +      }
      +    },
      +    {
      +      "a": {
      +        "b": 7
      +      }
      +    },
      +    {
      +      "a": {}
      +    }
      +  ]
      +]
  2. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond annotations (read-only, idempotent, non-destructive, closed-world), it states no side effects, no network, no stored state, deterministic output, and hard limits: 64 KB input, 1 s per call, 1 MB result. These are operationally useful disclosures and do not contradict the annotations.

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

Conciseness4/5

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

The description is front-loaded and structured into purpose, usage, side effects, determinism, and limits. It loses some conciseness by repeating the same information in Spanish and English, though each block remains readable.

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

Completeness5/5

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

With annotations covering safety semantics and an output schema present, the description supplies the remaining operational context: scope, exclusions, determinism, side effects, and execution limits. Nothing essential for correct invocation 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 the schema already documents all eight parameters. The description lists operators and aggregates, but these largely mirror schema enums and field descriptions; it adds little syntax or edge-case guidance beyond structured fields.

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 opens with a specific verb sequence—filter, group, and aggregate—over an array of objects, and explicitly contrasts itself with array-group-by. This lets an agent identify the tool precisely versus sibling array utilities without opening the schema.

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

Usage Guidelines5/5

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

It gives a concrete 'Cuándo' for structured data transformations and an explicit 'No para' pointing to array-group-by for key-based grouping and counts. The alternative condition is clear enough to route between tools.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources