Skip to main content
Glama

Lookup Contract Award

lookup_contract

Retrieve complete details of a federal contract award by its ID, including modifications, sub-awards, and performance history.

Instructions

Look up a single federal contract award by its ID. Returns full award details including modifications, sub-awards, and performance history. Cost: $0.018 per query. Source: USAspending.gov.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_idYesContract award ID

Implementation Reference

  • The async handler function for lookup_contract. Takes { contract_id } input, makes an API GET request to `/api/v1/contracts/{contract_id}`, and returns formatted JSON with the contract award details. Handles 404 specially (not found, not an error) and other errors normally.
    async ({ contract_id }) => {
      const res = await apiGet<{ dataset: string; data: Record<string, unknown> }>(
        `/api/v1/contracts/${encodeURIComponent(contract_id)}`,
      );
    
      if (!res.ok) {
        const msg =
          res.status === 404
            ? `Contract ${contract_id} not found.`
            : `API error (${res.status}): ${JSON.stringify(res.data)}`;
        return {
          content: [{ type: "text" as const, text: msg }],
          isError: res.status !== 404,
        };
      }
    
      const warn = stalenessWarning(res);
      return {
        content: [
          { type: "text" as const, text: `${warn}${JSON.stringify(res.data.data, null, 2)}` },
        ],
      };
    },
  • Input schema for lookup_contract: a single required string parameter 'contract_id' validated with Zod.
    inputSchema: {
      contract_id: z
        .string()
        .describe("Contract award ID"),
    },
  • Registration of the lookup_contract tool via server.registerTool() with title, description, inputSchema, and the handler callback.
    server.registerTool(
      "lookup_contract",
      {
        title: "Lookup Contract Award",
        description:
          "Look up a single federal contract award by its ID. Returns full award details " +
          "including modifications, sub-awards, and performance history. " +
          "Cost: $0.018 per query. Source: USAspending.gov.",
        inputSchema: {
          contract_id: z
            .string()
            .describe("Contract award ID"),
        },
      },
      async ({ contract_id }) => {
        const res = await apiGet<{ dataset: string; data: Record<string, unknown> }>(
          `/api/v1/contracts/${encodeURIComponent(contract_id)}`,
        );
    
        if (!res.ok) {
          const msg =
            res.status === 404
              ? `Contract ${contract_id} not found.`
              : `API error (${res.status}): ${JSON.stringify(res.data)}`;
          return {
            content: [{ type: "text" as const, text: msg }],
            isError: res.status !== 404,
          };
        }
    
        const warn = stalenessWarning(res);
        return {
          content: [
            { type: "text" as const, text: `${warn}${JSON.stringify(res.data.data, null, 2)}` },
          ],
        };
      },
    );
  • src/index.ts:53-53 (registration)
    The function call registerContractTools(server) which registers all contract tools including lookup_contract.
    registerContractTools(server);
  • The apiGet helper function used by the handler to make HTTP GET requests to the Verilex API. Also stalenessWarning (lines 35-41) for adding stale data warnings to output.
    export async function apiGet<T = unknown>(
      path: string,
      params?: Record<string, string | number | undefined>,
    ): Promise<ApiResponse<T>> {
      const url = buildUrl(path, params);
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "verilex-mcp-server/0.1.0",
      };
    
      // Forward x402 payment token if present in env (for paid endpoints)
      const paymentToken = process.env.VERILEX_PAYMENT_TOKEN;
      if (paymentToken) {
        headers["X-Payment-Token"] = paymentToken;
      }
    
      const res = await fetch(url, { headers });
      const data = (await res.json()) as T;
    
      const stale = res.headers.get("X-Data-Stale");
      const lastUpdated = res.headers.get("X-Data-Last-Updated");
      const ageSeconds = res.headers.get("X-Data-Age-Seconds");
    
      return {
        ok: res.ok,
        status: res.status,
        data,
        stale: stale === "true",
        lastUpdated: lastUpdated ?? undefined,
        ageSeconds: ageSeconds ? Number(ageSeconds) : undefined,
      };
    }
Behavior3/5

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

With no annotations, the description adds behavioral context: cost, data source, and what details are returned. However, it does not mention side effects, permissions, or error handling, leaving some behavioral aspects unclear.

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?

Three sentences, front-loaded with the primary action, and every sentence adds value (purpose, return details, cost, source). No wasted words.

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?

Given no output schema, the description adequately explains return content (modifications, sub-awards, performance history) and provides cost and source. It is missing information on error scenarios (e.g., invalid ID), but overall is sufficiently complete for a single-parameter lookup.

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 coverage is 100% for the single parameter. The description adds slight context by specifying 'federal contract award ID', but does not significantly enhance understanding beyond the schema's description.

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 it looks up a single federal contract award by ID, and differentiates from sibling tools like search_contracts which would search multiple records. It specifies the resource and action unambiguously.

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 use for a known ID but does not explicitly state when to use this tool vs alternatives like search_contracts. It mentions cost per query, which indirectly guides usage, but lacks explicit when-not or alternative comparisons.

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