@gala-chain/launchpad-mcp-server 1.24.1 → 1.25.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.
- package/CHANGELOG.md +30 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +3 -3
- package/dist/tools/pools/index.d.ts.map +1 -1
- package/dist/tools/pools/index.js +4 -0
- package/dist/tools/pools/index.js.map +1 -1
- package/dist/tools/pools/onDexPoolCreation.d.ts +6 -0
- package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -0
- package/dist/tools/pools/onDexPoolCreation.js +60 -0
- package/dist/tools/pools/onDexPoolCreation.js.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts +6 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js +54 -0
- package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -0
- package/package.json +2 -2
- package/docs/AI-AGENT-PATTERNS.md +0 -555
- package/docs/CONSTRAINTS-REFERENCE.md +0 -454
- package/docs/PROMPT-TOOL-MAPPING.md +0 -352
- package/docs/examples/default-values-pattern.md +0 -240
- package/docs/examples/tool-factory-pattern.md +0 -217
- package/jest.config.js +0 -94
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
- package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
- package/src/__tests__/server.test.ts +0 -255
- package/src/constants/mcpToolNames.ts +0 -183
- package/src/index.ts +0 -19
- package/src/prompts/__tests__/promptStructure.test.ts +0 -187
- package/src/prompts/__tests__/registry.test.ts +0 -349
- package/src/prompts/analysis.ts +0 -380
- package/src/prompts/balances.ts +0 -182
- package/src/prompts/create-token.ts +0 -123
- package/src/prompts/creation-utils.ts +0 -103
- package/src/prompts/dex-trading.ts +0 -86
- package/src/prompts/discover-tokens.ts +0 -86
- package/src/prompts/explore-dex-pools.ts +0 -138
- package/src/prompts/index.ts +0 -178
- package/src/prompts/liquidity-positions.ts +0 -237
- package/src/prompts/pools.ts +0 -496
- package/src/prompts/portfolio.ts +0 -208
- package/src/prompts/social.ts +0 -94
- package/src/prompts/trading-calculations.ts +0 -414
- package/src/prompts/trading.ts +0 -160
- package/src/prompts/transfers.ts +0 -97
- package/src/prompts/utility-tools.ts +0 -266
- package/src/prompts/utility.ts +0 -77
- package/src/prompts/utils/handlerHelpers.ts +0 -55
- package/src/prompts/utils/textTemplates.ts +0 -73
- package/src/prompts/utils/workflowTemplates.ts +0 -511
- package/src/schemas/common-schemas.ts +0 -393
- package/src/scripts/test-all-prompts.ts +0 -184
- package/src/server.ts +0 -367
- package/src/tools/__tests__/dex-tools.test.ts +0 -562
- package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
- package/src/tools/balance/index.ts +0 -174
- package/src/tools/creation/index.ts +0 -182
- package/src/tools/dex/fetchAllDexPools.ts +0 -45
- package/src/tools/dex/fetchDexPools.ts +0 -58
- package/src/tools/dex/index.ts +0 -231
- package/src/tools/dex/liquidity-positions.ts +0 -547
- package/src/tools/index.ts +0 -94
- package/src/tools/pools/fetchAllPools.ts +0 -47
- package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
- package/src/tools/pools/fetchPoolDetails.ts +0 -27
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
- package/src/tools/pools/fetchPools.ts +0 -47
- package/src/tools/pools/fetchPriceHistory.ts +0 -124
- package/src/tools/pools/fetchTokenDetails.ts +0 -77
- package/src/tools/pools/index.ts +0 -284
- package/src/tools/social/index.ts +0 -64
- package/src/tools/trading/index.ts +0 -605
- package/src/tools/transfers/index.ts +0 -75
- package/src/tools/utils/clearCache.ts +0 -36
- package/src/tools/utils/createWallet.ts +0 -19
- package/src/tools/utils/explainSdkUsage.ts +0 -1446
- package/src/tools/utils/getAddress.ts +0 -12
- package/src/tools/utils/getCacheInfo.ts +0 -14
- package/src/tools/utils/getConfig.ts +0 -21
- package/src/tools/utils/getEnvironment.ts +0 -17
- package/src/tools/utils/getEthereumAddress.ts +0 -12
- package/src/tools/utils/getUrlByTokenName.ts +0 -12
- package/src/tools/utils/getVersion.ts +0 -25
- package/src/tools/utils/getWallet.ts +0 -25
- package/src/tools/utils/hasWallet.ts +0 -15
- package/src/tools/utils/index.ts +0 -37
- package/src/tools/utils/isTokenGraduated.ts +0 -16
- package/src/tools/utils/setWallet.ts +0 -41
- package/src/tools/utils/switchEnvironment.ts +0 -28
- package/src/types/mcp.ts +0 -72
- package/src/utils/__tests__/validation.test.ts +0 -147
- package/src/utils/constraints.ts +0 -155
- package/src/utils/default-values.ts +0 -208
- package/src/utils/error-handler.ts +0 -69
- package/src/utils/error-templates.ts +0 -273
- package/src/utils/response-formatter.ts +0 -51
- package/src/utils/tool-factory.ts +0 -303
- package/src/utils/tool-registry.ts +0 -296
- package/src/utils/validation.ts +0 -429
- package/tests/wallet-management-integration.test.ts +0 -284
- package/tsconfig.json +0 -23
|
@@ -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,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch All DEX Pools Tool
|
|
3
|
-
*
|
|
4
|
-
* Convenience tool that fetches all available DEX pools with automatic pagination.
|
|
5
|
-
* No page/limit parameters needed - returns ALL pools matching filters.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { MCPTool } from '../../types/mcp.js';
|
|
9
|
-
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
10
|
-
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
11
|
-
|
|
12
|
-
export const fetchAllDexPoolsTool: MCPTool = {
|
|
13
|
-
name: 'gala_launchpad_fetch_all_dex_pools',
|
|
14
|
-
description: 'Fetch all DEX pools with automatic pagination. No page/limit parameters needed - returns ALL pools matching filters.',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
search: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
minLength: 1,
|
|
21
|
-
maxLength: 100,
|
|
22
|
-
description: 'Search filter for token symbols in pool pair (e.g., "GALA", "GUSDC")',
|
|
23
|
-
},
|
|
24
|
-
sortBy: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
enum: ['tvl', 'volume30d', 'volume1d'],
|
|
27
|
-
description: 'Field to sort results by (default: tvl)',
|
|
28
|
-
},
|
|
29
|
-
sortOrder: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
enum: ['asc', 'desc'],
|
|
32
|
-
description: 'Sort order direction (default: desc)',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
37
|
-
const result = await sdk.fetchAllDexPools({
|
|
38
|
-
...(args.search && { search: args.search }),
|
|
39
|
-
...(args.sortBy && { sortBy: args.sortBy }),
|
|
40
|
-
...(args.sortOrder && { sortOrder: args.sortOrder }),
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return formatSuccess(result);
|
|
44
|
-
}),
|
|
45
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch DEX Pools Tool
|
|
3
|
-
*
|
|
4
|
-
* Queries the GalaSwap DEX backend for available liquidity pools with pagination,
|
|
5
|
-
* sorting, and search filtering capabilities.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { MCPTool } from '../../types/mcp.js';
|
|
9
|
-
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
10
|
-
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
11
|
-
|
|
12
|
-
export const fetchDexPoolsTool: MCPTool = {
|
|
13
|
-
name: 'gala_launchpad_fetch_dex_pools',
|
|
14
|
-
description: 'Fetch DEX pools with pagination and filtering - query available liquidity pools on GalaSwap',
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
search: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
minLength: 1,
|
|
21
|
-
maxLength: 100,
|
|
22
|
-
description: 'Search filter for token symbols in pool pair (e.g., "GALA", "GUSDC", "GALA/GUSDC")',
|
|
23
|
-
},
|
|
24
|
-
sortBy: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
enum: ['tvl', 'volume30d', 'volume1d'],
|
|
27
|
-
description: 'Field to sort results by (default: tvl)',
|
|
28
|
-
},
|
|
29
|
-
sortOrder: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
enum: ['asc', 'desc'],
|
|
32
|
-
description: 'Sort order direction (default: desc)',
|
|
33
|
-
},
|
|
34
|
-
page: {
|
|
35
|
-
type: 'number',
|
|
36
|
-
minimum: 1,
|
|
37
|
-
description: 'Page number (1-based pagination, default: 1)',
|
|
38
|
-
},
|
|
39
|
-
limit: {
|
|
40
|
-
type: 'number',
|
|
41
|
-
minimum: 1,
|
|
42
|
-
maximum: 20,
|
|
43
|
-
description: 'Number of results per page (default: 10, maximum: 20)',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
48
|
-
const result = await sdk.fetchDexPools({
|
|
49
|
-
search: args.search,
|
|
50
|
-
sortBy: args.sortBy || 'tvl',
|
|
51
|
-
sortOrder: args.sortOrder || 'desc',
|
|
52
|
-
page: args.page || 1,
|
|
53
|
-
limit: args.limit || 10,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
return formatSuccess(result);
|
|
57
|
-
}),
|
|
58
|
-
};
|
package/src/tools/dex/index.ts
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DEX/GalaSwap Trading Operations Tools & Pool Discovery
|
|
3
|
-
*
|
|
4
|
-
* Tools for trading on GalaSwap DEX after tokens graduate from bonding curves,
|
|
5
|
-
* discovering liquidity pools, and managing positions.
|
|
6
|
-
* Provides quote generation, swap execution, liquidity management, asset management, and pool exploration.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { MCPTool } from '../../types/mcp.js';
|
|
10
|
-
import { liquidityPositionTools } from './liquidity-positions.js';
|
|
11
|
-
import { fetchDexPoolsTool } from './fetchDexPools.js';
|
|
12
|
-
import { fetchAllDexPoolsTool } from './fetchAllDexPools.js';
|
|
13
|
-
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
14
|
-
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
15
|
-
import {
|
|
16
|
-
DECIMAL_AMOUNT_SCHEMA,
|
|
17
|
-
ADDRESS_SCHEMA,
|
|
18
|
-
} from '../../schemas/common-schemas.js';
|
|
19
|
-
|
|
20
|
-
// Token symbol for DEX trading
|
|
21
|
-
const TOKEN_SYMBOL_SCHEMA = {
|
|
22
|
-
type: 'string',
|
|
23
|
-
minLength: 1,
|
|
24
|
-
maxLength: 20,
|
|
25
|
-
description: 'Token symbol (e.g., "GALA", "GUSDC")',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Fee tier for GalaSwap (in basis points)
|
|
29
|
-
const FEE_TIER_SCHEMA = {
|
|
30
|
-
type: 'number',
|
|
31
|
-
enum: [500, 3000, 10000],
|
|
32
|
-
description: 'Fee tier in basis points: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Slippage tolerance
|
|
36
|
-
const SLIPPAGE_TOLERANCE_SCHEMA = {
|
|
37
|
-
type: 'number',
|
|
38
|
-
minimum: 0,
|
|
39
|
-
maximum: 1,
|
|
40
|
-
description: 'Slippage tolerance as decimal (e.g., 0.01 for 1%)',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// 1. Get Swap Quote (Exact Input)
|
|
44
|
-
export const getSwapQuoteExactInputTool: MCPTool = {
|
|
45
|
-
name: 'gala_launchpad_get_swap_quote_exact_input',
|
|
46
|
-
description:
|
|
47
|
-
'Get swap quote for exact input amount - specify how much you want to spend',
|
|
48
|
-
inputSchema: {
|
|
49
|
-
type: 'object',
|
|
50
|
-
properties: {
|
|
51
|
-
fromToken: TOKEN_SYMBOL_SCHEMA,
|
|
52
|
-
toToken: TOKEN_SYMBOL_SCHEMA,
|
|
53
|
-
amount: {
|
|
54
|
-
...DECIMAL_AMOUNT_SCHEMA,
|
|
55
|
-
description: 'Amount of source token to spend',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
required: ['fromToken', 'toToken', 'amount'],
|
|
59
|
-
},
|
|
60
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
61
|
-
const quote = await sdk.getSwapQuoteExactInput(args.fromToken, args.toToken, args.amount);
|
|
62
|
-
return formatSuccess({
|
|
63
|
-
fromToken: quote.fromToken,
|
|
64
|
-
toToken: quote.toToken,
|
|
65
|
-
inputAmount: quote.inputAmount,
|
|
66
|
-
estimatedOutput: quote.estimatedOutput,
|
|
67
|
-
feeTier: quote.feeTier,
|
|
68
|
-
priceImpact: quote.priceImpact,
|
|
69
|
-
executionPrice: quote.executionPrice,
|
|
70
|
-
message: `Spending ${quote.inputAmount} ${quote.fromToken}, receiving ~${quote.estimatedOutput} ${quote.toToken}`,
|
|
71
|
-
});
|
|
72
|
-
}),
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// 2. Get Swap Quote (Exact Output)
|
|
76
|
-
export const getSwapQuoteExactOutputTool: MCPTool = {
|
|
77
|
-
name: 'gala_launchpad_get_swap_quote_exact_output',
|
|
78
|
-
description:
|
|
79
|
-
'Get swap quote for exact output amount - specify how much you want to receive',
|
|
80
|
-
inputSchema: {
|
|
81
|
-
type: 'object',
|
|
82
|
-
properties: {
|
|
83
|
-
fromToken: TOKEN_SYMBOL_SCHEMA,
|
|
84
|
-
toToken: TOKEN_SYMBOL_SCHEMA,
|
|
85
|
-
amount: {
|
|
86
|
-
...DECIMAL_AMOUNT_SCHEMA,
|
|
87
|
-
description: 'Desired amount of destination token to receive',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
required: ['fromToken', 'toToken', 'amount'],
|
|
91
|
-
},
|
|
92
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
93
|
-
const quote = await sdk.getSwapQuoteExactOutput(args.fromToken, args.toToken, args.amount);
|
|
94
|
-
return formatSuccess({
|
|
95
|
-
fromToken: quote.fromToken,
|
|
96
|
-
toToken: quote.toToken,
|
|
97
|
-
inputAmount: quote.inputAmount,
|
|
98
|
-
estimatedOutput: quote.estimatedOutput,
|
|
99
|
-
feeTier: quote.feeTier,
|
|
100
|
-
priceImpact: quote.priceImpact,
|
|
101
|
-
executionPrice: quote.executionPrice,
|
|
102
|
-
message: `Spending ~${quote.inputAmount} ${quote.fromToken}, receiving ${quote.estimatedOutput} ${quote.toToken}`,
|
|
103
|
-
});
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// 3. Execute Swap
|
|
108
|
-
export const executeSwapTool: MCPTool = {
|
|
109
|
-
name: 'gala_launchpad_execute_swap',
|
|
110
|
-
description:
|
|
111
|
-
'Execute a token swap on GalaSwap DEX with slippage protection. Get a quote first using getSwapQuote tools.',
|
|
112
|
-
inputSchema: {
|
|
113
|
-
type: 'object',
|
|
114
|
-
properties: {
|
|
115
|
-
fromToken: TOKEN_SYMBOL_SCHEMA,
|
|
116
|
-
toToken: TOKEN_SYMBOL_SCHEMA,
|
|
117
|
-
inputAmount: {
|
|
118
|
-
...DECIMAL_AMOUNT_SCHEMA,
|
|
119
|
-
description: 'Amount of source token to spend',
|
|
120
|
-
},
|
|
121
|
-
estimatedOutput: {
|
|
122
|
-
...DECIMAL_AMOUNT_SCHEMA,
|
|
123
|
-
description: 'Expected output amount from quote (for slippage calculation)',
|
|
124
|
-
},
|
|
125
|
-
feeTier: FEE_TIER_SCHEMA,
|
|
126
|
-
slippageTolerance: {
|
|
127
|
-
...SLIPPAGE_TOLERANCE_SCHEMA,
|
|
128
|
-
default: 0.01,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
required: ['fromToken', 'toToken', 'inputAmount', 'estimatedOutput', 'feeTier'],
|
|
132
|
-
},
|
|
133
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
134
|
-
// Validate wallet before execution by trying to get address
|
|
135
|
-
try {
|
|
136
|
-
sdk.getAddress();
|
|
137
|
-
} catch {
|
|
138
|
-
throw new Error('Wallet not configured - required for swap execution');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const result = await sdk.executeSwap(
|
|
142
|
-
args.fromToken,
|
|
143
|
-
args.toToken,
|
|
144
|
-
args.inputAmount,
|
|
145
|
-
args.estimatedOutput,
|
|
146
|
-
args.feeTier,
|
|
147
|
-
args.slippageTolerance || 0.01
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
return formatSuccess({
|
|
151
|
-
transactionId: result.transactionId,
|
|
152
|
-
status: result.status,
|
|
153
|
-
fromToken: result.fromToken,
|
|
154
|
-
toToken: result.toToken,
|
|
155
|
-
inputAmount: result.inputAmount,
|
|
156
|
-
outputAmount: result.outputAmount,
|
|
157
|
-
feeTier: result.feeTier,
|
|
158
|
-
slippageTolerance: result.slippageTolerance,
|
|
159
|
-
timestamp: result.timestamp.toISOString(),
|
|
160
|
-
message: `Swap completed! Sent ${result.inputAmount} ${result.fromToken}, received ${result.outputAmount} ${result.toToken}`,
|
|
161
|
-
});
|
|
162
|
-
}),
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// 4. Get User Assets
|
|
166
|
-
export const getSwapUserAssetsTool: MCPTool = {
|
|
167
|
-
name: 'gala_launchpad_get_swap_user_assets',
|
|
168
|
-
description: 'Get all token assets and balances for a wallet address',
|
|
169
|
-
inputSchema: {
|
|
170
|
-
type: 'object',
|
|
171
|
-
properties: {
|
|
172
|
-
walletAddress: {
|
|
173
|
-
...ADDRESS_SCHEMA,
|
|
174
|
-
description: 'Wallet address to query (e.g., "0x1234..." or "eth|1234...")',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
required: ['walletAddress'],
|
|
178
|
-
},
|
|
179
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
180
|
-
const assets = await sdk.getSwapUserAssets(args.walletAddress);
|
|
181
|
-
return formatSuccess({
|
|
182
|
-
walletAddress: args.walletAddress,
|
|
183
|
-
assetCount: assets.length,
|
|
184
|
-
assets: assets.map((asset) => ({
|
|
185
|
-
symbol: asset.symbol,
|
|
186
|
-
balance: asset.balance,
|
|
187
|
-
decimals: asset.decimals,
|
|
188
|
-
})),
|
|
189
|
-
message: `${assets.length} assets found for wallet ${args.walletAddress}`,
|
|
190
|
-
});
|
|
191
|
-
}),
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// 5. Get Pool Info
|
|
195
|
-
export const getSwapPoolInfoTool: MCPTool = {
|
|
196
|
-
name: 'gala_launchpad_get_swap_pool_info',
|
|
197
|
-
description:
|
|
198
|
-
'Get liquidity and fee tier information for a token pair on GalaSwap DEX',
|
|
199
|
-
inputSchema: {
|
|
200
|
-
type: 'object',
|
|
201
|
-
properties: {
|
|
202
|
-
tokenA: TOKEN_SYMBOL_SCHEMA,
|
|
203
|
-
tokenB: TOKEN_SYMBOL_SCHEMA,
|
|
204
|
-
},
|
|
205
|
-
required: ['tokenA', 'tokenB'],
|
|
206
|
-
},
|
|
207
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
208
|
-
const poolInfo = await sdk.getSwapPoolInfo(args.tokenA, args.tokenB);
|
|
209
|
-
return formatSuccess({
|
|
210
|
-
tokenA: poolInfo.tokenA,
|
|
211
|
-
tokenB: poolInfo.tokenB,
|
|
212
|
-
liquidity: poolInfo.liquidity,
|
|
213
|
-
feeTiers: poolInfo.feeTiers,
|
|
214
|
-
feeTiersFormatted: poolInfo.feeTiers.map((tier) => `${tier / 100}%`),
|
|
215
|
-
swapCount: poolInfo.swapCount,
|
|
216
|
-
message: `Pool ${args.tokenA}/${args.tokenB} has ${poolInfo.liquidity} liquidity with ${poolInfo.feeTiers.length} fee tiers`,
|
|
217
|
-
});
|
|
218
|
-
}),
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// Export all DEX tools (2 pool discovery + 5 swap tools + 8 liquidity position tools = 15 tools)
|
|
222
|
-
export const dexTools: MCPTool[] = [
|
|
223
|
-
fetchDexPoolsTool,
|
|
224
|
-
fetchAllDexPoolsTool,
|
|
225
|
-
getSwapQuoteExactInputTool,
|
|
226
|
-
getSwapQuoteExactOutputTool,
|
|
227
|
-
executeSwapTool,
|
|
228
|
-
getSwapUserAssetsTool,
|
|
229
|
-
getSwapPoolInfoTool,
|
|
230
|
-
...liquidityPositionTools,
|
|
231
|
-
];
|