Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_current_stock_price

Retrieve current stock prices for companies using ticker symbols like AAPL or GOOGL to monitor market values.

Instructions

Get the current / latest price of a company.

Args:
    ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the logic to fetch and return the current stock price snapshot as JSON for the given ticker using the Financial Datasets API.
    @mcp.tool()
    async def get_current_stock_price(ticker: str) -> str:
        """Get the current / latest price of a company.
    
        Args:
            ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/prices/snapshot/?ticker={ticker}"
        data = await make_request(url)
    
        # Check if data is found
        if not data:
            return "Unable to fetch current price or no current price found."
    
        # Extract the current price
        snapshot = data.get("snapshot", {})
    
        # Check if current price is found
        if not snapshot:
            return "Unable to fetch current price or no current price found."
    
        # Stringify the current price
        return json.dumps(snapshot, indent=2)
  • Helper function used by the get_current_stock_price tool (and others) 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:139-139 (registration)
    The @mcp.tool() decorator registers the get_current_stock_price function as an MCP tool with the name matching the function name.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits such as data freshness, rate limits, error handling, or authentication needs. For a tool that fetches real-time data, this lack of context is a significant gap.

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 with the core purpose, followed by parameter details. Both sentences earn their place by adding value, though the structure could be slightly improved by integrating the parameter explanation more seamlessly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of fetching real-time financial data, no annotations, and no output schema, the description is incomplete. It lacks details on return values, data sources, potential limitations, or error cases, making it inadequate for informed tool selection.

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% coverage. It explains that 'ticker' is the 'Ticker symbol of the company' and provides examples (e.g., AAPL, GOOGL), clarifying the parameter's purpose and format effectively.

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 verb 'Get' and resource 'current/latest price of a company', making the purpose specific and understandable. It distinguishes from siblings like get_historical_stock_prices by specifying 'current/latest', though it doesn't explicitly contrast with get_crypto_prices or other financial data tools.

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?

No guidance is provided on when to use this tool versus alternatives like get_historical_stock_prices or get_crypto_prices. The description implies usage for stock prices but doesn't specify exclusions or prerequisites, leaving the agent to infer context from sibling tool names alone.

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