Class: GrowwMcp::Tools::GetQuote

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

Class Method Summary collapse

Class Method Details

.call(server_context:, trading_symbol:, exchange: "NSE", segment: "CASH") ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/groww_mcp/tools/market_tools.rb', line 33

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