From 3f916b135c50e60834a5f7c7ffb787660f4def92 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Tue, 14 Oct 2025 11:18:43 -0500 Subject: [PATCH] Add options chain snapshot tool Adds list_snapshot_options_chain tool to retrieve full options chain data for an underlying ticker. Sets default limit to 250 (the maximum) to minimize API calls and improve performance. Includes greeks, implied volatility, and market data for all option contracts. Signed-off-by: Major Hayden --- src/mcp_polygon/server.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mcp_polygon/server.py b/src/mcp_polygon/server.py index 8e7e83d..4ab840f 100644 --- a/src/mcp_polygon/server.py +++ b/src/mcp_polygon/server.py @@ -462,6 +462,34 @@ async def get_snapshot_option( return {"error": str(e)} +@poly_mcp.tool(annotations=ToolAnnotations(readOnlyHint=True)) +async def list_snapshot_options_chain( + underlying_asset: str, + params: Optional[Dict[str, Any]] = None, +) -> Dict[str, Any]: + """ + Get snapshots of all option contracts for an underlying ticker. + Returns the full options chain with detailed contract data including greeks, implied volatility, and market data. + """ + try: + # Set default limit to 250 to avoid multiple API calls + if params is None: + params = {} + if "limit" not in params: + params["limit"] = 250 + + results = polygon_client.list_snapshot_options_chain( + underlying_asset=underlying_asset, + params=params, + raw=True, + ) + + data_str = results.data.decode("utf-8") + return json.loads(data_str) + except Exception as e: + return {"error": str(e)} + + @poly_mcp.tool(annotations=ToolAnnotations(readOnlyHint=True)) async def get_snapshot_crypto_book( ticker: str,