Skip to main content
Glama
cliwant

mcp-sam-gov

by cliwant

usas_search_awards_by_recipient

Retrieve contract award line items for a specific recipient by agency, NAICS code, and fiscal year. Returns detailed records including NAICS code and description, not aggregates.

Instructions

Pull every contract a specific recipient has won within an agency × NAICS slice. Use when the user asks 'show me Booz Allen wins at VA last year' — returns line items + naicsCode + description, not aggregates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipientNameYes
agencyNo
naicsNo
fiscalYearNo
limitNo

Implementation Reference

  • src/server.ts:343-348 (registration)
    Tool registration in the TOOLS array — defines name, description, and inputSchema for 'usas_search_awards_by_recipient'.
    {
      name: "usas_search_awards_by_recipient",
      description:
        "Pull every contract a specific recipient has won within an agency × NAICS slice. Use when the user asks 'show me Booz Allen wins at VA last year' — returns line items + naicsCode + description, not aggregates.",
      inputSchema: UsasRecipientAwardsInput,
    },
  • Zod input schema UsasRecipientAwardsInput with fields: recipientName (required), agency, naics, fiscalYear, limit (optional).
    const UsasRecipientAwardsInput = z.object({
      recipientName: z.string(),
      agency: z.string().optional(),
      naics: z.string().optional(),
      fiscalYear: z.number().int().min(2007).optional(),
      limit: z.number().min(1).max(50).optional(),
    });
  • Handler function searchAwardsByRecipient — posts to USAspending 'search/spending_by_award' endpoint with recipient filter, returns line items (awardId, recipient, amount, agency, NAICS, description, generatedInternalId).
    export async function searchAwardsByRecipient(args: {
      recipientName: string;
      agency?: string;
      naics?: string;
      fiscalYear?: number;
      limit?: number;
    }) {
      const filters = buildFilters(args);
      filters.recipient_search_text = [args.recipientName];
      type Resp = {
        results?: {
          "Award ID"?: string;
          "Recipient Name"?: string;
          "Award Amount"?: number;
          "Awarding Agency"?: string;
          "Awarding Sub Agency"?: string;
          NAICS?: { code?: string; description?: string };
          Description?: string;
          generated_internal_id?: string;
        }[];
      };
      const json = await postUsas<Resp>("search/spending_by_award", {
        filters,
        fields: [
          "Award ID",
          "Recipient Name",
          "Award Amount",
          "Awarding Agency",
          "Awarding Sub Agency",
          "NAICS",
          "Description",
        ],
        limit: args.limit ?? 15,
        page: 1,
        subawards: false,
      });
      const results = json.results ?? [];
      return {
        awards: results.map((r) => ({
          awardId: r["Award ID"] ?? "",
          recipient: r["Recipient Name"] ?? "",
          amount: r["Award Amount"] ?? 0,
          awardingAgency: r["Awarding Agency"] ?? "",
          awardingSubAgency: r["Awarding Sub Agency"],
          naicsCode: r.NAICS?.code,
          naicsDescription: r.NAICS?.description,
          description: r.Description,
          generatedInternalId: r.generated_internal_id ?? "",
        })),
        totalRecords: results.length,
      };
    }
  • src/server.ts:695-698 (registration)
    Tool dispatch in runTool switch statement — calls usas.searchAwardsByRecipient with parsed UsasRecipientAwardsInput.
    case "usas_search_awards_by_recipient":
      return await usas.searchAwardsByRecipient(
        UsasRecipientAwardsInput.parse(args),
      );
  • Helper function buildFilters — constructs USAspending filter object from agency, naics, fiscalYear params. Used by searchAwardsByRecipient.
    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 carries the full burden. It states the tool 'pulls' data (a read operation) but does not disclose any safety, rate limits, or other behavioral traits beyond the basic function.

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 extremely concise: two sentences covering functional purpose and a concrete usage example. No unnecessary words or repetition.

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 description covers the core purpose and usage context, but with 5 parameters, no output schema, and no annotations, it lacks detail on parameter formats, allowed values, and exact return structure. It is minimally adequate for a simple search tool but not fully complete.

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?

With 0% schema description coverage, the description should compensate but only mentions 'agency × NAICS slice' and the returned fields. The meanings of 'fiscalYear' and 'limit' are not elaborated, leaving the agent to infer from parameter 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?

The description clearly states the tool pulls every contract for a specific recipient within an agency × NAICS slice. It provides a concrete usage example ('show me Booz Allen wins at VA last year') and distinguishes itself from aggregate tools by specifying it returns line items, not aggregates.

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?

The description explicitly says when to use the tool via the example query and notes that it returns non-aggregate data. While it implies when not to use (if aggregates are needed), it does not explicitly list alternative tools among the many siblings.

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