@gala-chain/launchpad-mcp-server 1.24.1 → 1.25.0
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 +30 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +3 -3
- package/dist/tools/pools/index.d.ts.map +1 -1
- package/dist/tools/pools/index.js +4 -0
- package/dist/tools/pools/index.js.map +1 -1
- package/dist/tools/pools/onDexPoolCreation.d.ts +6 -0
- package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -0
- package/dist/tools/pools/onDexPoolCreation.js +60 -0
- package/dist/tools/pools/onDexPoolCreation.js.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts +6 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js +54 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -0
- package/package.json +2 -2
- package/docs/AI-AGENT-PATTERNS.md +0 -555
- package/docs/CONSTRAINTS-REFERENCE.md +0 -454
- package/docs/PROMPT-TOOL-MAPPING.md +0 -352
- package/docs/examples/default-values-pattern.md +0 -240
- package/docs/examples/tool-factory-pattern.md +0 -217
- package/jest.config.js +0 -94
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
- package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
- package/src/__tests__/server.test.ts +0 -255
- package/src/constants/mcpToolNames.ts +0 -183
- package/src/index.ts +0 -19
- package/src/prompts/__tests__/promptStructure.test.ts +0 -187
- package/src/prompts/__tests__/registry.test.ts +0 -349
- package/src/prompts/analysis.ts +0 -380
- package/src/prompts/balances.ts +0 -182
- package/src/prompts/create-token.ts +0 -123
- package/src/prompts/creation-utils.ts +0 -103
- package/src/prompts/dex-trading.ts +0 -86
- package/src/prompts/discover-tokens.ts +0 -86
- package/src/prompts/explore-dex-pools.ts +0 -138
- package/src/prompts/index.ts +0 -178
- package/src/prompts/liquidity-positions.ts +0 -237
- package/src/prompts/pools.ts +0 -496
- package/src/prompts/portfolio.ts +0 -208
- package/src/prompts/social.ts +0 -94
- package/src/prompts/trading-calculations.ts +0 -414
- package/src/prompts/trading.ts +0 -160
- package/src/prompts/transfers.ts +0 -97
- package/src/prompts/utility-tools.ts +0 -266
- package/src/prompts/utility.ts +0 -77
- package/src/prompts/utils/handlerHelpers.ts +0 -55
- package/src/prompts/utils/textTemplates.ts +0 -73
- package/src/prompts/utils/workflowTemplates.ts +0 -511
- package/src/schemas/common-schemas.ts +0 -393
- package/src/scripts/test-all-prompts.ts +0 -184
- package/src/server.ts +0 -367
- package/src/tools/__tests__/dex-tools.test.ts +0 -562
- package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
- package/src/tools/balance/index.ts +0 -174
- package/src/tools/creation/index.ts +0 -182
- package/src/tools/dex/fetchAllDexPools.ts +0 -45
- package/src/tools/dex/fetchDexPools.ts +0 -58
- package/src/tools/dex/index.ts +0 -231
- package/src/tools/dex/liquidity-positions.ts +0 -547
- package/src/tools/index.ts +0 -94
- package/src/tools/pools/fetchAllPools.ts +0 -47
- package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
- package/src/tools/pools/fetchPoolDetails.ts +0 -27
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
- package/src/tools/pools/fetchPools.ts +0 -47
- package/src/tools/pools/fetchPriceHistory.ts +0 -124
- package/src/tools/pools/fetchTokenDetails.ts +0 -77
- package/src/tools/pools/index.ts +0 -284
- package/src/tools/social/index.ts +0 -64
- package/src/tools/trading/index.ts +0 -605
- package/src/tools/transfers/index.ts +0 -75
- package/src/tools/utils/clearCache.ts +0 -36
- package/src/tools/utils/createWallet.ts +0 -19
- package/src/tools/utils/explainSdkUsage.ts +0 -1446
- package/src/tools/utils/getAddress.ts +0 -12
- package/src/tools/utils/getCacheInfo.ts +0 -14
- package/src/tools/utils/getConfig.ts +0 -21
- package/src/tools/utils/getEnvironment.ts +0 -17
- package/src/tools/utils/getEthereumAddress.ts +0 -12
- package/src/tools/utils/getUrlByTokenName.ts +0 -12
- package/src/tools/utils/getVersion.ts +0 -25
- package/src/tools/utils/getWallet.ts +0 -25
- package/src/tools/utils/hasWallet.ts +0 -15
- package/src/tools/utils/index.ts +0 -37
- package/src/tools/utils/isTokenGraduated.ts +0 -16
- package/src/tools/utils/setWallet.ts +0 -41
- package/src/tools/utils/switchEnvironment.ts +0 -28
- package/src/types/mcp.ts +0 -72
- package/src/utils/__tests__/validation.test.ts +0 -147
- package/src/utils/constraints.ts +0 -155
- package/src/utils/default-values.ts +0 -208
- package/src/utils/error-handler.ts +0 -69
- package/src/utils/error-templates.ts +0 -273
- package/src/utils/response-formatter.ts +0 -51
- package/src/utils/tool-factory.ts +0 -303
- package/src/utils/tool-registry.ts +0 -296
- package/src/utils/validation.ts +0 -429
- package/tests/wallet-management-integration.test.ts +0 -284
- package/tsconfig.json +0 -23
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
# Prompt-Tool Mapping Reference
|
|
2
|
-
|
|
3
|
-
**Auto-generated documentation mapping MCP prompts (slash commands) to the tools they use.**
|
|
4
|
-
|
|
5
|
-
This reference helps AI agents understand which tools are invoked by each prompt and how they work together.
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
- **Total Prompts**: 14 slash commands
|
|
10
|
-
- **Total Tools**: 47 MCP tools
|
|
11
|
-
- **Categories**: Trading, Portfolio, Analysis
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Trading Prompts
|
|
16
|
-
|
|
17
|
-
### `/analyze-token {tokenName}`
|
|
18
|
-
|
|
19
|
-
**Description**: Comprehensive token analysis including pool details, price metrics, and market data
|
|
20
|
-
|
|
21
|
-
**Tools Used**:
|
|
22
|
-
- `gala_launchpad_fetch_pool_details` - Get pool state and supply metrics
|
|
23
|
-
- `gala_launchpad_fetch_launchpad_token_spot_price` - Calculate USD spot price
|
|
24
|
-
- `gala_launchpad_fetch_token_distribution` - Get holder distribution
|
|
25
|
-
- `gala_launchpad_fetch_token_badges` - Get achievement badges
|
|
26
|
-
|
|
27
|
-
**Workflow**:
|
|
28
|
-
1. Fetches pool details (supply, status, fees)
|
|
29
|
-
2. Calculates current USD spot price
|
|
30
|
-
3. Analyzes holder distribution
|
|
31
|
-
4. Retrieves achievement badges
|
|
32
|
-
5. Compiles comprehensive analysis report
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
### `/buy-tokens {tokenName} {galaAmount}`
|
|
37
|
-
|
|
38
|
-
**Description**: Execute token purchase with automatic slippage protection
|
|
39
|
-
|
|
40
|
-
**Tools Used**:
|
|
41
|
-
- `gala_launchpad_fetch_pool_details` - Verify token exists and is tradeable
|
|
42
|
-
- `gala_launchpad_calculate_buy_amount` - Calculate expected output and fees
|
|
43
|
-
- `gala_launchpad_buy_tokens` - Execute purchase transaction
|
|
44
|
-
- `gala_launchpad_fetch_trades` - Verify transaction completion
|
|
45
|
-
|
|
46
|
-
**Workflow**:
|
|
47
|
-
1. Validates token pool exists
|
|
48
|
-
2. Calculates exact amount with `type: 'native'` (spending GALA)
|
|
49
|
-
3. Extracts `result.amount` for `expectedAmount`
|
|
50
|
-
4. Executes buy with 1% slippage tolerance
|
|
51
|
-
5. Confirms transaction success
|
|
52
|
-
|
|
53
|
-
**Critical Pattern**:
|
|
54
|
-
```typescript
|
|
55
|
-
// ✅ CORRECT - Use calculated amount as expectedAmount
|
|
56
|
-
const calc = await calculateBuyAmount({ tokenName, amount: '100', type: 'native' });
|
|
57
|
-
await buy({ tokenName, amount: '100', expectedAmount: calc.amount, ... });
|
|
58
|
-
|
|
59
|
-
// ❌ WRONG - Using input amount as expectedAmount
|
|
60
|
-
await buy({ tokenName, amount: '100', expectedAmount: '100', ... }); // FAILS!
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
### `/sell-tokens {tokenName} {tokenAmount}`
|
|
66
|
-
|
|
67
|
-
**Description**: Execute token sale with slippage protection
|
|
68
|
-
|
|
69
|
-
**Tools Used**:
|
|
70
|
-
- `gala_launchpad_fetch_token_balance` - Verify sufficient token balance
|
|
71
|
-
- `gala_launchpad_calculate_sell_amount` - Calculate expected GALA output
|
|
72
|
-
- `gala_launchpad_sell_tokens` - Execute sale transaction
|
|
73
|
-
- `gala_launchpad_fetch_trades` - Verify transaction completion
|
|
74
|
-
|
|
75
|
-
**Workflow**:
|
|
76
|
-
1. Checks user has enough tokens to sell
|
|
77
|
-
2. Calculates expected GALA with `type: 'exact'` (selling exact tokens)
|
|
78
|
-
3. Extracts `result.amount` for `expectedAmount`
|
|
79
|
-
4. Executes sell with 1% slippage tolerance
|
|
80
|
-
5. Confirms transaction success
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
### `/graduate-token {tokenName}`
|
|
85
|
-
|
|
86
|
-
**Description**: Graduate bonding curve pool to full DEX trading
|
|
87
|
-
|
|
88
|
-
**Tools Used**:
|
|
89
|
-
- `gala_launchpad_fetch_pool_details` - Check if already graduated
|
|
90
|
-
- `gala_launchpad_calculate_buy_amount_for_graduation` - Calculate remaining cost
|
|
91
|
-
- `gala_launchpad_graduate_token` - Execute graduation (convenience method)
|
|
92
|
-
- `gala_launchpad_fetch_pool_details` - Verify graduation success
|
|
93
|
-
|
|
94
|
-
**Workflow**:
|
|
95
|
-
1. Validates pool is not already graduated
|
|
96
|
-
2. Calculates GALA needed to buy remaining tokens
|
|
97
|
-
3. Executes graduation transaction (auto-calculates internally)
|
|
98
|
-
4. Verifies pool status changed to "Completed"
|
|
99
|
-
|
|
100
|
-
**Note**: `graduateToken()` is a convenience method that combines `calculateBuyAmountForGraduation()` + `buy()` internally.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Portfolio Prompts
|
|
105
|
-
|
|
106
|
-
### `/check-balance {tokenName?}`
|
|
107
|
-
|
|
108
|
-
**Description**: Check GALA and token balances for authenticated wallet
|
|
109
|
-
|
|
110
|
-
**Tools Used**:
|
|
111
|
-
- `gala_launchpad_fetch_gala_balance` - Get GALA balance
|
|
112
|
-
- `gala_launchpad_fetch_token_balance` - Get specific token balance (if tokenName provided)
|
|
113
|
-
- `gala_launchpad_fetch_tokens_held` - Get all held tokens (if no tokenName)
|
|
114
|
-
|
|
115
|
-
**Workflow**:
|
|
116
|
-
1. Always fetches GALA balance
|
|
117
|
-
2. If `tokenName` provided: fetches that specific token balance
|
|
118
|
-
3. If no `tokenName`: fetches all tokens held by user
|
|
119
|
-
4. Displays formatted balance report
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
### `/portfolio`
|
|
124
|
-
|
|
125
|
-
**Description**: Complete portfolio overview with holdings, creations, and values
|
|
126
|
-
|
|
127
|
-
**Tools Used**:
|
|
128
|
-
- `gala_launchpad_fetch_gala_balance` - Get GALA balance
|
|
129
|
-
- `gala_launchpad_fetch_tokens_held` - Get all tokens held
|
|
130
|
-
- `gala_launchpad_fetch_tokens_created` - Get tokens created by user
|
|
131
|
-
- `gala_launchpad_fetch_gala_spot_price` - Get GALA USD price
|
|
132
|
-
- `gala_launchpad_fetch_launchpad_token_spot_price` - Calculate token USD values
|
|
133
|
-
|
|
134
|
-
**Workflow**:
|
|
135
|
-
1. Fetches GALA balance and USD value
|
|
136
|
-
2. Lists all tokens held with balances
|
|
137
|
-
3. Lists all tokens created by user
|
|
138
|
-
4. Calculates total portfolio value in USD
|
|
139
|
-
5. Generates comprehensive portfolio report
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
### `/profile {address?}`
|
|
144
|
-
|
|
145
|
-
**Description**: View user profile with activity statistics
|
|
146
|
-
|
|
147
|
-
**Tools Used**:
|
|
148
|
-
- `gala_launchpad_fetch_profile` - Get profile data
|
|
149
|
-
- `gala_launchpad_fetch_tokens_created` - Count created tokens
|
|
150
|
-
- `gala_launchpad_fetch_trades` - Get recent trade history
|
|
151
|
-
|
|
152
|
-
**Workflow**:
|
|
153
|
-
1. Fetches user profile (name, image, wallet)
|
|
154
|
-
2. Counts tokens created
|
|
155
|
-
3. Retrieves recent trades
|
|
156
|
-
4. Displays profile summary with stats
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
### `/trade-history {tokenName?} {limit?}`
|
|
161
|
-
|
|
162
|
-
**Description**: View trade history with optional filtering
|
|
163
|
-
|
|
164
|
-
**Tools Used**:
|
|
165
|
-
- `gala_launchpad_fetch_trades` - Query trades with filters
|
|
166
|
-
|
|
167
|
-
**Workflow**:
|
|
168
|
-
1. Applies filters (tokenName, limit, sortOrder)
|
|
169
|
-
2. Fetches paginated trade history
|
|
170
|
-
3. Formats trade data (type, amounts, timestamps)
|
|
171
|
-
4. Displays chronological trade list
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Analysis Prompts
|
|
176
|
-
|
|
177
|
-
### `/discover-pools {type?} {limit?}`
|
|
178
|
-
|
|
179
|
-
**Description**: Discover trending and recent token pools
|
|
180
|
-
|
|
181
|
-
**Tools Used**:
|
|
182
|
-
- `gala_launchpad_fetch_pools` - Query pools with filters
|
|
183
|
-
|
|
184
|
-
**Workflow**:
|
|
185
|
-
1. Applies pool type filter (recent, popular, trending)
|
|
186
|
-
2. Sets pagination limits
|
|
187
|
-
3. Fetches pool list
|
|
188
|
-
4. Displays formatted pool data
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
### `/token-metrics {tokenName}`
|
|
193
|
-
|
|
194
|
-
**Description**: Detailed token metrics and performance data
|
|
195
|
-
|
|
196
|
-
**Tools Used**:
|
|
197
|
-
- `gala_launchpad_fetch_pool_details` - Get pool state
|
|
198
|
-
- `gala_launchpad_fetch_token_distribution` - Get holder distribution
|
|
199
|
-
- `gala_launchpad_fetch_volume_data` - Get OHLCV data for charting
|
|
200
|
-
- `gala_launchpad_fetch_token_badges` - Get achievement badges
|
|
201
|
-
|
|
202
|
-
**Workflow**:
|
|
203
|
-
1. Fetches complete pool details
|
|
204
|
-
2. Analyzes token distribution metrics
|
|
205
|
-
3. Retrieves historical volume data
|
|
206
|
-
4. Collects achievement badges
|
|
207
|
-
5. Compiles comprehensive metrics report
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
### `/market-overview {resolution?}`
|
|
212
|
-
|
|
213
|
-
**Description**: Market-wide overview with top pools and activity
|
|
214
|
-
|
|
215
|
-
**Tools Used**:
|
|
216
|
-
- `gala_launchpad_fetch_pools` - Get popular and trending pools
|
|
217
|
-
- `gala_launchpad_fetch_gala_spot_price` - Get current GALA price
|
|
218
|
-
- `gala_launchpad_fetch_volume_data` - Get market-wide volume (if supported)
|
|
219
|
-
|
|
220
|
-
**Workflow**:
|
|
221
|
-
1. Fetches top pools by various metrics
|
|
222
|
-
2. Gets current GALA price
|
|
223
|
-
3. Calculates aggregate market metrics
|
|
224
|
-
4. Displays market summary
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## Tool Categories Reference
|
|
229
|
-
|
|
230
|
-
### Pool Management Tools (13 tools)
|
|
231
|
-
- `gala_launchpad_fetch_pools`
|
|
232
|
-
- `gala_launchpad_fetch_pool_details`
|
|
233
|
-
- `gala_launchpad_fetch_pool_details_for_calculation`
|
|
234
|
-
- `gala_launchpad_fetch_token_distribution`
|
|
235
|
-
- `gala_launchpad_fetch_token_badges`
|
|
236
|
-
- `gala_launchpad_fetch_volume_data`
|
|
237
|
-
- `gala_launchpad_fetch_token_spot_price`
|
|
238
|
-
- `gala_launchpad_fetch_gala_spot_price`
|
|
239
|
-
- `gala_launchpad_fetch_launchpad_token_spot_price`
|
|
240
|
-
- `gala_launchpad_check_token_name`
|
|
241
|
-
- `gala_launchpad_check_token_symbol`
|
|
242
|
-
- `gala_launchpad_resolve_vault_address`
|
|
243
|
-
- `gala_launchpad_resolve_token_class_key`
|
|
244
|
-
|
|
245
|
-
### Trading Tools (9 tools)
|
|
246
|
-
- `gala_launchpad_calculate_buy_amount`
|
|
247
|
-
- `gala_launchpad_calculate_sell_amount`
|
|
248
|
-
- `gala_launchpad_buy_tokens`
|
|
249
|
-
- `gala_launchpad_sell_tokens`
|
|
250
|
-
- `gala_launchpad_fetch_trades`
|
|
251
|
-
- `gala_launchpad_calculate_initial_buy`
|
|
252
|
-
- `gala_launchpad_get_bundler_transaction_result`
|
|
253
|
-
- `gala_launchpad_calculate_buy_amount_for_graduation`
|
|
254
|
-
- `gala_launchpad_graduate_token`
|
|
255
|
-
|
|
256
|
-
### Balance Tools (6 tools)
|
|
257
|
-
- `gala_launchpad_fetch_gala_balance`
|
|
258
|
-
- `gala_launchpad_fetch_token_balance`
|
|
259
|
-
- `gala_launchpad_fetch_tokens_held`
|
|
260
|
-
- `gala_launchpad_fetch_tokens_created`
|
|
261
|
-
- `gala_launchpad_fetch_profile`
|
|
262
|
-
- `gala_launchpad_update_profile`
|
|
263
|
-
|
|
264
|
-
### Creation Tools (4 tools)
|
|
265
|
-
- `gala_launchpad_launch_token`
|
|
266
|
-
- `gala_launchpad_upload_token_image`
|
|
267
|
-
- `gala_launchpad_upload_profile_image`
|
|
268
|
-
- `gala_launchpad_fetch_launch_token_fee`
|
|
269
|
-
|
|
270
|
-
### Social Tools (2 tools)
|
|
271
|
-
- `gala_launchpad_post_comment`
|
|
272
|
-
- `gala_launchpad_fetch_comments`
|
|
273
|
-
|
|
274
|
-
### Transfer Tools (2 tools)
|
|
275
|
-
- `gala_launchpad_transfer_gala`
|
|
276
|
-
- `gala_launchpad_transfer_token`
|
|
277
|
-
|
|
278
|
-
### Utility Tools (6 tools)
|
|
279
|
-
- `gala_launchpad_create_wallet`
|
|
280
|
-
- `gala_launchpad_get_address`
|
|
281
|
-
- `gala_launchpad_get_ethereum_address`
|
|
282
|
-
- `gala_launchpad_get_config`
|
|
283
|
-
- `gala_launchpad_get_url_by_token_name`
|
|
284
|
-
- `gala_launchpad_explain_sdk_usage`
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## Common Patterns
|
|
289
|
-
|
|
290
|
-
### Pattern 1: Token Analysis
|
|
291
|
-
Most prompts start with pool details:
|
|
292
|
-
```
|
|
293
|
-
fetchPoolDetails() → analyze data → fetch related metrics
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Pattern 2: Trading Workflow
|
|
297
|
-
All trading operations follow this pattern:
|
|
298
|
-
```
|
|
299
|
-
calculate*Amount() → extract result.amount → execute trade → verify completion
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### Pattern 3: Portfolio Queries
|
|
303
|
-
Balance queries combine multiple data sources:
|
|
304
|
-
```
|
|
305
|
-
fetch balances + fetch prices → calculate values → format report
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Pattern 4: Validation First
|
|
309
|
-
Creation and trading prompts validate before execution:
|
|
310
|
-
```
|
|
311
|
-
check availability/balance → calculate → execute → verify
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
---
|
|
315
|
-
|
|
316
|
-
## AI Agent Best Practices
|
|
317
|
-
|
|
318
|
-
### ✅ DO
|
|
319
|
-
1. **Always extract `result.amount`** from calculate functions for `expectedAmount`
|
|
320
|
-
2. **Check token exists** before trading (use `fetchPoolDetails`)
|
|
321
|
-
3. **Verify balances** before selling (use `fetchTokenBalance`)
|
|
322
|
-
4. **Use slippage protection** (1% is standard)
|
|
323
|
-
5. **Confirm transactions** with `fetchTrades` after execution
|
|
324
|
-
|
|
325
|
-
### ❌ DON'T
|
|
326
|
-
1. **Never use input amount as `expectedAmount`** - use calculated `result.amount`
|
|
327
|
-
2. **Don't skip validation** - always check token exists and user has balance
|
|
328
|
-
3. **Don't ignore slippage** - transactions may fail without proper tolerance
|
|
329
|
-
4. **Don't assume success** - always verify transaction completion
|
|
330
|
-
5. **Don't hardcode limits** - use MCP_CONSTRAINTS constants
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## Quick Reference Table
|
|
335
|
-
|
|
336
|
-
| Prompt | Primary Tool | Secondary Tools | Category |
|
|
337
|
-
|--------|-------------|-----------------|----------|
|
|
338
|
-
| `/analyze-token` | `fetch_pool_details` | `fetch_*_price`, `fetch_distribution` | Analysis |
|
|
339
|
-
| `/buy-tokens` | `buy_tokens` | `calculate_buy_amount`, `fetch_trades` | Trading |
|
|
340
|
-
| `/sell-tokens` | `sell_tokens` | `calculate_sell_amount`, `fetch_balance` | Trading |
|
|
341
|
-
| `/graduate-token` | `graduate_token` | `fetch_pool_details`, `calculate_*` | Trading |
|
|
342
|
-
| `/check-balance` | `fetch_gala_balance` | `fetch_token_balance`, `fetch_tokens_held` | Portfolio |
|
|
343
|
-
| `/portfolio` | `fetch_tokens_held` | `fetch_gala_balance`, `fetch_*_price` | Portfolio |
|
|
344
|
-
| `/profile` | `fetch_profile` | `fetch_tokens_created`, `fetch_trades` | Portfolio |
|
|
345
|
-
| `/trade-history` | `fetch_trades` | - | Portfolio |
|
|
346
|
-
| `/discover-pools` | `fetch_pools` | - | Analysis |
|
|
347
|
-
| `/token-metrics` | `fetch_pool_details` | `fetch_distribution`, `fetch_volume_data` | Analysis |
|
|
348
|
-
| `/market-overview` | `fetch_pools` | `fetch_gala_spot_price` | Analysis |
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
**Note**: This mapping is auto-generated and reflects the current v1.5.0 implementation. Tool names and relationships may evolve in future versions.
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# Default Values Utilities - Usage Examples
|
|
2
|
-
|
|
3
|
-
Demonstrates how to use `default-values.ts` to eliminate magic numbers and ensure consistency across tool implementations.
|
|
4
|
-
|
|
5
|
-
**See**: `src/utils/default-values.ts`
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Example 1: Pagination Defaults (BEFORE vs AFTER)
|
|
10
|
-
|
|
11
|
-
### ❌ BEFORE: Magic numbers scattered throughout code
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
function fetchPoolsHandlerOLD(args: any) {
|
|
15
|
-
const params = {
|
|
16
|
-
type: args.type || 'recent',
|
|
17
|
-
page: args.page || 1, // Magic number!
|
|
18
|
-
limit: args.limit || 20, // Magic number!
|
|
19
|
-
};
|
|
20
|
-
return params;
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### ✅ AFTER: Using centralized defaults
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
function fetchPoolsHandlerNEW(args: any) {
|
|
28
|
-
const params = applyPaginationDefaults(args);
|
|
29
|
-
return {
|
|
30
|
-
type: args.type || 'recent',
|
|
31
|
-
...params,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Example 2: Operation-Specific Pagination (BEFORE vs AFTER)
|
|
39
|
-
|
|
40
|
-
### ❌ BEFORE: Inconsistent default limits across tools
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
function fetchTradesHandlerOLD(args: any) {
|
|
44
|
-
return {
|
|
45
|
-
page: args.page || 1,
|
|
46
|
-
limit: args.limit || 20, // Is this the right limit for trades?
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function fetchPoolsHandlerOLD2(args: any) {
|
|
51
|
-
return {
|
|
52
|
-
page: args.page || 1,
|
|
53
|
-
limit: args.limit || 100, // Different limit for pools!
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### ✅ AFTER: Operation-specific defaults ensure consistency
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
function fetchTradesHandlerNEW(args: any) {
|
|
62
|
-
return applyOperationPaginationDefaults(args, 'trade');
|
|
63
|
-
// Automatically uses correct limit (20) for trade operations
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function fetchPoolsHandlerNEW2(args: any) {
|
|
67
|
-
return applyOperationPaginationDefaults(args, 'pool');
|
|
68
|
-
// Automatically uses correct limit (20 - not 100) for pool operations
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Example 3: Trading Slippage Defaults (BEFORE vs AFTER)
|
|
75
|
-
|
|
76
|
-
### ❌ BEFORE: Magic number slippage values
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
function buyTokensHandlerOLD(args: any) {
|
|
80
|
-
const slippageTolerance = args.slippageToleranceFactor || 0.01; // Magic!
|
|
81
|
-
const rbcFeeSlippage = args.maxAcceptableReverseBondingCurveFeeSlippageFactor || 0.01; // Magic!
|
|
82
|
-
|
|
83
|
-
return { slippageTolerance, rbcFeeSlippage };
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### ✅ AFTER: Using centralized slippage defaults
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
function buyTokensHandlerNEW(args: any) {
|
|
91
|
-
const params = applySlippageDefaults(args);
|
|
92
|
-
return params;
|
|
93
|
-
// Automatically includes both slippage values with correct defaults
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Example 4: Volume Resolution (BEFORE vs AFTER)
|
|
100
|
-
|
|
101
|
-
### ❌ BEFORE: Duplicate resolution mapping in every tool
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
function fetchVolumeDataHandlerOLD(args: any) {
|
|
105
|
-
const resolutionMap: Record<string, number> = {
|
|
106
|
-
'1m': 60,
|
|
107
|
-
'5m': 300,
|
|
108
|
-
'15m': 900,
|
|
109
|
-
'1h': 3600, // Duplicate mapping!
|
|
110
|
-
'4h': 14400,
|
|
111
|
-
'1d': 86400,
|
|
112
|
-
};
|
|
113
|
-
const resolutionSeconds = resolutionMap[args.resolution || '1h'];
|
|
114
|
-
|
|
115
|
-
return { resolution: resolutionSeconds };
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### ✅ AFTER: Using centralized resolution mapping
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
function fetchVolumeDataHandlerNEW(args: any) {
|
|
123
|
-
const resolutionSeconds = resolutionToSeconds(args.resolution, DEFAULT_VOLUME_RESOLUTION);
|
|
124
|
-
|
|
125
|
-
return { resolution: resolutionSeconds };
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Example 5: Date Conversion (BEFORE vs AFTER)
|
|
132
|
-
|
|
133
|
-
### ❌ BEFORE: Duplicate date conversion logic
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
function fetchVolumeDataHandlerOLD2(args: any) {
|
|
137
|
-
const fromTimestamp = args.from
|
|
138
|
-
? Math.floor(new Date(args.from).getTime() / 1000) // Duplicate logic!
|
|
139
|
-
: undefined;
|
|
140
|
-
const toTimestamp = args.to
|
|
141
|
-
? Math.floor(new Date(args.to).getTime() / 1000) // Duplicate logic!
|
|
142
|
-
: undefined;
|
|
143
|
-
|
|
144
|
-
return { from: fromTimestamp, to: toTimestamp };
|
|
145
|
-
}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### ✅ AFTER: Using centralized date conversion
|
|
149
|
-
|
|
150
|
-
```typescript
|
|
151
|
-
function fetchVolumeDataHandlerNEW2(args: any) {
|
|
152
|
-
return {
|
|
153
|
-
from: dateToUnixTimestamp(args.from),
|
|
154
|
-
to: dateToUnixTimestamp(args.to),
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Example 6: Complete Tool Handler (BEFORE vs AFTER)
|
|
162
|
-
|
|
163
|
-
### ❌ BEFORE: All magic numbers and duplicate logic (15 lines)
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
async function completeToolHandlerOLD(sdk: any, args: any) {
|
|
167
|
-
const page = args.page || 1;
|
|
168
|
-
const limit = args.limit || 20;
|
|
169
|
-
const slippageTolerance = args.slippageToleranceFactor || 0.01;
|
|
170
|
-
const rbcFeeSlippage = args.maxAcceptableReverseBondingCurveFeeSlippageFactor || 0.01;
|
|
171
|
-
|
|
172
|
-
const params = {
|
|
173
|
-
page,
|
|
174
|
-
limit,
|
|
175
|
-
slippageTolerance,
|
|
176
|
-
rbcFeeSlippage,
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
return sdk.someMethod(params);
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### ✅ AFTER: Clean, centralized defaults (6 lines - 60% reduction)
|
|
184
|
-
|
|
185
|
-
```typescript
|
|
186
|
-
async function completeToolHandlerNEW(sdk: any, args: any) {
|
|
187
|
-
const params = {
|
|
188
|
-
...applyPaginationDefaults(args),
|
|
189
|
-
...applySlippageDefaults(args),
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
return sdk.someMethod(params);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## Summary Statistics
|
|
199
|
-
|
|
200
|
-
### IMPACT ANALYSIS:
|
|
201
|
-
|
|
202
|
-
**Benefits:**
|
|
203
|
-
- ✅ Eliminates ~50+ instances of magic numbers (1, 20, 0.01, etc.)
|
|
204
|
-
- ✅ Ensures consistency: All tools use same default values
|
|
205
|
-
- ✅ Single source of truth: Change defaults in one place
|
|
206
|
-
- ✅ Type safety: TypeScript ensures correct parameter types
|
|
207
|
-
- ✅ Reduces code: 40-60% fewer lines in tool handlers
|
|
208
|
-
|
|
209
|
-
**Before:**
|
|
210
|
-
- 15 tools with `page: args.page || 1`
|
|
211
|
-
- 15 tools with `limit: args.limit || 20`
|
|
212
|
-
- 9 tools with slippage defaults
|
|
213
|
-
- 2 tools with resolution mapping
|
|
214
|
-
- Total: ~150 lines of duplicate default handling
|
|
215
|
-
|
|
216
|
-
**After:**
|
|
217
|
-
- All defaults centralized in default-values.ts
|
|
218
|
-
- Tools use utility functions
|
|
219
|
-
- Total saved: ~100 lines of duplicate code
|
|
220
|
-
- Improved maintainability: Change defaults once, applies everywhere
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## USAGE GUIDELINES:
|
|
225
|
-
|
|
226
|
-
### 1. Pagination defaults:
|
|
227
|
-
- Use `applyPaginationDefaults(args)` for generic pagination
|
|
228
|
-
- Use `applyOperationPaginationDefaults(args, 'pool')` for operation-specific
|
|
229
|
-
|
|
230
|
-
### 2. Trading defaults:
|
|
231
|
-
- Use `applySlippageDefaults(args)` for buy/sell tools
|
|
232
|
-
- Automatically applies both slippage tolerance and RBC fee slippage
|
|
233
|
-
|
|
234
|
-
### 3. Volume data:
|
|
235
|
-
- Use `resolutionToSeconds(args.resolution)` for resolution conversion
|
|
236
|
-
- Use `dateToUnixTimestamp(args.from)` for date conversion
|
|
237
|
-
|
|
238
|
-
### 4. Constants:
|
|
239
|
-
- Import constants from `defaultValues` object for direct access
|
|
240
|
-
- Example: `DEFAULT_PAGINATION`, `DEFAULT_SLIPPAGE_TOLERANCE`
|