@gala-chain/launchpad-mcp-server 1.23.0 → 1.23.1

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 (131) hide show
  1. package/DRY_REFACTORING_GUIDE.md +272 -0
  2. package/dist/generated/version.d.ts +1 -1
  3. package/dist/generated/version.js +1 -1
  4. package/dist/prompts/analysis.d.ts.map +1 -1
  5. package/dist/prompts/analysis.js +14 -63
  6. package/dist/prompts/analysis.js.map +1 -1
  7. package/dist/prompts/balances.d.ts.map +1 -1
  8. package/dist/prompts/balances.js +46 -70
  9. package/dist/prompts/balances.js.map +1 -1
  10. package/dist/prompts/creation-utils.d.ts.map +1 -1
  11. package/dist/prompts/creation-utils.js +27 -50
  12. package/dist/prompts/creation-utils.js.map +1 -1
  13. package/dist/prompts/liquidity-positions.d.ts.map +1 -1
  14. package/dist/prompts/liquidity-positions.js +9 -44
  15. package/dist/prompts/liquidity-positions.js.map +1 -1
  16. package/dist/prompts/pools.d.ts.map +1 -1
  17. package/dist/prompts/pools.js +125 -228
  18. package/dist/prompts/pools.js.map +1 -1
  19. package/dist/prompts/portfolio.d.ts.map +1 -1
  20. package/dist/prompts/portfolio.js +13 -48
  21. package/dist/prompts/portfolio.js.map +1 -1
  22. package/dist/prompts/social.d.ts.map +1 -1
  23. package/dist/prompts/social.js +21 -31
  24. package/dist/prompts/social.js.map +1 -1
  25. package/dist/prompts/trading-calculations.d.ts.map +1 -1
  26. package/dist/prompts/trading-calculations.js +37 -126
  27. package/dist/prompts/trading-calculations.js.map +1 -1
  28. package/dist/prompts/trading.d.ts.map +1 -1
  29. package/dist/prompts/trading.js +23 -60
  30. package/dist/prompts/trading.js.map +1 -1
  31. package/dist/prompts/transfers.d.ts.map +1 -1
  32. package/dist/prompts/transfers.js +21 -31
  33. package/dist/prompts/transfers.js.map +1 -1
  34. package/dist/prompts/utility-tools.d.ts.map +1 -1
  35. package/dist/prompts/utility-tools.js +83 -202
  36. package/dist/prompts/utility-tools.js.map +1 -1
  37. package/dist/prompts/utility.d.ts.map +1 -1
  38. package/dist/prompts/utility.js +5 -20
  39. package/dist/prompts/utility.js.map +1 -1
  40. package/dist/prompts/utils/handlerHelpers.d.ts +35 -0
  41. package/dist/prompts/utils/handlerHelpers.d.ts.map +1 -0
  42. package/dist/prompts/utils/handlerHelpers.js +53 -0
  43. package/dist/prompts/utils/handlerHelpers.js.map +1 -0
  44. package/dist/prompts/utils/textTemplates.d.ts +42 -0
  45. package/dist/prompts/utils/textTemplates.d.ts.map +1 -0
  46. package/dist/prompts/utils/textTemplates.js +51 -0
  47. package/dist/prompts/utils/textTemplates.js.map +1 -0
  48. package/dist/utils/validation.d.ts +38 -0
  49. package/dist/utils/validation.d.ts.map +1 -1
  50. package/dist/utils/validation.js +52 -0
  51. package/dist/utils/validation.js.map +1 -1
  52. package/package.json +2 -2
  53. package/docs/AI-AGENT-PATTERNS.md +0 -555
  54. package/docs/CONSTRAINTS-REFERENCE.md +0 -454
  55. package/docs/PROMPT-TOOL-MAPPING.md +0 -352
  56. package/docs/examples/default-values-pattern.md +0 -240
  57. package/docs/examples/tool-factory-pattern.md +0 -217
  58. package/jest.config.js +0 -94
  59. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
  60. package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
  61. package/src/__tests__/server.test.ts +0 -256
  62. package/src/constants/mcpToolNames.ts +0 -181
  63. package/src/index.ts +0 -19
  64. package/src/prompts/__tests__/promptStructure.test.ts +0 -137
  65. package/src/prompts/__tests__/registry.test.ts +0 -359
  66. package/src/prompts/analysis.ts +0 -429
  67. package/src/prompts/balances.ts +0 -198
  68. package/src/prompts/create-token.ts +0 -123
  69. package/src/prompts/creation-utils.ts +0 -118
  70. package/src/prompts/dex-trading.ts +0 -86
  71. package/src/prompts/discover-tokens.ts +0 -86
  72. package/src/prompts/index.ts +0 -175
  73. package/src/prompts/liquidity-positions.ts +0 -270
  74. package/src/prompts/pools.ts +0 -571
  75. package/src/prompts/portfolio.ts +0 -242
  76. package/src/prompts/social.ts +0 -100
  77. package/src/prompts/trading-calculations.ts +0 -499
  78. package/src/prompts/trading.ts +0 -191
  79. package/src/prompts/transfers.ts +0 -103
  80. package/src/prompts/utility-tools.ts +0 -349
  81. package/src/prompts/utility.ts +0 -92
  82. package/src/prompts/utils/workflowTemplates.ts +0 -511
  83. package/src/schemas/common-schemas.ts +0 -393
  84. package/src/scripts/test-all-prompts.ts +0 -184
  85. package/src/server.ts +0 -367
  86. package/src/tools/__tests__/dex-tools.test.ts +0 -562
  87. package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
  88. package/src/tools/balance/index.ts +0 -174
  89. package/src/tools/creation/index.ts +0 -182
  90. package/src/tools/dex/index.ts +0 -226
  91. package/src/tools/dex/liquidity-positions.ts +0 -547
  92. package/src/tools/index.ts +0 -94
  93. package/src/tools/pools/fetchAllPools.ts +0 -47
  94. package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
  95. package/src/tools/pools/fetchPoolDetails.ts +0 -27
  96. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
  97. package/src/tools/pools/fetchPools.ts +0 -47
  98. package/src/tools/pools/fetchPriceHistory.ts +0 -124
  99. package/src/tools/pools/fetchTokenDetails.ts +0 -77
  100. package/src/tools/pools/index.ts +0 -284
  101. package/src/tools/social/index.ts +0 -64
  102. package/src/tools/trading/index.ts +0 -605
  103. package/src/tools/transfers/index.ts +0 -75
  104. package/src/tools/utils/clearCache.ts +0 -36
  105. package/src/tools/utils/createWallet.ts +0 -19
  106. package/src/tools/utils/explainSdkUsage.ts +0 -1446
  107. package/src/tools/utils/getAddress.ts +0 -12
  108. package/src/tools/utils/getCacheInfo.ts +0 -14
  109. package/src/tools/utils/getConfig.ts +0 -21
  110. package/src/tools/utils/getEnvironment.ts +0 -17
  111. package/src/tools/utils/getEthereumAddress.ts +0 -12
  112. package/src/tools/utils/getUrlByTokenName.ts +0 -12
  113. package/src/tools/utils/getVersion.ts +0 -25
  114. package/src/tools/utils/getWallet.ts +0 -25
  115. package/src/tools/utils/hasWallet.ts +0 -15
  116. package/src/tools/utils/index.ts +0 -37
  117. package/src/tools/utils/isTokenGraduated.ts +0 -16
  118. package/src/tools/utils/setWallet.ts +0 -41
  119. package/src/tools/utils/switchEnvironment.ts +0 -28
  120. package/src/types/mcp.ts +0 -72
  121. package/src/utils/__tests__/validation.test.ts +0 -147
  122. package/src/utils/constraints.ts +0 -155
  123. package/src/utils/default-values.ts +0 -208
  124. package/src/utils/error-handler.ts +0 -69
  125. package/src/utils/error-templates.ts +0 -273
  126. package/src/utils/response-formatter.ts +0 -51
  127. package/src/utils/tool-factory.ts +0 -303
  128. package/src/utils/tool-registry.ts +0 -296
  129. package/src/utils/validation.ts +0 -371
  130. package/tests/wallet-management-integration.test.ts +0 -284
  131. package/tsconfig.json +0 -23
