Skip to main content
Glama

Search Government Contracts

search_contracts

Search federal contract awards by agency, vendor, NAICS code, or keyword to find award details including value, performance period, and competition type.

Instructions

Search federal contract awards by agency, vendor, NAICS code, or keyword. Returns award details including value, period of performance, and competition type. Cost: $0.018 per query. Source: USAspending.gov, updated daily.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agencyNoAwarding agency name or abbreviation (e.g. DOD, HHS)
vendorNoVendor/contractor name (partial match)
naicsNoNAICS code filter
keywordNoKeyword search in award description
min_valueNoMinimum award value in USD
limitNoMaximum results (default 25)

Implementation Reference

  • The handler function for the `search_contracts` tool, which fetches data from the API based on provided filter parameters.
    async ({ agency, vendor, naics, keyword, min_value, limit }) => {
      const res = await apiGet<ContractQueryResponse>("/api/v1/contracts", {
        agency,
        vendor,
        naics,
        keyword,
        min_value,
        limit: limit ?? 25,
      });
    
      if (!res.ok) {
        return {
          content: [
            {
              type: "text" as const,
              text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
            },
          ],
          isError: true,
        };
      }
    
      const { count, data } = res.data;
      const warn = stalenessWarning(res);
      const summary = `${warn}Found ${count} contract award(s).`;
      const json = JSON.stringify(data, null, 2);
    
      return {
        content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
      };
    },
  • The input schema validation using Zod for the `search_contracts` tool parameters.
    inputSchema: {
      agency: z
        .string()
        .optional()
        .describe("Awarding agency name or abbreviation (e.g. DOD, HHS)"),
      vendor: z
        .string()
        .optional()
        .describe("Vendor/contractor name (partial match)"),
      naics: z
        .string()
        .optional()
        .describe("NAICS code filter"),
      keyword: z
        .string()
        .optional()
        .describe("Keyword search in award description"),
      min_value: z
        .number()
        .optional()
        .describe("Minimum award value in USD"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Maximum results (default 25)"),
    },
  • Registration of the `search_contracts` tool within the MCP server using server.registerTool.
    server.registerTool(
      "search_contracts",
      {
        title: "Search Government Contracts",
        description:
          "Search federal contract awards by agency, vendor, NAICS code, or keyword. " +
          "Returns award details including value, period of performance, and competition type. " +
          "Cost: $0.018 per query. Source: USAspending.gov, updated daily.",
        inputSchema: {
          agency: z
            .string()
            .optional()
            .describe("Awarding agency name or abbreviation (e.g. DOD, HHS)"),
          vendor: z
            .string()
            .optional()
            .describe("Vendor/contractor name (partial match)"),
          naics: z
            .string()
            .optional()
            .describe("NAICS code filter"),
          keyword: z
            .string()
            .optional()
            .describe("Keyword search in award description"),
          min_value: z
            .number()
            .optional()
            .describe("Minimum award value in USD"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum results (default 25)"),
        },
      },
      async ({ agency, vendor, naics, keyword, min_value, limit }) => {
        const res = await apiGet<ContractQueryResponse>("/api/v1/contracts", {
          agency,
          vendor,
          naics,
          keyword,
          min_value,
          limit: limit ?? 25,
        });
    
        if (!res.ok) {
          return {
            content: [
              {
                type: "text" as const,
                text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
              },
            ],
            isError: true,
          };
        }
    
        const { count, data } = res.data;
        const warn = stalenessWarning(res);
        const summary = `${warn}Found ${count} contract award(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );
Behavior4/5

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

With no annotations provided, the description carries full burden. It effectively discloses key behavioral traits: cost ($0.018 per query), data source (USAspending.gov), update frequency (daily), and return format details (value, period of performance, competition type). However, it doesn't mention rate limits, authentication requirements, or error conditions.

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 tightly packed sentences with zero waste. First sentence covers purpose and main parameters, second sentence adds return details, cost, source, and freshness - every element earns its place. Perfectly front-loaded with essential information.

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

Completeness4/5

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

For a search tool with no annotations and no output schema, the description does well by covering purpose, parameters, return format, cost, source, and freshness. However, it could benefit from mentioning pagination behavior (implied by 'limit' parameter) or typical result structure since there's no output schema.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds marginal value by listing searchable fields (agency, vendor, NAICS code, keyword) and mentioning value filtering, but doesn't provide additional syntax or format details beyond what the schema provides.

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 searches federal contract awards by specific criteria (agency, vendor, NAICS code, keyword) and returns detailed award information. It distinguishes itself from sibling tools like 'lookup_contract' or 'contract_stats' by emphasizing search functionality rather than lookup or statistical analysis.

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 for searching federal contracts with various filters, but doesn't explicitly state when to use this tool versus alternatives like 'lookup_contract' or 'contract_stats'. No guidance is provided about when not to use it or what prerequisites might exist.

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/carrierone/verilexdata-mcp'

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