Skip to main content
Glama

usaspending-mcp-server

Get Agency Overview

usaspending_get_agency
Read-onlyIdempotent

Fetch an agency's fiscal-year overview including mission, budgetary resources, obligation and outlay totals (for the most recent fiscal year with reported budget data), sub-agency count, and disaster/emergency funding codes. def_codes_fiscal_year names the fiscal year covered by def_codes, which follows the budget totals when available. budget_by_fiscal_year carries the same totals for every fiscal year with reported data since FY2017, newest first, for budget trends; a row whose reported_through_period is below 12 is year-to-date, so compare it to full years with care. Also returns a paginated sub-agency breakdown with obligation and transaction counts for the same fiscal year as the budget totals (the current fiscal year when no budget year is available within 5 seconds); sub_agency_fiscal_year names the year it covers. Accepts exactly one directory toptier_code (e.g., 097 for DoD, 1601 for Labor; one/two-digit numeric inputs are zero-padded to three digits) or an agency_slug (e.g., department-of-defense) — both appear in usaspending_list_agencies results and award search results. When the budget, sub-agency or DEF code request fails, the overview is still returned and unavailable_sections names each missing section with its reason.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "usaspending_get_agency"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoSub-agency breakdown page (1-based, 10 per page). Use with sub_agency_page_metadata.has_next to page through the full list.
agency_slugNoURL-friendly agency slug (e.g., department-of-defense) — from usaspending_list_agencies or award search results. Use either toptier_code or agency_slug, not both.
toptier_codeNoDirectory toptier agency code (e.g., 097, 012, 1601) from usaspending_list_agencies. One/two-digit numeric values are padded to three digits (80 becomes 080); three/four-digit codes are preserved. Use either toptier_code or agency_slug, not both.

Output Schema

