@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
@@ -7,6 +7,8 @@
7
7
  import type { MCPPrompt } from '../types/mcp.js';
8
8
  import { MCP_TOOLS } from '../constants/mcpToolNames.js';
9
9
  import { validateTokenName } from '../utils/validation.js';
10
+ import { createPromptResponse } from './utils/handlerHelpers.js';
11
+ import { createSimpleOperationText } from './utils/textTemplates.js';
10
12
 
11
13
  /**
12
14
  * Upload Profile Image - Standalone profile image upload
@@ -26,24 +28,19 @@ export const uploadProfileImagePrompt: MCPPrompt = {
26
28
  required: false,
27
29
  },
28
30
  ],
29
- handler: (args) => {
30
- return [
31
- {
32
- role: 'user',
33
- content: {
34
- type: 'text',
35
- text: `Upload profile image.
36
-
37
- Image Path: ${args.imagePath}
38
- ${args.address ? `Address: ${args.address}` : 'Using default wallet'}
39
-
40
- Use ${MCP_TOOLS.UPLOAD_PROFILE_IMAGE} to upload the image file.
41
-
42
- Display confirmation and the image URL.`,
31
+ handler: (args) =>
32
+ createPromptResponse(
33
+ createSimpleOperationText({
34
+ operation: 'Upload profile image.',
35
+ parameters: {
36
+ imagePath: `Image Path: ${args.imagePath}`,
37
+ wallet: args.address ? `Address: ${args.address}` : 'Using default wallet',
43
38
  },
44
- },
45
- ];
46
- },
39
+ toolName: MCP_TOOLS.UPLOAD_PROFILE_IMAGE,
40
+ actionDescription: 'upload the image file',
41
+ displayFormat: 'Display confirmation and the image URL.',
42
+ })
43
+ ),
47
44
  };
48
45
 
49
46
  /**
@@ -67,24 +64,18 @@ export const uploadTokenImagePrompt: MCPPrompt = {
67
64
  handler: (args) => {
68
65
  validateTokenName(args.tokenName);
69
66
 
70
- return [
71
- {
72
- role: 'user',
73
- content: {
74
- type: 'text',
75
- text: `Upload token image.
76
-
77
- Token: ${args.tokenName}
78
- Image Path: ${args.imagePath}
79
-
80
- Use ${MCP_TOOLS.UPLOAD_TOKEN_IMAGE} to upload the token image file.
81
-
82
- This tool is Node.js only (not available in browser).
83
-
84
- Display confirmation and the uploaded image URL.`,
67
+ return createPromptResponse(
68
+ createSimpleOperationText({
69
+ operation: 'Upload token image.',
70
+ parameters: {
71
+ token: `Token: ${args.tokenName}`,
72
+ imagePath: `Image Path: ${args.imagePath}`,
85
73
  },
86
- },
87
- ];
74
+ toolName: MCP_TOOLS.UPLOAD_TOKEN_IMAGE,
75
+ actionDescription: 'upload the token image file',
76
+ displayFormat: 'This tool is Node.js only (not available in browser).\n\nDisplay confirmation and the uploaded image URL.',
77
+ })
78
+ );
88
79
  },
89
80
  };
90
81
 
@@ -94,21 +85,15 @@ Display confirmation and the uploaded image URL.`,
94
85
  export const fetchLaunchTokenFeePrompt: MCPPrompt = {
95
86
  name: 'galachain-launchpad:fetch-launch-token-fee',
96
87
  description: 'Get the current GALA fee required to launch a new token',
97
- handler: () => {
98
- return [
99
- {
100
- role: 'user',
101
- content: {
102
- type: 'text',
103
- text: `Check the current token launch fee.
104
-
105
- Use ${MCP_TOOLS.FETCH_LAUNCH_TOKEN_FEE} to retrieve the current GALA fee.
106
-
107
- This is a dynamic value that may change. Display the current fee amount.`,
108
- },
109
- },
110
- ];
111
- },
88
+ handler: () =>
89
+ createPromptResponse(
90
+ createSimpleOperationText({
91
+ operation: 'Check the current token launch fee.',
92
+ toolName: MCP_TOOLS.FETCH_LAUNCH_TOKEN_FEE,
93
+ actionDescription: 'retrieve the current GALA fee',
94
+ displayFormat: 'This is a dynamic value that may change. Display the current fee amount.',
95
+ })
96
+ ),
112
97
  };
113
98
 
114
99
  export const creationUtilityPrompts: MCPPrompt[] = [
@@ -0,0 +1,138 @@
1
+ /**
2
+ * DEX Pool Exploration Prompts
3
+ *
4
+ * Slash commands for discovering and exploring GalaSwap DEX liquidity pools.
5
+ * These prompts guide users through finding trading pairs and analyzing pool metrics.
6
+ */
7
+
8
+ import type { MCPPrompt } from '../types/mcp.js';
9
+ import { MCP_TOOLS } from '../constants/mcpToolNames.js';
10
+ import { validatePaginationLimit } from '../utils/validation.js';
11
+ import { createPromptResponse } from './utils/handlerHelpers.js';
12
+ import { createSimpleOperationText } from './utils/textTemplates.js';
13
+
14
+ /**
15
+ * Fetch DEX Pools - Paginated pool discovery with filters
16
+ */
17
+ export const fetchDexPoolsPrompt: MCPPrompt = {
18
+ name: 'galachain-launchpad:fetch-dex-pools',
19
+ description: 'Discover DEX liquidity pools with pagination, sorting, and search filtering',
20
+ arguments: [
21
+ {
22
+ name: 'search',
23
+ description: 'Search filter for token symbols (e.g., GALA, GUSDC, GWETH)',
24
+ required: false,
25
+ },
26
+ {
27
+ name: 'sortBy',
28
+ description: 'Sort field: tvl (default), volume30d, or volume1d',
29
+ required: false,
30
+ },
31
+ {
32
+ name: 'sortOrder',
33
+ description: 'Sort order: desc (default) or asc',
34
+ required: false,
35
+ },
36
+ {
37
+ name: 'page',
38
+ description: 'Page number (default: 1)',
39
+ required: false,
40
+ },
41
+ {
42
+ name: 'limit',
43
+ description: 'Results per page (default: 10, max: 20)',
44
+ required: false,
45
+ },
46
+ ],
47
+ handler: (args) => {
48
+ if (args.limit) {
49
+ validatePaginationLimit(args.limit, 20);
50
+ }
51
+
52
+ const sortBy = args.sortBy || 'tvl';
53
+ const sortOrder = args.sortOrder || 'desc';
54
+ const page = args.page || 1;
55
+ const limit = args.limit || 10;
56
+
57
+ return createPromptResponse(
58
+ createSimpleOperationText({
59
+ operation: 'Discover liquidity pools on GalaSwap DEX.',
60
+ parameters: {
61
+ search: args.search ? `Search: ${args.search}` : 'Search: (none)',
62
+ sort_by: `Sort by: ${sortBy}`,
63
+ sort_order: `Order: ${sortOrder}`,
64
+ page: `Page: ${page}`,
65
+ limit: `Limit: ${limit}`,
66
+ },
67
+ toolName: MCP_TOOLS.FETCH_DEX_POOLS,
68
+ actionDescription: 'retrieve liquidity pools with pagination and filtering',
69
+ displayFormat: 'Display results showing pool names, token pairs, TVL, volumes, and APR metrics.',
70
+ })
71
+ );
72
+ },
73
+ };
74
+
75
+ /**
76
+ * Fetch All DEX Pools - Complete pool discovery with auto-pagination
77
+ */
78
+ export const fetchAllDexPoolsPrompt: MCPPrompt = {
79
+ name: 'galachain-launchpad:fetch-all-dex-pools',
80
+ description: 'Discover ALL DEX liquidity pools with automatic pagination',
81
+ arguments: [
82
+ {
83
+ name: 'search',
84
+ description: 'Search filter for token symbols (e.g., GALA, GUSDC)',
85
+ required: false,
86
+ },
87
+ {
88
+ name: 'sortBy',
89
+ description: 'Sort field: tvl (default), volume30d, or volume1d',
90
+ required: false,
91
+ },
92
+ {
93
+ name: 'sortOrder',
94
+ description: 'Sort order: desc (default) or asc',
95
+ required: false,
96
+ },
97
+ ],
98
+ handler: (args) => {
99
+ const sortBy = args.sortBy || 'tvl';
100
+ const sortOrder = args.sortOrder || 'desc';
101
+
102
+ return [
103
+ {
104
+ role: 'user',
105
+ content: {
106
+ type: 'text',
107
+ text: `I want to discover all DEX liquidity pools on GalaSwap.
108
+
109
+ **Discovery Parameters:**
110
+ - Search Filter: ${args.search || '(none - get all pools)'}
111
+ - Sort By: ${sortBy}
112
+ - Sort Order: ${sortOrder}
113
+
114
+ **Action:**
115
+ Fetch all available DEX pools with automatic pagination. Show me comprehensive pool data including:
116
+ - Pool identifiers (token pairs)
117
+ - Total Value Locked (TVL) and TVL breakdown by token
118
+ - 24-hour and 30-day trading volumes
119
+ - Fee tiers and APR
120
+ - Volume-to-TVL ratios
121
+
122
+ Please use the following MCP tool:
123
+ - gala_launchpad_fetch_all_dex_pools: Retrieve all pools with auto-pagination
124
+
125
+ Display the results in a clear format showing the top pools and key metrics for analysis.`,
126
+ },
127
+ },
128
+ ];
129
+ },
130
+ };
131
+
132
+ /**
133
+ * Export all DEX pool exploration prompts
134
+ */
135
+ export const exploreDexPoolsPrompts: MCPPrompt[] = [
136
+ fetchDexPoolsPrompt,
137
+ fetchAllDexPoolsPrompt,
138
+ ];
@@ -11,6 +11,7 @@ import { utilityPrompts } from './utility.js';
11
11
  import { creationPrompts } from './create-token.js';
