Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_income_statements

Retrieve income statements for companies by ticker symbol to analyze financial performance over specified periods like annual or quarterly.

Instructions

Get income statements for a company.

Args:
    ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
    period: Period of the income statement (e.g. annual, quarterly, ttm)
    limit: Number of income statements to return (default: 4)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
periodNoannual
limitNo

Implementation Reference

  • server.py:43-72 (handler)
    The main handler function for the 'get_income_statements' tool, decorated with @mcp.tool() for automatic registration and schema inference from the function signature and docstring. It fetches income statements data from the Financial Datasets API via a helper function.
    @mcp.tool()
    async def get_income_statements(
        ticker: str,
        period: str = "annual",
        limit: int = 4,
    ) -> str:
        """Get income statements for a company.
    
        Args:
            ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
            period: Period of the income statement (e.g. annual, quarterly, ttm)
            limit: Number of income statements to return (default: 4)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/financials/income-statements/?ticker={ticker}&period={period}&limit={limit}"
        data = await make_request(url)
    
        # Check if data is found
        if not data:
            return "Unable to fetch income statements or no income statements found."
    
        # Extract the income statements
        income_statements = data.get("income_statements", [])
    
        # Check if income statements are found
        if not income_statements:
            return "Unable to fetch income statements or no income statements found."
    
        # Stringify the income statements
        return json.dumps(income_statements, indent=2)
  • Shared helper function used by get_income_statements (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)}
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 of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't cover important aspects like authentication needs, rate limits, error handling, or data freshness. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose followed by parameter details in a clear 'Args:' section. Each sentence adds value without redundancy. However, the structure could be slightly improved by integrating parameter explanations more seamlessly, rather than a separate list, but it remains efficient and easy to scan.

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?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and parameters well, but lacks details on behavioral aspects (e.g., data source, limitations) and output format. Without annotations or an output schema, users are left guessing about the return structure and operational constraints, making it adequate but with clear gaps.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'ticker' as the company symbol with examples (AAPL, GOOGL), 'period' as the statement period with examples (annual, quarterly, ttm), and 'limit' as the number to return with a default. This compensates well for the schema's lack of descriptions, though it could provide more detail on format constraints (e.g., ttm meaning).

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's purpose: 'Get income statements for a company.' It specifies the verb ('Get') and resource ('income statements for a company'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_balance_sheets' or 'get_cash_flow_statements' beyond the resource name, which prevents a perfect score.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_balance_sheets' or 'get_cash_flow_statements' for financial data, or explain scenarios where income statements are preferred over other financial statements. Usage is implied by the tool name alone, with no explicit context or exclusions provided.

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

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