Skip to main content
Glama
Capture MCP Server

Capture MCP Server

by blen-labs

Aggregate Contracts

aggregate_contracts
Read-onlyIdempotent

Aggregate 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

NameRequiredDescriptionDefault
pscNoPSC codes
limitNoMax groups to return for category group_bys (default 25, max 100)
naicsNoNAICS codes
agencyNoAwarding toptier agency NAME as USASpending knows it (e.g. 'Department of Veterans Affairs')
metricNo'obligations' (default; aggregated dollars) or 'count' (prime award count; only with group_by=set_aside)
date_toYesEnd date YYYY-MM-DD (required)
group_byYesOne of: awarding_agency, awarding_subagency, recipient, naics, psc, month, set_aside
date_fromYesStart date YYYY-MM-DD (required)
date_typeNoWhich 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_asideNoFPDS set-aside code(s), validated (e.g. ['8AN','SDVOSBS']). Required when group_by=set_aside.
sub_agencyNoAwarding subtier agency name (requires agency)
award_type_codesNoAward type codes (default ['A','B','C','D'] = contract prime awards; see lookup_reference_code domain award_type)
recipient_searchNoRecipient name or UEI text filter

Output Schema

NameRequiredDescriptionDefault
errorNoPresent 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.
warningsNoCaveats about this result, for example a filter the upstream did not honor.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv4.0.2
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "error": {
      +      "description": "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.",
      +      "oneOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "additionalProperties": true,
      +          "properties": {
      +            "code": {
      +              "type": "string"
      +            },
      +            "message": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "code",
      +            "message"
      +          ],
      +          "type": "object"
      +        }
      +      ]
      +    },
      +    "warnings": {
      +      "description": "Caveats about this result, for example a filter the upstream did not honor.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Addedv1.0.1

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover safety and idempotency, and the description adds real operational context beyond them: per-code upstream queries for group_by=set_aside with ~4s pacing, and the constraint that metric 'count' is only valid for that grouping. It also discloses that counts carry a unit and that date_type selections materially change totals, which an agent needs in order to trust the numbers.

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 action and grouping options, then caveats. Dense but almost every clause carries information; the parenthetical about ~4s rate pacing and the count limitation are both load-bearing. Slightly run-on in the final sentence, but nothing is filler.

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?

For a 13-parameter aggregation tool with an output schema, the description covers purpose, grouping semantics, metric constraints, and the date-window nuance that affect result meaning. Remaining gaps (how filters like naics/psc/agency combine, ordering of returned groups) are modest and partly recoverable from the schema.

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 100%, so the baseline is 3; the description earns an extra point by explaining the interplay between group_by=set_aside and the metric parameter, including the performance cost of each set-aside code and the reason count is unavailable for other groupings. It does not add much for the filter parameters (naics, psc, agency), which are left entirely to the schema.

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 ('aggregate federal contract awards from USASpending') and immediately contrasts with row-pulling siblings ('without pulling rows'). The enumerated group_by values and the two metrics tell an agent exactly what shape of answer this tool produces.

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 a concrete usage exemplar ('how many 8(a) sole source awards per agency in Aug-Sep 2025') and a negative discriminator against row-level retrieval. It does not explicitly name get_usaspending_awards as the alternative, so the routing is implied rather than spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.