Skip to main content
Glama

Aggregate Records

aggregate_records
Read-only

Compute aggregate statistics over Maven's biopharma database.

Pass a natural language query describing what you want to analyze:

  • 'active oncology drugs grouped by phase'

  • 'Phase 3 trial starts by year since 2020'

  • 'deal values by type'

  • 'obesity deals by year' (deals filter by indication, hierarchy-expanded to broad areas) Maven resolves entity names, field names, grouping dimensions, and aggregation functions automatically.

Returns chart-ready flat rows in a single call instead of paginating raw records.

Use this tool for totals, counts, trends, rankings, distributions, and breakdowns. Use search_entities for listing individual records.

Supported entity types: drug, company, trial, indication, mechanism, target, financing, deal, document, abstract, product_label.

CROSS-ENTITY RANKINGS (use this idiom, not that idiom): To rank entities by counts of related entities, query FROM the related entity and group BY the ranking dimension:

  • Top companies by pipeline size: entity_type=drug, query='active drugs grouped by company, top 25' (NOT entity_type=company)

  • Top indications by competitive depth: entity_type=drug, query='drugs grouped by indication, top 25' (NOT entity_type=indication)

  • Top targets by program count: entity_type=drug, query='drugs grouped by target, top 25' (NOT entity_type=target)

Each result row contains the group key(s), a count, and any requested aggregation values as a flat dict. Check the 'hints' array in the response for warnings about M2M double-counting, field substitutions, or data coverage gaps.

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": {
      "entity_type": "<entity_type>",
      "query": "<query>"
    },
    "name": "aggregate_records"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax groups returned (default 200, max 1000).
queryYesNatural language description of what to analyze. Maven automatically resolves entity names, field names, grouping dimensions, and aggregation functions. Examples: 'active oncology drugs by phase', 'phase 3 oncology trials by primary completion year since 2023', 'median and average deal value by round type since 2022'.
fill_gapsNoFor date-bucketed groups only. If true, emit zero-count rows for missing buckets in the date range. Default false.
entity_typeYesEntity type to aggregate.
include_nullsNoIf true, include groups where a group key is NULL. Default false.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, destructiveHint=false, openWorldHint=false), and the description adds real behavioral context beyond them: results come back as chart-ready flat rows in a single call rather than paginated records, and the response carries a 'hints' array warning about M2M double-counting, field substitutions, and coverage gaps. It stops short of describing cost, limits, or failure modes, so 4 rather than 5.

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-loaded with the core purpose, then bulletted examples, then usage routing, then the ranking idiom. Most content earns its place, though the meta-phrase 'use this idiom, not that idiom' is slightly awkward and the example bullets partially duplicate the query parameter's own examples.

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?

For a natural-language-query aggregation tool, everything an agent needs is present: the supported entity_type list, worked query idioms, the warning system, and the shape of result rows. An output schema exists, so the description is not obliged to spec it further.

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 100%, so the parameter docs already stand on their own; the description adds genuine interpretive value on top by specifying which entity_type to use for which ranking goal (query from the related entity, group by the ranking dimension) rather than the intuitive-but-wrong choice. fill_gaps and include_nulls are left entirely to the schema, keeping this from a 5.

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 verb and resource ('Compute aggregate statistics over Maven's biopharma database') and immediately distinguishes itself from the closest sibling by contrast: 'Use search_entities for listing individual records.' An agent can route between aggregation and record retrieval without opening a 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?

Explicit when-to-use ('totals, counts, trends, rankings, distributions, and breakdowns'), explicit alternative ('search_entities for listing individual records'), and a dedicated section giving the correct calling idiom for cross-entity rankings with concrete NOT-examples to prevent a common misuse.

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