@gala-chain/launchpad-mcp-server 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +34 -6
- package/dist/constants/mcpToolNames.d.ts +6 -2
- package/dist/constants/mcpToolNames.d.ts.map +1 -1
- package/dist/constants/mcpToolNames.js +4 -2
- package/dist/constants/mcpToolNames.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/prompts/explore-dex-pools.d.ts +20 -0
- package/dist/prompts/explore-dex-pools.d.ts.map +1 -0
- package/dist/prompts/explore-dex-pools.js +132 -0
- package/dist/prompts/explore-dex-pools.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +6 -3
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/pools.js.map +1 -1
- package/dist/tools/dex/fetchAllDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchAllDexPools.js +45 -0
- package/dist/tools/dex/fetchAllDexPools.js.map +1 -0
- package/dist/tools/dex/fetchDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchDexPools.js +58 -0
- package/dist/tools/dex/fetchDexPools.js.map +1 -0
- package/dist/tools/dex/index.d.ts +4 -3
- package/dist/tools/dex/index.d.ts.map +1 -1
- package/dist/tools/dex/index.js +9 -4
- package/dist/tools/dex/index.js.map +1 -1
- package/docs/AI-AGENT-PATTERNS.md +555 -0
- package/docs/CONSTRAINTS-REFERENCE.md +454 -0
- package/docs/PROMPT-TOOL-MAPPING.md +352 -0
- package/docs/examples/default-values-pattern.md +240 -0
- package/docs/examples/tool-factory-pattern.md +217 -0
- package/jest.config.js +94 -0
- package/package.json +3 -3
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +258 -0
- package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
- package/src/__tests__/server.test.ts +255 -0
- package/src/constants/mcpToolNames.ts +183 -0
- package/src/index.ts +19 -0
- package/src/prompts/__tests__/promptStructure.test.ts +187 -0
- package/src/prompts/__tests__/registry.test.ts +349 -0
- package/src/prompts/analysis.ts +380 -0
- package/src/prompts/balances.ts +182 -0
- package/src/prompts/create-token.ts +123 -0
- package/src/prompts/creation-utils.ts +103 -0
- package/src/prompts/dex-trading.ts +86 -0
- package/src/prompts/discover-tokens.ts +86 -0
- package/src/prompts/explore-dex-pools.ts +138 -0
- package/src/prompts/index.ts +178 -0
- package/src/prompts/liquidity-positions.ts +237 -0
- package/src/prompts/pools.ts +496 -0
- package/src/prompts/portfolio.ts +208 -0
- package/src/prompts/social.ts +94 -0
- package/src/prompts/trading-calculations.ts +414 -0
- package/src/prompts/trading.ts +160 -0
- package/src/prompts/transfers.ts +97 -0
- package/src/prompts/utility-tools.ts +266 -0
- package/src/prompts/utility.ts +77 -0
- package/src/prompts/utils/handlerHelpers.ts +55 -0
- package/src/prompts/utils/textTemplates.ts +73 -0
- package/src/prompts/utils/workflowTemplates.ts +511 -0
- package/src/schemas/common-schemas.ts +393 -0
- package/src/scripts/test-all-prompts.ts +184 -0
- package/src/server.ts +367 -0
- package/src/tools/__tests__/dex-tools.test.ts +562 -0
- package/src/tools/__tests__/liquidity-positions.test.ts +673 -0
- package/src/tools/balance/index.ts +174 -0
- package/src/tools/creation/index.ts +182 -0
- package/src/tools/dex/fetchAllDexPools.ts +45 -0
- package/src/tools/dex/fetchDexPools.ts +58 -0
- package/src/tools/dex/index.ts +231 -0
- package/src/tools/dex/liquidity-positions.ts +547 -0
- package/src/tools/index.ts +94 -0
- package/src/tools/pools/fetchAllPools.ts +47 -0
- package/src/tools/pools/fetchAllPriceHistory.ts +119 -0
- package/src/tools/pools/fetchPoolDetails.ts +27 -0
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
- package/src/tools/pools/fetchPools.ts +47 -0
- package/src/tools/pools/fetchPriceHistory.ts +124 -0
- package/src/tools/pools/fetchTokenDetails.ts +77 -0
- package/src/tools/pools/index.ts +284 -0
- package/src/tools/social/index.ts +64 -0
- package/src/tools/trading/index.ts +605 -0
- package/src/tools/transfers/index.ts +75 -0
- package/src/tools/utils/clearCache.ts +36 -0
- package/src/tools/utils/createWallet.ts +19 -0
- package/src/tools/utils/explainSdkUsage.ts +1446 -0
- package/src/tools/utils/getAddress.ts +12 -0
- package/src/tools/utils/getCacheInfo.ts +14 -0
- package/src/tools/utils/getConfig.ts +21 -0
- package/src/tools/utils/getEnvironment.ts +17 -0
- package/src/tools/utils/getEthereumAddress.ts +12 -0
- package/src/tools/utils/getUrlByTokenName.ts +12 -0
- package/src/tools/utils/getVersion.ts +25 -0
- package/src/tools/utils/getWallet.ts +25 -0
- package/src/tools/utils/hasWallet.ts +15 -0
- package/src/tools/utils/index.ts +37 -0
- package/src/tools/utils/isTokenGraduated.ts +16 -0
- package/src/tools/utils/setWallet.ts +41 -0
- package/src/tools/utils/switchEnvironment.ts +28 -0
- package/src/types/mcp.ts +72 -0
- package/src/utils/__tests__/validation.test.ts +147 -0
- package/src/utils/constraints.ts +155 -0
- package/src/utils/default-values.ts +208 -0
- package/src/utils/error-handler.ts +69 -0
- package/src/utils/error-templates.ts +273 -0
- package/src/utils/response-formatter.ts +51 -0
- package/src/utils/tool-factory.ts +303 -0
- package/src/utils/tool-registry.ts +296 -0
- package/src/utils/validation.ts +429 -0
- package/tests/wallet-management-integration.test.ts +284 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,284 @@
|
|
|
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
|
+
];
|
|
@@ -0,0 +1,64 @@
|
|
|
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];
|