12
12
  import { discoveryPrompts } from './discover-tokens.js';
13
13
  import { dexTradingPrompts } from './dex-trading.js';
14
+ import { exploreDexPoolsPrompts } from './explore-dex-pools.js';
14
15
  import { liquidityPositionPrompts } from './liquidity-positions.js';
15
16
  import { poolPrompts } from './pools.js';
16
17
  import { tradingCalculationPrompts } from './trading-calculations.js';
@@ -22,7 +23,7 @@ import { utilityToolPrompts } from './utility-tools.js';
22
23
  import type { MCPPrompt } from '../types/mcp.js';
23
24
 
24
25
  /**
25
- * All available prompts (72 total)
26
+ * All available prompts (74 total - 2 new DEX pool exploration prompts)
26
27
  */
27
28
  export const prompts: MCPPrompt[] = [
28
29
  ...tradingPrompts,
@@ -31,6 +32,7 @@ export const prompts: MCPPrompt[] = [
31
32
  ...creationPrompts,
32
33
  ...discoveryPrompts,
33
34
  ...dexTradingPrompts,
35
+ ...exploreDexPoolsPrompts,
34
36
  ...liquidityPositionPrompts,
35
37
  ...utilityPrompts,
36
38
  ...poolPrompts,
@@ -127,7 +129,7 @@ export function getPromptsByCategory(
127
129
  case 'creation':
128
130
  return creationPrompts;
129
131
  case 'discovery':
130
- return discoveryPrompts;
132
+ return [...discoveryPrompts, ...exploreDexPoolsPrompts];
131
133
  case 'dex':
132
134
  return dexTradingPrompts;
133
135
  case 'liquidity':
@@ -163,6 +165,7 @@ export {
163
165
  creationPrompts,
164
166
  discoveryPrompts,
165
167
  dexTradingPrompts,
168
+ exploreDexPoolsPrompts,
166
169
  liquidityPositionPrompts,
167
170
  utilityPrompts,
168
171
  poolPrompts,
@@ -6,6 +6,7 @@
6
6
 
7
7
  import type { MCPPrompt } from '../types/mcp.js';
8
8
  import { validateNumericAmount } from '../utils/validation.js';
9
+ import { createPromptResponse } from './utils/handlerHelpers.js';
9
10
 
10
11
  /**
11
12
  * View My Liquidity Positions - List all open LP positions
@@ -17,13 +18,8 @@ export const myPositionsPrompt: MCPPrompt = {
17
18
  description:
18
19
  'View all your open liquidity positions on GalaSwap DEX with details about each position',
19
20
  arguments: [],
20
- handler: () => {
21
- return [
22
- {
23
- role: 'user',
24
- content: {
25
- type: 'text',
26
- text: `I want to view all my open liquidity positions on GalaSwap DEX.
21
+ handler: () =>
22
+ createPromptResponse(`I want to view all my open liquidity positions on GalaSwap DEX.
27
23
 
28
24
  **Action:**
29
25
  Show me all my liquidity positions with the following information for each:
@@ -42,11 +38,7 @@ Show me all my liquidity positions with the following information for each:
42
38
  Please use the following MCP tools:
43
39
  - gala_launchpad_get_user_liquidity_positions: Retrieve all open positions for my wallet
44
40
 
45
- Proceed with fetching my positions.`,
46
- },
47
- },
48
- ];
49
- },
41
+ Proceed with fetching my positions.`),
50
42
  };
51
43
 
52
44
  /**
@@ -104,12 +96,7 @@ export const addLiquidityPrompt: MCPPrompt = {
104
96
  const maxPrice = args.maxPrice || '1.05';
105
97
  const feeTier = args.feeTier || '3000';
106
98
 
107
- return [
108
- {
109
- role: 'user',
110
- content: {
111
- type: 'text',
112
- text: `I want to add liquidity to the ${args.token0}/${args.token1} pool on GalaSwap DEX.
99
+ return createPromptResponse(`I want to add liquidity to the ${args.token0}/${args.token1} pool on GalaSwap DEX.
113
100
 
114
101
  **Liquidity Details:**
115
102
  - Token Pair: ${args.token0} / ${args.token1}
@@ -134,10 +121,7 @@ Please use the following MCP tools:
134
121
  - gala_launchpad_get_swap_pool_info: Get ${args.token0}/${args.token1} pool details
135
122
  - gala_launchpad_add_liquidity_by_price: Add liquidity with price range
136
123
 
137
- Proceed with adding liquidity.`,
138
- },
139
- },
140
- ];
124
+ Proceed with adding liquidity.`);
141
125
  },
142
126
  };
143
127
 
@@ -165,12 +149,7 @@ export const removeLiquidityPrompt: MCPPrompt = {
165
149
  handler: (args) => {
166
150
  const percentage = args.percentage || '100';
167
151
 
168
- return [
169
- {
170
- role: 'user',
171
- content: {
172
- type: 'text',
173
- text: `I want to remove ${percentage}% of liquidity from position ${args.positionId}.
152
+ return createPromptResponse(`I want to remove ${percentage}% of liquidity from position ${args.positionId}.
174
153
 
175
154
  **Removal Details:**
176
155
  - Position ID: ${args.positionId}
@@ -195,10 +174,7 @@ Please use the following MCP tools:
195
174
  - gala_launchpad_estimate_remove_liquidity: Preview what I'll receive
196
175
  - gala_launchpad_remove_liquidity: Execute the removal
197
176
 
198
- Proceed with removing liquidity.`,
199
- },
200
- },
201
- ];
177
+ Proceed with removing liquidity.`);
202
178
  },
203
179
  };
204
180
 
@@ -218,13 +194,8 @@ export const collectFeesPrompt: MCPPrompt = {
218
194
  required: true,
219
195
  },
220
196
  ],
221
- handler: (args) => {
222
- return [
223
- {
224
- role: 'user',
225
- content: {
226
- type: 'text',
227
- text: `I want to collect accumulated trading fees from position ${args.positionId}.
197
+ handler: (args) =>
198
+ createPromptResponse(`I want to collect accumulated trading fees from position ${args.positionId}.
228
199
 
229
200
  **Fee Collection Details:**
230
201
  - Position ID: ${args.positionId}
@@ -252,11 +223,7 @@ Please use the following MCP tools:
252
223
  - gala_launchpad_get_liquidity_position_by_id: Get position details and fee amounts
253
224
  - gala_launchpad_collect_position_fees: Collect the accumulated fees
254
225
 
255
- Proceed with collecting fees.`,
256
- },
257
- },
258
- ];
259
- },
226
+ Proceed with collecting fees.`),
260
227
  };
261
228
 
262
229
  /**