robinhood_get_options_positions
Retrieve all current options positions from your Robinhood account, including chain symbol, option type, strike price, expiration date, and quantity for portfolio analysis.
Instructions
Get all current options positions (read-only).
Returns list of options positions with chain symbol, type, strike price, expiration, and quantity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/robinhood_mcp/tools.py:361-368 (handler)The actual handler function `get_options_positions()` that calls the robin_stocks library's `rh.options.get_open_option_positions` via `_safe_call` and returns the list of options positions.
def get_options_positions() -> list[dict[str, Any]]: """Get all current options positions. Returns: List of options positions with chain_symbol, type, quantity, etc. """ result = _safe_call(rh.options.get_open_option_positions) return result if isinstance(result, list) else [] - src/robinhood_mcp/server.py:248-256 (registration)The MCP tool registration where `robinhood_get_options_positions` is decorated with `@mcp.tool()` and calls the handler after ensuring login.
@mcp.tool() def robinhood_get_options_positions() -> list: """Get all current options positions (read-only). Returns list of options positions with chain symbol, type, strike price, expiration, and quantity. """ _ensure_logged_in() return get_options_positions() - src/robinhood_mcp/server.py:248-256 (schema)The tool function signature defines no required arguments and returns a list, documented to return options positions with chain symbol, type, strike price, expiration, and quantity.
@mcp.tool() def robinhood_get_options_positions() -> list: """Get all current options positions (read-only). Returns list of options positions with chain symbol, type, strike price, expiration, and quantity. """ _ensure_logged_in() return get_options_positions() - src/robinhood_mcp/tools.py:24-46 (helper)The `_safe_call` helper that wraps API calls with error handling, used by `get_options_positions()`.
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/tools.py:1-10 (handler)Imports: the handler imports `robin_stocks.robinhood as rh` and uses `rh.options.get_open_option_positions`.
"""Read-only Robinhood tools wrapping robin_stocks library.""" import threading import time from collections.abc import Callable from copy import deepcopy from typing import Any, Literal import robin_stocks.robinhood as rh