Class: GrowwMcp::Tools::CalculateMargin

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

Class Method Summary collapse

Class Method Details

.call(server_context:, segment:, orders:) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/groww_mcp/tools/portfolio_tools.rb', line 99

def call(server_context:, segment:, orders:)
  client = server_context[:client]
  result = client.calculate_margin(orders, segment: segment)
  format_response(result)
rescue GrowwMcp::ApiError => e
  error_response(e)
end