gate-mcp 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -19
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +45 -0
- package/dist/config.js.map +1 -0
- package/dist/index.js +31 -14
- package/dist/index.js.map +1 -1
- package/dist/tools/account.js +10 -10
- package/dist/tools/delivery.js +11 -11
- package/dist/tools/earn.js +5 -5
- package/dist/tools/flash_swap.js +5 -5
- package/dist/tools/futures.js +45 -45
- package/dist/tools/margin.js +5 -5
- package/dist/tools/options.js +13 -13
- package/dist/tools/spot.js +28 -28
- package/dist/tools/sub_account.js +11 -11
- package/dist/tools/unified.js +16 -16
- package/dist/tools/wallet.js +12 -12
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +12 -0
- package/dist/utils.js.map +1 -1
- package/package.json +3 -2
package/dist/tools/futures.js
CHANGED
|
@@ -5,7 +5,7 @@ import { textContent, errorContent } from '../utils.js';
|
|
|
5
5
|
const settleSchema = z.enum(['btc', 'usdt']).describe('Settlement currency: btc or usdt');
|
|
6
6
|
export function registerFuturesTools(server) {
|
|
7
7
|
// ── Public tools ──────────────────────────────────────────────────────────
|
|
8
|
-
server.tool('
|
|
8
|
+
server.tool('cex_futures_list_futures_contracts', 'List all perpetual futures contracts', { settle: settleSchema }, async ({ settle }) => {
|
|
9
9
|
try {
|
|
10
10
|
const { body } = await new FuturesApi(createClient()).listFuturesContracts(settle, {});
|
|
11
11
|
return textContent(body);
|
|
@@ -14,7 +14,7 @@ export function registerFuturesTools(server) {
|
|
|
14
14
|
return errorContent(e);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
server.tool('
|
|
17
|
+
server.tool('cex_futures_get_futures_contract', 'Get details of a single futures contract', {
|
|
18
18
|
settle: settleSchema,
|
|
19
19
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
20
20
|
}, async ({ settle, contract }) => {
|
|
@@ -26,7 +26,7 @@ export function registerFuturesTools(server) {
|
|
|
26
26
|
return errorContent(e);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
server.tool('
|
|
29
|
+
server.tool('cex_futures_get_futures_order_book', 'Get futures order book', {
|
|
30
30
|
settle: settleSchema,
|
|
31
31
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
32
32
|
limit: z.number().int().optional(),
|
|
@@ -42,7 +42,7 @@ export function registerFuturesTools(server) {
|
|
|
42
42
|
return errorContent(e);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
server.tool('
|
|
45
|
+
server.tool('cex_futures_get_futures_candlesticks', 'Get futures candlestick/OHLCV data', {
|
|
46
46
|
settle: settleSchema,
|
|
47
47
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
48
48
|
interval: z.enum(['10s', '1m', '5m', '15m', '30m', '1h', '4h', '8h', '1d', '7d']).optional(),
|
|
@@ -67,7 +67,7 @@ export function registerFuturesTools(server) {
|
|
|
67
67
|
return errorContent(e);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
server.tool('
|
|
70
|
+
server.tool('cex_futures_get_futures_tickers', 'Get ticker information for futures contracts', {
|
|
71
71
|
settle: settleSchema,
|
|
72
72
|
contract: z.string().optional().describe('Filter by contract name'),
|
|
73
73
|
}, async ({ settle, contract }) => {
|
|
@@ -82,7 +82,7 @@ export function registerFuturesTools(server) {
|
|
|
82
82
|
return errorContent(e);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
server.tool('
|
|
85
|
+
server.tool('cex_futures_get_futures_funding_rate', 'Get funding rate history for a futures contract', {
|
|
86
86
|
settle: settleSchema,
|
|
87
87
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
88
88
|
limit: z.number().int().optional(),
|
|
@@ -99,7 +99,7 @@ export function registerFuturesTools(server) {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
// ── Private tools ─────────────────────────────────────────────────────────
|
|
102
|
-
server.tool('
|
|
102
|
+
server.tool('cex_futures_get_futures_accounts', 'Get futures account balances (requires authentication)', { settle: settleSchema }, async ({ settle }) => {
|
|
103
103
|
try {
|
|
104
104
|
requireAuth();
|
|
105
105
|
const { body } = await new FuturesApi(createClient()).listFuturesAccounts(settle);
|
|
@@ -109,7 +109,7 @@ export function registerFuturesTools(server) {
|
|
|
109
109
|
return errorContent(e);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
server.tool('
|
|
112
|
+
server.tool('cex_futures_list_futures_positions', 'List all open futures positions (requires authentication)', {
|
|
113
113
|
settle: settleSchema,
|
|
114
114
|
holding: z.boolean().optional().describe('Only return positions with non-zero size'),
|
|
115
115
|
limit: z.number().int().optional(),
|
|
@@ -131,7 +131,7 @@ export function registerFuturesTools(server) {
|
|
|
131
131
|
return errorContent(e);
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
server.tool('
|
|
134
|
+
server.tool('cex_futures_get_futures_position', 'Get a single futures position (requires authentication)', {
|
|
135
135
|
settle: settleSchema,
|
|
136
136
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
137
137
|
}, async ({ settle, contract }) => {
|
|
@@ -144,7 +144,7 @@ export function registerFuturesTools(server) {
|
|
|
144
144
|
return errorContent(e);
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
|
-
server.tool('
|
|
147
|
+
server.tool('cex_futures_list_futures_orders', 'List futures orders (requires authentication)', {
|
|
148
148
|
settle: settleSchema,
|
|
149
149
|
status: z.enum(['open', 'finished']).describe('Order status'),
|
|
150
150
|
contract: z.string().optional().describe('Filter by contract'),
|
|
@@ -167,7 +167,7 @@ export function registerFuturesTools(server) {
|
|
|
167
167
|
return errorContent(e);
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
|
-
server.tool('
|
|
170
|
+
server.tool('cex_futures_create_futures_order', 'Create a futures order (requires authentication) — always confirm the details with the user before calling this tool', {
|
|
171
171
|
settle: settleSchema,
|
|
172
172
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
173
173
|
size: z.string().describe('Order size in contracts (negative = short)'),
|
|
@@ -194,7 +194,7 @@ export function registerFuturesTools(server) {
|
|
|
194
194
|
return errorContent(e);
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
|
-
server.tool('
|
|
197
|
+
server.tool('cex_futures_get_futures_order', 'Get a futures order by ID (requires authentication)', {
|
|
198
198
|
settle: settleSchema,
|
|
199
199
|
order_id: z.string().describe('Order ID'),
|
|
200
200
|
}, async ({ settle, order_id }) => {
|
|
@@ -207,7 +207,7 @@ export function registerFuturesTools(server) {
|
|
|
207
207
|
return errorContent(e);
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
|
-
server.tool('
|
|
210
|
+
server.tool('cex_futures_cancel_futures_order', 'Cancel a futures order (requires authentication) — always confirm with the user before calling this tool', {
|
|
211
211
|
settle: settleSchema,
|
|
212
212
|
order_id: z.string().describe('Order ID'),
|
|
213
213
|
}, async ({ settle, order_id }) => {
|
|
@@ -220,7 +220,7 @@ export function registerFuturesTools(server) {
|
|
|
220
220
|
return errorContent(e);
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
|
-
server.tool('
|
|
223
|
+
server.tool('cex_futures_amend_futures_order', 'Amend an open futures order (requires authentication) — always confirm the new values with the user before calling this tool', {
|
|
224
224
|
settle: settleSchema,
|
|
225
225
|
order_id: z.string().describe('Order ID'),
|
|
226
226
|
size: z.string().optional().describe('New order size'),
|
|
@@ -240,7 +240,7 @@ export function registerFuturesTools(server) {
|
|
|
240
240
|
return errorContent(e);
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
|
-
server.tool('
|
|
243
|
+
server.tool('cex_futures_list_futures_my_trades', 'Get personal futures trading history (requires authentication)', {
|
|
244
244
|
settle: settleSchema,
|
|
245
245
|
contract: z.string().optional().describe('Filter by contract'),
|
|
246
246
|
limit: z.number().int().optional(),
|
|
@@ -262,7 +262,7 @@ export function registerFuturesTools(server) {
|
|
|
262
262
|
return errorContent(e);
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
|
-
server.tool('
|
|
265
|
+
server.tool('cex_futures_list_position_close', 'List position close history (requires authentication)', {
|
|
266
266
|
settle: settleSchema,
|
|
267
267
|
contract: z.string().optional(),
|
|
268
268
|
limit: z.number().int().optional(),
|
|
@@ -281,7 +281,7 @@ export function registerFuturesTools(server) {
|
|
|
281
281
|
return errorContent(e);
|
|
282
282
|
}
|
|
283
283
|
});
|
|
284
|
-
server.tool('
|
|
284
|
+
server.tool('cex_futures_list_price_triggered_orders', 'List futures price-triggered orders (requires authentication)', {
|
|
285
285
|
settle: settleSchema,
|
|
286
286
|
status: z.enum(['open', 'finished']),
|
|
287
287
|
contract: z.string().optional(),
|
|
@@ -302,7 +302,7 @@ export function registerFuturesTools(server) {
|
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
// ── Additional public tools ────────────────────────────────────────────────
|
|
305
|
-
server.tool('
|
|
305
|
+
server.tool('cex_futures_get_futures_trades', 'Get recent public trades for a futures contract', {
|
|
306
306
|
settle: settleSchema,
|
|
307
307
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
308
308
|
limit: z.number().int().optional(),
|
|
@@ -324,7 +324,7 @@ export function registerFuturesTools(server) {
|
|
|
324
324
|
return errorContent(e);
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
|
-
server.tool('
|
|
327
|
+
server.tool('cex_futures_list_contract_stats', 'Get contract statistics (open interest, long/short ratio, etc.)', {
|
|
328
328
|
settle: settleSchema,
|
|
329
329
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
330
330
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -346,7 +346,7 @@ export function registerFuturesTools(server) {
|
|
|
346
346
|
return errorContent(e);
|
|
347
347
|
}
|
|
348
348
|
});
|
|
349
|
-
server.tool('
|
|
349
|
+
server.tool('cex_futures_get_futures_premium_index', 'Get premium index (mark price minus index price) history for a contract', {
|
|
350
350
|
settle: settleSchema,
|
|
351
351
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
352
352
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -372,7 +372,7 @@ export function registerFuturesTools(server) {
|
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
// ── Additional private tools ───────────────────────────────────────────────
|
|
375
|
-
server.tool('
|
|
375
|
+
server.tool('cex_futures_list_futures_account_book', 'Get futures account transaction/ledger history (requires authentication)', {
|
|
376
376
|
settle: settleSchema,
|
|
377
377
|
contract: z.string().optional().describe('Filter by contract'),
|
|
378
378
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -403,7 +403,7 @@ export function registerFuturesTools(server) {
|
|
|
403
403
|
return errorContent(e);
|
|
404
404
|
}
|
|
405
405
|
});
|
|
406
|
-
server.tool('
|
|
406
|
+
server.tool('cex_futures_get_futures_fee', 'Get futures trading fee rates (requires authentication)', {
|
|
407
407
|
settle: settleSchema,
|
|
408
408
|
contract: z.string().optional().describe('Filter by contract'),
|
|
409
409
|
}, async ({ settle, contract }) => {
|
|
@@ -419,7 +419,7 @@ export function registerFuturesTools(server) {
|
|
|
419
419
|
return errorContent(e);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
|
-
server.tool('
|
|
422
|
+
server.tool('cex_futures_get_leverage', 'Get current leverage for a futures position (requires authentication)', {
|
|
423
423
|
settle: settleSchema,
|
|
424
424
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
425
425
|
}, async ({ settle, contract }) => {
|
|
@@ -432,7 +432,7 @@ export function registerFuturesTools(server) {
|
|
|
432
432
|
return errorContent(e);
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
|
-
server.tool('
|
|
435
|
+
server.tool('cex_futures_update_futures_position_leverage', 'Update leverage for a futures position (requires authentication) — always confirm the new leverage with the user before calling this tool', {
|
|
436
436
|
settle: settleSchema,
|
|
437
437
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
438
438
|
leverage: z.string().describe('New leverage value; 0 for cross-margin mode'),
|
|
@@ -450,7 +450,7 @@ export function registerFuturesTools(server) {
|
|
|
450
450
|
return errorContent(e);
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
-
server.tool('
|
|
453
|
+
server.tool('cex_futures_update_futures_position_margin', 'Add or reduce margin for a futures position (requires authentication) — always confirm the amount with the user before calling this tool', {
|
|
454
454
|
settle: settleSchema,
|
|
455
455
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
456
456
|
change: z.string().describe('Margin change amount; positive to add, negative to reduce'),
|
|
@@ -464,7 +464,7 @@ export function registerFuturesTools(server) {
|
|
|
464
464
|
return errorContent(e);
|
|
465
465
|
}
|
|
466
466
|
});
|
|
467
|
-
server.tool('
|
|
467
|
+
server.tool('cex_futures_update_futures_position_risk_limit', 'Update the risk limit for a futures position (requires authentication)', {
|
|
468
468
|
settle: settleSchema,
|
|
469
469
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
470
470
|
risk_limit: z.string().describe('New risk limit value'),
|
|
@@ -478,7 +478,7 @@ export function registerFuturesTools(server) {
|
|
|
478
478
|
return errorContent(e);
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
|
-
server.tool('
|
|
481
|
+
server.tool('cex_futures_cancel_all_futures_orders', 'Cancel all open futures orders (requires authentication) — always confirm with the user before calling this tool', {
|
|
482
482
|
settle: settleSchema,
|
|
483
483
|
contract: z.string().optional().describe('Only cancel orders for this contract'),
|
|
484
484
|
side: z.enum(['ask', 'bid']).optional().describe('Only cancel ask (sell) or bid (buy) orders'),
|
|
@@ -497,7 +497,7 @@ export function registerFuturesTools(server) {
|
|
|
497
497
|
return errorContent(e);
|
|
498
498
|
}
|
|
499
499
|
});
|
|
500
|
-
server.tool('
|
|
500
|
+
server.tool('cex_futures_create_futures_batch_orders', 'Create multiple futures orders in a single request (requires authentication) — always confirm the details with the user before calling this tool', {
|
|
501
501
|
settle: settleSchema,
|
|
502
502
|
orders: z.array(z.object({
|
|
503
503
|
contract: z.string(),
|
|
@@ -529,7 +529,7 @@ export function registerFuturesTools(server) {
|
|
|
529
529
|
return errorContent(e);
|
|
530
530
|
}
|
|
531
531
|
});
|
|
532
|
-
server.tool('
|
|
532
|
+
server.tool('cex_futures_cancel_futures_batch_orders', 'Cancel multiple futures orders by ID in a single request (requires authentication) — always confirm with the user before calling this tool', {
|
|
533
533
|
settle: settleSchema,
|
|
534
534
|
order_ids: z.array(z.string()).describe('Array of order IDs to cancel'),
|
|
535
535
|
}, async ({ settle, order_ids }) => {
|
|
@@ -542,7 +542,7 @@ export function registerFuturesTools(server) {
|
|
|
542
542
|
return errorContent(e);
|
|
543
543
|
}
|
|
544
544
|
});
|
|
545
|
-
server.tool('
|
|
545
|
+
server.tool('cex_futures_get_futures_orders_with_time_range', 'Get futures orders filtered by time range (requires authentication)', {
|
|
546
546
|
settle: settleSchema,
|
|
547
547
|
contract: z.string().optional().describe('Filter by contract'),
|
|
548
548
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -570,7 +570,7 @@ export function registerFuturesTools(server) {
|
|
|
570
570
|
return errorContent(e);
|
|
571
571
|
}
|
|
572
572
|
});
|
|
573
|
-
server.tool('
|
|
573
|
+
server.tool('cex_futures_get_futures_my_trades_timerange', 'Get personal futures trade history filtered by time range (requires authentication)', {
|
|
574
574
|
settle: settleSchema,
|
|
575
575
|
contract: z.string().optional().describe('Filter by contract'),
|
|
576
576
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -601,7 +601,7 @@ export function registerFuturesTools(server) {
|
|
|
601
601
|
return errorContent(e);
|
|
602
602
|
}
|
|
603
603
|
});
|
|
604
|
-
server.tool('
|
|
604
|
+
server.tool('cex_futures_list_futures_liq_orders', 'Get personal futures liquidation history (requires authentication)', {
|
|
605
605
|
settle: settleSchema,
|
|
606
606
|
contract: z.string().optional(),
|
|
607
607
|
from: z.number().optional().describe('Start time (Unix timestamp)'),
|
|
@@ -629,7 +629,7 @@ export function registerFuturesTools(server) {
|
|
|
629
629
|
return errorContent(e);
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
|
-
server.tool('
|
|
632
|
+
server.tool('cex_futures_get_futures_price_triggered_order', 'Get details of a futures price-triggered order (requires authentication)', {
|
|
633
633
|
settle: settleSchema,
|
|
634
634
|
order_id: z.string().describe('Order ID'),
|
|
635
635
|
}, async ({ settle, order_id }) => {
|
|
@@ -642,7 +642,7 @@ export function registerFuturesTools(server) {
|
|
|
642
642
|
return errorContent(e);
|
|
643
643
|
}
|
|
644
644
|
});
|
|
645
|
-
server.tool('
|
|
645
|
+
server.tool('cex_futures_create_futures_price_triggered_order', 'Create a futures price-triggered order (requires authentication) — always confirm the details with the user before calling this tool', {
|
|
646
646
|
settle: settleSchema,
|
|
647
647
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
648
648
|
trigger_price: z.string().describe('Price that activates the order'),
|
|
@@ -676,7 +676,7 @@ export function registerFuturesTools(server) {
|
|
|
676
676
|
return errorContent(e);
|
|
677
677
|
}
|
|
678
678
|
});
|
|
679
|
-
server.tool('
|
|
679
|
+
server.tool('cex_futures_cancel_futures_price_triggered_order', 'Cancel a single futures price-triggered order (requires authentication) — always confirm with the user before calling this tool', {
|
|
680
680
|
settle: settleSchema,
|
|
681
681
|
order_id: z.string().describe('Order ID'),
|
|
682
682
|
}, async ({ settle, order_id }) => {
|
|
@@ -689,7 +689,7 @@ export function registerFuturesTools(server) {
|
|
|
689
689
|
return errorContent(e);
|
|
690
690
|
}
|
|
691
691
|
});
|
|
692
|
-
server.tool('
|
|
692
|
+
server.tool('cex_futures_cancel_futures_price_triggered_order_list', 'Cancel all futures price-triggered orders (requires authentication) — always confirm with the user before calling this tool', {
|
|
693
693
|
settle: settleSchema,
|
|
694
694
|
contract: z.string().optional().describe('Only cancel orders for this contract'),
|
|
695
695
|
}, async ({ settle, contract }) => {
|
|
@@ -705,7 +705,7 @@ export function registerFuturesTools(server) {
|
|
|
705
705
|
return errorContent(e);
|
|
706
706
|
}
|
|
707
707
|
});
|
|
708
|
-
server.tool('
|
|
708
|
+
server.tool('cex_futures_list_futures_risk_limit_tiers', 'Get risk limit tiers for a futures contract (requires authentication)', {
|
|
709
709
|
settle: settleSchema,
|
|
710
710
|
contract: z.string().optional().describe('Contract name e.g. BTC_USDT'),
|
|
711
711
|
limit: z.number().int().optional(),
|
|
@@ -727,7 +727,7 @@ export function registerFuturesTools(server) {
|
|
|
727
727
|
return errorContent(e);
|
|
728
728
|
}
|
|
729
729
|
});
|
|
730
|
-
server.tool('
|
|
730
|
+
server.tool('cex_futures_set_futures_dual_mode', 'Enable or disable dual-mode (hedge mode) for a futures account (requires authentication)', {
|
|
731
731
|
settle: settleSchema,
|
|
732
732
|
dual_mode: z.boolean().describe('true to enable dual/hedge mode, false to disable'),
|
|
733
733
|
}, async ({ settle, dual_mode }) => {
|
|
@@ -740,7 +740,7 @@ export function registerFuturesTools(server) {
|
|
|
740
740
|
return errorContent(e);
|
|
741
741
|
}
|
|
742
742
|
});
|
|
743
|
-
server.tool('
|
|
743
|
+
server.tool('cex_futures_get_futures_dual_mode_position', 'Get dual-mode positions for a contract (requires authentication)', {
|
|
744
744
|
settle: settleSchema,
|
|
745
745
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
746
746
|
}, async ({ settle, contract }) => {
|
|
@@ -753,7 +753,7 @@ export function registerFuturesTools(server) {
|
|
|
753
753
|
return errorContent(e);
|
|
754
754
|
}
|
|
755
755
|
});
|
|
756
|
-
server.tool('
|
|
756
|
+
server.tool('cex_futures_update_futures_dual_mode_position_margin', 'Add or reduce margin for a dual-mode position (requires authentication) — always confirm the amount with the user before calling this tool', {
|
|
757
757
|
settle: settleSchema,
|
|
758
758
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
759
759
|
change: z.string().describe('Margin change amount; positive to add, negative to reduce'),
|
|
@@ -768,7 +768,7 @@ export function registerFuturesTools(server) {
|
|
|
768
768
|
return errorContent(e);
|
|
769
769
|
}
|
|
770
770
|
});
|
|
771
|
-
server.tool('
|
|
771
|
+
server.tool('cex_futures_update_futures_dual_mode_position_leverage', 'Update leverage for a dual-mode position (requires authentication) — always confirm the new leverage with the user before calling this tool', {
|
|
772
772
|
settle: settleSchema,
|
|
773
773
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
774
774
|
leverage: z.string().describe('New leverage value; 0 for cross-margin mode'),
|
|
@@ -786,7 +786,7 @@ export function registerFuturesTools(server) {
|
|
|
786
786
|
return errorContent(e);
|
|
787
787
|
}
|
|
788
788
|
});
|
|
789
|
-
server.tool('
|
|
789
|
+
server.tool('cex_futures_update_futures_dual_mode_position_risk_limit', 'Update the risk limit for a dual-mode position (requires authentication)', {
|
|
790
790
|
settle: settleSchema,
|
|
791
791
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
792
792
|
risk_limit: z.string().describe('New risk limit value'),
|
|
@@ -800,7 +800,7 @@ export function registerFuturesTools(server) {
|
|
|
800
800
|
return errorContent(e);
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
|
-
server.tool('
|
|
803
|
+
server.tool('cex_futures_update_futures_position_cross_mode', 'Switch a single-mode position between isolated and cross margin (requires authentication)', {
|
|
804
804
|
settle: settleSchema,
|
|
805
805
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
806
806
|
mode: z.enum(['cross', 'isolated']).describe('Margin mode to set'),
|
|
@@ -817,7 +817,7 @@ export function registerFuturesTools(server) {
|
|
|
817
817
|
return errorContent(e);
|
|
818
818
|
}
|
|
819
819
|
});
|
|
820
|
-
server.tool('
|
|
820
|
+
server.tool('cex_futures_update_futures_dual_comp_position_cross_mode', 'Switch a dual-mode position between isolated and cross margin (requires authentication)', {
|
|
821
821
|
settle: settleSchema,
|
|
822
822
|
contract: z.string().describe('Contract name e.g. BTC_USDT'),
|
|
823
823
|
mode: z.enum(['cross', 'isolated']).describe('Margin mode to set'),
|
|
@@ -834,7 +834,7 @@ export function registerFuturesTools(server) {
|
|
|
834
834
|
return errorContent(e);
|
|
835
835
|
}
|
|
836
836
|
});
|
|
837
|
-
server.tool('
|
|
837
|
+
server.tool('cex_futures_countdown_cancel_all_futures', 'Set a countdown timer to cancel all futures orders (safety kill-switch, requires authentication)', {
|
|
838
838
|
settle: settleSchema,
|
|
839
839
|
timeout: z.number().int().describe('Countdown in seconds; 0 disables the timer'),
|
|
840
840
|
contract: z.string().optional().describe('Limit cancellation to this contract'),
|
package/dist/tools/margin.js
CHANGED
|
@@ -3,7 +3,7 @@ import { MarginApi } from 'gate-api';
|
|
|
3
3
|
import { createClient, requireAuth } from '../client.js';
|
|
4
4
|
import { textContent, errorContent } from '../utils.js';
|
|
5
5
|
export function registerMarginTools(server) {
|
|
6
|
-
server.tool('
|
|
6
|
+
server.tool('cex_margin_list_margin_accounts', 'List margin accounts (requires authentication)', { currency_pair: z.string().optional().describe('Filter by currency pair') }, async ({ currency_pair }) => {
|
|
7
7
|
try {
|
|
8
8
|
requireAuth();
|
|
9
9
|
const opts = {};
|
|
@@ -16,7 +16,7 @@ export function registerMarginTools(server) {
|
|
|
16
16
|
return errorContent(e);
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
server.tool('
|
|
19
|
+
server.tool('cex_margin_list_margin_account_book', 'List margin account balance change history (requires authentication)', {
|
|
20
20
|
currency: z.string().optional(),
|
|
21
21
|
currency_pair: z.string().optional(),
|
|
22
22
|
type: z.string().optional().describe('Change type filter'),
|
|
@@ -43,7 +43,7 @@ export function registerMarginTools(server) {
|
|
|
43
43
|
return errorContent(e);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
server.tool('
|
|
46
|
+
server.tool('cex_margin_get_auto_repay_status', 'Get auto-repay status for margin loans (requires authentication)', {}, async () => {
|
|
47
47
|
try {
|
|
48
48
|
requireAuth();
|
|
49
49
|
const { body } = await new MarginApi(createClient()).getAutoRepayStatus();
|
|
@@ -53,7 +53,7 @@ export function registerMarginTools(server) {
|
|
|
53
53
|
return errorContent(e);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
server.tool('
|
|
56
|
+
server.tool('cex_margin_set_auto_repay', 'Enable or disable auto-repay for margin loans (requires authentication) — always confirm with the user before calling this tool', {
|
|
57
57
|
status: z.enum(['on', 'off']).describe('Auto-repay status'),
|
|
58
58
|
}, async ({ status }) => {
|
|
59
59
|
try {
|
|
@@ -65,7 +65,7 @@ export function registerMarginTools(server) {
|
|
|
65
65
|
return errorContent(e);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
server.tool('
|
|
68
|
+
server.tool('cex_margin_get_margin_transferable', 'Get the maximum amount transferable for a margin currency (requires authentication)', {
|
|
69
69
|
currency: z.string().describe('Currency symbol'),
|
|
70
70
|
currency_pair: z.string().optional().describe('Filter by currency pair'),
|
|
71
71
|
}, async ({ currency, currency_pair }) => {
|
package/dist/tools/options.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createClient, requireAuth } from '../client.js';
|
|
|
4
4
|
import { textContent, errorContent } from '../utils.js';
|
|
5
5
|
export function registerOptionsTools(server) {
|
|
6
6
|
// ── Public tools ──────────────────────────────────────────────────────────
|
|
7
|
-
server.tool('
|
|
7
|
+
server.tool('cex_options_list_options_underlyings', 'List all options underlying assets', {}, async () => {
|
|
8
8
|
try {
|
|
9
9
|
const { body } = await new OptionsApi(createClient()).listOptionsUnderlyings();
|
|
10
10
|
return textContent(body);
|
|
@@ -13,7 +13,7 @@ export function registerOptionsTools(server) {
|
|
|
13
13
|
return errorContent(e);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
server.tool('
|
|
16
|
+
server.tool('cex_options_list_options_expirations', 'List option expiration dates for an underlying', { underlying: z.string().describe('Underlying asset e.g. BTC_USDT') }, async ({ underlying }) => {
|
|
17
17
|
try {
|
|
18
18
|
const { body } = await new OptionsApi(createClient()).listOptionsExpirations(underlying);
|
|
19
19
|
return textContent(body);
|
|
@@ -22,7 +22,7 @@ export function registerOptionsTools(server) {
|
|
|
22
22
|
return errorContent(e);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
server.tool('
|
|
25
|
+
server.tool('cex_options_list_options_contracts', 'List all options contracts for an underlying', {
|
|
26
26
|
underlying: z.string().describe('Underlying asset e.g. BTC_USDT'),
|
|
27
27
|
expiration: z.number().optional().describe('Filter by expiration timestamp'),
|
|
28
28
|
}, async ({ underlying, expiration }) => {
|
|
@@ -37,7 +37,7 @@ export function registerOptionsTools(server) {
|
|
|
37
37
|
return errorContent(e);
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
server.tool('
|
|
40
|
+
server.tool('cex_options_get_options_contract', 'Get details of a single options contract', { contract: z.string().describe('Options contract name e.g. BTC_USDT-20241227-50000-C') }, async ({ contract }) => {
|
|
41
41
|
try {
|
|
42
42
|
const { body } = await new OptionsApi(createClient()).getOptionsContract(contract);
|
|
43
43
|
return textContent(body);
|
|
@@ -46,7 +46,7 @@ export function registerOptionsTools(server) {
|
|
|
46
46
|
return errorContent(e);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
server.tool('
|
|
49
|
+
server.tool('cex_options_list_options_order_book', 'Get options order book', {
|
|
50
50
|
contract: z.string().describe('Options contract name'),
|
|
51
51
|
limit: z.number().int().optional(),
|
|
52
52
|
}, async ({ contract, limit }) => {
|
|
@@ -61,7 +61,7 @@ export function registerOptionsTools(server) {
|
|
|
61
61
|
return errorContent(e);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
server.tool('
|
|
64
|
+
server.tool('cex_options_list_options_tickers', 'Get options tickers for an underlying', { underlying: z.string().describe('Underlying asset e.g. BTC_USDT') }, async ({ underlying }) => {
|
|
65
65
|
try {
|
|
66
66
|
const { body } = await new OptionsApi(createClient()).listOptionsTickers(underlying);
|
|
67
67
|
return textContent(body);
|
|
@@ -70,7 +70,7 @@ export function registerOptionsTools(server) {
|
|
|
70
70
|
return errorContent(e);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
server.tool('
|
|
73
|
+
server.tool('cex_options_list_options_candlesticks', 'Get options candlestick data', {
|
|
74
74
|
contract: z.string().describe('Options contract name'),
|
|
75
75
|
interval: z.enum(['1m', '5m', '15m', '30m', '1h', '1d']).optional(),
|
|
76
76
|
limit: z.number().int().optional(),
|
|
@@ -89,7 +89,7 @@ export function registerOptionsTools(server) {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
// ── Private tools ─────────────────────────────────────────────────────────
|
|
92
|
-
server.tool('
|
|
92
|
+
server.tool('cex_options_list_options_account', 'Get options account balance (requires authentication)', {}, async () => {
|
|
93
93
|
try {
|
|
94
94
|
requireAuth();
|
|
95
95
|
const { body } = await new OptionsApi(createClient()).listOptionsAccount();
|
|
@@ -99,7 +99,7 @@ export function registerOptionsTools(server) {
|
|
|
99
99
|
return errorContent(e);
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
server.tool('
|
|
102
|
+
server.tool('cex_options_list_options_positions', 'List options positions (requires authentication)', { underlying: z.string().optional().describe('Filter by underlying') }, async ({ underlying }) => {
|
|
103
103
|
try {
|
|
104
104
|
requireAuth();
|
|
105
105
|
const opts = {};
|
|
@@ -112,7 +112,7 @@ export function registerOptionsTools(server) {
|
|
|
112
112
|
return errorContent(e);
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
-
server.tool('
|
|
115
|
+
server.tool('cex_options_list_options_orders', 'List options orders (requires authentication)', {
|
|
116
116
|
status: z.enum(['open', 'finished']),
|
|
117
117
|
underlying: z.string().optional(),
|
|
118
118
|
contract: z.string().optional(),
|
|
@@ -137,7 +137,7 @@ export function registerOptionsTools(server) {
|
|
|
137
137
|
return errorContent(e);
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
server.tool('
|
|
140
|
+
server.tool('cex_options_create_options_order', 'Create an options order (requires authentication) — always confirm the details with the user before calling this tool', {
|
|
141
141
|
contract: z.string().describe('Options contract name'),
|
|
142
142
|
size: z.number().int().describe('Order size (negative = short)'),
|
|
143
143
|
price: z.string().optional().describe('Order price (omit for market)'),
|
|
@@ -163,7 +163,7 @@ export function registerOptionsTools(server) {
|
|
|
163
163
|
return errorContent(e);
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
|
-
server.tool('
|
|
166
|
+
server.tool('cex_options_cancel_options_order', 'Cancel an options order (requires authentication) — always confirm with the user before calling this tool', { order_id: z.number().int().describe('Order ID') }, async ({ order_id }) => {
|
|
167
167
|
try {
|
|
168
168
|
requireAuth();
|
|
169
169
|
const { body } = await new OptionsApi(createClient()).cancelOptionsOrder(order_id);
|
|
@@ -173,7 +173,7 @@ export function registerOptionsTools(server) {
|
|
|
173
173
|
return errorContent(e);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
server.tool('
|
|
176
|
+
server.tool('cex_options_list_my_options_trades', 'List personal options trading history (requires authentication)', {
|
|
177
177
|
underlying: z.string().describe('Underlying asset e.g. BTC_USDT'),
|
|
178
178
|
contract: z.string().optional(),
|
|
179
179
|
limit: z.number().int().optional(),
|