Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_balance_sheets

Retrieve company balance sheets by entering a ticker symbol, specifying period (annual/quarterly), and setting result limits for financial analysis.

Instructions

Get balance sheets for a company.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
periodNoannual
limitNo

Implementation Reference

  • The handler function for the 'get_balance_sheets' tool. It is decorated with @mcp.tool(), which also serves as registration. Fetches balance sheets data from the Financial Datasets API based on ticker, period, and limit, then returns JSON-formatted data.
    @mcp.tool()
    async def get_balance_sheets(
        ticker: str,
        period: str = "annual",
        limit: int = 4,
    ) -> str:
        """Get balance sheets for a company.
    
        Args:
            ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
            period: Period of the balance sheet (e.g. annual, quarterly, ttm)
            limit: Number of balance sheets to return (default: 4)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/financials/balance-sheets/?ticker={ticker}&period={period}&limit={limit}"
        data = await make_request(url)
    
        # Check if data is found
        if not data:
            return "Unable to fetch balance sheets or no balance sheets found."
    
        # Extract the balance sheets
        balance_sheets = data.get("balance_sheets", [])
    
        # Check if balance sheets are found
        if not balance_sheets:
            return "Unable to fetch balance sheets or no balance sheets found."
    
        # Stringify the balance sheets
        return json.dumps(balance_sheets, indent=2)
  • Helper function used by get_balance_sheets 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 it 'gets' data, implying a read-only operation, but doesn't clarify permissions, rate limits, data freshness, or what happens with invalid inputs. The description adds minimal behavioral context beyond the basic action.

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 well-structured and concise. It starts with a clear purpose statement, then lists parameters with brief explanations and examples. Every sentence adds value, with no redundant or vague language. It's appropriately sized for a tool with three parameters.

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 adequate but has gaps. It covers parameters well but lacks behavioral details like error handling or output format. Without annotations or output schema, more context on what the tool returns would improve completeness for a data-fetching tool.

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 significant value beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: ticker as the company symbol with examples, period as the timeframe with examples, and limit as the number to return with a default. This compensates well for the schema's lack of descriptions, though it doesn't detail format constraints like period enum values.

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 balance sheets for a company.' It specifies the verb ('Get') and resource ('balance sheets'), and distinguishes it from siblings like get_income_statements or get_cash_flow_statements by focusing on balance sheets specifically. However, it doesn't explicitly differentiate from all siblings beyond the resource type.

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 when to prefer balance sheets over income statements or cash flow statements, nor does it reference sibling tools. Usage is implied by the resource 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