Aggregate Records
aggregate_recordsCompute 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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max groups returned (default 200, max 1000). | |
| query | Yes | Natural 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_gaps | No | For date-bucketed groups only. If true, emit zero-count rows for missing buckets in the date range. Default false. | |
| entity_type | Yes | Entity type to aggregate. | |
| include_nulls | No | If true, include groups where a group key is NULL. Default false. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||