Skip to main content
Glama

top_vendors

Identify leading government contractors by analyzing total award values, agency-specific rankings, and contract counts using USAspending.gov data.

Instructions

Get vendor rankings by total award value. Shows top contractors by agency, total awards, and contract counts. Cost: $0.03 per query. Source: USAspending.gov.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agencyNoFilter by awarding agency
periodNoTime period for ranking (default: 1y)
limitNoMaximum results (default 25)

Implementation Reference

  • Handler implementation for the "top_vendors" tool, including its registration, Zod schema definition for inputs, and the API call logic.
    server.registerTool(
      "top_vendors",
      {
        title: "Top Government Contract Vendors",
        description:
          "Get vendor rankings by total award value. Shows top contractors by agency, " +
          "total awards, and contract counts. " +
          "Cost: $0.03 per query. Source: USAspending.gov.",
        inputSchema: {
          agency: z
            .string()
            .optional()
            .describe("Filter by awarding agency"),
          period: z
            .enum(["1y", "3y", "5y", "all"])
            .optional()
            .describe("Time period for ranking (default: 1y)"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum results (default 25)"),
        },
      },
      async ({ agency, period, limit }) => {
        const res = await apiGet<ContractQueryResponse>("/api/v1/contracts/vendors", {
          agency,
          period: period ?? "1y",
          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} vendor(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );

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