@michaleffffff/mcp-trading-server 3.0.10 → 3.0.16
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/CHANGELOG.md +57 -0
- package/README.md +93 -1
- package/TOOL_EXAMPLES.md +293 -54
- package/dist/prompts/tradingGuide.js +4 -2
- package/dist/server.js +96 -5
- package/dist/services/tradeService.js +62 -2
- package/dist/tools/closePosition.js +1 -1
- package/dist/tools/executeTrade.js +12 -1
- package/dist/tools/getBaseDetail.js +86 -0
- package/dist/tools/openPositionSimple.js +41 -13
- package/dist/tools/searchTools.js +237 -12
- package/dist/utils/address.js +12 -0
- package/dist/utils/mappings.js +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.16 - 2026-03-18
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Improved MCP-side validation UX:
|
|
7
|
+
- `executionFeeToken` now fails early with a clear `INVALID_PARAM` when callers pass the zero address, and points users to the real pool `quoteToken`.
|
|
8
|
+
- `open_position_simple` no longer returns a generic numeric parse error when `collateralAmount` is omitted; it now explains that `collateralAmount` is still required and suggests an approximate value from `size`, `price`, and `leverage`.
|
|
9
|
+
|
|
10
|
+
## 3.0.15 - 2026-03-18
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Hardened trading parameter compatibility with SDK `v1.0.2`:
|
|
14
|
+
- `execute_trade` / `close_position` now enforce `timeInForce=IOC` only (`0` / `IOC`).
|
|
15
|
+
- Added `poolId` ↔ `marketId` consistency validation on `execute_trade`.
|
|
16
|
+
- Added preflight size/notional validation so `size` is treated strictly as BASE quantity instead of mistaken USD order value.
|
|
17
|
+
- Hardened `get_base_detail`:
|
|
18
|
+
- If SDK returns empty data for a valid active base token, MCP now falls back to market search + market detail to synthesize base metadata instead of returning false `NOT_FOUND`.
|
|
19
|
+
|
|
20
|
+
## 3.0.14 - 2026-03-18
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Improved `open_position_simple` compatibility for MCP/LLM callers:
|
|
24
|
+
- Accepts optional `marketId` input without triggering schema rejection.
|
|
25
|
+
- Validates supplied `marketId` against the market resolved from `poolId` / `keyword`.
|
|
26
|
+
- Added regression coverage for `dryRun` calls that include `marketId`.
|
|
27
|
+
|
|
28
|
+
## 3.0.13 - 2026-03-18
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Updated docs to better reflect the consolidated toolset:
|
|
32
|
+
- Added a `Legacy Mapping` section to `README.md`
|
|
33
|
+
- Added a `Tool Discovery` workflow using `search_tools`
|
|
34
|
+
- Added a dedicated `Parameter Format Guide` with canonical examples
|
|
35
|
+
- Rebuilt `TOOL_EXAMPLES.md` into a current, MCP-first example handbook with clearer payload formats for trading, liquidity, account, and discovery workflows.
|
|
36
|
+
- Improved `search_tools`:
|
|
37
|
+
- Searches legacy tool names, aliases, categories, and intent phrases
|
|
38
|
+
- Returns categories, aliases, required args, and common parameter hints
|
|
39
|
+
- Returns fallback suggestions when no exact match is found
|
|
40
|
+
- Updated `trading_best_practices` prompt to reference `search_tools`, consolidated tools, and tolerant enum handling.
|
|
41
|
+
|
|
42
|
+
## 3.0.12 - 2026-03-18
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Expanded MCP server-side alias normalization beyond case-insensitive enums:
|
|
46
|
+
- `direction`: supports `buy/sell`, `long/short`, `bull/bear`
|
|
47
|
+
- `action`: supports `add/remove/increase/decrease` and normalizes to `deposit/withdraw`
|
|
48
|
+
- `orderType`: supports case-insensitive `market/limit/stop/conditional`
|
|
49
|
+
- `triggerType`: supports case-insensitive `none/gte/lte`
|
|
50
|
+
- This keeps tool schemas strict while making AI/tool callers more tolerant of natural-language style inputs.
|
|
51
|
+
|
|
52
|
+
## 3.0.11 - 2026-03-18
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
- Improved MCP argument normalization for string enums:
|
|
56
|
+
- `z.enum(...)` inputs are now matched case-insensitively at the server layer before Zod validation.
|
|
57
|
+
- Lowercase/mixed-case inputs like `open`, `history`, `all`, `base`, `quote`, `long`, `short` now normalize to canonical enum values automatically.
|
|
58
|
+
- This reduces avoidable `INVALID_PARAM` errors for AI callers while preserving the same canonical tool schemas.
|
|
59
|
+
|
|
3
60
|
## 3.0.10 - 2026-03-18
|
|
4
61
|
|
|
5
62
|
### Fixed
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A production-ready MCP (Model Context Protocol) server for deep integration with
|
|
|
6
6
|
|
|
7
7
|
# Release Notes
|
|
8
8
|
|
|
9
|
-
- **Current release: 3.0.
|
|
9
|
+
- **Current release: 3.0.16**
|
|
10
10
|
- **SDK baseline**: `@myx-trade/sdk@^1.0.2` compatibility completed.
|
|
11
11
|
- **Refinement**: Consolidated 40+ specialized tools into ~26 high-level unified tools.
|
|
12
12
|
- **Improved UX**: Enhanced AI parameter parsing, automated unit conversion, and structured error reporting.
|
|
@@ -44,6 +44,7 @@ QUOTE_TOKEN_DECIMALS=18
|
|
|
44
44
|
### 📈 Market Analysis
|
|
45
45
|
* **`find_pool`**: Discover active markets by keyword/symbol (e.g., "BTC", "ETH").
|
|
46
46
|
* **`list_pools`**: List all tradable assets on the current chain.
|
|
47
|
+
* **`search_tools`**: Discover the right MCP tool by keyword, legacy tool name, or intent phrase.
|
|
47
48
|
* **`get_price`**: Fetch real-time prices (Impact Market Price or Oracle Price).
|
|
48
49
|
* **`get_pool_metadata`**: Comprehensive metrics (Fees, Open Interest, Liquidity Depth).
|
|
49
50
|
* **`get_kline`**: Fetch candlestick data for technical analysis.
|
|
@@ -75,6 +76,97 @@ QUOTE_TOKEN_DECIMALS=18
|
|
|
75
76
|
|
|
76
77
|
---
|
|
77
78
|
|
|
79
|
+
# Tool Discovery
|
|
80
|
+
|
|
81
|
+
When a client or LLM is unsure which tool to call:
|
|
82
|
+
|
|
83
|
+
1. Use `search_tools(keyword="open order")` or `search_tools(keyword="get_market_price")`
|
|
84
|
+
2. Read the returned `aliases`, `category`, and `commonArgs`
|
|
85
|
+
3. Confirm market context with `find_pool`
|
|
86
|
+
4. Call the recommended high-level tool instead of a removed legacy tool
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{ "name": "search_tools", "arguments": { "keyword": "get_open_orders" } }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{ "name": "search_tools", "arguments": { "keyword": "add base lp" } }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
# Parameter Format Guide
|
|
101
|
+
|
|
102
|
+
Use these conventions when generating tool arguments:
|
|
103
|
+
|
|
104
|
+
- `poolId`: Prefer a real hex pool id from `find_pool` or `list_pools`
|
|
105
|
+
- `keyword`: Use a market symbol like `"BTC"`, `"ETH"`, `"ARB"`
|
|
106
|
+
- `direction`: `LONG` / `SHORT` are canonical; lowercase and aliases like `buy` / `sell` are tolerated
|
|
107
|
+
- `status`: `OPEN` / `HISTORY` / `ALL` are canonical; lowercase is tolerated
|
|
108
|
+
- `poolType`: `BASE` / `QUOTE` are canonical; lowercase is tolerated
|
|
109
|
+
- `orderType`: `MARKET` / `LIMIT` / `STOP` / `CONDITIONAL`
|
|
110
|
+
- `timeInForce`: SDK `v1.0.2` currently supports `IOC` only, so use `0` or `"IOC"`
|
|
111
|
+
- `size`: base token quantity, not USD notional; expected order value is usually `collateralAmount * leverage`
|
|
112
|
+
- `executionFeeToken`: must be a real token address; zero address is rejected. Use the pool `quoteToken`
|
|
113
|
+
- Human units: `"100"` means 100 USDC or 100 token units depending on field
|
|
114
|
+
- Raw units: `"raw:1000000"` means exact on-chain integer units
|
|
115
|
+
|
|
116
|
+
Examples:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"name": "get_orders",
|
|
121
|
+
"arguments": { "status": "OPEN", "limit": 20 }
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"name": "manage_liquidity",
|
|
128
|
+
"arguments": {
|
|
129
|
+
"poolId": "0x...",
|
|
130
|
+
"poolType": "BASE",
|
|
131
|
+
"action": "deposit",
|
|
132
|
+
"amount": 1000,
|
|
133
|
+
"slippage": 0.01
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"name": "open_position_simple",
|
|
141
|
+
"arguments": {
|
|
142
|
+
"keyword": "ARB",
|
|
143
|
+
"direction": "LONG",
|
|
144
|
+
"collateralAmount": "100",
|
|
145
|
+
"leverage": 5,
|
|
146
|
+
"orderType": "LIMIT",
|
|
147
|
+
"price": "2.5"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
# Legacy Mapping
|
|
155
|
+
|
|
156
|
+
Common old-to-new tool mappings:
|
|
157
|
+
|
|
158
|
+
- `get_market_price` / `get_oracle_price` -> `get_price`
|
|
159
|
+
- `get_market_detail` / `get_pool_info` / `get_liquidity_info` / `get_pool_level_config` -> `get_pool_metadata`
|
|
160
|
+
- `get_pool_list` / `get_pool_symbol_all` -> `list_pools`
|
|
161
|
+
- `search_market` / `get_pool_by_symbol` -> `find_pool`
|
|
162
|
+
- `get_open_orders` / `get_order_history` -> `get_orders`
|
|
163
|
+
- `get_positions` / `get_position_history` -> `get_positions_all`
|
|
164
|
+
- `cancel_order` / `cancel_all_orders` -> `cancel_orders`
|
|
165
|
+
- `set_tp_sl` / `update_order_tp_sl` -> `manage_tp_sl`
|
|
166
|
+
- `get_account` / `get_account_info` / `get_balances` / `get_margin_balance` -> `get_account_snapshot`
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
78
170
|
# Documentation
|
|
79
171
|
|
|
80
172
|
For detailed implementation examples and parameter guides, see:
|
package/TOOL_EXAMPLES.md
CHANGED
|
@@ -1,150 +1,389 @@
|
|
|
1
|
-
# MYX MCP Tool Examples Handbook (v3.0.
|
|
1
|
+
# MYX MCP Tool Examples Handbook (v3.0.15)
|
|
2
2
|
|
|
3
|
-
This guide provides practical payload examples for the
|
|
4
|
-
All examples
|
|
3
|
+
This guide provides practical MCP payload examples for the current unified toolset.
|
|
4
|
+
All examples use the MCP format:
|
|
5
|
+
|
|
6
|
+
```json
|
|
7
|
+
{ "name": "tool_name", "arguments": { "...": "..." } }
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Discovery First
|
|
13
|
+
|
|
14
|
+
### `search_tools`
|
|
15
|
+
Find the right tool by intent phrase, old tool name, or keyword.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"name": "search_tools",
|
|
20
|
+
"arguments": { "keyword": "get_open_orders" }
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"name": "search_tools",
|
|
27
|
+
"arguments": { "keyword": "add base lp" }
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### `find_pool`
|
|
32
|
+
Resolve a market keyword to a tradable `poolId`.
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"name": "find_pool",
|
|
37
|
+
"arguments": { "keyword": "ETH", "limit": 5 }
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### `list_pools`
|
|
42
|
+
Browse all current markets on the active chain.
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"name": "list_pools",
|
|
47
|
+
"arguments": {}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
5
50
|
|
|
6
51
|
---
|
|
7
52
|
|
|
8
|
-
##
|
|
53
|
+
## Trading
|
|
54
|
+
|
|
55
|
+
### `open_position_simple`
|
|
56
|
+
Recommended high-level entry tool.
|
|
9
57
|
|
|
10
|
-
### `open_position_simple` (Recommended)
|
|
11
|
-
High-level tool that computes size and fees automatically.
|
|
12
58
|
```json
|
|
13
59
|
{
|
|
14
60
|
"name": "open_position_simple",
|
|
15
61
|
"arguments": {
|
|
16
|
-
"keyword": "
|
|
62
|
+
"keyword": "ARB",
|
|
63
|
+
"marketId": "0x...",
|
|
17
64
|
"direction": "LONG",
|
|
18
65
|
"collateralAmount": "100",
|
|
19
|
-
"leverage":
|
|
20
|
-
"
|
|
21
|
-
"
|
|
66
|
+
"leverage": 5,
|
|
67
|
+
"orderType": "LIMIT",
|
|
68
|
+
"price": "2.5",
|
|
69
|
+
"tpPrice": "2.9",
|
|
70
|
+
"slPrice": "2.2"
|
|
22
71
|
}
|
|
23
72
|
}
|
|
24
73
|
```
|
|
25
74
|
|
|
26
|
-
|
|
27
|
-
|
|
75
|
+
`marketId` is optional on `open_position_simple`. If supplied, it is validated against the market resolved from `poolId` or `keyword`.
|
|
76
|
+
`size` is always the base-asset quantity, not the USD notional. For example, a 500 USD order at price 1200 implies `size ≈ 0.416666...`.
|
|
77
|
+
`collateralAmount` remains required on `open_position_simple`; if omitted, MCP now returns an actionable suggestion instead of a generic parse error.
|
|
78
|
+
|
|
79
|
+
Raw-units example:
|
|
80
|
+
|
|
28
81
|
```json
|
|
29
|
-
// Mode 1: Specific IDs
|
|
30
82
|
{
|
|
31
|
-
"name": "
|
|
32
|
-
"arguments": {
|
|
83
|
+
"name": "open_position_simple",
|
|
84
|
+
"arguments": {
|
|
85
|
+
"poolId": "0x...",
|
|
86
|
+
"direction": "SHORT",
|
|
87
|
+
"collateralAmount": "raw:100000000",
|
|
88
|
+
"leverage": 10,
|
|
89
|
+
"orderType": "MARKET"
|
|
90
|
+
}
|
|
33
91
|
}
|
|
92
|
+
```
|
|
34
93
|
|
|
35
|
-
|
|
94
|
+
### `execute_trade`
|
|
95
|
+
Low-level increase-order tool when you want full control.
|
|
96
|
+
|
|
97
|
+
```json
|
|
36
98
|
{
|
|
37
|
-
"name": "
|
|
38
|
-
"arguments": {
|
|
99
|
+
"name": "execute_trade",
|
|
100
|
+
"arguments": {
|
|
101
|
+
"poolId": "0x...",
|
|
102
|
+
"marketId": "0x...",
|
|
103
|
+
"direction": "LONG",
|
|
104
|
+
"orderType": "LIMIT",
|
|
105
|
+
"price": "2500",
|
|
106
|
+
"size": "0.2",
|
|
107
|
+
"collateralAmount": "100",
|
|
108
|
+
"timeInForce": 0,
|
|
109
|
+
"leverage": 5
|
|
110
|
+
}
|
|
39
111
|
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`timeInForce` should be `0` (or `"IOC"` in string form) for SDK `v1.0.2`.
|
|
115
|
+
`executionFeeToken` must be a real token address; do not pass the zero address. Use the pool `quoteToken`.
|
|
40
116
|
|
|
41
|
-
|
|
117
|
+
### `close_position`
|
|
118
|
+
Close or reduce a position. Use `ALL` for a full close.
|
|
119
|
+
|
|
120
|
+
```json
|
|
42
121
|
{
|
|
43
|
-
"name": "
|
|
44
|
-
"arguments": {
|
|
122
|
+
"name": "close_position",
|
|
123
|
+
"arguments": {
|
|
124
|
+
"poolId": "0x...",
|
|
125
|
+
"positionId": "0x...",
|
|
126
|
+
"direction": "LONG",
|
|
127
|
+
"orderType": "MARKET",
|
|
128
|
+
"collateralAmount": "ALL",
|
|
129
|
+
"size": "ALL",
|
|
130
|
+
"price": "2200",
|
|
131
|
+
"timeInForce": 0,
|
|
132
|
+
"postOnly": false,
|
|
133
|
+
"slippagePct": "50",
|
|
134
|
+
"executionFeeToken": "0x...",
|
|
135
|
+
"leverage": 5
|
|
136
|
+
}
|
|
45
137
|
}
|
|
46
138
|
```
|
|
47
139
|
|
|
48
140
|
### `manage_tp_sl`
|
|
49
|
-
|
|
141
|
+
Create or update TP/SL on an open position.
|
|
142
|
+
|
|
50
143
|
```json
|
|
51
144
|
{
|
|
52
145
|
"name": "manage_tp_sl",
|
|
53
146
|
"arguments": {
|
|
54
|
-
"poolId": "
|
|
55
|
-
"positionId": "
|
|
147
|
+
"poolId": "0x...",
|
|
148
|
+
"positionId": "0x...",
|
|
149
|
+
"direction": "LONG",
|
|
56
150
|
"leverage": 5,
|
|
57
|
-
"tpPrice": "
|
|
58
|
-
"slPrice": "
|
|
151
|
+
"tpPrice": "2800",
|
|
152
|
+
"slPrice": "2300"
|
|
59
153
|
}
|
|
60
154
|
}
|
|
61
155
|
```
|
|
62
156
|
|
|
63
|
-
Delete both TP/SL
|
|
157
|
+
Delete both TP/SL orders:
|
|
158
|
+
|
|
64
159
|
```json
|
|
65
160
|
{
|
|
66
161
|
"name": "manage_tp_sl",
|
|
67
162
|
"arguments": {
|
|
68
|
-
"poolId": "
|
|
69
|
-
"positionId": "
|
|
163
|
+
"poolId": "0x...",
|
|
164
|
+
"positionId": "0x...",
|
|
70
165
|
"tpPrice": "0",
|
|
71
166
|
"slPrice": "0"
|
|
72
167
|
}
|
|
73
168
|
}
|
|
74
169
|
```
|
|
75
170
|
|
|
76
|
-
|
|
171
|
+
### `cancel_orders`
|
|
172
|
+
Supports single-order, pool-wide, or account-wide cancellation.
|
|
77
173
|
|
|
78
|
-
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"name": "cancel_orders",
|
|
177
|
+
"arguments": { "orderIds": ["123", "124"] }
|
|
178
|
+
}
|
|
179
|
+
```
|
|
79
180
|
|
|
80
|
-
### `find_pool`
|
|
81
|
-
Keyword or symbol based discovery.
|
|
82
181
|
```json
|
|
83
182
|
{
|
|
84
|
-
"name": "
|
|
85
|
-
"arguments": { "
|
|
183
|
+
"name": "cancel_orders",
|
|
184
|
+
"arguments": { "poolId": "0x..." }
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"name": "cancel_orders",
|
|
191
|
+
"arguments": { "cancelAll": true }
|
|
86
192
|
}
|
|
87
193
|
```
|
|
88
194
|
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Market Data
|
|
198
|
+
|
|
89
199
|
### `get_price`
|
|
90
|
-
|
|
200
|
+
Read either market or oracle price.
|
|
201
|
+
|
|
91
202
|
```json
|
|
92
203
|
{
|
|
93
204
|
"name": "get_price",
|
|
94
|
-
"arguments": {
|
|
95
|
-
"poolId": "0x...",
|
|
96
|
-
"priceType": "market"
|
|
205
|
+
"arguments": {
|
|
206
|
+
"poolId": "0x...",
|
|
207
|
+
"priceType": "market"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"name": "get_price",
|
|
215
|
+
"arguments": {
|
|
216
|
+
"poolId": "0x...",
|
|
217
|
+
"priceType": "oracle"
|
|
97
218
|
}
|
|
98
219
|
}
|
|
99
220
|
```
|
|
100
221
|
|
|
101
222
|
### `get_pool_metadata`
|
|
102
|
-
|
|
223
|
+
Unified pool detail, config, and liquidity info.
|
|
224
|
+
|
|
103
225
|
```json
|
|
104
226
|
{
|
|
105
227
|
"name": "get_pool_metadata",
|
|
106
|
-
"arguments": {
|
|
228
|
+
"arguments": {
|
|
229
|
+
"poolId": "0x...",
|
|
230
|
+
"includeConfig": true,
|
|
231
|
+
"includeLiquidity": true
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `get_kline`
|
|
237
|
+
Read chart data. Use `limit: 1` for the latest bar.
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"name": "get_kline",
|
|
242
|
+
"arguments": {
|
|
243
|
+
"poolId": "0x...",
|
|
244
|
+
"interval": "1m",
|
|
245
|
+
"limit": 50
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Liquidity
|
|
253
|
+
|
|
254
|
+
### `manage_liquidity`
|
|
255
|
+
Add or remove BASE/QUOTE LP.
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"name": "manage_liquidity",
|
|
260
|
+
"arguments": {
|
|
261
|
+
"poolId": "0x...",
|
|
262
|
+
"poolType": "BASE",
|
|
263
|
+
"action": "deposit",
|
|
264
|
+
"amount": 1000,
|
|
265
|
+
"slippage": 0.01
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Alias-friendly form also works:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"name": "manage_liquidity",
|
|
275
|
+
"arguments": {
|
|
276
|
+
"poolId": "0x...",
|
|
277
|
+
"poolType": "base",
|
|
278
|
+
"action": "add",
|
|
279
|
+
"amount": 1000,
|
|
280
|
+
"slippage": 0.01
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### `get_lp_price`
|
|
286
|
+
Read LP NAV price for BASE or QUOTE side.
|
|
287
|
+
|
|
288
|
+
```json
|
|
289
|
+
{
|
|
290
|
+
"name": "get_lp_price",
|
|
291
|
+
"arguments": {
|
|
292
|
+
"poolId": "0x...",
|
|
293
|
+
"poolType": "QUOTE"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### `get_my_lp_holdings`
|
|
299
|
+
Read current LP balances across pools.
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"name": "get_my_lp_holdings",
|
|
304
|
+
"arguments": {
|
|
305
|
+
"includeZero": false,
|
|
306
|
+
"maxPools": 20
|
|
307
|
+
}
|
|
107
308
|
}
|
|
108
309
|
```
|
|
109
310
|
|
|
110
311
|
---
|
|
111
312
|
|
|
112
|
-
##
|
|
313
|
+
## Account And Monitoring
|
|
113
314
|
|
|
114
315
|
### `get_account_snapshot`
|
|
115
|
-
|
|
316
|
+
Read wallet balance, trading account info, and VIP snapshot.
|
|
317
|
+
|
|
116
318
|
```json
|
|
117
319
|
{
|
|
118
320
|
"name": "get_account_snapshot",
|
|
119
|
-
"arguments": {
|
|
321
|
+
"arguments": {
|
|
322
|
+
"poolId": "0x..."
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### `check_account_ready`
|
|
328
|
+
Pre-check whether collateral is available before trading.
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"name": "check_account_ready",
|
|
333
|
+
"arguments": {
|
|
334
|
+
"poolId": "0x...",
|
|
335
|
+
"collateralAmount": "100"
|
|
336
|
+
}
|
|
120
337
|
}
|
|
121
338
|
```
|
|
122
339
|
|
|
123
340
|
### `get_orders`
|
|
124
|
-
|
|
341
|
+
Read open orders, history, or both.
|
|
342
|
+
|
|
125
343
|
```json
|
|
126
344
|
{
|
|
127
345
|
"name": "get_orders",
|
|
128
|
-
"arguments": {
|
|
129
|
-
"status": "
|
|
130
|
-
"
|
|
346
|
+
"arguments": {
|
|
347
|
+
"status": "OPEN",
|
|
348
|
+
"poolId": "0x...",
|
|
349
|
+
"limit": 20
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Lowercase is also accepted:
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"name": "get_orders",
|
|
359
|
+
"arguments": {
|
|
360
|
+
"status": "open",
|
|
361
|
+
"limit": 20
|
|
131
362
|
}
|
|
132
363
|
}
|
|
133
364
|
```
|
|
134
365
|
|
|
135
366
|
### `get_positions_all`
|
|
136
|
-
|
|
367
|
+
Read open positions, history, or both.
|
|
368
|
+
|
|
137
369
|
```json
|
|
138
370
|
{
|
|
139
371
|
"name": "get_positions_all",
|
|
140
|
-
"arguments": {
|
|
372
|
+
"arguments": {
|
|
373
|
+
"status": "ALL",
|
|
374
|
+
"poolId": "0x...",
|
|
375
|
+
"limit": 20
|
|
376
|
+
}
|
|
141
377
|
}
|
|
142
378
|
```
|
|
143
379
|
|
|
144
380
|
---
|
|
145
381
|
|
|
146
|
-
##
|
|
382
|
+
## Parameter Conventions
|
|
147
383
|
|
|
148
|
-
1.
|
|
149
|
-
2.
|
|
150
|
-
3.
|
|
384
|
+
1. Use `find_pool` before trading if you do not already have a `poolId`.
|
|
385
|
+
2. Human-readable units are allowed on high-level tools, such as `"100"` or `"0.5"`.
|
|
386
|
+
3. Exact on-chain values can be passed with the `raw:` prefix.
|
|
387
|
+
4. Canonical enums are still preferred:
|
|
388
|
+
`OPEN|HISTORY|ALL`, `BASE|QUOTE`, `LONG|SHORT`, `MARKET|LIMIT|STOP`.
|
|
389
|
+
5. The server tolerates common lowercase and alias forms for better AI compatibility.
|
|
@@ -12,12 +12,12 @@ export const tradingGuidePrompt = {
|
|
|
12
12
|
content: {
|
|
13
13
|
type: "text",
|
|
14
14
|
text: `
|
|
15
|
-
# MYX Trading MCP Best Practices (v3.0.
|
|
15
|
+
# MYX Trading MCP Best Practices (v3.0.12)
|
|
16
16
|
|
|
17
17
|
You are an expert crypto trader using the MYX Protocol. To ensure successful execution and safe handling of user funds, follow these patterns:
|
|
18
18
|
|
|
19
19
|
## 1. The Standard Workflow
|
|
20
|
-
1. **Discovery**: Use \`find_pool\` with a keyword (e.g. "BTC") to get the \`poolId\`.
|
|
20
|
+
1. **Discovery**: Use \`search_tools\` if the intent is unclear, then use \`find_pool\` with a keyword (e.g. "BTC") to get the \`poolId\`.
|
|
21
21
|
2. **Context**: Use \`get_account_snapshot\` (with \`poolId\`) to check balances, trading metrics, and VIP tier. Use \`get_price\` for real-time market/oracle prices.
|
|
22
22
|
3. **Pre-check**: Use \`check_account_ready\` to ensure the trading account has enough collateral.
|
|
23
23
|
4. **Execution**: Prefer \`open_position_simple\` for entry. It supports Stop-Loss (\`slPrice\`) and Take-Profit (\`tpPrice\`) in one call.
|
|
@@ -26,10 +26,12 @@ You are an expert crypto trader using the MYX Protocol. To ensure successful exe
|
|
|
26
26
|
|
|
27
27
|
## 2. Parameter Tips
|
|
28
28
|
- **Consolidated Tools**: Many legacy tools have been merged. Always use the high-level versions (e.g., \`get_price\` instead of \`get_market_price\`).
|
|
29
|
+
- **Discovery**: \`search_tools\` understands legacy names like \`get_open_orders\` and intent phrases like \`add base lp\`.
|
|
29
30
|
- **Unit Prefixes**: Prefer \`human:\` for readable amounts (e.g., "100" USDC) and \`raw:\` for exact on-chain units.
|
|
30
31
|
- **Slippage**: Default is 100 (1%). For volatile tokens, consider 200-300 (2-3%).
|
|
31
32
|
- **Fees**: Use \`get_pool_metadata\` to view current fee tiers and pool configuration.
|
|
32
33
|
- **LP Strategy**: Use \`get_my_lp_holdings\` to monitor liquidity positions. Naming follows \`mBASE.QUOTE\` (e.g., \`mBTC.USDC\`).
|
|
34
|
+
- **Enum Tolerance**: The server tolerates common lowercase or alias inputs such as \`open\`, \`base\`, \`buy\`, and \`add\`, but canonical forms are still preferred in documentation.
|
|
33
35
|
|
|
34
36
|
Current Session:
|
|
35
37
|
- Wallet: ${address}
|