NameRequiredDescriptionDefault
nameNoAgency full name
errorNoPresent when the call failed. Absent on success.
noticeNoHow to page for more sub-agencies when the breakdown is truncated, and which sections failed to load and whether a retry may recover them. Absent when neither applies.
missionNoAgency mission statement
websiteNoAgency website URL
agency_idNoInternal agency ID
def_codesNoDisaster/Emergency Funding (DEF) codes for the budget year, or for the default overview when no budget year is available. Empty when upstream returned no codes. Omitted when unavailable.
fiscal_yearNoFiscal year the budgetary totals below reflect: the most recent year with reported budget data, which can trail the current fiscal year (a new year has no amounts until the agency first reports in it)
abbreviationNoAgency abbreviation
sub_agenciesNoSub-agency breakdown within this toptier agency (one page)
toptier_codeNoDirectory toptier agency code, which can have three or four digits
outlay_amountNoTotal outlays in USD for the fiscal year
sub_agency_pageNoCurrent sub-agency page returned. Absent when the sub-agency request failed.
obligated_amountNoTotal amount obligated in USD for the fiscal year
sub_agency_totalNoTotal sub-agencies across all pages (when available)
subtier_agency_countNoNumber of sub-agencies within this toptier agency
unavailable_sectionsNoSections omitted because their request failed while the agency overview loaded. Absent when every section loaded.
budget_by_fiscal_yearNoBudgetary resources, obligations, and outlays for every fiscal year with reported data since FY2017, newest first. The first row is the year fiscal_year and the totals above report. Each row is as of the latest closed reporting period of its year. Absent when no year carries data or the budget request failed.
def_codes_fiscal_yearNoFiscal year covered by def_codes, when USAspending reports it
has_more_sub_agenciesNoWhether more sub-agency pages are available. Absent when the sub-agency request failed, since pagination is then unknown.
sub_agency_fiscal_yearNoFiscal year the sub-agency breakdown covers, as upstream reports it: the same year as fiscal_year, or the current fiscal year when no budget year was available within 5 seconds — so it can differ from fiscal_year even when both are present. Absent when the sub-agency request failed, or when upstream reports no year for a breakdown requested without one.
sub_agency_page_metadataNoPagination metadata for the sub-agency breakdown
budgetary_resources_amountNoTotal budgetary resources in USD for the fiscal year

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / unavailable_sections / items / properties / reason / description
      Previous value: -"api_unavailable: USAspending was unreachable or answered with a server error. api_timeout: no answer before the request deadline. upstream_error: USAspending rejected the request, or its record lacks the identifier the section is requested by."New value: +"api_unavailable: USAspending was unreachable, throttled the request, or answered with a server error. api_timeout: no answer before the request deadline. upstream_error: USAspending rejected the request, or its record lacks the identifier the section is requested by."
  2. Changed4 schema fields changed
    • changedOutput schema / properties / def_codes / description
      Previous value: -"Disaster/Emergency Funding (DEF) codes applicable to this agency"New value: +"Disaster/Emergency Funding (DEF) codes for the budget year, or for the default overview when no budget year is available. Empty when upstream returned no codes. Omitted when unavailable."
    • addedOutput schema / properties / def_codes_fiscal_year
      Added value: +{
      +  "description": "Fiscal year covered by def_codes, when USAspending reports it",
      +  "type": "number"
      +}
    • changedOutput schema / properties / unavailable_sections / items / properties / section / description
      Previous value: -"budgetary_resources: fiscal_year, the budget, obligation, and outlay totals, and budget_by_fiscal_year. sub_agencies: the sub-agency breakdown and its pagination."New value: +"budgetary_resources: fiscal_year, the budget, obligation, and outlay totals, and budget_by_fiscal_year. sub_agencies: the breakdown and its pagination. def_codes: the disaster/emergency funding codes and their fiscal year."
    • changedOutput schema / properties / unavailable_sections / items / properties / section / enum
      Previous value: -[
      -  "budgetary_resources",
      -  "sub_agencies"
      -]New value: +[
      +  "budgetary_resources",
      +  "sub_agencies",
      +  "def_codes"
      +]
  3. Changed3 schema fields changed
    • addedOutput schema / properties / budget_by_fiscal_year
      Added value: +{
      +  "description": "Budgetary resources, obligations, and outlays for every fiscal year with reported data since FY2017, newest first. The first row is the year fiscal_year and the totals above report. Each row is as of the latest closed reporting period of its year. Absent when no year carries data or the budget request failed.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "One fiscal year of budget data; a null upstream amount is omitted",
      +    "properties": {
      +      "budgetary_resources_amount": {
      +        "description": "Total budgetary resources in USD for the year",
      +        "type": "number"
      +      },
      +      "fiscal_year": {
      +        "description": "Fiscal year (FY2026 ran October 2025 – September 2026)",
      +        "type": "number"
      +      },
      +      "obligated_amount": {
      +        "description": "Amount obligated in USD for the year, through reported_through_period",
      +        "type": "number"
      +      },
      +      "outlay_amount": {
      +        "description": "Outlays in USD for the year, through reported_through_period",
      +        "type": "number"
      +      },
      +      "reported_through_period": {
      +        "description": "Last reporting period the row covers (1–12, 1 = October). Below 12, the year is still being reported and its amounts are year-to-date, not comparable to a full year. Absent when upstream lists no reporting periods for the year.",
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "fiscal_year"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / unavailable_sections / items / properties / reason / description
      Previous value: -"api_unavailable: USAspending was unreachable or answered with a server error. api_timeout: no answer before the request deadline. upstream_error: USAspending rejected the request."New value: +"api_unavailable: USAspending was unreachable or answered with a server error. api_timeout: no answer before the request deadline. upstream_error: USAspending rejected the request, or its record lacks the identifier the section is requested by."
    • changedOutput schema / properties / unavailable_sections / items / properties / section / description
      Previous value: -"budgetary_resources: fiscal_year and the budget, obligation, and outlay totals. sub_agencies: the sub-agency breakdown and its pagination."New value: +"budgetary_resources: fiscal_year, the budget, obligation, and outlay totals, and budget_by_fiscal_year. sub_agencies: the sub-agency breakdown and its pagination."
  4. Changed2 schema fields changed
    • changedInput schema / properties / toptier_code / description
      Previous value: -"3-digit toptier agency code (e.g., 097, 012) — from usaspending_list_agencies. Use either toptier_code or agency_slug, not both."New value: +"Directory toptier agency code (e.g., 097, 012, 1601) from usaspending_list_agencies. One/two-digit numeric values are padded to three digits (80 becomes 080); three/four-digit codes are preserved. Use either toptier_code or agency_slug, not both."
    • changedOutput schema / properties / toptier_code / description
      Previous value: -"3-digit toptier agency code"New value: +"Directory toptier agency code, which can have three or four digits"
  5. Changed9 schema fields changed
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "sub_agency_page",
      -      "has_more_sub_agencies"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    }
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `agency_not_found`: No agency found for the given toptier_code or agency_slug. `missing_input`: Neither toptier_code nor agency_slug was provided. `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: `agency_not_found`: No agency found for the given toptier_code or agency_slug. `missing_input`: Neither toptier_code nor agency_slug was provided. `conflicting_input`: Both toptier_code and agency_slug were provided. `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."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "agency_not_found",
      -  "missing_input",
      -  "api_unavailable",
      -  "api_timeout"
      -]New value: +[
      +  "agency_not_found",
      +  "missing_input",
      +  "conflicting_input",
      +  "api_unavailable",
      +  "api_timeout"
      +]
    • changedOutput schema / properties / fiscal_year / description
      Previous value: -"Fiscal year the budgetary totals below reflect (most recent available)"New value: +"Fiscal year the budgetary totals below reflect: the most recent year with reported budget data, which can trail the current fiscal year (a new year has no amounts until the agency first reports in it)"
    • changedOutput schema / properties / has_more_sub_agencies / description
      Previous value: -"Whether more sub-agency pages are available"New value: +"Whether more sub-agency pages are available. Absent when the sub-agency request failed, since pagination is then unknown."
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when the sub-agency breakdown is truncated — how to page for the rest. Absent when the last page is shown."New value: +"How to page for more sub-agencies when the breakdown is truncated, and which sections failed to load and whether a retry may recover them. Absent when neither applies."
    • addedOutput schema / properties / sub_agency_fiscal_year
      Added value: +{
      +  "description": "Fiscal year the sub-agency breakdown covers, as upstream reports it: the same year as fiscal_year, or the current fiscal year when no budget year was available within 5 seconds — so it can differ from fiscal_year even when both are present. Absent when the sub-agency request failed, or when upstream reports no year for a breakdown requested without one.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / sub_agency_page / description
      Previous value: -"Current sub-agency page returned"New value: +"Current sub-agency page returned. Absent when the sub-agency request failed."
    • addedOutput schema / properties / unavailable_sections
      Added value: +{
      +  "description": "Sections omitted because their request failed while the agency overview loaded. Absent when every section loaded.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "A section omitted from the result because its request failed",
      +    "properties": {
      +      "message": {
      +        "description": "The failure message for this section.",
      +        "type": "string"
      +      },
      +      "reason": {
      +        "description": "api_unavailable: USAspending was unreachable or answered with a server error. api_timeout: no answer before the request deadline. upstream_error: USAspending rejected the request.",
      +        "enum": [
      +          "api_unavailable",
      +          "api_timeout",
      +          "upstream_error"
      +        ],
      +        "type": "string"
      +      },
      +      "retryable": {
      +        "description": "Whether retrying the call may load this section.",
      +        "type": "boolean"
      +      },
      +      "section": {
      +        "description": "budgetary_resources: fiscal_year and the budget, obligation, and outlay totals. sub_agencies: the sub-agency breakdown and its pagination.",
      +        "enum": [
      +          "budgetary_resources",
      +          "sub_agencies"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "section",
      +      "reason",
      +      "retryable",
      +      "message"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  6. 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": [
      +      "sub_agency_page",
      +      "has_more_sub_agencies"
      +    ]
      +  },
      +  {
      +    "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: `agency_not_found`: No agency found for the given toptier_code or agency_slug. `missing_input`: Neither toptier_code nor agency_slug was provided. `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": [
      +            "agency_not_found",
      +            "missing_input",
      +            "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: -[
      -  "sub_agency_page",
      -  "has_more_sub_agencies"
      -]
  7. Changed14 schema fields changed
    • addedInput schema / properties / page
      Added value: +{
      +  "default": 1,
      +  "description": "Sub-agency breakdown page (1-based, 10 per page). Use with sub_agency_page_metadata.has_next to page through the full list.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • removedOutput schema / properties / budget_authority_amount
      Removed value: -{
      -  "description": "Total budget authority amount in USD for current fiscal year",
      -  "type": "number"
      -}
    • addedOutput schema / properties / budgetary_resources_amount
      Added value: +{
      +  "description": "Total budgetary resources in USD for the fiscal year",
      +  "type": "number"
      +}
    • addedOutput schema / properties / fiscal_year
      Added value: +{
      +  "description": "Fiscal year the budgetary totals below reflect (most recent available)",
      +  "type": "number"
      +}
    • addedOutput schema / properties / has_more_sub_agencies
      Added value: +{
      +  "description": "Whether more sub-agency pages are available",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Guidance when the sub-agency breakdown is truncated — how to page for the rest. Absent when the last page is shown.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / obligated_amount / description
      Previous value: -"Total obligated amount in USD for current fiscal year"New value: +"Total amount obligated in USD for the fiscal year"
    • addedOutput schema / properties / outlay_amount
      Added value: +{
      +  "description": "Total outlays in USD for the fiscal year",
      +  "type": "number"
      +}
    • changedOutput schema / properties / sub_agencies / description
      Previous value: -"Sub-agency breakdown within this toptier agency"New value: +"Sub-agency breakdown within this toptier agency (one page)"
    • addedOutput schema / properties / sub_agency_page
      Added value: +{
      +  "description": "Current sub-agency page returned",
      +  "type": "number"
      +}
    • addedOutput schema / properties / sub_agency_page_metadata
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Pagination metadata for the sub-agency breakdown",
      +  "properties": {
      +    "has_next": {
      +      "description": "Whether more sub-agency pages are available",
      +      "type": "boolean"
      +    },
      +    "limit": {
      +      "description": "Sub-agencies per page",
      +      "type": "number"
      +    },
      +    "page": {
      +      "description": "Current sub-agency page number",
      +      "type": "number"
      +    },
      +    "total": {
      +      "description": "Total sub-agencies across all pages",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "page",
      +    "has_next",
      +    "limit"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / sub_agency_total
      Added value: +{
      +  "description": "Total sub-agencies across all pages (when available)",
      +  "type": "number"
      +}
    • removedOutput schema / properties / transactions_count
      Removed value: -{
      -  "description": "Total transaction count",
      -  "type": "number"
      -}
    • addedOutput schema / required
      Added value: +[
      +  "sub_agency_page",
      +  "has_more_sub_agencies"
      +]
  8. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations cover only the safety profile (readOnly/idempotent/closed-world), and the description adds real operational context beyond them: partial results are still returned with unavailable_sections naming failures and reasons, the sub-agency year falls back to the current fiscal year after a 5-second wait, codes are zero-padded to three digits, and rows with reported_through_period below 12 are year-to-date. These are exactly the behaviors an agent cannot infer from structured fields.

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

Conciseness3/5

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

It is front-loaded and every clause carries information, but it is a single dense ~200-word paragraph with no structural breaks. Because an output schema exists, the long run-through of returned fields (budget totals, DEF codes, sub-agency breakdown) partially duplicates structured data, though the YTD caveat and fallback rules justify their space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with partial-failure semantics and an implicit fallback, this covers what matters: degradation to partial overview, the fallback year choice with its latency bound, per-section fiscal-year labeling, and pagination via has_next. Nothing essential to invoking it correctly is missing.

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, but the description adds meaning the schema lacks: the mutual-exclusivity of toptier_code and agency_slug (the schema has no required list or oneOf), the zero-padding normalization for one/two-digit inputs, and the fact that page walks a 10-per-page sub-agency list. It stops short of showing a fully worked multi-page retrieval example.

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?

Opens with a specific verb and resource ("Fetch an agency's fiscal-year overview") and enumerates exactly what the payload contains: mission, budgetary resources, obligations/outlays, sub-agency count, DEF codes. It also differentiates scope against the sibling that supplies its inputs (usaspending_list_agencies), so an agent can identify it without opening the schema.

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?

It states the identity constraint clearly — "exactly one" of toptier_code or agency_slug — and tells the agent where those values come from (usaspending_list_agencies results, award search results). What it does not do is state when to prefer this tool over list_agencies or search_* for a given question, so routing guidance is clear but not complete.

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.