@gala-chain/launchpad-mcp-server 1.23.0 → 1.24.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/DRY_REFACTORING_GUIDE.md +272 -0
  3. package/README.md +34 -6
  4. package/dist/constants/mcpToolNames.d.ts +6 -2
  5. package/dist/constants/mcpToolNames.d.ts.map +1 -1
  6. package/dist/constants/mcpToolNames.js +4 -2
  7. package/dist/constants/mcpToolNames.js.map +1 -1
  8. package/dist/generated/version.d.ts +1 -1
  9. package/dist/generated/version.js +1 -1
  10. package/dist/prompts/analysis.d.ts.map +1 -1
  11. package/dist/prompts/analysis.js +14 -63
  12. package/dist/prompts/analysis.js.map +1 -1
  13. package/dist/prompts/balances.d.ts.map +1 -1
  14. package/dist/prompts/balances.js +46 -70
  15. package/dist/prompts/balances.js.map +1 -1
  16. package/dist/prompts/creation-utils.d.ts.map +1 -1
  17. package/dist/prompts/creation-utils.js +27 -50
  18. package/dist/prompts/creation-utils.js.map +1 -1
  19. package/dist/prompts/explore-dex-pools.d.ts +20 -0
  20. package/dist/prompts/explore-dex-pools.d.ts.map +1 -0
  21. package/dist/prompts/explore-dex-pools.js +132 -0
  22. package/dist/prompts/explore-dex-pools.js.map +1 -0
  23. package/dist/prompts/index.d.ts +3 -2
  24. package/dist/prompts/index.d.ts.map +1 -1
  25. package/dist/prompts/index.js +6 -3
  26. package/dist/prompts/index.js.map +1 -1
  27. package/dist/prompts/liquidity-positions.d.ts.map +1 -1
  28. package/dist/prompts/liquidity-positions.js +9 -44
  29. package/dist/prompts/liquidity-positions.js.map +1 -1
  30. package/dist/prompts/pools.d.ts.map +1 -1
  31. package/dist/prompts/pools.js +125 -228
  32. package/dist/prompts/pools.js.map +1 -1
  33. package/dist/prompts/portfolio.d.ts.map +1 -1
  34. package/dist/prompts/portfolio.js +13 -48
  35. package/dist/prompts/portfolio.js.map +1 -1
  36. package/dist/prompts/social.d.ts.map +1 -1
  37. package/dist/prompts/social.js +21 -31
  38. package/dist/prompts/social.js.map +1 -1
  39. package/dist/prompts/trading-calculations.d.ts.map +1 -1
  40. package/dist/prompts/trading-calculations.js +37 -126
  41. package/dist/prompts/trading-calculations.js.map +1 -1
  42. package/dist/prompts/trading.d.ts.map +1 -1
  43. package/dist/prompts/trading.js +23 -60
  44. package/dist/prompts/trading.js.map +1 -1
  45. package/dist/prompts/transfers.d.ts.map +1 -1
  46. package/dist/prompts/transfers.js +21 -31
  47. package/dist/prompts/transfers.js.map +1 -1
  48. package/dist/prompts/utility-tools.d.ts.map +1 -1
  49. package/dist/prompts/utility-tools.js +83 -202
  50. package/dist/prompts/utility-tools.js.map +1 -1
  51. package/dist/prompts/utility.d.ts.map +1 -1
  52. package/dist/prompts/utility.js +5 -20
  53. package/dist/prompts/utility.js.map +1 -1
  54. package/dist/prompts/utils/handlerHelpers.d.ts +35 -0
  55. package/dist/prompts/utils/handlerHelpers.d.ts.map +1 -0
  56. package/dist/prompts/utils/handlerHelpers.js +53 -0
  57. package/dist/prompts/utils/handlerHelpers.js.map +1 -0
  58. package/dist/prompts/utils/textTemplates.d.ts +42 -0
  59. package/dist/prompts/utils/textTemplates.d.ts.map +1 -0
  60. package/dist/prompts/utils/textTemplates.js +51 -0
  61. package/dist/prompts/utils/textTemplates.js.map +1 -0
  62. package/dist/tools/dex/fetchAllDexPools.d.ts +9 -0
  63. package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -0
  64. package/dist/tools/dex/fetchAllDexPools.js +45 -0
  65. package/dist/tools/dex/fetchAllDexPools.js.map +1 -0
  66. package/dist/tools/dex/fetchDexPools.d.ts +9 -0
  67. package/dist/tools/dex/fetchDexPools.d.ts.map +1 -0
  68. package/dist/tools/dex/fetchDexPools.js +58 -0
  69. package/dist/tools/dex/fetchDexPools.js.map +1 -0
  70. package/dist/tools/dex/index.d.ts +4 -3
  71. package/dist/tools/dex/index.d.ts.map +1 -1
  72. package/dist/tools/dex/index.js +9 -4
  73. package/dist/tools/dex/index.js.map +1 -1
  74. package/dist/utils/validation.d.ts +38 -0
  75. package/dist/utils/validation.d.ts.map +1 -1
  76. package/dist/utils/validation.js +52 -0
  77. package/dist/utils/validation.js.map +1 -1
  78. package/package.json +3 -3
  79. package/src/__tests__/server.test.ts +1 -2
  80. package/src/constants/mcpToolNames.ts +4 -2
  81. package/src/prompts/__tests__/promptStructure.test.ts +50 -0
  82. package/src/prompts/__tests__/registry.test.ts +23 -33
  83. package/src/prompts/analysis.ts +15 -64
  84. package/src/prompts/balances.ts +57 -73
  85. package/src/prompts/creation-utils.ts +34 -49
  86. package/src/prompts/explore-dex-pools.ts +138 -0
  87. package/src/prompts/index.ts +5 -2
  88. package/src/prompts/liquidity-positions.ts +11 -44
  89. package/src/prompts/pools.ts +156 -231
  90. package/src/prompts/portfolio.ts +13 -47
  91. package/src/prompts/social.ts +25 -31
  92. package/src/prompts/trading-calculations.ts +42 -127
  93. package/src/prompts/trading.ts +30 -61
  94. package/src/prompts/transfers.ts +25 -31
  95. package/src/prompts/utility-tools.ts +116 -199
  96. package/src/prompts/utility.ts +5 -20
  97. package/src/prompts/utils/handlerHelpers.ts +55 -0
  98. package/src/prompts/utils/textTemplates.ts +73 -0
  99. package/src/tools/dex/fetchAllDexPools.ts +45 -0
  100. package/src/tools/dex/fetchDexPools.ts +58 -0
  101. package/src/tools/dex/index.ts +9 -4
  102. package/src/utils/validation.ts +58 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gala-chain/launchpad-mcp-server",
