Contracts Dataset Statistics
contract_statsRetrieve key statistics from the government contracts dataset, including total awards, agencies covered, date range, and data source information.
Instructions
Get statistics about the government contracts dataset: total awards, agencies covered, date range, and data source information. Free endpoint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/contracts.ts:212-233 (handler)The async handler function for the contract_stats tool. Calls GET /api/v1/contracts/stats and returns JSON with dataset stats.
async () => { const res = await apiGet<ContractStatsResponse>("/api/v1/contracts/stats"); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); - src/tools/contracts.ts:21-26 (schema)The ContractStatsResponse interface defining the shape of the API response (dataset, source, update_frequency, stats).
interface ContractStatsResponse { dataset: string; source: string; update_frequency: string; stats: Record<string, unknown>; } - src/tools/contracts.ts:203-210 (registration)Registration of the 'contract_stats' tool on the MCP server with its title, description, empty inputSchema, and handler.
server.registerTool( "contract_stats", { title: "Contracts Dataset Statistics", description: "Get statistics about the government contracts dataset: total awards, " + "agencies covered, date range, and data source information. Free endpoint.", inputSchema: {}, - src/index.ts:53-53 (registration)The entry point registration calling registerContractTools(server) which registers contract_stats among other contract tools.
registerContractTools(server); - src/client.ts:44-76 (helper)The apiGet helper function used by contract_stats handler to make the GET request to /api/v1/contracts/stats.
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, }; }