usas_search_federal_account_spending
Search federal account spending broken down by Treasury Account Symbol (TAS). Filter by agency, NAICS, or fiscal year to map money to budget line items like '036-0167 = Information Technology Systems, VA'.
Instructions
Spending broken down by federal account / Treasury Account Symbol (TAS). Use to map money to the actual budget line item (e.g. '036-0167 = Information Technology Systems, VA').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agency | No | ||
| naics | No | ||
| fiscalYear | No | ||
| limit | No |
Implementation Reference
- src/usaspending.ts:534-555 (handler)The actual handler function `searchFederalAccountSpending` that calls the USAspending API endpoint 'search/spending_by_category/federal_account' with built filters and returns an array of federal accounts (TAS codes), account names, and amounts.
export async function searchFederalAccountSpending(args: { agency?: string; naics?: string; fiscalYear?: number; limit?: number; }) { const filters = buildFilters(args); type Resp = { results?: { code?: string; name?: string; amount?: number }[]; }; const json = await postUsas<Resp>( "search/spending_by_category/federal_account", { filters, limit: args.limit ?? 10, page: 1 }, ); return { accounts: (json.results ?? []).map((r) => ({ tasCode: r.code ?? "", accountName: r.name ?? "", amount: r.amount ?? 0, })), }; } - src/server.ts:136-141 (schema)The Zod input schema `UsasCategorySpendingInput` used by the federal account spending tool, accepting optional agency, naics, fiscalYear, and limit parameters.
const UsasCategorySpendingInput = z.object({ agency: z.string().optional(), naics: z.string().optional(), fiscalYear: z.number().int().min(2007).optional(), limit: z.number().min(1).max(50).optional(), }); - src/server.ts:393-398 (registration)The tool registration entry in the TOOLS array defining the tool name 'usas_search_federal_account_spending', its description, and linking to UsasCategorySpendingInput schema.
{ name: "usas_search_federal_account_spending", description: "Spending broken down by federal account / Treasury Account Symbol (TAS). Use to map money to the actual budget line item (e.g. '036-0167 = Information Technology Systems, VA').", inputSchema: UsasCategorySpendingInput, }, - src/server.ts:723-726 (registration)The switch-case handler in runTool that dispatches 'usas_search_federal_account_spending' to the searchFederalAccountSpending function with parsed args from UsasCategorySpendingInput.
case "usas_search_federal_account_spending": return await usas.searchFederalAccountSpending( UsasCategorySpendingInput.parse(args), );