@gala-chain/launchpad-mcp-server 1.7.2 → 1.7.4

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +40 -4
  2. package/docs/AI-AGENT-PATTERNS.md +555 -0
  3. package/docs/CONSTRAINTS-REFERENCE.md +454 -0
  4. package/docs/PROMPT-TOOL-MAPPING.md +352 -0
  5. package/docs/examples/default-values-pattern.md +240 -0
  6. package/docs/examples/tool-factory-pattern.md +217 -0
  7. package/jest.config.js +94 -0
  8. package/package.json +2 -2
  9. package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
  10. package/src/constants/mcpToolNames.ts +141 -0
  11. package/src/index.ts +19 -0
  12. package/src/prompts/__tests__/promptStructure.test.ts +114 -0
  13. package/src/prompts/__tests__/registry.test.ts +143 -0
  14. package/src/prompts/analysis.ts +429 -0
  15. package/src/prompts/index.ts +123 -0
  16. package/src/prompts/portfolio.ts +242 -0
  17. package/src/prompts/trading.ts +191 -0
  18. package/src/prompts/utils/workflowTemplates.ts +344 -0
  19. package/src/schemas/common-schemas.ts +392 -0
  20. package/src/scripts/test-all-prompts.ts +184 -0
  21. package/src/server.ts +241 -0
  22. package/src/tools/balance/index.ts +174 -0
  23. package/src/tools/creation/index.ts +182 -0
  24. package/src/tools/index.ts +80 -0
  25. package/src/tools/pools/fetchAllPools.ts +47 -0
  26. package/src/tools/pools/fetchPoolDetails.ts +27 -0
  27. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
  28. package/src/tools/pools/fetchPools.ts +47 -0
  29. package/src/tools/pools/index.ts +240 -0
  30. package/src/tools/social/index.ts +64 -0
  31. package/src/tools/trading/index.ts +605 -0
  32. package/src/tools/transfers/index.ts +75 -0
  33. package/src/tools/utils/clearCache.ts +36 -0
  34. package/src/tools/utils/createWallet.ts +19 -0
  35. package/src/tools/utils/explainSdkUsage.ts +765 -0
  36. package/src/tools/utils/getAddress.ts +12 -0
  37. package/src/tools/utils/getCacheInfo.ts +14 -0
  38. package/src/tools/utils/getConfig.ts +11 -0
  39. package/src/tools/utils/getEthereumAddress.ts +12 -0
  40. package/src/tools/utils/getUrlByTokenName.ts +12 -0
  41. package/src/tools/utils/index.ts +25 -0
  42. package/src/tools/utils/isTokenGraduated.ts +16 -0
  43. package/src/types/mcp.ts +72 -0
  44. package/src/utils/__tests__/validation.test.ts +147 -0
  45. package/src/utils/constraints.ts +146 -0
  46. package/src/utils/default-values.ts +208 -0
  47. package/src/utils/error-handler.ts +69 -0
  48. package/src/utils/error-templates.ts +273 -0
  49. package/src/utils/response-formatter.ts +51 -0
  50. package/src/utils/tool-factory.ts +257 -0
  51. package/src/utils/tool-registry.ts +296 -0
  52. package/src/utils/validation.ts +336 -0
  53. package/tsconfig.json +23 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix demo script failures caused by missing tokenName field in poolDetails response.
8
+
9
+ **Root Causes:**
10
+ - GalaChainService response transformation broke property access after Phase 2 type safety changes
11
+ - fetchPoolDetails didn't include tokenName field that demo code expects
12
+
13
+ **Changes:**
14
+ - Add tokenName field to fetchPoolDetails return value for convenience
15
+ - Fix GalaChainService response transformation to preserve structure using type assertion patterns
16
+ - Maintain type safety throughout with proper TypeScript patterns
17
+
18
+ **Impact:**
19
+ - Resolves 9 failing demo scenarios with "Token name is required" validation errors
20
+ - All calculation methods (calculateBuyAmountLocal, calculateSellAmountLocal, calculateBuyAmount)
21
+ now work correctly
22
+ - Demo script runs without validation errors
23
+
24
+ - Updated dependencies
25
+ - @gala-chain/launchpad-sdk@3.11.3
26
+
27
+ ## 1.7.3
28
+
29
+ ### Patch Changes
30
+
31
+ - chore: Update SDK dependency to 3.11.2
32
+
3
33
  ## 1.7.1 - 2025-10-11
