Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_sec_filings

Retrieve SEC filings for companies by ticker symbol, with options to filter by filing type and limit results for financial analysis.

Instructions

Get all SEC filings for a company.

Args:
    ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
    limit: Number of SEC filings to return (default: 10)
    filing_type: Type of SEC filing (e.g. 10-K, 10-Q, 8-K)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
limitNo
filing_typeNo

Implementation Reference

  • The handler function for the 'get_sec_filings' tool, decorated with @mcp.tool() for automatic registration in FastMCP. It constructs an API URL using the provided ticker, optional limit, and filing_type, fetches data via the shared make_request helper, extracts filings, and returns JSON stringified data or an error message.
    @mcp.tool()
    async def get_sec_filings(
        ticker: str,
        limit: int = 10,
        filing_type: str | None = None,
    ) -> str:
        """Get all SEC filings for a company.
    
        Args:
            ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
            limit: Number of SEC filings to return (default: 10)
            filing_type: Type of SEC filing (e.g. 10-K, 10-Q, 8-K)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/filings/?ticker={ticker}&limit={limit}"
        if filing_type:
            url += f"&filing_type={filing_type}"
     
        # Call the API
        data = await make_request(url)
    
        # Extract the SEC filings
        filings = data.get("filings", [])
    
        # Check if SEC filings are found
        if not filings:
            return f"Unable to fetch SEC filings or no SEC filings found."
    
        # Stringify the SEC filings
        return json.dumps(filings, indent=2)
  • Shared helper function used by get_sec_filings (and other tools) to make authenticated HTTP requests to the Financial Datasets API.
    async def make_request(url: str) -> dict[str, any] | None:
        """Make a request to the Financial Datasets API with proper error handling."""
        # Load environment variables from .env file
        load_dotenv()
        
        headers = {}
        if api_key := os.environ.get("FINANCIAL_DATASETS_API_KEY"):
            headers["X-API-KEY"] = api_key
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception as e:
                return {"Error": str(e)}
  • server.py:337-337 (registration)
    The @mcp.tool() decorator registers the get_sec_filings function as an MCP tool with the FastMCP server instance.
    @mcp.tool()

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/financial-datasets/mcp-server'

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