Skip to main content
Glama
cliwant

mcp-sam-gov

by cliwant

usas_search_psc_spending

Search federal spending broken down by Product Service Code (PSC) to analyze market structure and identify top spending categories beyond NAICS.

Instructions

Spending broken down by Product Service Code (PSC). Use for 'what PSC categories see the most $ at DoD' — surfaces market structure beyond NAICS (e.g. PSC R425 = engineering support services).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agencyNo
naicsNo
fiscalYearNo
limitNo

Implementation Reference

  • The actual handler function 'searchPscSpending' that calls the USAspending 'search/spending_by_category/psc' API endpoint and returns spending broken down by PSC code.
    export async function searchPscSpending(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/psc",
        { filters, limit: args.limit ?? 10, page: 1 },
      );
      return {
        psc: (json.results ?? []).map((r) => ({
          pscCode: r.code ?? "",
          pscName: r.name ?? "",
          amount: r.amount ?? 0,
        })),
      };
    }
  • Input validation schema 'UsasCategorySpendingInput' used by the tool, defined with Zod.
    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:376-381 (registration)
    Tool registration with name 'usas_search_psc_spending', description, and inputSchema binding.
    {
      name: "usas_search_psc_spending",
      description:
        "Spending broken down by Product Service Code (PSC). Use for 'what PSC categories see the most $ at DoD' — surfaces market structure beyond NAICS (e.g. PSC R425 = engineering support services).",
      inputSchema: UsasCategorySpendingInput,
    },
  • src/server.ts:722-725 (registration)
    Case statement routing the tool name to the handler function in the server's main switch.
    case "usas_search_psc_spending":
      return await usas.searchPscSpending(
        UsasCategorySpendingInput.parse(args),
      );
  • Helper 'buildFilters' constructs the shared filter object used by searchPscSpending and other category endpoints.
    function buildFilters(args: {
      agency?: string;
      naics?: string;
      fiscalYear?: number;
      setAside?: string;
      pscCodes?: string[];
    }): UsasFilters {
      const filters: UsasFilters = { award_type_codes: ["A", "B", "C", "D"] };
      if (args.agency) {
        filters.agencies = [
          { type: "awarding", tier: "toptier", name: args.agency },
        ];
      }
      if (args.naics) filters.naics_codes = [args.naics];
      if (args.fiscalYear) {
        filters.time_period = [
          {
            start_date: `${args.fiscalYear - 1}-10-01`,
            end_date: `${args.fiscalYear}-09-30`,
          },
        ];
      }
      if (args.setAside) filters.set_aside_type_codes = [args.setAside];
      if (args.pscCodes?.length) filters.psc_codes = args.pscCodes;
      return filters;
    }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states that the tool returns spending broken down by PSC, but does not mention authentication, rate limits, output format, pagination, or any restrictions. The description is minimal and lacks important behavioral context.

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 only two sentences long, front-loads the core purpose, and provides an example. Every sentence adds value without redundancy.

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

Completeness2/5

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

Given the moderate complexity (4 parameters, no annotations, no output schema), the description is incomplete. It lacks parameter details, output structure, and cues for when to use it among many sibling spending tools. It does not explain how to interpret results or if there are any constraints like mandatory filters.

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

Parameters1/5

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

The schema has 0% description coverage for its 4 parameters (agency, naics, fiscalYear, limit). The description does not explain any of these parameters or how they affect the query. This is a significant gap as the agent receives no guidance on parameter usage beyond their names.

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?

Clearly states the tool breaks down spending by Product Service Code (PSC) and gives an example use case ('what PSC categories see the most $ at DoD'). The mention of 'beyond NAICS' differentiates it from NAICS-focused tools, and the name includes 'psc_spending' which aligns with its purpose.

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?

Provides a clear use case ('Use for what PSC categories see the most $ at DoD') and implies market structure analysis. However, it does not explicitly state when not to use this tool or mention alternative tools for similar but different queries (e.g., by agency or subagency).

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