4
34
 
5
35
  ### Fixed
@@ -23,7 +53,10 @@
23
53
 
24
54
  ### Context
25
55
 
26
- v1.7.0 was published with incorrect tool counts due to not accounting for cache management tools added in v1.6.0. The registry validation expected 49 tools but 50 were actually registered, causing the MCP server to crash on startup with "Tool registry validation failed: Tool count mismatch: expected 49, got 50".
56
+ v1.7.0 was published with incorrect tool counts due to not accounting for cache management tools
57
+ added in v1.6.0. The registry validation expected 49 tools but 50 were actually registered, causing
58
+ the MCP server to crash on startup with "Tool registry validation failed: Tool count mismatch:
59
+ expected 49, got 50".
27
60
 
28
61
  ## 1.7.0 - 2025-10-11
29
62
 
@@ -44,7 +77,8 @@ v1.7.0 was published with incorrect tool counts due to not accounting for cache
44
77
  ### Changed
45
78
 
46
79
  - Updated SDK dependency from ^3.10.0 to ^3.11.0
47
- - Tool count increased from 49 to 50 tools (NOTE: v1.6.0 added 2 cache tools, bringing count from 47 to 49)
80
+ - Tool count increased from 49 to 50 tools (NOTE: v1.6.0 added 2 cache tools, bringing count from 47
81
+ to 49)
48
82
  - Pool Management tools increased from 13 to 14 tools
49
83
  - Benefits from SDK v3.11.0 auto-pagination with 5x performance improvement
50
84
 
@@ -66,10 +100,12 @@ v1.7.0 was published with incorrect tool counts due to not accounting for cache
66
100
 
67
101
  ### Documentation
68
102
 
69
- - **Critical graduation calculation clarification** - Added comprehensive documentation to prevent misinterpretation of `calculateBuyAmountForGraduation` results
103
+ - **Critical graduation calculation clarification** - Added comprehensive documentation to prevent
104
+ misinterpretation of `calculateBuyAmountForGraduation` results
70
105
  - Updated MCP README with "Understanding Graduation Calculations" section
71
106
  - Added amount field reference table showing what each calculation method returns
72
- - Clarified that `amount` field represents **GALA cost** (e.g., "1594263.419" = 1.59 million GALA), NOT token quantity
107
+ - Clarified that `amount` field represents **GALA cost** (e.g., "1594263.419" = 1.59 million
108
+ GALA), NOT token quantity
73
109
  - Added real-world examples showing wrong vs correct interpretation
74
110
  - Updated CLAUDE.md with "Token Graduation Patterns" section and complete workflow examples
75
111
  - Emphasized that graduation amounts are typically hundreds of thousands to millions of GALA
