getOptionExpirations
Retrieve available expiration dates for options contracts on a specific underlying symbol to support trading decisions and strategy planning.
Instructions
Get available expiration dates for options on an underlying symbol
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": {
"underlying": "<underlying>"
},
"name": "getOptionExpirations"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| underlying | Yes | Underlying symbol (e.g., AAPL, SPY) |
Implementation Reference
- src/index.ts:92-94 (schema)Input schema defining the 'underlying' parameter for the getOptionExpirations tool.
const optionExpirationsSchema = { underlying: z.string().describe('Underlying symbol (e.g., AAPL, SPY)') }; - src/index.ts:367-398 (handler)The complete tool handler registration and implementation for 'getOptionExpirations'. It extracts the 'underlying' symbol from arguments, makes an authenticated API request to the TradeStation endpoint `/marketdata/options/expirations/{underlying}`, and returns the JSON response or error.
server.tool( "getOptionExpirations", "Get available expiration dates for options on an underlying symbol", optionExpirationsSchema, async (args) => { try { const { underlying } = args; const expirations = await makeAuthenticatedRequest( `/marketdata/options/expirations/${encodeURIComponent(underlying)}` ); return { content: [ { type: "text", text: JSON.stringify(expirations, null, 2) } ] }; } catch (error: unknown) { return { content: [ { type: "text", text: `Failed to fetch option expirations: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }