@gala-chain/launchpad-mcp-server 1.24.1 → 1.27.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 (106) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +103 -3
  3. package/dist/constants/mcpToolNames.d.ts +6 -2
  4. package/dist/constants/mcpToolNames.d.ts.map +1 -1
  5. package/dist/constants/mcpToolNames.js +4 -2
  6. package/dist/constants/mcpToolNames.js.map +1 -1
  7. package/dist/generated/version.d.ts +1 -1
  8. package/dist/generated/version.js +1 -1
  9. package/dist/tools/index.d.ts +2 -2
  10. package/dist/tools/index.js +3 -3
  11. package/dist/tools/pools/index.d.ts.map +1 -1
  12. package/dist/tools/pools/index.js +4 -0
  13. package/dist/tools/pools/index.js.map +1 -1
  14. package/dist/tools/pools/onDexPoolCreation.d.ts +6 -0
  15. package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -0
  16. package/dist/tools/pools/onDexPoolCreation.js +58 -0
  17. package/dist/tools/pools/onDexPoolCreation.js.map +1 -0
  18. package/dist/tools/pools/onLaunchpadTokenCreation.d.ts +6 -0
  19. package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -0
  20. package/dist/tools/pools/onLaunchpadTokenCreation.js +52 -0
  21. package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -0
  22. package/package.json +3 -3
  23. package/docs/AI-AGENT-PATTERNS.md +0 -555
  24. package/docs/CONSTRAINTS-REFERENCE.md +0 -454
  25. package/docs/PROMPT-TOOL-MAPPING.md +0 -352
  26. package/docs/examples/default-values-pattern.md +0 -240
  27. package/docs/examples/tool-factory-pattern.md +0 -217
  28. package/jest.config.js +0 -94
  29. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
  30. package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
  31. package/src/__tests__/server.test.ts +0 -255
  32. package/src/constants/mcpToolNames.ts +0 -183
  33. package/src/index.ts +0 -19
  34. package/src/prompts/__tests__/promptStructure.test.ts +0 -187
  35. package/src/prompts/__tests__/registry.test.ts +0 -349
  36. package/src/prompts/analysis.ts +0 -380
  37. package/src/prompts/balances.ts +0 -182
  38. package/src/prompts/create-token.ts +0 -123
  39. package/src/prompts/creation-utils.ts +0 -103
  40. package/src/prompts/dex-trading.ts +0 -86
  41. package/src/prompts/discover-tokens.ts +0 -86
  42. package/src/prompts/explore-dex-pools.ts +0 -138
  43. package/src/prompts/index.ts +0 -178
  44. package/src/prompts/liquidity-positions.ts +0 -237
  45. package/src/prompts/pools.ts +0 -496
  46. package/src/prompts/portfolio.ts +0 -208
  47. package/src/prompts/social.ts +0 -94
  48. package/src/prompts/trading-calculations.ts +0 -414
  49. package/src/prompts/trading.ts +0 -160
  50. package/src/prompts/transfers.ts +0 -97
  51. package/src/prompts/utility-tools.ts +0 -266
  52. package/src/prompts/utility.ts +0 -77
  53. package/src/prompts/utils/handlerHelpers.ts +0 -55
  54. package/src/prompts/utils/textTemplates.ts +0 -73
  55. package/src/prompts/utils/workflowTemplates.ts +0 -511
  56. package/src/schemas/common-schemas.ts +0 -393
  57. package/src/scripts/test-all-prompts.ts +0 -184
  58. package/src/server.ts +0 -367
  59. package/src/tools/__tests__/dex-tools.test.ts +0 -562
  60. package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
  61. package/src/tools/balance/index.ts +0 -174
  62. package/src/tools/creation/index.ts +0 -182
  63. package/src/tools/dex/fetchAllDexPools.ts +0 -45
  64. package/src/tools/dex/fetchDexPools.ts +0 -58
  65. package/src/tools/dex/index.ts +0 -231
  66. package/src/tools/dex/liquidity-positions.ts +0 -547
  67. package/src/tools/index.ts +0 -94
  68. package/src/tools/pools/fetchAllPools.ts +0 -47
  69. package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
  70. package/src/tools/pools/fetchPoolDetails.ts +0 -27
  71. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
  72. package/src/tools/pools/fetchPools.ts +0 -47
  73. package/src/tools/pools/fetchPriceHistory.ts +0 -124
  74. package/src/tools/pools/fetchTokenDetails.ts +0 -77
  75. package/src/tools/pools/index.ts +0 -284
  76. package/src/tools/social/index.ts +0 -64
  77. package/src/tools/trading/index.ts +0 -605
  78. package/src/tools/transfers/index.ts +0 -75
  79. package/src/tools/utils/clearCache.ts +0 -36
  80. package/src/tools/utils/createWallet.ts +0 -19
  81. package/src/tools/utils/explainSdkUsage.ts +0 -1446
  82. package/src/tools/utils/getAddress.ts +0 -12
  83. package/src/tools/utils/getCacheInfo.ts +0 -14
  84. package/src/tools/utils/getConfig.ts +0 -21
  85. package/src/tools/utils/getEnvironment.ts +0 -17
  86. package/src/tools/utils/getEthereumAddress.ts +0 -12
  87. package/src/tools/utils/getUrlByTokenName.ts +0 -12
  88. package/src/tools/utils/getVersion.ts +0 -25
  89. package/src/tools/utils/getWallet.ts +0 -25
  90. package/src/tools/utils/hasWallet.ts +0 -15
  91. package/src/tools/utils/index.ts +0 -37
  92. package/src/tools/utils/isTokenGraduated.ts +0 -16
  93. package/src/tools/utils/setWallet.ts +0 -41
  94. package/src/tools/utils/switchEnvironment.ts +0 -28
  95. package/src/types/mcp.ts +0 -72
  96. package/src/utils/__tests__/validation.test.ts +0 -147
  97. package/src/utils/constraints.ts +0 -155
  98. package/src/utils/default-values.ts +0 -208
  99. package/src/utils/error-handler.ts +0 -69
  100. package/src/utils/error-templates.ts +0 -273
  101. package/src/utils/response-formatter.ts +0 -51
  102. package/src/utils/tool-factory.ts +0 -303
  103. package/src/utils/tool-registry.ts +0 -296
  104. package/src/utils/validation.ts +0 -429
  105. package/tests/wallet-management-integration.test.ts +0 -284
  106. 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];