Query Economic Releases
query_releasesRetrieve upcoming economic data releases with release dates, expected impact, prior values, and consensus forecasts from FRED, BLS, and BEA.
Instructions
Get upcoming economic data releases. Shows release dates, expected impact, prior values, and consensus forecasts. Cost: $0.01 per query. Source: FRED, BLS, BEA.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days to look ahead (default 14) | |
| category | No | Category filter (e.g. inflation, employment) | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/econ.ts:124-151 (handler)The handler function for the 'query_releases' tool. It calls apiGet('/api/v1/econ/releases') with days, category, and limit parameters, processes the response, and returns formated text content with a summary and JSON data.
async ({ days, category, limit }) => { const res = await apiGet<EconQueryResponse>("/api/v1/econ/releases", { days: days ?? 14, category, 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} upcoming release(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, - src/tools/econ.ts:103-122 (schema)The input schema for 'query_releases' tool, defining optional parameters: days (int 1-90), category (string), and limit (int 1-100).
inputSchema: { days: z .number() .int() .min(1) .max(90) .optional() .describe("Number of days to look ahead (default 14)"), category: z .string() .optional() .describe("Category filter (e.g. inflation, employment)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, - src/tools/econ.ts:95-152 (registration)The registration call for the 'query_releases' tool via server.registerTool(), with its title, description, input schema, and handler.
server.registerTool( "query_releases", { title: "Query Economic Releases", description: "Get upcoming economic data releases. Shows release dates, expected impact, " + "prior values, and consensus forecasts. " + "Cost: $0.01 per query. Source: FRED, BLS, BEA.", inputSchema: { days: z .number() .int() .min(1) .max(90) .optional() .describe("Number of days to look ahead (default 14)"), category: z .string() .optional() .describe("Category filter (e.g. inflation, employment)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ days, category, limit }) => { const res = await apiGet<EconQueryResponse>("/api/v1/econ/releases", { days: days ?? 14, category, 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} upcoming release(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/client.ts:44-76 (helper)The apiGet helper function used by the handler to make HTTP GET requests to the Verilex API.
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, }; } - src/client.ts:35-41 (helper)The stalenessWarning helper function used to generate stale data warnings in the response.
export function stalenessWarning(res: ApiResponse): string { if (!res.stale) return ""; const parts = ["[STALE DATA]"]; if (res.lastUpdated) parts.push(`Last updated: ${res.lastUpdated}`); if (res.ageSeconds != null) parts.push(`Age: ${res.ageSeconds}s`); return parts.join(" ") + "\n\n"; }