Skip to main content
Glama

usaspending-mcp-server

Spending by Category

usaspending_spending_by_category
Read-onlyIdempotent

Aggregate federal spending grouped by a specific dimension: NAICS industry code, PSC product/service code, awarding agency, funding agency, CFDA assistance program, or recipient. Returns top items with obligation amounts — useful for trend and breakdown analysis. Chain NAICS codes into usaspending_search_awards filters or usaspending_autocomplete_filters lookups.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (1-based)
limitNoMaximum items to return (1–100)
filtersNoOptional filters to scope the aggregation
categoryYesBreakdown dimension: naics (industry), psc (product/service code), awarding_agency, awarding_subagency, funding_agency, funding_subagency, cfda (assistance programs), recipient_duns, or recipient_parent_duns

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoCurrent page returned
errorNoPresent when the call failed. Absent on success.
noticeNoNames a date bound that was filled in because only the other was supplied, and suggests how to broaden filters when results are empty. Absent when neither applies.
resultsNoTop items in this category by obligation amount
categoryNoBreakdown dimension used
has_nextNoWhether there are more pages
totalCountNoTotal number of items in this category (when available)
page_metadataNoPagination metadata
applied_keywordsNoKeyword filters applied (comma-separated)
applied_agency_nameNoAwarding agency name filter applied
applied_naics_codesNoNAICS code filters applied (comma-separated)
applied_time_period_endNoEnd date sent (YYYY-MM-DD), including a filled-in end
applied_time_period_startNoStart date sent (YYYY-MM-DD), including a filled-in start

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changed
    • addedInput schema / properties / filters / properties / time_period_end / anyOf
      Added value: +[
      +  {
      +    "const": "",
      +    "type": "string"
      +  },
      +  {
      +    "description": "Date as YYYY-MM-DD; month and day may be unpadded",
      +    "pattern": "^\\d{4}-\\d{1,2}-\\d{1,2}$",
      +    "type": "string"
      +  }
      +]
    • changedInput schema / properties / filters / properties / time_period_end / description
      Previous value: -"End date (YYYY-MM-DD)"New value: +"End date (YYYY-MM-DD). Given alone, the window starts at 2007-10-01, the earliest searchable date."
    • removedInput schema / properties / filters / properties / time_period_end / type
      Removed value: -"string"
    • addedInput schema / properties / filters / properties / time_period_start / anyOf
      Added value: +[
      +  {
      +    "const": "",
      +    "type": "string"
      +  },
      +  {
      +    "description": "Date as YYYY-MM-DD; month and day may be unpadded",
      +    "pattern": "^\\d{4}-\\d{1,2}-\\d{1,2}$",
      +    "type": "string"
      +  }
      +]
    • changedInput schema / properties / filters / properties / time_period_start / description
      Previous value: -"Start date (YYYY-MM-DD)"New value: +"Start date (YYYY-MM-DD), 2007-10-01 or later. Given alone, the window runs through today (UTC)."
    • removedInput schema / properties / filters / properties / time_period_start / type
      Removed value: -"string"
    • changedOutput schema / properties / applied_time_period_end / description
      Previous value: -"End date filter applied (YYYY-MM-DD)"New value: +"End date sent (YYYY-MM-DD), including a filled-in end"
    • changedOutput schema / properties / applied_time_period_start / description
      Previous value: -"Start date filter applied (YYYY-MM-DD)"New value: +"Start date sent (YYYY-MM-DD), including a filled-in start"
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `api_unavailable`: USAspending.gov API is unreachable or returns an error. `api_timeout`: USAspending.gov did not respond before the request deadline elapsed. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `api_unavailable`: USAspending.gov API is unreachable or returns an error. `api_timeout`: USAspending.gov did not respond before the request deadline elapsed. `date_range_inverted`: Both filters.time_period_start and filters.time_period_end were supplied and the start falls after the end. `date_before_earliest`: The resolved start date precedes the 2007-10-01 earliest date this endpoint can search. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "api_unavailable",
      -  "api_timeout"
      -]New value: +[
      +  "api_unavailable",
      +  "api_timeout",
      +  "date_range_inverted",
      +  "date_before_earliest"
      +]
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery hint when results are empty — suggests how to broaden filters. Absent when results are present."New value: +"Names a date bound that was filled in because only the other was supplied, and suggests how to broaden filters when results are empty. Absent when neither applies."
  2. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "category",
      +      "results",
      +      "page_metadata",
      +      "page",
      +      "has_next"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `api_unavailable`: USAspending.gov API is unreachable or returns an error. `api_timeout`: USAspending.gov did not respond before the request deadline elapsed. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "api_unavailable",
      +            "api_timeout"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "category",
      -  "results",
      -  "page_metadata",
      -  "page",
      -  "has_next"
      -]
  3. Changed2 schema fields changed
    • removedOutput schema / properties / total
      Removed value: -{
      -  "description": "Total number of items in this category (when available)",
      -  "type": "number"
      -}
    • addedOutput schema / properties / totalCount
      Added value: +{
      +  "description": "Total number of items in this category (when available)",
      +  "type": "number"
      +}
  4. Changed5 schema fields changed
    • addedOutput schema / properties / applied_agency_name
      Added value: +{
      +  "description": "Awarding agency name filter applied",
      +  "type": "string"
      +}
    • addedOutput schema / properties / applied_keywords
      Added value: +{
      +  "description": "Keyword filters applied (comma-separated)",
      +  "type": "string"
      +}
    • addedOutput schema / properties / applied_naics_codes
      Added value: +{
      +  "description": "NAICS code filters applied (comma-separated)",
      +  "type": "string"
      +}
    • addedOutput schema / properties / applied_time_period_end
      Added value: +{
      +  "description": "End date filter applied (YYYY-MM-DD)",
      +  "type": "string"
      +}
    • addedOutput schema / properties / applied_time_period_start
      Added value: +{
      +  "description": "Start date filter applied (YYYY-MM-DD)",
      +  "type": "string"
      +}
  5. Changed6 schema fields changed
    • addedOutput schema / properties / has_next
      Added value: +{
      +  "description": "Whether there are more pages",
      +  "type": "boolean"
      +}
    • removedOutput schema / properties / message
      Removed value: -{
      -  "description": "Recovery hint when results are empty — suggests how to broaden filters. Absent when results are present.",
      -  "type": "string"
      -}
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Recovery hint when results are empty — suggests how to broaden filters. Absent when results are present.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / page
      Added value: +{
      +  "description": "Current page returned",
      +  "type": "number"
      +}
    • addedOutput schema / properties / total
      Added value: +{
      +  "description": "Total number of items in this category (when available)",
      +  "type": "number"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "category",
      -  "results",
      -  "page_metadata"
      -]New value: +[
      +  "category",
      +  "results",
      +  "page_metadata",
      +  "page",
      +  "has_next"
      +]
  6. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover readOnlyHint, openWorldHint, and idempotentHint, so the safety profile is known. The description adds behavioral context by disclosing aggregation by dimension, top-item results with obligation amounts, and the chaining relationship to search/autocomplete tools. It does not contradict annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences and about 45 words, with the core aggregation behavior front-loaded before the use case and chaining guidance. Every sentence earns its place with no filler or redundancy.

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?

The tool is a complex aggregation endpoint with nested filters and an output schema, but the description covers the core behavior, supported categories, use case, and a follow-on workflow. Minor gaps like sorting order for 'top items' are not essential given the output schema and annotations.

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 100%, so all parameters (page, limit, filters, category) are already documented. The description adds minimal parameter-level meaning beyond the schema; it lists categories that echo the enum and gives one NAICS chaining tip. Baseline 3 is appropriate because the schema carries the burden.

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?

The description names the specific verb and resource: 'Aggregate federal spending grouped by a specific dimension', then enumerates the supported dimensions (NAICS, PSC, agencies, CFDA, recipient). It also states the output is top items with obligation amounts, which clearly distinguishes it from sibling tools like spending_by_geography or spending_over_time.

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?

The description gives clear context: 'useful for trend and breakdown analysis' and provides a concrete follow-on workflow ('Chain NAICS codes into usaspending_search_awards filters or usaspending_autocomplete_filters lookups'). It does not explicitly name alternatives to avoid or state when-not-to-use, but the usage context is strong enough.

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.