Skip to main content
Glama
nicoloceneda

Fred St Louis MCP

by nicoloceneda

geofred_request

Access GeoFRED API endpoints to retrieve geographic economic data from FRED for research and analysis.

Instructions

Call any GeoFRED API endpoint path directly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYes
params_jsonNo{}

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for the geofred_request MCP tool. Decorated with @mcp.tool() to register it as an MCP tool. Accepts an endpoint path and JSON params string, parses the JSON, and delegates to _geofred_get helper to make the actual API call.
    @mcp.tool()
    @_tool_error_boundary
    async def geofred_request(endpoint: str, params_json: str = "{}") -> dict[str, Any]:
        """Call any GeoFRED API endpoint path directly."""
        params = _parse_json_object(params_json)
        return await _geofred_get(endpoint, params)
  • Helper function that makes HTTP GET requests to the GeoFRED API. Uses the GEOFRED_API_BASE URL (https://api.stlouisfed.org/geofred) and delegates to the generic _http_get_json function with retry logic and error handling.
    async def _geofred_get(endpoint: str, params: dict[str, Any]) -> dict[str, Any]:
        return await _http_get_json(GEOFRED_API_BASE, endpoint, params)
  • Helper function that validates and parses the params_json input string. Ensures the input is valid JSON and that the parsed value is a dictionary object. Raises ValueError if validation fails.
    def _parse_json_object(raw: str) -> dict[str, Any]:
        try:
            parsed = json.loads(raw)
        except json.JSONDecodeError as exc:
            raise ValueError(f"Invalid JSON: {exc}") from exc
        if not isinstance(parsed, dict):
            raise ValueError("JSON value must be an object")
        return parsed
  • fred_mcp/app.py:1-8 (registration)
    Creates and configures the FastMCP server instance that provides the @mcp.tool() decorator used to register geofred_request as an MCP tool. The server is named 'fred-mcp' and includes instructions for querying FRED APIs.
    from mcp.server.fastmcp import FastMCP
    
    mcp = FastMCP(
        "fred-mcp",
        instructions=(
            "Query FRED API v1, GeoFRED maps API, and FRED API v2 release observations."
        ),
    )
  • Error boundary decorator applied to geofred_request via @_tool_error_boundary. Wraps the handler to catch and convert exceptions (FredServerError, ValueError, etc.) into structured error payloads for consistent error handling.
    def _tool_error_boundary(
        func: Callable[..., Awaitable[dict[str, Any]]],
    ) -> Callable[..., Awaitable[dict[str, Any]]]:
        @wraps(func)
        async def wrapper(*args: Any, **kwargs: Any) -> dict[str, Any]:
            try:
                return await func(*args, **kwargs)
            except asyncio.CancelledError:
                raise
            except FredServerError as exc:
                return exc.payload
            except ValueError as exc:
                return _error_payload(
                    str(exc),
                    code="validation_error",
                    error_type="validation_error",
                )
            except Exception as exc:
                logger.exception("Unhandled tool error in '%s'", func.__name__)
                return _error_payload(
                    "Internal server error",
                    code="internal_error",
                    error_type="internal_error",
                    details={"exception_type": type(exc).__name__},
                )
    
        return wrapper
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'Call any GeoFRED API endpoint,' implying a read operation, but does not disclose behavioral traits such as authentication needs, rate limits, error handling, or response formats. This is inadequate for a tool that interacts with an external API.

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 a single, efficient sentence with no wasted words. It is front-loaded and appropriately sized for its purpose, earning full marks for conciseness.

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

Completeness2/5

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

Given the tool's complexity (direct API calls with 2 parameters), lack of annotations, and 0% schema coverage, the description is incomplete. While an output schema exists, the description does not address key aspects like authentication, error cases, or how to interpret endpoints, leaving significant gaps for the agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It does not explain the 'endpoint' parameter (e.g., what endpoint paths are available) or 'params_json' (e.g., expected JSON structure for parameters). Without this, the agent cannot infer parameter meanings beyond their names.

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

Purpose3/5

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

The description states the tool 'Call[s] any GeoFRED API endpoint path directly,' which provides a clear verb ('Call') and resource ('GeoFRED API endpoint path'). However, it lacks specificity about what GeoFRED is (e.g., a geographic economic data service) and does not differentiate from siblings like 'fred_request' or 'get_map_regional_data,' making it vague in context.

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?

The description offers no guidance on when to use this tool versus alternatives. With many sibling tools for specific FRED/GeoFRED operations (e.g., 'get_observations,' 'get_map_regional_data'), it fails to indicate scenarios where direct endpoint calls are preferred over specialized tools, leaving the agent without usage context.

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

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