getOptionStrikes
Retrieve available strike prices for options contracts on a specific stock or ETF symbol. Filter results by expiration date to find suitable trading opportunities.
Instructions
Get available strike prices for options on an underlying symbol
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| underlying | Yes | Underlying symbol (e.g., AAPL, SPY) | |
| expiration | No | Expiration date filter in YYYY-MM-DD format (optional) |
Input Schema (JSON Schema)
{
"properties": {
"expiration": {
"description": "Expiration date filter in YYYY-MM-DD format (optional)",
"type": "string"
},
"underlying": {
"description": "Underlying symbol (e.g., AAPL, SPY)",
"type": "string"
}
},
"required": [
"underlying"
],
"type": "object"
}
Implementation Reference
- src/index.ts:405-436 (handler)Handler function that constructs the TradeStation API endpoint for option strikes based on underlying symbol and optional expiration date, fetches data using makeAuthenticatedRequest, and returns JSON-formatted response or error.async (args) => { try { const { underlying, expiration } = args; let endpoint = `/marketdata/options/strikes/${encodeURIComponent(underlying)}`; if (expiration) { endpoint += `?expiration=${encodeURIComponent(expiration)}`; } const strikes = await makeAuthenticatedRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify(strikes, null, 2) } ] }; } catch (error: unknown) { return { content: [ { type: "text", text: `Failed to fetch option strikes: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/index.ts:96-99 (schema)Zod input schema defining parameters for getOptionStrikes: required 'underlying' string and optional 'expiration' string.const optionStrikesSchema = { underlying: z.string().describe('Underlying symbol (e.g., AAPL, SPY)'), expiration: z.string().optional().describe('Expiration date filter in YYYY-MM-DD format (optional)') };
- src/index.ts:401-437 (registration)MCP server tool registration for 'getOptionStrikes' including name, description, schema reference, and inline handler function.server.tool( "getOptionStrikes", "Get available strike prices for options on an underlying symbol", optionStrikesSchema, async (args) => { try { const { underlying, expiration } = args; let endpoint = `/marketdata/options/strikes/${encodeURIComponent(underlying)}`; if (expiration) { endpoint += `?expiration=${encodeURIComponent(expiration)}`; } const strikes = await makeAuthenticatedRequest(endpoint); return { content: [ { type: "text", text: JSON.stringify(strikes, null, 2) } ] }; } catch (error: unknown) { return { content: [ { type: "text", text: `Failed to fetch option strikes: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );