Skip to main content
Glama

spending_by_category

Read-only

Aggregate spending by a dimension (top vendors, top agencies, top NAICS, etc.).

The 'category' parameter controls the grouping dimension. Common uses:
- category='recipient': top vendors for a filter set (vendor landscape analysis)
- category='awarding_subagency': which contracting offices within an agency
- category='naics': which work categories got the most spending
- category='psc': which product/service codes got the most spending
- category='state_territory': geographic distribution
- category='cfda': grant assistance listings

Note: recipient category returns vendor names in ALL CAPS and may contain
duplicates (subsidiaries, rebrands, re-registrations). For precise market
share, apply name normalization to the returned 'name' field.

At least one filter is required. An unfiltered call would silently
aggregate the entire USASpending database (all years, all agencies),
which is never what a caller wants.

date_type controls the transaction date window. Omitted (the default)
or 'action_date', it selects transaction actions inside the window.
'date_signed' selects the associated award's first signing date;
'last_modified_date' selects transaction update dates. 'new_awards_only'
retains in-window actions associated with awards first signed in the
window. These are transaction obligation totals, not new-award counts:
use new_awards_over_time for counts. Award search/count tools use a
different default interval-overlap rule.
date_type needs time_period_start and/or time_period_end.

program_numbers filters assistance awards by assistance listing (CFDA)
number, e.g. ['93.778'] for Medicaid; use it with award_type='grants',
'loans', 'direct_payments', or 'other'. autocomplete_cfda() finds numbers
by program name.

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": {
      "category": "<category>"
    },
    "name": "spending_by_category"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNo
limitNo
categoryYes
keywordsNo
date_typeNo
def_codesNo
psc_codesNo
award_typeNo
naics_codesNo
funding_agencyNo
recipient_nameNo
awarding_agencyNo
program_numbersNo
time_period_endNo
time_period_startNo
awarding_subagencyNo
set_aside_type_codesNo
extent_competed_type_codesNo
contract_pricing_type_codesNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Annotations only cover read-only/open-world; the description adds genuine behavioral context beyond that: the unfiltered call silently aggregates the whole USASpending database, date_type changes which records fall in the window, results are transaction obligation totals rather than award counts, and award search/count tools use a different interval rule. It also warns that recipient names come back in ALL CAPS with duplicate subsidiaries requiring normalization.

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 purpose sentence followed by a scannable bulleted category list, with the critical filter precondition given its own line. Some prose (e.g. the multi-sentence recipient normalization note, repetition of the date_type dependency) could be tightened, 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?

With an output schema and annotations present, the description need only cover calling constraints, and it covers the two that would most likely cause a wrong call: missing filters and mis-set date_type. The remaining gap is the large set of undocumented filter parameters, which an agent must infer from names alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 19 parameters, so the description must carry the load. It does well on category (six enumerated use cases with concrete values), date_type (all four modes explained), program_numbers (example ['93.778'] with a compatible award_type caveat) and the time_period dependency, but says nothing about keywords, def_codes, psc_codes, naics_codes, agency/subagency filters, set-aside/competition/pricing code params, page or limit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Aggregate spending by a dimension') and enumerates the grouping dimensions with intent labels such as 'vendor landscape analysis' and 'geographic distribution'. Partial sibling differentiation — it routes counts to new_awards_over_time but never contrasts itself with spending_by_geography or spending_over_time, which cover overlapping territory.

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?

Explicit when-to-use via per-category use cases and an explicit precondition ('At least one filter is required'), plus a pointer to autocomplete_cfda for program name lookup. It does not resolve the ambiguity with the sibling spending_by_geography despite offering category='state_territory', so one clear alternative remains unaddressed.

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.