Skip to main content
Glama
stefanoamorelli

Federal Reserve Economic Data (FRED) MCP Server

fred_search

Search FRED economic data by keywords, tags, or filters to find matching series with IDs, titles, and metadata.

Instructions

Search for FRED economic data series by keywords, tags, or filters. Returns matching series with their IDs, titles, and metadata. Use this to find specific series when you know what you're looking for.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_textNoText to search for in series titles and descriptions
search_typeNoType of search to perform
tag_namesNoComma-separated list of tag names to filter by
exclude_tag_namesNoComma-separated list of tag names to exclude
limitNoMaximum number of results to return
offsetNoNumber of results to skip for pagination
order_byNoField to order results by
sort_orderNoSort order for results
filter_variableNoVariable to filter by
filter_valueNoValue to filter the variable by

Implementation Reference

  • The main handler function `searchSeries` that executes the FRED search logic. Calls the FRED API 'series/search' endpoint, maps options to query parameters, formats results, and returns MCP content.
    export async function searchSeries(options: FREDSearchOptions = {}) {
      try {
        const queryParams: Record<string, string | number> = {};
        
        // Add search parameters
        if (options.search_text) queryParams.search_text = options.search_text;
        if (options.search_type) queryParams.search_type = options.search_type;
        if (options.tag_names) queryParams.tag_names = options.tag_names;
        if (options.exclude_tag_names) queryParams.exclude_tag_names = options.exclude_tag_names;
        if (options.limit !== undefined) queryParams.limit = options.limit;
        if (options.offset !== undefined) queryParams.offset = options.offset;
        if (options.order_by) queryParams.order_by = options.order_by;
        if (options.sort_order) queryParams.sort_order = options.sort_order;
        if (options.filter_variable) queryParams.filter_variable = options.filter_variable;
        if (options.filter_value) queryParams.filter_value = options.filter_value;
        
        const response = await makeRequest<SearchResponse>(
          "series/search",
          queryParams
        );
        
        // Format the response for better readability
        const formattedResults = {
          total_results: response.count,
          showing: `${response.offset + 1}-${Math.min(response.offset + response.limit, response.count)}`,
          results: response.seriess.map(series => ({
            id: series.id,
            title: series.title,
            units: series.units,
            frequency: series.frequency,
            seasonal_adjustment: series.seasonal_adjustment,
            observation_range: `${series.observation_start} to ${series.observation_end}`,
            last_updated: series.last_updated,
            popularity: series.popularity,
            notes: series.notes?.substring(0, 200) + (series.notes && series.notes.length > 200 ? "..." : "")
          }))
        };
        
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify(formattedResults, null, 2)
          }]
        };
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to search FRED series: ${error.message}`);
        }
        throw error;
      }
    }
  • Interface `FREDSearchOptions` defining input parameters for the search (search_text, search_type, tags, limit, offset, order_by, sort_order, filters).
    export interface FREDSearchOptions {
      search_text?: string;
      search_type?: "full_text" | "series_id";
      tag_names?: string;
      exclude_tag_names?: string;
      limit?: number;
      offset?: number;
      order_by?: "search_rank" | "series_id" | "title" | "units" | "frequency" | "seasonal_adjustment" | "realtime_start" | "realtime_end" | "last_updated" | "observation_start" | "observation_end" | "popularity";
      sort_order?: "asc" | "desc";
      filter_variable?: "frequency" | "units" | "seasonal_adjustment";
      filter_value?: string;
    }
  • Zod schema `SearchResponseSchema` for validating the FRED API search response structure, including realtime info, count, offset, limit, and array of series results.
    const SearchResponseSchema = z.object({
      realtime_start: z.string(),
      realtime_end: z.string(),
      order_by: z.string(),
      sort_order: z.string(),
      count: z.number(),
      offset: z.number(),
      limit: z.number(),
      seriess: z.array(SearchSeriesSchema),
    });
  • Zod schema `SearchSeriesSchema` for validating individual search result series fields (id, title, frequency, units, popularity, etc.).
    const SearchSeriesSchema = z.object({
      id: z.string(),
      realtime_start: z.string(),
      realtime_end: z.string(),
      title: z.string(),
      observation_start: z.string(),
      observation_end: z.string(),
      frequency: z.string(),
      frequency_short: z.string(),
      units: z.string(),
      units_short: z.string(),
      seasonal_adjustment: z.string(),
      seasonal_adjustment_short: z.string(),
      last_updated: z.string(),
      popularity: z.number(),
      notes: z.string().optional(),
    });
  • Registration of 'fred_search' tool with the MCP server via `server.tool()`, including the description and the handler that calls `searchSeries`.
    // Register search tool
    server.tool(
      "fred_search",
      "Search for FRED economic data series by keywords, tags, or filters. Returns matching series with their IDs, titles, and metadata. Use this to find specific series when you know what you're looking for.",
      SEARCH_SCHEMA,
      async (input) => {
        console.error(`fred_search called with params: ${JSON.stringify(input)}`);
        const result = await searchSeries(input as FREDSearchOptions);
        console.error("fred_search complete");
        return result;
      }
    );
Behavior3/5

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

No annotations are provided, so the description carries full burden. It describes the output (series IDs, titles, metadata) but does not disclose if the operation is read-only, requires authentication, or has rate limits. The lack of contradictions keeps it at a minimum.

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?

The description is two sentences, efficiently covering purpose and usage context. It is front-loaded with key information and contains no unnecessary words.

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?

With 10 parameters and no output schema, the description lacks details on pagination, ordering, filtering logic, or exact metadata returned. The schema covers parameters individually, but overall context is only adequate.

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?

Schema coverage is 100%, so each parameter has a description in the schema. The tool description adds no new meaning beyond the schema, only vaguely mentioning 'keywords, tags, or filters.' Baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the tool searches for FRED data series by keywords, tags, or filters and returns matching series with IDs, titles, and metadata. It implies distinguishing from siblings (browsing or getting specific series) but does not explicitly differentiate.

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

Usage Guidelines3/5

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

The description says 'Use this to find specific series when you know what you're looking for,' giving a usage context. However, it does not mention when not to use it (e.g., for browsing categories or retrieving full series) or suggest alternatives.

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/stefanoamorelli/fred-mcp-server'

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