lookup_contract
Retrieve detailed federal contract award information by ID, including modifications, sub-awards, and performance history from USAspending.gov data.
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
| Name | Required | Description | Default |
|---|---|---|---|
| contract_id | Yes | Contract award ID |
Implementation Reference
- src/tools/contracts.ts:118-141 (handler)The handler function for 'lookup_contract', which fetches contract details from the API based on the provided 'contract_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/tools/contracts.ts:112-116 (schema)Input schema for 'lookup_contract' tool using Zod for validation.
inputSchema: { contract_id: z .string() .describe("Contract award ID"), }, - src/tools/contracts.ts:104-105 (registration)Registration of 'lookup_contract' tool within the MCP server.
server.registerTool( "lookup_contract",