Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_cash_flow_statements

Retrieve cash flow statements for companies to analyze financial health by providing ticker symbols, period options, and statement limits.

Instructions

Get cash flow statements for a company.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
periodNoannual
limitNo

Implementation Reference

  • This is the handler function for the 'get_cash_flow_statements' tool. It is registered via the @mcp.tool() decorator. The function fetches cash flow statements from the Financial Datasets API for a given ticker, period, and limit, handles errors, and returns the data as a JSON string.
    @mcp.tool()
    async def get_cash_flow_statements(
        ticker: str,
        period: str = "annual",
        limit: int = 4,
    ) -> str:
        """Get cash flow statements for a company.
    
        Args:
            ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
            period: Period of the cash flow statement (e.g. annual, quarterly, ttm)
            limit: Number of cash flow statements to return (default: 4)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/financials/cash-flow-statements/?ticker={ticker}&period={period}&limit={limit}"
        data = await make_request(url)
    
        # Check if data is found
        if not data:
            return "Unable to fetch cash flow statements or no cash flow statements found."
    
        # Extract the cash flow statements
        cash_flow_statements = data.get("cash_flow_statements", [])
    
        # Check if cash flow statements are found
        if not cash_flow_statements:
            return "Unable to fetch cash flow statements or no cash flow statements found."
    
        # Stringify the cash flow statements
        return json.dumps(cash_flow_statements, indent=2)
  • Helper function used by get_cash_flow_statements (and other tools) to make authenticated API 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:107-107 (registration)
    The @mcp.tool() decorator registers the get_cash_flow_statements function as an MCP tool.
    @mcp.tool()
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 mention any behavioral traits such as rate limits, authentication needs, error handling, or what the return format looks like. For a data retrieval tool with zero annotation coverage, this is a significant gap in transparency.

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 appropriately sized and front-loaded: it starts with a clear purpose statement, followed by a structured list of parameters with explanations and examples. Every sentence earns its place, with no wasted words or redundancy, making it easy to scan and understand quickly.

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 complexity (a data retrieval tool with 3 parameters) and the lack of annotations and output schema, the description is partially complete. It covers the purpose and parameters well, but misses behavioral context (e.g., return format, error cases) and usage guidelines. For a tool with no structured support, it should do more to compensate, but it's adequate as a minimum viable description.

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 substantial meaning beyond the input schema, which has 0% description coverage. It explains each parameter's purpose (e.g., 'ticker symbol of the company', 'period of the cash flow statement', 'number of cash flow statements to return') and provides examples (e.g., 'AAPL, GOOGL', 'annual, quarterly, ttm', 'default: 4'). This compensates well for the schema's lack of descriptions, though it doesn't cover all possible nuances like format constraints for 'period'.

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 cash flow statements for a company.' It specifies the verb ('Get') and resource ('cash flow statements'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_balance_sheets' or 'get_income_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. There are no mentions of when-not scenarios, prerequisites, or comparisons to sibling tools like 'get_balance_sheets' or 'get_income_statements'. The only usage context is implied by the parameters, but no explicit guidelines are given.

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