Skip to main content
Glama
cliwant

mcp-sam-gov

by cliwant

usas_get_agency_budget_function

Retrieve a federal agency's budget breakdown by program area for a specified fiscal year using its toptier code, showing spending amounts per program.

Instructions

Budget function breakdown for an agency × fiscal year. Returns the agency's spending by program area (e.g. VA: 'Income security for veterans' $204B, 'Hospital and medical care for veterans' $126B).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toptierCodeYes3-4 digit toptier code from usas_lookup_agency (e.g. '036' for VA)
fiscalYearNo
limitNo

Implementation Reference

  • Core handler function `getAgencyBudgetFunction` that calls the USAspending API endpoint `agency/{toptier_code}/budget_function/` and returns budget function breakdown with programs (name, obligated amount, outlays).
    export async function getAgencyBudgetFunction(args: {
      toptierCode: string;
      fiscalYear?: number;
      limit?: number;
    }) {
      const fy = args.fiscalYear ?? new Date().getUTCFullYear();
      type Resp = {
        toptier_code?: string;
        fiscal_year?: number;
        results?: {
          name?: string;
          children?: {
            name?: string;
            obligated_amount?: number;
            gross_outlay_amount?: number;
          }[];
        }[];
      };
      const json = await getUsas<Resp>(
        `agency/${args.toptierCode}/budget_function/?fiscal_year=${fy}&limit=${args.limit ?? 10}`,
      );
      return {
        toptierCode: json.toptier_code,
        fiscalYear: json.fiscal_year,
        functions: (json.results ?? []).map((r) => ({
          name: r.name ?? "",
          programs: (r.children ?? []).map((c) => ({
            name: c.name ?? "",
            obligated: c.obligated_amount ?? 0,
            outlays: c.gross_outlay_amount ?? 0,
          })),
        })),
      };
    }
  • Input schema `UsasAgencyBudgetInput` extending agency profile input with optional fiscalYear (min 2007) and limit (1-20).
    const UsasAgencyBudgetInput = UsasAgencyProfileInput.extend({
      fiscalYear: z.number().int().min(2007).optional(),
      limit: z.number().min(1).max(20).optional(),
    });
  • src/server.ts:419-424 (registration)
    Tool registration in the tools array: name 'usas_get_agency_budget_function', description explaining it returns budget function breakdown by program area.
    {
      name: "usas_get_agency_budget_function",
      description:
        "Budget function breakdown for an agency × fiscal year. Returns the agency's spending by program area (e.g. VA: 'Income security for veterans' $204B, 'Hospital and medical care for veterans' $126B).",
      inputSchema: UsasAgencyBudgetInput,
    },
  • src/server.ts:741-744 (registration)
    Handler dispatch case in the main switch statement: parses args with UsasAgencyBudgetInput and delegates to usas.getAgencyBudgetFunction.
    case "usas_get_agency_budget_function":
      return await usas.getAgencyBudgetFunction(
        UsasAgencyBudgetInput.parse(args),
      );
  • TypeScript type declaration for getAgencyBudgetFunction showing return type: {toptierCode, fiscalYear, functions: {name, programs: {name, obligated, outlays}[]}[]}.
    export declare function getAgencyBudgetFunction(args: {
        toptierCode: string;
        fiscalYear?: number;
        limit?: number;
    }): Promise<{
        toptierCode: string | undefined;
        fiscalYear: number | undefined;
        functions: {
            name: string;
            programs: {
                name: string;
                obligated: number;
                outlays: number;
            }[];
        }[];
    }>;
Behavior3/5

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

With no annotations, the description carries the full burden. It explains the output format (spending by program area with dollar examples) but does not disclose behavioral traits like result limits, error handling, authentication needs, or performance. The description adds moderate context beyond the bare output.

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?

Two sentences, front-loaded with the core purpose. The example adds concrete context without unnecessary words. Every sentence earns its place.

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

Completeness3/5

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

The tool has 3 parameters, no output schema, and many siblings. The description is concise but misses details: fiscalYear format, limit behavior, return structure (list vs object), and differentiation from similar tools like usas_search_agency_spending. It is adequate but not fully complete for confident use.

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

Parameters2/5

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

Schema coverage is only 33% (only toptierCode described). The description mentions fiscal year in the phrase 'agency × fiscal year' but does not explain its format or that it is optional. The 'limit' parameter is not mentioned at all. The description adds partial value for fiscalYear but fails to cover limit.

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 clearly states the tool returns a 'budget function breakdown for an agency × fiscal year' with specific verb 'returns' and resource 'spending by program area'. The example with VA and dollar amounts makes the purpose concrete. It distinguishes from sibling tools like usas_search_agency_spending by focusing on budget functions.

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

Usage Guidelines3/5

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

The description implies usage when needing a breakdown by program area, but provides no explicit when-to-use or when-not-to-use guidance, nor does it mention alternative tools. The context of siblings is not addressed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cliwant/mcp-sam-gov'

If you have feedback or need assistance with the MCP directory API, please join our Discord server