query_surprises
Compare actual economic data to consensus forecasts to identify surprises, analyze historical patterns, and assess market impact using recent releases from FRED, BLS, and BEA sources.
Instructions
Get actual vs consensus comparison for recent economic releases. Shows beat/miss magnitude, historical surprise patterns, and market impact. Cost: $0.02 per query. Source: FRED, BLS, BEA.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| series | No | FRED series ID to filter by | |
| days | No | Lookback period in days (default 30) | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/econ.ts:185-213 (handler)The handler function for 'query_surprises' which fetches data from '/api/v1/econ/surprise'.
async ({ series, days, limit }) => { const res = await apiGet<EconQueryResponse>("/api/v1/econ/surprise", { series, days: days ?? 30, 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} economic surprise(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/tools/econ.ts:158-184 (schema)The input schema and tool definition for 'query_surprises'.
{ title: "Query Economic Surprises", description: "Get actual vs consensus comparison for recent economic releases. Shows beat/miss " + "magnitude, historical surprise patterns, and market impact. " + "Cost: $0.02 per query. Source: FRED, BLS, BEA.", inputSchema: { series: z .string() .optional() .describe("FRED series ID to filter by"), days: z .number() .int() .min(1) .max(365) .optional() .describe("Lookback period in days (default 30)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, - src/tools/econ.ts:156-157 (registration)The registration call for the 'query_surprises' tool within the MCP server.
server.registerTool( "query_surprises",