Economic Dataset Statistics
econ_statsRetrieve statistics on economic indicators dataset including total series, categories, date range, and data source information. Free endpoint.
Instructions
Get statistics about the economic indicators dataset: total series, categories covered, date range, and data source information. Free endpoint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/econ.ts:268-298 (registration)The 'econ_stats' tool is registered via server.registerTool() with the name 'econ_stats', title 'Economic Dataset Statistics', and an empty input schema (no parameters required).
server.registerTool( "econ_stats", { title: "Economic Dataset Statistics", description: "Get statistics about the economic indicators dataset: total series, " + "categories covered, date range, and data source information. Free endpoint.", inputSchema: {}, }, async () => { const res = await apiGet<EconStatsResponse>("/api/v1/econ/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/econ.ts:277-297 (handler)The handler function for the econ_stats tool. It makes a GET request to '/api/v1/econ/stats' via apiGet<EconStatsResponse>, and returns the JSON result. On error, it returns an isError response.
async () => { const res = await apiGet<EconStatsResponse>("/api/v1/econ/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/econ.ts:22-27 (schema)The EconStatsResponse interface defines the shape of the API response: dataset, source, update_frequency, and stats (a generic Record).
interface EconStatsResponse { dataset: string; source: string; update_frequency: string; stats: Record<string, unknown>; } - src/client.ts:44-76 (helper)The apiGet helper function used by the handler to make the HTTP GET request to the Verilex API server.
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, }; }