@gala-chain/launchpad-mcp-server 1.23.0 → 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/DRY_REFACTORING_GUIDE.md +272 -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/analysis.d.ts.map +1 -1
- package/dist/prompts/analysis.js +14 -63
- package/dist/prompts/analysis.js.map +1 -1
- package/dist/prompts/balances.d.ts.map +1 -1
- package/dist/prompts/balances.js +46 -70
- package/dist/prompts/balances.js.map +1 -1
- package/dist/prompts/creation-utils.d.ts.map +1 -1
- package/dist/prompts/creation-utils.js +27 -50
- package/dist/prompts/creation-utils.js.map +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/liquidity-positions.d.ts.map +1 -1
- package/dist/prompts/liquidity-positions.js +9 -44
- package/dist/prompts/liquidity-positions.js.map +1 -1
- package/dist/prompts/pools.d.ts.map +1 -1
- package/dist/prompts/pools.js +125 -228
- package/dist/prompts/pools.js.map +1 -1
- package/dist/prompts/portfolio.d.ts.map +1 -1
- package/dist/prompts/portfolio.js +13 -48
- package/dist/prompts/portfolio.js.map +1 -1
- package/dist/prompts/social.d.ts.map +1 -1
- package/dist/prompts/social.js +21 -31
- package/dist/prompts/social.js.map +1 -1
- package/dist/prompts/trading-calculations.d.ts.map +1 -1
- package/dist/prompts/trading-calculations.js +37 -126
- package/dist/prompts/trading-calculations.js.map +1 -1
- package/dist/prompts/trading.d.ts.map +1 -1
- package/dist/prompts/trading.js +23 -60
- package/dist/prompts/trading.js.map +1 -1
- package/dist/prompts/transfers.d.ts.map +1 -1
- package/dist/prompts/transfers.js +21 -31
- package/dist/prompts/transfers.js.map +1 -1
- package/dist/prompts/utility-tools.d.ts.map +1 -1
- package/dist/prompts/utility-tools.js +83 -202
- package/dist/prompts/utility-tools.js.map +1 -1
- package/dist/prompts/utility.d.ts.map +1 -1
- package/dist/prompts/utility.js +5 -20
- package/dist/prompts/utility.js.map +1 -1
- package/dist/prompts/utils/handlerHelpers.d.ts +35 -0
- package/dist/prompts/utils/handlerHelpers.d.ts.map +1 -0
- package/dist/prompts/utils/handlerHelpers.js +53 -0
- package/dist/prompts/utils/handlerHelpers.js.map +1 -0
- package/dist/prompts/utils/textTemplates.d.ts +42 -0
- package/dist/prompts/utils/textTemplates.d.ts.map +1 -0
- package/dist/prompts/utils/textTemplates.js +51 -0
- package/dist/prompts/utils/textTemplates.js.map +1 -0
- 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/dist/utils/validation.d.ts +38 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +52 -0
- package/dist/utils/validation.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/server.test.ts +1 -2
- package/src/constants/mcpToolNames.ts +4 -2
- package/src/prompts/__tests__/promptStructure.test.ts +50 -0
- package/src/prompts/__tests__/registry.test.ts +23 -33
- package/src/prompts/analysis.ts +15 -64
- package/src/prompts/balances.ts +57 -73
- package/src/prompts/creation-utils.ts +34 -49
- package/src/prompts/explore-dex-pools.ts +138 -0
- package/src/prompts/index.ts +5 -2
- package/src/prompts/liquidity-positions.ts +11 -44
- package/src/prompts/pools.ts +156 -231
- package/src/prompts/portfolio.ts +13 -47
- package/src/prompts/social.ts +25 -31
- package/src/prompts/trading-calculations.ts +42 -127
- package/src/prompts/trading.ts +30 -61
- package/src/prompts/transfers.ts +25 -31
- package/src/prompts/utility-tools.ts +116 -199
- package/src/prompts/utility.ts +5 -20
- package/src/prompts/utils/handlerHelpers.ts +55 -0
- package/src/prompts/utils/textTemplates.ts +73 -0
- package/src/tools/dex/fetchAllDexPools.ts +45 -0
- package/src/tools/dex/fetchDexPools.ts +58 -0
- package/src/tools/dex/index.ts +9 -4
- package/src/utils/validation.ts +58 -0
|
@@ -0,0 +1,58 @@
|
|
|
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
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DEX/GalaSwap Trading Operations Tools
|
|
2
|
+
* DEX/GalaSwap Trading Operations Tools & Pool Discovery
|
|
3
3
|
*
|
|
4
|
-
* Tools for trading on GalaSwap DEX after tokens graduate from bonding curves
|
|
5
|
-
*
|
|
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.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
import type { MCPTool } from '../../types/mcp.js';
|
|
9
10
|
import { liquidityPositionTools } from './liquidity-positions.js';
|
|
11
|
+
import { fetchDexPoolsTool } from './fetchDexPools.js';
|
|
12
|
+
import { fetchAllDexPoolsTool } from './fetchAllDexPools.js';
|
|
10
13
|
import { formatSuccess } from '../../utils/response-formatter.js';
|
|
11
14
|
import { withErrorHandling } from '../../utils/error-handler.js';
|
|
12
15
|
import {
|
|
@@ -215,8 +218,10 @@ export const getSwapPoolInfoTool: MCPTool = {
|
|
|
215
218
|
}),
|
|
216
219
|
};
|
|
217
220
|
|
|
218
|
-
// Export all DEX tools (5 swap tools + 8 liquidity position tools =
|
|
221
|
+
// Export all DEX tools (2 pool discovery + 5 swap tools + 8 liquidity position tools = 15 tools)
|
|
219
222
|
export const dexTools: MCPTool[] = [
|
|
223
|
+
fetchDexPoolsTool,
|
|
224
|
+
fetchAllDexPoolsTool,
|
|
220
225
|
getSwapQuoteExactInputTool,
|
|
221
226
|
getSwapQuoteExactOutputTool,
|
|
222
227
|
executeSwapTool,
|
package/src/utils/validation.ts
CHANGED
|
@@ -369,3 +369,61 @@ export function safeValidate(
|
|
|
369
369
|
return { success: false, error: String(error) };
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Validate optional field if present
|
|
375
|
+
*
|
|
376
|
+
* Convenience wrapper for validating optional fields. Only runs validation
|
|
377
|
+
* if the value is defined and not null.
|
|
378
|
+
*
|
|
379
|
+
* @param value - Value to validate (can be undefined)
|
|
380
|
+
* @param validator - Validation function to run if value is present
|
|
381
|
+
* @throws {ValidationError} If validation fails
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* validateOptional(args.slippage, (val) => validateSlippage(val));
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export function validateOptional<T>(
|
|
389
|
+
value: T | undefined | null,
|
|
390
|
+
validator: (val: T) => void
|
|
391
|
+
): void {
|
|
392
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
393
|
+
validator(value as T);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Validate optional slippage field
|
|
399
|
+
*
|
|
400
|
+
* @param slippage - Slippage value to validate (optional)
|
|
401
|
+
* @throws {ValidationError} If slippage is invalid
|
|
402
|
+
*/
|
|
403
|
+
export function validateOptionalSlippage(slippage?: string | number): void {
|
|
404
|
+
validateOptional(slippage, (val) => validateSlippage(val));
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Validate optional pagination limit field
|
|
409
|
+
*
|
|
410
|
+
* @param limit - Limit value to validate (optional)
|
|
411
|
+
* @param max - Maximum allowed limit (default: 100)
|
|
412
|
+
* @throws {ValidationError} If limit is invalid
|
|
413
|
+
*/
|
|
414
|
+
export function validateOptionalLimit(
|
|
415
|
+
limit?: string | number,
|
|
416
|
+
max: number = 100
|
|
417
|
+
): void {
|
|
418
|
+
validateOptional(limit, (val) => validatePaginationLimit(val, max));
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Validate optional address field
|
|
423
|
+
*
|
|
424
|
+
* @param address - Address value to validate (optional)
|
|
425
|
+
* @throws {ValidationError} If address is invalid
|
|
426
|
+
*/
|
|
427
|
+
export function validateOptionalAddress(address?: string): void {
|
|
428
|
+
validateOptional(address, (val) => validateAddress(val));
|
|
429
|
+
}
|