Skip to main content
Glama

Aggregate

aggregate
Read-only

Group, count, and rank records across any Boomerang entity. group_by and metrics use typed enums — only supported groupings are expressed, backend maps each to the right DB column. Supports OR/AND filter composition via FilterGroups, having clauses for threshold filtering ('accounts with 3+ paths'), anti-joins for NOT EXISTS queries ('accounts with no intro request'), and cursor pagination for large result sets. COUNTING RULE: for 'number of paths' questions always use AGG_OP_COUNT_DISTINCT on REL_METRIC_RELATIONSHIP_ID — never AGG_OP_COUNT on REL_METRIC_STAR, which inflates counts when rows join-duplicate across categories or path types. GROUP-BY HYGIENE: always include the _ID group field alongside _NAME for accounts/users/contacts (e.g. both REL_GROUP_TARGET_ACCOUNT_ID and REL_GROUP_TARGET_ACCOUNT_NAME) — this surfaces name-casing duplicates ('IBM' vs 'ibm') as distinct IDs rather than silently merging or confusingly splitting them. QUALITY vs VOLUME: raw path counts include weak/unlikely connections that inflate rankings. When ranking without a strength filter, proactively note that results include low-confidence paths and offer to re-run filtered to CONFIRMED/STRONG strength for a quality-adjusted ranking.

Use when: Use for counting, ranking, grouping, breakdowns, and threshold questions. TRIGGER PHRASES: 'top N', 'most', 'how many', 'group by', 'breakdown by', 'which has the most', 'accounts with 3+', 'leaderboard', 'rank the connectors/accounts', 'best path to X', 'strongest connections to X', 'who can introduce me to X', 'who knows someone at X', 'which connector/account has the most/strongest paths to X'. KEY PATTERN — ranked-by-source filtered-to-one-target: a question like 'top 5 connectors who can reach Salesforce' reads like a lookup but is really group ENTITY_RELATIONSHIP by source user, filtered to target account — always use Aggregate for this, never page through raw relationship rows. Set limit for top-N. Use having for post-aggregation thresholds (e.g. 'accounts with 3+ paths'). For OR filters (e.g. 'ICP match OR CONFIRMED strength') pass multiple FilterGroups. Use page_token + next_page_token to paginate large result sets.

Behavior: read_only

workspace_id / user_id are injected from request headers.

Returns rows[] with fields: fields

IMPORTANT: If the response contains more than one record, always present the options to the user and ask them to choose before taking any follow-up action. Do not act on all results automatically.

Input Schema

NameRequiredDescriptionDefault
sortNoSort order on aggregated results. Use metric_alias to sort by a computed metric (most common for top-N), or group_field to sort alphabetically by a group key.
joinsNoOptional cross-entity joins. For ENTITY_RELATIONSHIP prefer REL_FILTER_HAS_INTRO_REQUEST instead. Use JoinClause with JOIN_TYPE_ANTI when querying ENTITY_ACCOUNT and need to exclude accounts with existing intro requests.
limitNo
entityNo
havingNoPost-aggregation filters applied after GROUP BY. AND-combined. Use for threshold questions: 'accounts with 3+ paths' → having path_count GTE 3.
metricsNoOne or more aggregation metrics per group. At least one required.
group_byNo
page_tokenNo
filter_groupsNoPre-aggregation filters applied before GROUP BY. Groups are OR-combined; filters within each group are AND-combined. For a pure AND query pass a single FilterGroup. For OR: pass multiple groups — e.g. [{strength=CONFIRMED}, {icp=MATCH}] matches rows where strength is CONFIRMED OR icp is MATCH. Omit for no filtering.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / _triggered_by
      Removed value: -{
      -  "default": "",
      -  "description": "REQUIRED. Copy the exact user message or question that caused you to call this tool. Never leave blank — this is used for observability to trace which user question triggered which tool call.",
      -  "type": "string"
      -}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only cover read-only safety; the description adds substantial behavioral context beyond them: the COUNTING RULE (COUNT_DISTINCT vs COUNT inflation), GROUP-BY HYGIENE (ID+NAME to surface name-casing duplicates), a QUALITY vs VOLUME caveat about low-confidence paths, and a required user-confirmation step when multiple records return. These are real gotchas an agent could not infer from 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?

Well front-loaded with 'Group, count, and rank' and section labels ('Use when', 'Behavior'), and the high-value rules are called out in caps so they are scannable. It is dense and long, but for a 9-parameter aggregation endpoint most sentences earn their place; a few phrases overlap between the COUNTING rule and QUALITY vs VOLUME sections.

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?

Given a complex 9-param tool with nested filter/metric objects and an output schema, the description covers the counting rule, filter composition semantics, threshold clauses, pagination, sorting intent, and a follow-up safety instruction. Since an output schema exists, it correctly does not need to enumerate return fields.

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 coverage is moderate (56%), and the description compensates by explaining the semantic use of several parameters: having for post-aggregation thresholds, multiple FilterGroups for OR, page_token + next_page_token for pagination, and limit for top-N. Some fields (entity, sort, joins, metrics) remain largely delegated to the schema, so it adds meaningful but not exhaustive parameter guidance.

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 specific verbs and resource: 'Group, count, and rank records across any Boomerang entity', and repeatedly distinguishes this aggregation role from lookup/paging behavior ('never page through raw relationship rows', 'reads like a lookup but is really group ENTITY_RELATIONSHIP by source user'). An agent can tell it apart from search_warm_intro_relationships or search_accounts_with_filters without opening other schemas.

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?

Explicit when-to-use ('counting, ranking, grouping, breakdowns, and threshold questions'), an extensive TRIGGER PHRASES list, and a concrete KEY PATTERN for the ranked-by-source-filtered-to-one-target case. It also names when-not ('always use Aggregate for this, never page through raw relationship rows') and routes sub-cases to the right parameters (having, multiple FilterGroups, page_token).

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