cancel_order
DestructiveIdempotent
Cancel open exchange orders by providing the order ID to manage trading positions and maintain order book integrity.
Instructions
Cancel one of your open orders on the exchange.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orderId | Yes | The order ID to cancel |
Implementation Reference
- src/tools/exchange.ts:67-81 (handler)MCP tool registration and handler for cancel_order. Defines the tool with input schema (orderId string) and executes the cancellation by calling client.cancelOrder(), returning the JSON result.
// cancel_order — Cancel an open order server.tool( 'cancel_order', 'Cancel one of your open orders on the exchange.', { orderId: z.string().describe('The order ID to cancel'), }, { destructiveHint: true, idempotentHint: true, openWorldHint: true }, async (params) => { const result = await client.cancelOrder(params.orderId); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } ); - src/client.ts:264-266 (helper)HTTP client method that sends a DELETE request to /orders/{orderId} endpoint to cancel the order via the Agora API.
async cancelOrder(orderId: string): Promise<any> { return this.request(`/orders/${orderId}`, { method: 'DELETE' }); }