Skip to main content
Glama

usaspending-mcp-server

Search Federal Accounts

usaspending_search_federal_accounts
Read-onlyIdempotent

List and keyword-search federal accounts by directory toptier code or title keyword. Returns account numbers, names, managing agencies, and budgetary resources. fiscal_year selects the resource amounts, not account membership; omit it for the latest available submission year. Search and detail totals use different calculations and can differ for the same year. Use account_number from results as input to usaspending_get_federal_account for full budget detail. Use usaspending_list_agencies to look up the input agency_identifier (directory toptier_code, e.g. "097" for DoD or "1601" for Labor); account rows return their account-prefix agency_identifier, e.g. "016" for Labor.

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_search_federal_accounts"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoPage number (1-based)
limitNoAccounts per page. Default 10, at most 100 per call.
keywordNoFilter accounts by name or title keyword (e.g., "defense", "transportation")
sort_fieldNoField to sort results bybudgetary_resources
fiscal_yearNoFederal fiscal year (2001 through the current federal fiscal year; October 1 rollover). Omit or leave blank to preserve the endpoint default.
sort_directionNoSort directiondesc
agency_identifierNoDirectory toptier_code from usaspending_list_agencies (e.g., "097" for Defense, "1601" for Labor). This differs from the account-prefix agency_identifier returned in account rows (e.g., "016" for Labor).

Output Schema

NameRequiredDescriptionDefault
pageNoCurrent page number returned
errorNoPresent when the call failed. Absent on success.
noticeNoA reduced limit, and a recovery hint when results are empty — echoes applied filters and suggests how to broaden. Absent when neither applies.
resultsNoMatching federal accounts
has_nextNoWhether there are more pages of results
limitClampNoPresent when a count input above its per-call cap was reduced to the cap.
totalCountNoTotal number of matching accounts across all pages (when available)
fiscal_yearNoEffective fiscal year of the budgetary resources, as reported by USAspending; account membership spans all submitted years
page_metadataNoPagination metadata

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum results per page (1–100)"New value: +"Accounts per page. Default 10, at most 100 per call."
    • removedInput schema / properties / limit / maximum
      Removed value: -100
    • addedOutput schema / properties / limitClamp
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Present when a count input above its per-call cap was reduced to the cap.",
      +  "properties": {
      +    "applied": {
      +      "description": "Value the call used: the per-call cap",
      +      "type": "number"
      +    },
      +    "field": {
      +      "description": "Input that was reduced (e.g., limit)",
      +      "type": "string"
      +    },
      +    "requested": {
      +      "description": "Value the caller sent",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "field",
      +    "requested",
      +    "applied"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery hint when results are empty — echoes applied filters and suggests how to broaden. Absent when results are present."New value: +"A reduced limit, and a recovery hint when results are empty — echoes applied filters and suggests how to broaden. Absent when neither applies."
  2. Changed2 schema fields changed
    • changedInput schema / properties / agency_identifier / description
      Previous value: -"3-digit agency identifier code (e.g., \"097\" for Department of Defense). Use usaspending_list_agencies to look up codes."New value: +"Directory toptier_code from usaspending_list_agencies (e.g., \"097\" for Defense, \"1601\" for Labor). This differs from the account-prefix agency_identifier returned in account rows (e.g., \"016\" for Labor)."
    • changedOutput schema / properties / results / items / properties / agency_identifier / description
      Previous value: -"3-digit agency identifier code for this account"New value: +"Account-prefix agency identifier (e.g., 016 for Labor); distinct from the directory toptier_code used by the input filter"
  3. Changed2 schema fields changed
    • addedInput schema / properties / fiscal_year
      Added value: +{
      +  "anyOf": [
      +    {
      +      "description": "Integer federal fiscal year from 2001 through the current federal fiscal year",
      +      "maximum": 9007199254740991,
      +      "minimum": 2001,
      +      "type": "integer"
      +    },
      +    {
      +      "description": "Blank form value; leaves the fiscal year unset",
      +      "maxLength": 0,
      +      "minLength": 0,
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Federal fiscal year (2001 through the current federal fiscal year; October 1 rollover). Omit or leave blank to preserve the endpoint default."
      +}
    • addedOutput schema / properties / fiscal_year
      Added value: +{
      +  "description": "Effective fiscal year of the budgetary resources, as reported by USAspending; account membership spans all submitted years",
      +  "maximum": 9007199254740991,
      +  "minimum": -9007199254740991,
      +  "type": "integer"
      +}
  4. 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": [
      +      "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: -[
      -  "results",
      -  "page_metadata",
      -  "page",
      -  "has_next"
      -]
  5. Changed2 schema fields changed
    • removedOutput schema / properties / total
      Removed value: -{
      -  "description": "Total number of matching accounts across all pages (when available)",
      -  "type": "number"
      -}
    • addedOutput schema / properties / totalCount
      Added value: +{
      +  "description": "Total number of matching accounts across all pages (when available)",
      +  "type": "number"
      +}
  6. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/openWorld/idempotent annotations it discloses genuinely non-obvious behavior: fiscal_year changes the resource amounts but not account membership, and search totals versus detail totals use different calculations and may disagree for the same year. It also flags the account-prefix agency_identifier coming back in rows, which prevents a common misreading of results.

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?

Four tight sentences, front-loaded with purpose then warnings then routing, with no filler. Minor redundancy: the directory-versus-account-prefix identifier caveat is restated in both description and schema, and appears twice across the description's prose.

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?

An output schema exists, yet the description still summarizes returned fields, and the fiscal-year and total-mismatch caveats cover the main sources of misinterpretation for a 7-parameter search tool. Nothing an agent needs to call 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; the description earns an extra point by explaining that fiscal_year only affects reported resource amounts rather than which accounts are returned. The agency_identifier distinction it states largely duplicates the schema's own wording, so it is not fully additive.

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 opening sentence gives a specific verb pair (list, keyword-search) and resource (federal accounts), plus the two lookup paths (directory toptier code or title keyword). It also states what the results contain, and explicitly names usaspending_get_federal_account as the detail sibling, so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It names two alternatives with the condition that selects each: usaspending_get_federal_account for full budget detail using a returned account_number, and usaspending_list_agencies for resolving the agency_identifier input. It also gives when-to-omit guidance for fiscal_year (omit for the latest submission year).

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.