Skip to main content
Glama
jjmerri

E*TRADE MCP Server

by jjmerri

etrade_get_option_chains

Retrieve option chains for stocks to analyze available strikes and expiration dates for calls and puts using E*TRADE market data.

Instructions

Get option chains for a symbol.

Args: symbol: Underlying stock symbol (e.g., "AAPL") expiry_year: Expiration year (4-digit, e.g., 2024) expiry_month: Expiration month (1-12) expiry_day: Expiration day (1-31) strike_price_near: Strike price near this value no_of_strikes: Number of strikes to return include_weekly: Include weekly options skip_adjusted: Skip adjusted options option_category: STANDARD, ALL, or MINI chain_type: CALL, PUT, or CALLPUT price_type: ATNM (at the money) or ALL

Returns: Option chain data with available strikes and expiration dates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
expiry_yearNo
expiry_monthNo
expiry_dayNo
strike_price_nearNo
no_of_strikesNo
include_weeklyNo
skip_adjustedNo
option_categoryNo
chain_typeNo
price_typeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary MCP tool handler for 'etrade_get_option_chains', registered via @mcp.tool() decorator. Handles input parameters and delegates to MarketClient.get_option_chains.
    @mcp.tool()
    def etrade_get_option_chains(symbol: str, expiry_year: Optional[int] = None,
                                expiry_month: Optional[int] = None, expiry_day: Optional[int] = None,
                                strike_price_near: Optional[float] = None, no_of_strikes: Optional[int] = None,
                                include_weekly: bool = False, skip_adjusted: bool = False,
                                option_category: Optional[str] = None, chain_type: Optional[str] = None,
                                price_type: Optional[str] = None) -> dict:
        """
        Get option chains for a symbol.
        
        Args:
            symbol: Underlying stock symbol (e.g., "AAPL")
            expiry_year: Expiration year (4-digit, e.g., 2024)
            expiry_month: Expiration month (1-12)
            expiry_day: Expiration day (1-31)
            strike_price_near: Strike price near this value
            no_of_strikes: Number of strikes to return
            include_weekly: Include weekly options
            skip_adjusted: Skip adjusted options
            option_category: STANDARD, ALL, or MINI
            chain_type: CALL, PUT, or CALLPUT
            price_type: ATNM (at the money) or ALL
            
        Returns:
            Option chain data with available strikes and expiration dates
        """
        client = get_market_client()
        return client.get_option_chains(
            symbol, expiry_year, expiry_month, expiry_day,
            strike_price_near, no_of_strikes, include_weekly, skip_adjusted,
            option_category, chain_type, price_type
        )
  • Core helper method in MarketClient that constructs the API request to E*TRADE's optionchains endpoint and returns the JSON response.
    def get_option_chains(self, symbol: str, expiry_year: Optional[int] = None,
                         expiry_month: Optional[int] = None, expiry_day: Optional[int] = None,
                         strike_price_near: Optional[float] = None, no_of_strikes: Optional[int] = None,
                         include_weekly: bool = False, skip_adjusted: bool = False,
                         option_category: Optional[str] = None, chain_type: Optional[str] = None,
                         price_type: Optional[str] = None) -> Dict[str, Any]:
        """
        Get option chains for a symbol
        
        Args:
            symbol: Underlying symbol
            expiry_year: Expiration year (4-digit)
            expiry_month: Expiration month (1-12)
            expiry_day: Expiration day (1-31)
            strike_price_near: Strike price near value
            no_of_strikes: Number of strikes
            include_weekly: Include weekly options
            skip_adjusted: Skip adjusted options
            option_category: Option category (STANDARD, ALL, MINI)
            chain_type: Chain type (CALL, PUT, CALLPUT)
            price_type: Price type (ATNM, ALL)
            
        Returns:
            Option chains response data
        """
        url = f"{self.base_url}/v1/market/optionchains.json"
        
        params = {"symbol": symbol}
        
        if expiry_year:
            params["expiryYear"] = expiry_year
        if expiry_month:
            params["expiryMonth"] = expiry_month
        if expiry_day:
            params["expiryDay"] = expiry_day
        if strike_price_near:
            params["strikePriceNear"] = strike_price_near
        if no_of_strikes:
            params["noOfStrikes"] = no_of_strikes
        if include_weekly:
            params["includeWeekly"] = "true"
        if skip_adjusted:
            params["skipAdjusted"] = "true"
        if option_category:
            params["optionCategory"] = option_category
        if chain_type:
            params["chainType"] = chain_type
        if price_type:
            params["priceType"] = price_type
        
        response = self.session.get(url, params=params)
        response.raise_for_status()
        
        return response.json()
    
    def get_option_expire_dates(self, symbol: str, expiry_type: Optional[str] = None) -> Dict[str, Any]:
        """
        Get option expiration dates for a symbol
        
        Args:
            symbol: Underlying symbol
            expiry_type: Expiry type (WEEKLY, MONTHLY, QUARTERLY, ALL)
            
        Returns:
            Expiration dates response data
        """
        url = f"{self.base_url}/v1/market/optionexpiredate.json"
        
        params = {"symbol": symbol}
        if expiry_type:
            params["expiryType"] = expiry_type
        
        response = self.session.get(url, params=params)
        response.raise_for_status()
        
        return response.json()
  • Helper function that provides the singleton authenticated MarketClient instance used by the tool handler.
    def get_market_client() -> MarketClient:
        """Get market client (requires authentication)"""
        global _market_client
        if _market_client is None:
            # Try to load access token from environment
            access_token = os.getenv("ETRADE_ACCESS_TOKEN")
            access_token_secret = os.getenv("ETRADE_ACCESS_TOKEN_SECRET")
            
            if access_token and access_token_secret:
                # Create session from stored tokens
                auth = get_auth()
                from rauth import OAuth1Session
                session = OAuth1Session(
                    auth.consumer_key,
                    auth.consumer_secret,
                    access_token=access_token,
                    access_token_secret=access_token_secret
                )
                _market_client = MarketClient(session, auth.base_url)
            else:
                raise ValueError(
                    "Not authenticated. Please run authenticate.py to get access tokens, "
                    "or use etrade_get_auth_url and etrade_authenticate tools."
                )
        return _market_client
  • Initialization of the FastMCP server instance where all @mcp.tool() decorators register their tools.
    mcp = FastMCP("E*TRADE Market API")
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but lacks critical details: it doesn't mention authentication requirements (though sibling tools suggest it's needed), rate limits, error handling, or whether this is a read-only operation. The 'Returns' section hints at output but doesn't fully describe behavior.

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 with a clear purpose statement followed by organized parameter and return sections. It's appropriately sized for an 11-parameter tool, though the 'Returns' section could be more detailed given the complexity. Every sentence earns its place, but minor verbosity in listing all parameters slightly reduces efficiency.

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?

For a complex tool with 11 parameters, no annotations, and an output schema, the description is moderately complete. It covers parameter semantics well but lacks behavioral context (e.g., authentication, errors) and doesn't leverage the output schema to explain return values in detail. It's adequate but has clear gaps given the tool's complexity.

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

Parameters5/5

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

Given 0% schema description coverage, the description compensates excellently by providing clear semantics for all 11 parameters. Each parameter is explained with examples (e.g., 'AAPL' for symbol) and valid ranges/enums (e.g., 'STANDARD, ALL, or MINI' for option_category), adding significant value beyond the bare schema.

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 verb 'Get' and the resource 'option chains for a symbol', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'etrade_get_option_expire_dates' or 'etrade_get_quote', which prevents a perfect score.

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. There's no mention of sibling tools like 'etrade_get_option_expire_dates' for expiration dates or 'etrade_get_quote' for stock quotes, nor any context about prerequisites such as authentication.

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/jjmerri/etrade-mcp'

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