Skip to main content
Glama
drasticstatic

robinhood-mcp

robinhood_get_historicals

Retrieve historical price data for a stock by specifying symbol, interval, and span. Supports intervals from 5 minutes to weekly and spans up to 5 years.

Instructions

Get historical price data for a stock.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol
intervalNoTime interval (5minute, 10minute, hour, day, week)day
spanNoTime span (day, week, month, 3month, year, 5year)month

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Actual implementation of get_historicals – Normalizes the symbol, validates interval/span, and calls robin_stocks' get_stock_historicals via _safe_call.
    def get_historicals(
        symbol: str,
        interval: Literal["5minute", "10minute", "hour", "day", "week"] = "day",
        span: Literal["day", "week", "month", "3month", "year", "5year"] = "month",
    ) -> list[dict[str, Any]]:
        """Get historical price data for a stock.
    
        Args:
            symbol: Stock ticker symbol.
            interval: Time interval (5minute, 10minute, hour, day, week).
            span: Time span (day, week, month, 3month, year, 5year).
    
        Returns:
            List of historical data points with open, close, high, low, volume.
        """
        symbol = _normalize_symbol(symbol)
    
        valid_intervals = {"5minute", "10minute", "hour", "day", "week"}
        valid_spans = {"day", "week", "month", "3month", "year", "5year"}
    
        if interval not in valid_intervals:
            raise RobinhoodError(f"Invalid interval. Must be one of: {valid_intervals}")
        if span not in valid_spans:
            raise RobinhoodError(f"Invalid span. Must be one of: {valid_spans}")
    
        result = _safe_call(rh.stocks.get_stock_historicals, symbol, interval=interval, span=span)
        return result if isinstance(result, list) else []
  • MCP tool registration of robinhood_get_historicals using the @mcp.tool() decorator, which delegates to get_historicals in tools.py.
    @mcp.tool()
    def robinhood_get_historicals(
        symbol: str,
        interval: Literal["5minute", "10minute", "hour", "day", "week"] = "day",
        span: Literal["day", "week", "month", "3month", "year", "5year"] = "month",
    ) -> list:
        """Get historical price data for a stock.
    
        Args:
            symbol: Stock ticker symbol
            interval: Time interval (5minute, 10minute, hour, day, week)
            span: Time span (day, week, month, 3month, year, 5year)
    
        Returns list of OHLCV data points (open, high, low, close, volume).
        """
        _ensure_logged_in()
        return get_historicals(symbol, interval, span)
  • Input parameter schema for the tool – accepts symbol: str, interval (Literal), span (Literal) with defaults.
    def robinhood_get_historicals(
        symbol: str,
        interval: Literal["5minute", "10minute", "hour", "day", "week"] = "day",
        span: Literal["day", "week", "month", "3month", "year", "5year"] = "month",
    ) -> list:
  • Helper _normalize_symbol used by get_historicals to uppercase and strip the ticker symbol.
    def _normalize_symbol(symbol: str) -> str:
        """Normalize and validate ticker symbols."""
        if not symbol or not isinstance(symbol, str):
            raise RobinhoodError("Symbol must be a non-empty string")
        symbol = symbol.upper().strip()
        if not symbol:
            raise RobinhoodError("Symbol must be a non-empty string")
        return symbol
  • Helper _safe_call used by get_historicals to wrap the robin_stocks API call with error handling.
    def _safe_call(func: Callable[..., Any], *args, **kwargs) -> Any:
        """Safely call a robin_stocks function with error handling.
    
        Args:
            func: The robin_stocks function to call.
            *args: Positional arguments.
            **kwargs: Keyword arguments.
    
        Returns:
            The function result.
    
        Raises:
            RobinhoodError: If the call fails.
        """
        try:
            result = func(*args, **kwargs)
            if result is None:
                raise RobinhoodError("API returned None - you may need to login first")
            return result
        except RobinhoodError:
            raise
        except Exception as e:
            raise RobinhoodError(f"API call failed: {e}") from e
Behavior2/5

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

With no annotations, the description carries full burden but only states 'get historical price data', implying a read operation. It does not disclose any behavioral traits such as authentication requirements, data adjustments, or limitations like rate limits or data range. The minimal description leaves significant gaps.

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 a single, concise sentence with no unnecessary words. It is appropriately front-loaded and efficient for a simple tool.

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?

The tool has an output schema, so return values are covered. However, the description omits mention of default parameter values (interval='day', span='month') and any usage constraints. While functional, it is minimally complete and could provide more context without being verbose.

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

Parameters3/5

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

The input schema has 100% description coverage, so the schema already documents all parameters. The description adds no additional meaning beyond what the schema provides, earning the baseline score of 3.

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 gets historical price data for a stock, which is a specific verb+resource. However, it does not differentiate from sibling tools like 'get_quote' (current price) or 'get_fundamentals' (financial data), missing an opportunity to clarify its unique purpose.

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. There is no mention of when not to use it, required context, or alternative tools like 'get_quote' for current data or 'search_symbols' for lookup.

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/drasticstatic/robinhood-mcp'

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