RealizeAlpha integrates a highly secure, local Model Context Protocol (MCP) execution framework powered by package:mcp_dart. This integration enables conversational generative models (specifically Gemini 3.1 Flash-Lite) to interact natively with your active Robinhood trading accounts on-device without exposing private tokens, brokerage API credentials, or trading secrets to untrusted remote cloud environments.
The app establishes a local client-driven JSON-RPC channel with the secure sandbox server endpoints. Unlike typical SaaS tools that process client data remotely, this architecture keeps all token exchanges, request composition, and validation steps on-device.
sequenceDiagram
participant User as User
box On-Device Mobile Sandbox
participant App as Chat Screen (chat_widget)
participant Gen as Generative Service
end
box Secure Networks
participant API as Robinhood Brokerage API
participant AI as Remote Gemini LLM
end
User->>App: Submits chat prompt: "What are my current holdings?"
App->>Gen: Sends query to chat processing pipeline
Gen->>Gen: Initiates local MCP Client connection using logged-in token
Gen->>Gen: Queries list of dynamic tools from local transport
Gen->>AI: Sends system prompt of tools and user message
AI-->>Gen: Returns JSON function call request for `list_positions`
Gen-->>App: Dispatches visual indicator "Calling Tool list_positions..."
Gen->>Gen: Executes tool natively via `mcp_client.callTool('list_positions')`
Gen->>API: Sends authorized on-device fetch requests
API-->>Gen: Returns raw JSON array of positions and margins
Gen->>AI: Serializes raw results and appends to prompt conversation stream
AI-->>Gen: Responds with comprehensive text report about holdings
Gen->>App: Parses proposals, strips system tags, and renders report
App->>User: Displays text card with interactive trading recommendations
To authorized local trading capabilities, users can prompt an OAuth authentication screen from within their User Settings.
_generateCodeChallenge and _generateCodeVerifier).getMcpAccessToken).The Model Context Protocol server exposes high-fidelity tools dynamically mapped for LLM execution, providing perfect parity with top-tier quantitative and brokerage platforms.
get_accountsLists the user’s connected brokerage accounts detailing account numbers, profile type (e.g. margin, cash, options), and agentic suitability status.
get_portfolioRetrieves a detailed real-time market value breakdown by asset class, cash balance, margin requirements, custody hold boundaries, and buying power.
account_number (string, required): Valid account identifier.get_watchlistsLists the user’s custom and followed watchlists.
get_watchlist_itemsLists all tracked securities configured inside a designated user watchlist.
list_id (string, required): The unique watchlist identifier (UUID).create_watchlistCreates a brand new custom watchlist for the user.
display_name (string, required): The name of the new watchlist. Must be unique.display_description (string, optional): A short description of the watchlist.icon_emoji (string, optional): A single-character emoji to display with the watchlist.update_watchlistModifies the display details of a custom watchlist.
list_id (string, required): The UUID of the target watchlist.display_name (string, optional): New name for the watchlist.display_description (string, optional): New description.icon_emoji (string, optional): New single-character emoji.add_to_watchlistAppends assets directly into a target watchlist. Exactly one of symbols, currency_pair_ids, or index_ids is required.
list_id (string, required): Watchlist identifier (UUID).symbols (array of strings, optional): Stock/ETF tickers (e.g., ["AAPL", "NVDA"]).currency_pair_ids (array of strings, optional): Crypto pair UUIDs.index_ids (array of strings, optional): Market index UUIDs (e.g. SPX or NDX).remove_from_watchlistRemoves assets from a designated watchlist. Exactly one of symbols, currency_pair_ids, or index_ids is required.
list_id (string, required): Watchlist identifier (UUID).symbols (array of strings, optional): Stock/ETF tickers to remove.currency_pair_ids (array of strings, optional): Crypto pair UUIDs to remove.index_ids (array of strings, optional): Market index UUIDs to remove.follow_watchlistDisplays a curated pre-existing Robinhood list under the user’s watchlists.
list_id (string, required): Curiosity list identifier to subscribe to.unfollow_watchlistStops displaying a followed curated list under details lists.
list_id (string, required): Curved list identifier.get_popular_watchlistsDiscovers popular curated market sectors or collections to browse or follow.
get_option_watchlistQueries single-leg options contracts stored on the user’s options watchlist.
add_option_to_watchlistAdds single-leg options contracts to the options watchlist.
option_ids (array of strings, required): Contract UUIDs to append (sourced from option instruments).position_type (string, optional): Direction categorization (long or short).get_option_instrumentsRetrieves options contracts matching specific underlying tickers, expiration schedules, strikes, and call/put directions.
chain_symbol (string, optional): Underlying ticker (e.g., AAPL).chain_id (string, optional): Underlying chain UUID.expiration_dates (string, optional): Comma-separated YYYY-MM-DD expirations.strike_price (string, optional): Exact strike (e.g., 150.0000).type (string, optional): Contract type (call or put).state (string, optional): State (defaults to active).get_option_quotesFetch real-time option market quotes and prices for a set of options contract instrument UUIDs.
instrument_ids (array of strings, required): Option instrument UUIDs.get_option_positionsFetches a list of active options legs, multi-leg spreads, or single contracts.
account_number (string, required): Valid account identifier.nonzero (boolean, optional): Pass true to return currently-open positions only (defaults to false).get_option_ordersFetches a history list of options trades, filled positions, or cancelled order entries for a portfolio.
account_number (string, required): Valid account identifier.order_id (string, optional): Filter results to one single order UUID.state (string, optional): Filter by single state (e.g., queued, filled, cancelled, rejected).review_option_orderSimulates an options contract transaction to retrieve fees, collateral metrics, and pre-trade rules check.
account_number (string, required): Target portfolio account (must be agentic_allowed=true AND option_level_2 or option_level_3).legs (array of objects, required): Option contract leg specifying option_id, side, position_effect, and ratio_quantity.quantity (string, required): Contract volume count.price (string, optional): Net premium limit per contract.type (string, optional): limit, market, stop_limit, or stop_market.time_in_force (string, optional): gfd or gtc.market_hours (string, optional): regular_hours, regular_curb_hours, or regular_curb_overnight_hours (non-limit immediate forces regular_hours).chain_symbol (string, optional): Option underlying ticker.underlying_type (string, optional): Ticker type (equity or index).place_option_orderExecutes single-leg or complex multi-leg options strategies.
account_number (string, required): Target portfolio account.legs (array of objects, required): Array of option contract legs describing type (call/put), expiration, strike, action, and volume.quantity (string, required): Number of contracts.price (string, required): Net debit or credit limit price.cancel_option_orderSubmits a secure cancel request for an active, pending options transaction.
account_number (string, required): Brokerage account owning the order.order_id (string, required): Target order UUID to terminate.get_equity_positionsFetches a list of active equity, ETF, and mutual fund holdings.
account_number (string, required): Valid account identifier.get_equity_quotesFetch real-time quoted figures for underlying equity instruments.
symbols (array of strings, required): List of equity tickers (e.g. ["AAPL", "NVDA"]).get_equity_historicalsRetrieves historical price data candles for equities.
symbols (array of strings, required): Tickers to query.start_time (string, required): Start limit (RFC3339 UTC).end_time (string, optional): End time defaults to now.interval (string, optional): Candle bar size (e.g., minute, 5minute, 30minute, day, week).bounds (string, optional): Trading session bounds (e.g., regular, extended, 24_5).get_equity_ordersFetches historical stock orders, trades, and pending items.
account_number (string, required): Valid account identifier.symbol (string, optional): Filter stock orders to one single ticker symbol.state (string, optional): Order state filter (e.g., filled, cancelled, rejected).get_equity_fundamentalsRetrieves comprehensive daily fundamental metrics and ratios for one or more stock symbols.
symbols (array of strings, required): Target stock tickers (maximum 10).bounds (string, optional): Session bounds (e.g., regular, extended, trading, 24_5).get_equity_tradabilityChecks detailed eligibility and fractional trading status constraints for a set of stock symbols under a specified account.
account_number (string, required): Valid account identifier.symbols (array of strings, required): Stock tickers to check (maximum 10).review_equity_orderSimulates a stock, ETF, or trust order without executing it, returning pre-trade warnings, cash costs, and margin impact.
account_number (string, required): Target portfolio account (must be agentic_allowed=true).symbol (string, required): Stock ticker.side (string, required): Direction (buy or sell).type (string, required): market or limit or stop_market or stop_limit.quantity (string, optional): Shares count.dollar_amount (string, optional): USD notional limit (market orders only).limit_price (string, optional): Limit execution constraint.stop_price (string, optional): Stop trigger barrier.time_in_force (string, optional): gfd or gtc (defaults to gfd).market_hours (string, optional): Session boundaries (e.g., regular_hours, extended_hours, all_day_hours).place_equity_orderConstructs and logs trade transactions directly with the broker.
account_number (string, required): Target portfolio account.symbol (string, required): Trade instrument ticker.side (string, required): Direction (buy or sell).type (string, required): market, limit, stop_market, or stop_limit.quantity (string, optional): Shares count to purchase/sell.dollar_amount (string, optional): USD notional limit (market orders only).limit_price (string, optional): Limit price limit.ref_id (string, optional): Idempotency key (UUID) to secure communication across retries.get_index_quotesFetch real-time values, stamps, and state changes for major indices.
instrument_ids (array of strings, required): Major market index UUIDs (sourced from get_indexes).get_earnings_calendarDiscovers macro earnings schedules across the entire market over a given date range.
start_date (string, optional): Window anchor formatted as YYYY-MM-DD (defaults to today).days (number, optional): Date range size in days (max 31). Positive for forward-looking calendar, negative for historical look-back.filter (string, optional): Set to high_market_cap to limit results to high-liquidity large-caps.get_earnings_resultsRetrieves detailed corporate earnings history, EPS surprise statistics, and report timings for a single ticker.
symbol (string, required): Stock ticker.create_scanCreates a brand new saved scanner configuration on the user’s account, allowing custom dynamic filters to parse the market.
preset (string, optional): Starting preset template (e.g., INITIAL, DAILY_GAINERS, DAILY_LOSERS, HIGH_OPTIONS_VOLUME_IV, UPCOMING_EARNINGS).filters (array of objects, optional): Custom metric filters specifying filter types, mathematical predicates, intervals, track lengths, and lookups (e.g., RSI metrics, volume bounds).title (string, optional): Custom descriptive header name.get_scansLists all saved market scanners and screeners registered.
run_scanExecutes an existing pre-registered market screener evaluation against live realtime quote aggregates.
scan_id (string, required): Target scan registry UUID.As Gemini process requests, the conversational interface inside src/robinhood_options_mobile/lib/widgets/chat_widget.dart provides deep visual tracking:
ToolExecutionCard widgets revealing precisely what tools were called and what parameters were populated.Calling local tool list_accounts... to maintain user awareness of model actions in real-time.When Gemini detects a programmatic order request, it formats responses utilizing structured proposal blocks:
[TRADE_PROPOSAL: Action Stock Symbol Qty Quantity Type market/limit Price LimitPrice]Our chat widget automatically intercepts these proposal patterns before compiling message bubbles, transforming the raw text blocks into elegant Interactive Proposal Card overlays.