3
- "version": "1.23.0",
4
- "description": "MCP server for Gala Launchpad - 62 tools (pool management, GSwap DEX trading, price history, token creation, wallet management) supporting optional wallet (read-only and full-access modes). Production-grade AI agent integration for Claude Desktop with comprehensive validation and 80%+ test coverage",
3
+ "version": "1.24.0",
4
+ "description": "MCP server for Gala Launchpad - 74 tools (pool management, GSwap DEX trading, price history, token creation, wallet management, DEX pool discovery) supporting optional wallet (read-only and full-access modes). Production-grade AI agent integration for Claude Desktop with comprehensive validation and 80%+ test coverage",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
7
  "gala-launchpad-mcp": "./dist/index.js"
@@ -73,7 +73,7 @@
73
73
  "dependencies": {
74
74
  "@gala-chain/api": "^2.4.3",
75
75
  "@gala-chain/connect": "^2.4.3",
76
- "@gala-chain/launchpad-sdk": "^3.27.3",
76
+ "@gala-chain/launchpad-sdk": "^3.28.0",
77
77
  "@modelcontextprotocol/sdk": "^0.5.0",
78
78
  "axios": "^1.12.2",
79
79
  "bignumber.js": "^9.1.2",
@@ -120,7 +120,6 @@ describe('LaunchpadMCPServer', () => {
120
120
  describe('Error Handling Contract', () => {
121
121
  it('should maintain server state on switch failure', () => {
122
122
  const originalEnv = 'production';
123
- const failedNewEnv = 'development';
124
123
 
125
124
  // Simulates switch failure leaving original state intact
126
125
  const finalEnv = originalEnv;
@@ -187,7 +186,7 @@ describe('LaunchpadMCPServer', () => {
187
186
  return { result: server?.getEnvironment?.() };
188
187
  };
189
188
 
190
- const handlerWithoutServer: ToolHandler = async (sdk, args) => {
189
+ const handlerWithoutServer: ToolHandler = async (_sdk, _args) => {
191
190
  return { result: 'ok' };
192
191
  };
193
192
 
@@ -5,7 +5,7 @@
5
5
  * Use these constants instead of hardcoded strings to prevent typos
6
6
  * and enable IDE autocomplete.
7
7
  *
8
- * Total: 72 tools across 9 categories
8
+ * Total: 74 tools across 9 categories (added 2 new DEX pool discovery tools)
9
9
  */
10
10
 
11
11
  /**
@@ -110,9 +110,11 @@ export const UTILITY_TOOLS = {
110
110
  } as const;
111
111
 
112
112
  /**
113
- * DEX Trading Tools (5 tools)
113
+ * DEX Trading & Pool Discovery Tools (7 tools)
114
114
  */
115
115
  export const DEX_TOOLS = {
116
+ FETCH_DEX_POOLS: 'gala_launchpad_fetch_dex_pools',
117
+ FETCH_ALL_DEX_POOLS: 'gala_launchpad_fetch_all_dex_pools',
116
118
  GET_SWAP_QUOTE_EXACT_INPUT: 'gala_launchpad_get_swap_quote_exact_input',
117
119
  GET_SWAP_QUOTE_EXACT_OUTPUT: 'gala_launchpad_get_swap_quote_exact_output',
118
120
  EXECUTE_SWAP: 'gala_launchpad_execute_swap',
@@ -50,6 +50,56 @@ describe('Prompt Structure', () => {
50
50
  if (promptName.includes('collect-fees')) {
51
51
  return { positionId: 'position-123' };
52
52
  }
53
+ // Pool prompts requiring tokenName
54
+ if (promptName.includes('token-distribution') ||
55
+ promptName.includes('token-badges') ||
56
+ promptName.includes('volume-data') ||
57
+ promptName.includes('token-spot-price') ||
58
+ promptName.includes('check-token-name') ||
59
+ promptName.includes('resolve-vault-address') ||
60
+ promptName.includes('resolve-token-class-key') ||
61
+ promptName.includes('upload-token-image') ||
62
+ promptName.includes('post-comment') ||
63
+ promptName.includes('fetch-comments')) {
64
+ return { tokenName: 'anime' };
65
+ }
66
+ // Trading calculation prompts
67
+ if (promptName.includes('calculate-buy-amount') ||
68
+ promptName.includes('calculate-sell-amount') ||
69
+ promptName.includes('calculate-graduation-cost') ||
70
+ promptName.includes('is-token-graduated')) {
71
+ return { tokenName: 'anime', amount: '100' };
72
+ }
73
+ if (promptName.includes('calculate-initial-buy')) {
74
+ return { tokenName: 'anime', amount: '100', priceUsd: '1.0' };
75
+ }
76
+ // Balance prompts
77
+ if (promptName.includes('token-balance') || promptName.includes('tokens-created')) {
78
+ return { address: 'eth|0x1234567890123456789012345678901234567890', tokenName: 'anime' };
79
+ }
80
+ // Transfer prompts
81
+ if (promptName.includes('transfer-gala')) {
82
+ return { recipientAddress: 'eth|0x1234567890123456789012345678901234567890', amount: '100' };
83
+ }
84
+ if (promptName.includes('transfer-token')) {
85
+ return { to: 'eth|0x1234567890123456789012345678901234567890', tokenName: 'anime', amount: '100' };
86
+ }
87
+ // Wallet prompts
88
+ if (promptName.includes('set-wallet')) {
89
+ return { privateKey: '0x1234567890123456789012345678901234567890123456789012345678901234' };
90
+ }
91
+ if (promptName.includes('get-url-by-token-name')) {
92
+ return { tokenName: 'anime' };
93
+ }
94
+ if (promptName.includes('explain-sdk-usage')) {
95
+ return { topic: 'buy-tokens' };
96
+ }
97
+ if (promptName.includes('fetch-price-history') || promptName.includes('fetch-all-price-history')) {
98
+ return { tokenId: 'Token|Unit|GUSDC|eth:0x1234567890123456789012345678901234567890' };
99
+ }
100
+ if (promptName.includes('fetch-token-details')) {
101
+ return { tokenId: 'Token|Unit|GUSDC|eth:0x1234567890123456789012345678901234567890' };
102
+ }
53
103
  return {}; // For prompts with no required args (portfolio, balance, my-positions, version, etc.)
54
104
  }
55
105
 
@@ -16,15 +16,15 @@ import {
16
16
 
17
17
  describe('Prompt Registry', () => {
18
18
  describe('prompts array', () => {
19
- it('should contain exactly 72 prompts (1:1 tool-to-command mapping)', () => {
20
- expect(prompts).toHaveLength(72);
19
+ it('should contain exactly 74 prompts (1:1 tool-to-command mapping)', () => {
20
+ expect(prompts).toHaveLength(74);
21
21
  });
22
22
 
23
23
  it('should have all unique prompt names', () => {
24
24
  const names = prompts.map((p) => p.name);
25
25
  const uniqueNames = new Set(names);
26
26
  expect(uniqueNames.size).toBe(names.length);
27
- expect(uniqueNames.size).toBe(72);
27
+ expect(uniqueNames.size).toBe(74);
28
28
  });
29
29
 
30
30
  it('should have all prompts with galachain-launchpad prefix', () => {
@@ -180,9 +180,9 @@ describe('Prompt Registry', () => {
180
180
  });
181
181
 
182
182
  describe('getPromptNames()', () => {
183
- it('should return array of 72 prompt names', () => {
183
+ it('should return array of 74 prompt names', () => {
184
184
  const names = getPromptNames();
185
- expect(names).toHaveLength(72);
185
+ expect(names).toHaveLength(74);
186
186
  });
187
187
 
188
188
  it('should contain all original 24 prompts', () => {
@@ -219,9 +219,9 @@ describe('Prompt Registry', () => {
219
219
  });
220
220
  });
221
221
 
222
- it('should contain 48 new prompts for complete 1:1 mapping', () => {
222
+ it('should contain all pool management and trading prompts', () => {
223
223
  const names = getPromptNames();
224
- const newPrompts = [
224
+ const poolManagementPrompts = [
225
225
  // Pool management (14)
226
226
  'galachain-launchpad:fetch-pools',
227
227
  'galachain-launchpad:fetch-pool-details-for-calculation',
@@ -253,32 +253,18 @@ describe('Prompt Registry', () => {
253
253
  'galachain-launchpad:fetch-token-balance',
254
254
  'galachain-launchpad:fetch-tokens-created',
255
255
  'galachain-launchpad:update-profile',
256
- // Creation utilities (2)
257
- 'galachain-launchpad:upload-profile-image',
258
- 'galachain-launchpad:fetch-launch-token-fee',
259
256
  // Social (2)
260
257
  'galachain-launchpad:post-comment',
261
258
  'galachain-launchpad:fetch-comments',
262
259
  // Transfers (2)
263
260
  'galachain-launchpad:transfer-gala',
264
261
  'galachain-launchpad:transfer-token',
265
- // Utility tools (13)
266
- 'galachain-launchpad:create-wallet',
267
- 'galachain-launchpad:get-address',
268
- 'galachain-launchpad:get-ethereum-address',
269
- 'galachain-launchpad:get-config',
270
- 'galachain-launchpad:get-url-by-token-name',
271
- 'galachain-launchpad:explain-sdk-usage',
272
- 'galachain-launchpad:get-cache-info',
273
- 'galachain-launchpad:clear-cache',
274
- 'galachain-launchpad:has-wallet',
275
- 'galachain-launchpad:get-wallet',
276
- 'galachain-launchpad:set-wallet',
277
- 'galachain-launchpad:get-environment',
262
+ // DEX Pool Discovery (2) - NEW
263
+ 'galachain-launchpad:fetch-dex-pools',
264
+ 'galachain-launchpad:fetch-all-dex-pools',
278
265
  ];
279
266
 
280
- expect(newPrompts).toHaveLength(48);
281
- newPrompts.forEach((name) => {
267
+ poolManagementPrompts.forEach((name) => {
282
268
  expect(names).toContain(name);
283
269
  });
284
270
  });
@@ -320,14 +306,15 @@ describe('Prompt Registry', () => {
320
306
  expect(analysis).toHaveLength(6);
321
307
  });
322
308
 
323
- it('should return creation prompts (1 original + 2 new = 3)', () => {
309
+ it('should return creation prompts (1 - create-token)', () => {
324
310
  const creation = getPromptsByCategory('creation');
325
- expect(creation).toHaveLength(3);
311
+ expect(creation).toHaveLength(1);
312
+ expect(creation[0]?.name).toBe('galachain-launchpad:create-token');
326
313
  });
327
314
 
328
- it('should return discovery prompts (1)', () => {
315
+ it('should return discovery prompts (1 original + 2 new = 3)', () => {
329
316
  const discovery = getPromptsByCategory('discovery');
330
- expect(discovery).toHaveLength(1);
317
+ expect(discovery).toHaveLength(3);
331
318
  });
332
319
 
333
320
  it('should return dex trading prompts (1)', () => {
@@ -340,9 +327,12 @@ describe('Prompt Registry', () => {
340
327
  expect(liquidity).toHaveLength(4);
341
328
  });
342
329
 
343
- it('should return utility prompts (2 original + 12 new = 14)', () => {
330
+ it('should return utility prompts (version + switch-environment)', () => {
344
331
  const utility = getPromptsByCategory('utility');
345
- expect(utility).toHaveLength(14);
332
+ expect(utility).toHaveLength(2);
333
+ const utilityNames = utility.map(u => u.name);
334
+ expect(utilityNames).toContain('galachain-launchpad:version');
335
+ expect(utilityNames).toContain('galachain-launchpad:switch-environment');
346
336
  });
347
337
 
348
338
  it('should return empty array for invalid category', () => {
@@ -352,8 +342,8 @@ describe('Prompt Registry', () => {
352
342
  });
353
343
 
354
344
  describe('getPromptCount()', () => {
355
- it('should return 72 (1:1 tool-to-command mapping)', () => {
356
- expect(getPromptCount()).toBe(72);
345
+ it('should return 74 (1:1 tool-to-command mapping)', () => {
346
+ expect(getPromptCount()).toBe(74);
357
347
  });
358
348
  });
359
349
  });
@@ -6,7 +6,8 @@
6
6
 
7
7
  import type { MCPPrompt } from '../types/mcp.js';
8
8
  import { MCP_TOOLS } from '../constants/mcpToolNames.js';
9
- import { validateTokenName, validateTokenList, validatePaginationLimit } from '../utils/validation.js';
9
+ import { validateTokenName, validateTokenList, validateOptionalLimit } from '../utils/validation.js';
10
+ import { createPromptResponse } from './utils/handlerHelpers.js';
10
11
 
11
12
  /**
12
13
  * Compare Tokens - Side-by-side comparison
@@ -31,12 +32,7 @@ export const compareTokensPrompt: MCPPrompt = {
31
32
  validateTokenName(args.token1, 'token1');
32
33
  validateTokenName(args.token2, 'token2');
33
34
 
34
- return [
35
- {
36
- role: 'user',
37
- content: {
38
- type: 'text',
39
- text: `Compare two Launchpad tokens side-by-side:
35
+ return createPromptResponse(`Compare two Launchpad tokens side-by-side:
40
36
 
41
37
  Token 1: ${args.token1}
42
38
  Token 2: ${args.token2}
@@ -72,10 +68,7 @@ Provide analysis:
72
68
  - Which token is closer to graduation?
73
69
  - Which has better liquidity?
74
70
  - Which might be a better investment and why?
75
- - Any notable badges or achievements?`,
76
- },
77
- },
78
- ];
71
+ - Any notable badges or achievements?`);
79
72
  },
80
73
  };
81
74
 
@@ -96,12 +89,7 @@ export const graduationStatusPrompt: MCPPrompt = {
96
89
  // Validate inputs
97
90
  const tokenArray = validateTokenList(args.tokens);
98
91
 
99
- return [
100
- {
101
- role: 'user',
102
- content: {
103
- type: 'text',
104
- text: `Check graduation status for multiple tokens:
92
+ return createPromptResponse(`Check graduation status for multiple tokens:
105
93
 
106
94
  Tokens: ${args.tokens}
107
95
 
@@ -131,10 +119,7 @@ Summary:
131
119
 
132
120
  Provide recommendations:
133
121
  - Which tokens are good graduation opportunities?
134
- - Which tokens might be undervalued?`,
135
- },
136
- },
137
- ];
122
+ - Which tokens might be undervalued?`);
138
123
  },
139
124
  };
140
125
 
@@ -155,12 +140,7 @@ export const spotPricesPrompt: MCPPrompt = {
155
140
  // Validate inputs
156
141
  validateTokenList(args.tokens);
157
142
 
158
- return [
159
- {
160
- role: 'user',
161
- content: {
162
- type: 'text',
163
- text: `Get spot prices for multiple Launchpad tokens:
143
+ return createPromptResponse(`Get spot prices for multiple Launchpad tokens:
164
144
 
165
145
  Tokens: ${args.tokens}
166
146
 
@@ -182,10 +162,7 @@ Present results:
182
162
 
183
163
  Performance note: Using LOCAL calculations - instant results with <0.01% difference from external!
184
164
 
185
- Sort by USD price (highest to lowest).`,
186
- },
187
- },
188
- ];
165
+ Sort by USD price (highest to lowest).`);
189
166
  },
190
167
  };
191
168
 
@@ -206,12 +183,7 @@ export const poolDetailsPrompt: MCPPrompt = {
206
183
  // Validate inputs
207
184
  validateTokenName(args.tokenName);
208
185
 
209
- return [
210
- {
211
- role: 'user',
212
- content: {
213
- type: 'text',
214
- text: `Get comprehensive pool information for "${args.tokenName}":
186
+ return createPromptResponse(`Get comprehensive pool information for "${args.tokenName}":
215
187
 
216
188
  1. Full pool details: ${MCP_TOOLS.FETCH_POOL_DETAILS}
217
189
  2. Token distribution: ${MCP_TOOLS.FETCH_TOKEN_DISTRIBUTION}
@@ -252,10 +224,7 @@ Display organized sections:
252
224
  **Reverse Bonding Curve:**
253
225
  - Max fee factor
254
226
  - Min fee factor
255
- - Current fee structure`,
256
- },
257
- },
258
- ];
227
+ - Current fee structure`);
259
228
  },
260
229
  };
261
230
 
@@ -292,21 +261,14 @@ export const tradeHistoryPrompt: MCPPrompt = {
292
261
  if (args.tokenName) {
293
262
  validateTokenName(args.tokenName);
294
263
  }
295
- if (args.limit) {
296
- validatePaginationLimit(args.limit, 20);
297
- }
264
+ validateOptionalLimit(args.limit, 20);
298
265
  if (args.tradeType && args.tradeType !== 'BUY' && args.tradeType !== 'SELL') {
299
266
  throw new Error('tradeType must be either BUY or SELL');
300
267
  }
301
268
 
302
269
  const limit = args.limit || '20';
303
270
 
304
- return [
305
- {
306
- role: 'user',
307
- content: {
308
- type: 'text',
309
- text: `Show recent trade history:
271
+ return createPromptResponse(`Show recent trade history:
310
272
 
311
273
  ${args.tokenName ? `Token: ${args.tokenName}` : 'All tokens'}
312
274
  ${args.userAddress ? `User: ${args.userAddress}` : 'All users'}
@@ -333,10 +295,7 @@ Calculate summary:
333
295
  - Total trades shown
334
296
  - Total volume (GALA)
335
297
  - Average trade size
336
- - Buy vs Sell ratio (if not filtered)`,
337
- },
338
- },
339
- ];
298
+ - Buy vs Sell ratio (if not filtered)`);
340
299
  },
341
300
  };
342
301
 
@@ -369,12 +328,7 @@ export const fetchAllPoolsPrompt: MCPPrompt = {
369
328
  : '- No search filter';
370
329
  const typeFilter = args.type ? args.type : 'recent';
371
330
 
372
- return [
373
- {
374
- role: 'user',
375
- content: {
376
- type: 'text',
377
- text: `Fetch ALL available Launchpad pools with automatic pagination:
331
+ return createPromptResponse(`Fetch ALL available Launchpad pools with automatic pagination:
378
332
 
379
333
  Use ${MCP_TOOLS.FETCH_ALL_POOLS} with:
380
334
  ${searchFilter}
@@ -409,10 +363,7 @@ Performance note:
409
363
  - Automatic cache warming for token metadata
410
364
  - Much faster than manual pagination!
411
365
 
412
- Sort pools by creation date (newest first) or progress (closest to graduation first).`,
413
- },
414
- },
415
- ];
366
+ Sort pools by creation date (newest first) or progress (closest to graduation first).`);
416
367
  },
417
368
  };
418
369
 
@@ -6,7 +6,9 @@
6
6
 
7
7
  import type { MCPPrompt } from '../types/mcp.js';
8
8
  import { MCP_TOOLS } from '../constants/mcpToolNames.js';
9
- import { validateAddress } from '../utils/validation.js';
9
+ import { validateAddress, validateOptionalAddress } from '../utils/validation.js';
10
+ import { createPromptResponse } from './utils/handlerHelpers.js';
11
+ import { createSimpleOperationText } from './utils/textTemplates.js';
10
12
 
11
13
  /**
12
14
  * Fetch GALA Balance - GALA balance query
@@ -22,25 +24,19 @@ export const fetchGalaBalancePrompt: MCPPrompt = {
22
24
  },
23
25
  ],
24
26
  handler: (args) => {
25
- if (args.address) {
26
- validateAddress(args.address);
27
- }
28
-
29
- return [
30
- {
31
- role: 'user',
32
- content: {
33
- type: 'text',
34
- text: `Get GALA balance for wallet.
35
-
36
- ${args.address ? `Address: ${args.address}` : 'Using default wallet'}
37
-
38
- Use ${MCP_TOOLS.FETCH_GALA_BALANCE} to retrieve the GALA balance.
39
-
40
- Display the balance in a clear format.`,
41
- },
42
- },
43
- ];
27
+ validateOptionalAddress(args.address);
28
+
29
+ return createPromptResponse(
30
+ createSimpleOperationText({
31
+ operation: 'Get GALA balance for wallet.',
32
+ parameters: args.address
33
+ ? { address: `Address: ${args.address}` }
34
+ : { wallet: 'Using default wallet' },
35
+ toolName: MCP_TOOLS.FETCH_GALA_BALANCE,
36
+ actionDescription: 'retrieve the GALA balance',
37
+ displayFormat: 'Display the balance in a clear format.',
38
+ })
39
+ );
44
40
  },
45
41
  };
46
42
 
@@ -65,22 +61,18 @@ export const fetchTokenBalancePrompt: MCPPrompt = {
65
61
  handler: (args) => {
66
62
  validateAddress(args.address);
67
63
 
68
- return [
69
- {
70
- role: 'user',
71
- content: {
72
- type: 'text',
73
- text: `Get balance for specific token.
74
-
75
- Token: ${args.tokenName}
76
- Address: ${args.address}
77
-
78
- Use ${MCP_TOOLS.FETCH_TOKEN_BALANCE} to retrieve the token balance.
79
-
80
- Display the balance with token details.`,
64
+ return createPromptResponse(
65
+ createSimpleOperationText({
66
+ operation: 'Get balance for specific token.',
67
+ parameters: {
68
+ token: `Token: ${args.tokenName}`,
69
+ address: `Address: ${args.address}`,
81
70
  },
82
- },
83
- ];
71
+ toolName: MCP_TOOLS.FETCH_TOKEN_BALANCE,
72
+ actionDescription: 'retrieve the token balance',
73
+ displayFormat: 'Display the balance with token details.',
74
+ })
75
+ );
84
76
  },
85
77
  };
86
78
 
@@ -120,25 +112,21 @@ export const fetchTokensCreatedPrompt: MCPPrompt = {
120
112
  handler: (args) => {
121
113
  validateAddress(args.address);
122
114
 
123
- return [
124
- {
125
- role: 'user',
126
- content: {
127
- type: 'text',
128
- text: `Get tokens created by wallet.
129
-
130
- Address: ${args.address}
131
- Page: ${args.page || 1}
132
- Limit: ${args.limit || 20}
133
- ${args.tokenName ? `Token Name Filter: ${args.tokenName}` : ''}
134
- ${args.search ? `Search Filter: ${args.search}` : ''}
135
-
136
- Use ${MCP_TOOLS.FETCH_TOKENS_CREATED} to retrieve created tokens.
137
-
138
- Display the list of tokens created by this wallet.`,
115
+ return createPromptResponse(
116
+ createSimpleOperationText({
117
+ operation: 'Get tokens created by wallet.',
118
+ parameters: {
119
+ address: `Address: ${args.address}`,
120
+ page: `Page: ${args.page || 1}`,
121
+ limit: `Limit: ${args.limit || 20}`,
122
+ ...(args.tokenName && { tokenFilter: `Token Name Filter: ${args.tokenName}` }),
123
+ ...(args.search && { searchFilter: `Search Filter: ${args.search}` }),
139
124
  },
140
- },
141
- ];
125
+ toolName: MCP_TOOLS.FETCH_TOKENS_CREATED,
126
+ actionDescription: 'retrieve created tokens',
127
+ displayFormat: 'Display the list of tokens created by this wallet.',
128
+ })
129
+ );
142
130
  },
143
131
  };
144
132
 
@@ -166,27 +154,23 @@ export const updateProfilePrompt: MCPPrompt = {
166
154
  },
167
155
  ],
168
156
  handler: (args) => {
169
- if (args.address) {
170
- validateAddress(args.address);
171
- }
172
-
173
- return [
174
- {
175
- role: 'user',
176
- content: {
177
- type: 'text',
178
- text: `Update user profile.
179
-
180
- Full Name: ${args.fullName}
181
- Profile Image: ${args.profileImage}
182
- ${args.address ? `Address: ${args.address}` : 'Using default wallet'}
183
-
184
- Use ${MCP_TOOLS.UPDATE_PROFILE} to update the profile.
185
-
186
- Display confirmation of successful update.`,
157
+ validateOptionalAddress(args.address);
158
+
159
+ return createPromptResponse(
160
+ createSimpleOperationText({
161
+ operation: 'Update user profile.',
162
+ parameters: {
163
+ fullName: `Full Name: ${args.fullName}`,
164
+ profileImage: `Profile Image: ${args.profileImage}`,
165
+ ...(args.address
166
+ ? { address: `Address: ${args.address}` }
167
+ : { wallet: 'Using default wallet' }),
187
168
  },
188
- },
189
- ];
169
+ toolName: MCP_TOOLS.UPDATE_PROFILE,
170
+ actionDescription: 'update the profile',
171
+ displayFormat: 'Display confirmation of successful update.',
172
+ })
173
+ );
190
174
  },
191
175
  };
192
176