Skip to main content
Glama
Yahoo Finance MCP Server

Yahoo Finance MCP Server

yfinance_get_options_chain

Read-only

Retrieve stock options chain data, including calls, puts, strikes, expirations, volume, open interest, and implied volatility. Filter by days to expiration or target date and summarize activity.

Instructions

Get options chain data for a stock. Returns call options near current price for the nearest expiration by default.

Args: ticker: Stock ticker symbol (e.g., 'AAPL', 'MSFT', 'GOOGL') expiration_date: Optional expiration date in 'YYYY-MM-DD' format (default: nearest) dte: Optional days to expiration - USE THIS for time-based queries: - 7 for "weekly options" - 30 for "monthly options" - 90 for "quarterly options" - 365 for "LEAPS" or "long-term options" MUTUALLY EXCLUSIVE with target_date - cannot use both (default: None, uses nearest expiration) target_date: Optional target date in 'YYYY-MM-DD' format to find closest expiration(s). USE THIS when query mentions a specific date like "around Dec 15" or "near January" MUTUALLY EXCLUSIVE with dte - cannot use both (default: None) limit: Number of closest expirations to return (works with dte or target_date). - 1 = single closest expiration (default) - 2 = two closest (one before, one after if possible) - 3+ = N closest expirations around the target EFFICIENCY: Always use limit parameter to get multiple expirations in ONE call, rather than making multiple separate calls with different dte values. (default: 1) option_type: 'calls', 'puts', or 'both' - Use 'both' when query mentions "what's available" or exploratory requests - Default: 'calls' strikes_near_price: Number of strikes above/below current price, or None for all (default: 10) in_the_money: True for ITM, False for OTM, None for both (default: None) min_volume: Minimum volume filter - ONLY use if query mentions "liquid" or "active" (default: None) min_open_interest: Minimum open interest filter - ONLY use if query mentions "liquid" or "active" (default: None) strike_min: Minimum strike price (default: None) strike_max: Maximum strike price (default: None) fields: Which fields/data to return. Special values: - ["expiration_dates"] or ["expirations"] = return only dates without contract data - None (default) = return full contract data Use for queries like "what expiration dates does [ticker] have?" summary: If True, return aggregate statistics instead of individual contracts. Returns: total volume, open interest, strike ranges, avg IV, most active strikes, put/call ratios. Use this for queries asking for "summary", "activity", "overview", or "sentiment" - NOT for queries asking for specific contracts/strikes. Works seamlessly with limit parameter to analyze multiple expirations. (default: False) response_format: 'json' or 'markdown' (default: 'markdown')

Query interpretation: - "weekly options" → dte=7 - "monthly options" → dte=30 - "around Dec 15" or "near December 20" → target_date="2024-12-15", target_date="2024-12-20" - "3 expirations around..." → limit=3 with dte or target_date - For multiple time periods (weekly, monthly, quarterly): Use dte with limit, NOT separate calls Example: "compare weekly, monthly, quarterly" → dte=30, limit=3 (gets ~weekly, ~monthly, ~next monthly in ONE call) - "what options are available" → option_type="both" - "what expiration dates" or "what dates are available" → fields=["expiration_dates"] - "activity summary", "options activity", "market sentiment", or any query with "summary" → summary=True - "liquid/active options" (without "summary") → add min_volume and min_open_interest (NOT summary=True) - Don't add filters unless specifically requested

Returns: Options chain data with contract details, prices, volume, open interest, and implied volatility. If fields=["expiration_dates"], returns only the list of expiration dates. If summary=True, returns aggregate statistics for market analysis. If limit > 1, returns data for multiple expirations.

Examples: yfinance_get_options_chain("SPY", fields=["expiration_dates"]) # Just get available expiration dates yfinance_get_options_chain("SPY", dte=7) # Weekly options (closest to 7 days) yfinance_get_options_chain("SPY", dte=7, summary=True) # Weekly options activity summary yfinance_get_options_chain("SPY", dte=30, limit=3) # Get 3 expirations around 30 days (detailed contracts) yfinance_get_options_chain("TSLA", dte=30, limit=3, summary=True, option_type="both") # Compare activity across 3 expirations yfinance_get_options_chain("AAPL", dte=30, limit=3, fields=["expiration_dates"]) # Get 3 expiration dates around 30 days yfinance_get_options_chain("AAPL", target_date="2024-12-15", limit=2) # 2 closest expirations to Dec 15 (detailed) yfinance_get_options_chain("TSLA", dte=7, min_volume=1000) # Liquid weekly options

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "ticker": "<ticker>"
    },
    "name": "yfinance_get_options_chain"
  }
}

Input Schema

NameRequiredDescriptionDefault
dteNo
limitNo
fieldsNo
tickerYes
summaryNo
min_volumeNo
strike_maxNo
strike_minNo
option_typeNocalls
target_dateNo
in_the_moneyNo
expiration_dateNo
response_formatNomarkdown
min_open_interestNo
strikes_near_priceNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only give readOnlyHint and openWorldHint, but the description adds the important behavioral constraints itself: dte and target_date are MUTUALLY EXCLUSIVE, limit controls how many expirations come back in one call, min_volume/min_open_interest are conditional filters, and there are cheap modes (dates-only via fields, aggregate via summary) that change what the response will look like. This is real operational context an agent could not derive from the annotations alone.

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?

Well front-loaded (purpose → args → query interpretation → returns → examples), but there is redundancy: the efficiency guidance about using limit instead of multiple calls appears twice, and the "multiple time periods" advice is restated in the Query interpretation section. Three sections (Args, Query interpretation, Examples) cover overlapping ground, adding length and some cognitive load.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 15-parameter, high-complexity tool with mutually exclusive options and mode-switching output, the description covers defaults, constraints, mode selection, and output shape well. Since an output schema exists and response_format enum is documented, its brief Returns section is sufficient rather than redundant.

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?

Schema description coverage is 0%, so the description carries the full burden and does: every parameter is given meaning, defaults, allowed values, and behavioral effect, including special string sentinels for fields and the calls/puts/both enum semantics. Examples at the bottom show concrete argument combinations, turning an undocumented 15-parameter schema into something an agent can invoke correctly on the first try.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ("Get options chain data for a stock") and immediately states the default scope ("call options near current price for the nearest expiration"), so an agent knows both what it retrieves and what it retrieves by default. The default behavior is unusually well signaled, which matters given 15 parameters with non-obvious defaults.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit routing rules far beyond the norm: dte for time-based queries with concrete mappings (7/30/90/365 = weekly/monthly/quarterly/LEAPS), target_date for specific dates, fields=["expiration_dates"] for date-only queries, and summary=True for activity/sentiment questions. It also states an exclusion ("Don't add filters unless specifically requested") and warns against pathological use (limit instead of repeated calls), so the agent rarely needs to infer hospital.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.