@gala-chain/launchpad-mcp-server 1.18.0 → 1.19.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 (101) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/README.md +83 -3
  3. package/dist/generated/version.d.ts +1 -1
  4. package/dist/generated/version.js +1 -1
  5. package/dist/prompts/create-token.d.ts +15 -0
  6. package/dist/prompts/create-token.d.ts.map +1 -0
  7. package/dist/prompts/create-token.js +106 -0
  8. package/dist/prompts/create-token.js.map +1 -0
  9. package/dist/prompts/dex-trading.d.ts +18 -0
  10. package/dist/prompts/dex-trading.d.ts.map +1 -0
  11. package/dist/prompts/dex-trading.js +83 -0
  12. package/dist/prompts/dex-trading.js.map +1 -0
  13. package/dist/prompts/discover-tokens.d.ts +15 -0
  14. package/dist/prompts/discover-tokens.d.ts.map +1 -0
  15. package/dist/prompts/discover-tokens.js +78 -0
  16. package/dist/prompts/discover-tokens.js.map +1 -0
  17. package/dist/prompts/index.d.ts +9 -4
  18. package/dist/prompts/index.d.ts.map +1 -1
  19. package/dist/prompts/index.js +20 -3
  20. package/dist/prompts/index.js.map +1 -1
  21. package/dist/prompts/utils/workflowTemplates.d.ts +28 -0
  22. package/dist/prompts/utils/workflowTemplates.d.ts.map +1 -1
  23. package/dist/prompts/utils/workflowTemplates.js +136 -0
  24. package/dist/prompts/utils/workflowTemplates.js.map +1 -1
  25. package/dist/tools/dex/index.d.ts +14 -0
  26. package/dist/tools/dex/index.d.ts.map +1 -0
  27. package/dist/tools/dex/index.js +202 -0
  28. package/dist/tools/dex/index.js.map +1 -0
  29. package/dist/tools/index.d.ts +1 -1
  30. package/dist/tools/index.d.ts.map +1 -1
  31. package/dist/tools/index.js +18 -12
  32. package/dist/tools/index.js.map +1 -1
  33. package/dist/tools/utils/explainSdkUsage.d.ts.map +1 -1
  34. package/dist/tools/utils/explainSdkUsage.js +94 -1
  35. package/dist/tools/utils/explainSdkUsage.js.map +1 -1
  36. package/dist/utils/validation.d.ts +18 -0
  37. package/dist/utils/validation.d.ts.map +1 -1
  38. package/dist/utils/validation.js +35 -0
  39. package/dist/utils/validation.js.map +1 -1
  40. package/package.json +3 -3
  41. package/docs/AI-AGENT-PATTERNS.md +0 -555
  42. package/docs/CONSTRAINTS-REFERENCE.md +0 -454
  43. package/docs/PROMPT-TOOL-MAPPING.md +0 -352
  44. package/docs/examples/default-values-pattern.md +0 -240
  45. package/docs/examples/tool-factory-pattern.md +0 -217
  46. package/jest.config.js +0 -94
  47. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
  48. package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
  49. package/src/constants/mcpToolNames.ts +0 -141
  50. package/src/index.ts +0 -19
  51. package/src/prompts/__tests__/promptStructure.test.ts +0 -114
  52. package/src/prompts/__tests__/registry.test.ts +0 -145
  53. package/src/prompts/analysis.ts +0 -429
  54. package/src/prompts/index.ts +0 -127
  55. package/src/prompts/portfolio.ts +0 -242
  56. package/src/prompts/trading.ts +0 -191
  57. package/src/prompts/utility.ts +0 -43
  58. package/src/prompts/utils/workflowTemplates.ts +0 -344
  59. package/src/schemas/common-schemas.ts +0 -393
  60. package/src/scripts/test-all-prompts.ts +0 -184
  61. package/src/server.ts +0 -277
  62. package/src/tools/balance/index.ts +0 -174
  63. package/src/tools/creation/index.ts +0 -182
  64. package/src/tools/index.ts +0 -80
  65. package/src/tools/pools/fetchAllPools.ts +0 -47
  66. package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
  67. package/src/tools/pools/fetchPoolDetails.ts +0 -27
  68. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
  69. package/src/tools/pools/fetchPools.ts +0 -47
  70. package/src/tools/pools/fetchPriceHistory.ts +0 -124
  71. package/src/tools/pools/fetchTokenDetails.ts +0 -77
  72. package/src/tools/pools/index.ts +0 -284
  73. package/src/tools/social/index.ts +0 -64
  74. package/src/tools/trading/index.ts +0 -605
  75. package/src/tools/transfers/index.ts +0 -75
  76. package/src/tools/utils/clearCache.ts +0 -36
  77. package/src/tools/utils/createWallet.ts +0 -19
  78. package/src/tools/utils/explainSdkUsage.ts +0 -1420
  79. package/src/tools/utils/getAddress.ts +0 -12
  80. package/src/tools/utils/getCacheInfo.ts +0 -14
  81. package/src/tools/utils/getConfig.ts +0 -11
  82. package/src/tools/utils/getEthereumAddress.ts +0 -12
  83. package/src/tools/utils/getUrlByTokenName.ts +0 -12
  84. package/src/tools/utils/getVersion.ts +0 -25
  85. package/src/tools/utils/getWallet.ts +0 -25
  86. package/src/tools/utils/hasWallet.ts +0 -15
  87. package/src/tools/utils/index.ts +0 -33
  88. package/src/tools/utils/isTokenGraduated.ts +0 -16
  89. package/src/tools/utils/setWallet.ts +0 -41
  90. package/src/types/mcp.ts +0 -72
  91. package/src/utils/__tests__/validation.test.ts +0 -147
  92. package/src/utils/constraints.ts +0 -155
  93. package/src/utils/default-values.ts +0 -208
  94. package/src/utils/error-handler.ts +0 -69
  95. package/src/utils/error-templates.ts +0 -273
  96. package/src/utils/response-formatter.ts +0 -51
  97. package/src/utils/tool-factory.ts +0 -257
  98. package/src/utils/tool-registry.ts +0 -296
  99. package/src/utils/validation.ts +0 -336
  100. package/tests/wallet-management-integration.test.ts +0 -284
  101. package/tsconfig.json +0 -23