@@ -1,284 +0,0 @@
1
- /**
2
- * Pool Management Tools
3
- */
4
-
5
- import { POOL_TYPES } from '@gala-chain/launchpad-sdk';
6
- import type { MCPTool } from '../../types/mcp.js';
7
- import { formatSuccess } from '../../utils/response-formatter.js';
8
- import { withErrorHandling } from '../../utils/error-handler.js';
9
- import {
10
- TOKEN_NAME_SCHEMA,
11
- TOKEN_SYMBOL_SCHEMA,
12
- ADDRESS_SCHEMA,
13
- PAGE_SCHEMA,
14
- createLimitSchema,
15
- CALCULATION_MODE_SCHEMA,
16
- CURRENT_SUPPLY_SCHEMA,
17
- } from '../../schemas/common-schemas.js';
18
- import { fetchPoolDetailsForCalculationTool } from './fetchPoolDetailsForCalculation.js';
19
- import { fetchAllPoolsTool } from './fetchAllPools.js';
20
- import { fetchPriceHistoryTool } from './fetchPriceHistory.js';
21
- import { fetchAllPriceHistoryTool } from './fetchAllPriceHistory.js';
22
- import { fetchTokenDetailsTool } from './fetchTokenDetails.js';
23
- import {
24
- createSimpleTokenFetchTool,
25
- createBooleanCheckTool,
26
- createResolutionTool,
27
- createNoParamTool,
28
- } from '../../utils/tool-factory.js';
29
- import { resolutionToSeconds, dateToUnixTimestamp, DEFAULT_VOLUME_RESOLUTION } from '../../utils/default-values.js';
30
-
31
- // 1. Fetch Pools
32
- export const fetchPoolsTool: MCPTool = {
33
- name: 'gala_launchpad_fetch_pools',
34
- description: 'Fetch token pools from Gala Launchpad with filtering and pagination',
35
- inputSchema: {
36
- type: 'object',
37
- properties: {
38
- type: {
39
- type: 'string',
40
- enum: Object.values(POOL_TYPES),
41
- description: 'Type of pools to fetch (default: recent)',
42
- },
43
- creatorAddress: {
44
- ...ADDRESS_SCHEMA,
45
- description: 'Filter by creator address (optional)',
46
- },
47
- page: PAGE_SCHEMA,
48
- limit: createLimitSchema('pool', 20),
49
- },
50
- },
51
- handler: withErrorHandling(async (sdk, args) => {
52
- const result = await sdk.fetchPools({
53
- type: args.type || 'recent',
54
- page: args.page || 1,
55
- limit: args.limit || 20,
56
- });
57
- return formatSuccess(result);
58
- }),
59
- };
60
-
61
- // 2. Fetch Pool Details (73% code reduction via factory pattern)
62
- export const fetchPoolDetailsTool = createSimpleTokenFetchTool({
63
- name: 'gala_launchpad_fetch_pool_details',
64
- description: 'Get detailed pool state from GalaChain bonding curve',
65
- handler: (sdk, tokenName) => sdk.fetchPoolDetails(tokenName),
66
- });
67
-
68
- // 3. Fetch Token Distribution (73% code reduction via factory pattern)
69
- export const fetchTokenDistributionTool = createSimpleTokenFetchTool({
70
- name: 'gala_launchpad_fetch_token_distribution',
71
- description: 'Get holder distribution and supply metrics',
72
- handler: (sdk, tokenName) => sdk.fetchTokenDistribution(tokenName),
73
- });
74
-
75
- // 4. Fetch Token Badges (73% code reduction via factory pattern)
76
- export const fetchTokenBadgesTool = createSimpleTokenFetchTool({
77
- name: 'gala_launchpad_fetch_token_badges',
78
- description: 'Get achievement badges for volume and engagement',
79
- handler: (sdk, tokenName) => sdk.fetchTokenBadges(tokenName),
80
- });
81
-
82
- // 5. Fetch Volume Data (using centralized default values utilities)
83
- export const fetchVolumeDataTool: MCPTool = {
84
- name: 'gala_launchpad_fetch_volume_data',
85
- description: 'Get OHLCV (candlestick) data for charting',
86
- inputSchema: {
87
- type: 'object',
88
- properties: {
89
- tokenName: TOKEN_NAME_SCHEMA,
90
- from: {
91
- type: 'string',
92
- format: 'date-time',
93
- description: 'Start date (ISO 8601)',
94
- },
95
- to: {
96
- type: 'string',
97
- format: 'date-time',
98
- description: 'End date (ISO 8601)',
99
- },
100
- resolution: {
101
- type: 'string',
102
- enum: ['1m', '5m', '15m', '1h', '4h', '1d'],
103
- description: 'Time resolution (default: 1h)',
104
- },
105
- },
106
- required: ['tokenName'],
107
- },
108
- handler: withErrorHandling(async (sdk, args) => {
109
- const result = await sdk.fetchVolumeData({
110
- tokenName: args.tokenName,
111
- from: dateToUnixTimestamp(args.from),
112
- to: dateToUnixTimestamp(args.to),
113
- resolution: resolutionToSeconds(args.resolution, DEFAULT_VOLUME_RESOLUTION),
114
- });
115
- return formatSuccess(result);
116
- }),
117
- };
118
-
119
- // 6. Fetch Token Spot Price (Smart Router - Launchpad or DEX)
120
- export const fetchTokenPriceTool: MCPTool = {
121
- name: 'gala_launchpad_fetch_token_spot_price',
122
- description: `Fetch USD spot price for ANY token with smart routing
123
-
124
- Routes to the correct backend automatically:
125
- - **tokenName** → Launchpad token (detects graduation status)
126
- - **tokenId** → DEX token via /v1/trade/price endpoint`,
127
- inputSchema: {
128
- type: 'object',
129
- properties: {
130
- tokenName: {
131
- ...TOKEN_NAME_SCHEMA,
132
- description: 'Launchpad token name (e.g., "galadog", "anime") - auto-detects graduation status',
133
- },
134
- tokenId: {
135
- oneOf: [
136
- {
137
- type: 'string',
138
- description:
139
- 'Pipe-delimited format: "collection|category|type|additionalKey" (e.g., "Token|Unit|GUSDC|eth:0x...")',
140
- },
141
- {
142
- type: 'object',
143
- properties: {
144
- collection: {
145
- type: 'string',
146
- description: 'Token collection (e.g., "Token")',
147
- },
148
- category: {
149
- type: 'string',
150
- description: 'Token category (e.g., "Unit")',
151
- },
152
- type: {
153
- type: 'string',
154
- description: 'Token type (e.g., "GUSDC")',
155
- },
156
- additionalKey: {
157
- type: 'string',
158
- description: 'Additional key (e.g., "eth:0x...")',
159
- },
160
- },
161
- required: ['collection', 'category', 'type', 'additionalKey'],
162
- description: 'TokenClassKey object format',
163
- },
164
- ],
165
- description: 'DEX token identifier in flexible format (string or object)',
166
- },
167
- currentSupply: CURRENT_SUPPLY_SCHEMA,
168
- calculateAmountMode: CALCULATION_MODE_SCHEMA,
169
- },
170
- },
171
- handler: withErrorHandling(async (sdk, args) => {
172
- const result = await sdk.fetchTokenPrice({
173
- tokenName: args.tokenName,
174
- tokenId: args.tokenId,
175
- currentSupply: args.currentSupply,
176
- calculateAmountMode: args.calculateAmountMode,
177
- });
178
- return formatSuccess(result);
179
- }),
180
- };
181
-
182
- // 7. Fetch GALA Spot Price (45% code reduction via factory pattern)
183
- export const fetchGalaPriceTool = createNoParamTool({
184
- name: 'gala_launchpad_fetch_gala_spot_price',
185
- description: 'Fetch current GALA USD spot price (convenience method)',
186
- handler: (sdk) => sdk.fetchGalaPrice(),
187
- });
188
-
189
- // 8. Fetch Launchpad Token Spot Price (DEPRECATED)
190
- export const fetchLaunchpadTokenSpotPriceTool: MCPTool = {
191
- name: 'gala_launchpad_fetch_launchpad_token_spot_price',
192
- description: `⚠️ **DEPRECATED** - Use gala_launchpad_fetch_token_spot_price with { tokenName } instead. Will be removed in v4.0.0.
193
-
194
- Fetch USD spot price for a launchpad token by name.
195
-
196
- Performance optimization: Provide currentSupply to avoid fetching pool details twice.`,
197
- inputSchema: {
198
- type: 'object',
199
- properties: {
200
- tokenName: {
201
- ...TOKEN_NAME_SCHEMA,
202
- description: 'Token name (e.g., "dragnrkti", "rocketri", "unicornri")',
203
- },
204
- calculateAmountMode: CALCULATION_MODE_SCHEMA,
205
- currentSupply: CURRENT_SUPPLY_SCHEMA,
206
- },
207
- required: ['tokenName'],
208
- },
209
- handler: withErrorHandling(async (sdk, args) => {
210
- // Build options object only if mode or supply provided
211
- const options = args.calculateAmountMode || args.currentSupply
212
- ? {
213
- tokenName: args.tokenName,
214
- calculateAmountMode: args.calculateAmountMode,
215
- currentSupply: args.currentSupply,
216
- }
217
- : args.tokenName;
218
-
219
- const result = await sdk.fetchLaunchpadTokenSpotPrice(options);
220
- return formatSuccess(result);
221
- }),
222
- };
223
-
224
- // 9. Check Token Name (60% code reduction via factory pattern)
225
- export const checkTokenNameTool = createBooleanCheckTool({
226
- name: 'gala_launchpad_check_token_name',
227
- description: 'Check if token name is available',
228
- paramName: 'tokenName',
229
- paramSchema: TOKEN_NAME_SCHEMA,
230
- handler: (sdk, tokenName) => sdk.isTokenNameAvailable(tokenName),
231
- messages: {
232
- true: 'Token name is available',
233
- false: 'Token name is already taken',
234
- },
235
- });
236
-
237
- // 10. Check Token Symbol (60% code reduction via factory pattern)
238
- export const checkTokenSymbolTool = createBooleanCheckTool({
239
- name: 'gala_launchpad_check_token_symbol',
240
- description: 'Check if token symbol is available',
241
- paramName: 'symbol',
242
- paramSchema: TOKEN_SYMBOL_SCHEMA,
243
- handler: (sdk, symbol) => sdk.isTokenSymbolAvailable(symbol),
244
- messages: {
245
- true: 'Token symbol is available',
246
- false: 'Token symbol is already taken',
247
- },
248
- });
249
-
250
- // 11. Resolve Vault Address (73% code reduction via factory pattern)
251
- export const resolveVaultAddressTool = createResolutionTool({
252
- name: 'gala_launchpad_resolve_vault_address',
253
- description: 'Get GalaChain vault address for a token (useful for debugging)',
254
- resolver: (sdk, tokenName) => sdk.resolveVaultAddress(tokenName),
255
- resultKey: 'vaultAddress',
256
- });
257
-
258
- // 12. Resolve Token Class Key (73% code reduction via factory pattern)
259
- export const resolveTokenClassKeyTool = createResolutionTool({
260
- name: 'gala_launchpad_resolve_token_class_key',
261
- description: 'Get GalaChain TokenClassKey for a launchpad token (useful for direct GalaChain operations)',
262
- resolver: (sdk, tokenName) => sdk.resolveTokenClassKey(tokenName),
263
- resultKey: 'tokenClassKey',
264
- });
265
-
266
- export const poolTools: MCPTool[] = [
267
- fetchPoolsTool,
268
- fetchAllPoolsTool,
269
- fetchPoolDetailsTool,
270
- fetchPoolDetailsForCalculationTool,
271
- fetchTokenDetailsTool,
272
- fetchTokenDistributionTool,
273
- fetchTokenBadgesTool,
274
- fetchVolumeDataTool,
275
- fetchTokenPriceTool,
276
- fetchGalaPriceTool,
277
- fetchLaunchpadTokenSpotPriceTool,
278
- fetchPriceHistoryTool,
279
- fetchAllPriceHistoryTool,
280
- checkTokenNameTool,
281
- checkTokenSymbolTool,
282
- resolveVaultAddressTool,
283
- resolveTokenClassKeyTool,
284
- ];
@@ -1,64 +0,0 @@
1
- /**
2
- * Comments & Social Tools
3
- */
4
-
5
- import type { MCPTool } from '../../types/mcp.js';
6
- import { formatSuccess } from '../../utils/response-formatter.js';
7
- import { withErrorHandling } from '../../utils/error-handler.js';
8
- import {
9
- TOKEN_NAME_SCHEMA,
10
- COMMENT_MESSAGE_SCHEMA,
11
- PRIVATE_KEY_SCHEMA,
12
- PAGE_SCHEMA,
13
- createLimitSchema,
14
- } from '../../schemas/common-schemas.js';
15
- import { applyOperationPaginationDefaults } from '../../utils/default-values.js';
16
-
17
- // 1. Post Comment
18
- export const postCommentTool: MCPTool = {
19
- name: 'gala_launchpad_post_comment',
20
- description: 'Post a comment on a token pool',
21
- inputSchema: {
22
- type: 'object',
23
- properties: {
24
- tokenName: TOKEN_NAME_SCHEMA,
25
- message: COMMENT_MESSAGE_SCHEMA,
26
- privateKey: PRIVATE_KEY_SCHEMA,
27
- },
28
- required: ['tokenName', 'message'],
29
- },
30
- handler: withErrorHandling(async (sdk, args) => {
31
- await sdk.postComment({
32
- tokenName: args.tokenName,
33
- content: args.message, // MCP parameter "message" → SDK parameter "content"
34
- privateKey: args.privateKey,
35
- });
36
- // postComment returns void, so return success message
37
- return formatSuccess({ success: true, message: 'Comment posted successfully' });
38
- }),
39
- };
40
-
41
- // 2. Fetch Comments (using centralized pagination defaults)
42
- export const fetchCommentsTool: MCPTool = {
43
- name: 'gala_launchpad_fetch_comments',
44
- description: 'Get comments for a token pool',
45
- inputSchema: {
46
- type: 'object',
47
- properties: {
48
- tokenName: TOKEN_NAME_SCHEMA,
49
- page: PAGE_SCHEMA,
50
- limit: createLimitSchema('comment', 20),
51
- },
52
- required: ['tokenName'],
53
- },
54
- handler: withErrorHandling(async (sdk, args) => {
55
- const pagination = applyOperationPaginationDefaults(args, 'comment');
56
- const result = await sdk.fetchComments({
57
- tokenName: args.tokenName,
58
- ...pagination,
59
- });
60
- return formatSuccess(result);
61
- }),
62
- };
63
-
64
- export const socialTools: MCPTool[] = [postCommentTool, fetchCommentsTool];