Class: GrowwMcp::Tools::ModifyOrder

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

Class Method Summary collapse

Class Method Details

.call(server_context:, order_id:, quantity:, order_type:, segment:, price: nil, trigger_price: nil) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/groww_mcp/tools/order_tools.rb', line 171

def call(server_context:, order_id:, quantity:, order_type:, segment:, price: nil, trigger_price: nil)
  client = server_context[:client]
  mods = {
    quantity: quantity,
    order_type: order_type,
    segment: segment,
  }
  mods[:price] = price if price
  mods[:trigger_price] = trigger_price if trigger_price

  result = client.modify_order(order_id, mods)
  format_response(result)
rescue GrowwMcp::ApiError => e
  error_response(e)
end