Skip to main content
Glama
henrysouchien

edgar-mcp

get_filings

Fetch SEC filing metadata for companies to access 10-Q, 10-K, and 8-K reports with URLs, dates, and fiscal period information.

Instructions

Fetch SEC filing metadata for a company. Returns list of 10-Q, 10-K, and 8-K (earnings release) filings with URLs, dates, and fiscal period assignments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
yearYes
quarterYes

Implementation Reference

  • Main async handler function decorated with @mcp.tool() that accepts ticker, year, and quarter parameters. It delegates to _run_tool_guarded with the tool name and arguments.
    @mcp.tool()
    async def get_filings(
        ticker: str,
        year: int,
        quarter: int,
    ) -> dict:
        """
        Fetch SEC filing metadata for a company. Returns list of 10-Q, 10-K, and 8-K
        (earnings release) filings with URLs, dates, and fiscal period assignments.
        """
        return await _run_tool_guarded(
            "get_filings",
            {"ticker": ticker, "year": year, "quarter": quarter},
        )
  • Proxy function that makes the actual API call to the remote EDGAR API. Calls /api/filings endpoint with ticker, year, and quarter parameters.
    def _proxy_get_filings(args: dict) -> dict:
        return _call_api("/api/filings", {
            "ticker": args["ticker"],
            "year": args["year"],
            "quarter": args["quarter"],
        })
  • Tool dispatch dictionary that registers 'get_filings' to its proxy function _proxy_get_filings. Used by _run_tool_guarded to route tool calls.
    _TOOL_DISPATCH = {
        "get_filings": _proxy_get_filings,
        "get_financials": _proxy_get_financials,
        "get_metric": _proxy_get_metric,
        "list_metrics": _proxy_list_metrics,
        "search_metrics": _proxy_search_metrics,
        "get_filing_sections": _proxy_get_filing_sections,
    }
  • Tool timeout configuration that sets a 30-second timeout for get_filings tool execution.
    _TOOL_TIMEOUT = {
        "get_filings": 30,
        "get_financials": 60,
        "get_metric": 30,
        "list_metrics": 45,
        "search_metrics": 45,
        "get_filing_sections": 60,
    }
  • HTTP helper function that makes GET requests to the remote EDGAR API with authentication and error handling.
    def _call_api(path: str, params: dict, timeout: int = 60) -> dict:
        """HTTP GET to the remote EDGAR API. Returns parsed JSON or error dict."""
        base_url, api_key = _get_api_config()
        if not api_key:
            return {"status": "error", "message": "EDGAR_API_KEY is not configured"}
    
        url = f"{base_url}{path}"
        payload = dict(params)
        payload["key"] = api_key
    
        t0 = time.time()
        try:
            resp = requests.get(url, params=payload, timeout=timeout)
        except requests.RequestException as exc:
            return {"status": "error", "message": f"EDGAR API request failed after {time.time()-t0:.1f}s: {exc}"}
    
        try:
            data = resp.json()
        except ValueError:
            return {"status": "error", "message": f"Invalid JSON from EDGAR API (HTTP {resp.status_code})"}
    
        if resp.status_code != 200:
            if isinstance(data, dict) and data:
                return data
            return {"status": "error", "message": f"EDGAR API error (HTTP {resp.status_code})"}
    
        return data

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/henrysouchien/edgar-mcp'

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