Query Economic Indicators
query_indicatorsRetrieve current values for economic indicators such as CPI, GDP, and unemployment rates. Filter by series ID, category, or frequency to access data from FRED, BLS, and BEA.
Instructions
Get current values for economic indicators like CPI, GDP, unemployment, interest rates, and more. Filter by series ID, category, or frequency. Cost: $0.01 per query. Source: FRED, BLS, BEA.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| series | No | FRED series ID (e.g. CPIAUCSL, GDP, UNRATE) | |
| category | No | Category filter (e.g. inflation, employment, gdp) | |
| frequency | No | Data frequency filter | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/econ.ts:62-91 (handler)The handler function for query_indicators. It calls the Verilex API at /api/v1/econ/indicators with query params (series, category, frequency, limit), handles errors, and returns indicator data as text content.
async ({ series, category, frequency, limit }) => { const res = await apiGet<EconQueryResponse>("/api/v1/econ/indicators", { series, category, frequency, 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} indicator(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/tools/econ.ts:40-60 (schema)Input schema for query_indicators using Zod. Defines optional parameters: series (string), category (string), frequency (enum: daily/weekly/monthly/quarterly/annual), limit (number 1-100, default 25).
inputSchema: { series: z .string() .optional() .describe("FRED series ID (e.g. CPIAUCSL, GDP, UNRATE)"), category: z .string() .optional() .describe("Category filter (e.g. inflation, employment, gdp)"), frequency: z .enum(["daily", "weekly", "monthly", "quarterly", "annual"]) .optional() .describe("Data frequency filter"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, - src/tools/econ.ts:32-91 (registration)Registration of query_indicators tool via server.registerTool() with the name 'query_indicators', along with its title, description, input schema, and handler.
server.registerTool( "query_indicators", { title: "Query Economic Indicators", description: "Get current values for economic indicators like CPI, GDP, unemployment, " + "interest rates, and more. Filter by series ID, category, or frequency. " + "Cost: $0.01 per query. Source: FRED, BLS, BEA.", inputSchema: { series: z .string() .optional() .describe("FRED series ID (e.g. CPIAUCSL, GDP, UNRATE)"), category: z .string() .optional() .describe("Category filter (e.g. inflation, employment, gdp)"), frequency: z .enum(["daily", "weekly", "monthly", "quarterly", "annual"]) .optional() .describe("Data frequency filter"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ series, category, frequency, limit }) => { const res = await apiGet<EconQueryResponse>("/api/v1/econ/indicators", { series, category, frequency, 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} indicator(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/index.ts:57-57 (registration)The call to registerEconTools(server) which registers query_indicators (among other econ tools) on the MCP server.
registerEconTools(server); - src/client.ts:35-41 (helper)The stalenessWarning helper used in the query_indicators handler to check for stale data headers from the API 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"; }