Skip to main content
Glama

henosis

aggregate

Read-only

Group the entities matching a CEL expression by the scalar group_by expression and return one row per group, ranked by the aggregate descending — a bounded roll-up, NOT per-entity fetch-and-tally. aggregate is 'count' (default) or sum|avg|min|max applied to the metric CEL expression (required for those). Examples: aggregate("entity.type=='Well'", group_by="entity.state.status") → count of wells per status aggregate("entity.type=='Well' && has_obs(entity,'gas_rate')", group_by="entity.identity.field", metric="latest(entity,'gas_rate')", aggregate='avg') → average current gas_rate per field Bounded to a context-lookup roll-up: fixed aggregates, no joins, and a hard group cap (a high-cardinality group_by errors — group by a low-cardinality field or narrow the selection). format (json|tsv|md) applies to the group rows.

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": {
      "expression": "<expression>",
      "group_by": "<group_by>"
    },
    "name": "aggregate"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
typesNo
formatNojson
metricNo
group_byYes
aggregateNocount
expressionYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, so the description adds real value: fixed aggregate set with no joins, a hard group cap that raises an error on high-cardinality group_by, and the note that format applies to the group rows. It does not cover ordering details beyond 'ranked by the aggregate descending' or any cost/latency considerations, so it stops short of full disclosure.

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?

Front-loads the core operation and the roll-up constraint before the examples, and every sentence carries information. The worked examples cost length but justify themselves by clarifying the CEL expression semantics; the odd indentation is cosmetic.

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 a read-only aggregate tool with an output schema (so return shape need not be described) and seven parameters, the description covers the CEL inputs, the aggregate/metric relationship, and the group-cap failure mode. The main gaps are the limit and types parameters, which are undocumented in both schema and description.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must carry the parameter burden, and it does for the important ones: expression, group_by, metric (required for sum/avg/min/max), aggregate ('count' default or sum|avg|min|max), and format (json|tsv|md). It says nothing about limit or types, leaving two of seven parameters explained only by their terse schema titles.

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?

States a specific operation: group the entities matching a CEL expression by a group_by expression and return one row per group. It explicitly distinguishes this from per-entity retrieval ('NOT per-entity fetch-and-tally'), which separates it from siblings like list_entities or count_entities.

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

Usage Guidelines4/5

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

Gives clear context: use for a bounded roll-up across a group_by, with two worked examples showing count-per-group and metric-average-per-group. It also warns that a high-cardinality group_by errors and advises grouping by a low-cardinality field or narrowing the selection. No sibling is named explicitly, but the when-to-use condition is well established.

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.