robinhood_get_quote
Get real-time stock quotes for any ticker symbol. Input a symbol like AAPL to retrieve current price and market data.
Instructions
Get real-time quote for a stock symbol.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock ticker symbol (e.g., "AAPL", "TSLA") |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/robinhood_mcp/server.py:148-159 (registration)Registration of the 'robinhood_get_quote' tool as an MCP tool via @mcp.tool() decorator. It calls get_quote() from the tools module.
@mcp.tool() def robinhood_get_quote(symbol: str) -> dict: """Get real-time quote for a stock symbol. Args: symbol: Stock ticker symbol (e.g., "AAPL", "TSLA") Returns quote data including last trade price, bid, ask, previous close, and trading status. """ _ensure_logged_in() return get_quote(symbol) - src/robinhood_mcp/tools.py:243-257 (handler)The actual handler/implementation: get_quote() normalizes the symbol, calls rh.stocks.get_quotes via the safe wrapper, and returns the first result.
def get_quote(symbol: str) -> dict[str, Any]: """Get real-time quote for a stock symbol. Args: symbol: Stock ticker symbol (e.g., "AAPL"). Returns: Quote data including last_trade_price, bid, ask, etc. """ symbol = _normalize_symbol(symbol) result = _safe_call(rh.stocks.get_quotes, symbol) if isinstance(result, list) and len(result) > 0: return result[0] raise RobinhoodError(f"No quote found for symbol: {symbol}") - src/robinhood_mcp/tools.py:49-56 (helper)Helper function _normalize_symbol() that validates and uppercases ticker symbols, used by get_quote().
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 - src/robinhood_mcp/tools.py:24-46 (helper)Helper function _safe_call() that wraps robin_stocks API calls with error handling, used by get_quote().
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 - src/robinhood_mcp/server.py:148-156 (schema)Input schema for robinhood_get_quote derived from function signature: takes a 'symbol: str' parameter and returns a dict.
@mcp.tool() def robinhood_get_quote(symbol: str) -> dict: """Get real-time quote for a stock symbol. Args: symbol: Stock ticker symbol (e.g., "AAPL", "TSLA") Returns quote data including last trade price, bid, ask, previous close, and trading status.