package/src/server.ts DELETED
@@ -1,277 +0,0 @@
1
- /**
2
- * Gala Launchpad MCP Server
3
- *
4
- * Provides MCP tools for AI agents to interact with Gala Launchpad
5
- */
6
-
7
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
8
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
- import {
10
- ListToolsRequestSchema,
11
- CallToolRequestSchema,
12
- ListPromptsRequestSchema,
13
- GetPromptRequestSchema,
14
- } from '@modelcontextprotocol/sdk/types.js';
15
- import { AgentConfig, type LaunchpadSDK } from '@gala-chain/launchpad-sdk';
16
- import { tools } from './tools/index.js';
17
- import { prompts, getPrompt } from './prompts/index.js';
18
-
19
- export class LaunchpadMCPServer {
20
- private server: Server;
21
- private sdk: LaunchpadSDK | null = null;
22
- private debug: boolean;
23
-
24
- constructor() {
25
- this.debug = process.env.DEBUG === 'true';
26
-
27
- this.server = new Server(
28
- {
29
- name: '@gala-chain/launchpad-mcp-server',
30
- version: '1.5.0',
31
- },
32
- {
33
- capabilities: {
34
- tools: {},
35
- prompts: {
36
- listChanged: true,
37
- },
38
- },
39
- }
40
- );
41
-
42
- this.setupToolHandlers();
43
- this.setupPromptHandlers();
44
- this.setupErrorHandlers();
45
- }
46
-
47
- /**
48
- * Initialize SDK with AgentConfig
49
- *
50
- * Supports two operational modes:
51
- * 1. Full-access mode (PRIVATE_KEY provided): Uses quickSetup() - all operations available
52
- * 2. Read-only mode (PRIVATE_KEY not provided): Uses readOnlySetup() - query operations only
53
- *
54
- * In read-only mode, signing operations (buy, sell, create tokens, etc.) will throw ValidationError
55
- * when attempted, but all query operations (fetchPools, fetchBalance, etc.) work normally.
56
- */
57
- async initialize() {
58
- try {
59
- if (this.debug) {
60
- console.error('[MCP Server] Initializing SDK...');
61
- }
62
-
63
- const hasPrivateKey = Boolean(process.env.PRIVATE_KEY && process.env.PRIVATE_KEY.trim());
64
- const environment = (process.env.ENVIRONMENT as any) || 'production';
65
- const timeout = parseInt(process.env.TIMEOUT || '30000', 10);
66
-
67
- if (hasPrivateKey) {
68
- // Full-access mode: use quickSetup() to enable signing operations
69
- if (this.debug) {
70
- console.error('[MCP Server] PRIVATE_KEY detected - initializing in full-access mode');
71
- }
72
-
73
- const { sdk, validation } = await AgentConfig.quickSetup({
74
- environment,
75
- privateKey: process.env.PRIVATE_KEY,
76
- timeout,
77
- debug: this.debug,
78
- autoValidate: false,
79
- });
80
-
81
- this.sdk = sdk;
82
-
83
- if (this.debug) {
84
- console.error('[MCP Server] SDK initialized successfully (full-access mode)');
85
- if (validation) {
86
- console.error(`[MCP Server] Validation - Ready: ${validation.ready}`);
87
- console.error(`[MCP Server] Validation - Can Trade: ${validation.capabilities.canTrade}`);
88
- }
89
- }
90
-
91
- if (validation && !validation.ready) {
92
- console.error('[MCP Server] Warning: SDK not ready', validation.issues);
93
- }
94
- } else {
95
- // Read-only mode: use readOnlySetup() for query-only operations
96
- if (this.debug) {
97
- console.error('[MCP Server] PRIVATE_KEY not provided - initializing in read-only mode');
98
- }
99
-
100
- const { sdk } = await AgentConfig.readOnlySetup({
101
- environment,
102
- timeout,
103
- debug: this.debug,
104
- });
105
-
106
- this.sdk = sdk;
107
-
108
- if (this.debug) {
109
- console.error('[MCP Server] SDK initialized successfully (read-only mode)');
110
- console.error('[MCP Server] Note: Signing operations will fail - wallet required');
111
- }
112
- }
113
- } catch (error) {
114
- console.error('[MCP Server] Failed to initialize SDK:', error);
115
- throw error;
116
- }
117
- }
118
-
119
- /**
120
- * Setup tool handlers
121
- */
122
- private setupToolHandlers() {
123
- // Register tools/list handler
124
- this.server.setRequestHandler(ListToolsRequestSchema, async () => {
125
- if (this.debug) {
126
- console.error(`[MCP Server] Listing ${tools.length} tools`);
127
- }
128
-
129
- return {
130
- tools: tools.map((tool) => ({
131
- name: tool.name,
132
- description: tool.description,
133
- inputSchema: tool.inputSchema,
134
- })),
135
- };
136
- });
137
-
138
- // Register tools/call handler
139
- this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
140
- const toolName = request.params.name as string;
141
- const args = request.params.arguments || {};
142
-
143
- if (this.debug) {
144
- console.error(`[MCP Server] Executing tool: ${toolName}`);
145
- console.error(`[MCP Server] Arguments:`, JSON.stringify(args, null, 2));
146
- }
147
-
148
- const tool = tools.find((t) => t.name === toolName);
149
-
150
- if (!tool) {
151
- throw new Error(`Tool not found: ${toolName}`);
152
- }
153
-
154
- if (!this.sdk) {
155
- throw new Error('SDK not initialized. Failed during startup - check logs for details.');
156
- }
157
-
158
- try {
159
- const result = await tool.handler(this.sdk, args);
160
-
161
- if (this.debug) {
162
- console.error(`[MCP Server] Tool execution successful: ${toolName}`);
163
- }
164
-
165
- return result as any;
166
- } catch (error) {
167
- console.error(`[MCP Server] Tool execution failed: ${toolName}`, error);
168
- throw error;
169
- }
170
- });
171
- }
172
-
173
- /**
174
- * Setup prompt handlers
175
- */
176
- private setupPromptHandlers() {
177
- // Register prompts/list handler
178
- this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
179
- if (this.debug) {
180
- console.error(`[MCP Server] Listing ${prompts.length} prompts`);
181
- }
182
-
183
- return {
184
- prompts: prompts.map((prompt) => ({
185
- name: prompt.name,
186
- description: prompt.description,
187
- arguments: prompt.arguments || [],
188
- })),
189
- };
190
- });
191
-
192
- // Register prompts/get handler
193
- this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
194
- const promptName = request.params.name as string;
195
- const args = (request.params.arguments || {}) as Record<string, string>;
196
-
197
- if (this.debug) {
198
- console.error(`[MCP Server] Getting prompt: ${promptName}`);
199
- console.error(`[MCP Server] Arguments:`, JSON.stringify(args, null, 2));
200
- }
201
-
202
- const prompt = getPrompt(promptName);
203
-
204
- if (!prompt) {
205
- throw new Error(`Prompt not found: ${promptName}`);
206
- }
207
-
208
- try {
209
- const messages = prompt.handler(args);
210
-
211
- if (this.debug) {
212
- console.error(`[MCP Server] Prompt generated ${messages.length} messages`);
213
- }
214
-
215
- return {
216
- messages,
217
- };
218
- } catch (error) {
219
- console.error(`[MCP Server] Prompt generation failed: ${promptName}`, error);
220
- throw error;
221
- }
222
- });
223
- }
224
-
225
- /**
226
- * Setup error handlers
227
- */
228
- private setupErrorHandlers() {
229
- this.server.onerror = (error) => {
230
- console.error('[MCP Server] Protocol error:', error);
231
- };
232
-
233
- process.on('SIGINT', () => {
234
- if (this.debug) {
235
- console.error('[MCP Server] Received SIGINT, shutting down...');
236
- }
237
- this.cleanup();
238
- process.exit(0);
239
- });
240
-
241
- process.on('SIGTERM', () => {
242
- if (this.debug) {
243
- console.error('[MCP Server] Received SIGTERM, shutting down...');
244
- }
245
- this.cleanup();
246
- process.exit(0);
247
- });
248
- }
249
-
250
- /**
251
- * Start the MCP server
252
- */
253
- async start() {
254
- await this.initialize();
255
-
256
- const transport = new StdioServerTransport();
257
- await this.server.connect(transport);
258
-
259
- if (this.debug) {
260
- console.error('[MCP Server] Gala Launchpad MCP server running on stdio');
261
- console.error(`[MCP Server] Registered ${tools.length} tools`);
262
- console.error(`[MCP Server] Registered ${prompts.length} prompts (slash commands)`);
263
- }
264
- }
265
-
266
- /**
267
- * Cleanup resources
268
- */
269
- cleanup() {
270
- if (this.sdk) {
271
- this.sdk.cleanup();
272
- if (this.debug) {
273
- console.error('[MCP Server] SDK cleaned up');
274
- }
275
- }
276
- }
277
- }
@@ -1,174 +0,0 @@
1
- /**
2
- * Balance & Portfolio Tools
3
- */
4
-
5
- import type { MCPTool } from '../../types/mcp.js';
6
- import { formatSuccess, formatBoolean } from '../../utils/response-formatter.js';
7
- import { withErrorHandling } from '../../utils/error-handler.js';
8
- import {
9
- TOKEN_NAME_SCHEMA,
10
- ADDRESS_SCHEMA,
11
- PAGE_SCHEMA,
12
- createLimitSchema,
13
- SEARCH_SCHEMA,
14
- FULL_NAME_SCHEMA,
15
- PRIVATE_KEY_SCHEMA,
16
- } from '../../schemas/common-schemas.js';
17
- import { applyOperationPaginationDefaults } from '../../utils/default-values.js';
18
-
19
- // 1. Fetch GALA Balance
20
- export const fetchGalaBalanceTool: MCPTool = {
21
- name: 'gala_launchpad_fetch_gala_balance',
22
- description: 'Get GALA balance for a wallet',
23
- inputSchema: {
24
- type: 'object',
25
- properties: {
26
- address: {
27
- ...ADDRESS_SCHEMA,
28
- description: 'Wallet address (optional, defaults to SDK wallet)',
29
- },
30
- },
31
- },
32
- handler: withErrorHandling(async (sdk, args) => {
33
- const result = await sdk.fetchGalaBalance(args.address);
34
- return formatSuccess(result);
35
- }),
36
- };
37
-
38
- // 2. Fetch Token Balance (Optimized Single-Token Lookup)
39
- export const fetchTokenBalanceTool: MCPTool = {
40
- name: 'gala_launchpad_fetch_token_balance',
41
- description: 'Get token balance for a specific token. Automatically routes to the correct backend: GalaChain for standard tokens (GALA, GUSDC) or launchpad backend for launchpad tokens (anime, etc.).',
42
- inputSchema: {
43
- type: 'object',
44
- properties: {
45
- tokenName: TOKEN_NAME_SCHEMA,
46
- address: ADDRESS_SCHEMA,
47
- },
48
- required: ['tokenName', 'address'],
49
- },
50
- handler: withErrorHandling(async (sdk, args) => {
51
- // SDK now handles routing: tokenId → GalaChain, tokenName → launchpad backend
52
- const result = await sdk.fetchTokenBalance({
53
- tokenName: args.tokenName,
54
- address: args.address
55
- });
56
- return formatSuccess(result);
57
- }),
58
- };
59
-
60
- // 3. Fetch Tokens Held (with Filtering Support)
61
- export const fetchTokensHeldTool: MCPTool = {
62
- name: 'gala_launchpad_fetch_tokens_held',
63
- description: 'Get tokens held by a wallet with optional filtering. Supports exact match (tokenName) and fuzzy search (search) for efficient backend filtering.',
64
- inputSchema: {
65
- type: 'object',
66
- properties: {
67
- address: ADDRESS_SCHEMA,
68
- page: PAGE_SCHEMA,
69
- limit: createLimitSchema('user', 20),
70
- tokenName: {
71
- ...TOKEN_NAME_SCHEMA,
72
- description: 'Optional token name (exact match filter)',
73
- },
74
- search: SEARCH_SCHEMA,
75
- },
76
- required: ['address'],
77
- },
78
- handler: withErrorHandling(async (sdk, args) => {
79
- const pagination = applyOperationPaginationDefaults(args, 'user');
80
- const result = await sdk.fetchTokensHeld({
81
- ...pagination,
82
- tokenName: args.tokenName,
83
- search: args.search,
84
- address: args.address,
85
- });
86
- return formatSuccess(result);
87
- }),
88
- };
89
-
90
- // 4. Fetch Tokens Created (with Filtering Support)
91
- export const fetchTokensCreatedTool: MCPTool = {
92
- name: 'gala_launchpad_fetch_tokens_created',
93
- description: 'Get tokens created by a wallet with optional filtering. Supports exact match (tokenName) and fuzzy search (search) for efficient backend filtering.',
94
- inputSchema: {
95
- type: 'object',
96
- properties: {
97
- address: ADDRESS_SCHEMA,
98
- page: PAGE_SCHEMA,
99
- limit: createLimitSchema('user', 20),
100
- tokenName: {
101
- ...TOKEN_NAME_SCHEMA,
102
- description: 'Optional token name (exact match filter)',
103
- },
104
- search: SEARCH_SCHEMA,
105
- },
106
- required: ['address'],
107
- },
108
- handler: withErrorHandling(async (sdk, args) => {
109
- const pagination = applyOperationPaginationDefaults(args, 'user');
110
- const result = await sdk.fetchTokensCreated({
111
- ...pagination,
112
- tokenName: args.tokenName,
113
- search: args.search,
114
- address: args.address,
115
- });
116
- return formatSuccess(result);
117
- }),
118
- };
119
-
120
- // 5. Fetch Profile
121
- export const fetchProfileTool: MCPTool = {
122
- name: 'gala_launchpad_fetch_profile',
123
- description: 'Get user profile data',
124
- inputSchema: {
125
- type: 'object',
126
- properties: {
127
- address: {
128
- ...ADDRESS_SCHEMA,
129
- description: 'Wallet address (optional, defaults to SDK wallet)',
130
- },
131
- },
132
- },
133
- handler: withErrorHandling(async (sdk, args) => {
134
- const result = await sdk.fetchProfile(args.address);
135
- return formatSuccess(result);
136
- }),
137
- };
138
-
139
- // 6. Update Profile
140
- export const updateProfileTool: MCPTool = {
141
- name: 'gala_launchpad_update_profile',
142
- description: 'Update user profile',
143
- inputSchema: {
144
- type: 'object',
145
- properties: {
146
- fullName: FULL_NAME_SCHEMA,
147
- profileImage: {
148
- type: 'string',
149
- description: 'Profile image URL or empty string',
150
- },
151
- address: ADDRESS_SCHEMA,
152
- privateKey: PRIVATE_KEY_SCHEMA,
153
- },
154
- required: ['fullName', 'profileImage', 'address'],
155
- },
156
- handler: withErrorHandling(async (sdk, args) => {
157
- await sdk.updateProfile({
158
- fullName: args.fullName,
159
- profileImage: args.profileImage,
160
- address: args.address,
161
- privateKey: args.privateKey,
162
- });
163
- return formatBoolean(true, 'Profile updated successfully');
164
- }),
165
- };
166
-
167
- export const balanceTools: MCPTool[] = [
168
- fetchGalaBalanceTool,
169
- fetchTokenBalanceTool,
170
- fetchTokensHeldTool,
171
- fetchTokensCreatedTool,
172
- fetchProfileTool,
173
- updateProfileTool,
174
- ];
@@ -1,182 +0,0 @@
1
- /**
2
- * Token Creation 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 { createNoParamTool } from '../../utils/tool-factory.js';
9
- import {
10
- TOKEN_NAME_SCHEMA,
11
- TOKEN_SYMBOL_SCHEMA,
12
- TOKEN_DESCRIPTION_SCHEMA,
13
- PRE_BUY_QUANTITY_SCHEMA,
14
- URL_SCHEMA,
15
- PRIVATE_KEY_SCHEMA,
16
- ADDRESS_SCHEMA,
17
- } from '../../schemas/common-schemas.js';
18
-
19
- // 1. Launch Token
20
- export const launchTokenTool: MCPTool = {
21
- name: 'gala_launchpad_launch_token',
22
- description: `Create a new token on the launchpad.
23
-
24
- WORKFLOW:
25
- 1. checkTokenName() → Verify name is available
26
- 2. checkTokenSymbol() → Verify symbol is available
27
- 3. launchToken() → Create token with validated name/symbol
28
- 4. getUrlByTokenName() → Get frontend URL for the new token
29
-
30
- REQUIREMENT: At least one social URL (websiteUrl, twitterUrl, or telegramUrl) is required.
31
-
32
- RETURNS: Transaction details including token name, symbol, creator address, and transaction ID`,
33
- inputSchema: {
34
- type: 'object',
35
- properties: {
36
- tokenName: TOKEN_NAME_SCHEMA,
37
- tokenSymbol: TOKEN_SYMBOL_SCHEMA,
38
- tokenDescription: TOKEN_DESCRIPTION_SCHEMA,
39
- tokenImage: {
40
- ...URL_SCHEMA,
41
- description: 'Token image URL',
42
- },
43
- preBuyQuantity: PRE_BUY_QUANTITY_SCHEMA,
44
- websiteUrl: {
45
- ...URL_SCHEMA,
46
- description: 'Website URL (optional)',
47
- },
48
- telegramUrl: {
49
- ...URL_SCHEMA,
50
- description: 'Telegram channel URL (optional)',
51
- },
52
- twitterUrl: {
53
- ...URL_SCHEMA,
54
- description: 'Twitter profile URL (optional)',
55
- },
56
- tokenCategory: {
57
- type: 'string',
58
- description: 'Token category (defaults to "Unit")',
59
- },
60
- tokenCollection: {
61
- type: 'string',
62
- description: 'Token collection (defaults to "Token")',
63
- },
64
- reverseBondingCurveConfiguration: {
65
- type: 'object',
66
- properties: {
67
- minFeePortion: {
68
- type: 'string',
69
- description: 'Minimum fee portion',
70
- },
71
- maxFeePortion: {
72
- type: 'string',
73
- description: 'Maximum fee portion',
74
- },
75
- },
76
- description: 'Reverse bonding curve configuration (optional, uses defaults)',
77
- },
78
- privateKey: PRIVATE_KEY_SCHEMA,
79
- },
80
- required: [
81
- 'tokenName',
82
- 'tokenSymbol',
83
- 'tokenDescription',
84
- 'tokenImage',
85
- ],
86
- },
87
- handler: withErrorHandling(async (sdk, args) => {
88
- const result = await sdk.launchToken(args);
89
- return formatSuccess(result);
90
- }),
91
- };
92
-
93
- // 2. Upload Token Image
94
- export const uploadTokenImageTool: MCPTool = {
95
- name: 'gala_launchpad_upload_token_image',
96
- description: 'Upload token image from filesystem (Node.js only)',
97
- inputSchema: {
98
- type: 'object',
99
- properties: {
100
- tokenName: {
101
- ...TOKEN_NAME_SCHEMA,
102
- description: 'Token name (2-20 lowercase alphanumeric)',
103
- },
104
- imagePath: {
105
- type: 'string',
106
- description: 'Absolute file path to image file',
107
- },
108
- privateKey: PRIVATE_KEY_SCHEMA,
109
- },
110
- required: ['tokenName', 'imagePath'],
111
- },
112
- handler: withErrorHandling(async (sdk, args) => {
113
- const fs = await import('fs/promises');
114
- const fileBuffer = await fs.readFile(args.imagePath);
115
-
116
- const result = await sdk.uploadTokenImage({
117
- tokenName: args.tokenName,
118
- options: {
119
- file: fileBuffer,
120
- tokenName: args.tokenName,
121
- },
122
- privateKey: args.privateKey,
123
- });
124
- return formatSuccess(result);
125
- }),
126
- };
127
-
128
- // 3. Upload Profile Image
129
- export const uploadProfileImageTool: MCPTool = {
130
- name: 'gala_launchpad_upload_profile_image',
131
- description: 'Upload profile image from filesystem (Node.js only)',
132
- inputSchema: {
133
- type: 'object',
134
- properties: {
135
- imagePath: {
136
- type: 'string',
137
- description: 'Absolute file path to image file',
138
- },
139
- address: {
140
- ...ADDRESS_SCHEMA,
141
- description: 'Optional wallet address (defaults to authenticated user)',
142
- },
143
- privateKey: PRIVATE_KEY_SCHEMA,
144
- },
145
- required: ['imagePath'],
146
- },
147
- handler: withErrorHandling(async (sdk, args) => {
148
- const fs = await import('fs/promises');
149
- const fileBuffer = await fs.readFile(args.imagePath);
150
-
151
- const imageUrl = await sdk.uploadProfileImage({
152
- file: fileBuffer,
153
- address: args.address,
154
- privateKey: args.privateKey,
155
- });
156
-
157
- // If no imageUrl returned but upload succeeded, provide helpful message
158
- if (!imageUrl) {
159
- return formatSuccess({
160
- success: true,
161
- message: 'Profile image uploaded successfully (image stored with wallet address)',
162
- });
163
- }
164
-
165
- return formatSuccess({ success: true, imageUrl });
166
- }),
167
- };
168
-
169
- // 4. Fetch Launch Token Fee (45% code reduction via factory pattern)
170
- export const fetchLaunchTokenFeeTool = createNoParamTool({
171
- name: 'gala_launchpad_fetch_launch_token_fee',
172
- description: 'Fetch the current GALA fee required to launch a new token on the launchpad. Returns a number (e.g., 0.001). This is a dynamic value that may change. Check this before launching a token to ensure sufficient balance.',
173
- handler: (sdk) => sdk.fetchLaunchTokenFee(),
174
- resultKey: 'feeAmount',
175
- });
176
-
177
- export const creationTools: MCPTool[] = [
178
- launchTokenTool,
179
- uploadTokenImageTool,
180
- uploadProfileImageTool,
181
- fetchLaunchTokenFeeTool,
182
- ];
@@ -1,80 +0,0 @@
1
- /**
2
- * Tool Registry
3
- *
4
- * Enhanced tool registry with auto-validation and metadata.
5
- * Uses tool-registry system for robust tool management.
6
- *
7
- * @see src/utils/tool-registry.ts
8
- */
9
-
10
- import { poolTools } from './pools/index.js';
11
- import { tradingTools } from './trading/index.js';
12
- import { balanceTools } from './balance/index.js';
13
- import { creationTools } from './creation/index.js';
14
- import { socialTools } from './social/index.js';
15
- import { transferTools } from './transfers/index.js';
16
- import { utilityTools } from './utils/index.js';
17
- import { createToolRegistry, logToolRegistry } from '../utils/tool-registry.js';
18
-
19
- /**
20
- * Tool categories with metadata
21
- */
22
- const toolCategories = [
23
- {
24
- name: 'pools',
25
- description: 'Pool management, pricing, and token availability checks',
26
- tools: poolTools,
27
- },
28
- {
29
- name: 'trading',
30
- description: 'Token trading operations (buy, sell, calculate amounts)',
31
- tools: tradingTools,
32
- },
33
- {
34
- name: 'balance',
35
- description: 'Balance queries and portfolio management',
36
- tools: balanceTools,
37
- },
38
- {
39
- name: 'creation',
40
- description: 'Token creation and launch operations',
41
- tools: creationTools,
42
- },
43
- {
44
- name: 'social',
45
- description: 'Comments and social interactions',
46
- tools: socialTools,
47
- },
48
- {
49
- name: 'transfers',
50
- description: 'Token and GALA transfer operations',
51
- tools: transferTools,
52
- },
53
- {
54
- name: 'utils',
55
- description: 'Utility tools (wallet, config, SDK documentation)',
56
- tools: utilityTools,
57
- },
58
- ];
59
-
60
- /**
61
- * Enhanced tool registry with validation (57 tools)
62
- */
63
- export const registry = createToolRegistry(toolCategories, 57);
64
-
65
- /**
66
- * Complete tool array (for backward compatibility)
67
- */
68
- export const tools = registry.tools;
69
-
70
- // Log registry statistics in debug mode
71
- if (process.env.DEBUG === 'true') {
72
- logToolRegistry(registry);
73
- }
74
-
75
- // Throw error if registry is invalid
76
- if (!registry.isValid) {
77
- throw new Error(
78
- `Tool registry validation failed:\n${registry.errors.join('\n')}`
79
- );
80
- }