modify_order
Adjust price or quantity of pending limit orders on Groww to update trading strategies before execution.
Instructions
Modify price/quantity of a pending limit order
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order_id | Yes | Order ID to modify | |
| quantity | No | New quantity | |
| price | No | New limit price | |
| trigger_price | No | New trigger price |
Implementation Reference
- src/tools/orders.ts:94-135 (handler)The handler for the modify_order tool, which validates inputs and calls the growwClient.modifyOrder method.
// ── modify_order ────────────────────────────────────────── server.tool( "modify_order", "Modify price/quantity of a pending limit order", { order_id: z.string().describe("Order ID to modify"), quantity: z.number().int().positive().optional().describe("New quantity"), price: z.number().positive().optional().describe("New limit price"), trigger_price: z.number().positive().optional().describe("New trigger price"), }, async ({ order_id, quantity, price, trigger_price }) => { try { if (!quantity && !price && !trigger_price) { return mcpError("At least one of quantity, price, or trigger_price must be provided"); } const result = await growwClient.modifyOrder({ orderId: order_id, quantity, price, triggerPrice: trigger_price, }); const changes: string[] = []; if (quantity) changes.push(`Quantity → ${quantity}`); if (price) changes.push(`Price → ${formatCurrencyExact(price)}`); if (trigger_price) changes.push(`Trigger → ${formatCurrencyExact(trigger_price)}`); const text = [ `✏️ ORDER MODIFIED`, `${"─".repeat(40)}`, `Order ID: ${result.orderId}`, `Status: ${result.status}`, `Changes: ${changes.join(", ")}`, `${result.message}`, ].join("\n"); return mcpText(text); } catch (err) { return mcpError(normalizeError(err)); } } );