Aggregate Contracts
aggregate_contractsAggregate federal contract awards by agency, subagency, recipient, NAICS, PSC, month, or set-aside without pulling rows; return dollar obligations or prime award counts for date-filtered USASpending queries.
Instructions
Aggregate federal contract awards from USASpending without pulling rows: group by awarding_agency, awarding_subagency, recipient, naics, psc, month, or set_aside, with metric 'obligations' (dollars) or 'count' (prime awards). This is the tool for questions like 'how many 8(a) sole source awards per agency in Aug-Sep 2025'. Counts state their unit and the date filter states its date_type. group_by=set_aside issues one upstream query per code (~4s each due to rate pacing); metric 'count' is supported for group_by set_aside only (USASpending exposes counts per filter, not per category).
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": {
"group_by": "<group_by>",
"date_from": "<date_from>",
"date_to": "<date_to>"
},
"name": "aggregate_contracts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| psc | No | PSC codes | |
| limit | No | Max groups to return for category group_bys (default 25, max 100) | |
| naics | No | NAICS codes | |
| agency | No | Awarding toptier agency NAME as USASpending knows it (e.g. 'Department of Veterans Affairs') | |
| metric | No | 'obligations' (default; aggregated dollars) or 'count' (prime award count; only with group_by=set_aside) | |
| date_to | Yes | End date YYYY-MM-DD (required) | |
| group_by | Yes | One of: awarding_agency, awarding_subagency, recipient, naics, psc, month, set_aside | |
| date_from | Yes | Start date YYYY-MM-DD (required) | |
| date_type | No | Which award date the window filters on: 'action_date' (default), 'date_signed', or 'new_awards_only'. Different choices produce materially different totals — the response echoes this as date_field. | |
| set_aside | No | FPDS set-aside code(s), validated (e.g. ['8AN','SDVOSBS']). Required when group_by=set_aside. | |
| sub_agency | No | Awarding subtier agency name (requires agency) | |
| award_type_codes | No | Award type codes (default ['A','B','C','D'] = contract prime awards; see lookup_reference_code domain award_type) | |
| recipient_search | No | Recipient name or UEI text filter |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present when the tool could not do what was asked: a message, or an object with a stable `code` (bad_request, not_found, upstream_error, ...) and a `message`. The call is then marked isError. | |
| warnings | No | Caveats about this result, for example a filter the upstream did not honor. |