Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_historical_crypto_prices

Retrieve historical cryptocurrency price data by specifying ticker, date range, and interval for analysis and tracking.

Instructions

Gets historical prices for a crypto currency.

Args:
    ticker: Ticker symbol of the crypto currency (e.g. BTC-USD). The list of available crypto tickers can be retrieved via the get_available_crypto_tickers tool.
    start_date: Start date of the price data (e.g. 2020-01-01)
    end_date: End date of the price data (e.g. 2020-12-31)
    interval: Interval of the price data (e.g. minute, hour, day, week, month)
    interval_multiplier: Multiplier of the interval (e.g. 1, 2, 3)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes
start_dateYes
end_dateYes
intervalNoday
interval_multiplierNo

Implementation Reference

  • The main handler function for the 'get_historical_crypto_prices' tool. It is decorated with @mcp.tool() which handles both registration and schema inference from the signature and docstring. The function constructs an API URL, calls the make_request helper to fetch data from Financial Datasets API, extracts the prices, and returns them as JSON string.
    @mcp.tool()
    async def get_historical_crypto_prices(
        ticker: str,
        start_date: str,
        end_date: str,
        interval: str = "day",
        interval_multiplier: int = 1,
    ) -> str:
        """Gets historical prices for a crypto currency.
    
        Args:
            ticker: Ticker symbol of the crypto currency (e.g. BTC-USD). The list of available crypto tickers can be retrieved via the get_available_crypto_tickers tool.
            start_date: Start date of the price data (e.g. 2020-01-01)
            end_date: End date of the price data (e.g. 2020-12-31)
            interval: Interval of the price data (e.g. minute, hour, day, week, month)
            interval_multiplier: Multiplier of the interval (e.g. 1, 2, 3)
        """
        # Fetch data from the API
        url = f"{FINANCIAL_DATASETS_API_BASE}/crypto/prices/?ticker={ticker}&interval={interval}&interval_multiplier={interval_multiplier}&start_date={start_date}&end_date={end_date}"
        data = await make_request(url)
    
        # Check if data is found
        if not data:
            return "Unable to fetch prices or no prices found."
    
        # Extract the prices
        prices = data.get("prices", [])
    
        # Check if prices are found
        if not prices:
            return "Unable to fetch prices or no prices found."
    
        # Stringify the prices
        return json.dumps(prices, indent=2)
  • Helper function used by the tool (and others) to make authenticated HTTP requests to the Financial Datasets API, handling API key from env and errors.
    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:275-275 (registration)
    The @mcp.tool() decorator registers the function as an MCP tool, inferring schema from args and docstring.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool does but lacks critical behavioral information such as rate limits, authentication requirements, data format of returned prices, error handling, or whether this is a read-only operation. The description is functional but incomplete for safe and effective use.

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 well-structured and appropriately sized, with a clear purpose statement followed by a bulleted parameter explanation. Every sentence adds value, though it could be slightly more concise by integrating the parameter explanations more seamlessly rather than using a separate 'Args' section.

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 (5 parameters, no annotations, no output schema), the description is partially complete. It excels at explaining parameters but lacks behavioral context and output details. Without an output schema, the description should ideally mention what the return data looks like (e.g., price objects with timestamps and values), which is a notable gap.

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 provides excellent parameter semantics through the 'Args' section, explaining each parameter's purpose with examples (e.g., 'BTC-USD', '2020-01-01', 'minute, hour, day, week, month', '1, 2, 3'). This significantly compensates for the 0% schema description coverage, making all parameters clearly understandable despite the schema lacking descriptions.

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 with a specific verb ('Gets') and resource ('historical prices for a crypto currency'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_crypto_prices' or 'get_current_crypto_price', which could cause confusion about when to use each.

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. While it mentions that available tickers can be retrieved via 'get_available_crypto_tickers', it doesn't explain when to choose this tool over 'get_crypto_prices', 'get_current_crypto_price', or 'get_historical_stock_prices', leaving the agent without clear usage context.

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