Class: GrowwMcp::Tools::GetGreeks

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/groww_mcp/tools/option_chain_tools.rb

Class Method Summary collapse

Class Method Details

.call(server_context:, trading_symbol:, underlying:, expiry:, exchange: "NSE") ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/groww_mcp/tools/option_chain_tools.rb', line 78

def call(server_context:, trading_symbol:, underlying:, expiry:, exchange: "NSE")
  client = server_context[:client]
  result = client.greeks(trading_symbol: trading_symbol, underlying: underlying,
                         expiry: expiry, exchange: exchange)
  format_response(result)
rescue GrowwMcp::ForbiddenError
  MCP::Tool::Response.new([{
    type: "text",
    text: "❌ Greeks access denied. Requires Groww Live Data subscription (₹499 + GST/month). " \
          "Subscribe at: Groww App → Settings → Trading APIs.",
  }])
rescue GrowwMcp::ApiError => e
  error_response(e)
end