@@ -0,0 +1,555 @@
1
+ # AI Agent Patterns for Gala Launchpad MCP Server
2
+
3
+ This guide provides AI agents with common workflows, gotchas, and best practices when using the `galachain-launchpad` MCP server.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Common Workflows](#common-workflows)
8
+ - [Critical Gotchas](#critical-gotchas)
9
+ - [Constraint Reference](#constraint-reference)
10
+ - [Error Troubleshooting](#error-troubleshooting)
11
+ - [Best Practices](#best-practices)
12
+
13
+ ---
14
+
15
+ ## Common Workflows
16
+
17
+ ### 1. Token Launch Workflow
18
+
19
+ **Complete token creation from scratch:**
20
+
21
+ ```typescript
22
+ // Step 1: Verify token name is available
23
+ gala_launchpad_check_token_name({
24
+ tokenName: 'mytoken'
25
+ })
26
+ // Response: { available: true, message: "Token name is available" }
27
+
28
+ // Step 2: Verify token symbol is available
29
+ gala_launchpad_check_token_symbol({
30
+ symbol: 'MTK'
31
+ })
32
+ // Response: { available: true, message: "Token symbol is available" }
33
+
34
+ // Step 3: Upload token image (optional, can use URL instead)
35
+ gala_launchpad_upload_token_image({
36
+ tokenName: 'mytoken',
37
+ imagePath: '/absolute/path/to/image.png'
38
+ })
39
+ // Response: { url: 'https://launchpad.galachain.com/uploads/mytoken.png' }
40
+
41
+ // Step 4: Launch the token
42
+ gala_launchpad_launch_token({
43
+ tokenName: 'mytoken',
44
+ tokenSymbol: 'MTK',
45
+ tokenDescription: 'My awesome token for the community',
46
+ tokenImage: 'https://launchpad.galachain.com/uploads/mytoken.png',
47
+ preBuyQuantity: '100', // Optional initial buy
48
+ websiteUrl: 'https://mytoken.com',
49
+ twitterUrl: 'https://twitter.com/mytoken'
50
+ })
51
+ // Response: { tokenName: 'mytoken', transactionId: '...' }
52
+
53
+ // Step 5: Get the frontend URL
54
+ gala_launchpad_get_url_by_token_name({
55
+ tokenName: 'mytoken'
56
+ })
57
+ // Response: { url: 'https://launchpad.galachain.com/token/mytoken' }
58
+ ```
59
+
60
+ ### 2. Trading Workflow (Buy Tokens)
61
+
62
+ **Two-step process: Calculate → Execute**
63
+
64
+ ```typescript
65
+ // Step 1: Calculate buy amount (REQUIRED FIRST STEP)
66
+ const calcResult = gala_launchpad_calculate_buy_amount({
67
+ tokenName: 'woohoo',
68
+ amount: '10', // Spending 10 GALA
69
+ type: 'native' // 'native' = GALA amount
70
+ })
71
+ // Response: {
72
+ // amount: '16843.7579794843252', // <- THIS is expectedAmount for buy()
73
+ // reverseBondingCurveFee: '0.059280156', // <- THIS is maxAcceptableReverseBondingCurveFee
74
+ // transactionFee: '0.00141090',
75
+ // gasFee: '1'
76
+ // }
77
+
78
+ // Step 2: Execute buy with calculated expectedAmount AND reverseBondingCurveFee
79
+ gala_launchpad_buy_tokens({
80
+ tokenName: 'woohoo',
81
+ amount: '10', // Same as Step 1
82
+ type: 'native', // Same as Step 1
83
+ expectedAmount: '16843.7579794843252', // <- Use result.amount from Step 1
84
+ maxAcceptableReverseBondingCurveFee: '0.059280156', // <- Use result.reverseBondingCurveFee from Step 1
85
+ slippageToleranceFactor: 0.05 // 5% slippage protection
86
+ })
87
+ // Response: { transactionId: '...', status: 'completed' }
88
+
89
+ // Step 3: Verify trade completed
90
+ gala_launchpad_fetch_trades({
91
+ tokenName: 'woohoo',
92
+ userAddress: 'eth|your-address',
93
+ limit: 1
94
+ })
95
+ ```
96
+
97
+ **⚠️ CRITICAL:**
98
+ - `expectedAmount` must be `result.amount` from calculate function, NOT your input amount!
99
+ - `maxAcceptableReverseBondingCurveFee` must be `result.reverseBondingCurveFee` from calculate function!
100
+
101
+ ### 3. Trading Workflow (Sell Tokens)
102
+
103
+ **Same two-step pattern:**
104
+
105
+ ```typescript
106
+ // Step 1: Calculate sell amount
107
+ const calcResult = gala_launchpad_calculate_sell_amount({
108
+ tokenName: 'woohoo',
109
+ amount: '1000', // Selling 1000 tokens
110
+ type: 'exact' // 'exact' = exact token amount
111
+ })
112
+ // Response: {
113
+ // amount: '5.234567', // <- THIS is expectedAmount for sell()
114
+ // reverseBondingCurveFee: '2.617284', // <- THIS is maxAcceptableReverseBondingCurveFee
115
+ // transactionFee: '0.00523457',
116
+ // gasFee: '1'
117
+ // }
118
+
119
+ // Step 2: Execute sell with calculated expectedAmount AND reverseBondingCurveFee
120
+ gala_launchpad_sell_tokens({
121
+ tokenName: 'woohoo',
122
+ amount: '1000',
123
+ type: 'exact',
124
+ expectedAmount: '5.234567', // <- Use result.amount from Step 1
125
+ maxAcceptableReverseBondingCurveFee: '2.617284', // <- Use result.reverseBondingCurveFee from Step 1
126
+ slippageToleranceFactor: 0.05
127
+ })
128
+ ```
129
+
130
+ ### 4. Portfolio Management Workflow
131
+
132
+ **Check balances and trading activity:**
133
+
134
+ ```typescript
135
+ // Get GALA balance
136
+ gala_launchpad_fetch_gala_balance({
137
+ address: 'eth|your-address' // Optional, defaults to authenticated wallet
138
+ })
139
+
140
+ // Get specific token balance (optimized single-token lookup)
141
+ gala_launchpad_fetch_token_balance({
142
+ tokenName: 'woohoo',
143
+ address: 'eth|your-address'
144
+ })
145
+
146
+ // Get all tokens held (with filtering)
147
+ gala_launchpad_fetch_tokens_held({
148
+ address: 'eth|your-address',
149
+ tokenName: 'woohoo', // Optional exact match filter
150
+ limit: 20 // Max 20 for user operations
151
+ })
152
+
153
+ // Get all tokens created by user
154
+ gala_launchpad_fetch_tokens_created({
155
+ address: 'eth|your-address',
156
+ search: 'test', // Optional fuzzy search filter
157
+ limit: 20
158
+ })
159
+
160
+ // Get trade history
161
+ gala_launchpad_fetch_trades({
162
+ tokenName: 'woohoo',
163
+ userAddress: 'eth|your-address',
164
+ tradeType: 'BUY', // Optional: 'BUY' or 'SELL'
165
+ limit: 20, // Max 20 for trade operations
166
+ sortOrder: 'DESC'
167
+ })
168
+ ```
169
+
170
+ ### 5. Pool Analysis Workflow
171
+
172
+ **Discover and analyze token pools:**
173
+
174
+ ```typescript
175
+ // Fetch recent/trending pools
176
+ gala_launchpad_fetch_pools({
177
+ type: 'trending', // 'recent', 'trending', or 'user'
178
+ limit: 100 // Max 100 for pool operations
179
+ })
180
+
181
+ // Get detailed pool state
182
+ gala_launchpad_fetch_pool_details({
183
+ tokenName: 'woohoo'
184
+ })
185
+
186
+ // Get holder distribution
187
+ gala_launchpad_fetch_token_distribution({
188
+ tokenName: 'woohoo'
189
+ })
190
+
191
+ // Get volume data for charting
192
+ gala_launchpad_fetch_volume_data({
193
+ tokenName: 'woohoo',
194
+ resolution: '1h', // '1m', '5m', '15m', '1h', '4h', '1d'
195
+ from: '2024-01-01T00:00:00Z',
196
+ to: '2024-01-31T23:59:59Z'
197
+ })
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Critical Gotchas
203
+
204
+ ### Gotcha #1: Missing reverseBondingCurveFee Parameter ⚠️🔥
205
+
206
+ **Problem:** AI agents forget to pass `maxAcceptableReverseBondingCurveFee`, causing transaction failures.
207
+
208
+ **Wrong:**
209
+ ```typescript
210
+ // Step 1: Calculate
211
+ const calc = gala_launchpad_calculate_sell_amount({ tokenName: 'anime', amount: '500', type: 'exact' })
212
+ // calc = { amount: '0.7056532', reverseBondingCurveFee: '0.3528266', ... }
213
+
214
+ // Step 2: Execute - MISSING reverseBondingCurveFee!
215
+ gala_launchpad_sell_tokens({
216
+ tokenName: 'anime',
217
+ amount: '500',
218
+ type: 'exact',
219
+ expectedAmount: '0.7056532', // ✅ Got this right
220
+ // ❌ MISSING: maxAcceptableReverseBondingCurveFee
221
+ slippageToleranceFactor: 0.05
222
+ })
223
+ // Result: Transaction fails with "FAILED" status
224
+ ```
225
+
226
+ **Correct:**
227
+ ```typescript
228
+ // Step 1: Calculate
229
+ const calc = gala_launchpad_calculate_sell_amount({ tokenName: 'anime', amount: '500', type: 'exact' })
230
+ // calc = { amount: '0.7056532', reverseBondingCurveFee: '0.3528266', ... }
231
+
232
+ // Step 2: Execute - Include BOTH parameters from calculation
233
+ gala_launchpad_sell_tokens({
234
+ tokenName: 'anime',
235
+ amount: '500',
236
+ type: 'exact',
237
+ expectedAmount: '0.7056532', // ✅ From result.amount
238
+ maxAcceptableReverseBondingCurveFee: '0.3528266', // ✅ From result.reverseBondingCurveFee
239
+ slippageToleranceFactor: 0.05
240
+ })
241
+ // Result: Transaction succeeds!
242
+ ```
243
+
244
+ **Fix:** Always extract BOTH `result.amount` AND `result.reverseBondingCurveFee` from calculate functions, then pass BOTH to buy/sell.
245
+
246
+ **This applies to both buy AND sell operations!**
247
+
248
+ ### Gotcha #2: expectedAmount Parameter Confusion ⚠️
249
+
250
+ **Problem:** AI agents use the input `amount` as `expectedAmount`, causing WebSocket timeouts.
251
+
252
+ **Wrong:**
253
+ ```typescript
254
+ gala_launchpad_buy_tokens({
255
+ amount: '10',
256
+ expectedAmount: '10' // ❌ WRONG - This is your input, not the expected output!
257
+ })
258
+ ```
259
+
260
+ **Correct:**
261
+ ```typescript
262
+ // Step 1: Calculate first
263
+ const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
264
+ // calc.amount = '16843.7579794843252'
265
+
266
+ // Step 2: Use calc.amount as expectedAmount
267
+ gala_launchpad_buy_tokens({
268
+ amount: '10',
269
+ expectedAmount: '16843.7579794843252' // ✅ CORRECT - Use result.amount
270
+ })
271
+ ```
272
+
273
+ **Fix:** Always call `calculate*Amount()` first, then use `result.amount` as `expectedAmount`.
274
+
275
+ ### Gotcha #3: Limit Validation Errors
276
+
277
+ **Problem:** AI agents hit "Limit must be between 1 and 20" errors when using `limit: 100`.
278
+
279
+ **Root Cause:** Different operations have different maximum limits:
280
+ - Trade operations: Max 20
281
+ - User operations (tokens held/created): Max 20
282
+ - Pool operations: Max 100
283
+ - Comment operations: Max 50
284
+
285
+ **Wrong:**
286
+ ```typescript
287
+ gala_launchpad_fetch_trades({
288
+ limit: 100 // ❌ WRONG - Trades max is 20!
289
+ })
290
+ ```
291
+
292
+ **Correct:**
293
+ ```typescript
294
+ gala_launchpad_fetch_trades({
295
+ limit: 20 // ✅ CORRECT - Respects constraint
296
+ })
297
+
298
+ gala_launchpad_fetch_pools({
299
+ limit: 100 // ✅ CORRECT - Pools allow 100
300
+ })
301
+ ```
302
+
303
+ **Fix:** Use the constraint reference table below for correct limits.
304
+
305
+ ### Gotcha #4: Type Parameter Ambiguity
306
+
307
+ **Problem:** Confusion between `type: 'native'` and `type: 'exact'`.
308
+
309
+ **When to use 'native' (GALA amount):**
310
+ - "I want to spend 10 GALA" → `{ amount: '10', type: 'native' }`
311
+ - "I want to receive 5 GALA" → `{ amount: '5', type: 'native' }`
312
+
313
+ **When to use 'exact' (exact token amount):**
314
+ - "I want to buy exactly 1000 tokens" → `{ amount: '1000', type: 'exact' }`
315
+ - "I want to sell exactly 500 tokens" → `{ amount: '500', type: 'exact' }`
316
+
317
+ **Most Common:** Use `'native'` when you know the GALA amount.
318
+
319
+ ### Gotcha #5: Token Filtering Confusion
320
+
321
+ **Problem:** Not using the right filter for the task.
322
+
323
+ **Use `tokenName` for exact lookups:**
324
+ ```typescript
325
+ gala_launchpad_fetch_tokens_held({
326
+ tokenName: 'anime', // Exact match
327
+ limit: 1 // Only need 1 result
328
+ })
329
+ ```
330
+
331
+ **Use `search` for discovery:**
332
+ ```typescript
333
+ gala_launchpad_fetch_tokens_held({
334
+ search: 'dragon', // Fuzzy search
335
+ limit: 10 // Get multiple matches
336
+ })
337
+ ```
338
+
339
+ **Don't mix both:** If you provide both, `tokenName` takes precedence.
340
+
341
+ ### Gotcha #6: Wallet Address Format
342
+
343
+ **Problem:** Wrong wallet address format causes validation errors.
344
+
345
+ **Backend Format (for API):**
346
+ - ✅ `'eth|abc123...'` - Prefixed format
347
+ - ❌ `'0xabc123...'` - Standard Ethereum format
348
+
349
+ **Conversion Pattern:**
350
+ ```typescript
351
+ // From standard to backend format
352
+ const backendAddress = address.startsWith('0x')
353
+ ? `eth|${address.slice(2)}`
354
+ : address
355
+
356
+ // From backend to standard format
357
+ const standardAddress = address.startsWith('eth|')
358
+ ? `0x${address.slice(4)}`
359
+ : address
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Constraint Reference
365
+
366
+ ### Pagination Limits by Operation Type
367
+
368
+ | Operation Type | Max Limit | SDK Source |
369
+ |---------------|-----------|------------|
370
+ | **Trade Operations** | 20 | `TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
371
+ | `fetchTrades` | 20 | packages/sdk/src/types/trade.dto.ts:331 |
372
+ | **User Operations** | 20 | `USER_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
373
+ | `fetchTokensHeld` | 20 | packages/sdk/src/types/user.dto.ts:297 |
374
+ | `fetchTokensCreated` | 20 | packages/sdk/src/types/user.dto.ts:297 |
375
+ | **Pool Operations** | 100 | `PAGINATION_CONSTRAINTS.MAX_LIMIT` |
376
+ | `fetchPools` | 100 | packages/sdk/src/types/launchpad.dto.ts:587 |
377
+ | **Comment Operations** | 50 | `COMMENT_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
378
+ | `fetchComments` | 50 | packages/sdk/src/types/comment.dto.ts:149 |
379
+
380
+ ### Common Validation Rules
381
+
382
+ | Parameter | Pattern | Example |
383
+ |-----------|---------|---------|
384
+ | `tokenName` | `^[a-z0-9_-]{2,20}$` | `'mytoken'`, `'test_token'` |
385
+ | `tokenSymbol` | `^[A-Z0-9]{2,10}$` | `'MTK'`, `'TEST123'` |
386
+ | `address` | `^(0x[a-fA-F0-9]{40}\|eth\\|[a-fA-F0-9]{40})$` | `'eth\|abc123...'`, `'0xabc123...'` (auto-normalized) |
387
+ | `amount` | `^[0-9.]+$` | `'10'`, `'100.5'` |
388
+ | `slippageTolerance` | `0-1` (decimal) | `0.05` (5%), `0.01` (1%) |
389
+
390
+ ---
391
+
392
+ ## Error Troubleshooting
393
+
394
+ ### "Limit must be a number between 1 and 20"
395
+
396
+ **Cause:** Using `limit: 100` on trade or user operations.
397
+
398
+ **Solution:**
399
+ ```typescript
400
+ // Wrong
401
+ gala_launchpad_fetch_trades({ limit: 100 })
402
+
403
+ // Correct
404
+ gala_launchpad_fetch_trades({ limit: 20 })
405
+ ```
406
+
407
+ ### "WebSocket timeout on trade execution"
408
+
409
+ **Cause:** Using wrong `expectedAmount` (likely using input amount instead of calculated result).
410
+
411
+ **Solution:**
412
+ ```typescript
413
+ // Wrong
414
+ const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
415
+ gala_launchpad_buy_tokens({ amount: '10', expectedAmount: '10' })
416
+
417
+ // Correct
418
+ const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
419
+ gala_launchpad_buy_tokens({ amount: '10', expectedAmount: calc.amount })
420
+ ```
421
+
422
+ ### "Token name validation failed"
423
+
424
+ **Cause:** Token name doesn't match pattern `^[a-z0-9_-]{2,20}$`.
425
+
426
+ **Valid:** `'mytoken'`, `'test-token'`, `'token_123'`
427
+ **Invalid:** `'MyToken'` (uppercase), `'a'` (too short), `'my token'` (space)
428
+
429
+ **Solution:** Use lowercase alphanumeric with dashes/underscores, 2-20 characters.
430
+
431
+ ### "Token symbol validation failed"
432
+
433
+ **Cause:** Token symbol doesn't match pattern `^[A-Z0-9]{2,10}$`.
434
+
435
+ **Valid:** `'MTK'`, `'TEST123'`, `'ABC'`
436
+ **Invalid:** `'mtk'` (lowercase), `'A'` (too short), `'MY-TOKEN'` (dash)
437
+
438
+ **Solution:** Use uppercase alphanumeric only, 2-10 characters.
439
+
440
+ ### "At least one social URL required"
441
+
442
+ **Cause:** Launching token without `websiteUrl`, `twitterUrl`, or `telegramUrl`.
443
+
444
+ **Solution:** Provide at least one social link:
445
+ ```typescript
446
+ gala_launchpad_launch_token({
447
+ // ... other params
448
+ websiteUrl: 'https://mytoken.com' // At least one required
449
+ })
450
+ ```
451
+
452
+ ---
453
+
454
+ ## Best Practices
455
+
456
+ ### 1. Always Calculate Before Trading
457
+
458
+ Never skip the calculate step - it provides:
459
+ - Accurate `expectedAmount` for slippage protection
460
+ - Fee breakdown for transparency
461
+ - Price impact analysis for informed decisions
462
+
463
+ ### 2. Use Appropriate Limits
464
+
465
+ Match your `limit` to the operation type:
466
+ - Trades/User operations: Use 20 or less
467
+ - Pools: Can use up to 100
468
+ - Comments: Can use up to 50
469
+
470
+ ### 3. Handle Slippage Appropriately
471
+
472
+ Common slippage tolerance factors:
473
+ - `0.01` (1%) - Low volatility, stable pools
474
+ - `0.05` (5%) - Standard for most trades
475
+ - `0.10` (10%) - High volatility, new tokens
476
+
477
+ ### 4. Use Token Filtering Efficiently
478
+
479
+ **For single token lookups:**
480
+ ```typescript
481
+ gala_launchpad_fetch_token_balance({
482
+ tokenName: 'anime',
483
+ address: 'eth|...'
484
+ })
485
+ // 99% payload reduction vs fetching all tokens
486
+ ```
487
+
488
+ **For discovery:**
489
+ ```typescript
490
+ gala_launchpad_fetch_tokens_held({
491
+ search: 'dragon',
492
+ limit: 10
493
+ })
494
+ ```
495
+
496
+ ### 5. Verify Trades Complete
497
+
498
+ After executing trades, always verify:
499
+ ```typescript
500
+ gala_launchpad_fetch_trades({
501
+ tokenName: 'woohoo',
502
+ userAddress: 'eth|...',
503
+ limit: 1,
504
+ sortOrder: 'DESC'
505
+ })
506
+ ```
507
+
508
+ ### 6. Check Availability Before Launch
509
+
510
+ Always verify token name and symbol availability before launching:
511
+ ```typescript
512
+ // Step 1: Check name
513
+ gala_launchpad_check_token_name({ tokenName: 'mytoken' })
514
+
515
+ // Step 2: Check symbol
516
+ gala_launchpad_check_token_symbol({ symbol: 'MTK' })
517
+
518
+ // Step 3: Launch if both available
519
+ gala_launchpad_launch_token({ ... })
520
+ ```
521
+
522
+ ---
523
+
524
+ ## Quick Reference Card
525
+
526
+ ### Trading Flow
527
+ 1. `calculate_buy_amount()` or `calculate_sell_amount()`
528
+ 2. Extract `result.amount` from response
529
+ 3. Use `result.amount` as `expectedAmount` in buy/sell
530
+ 4. Verify with `fetch_trades()`
531
+
532
+ ### Limit Values
533
+ - Trades: 20 max
534
+ - User ops: 20 max
535
+ - Pools: 100 max
536
+ - Comments: 50 max
537
+
538
+ ### Type Parameter
539
+ - `'native'` = GALA amount (most common)
540
+ - `'token'` = Exact token amount
541
+
542
+ ### Token Filtering
543
+ - `tokenName` = Exact match (faster)
544
+ - `search` = Fuzzy match (discovery)
545
+
546
+ ### Address Format
547
+ - API expects: `'eth|abc123...'`
548
+ - Convert from: `'0xabc123...'`
549
+
550
+ ---
551
+
552
+ **For more details, see:**
553
+ - [MCP Server README](../README.md)
554
+ - [SDK Documentation](../../sdk/README.md)
555
+ - [Constraints Reference](./CONSTRAINTS-REFERENCE.md)