Skip to main content
Glama

Query Economic Surprises

query_surprises

Compare actual economic releases to consensus forecasts. Analyze beat/miss magnitude, historical surprise patterns, and market impact.

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
NameRequiredDescriptionDefault
seriesNoFRED series ID to filter by
daysNoLookback period in days (default 30)
limitNoMaximum results (default 25)

Implementation Reference

  • The registration of the 'query_surprises' tool via server.registerTool, including inputSchema definition and the async handler function.
    server.registerTool(
      "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)"),
        },
      },
      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}` }],
        };
      },
    );
  • The async handler function for 'query_surprises'. Delegates to the API at /api/v1/econ/surprise with optional series, days (default 30), and limit (default 25) parameters. Formats response with count and JSON data.
    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}` }],
      };
    },
  • Input schema for 'query_surprises' defining optional parameters: series (FRED series ID), days (1-365 lookback, default 30), and limit (1-100, default 25).
    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/index.ts:57-57 (registration)
    Registration call: registerEconTools(server) which adds 'query_surprises' (among other econ tools) to the MCP server.
    registerEconTools(server);
  • The apiGet helper used by the handler to make HTTP GET requests to the Verilex API, including staleness tracking.
    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,
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description only discloses cost and sources. It does not address behavioral traits like idempotency, data freshness, or any side effects, leaving the agent without crucial operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences convey purpose, key features, cost, and sources. No wasted words, and critical information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While purpose and cost are clear, the description omits output format, error conditions, and behavioral constraints. Given three optional parameters and no output schema or annotations, more completeness is needed for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All three parameters have descriptions in the input schema (100% coverage). The description adds no additional parameter-specific meaning beyond what the schema already provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool returns actual vs consensus comparison for economic releases, including beat/miss magnitude, patterns, and market impact. It distinguishes from siblings like query_releases by specifying the focus on surprises.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as query_releases, econ_stats, or econ_changes. The description mentions cost and sources but lacks explicit context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/carrierone/verilexdata-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server