@gala-chain/launchpad-mcp-server 1.12.2 → 1.12.4
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 +48 -0
- package/README.md +63 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- 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/poolTools.integration.test.ts +0 -185
- package/src/constants/mcpToolNames.ts +0 -141
- package/src/index.ts +0 -19
- package/src/prompts/__tests__/promptStructure.test.ts +0 -114
- package/src/prompts/__tests__/registry.test.ts +0 -143
- package/src/prompts/analysis.ts +0 -429
- package/src/prompts/index.ts +0 -127
- package/src/prompts/portfolio.ts +0 -242
- package/src/prompts/trading.ts +0 -191
- package/src/prompts/utility.ts +0 -43
- package/src/prompts/utils/workflowTemplates.ts +0 -344
- package/src/schemas/common-schemas.ts +0 -392
- package/src/scripts/test-all-prompts.ts +0 -184
- package/src/server.ts +0 -247
- package/src/tools/balance/index.ts +0 -174
- package/src/tools/creation/index.ts +0 -182
- package/src/tools/index.ts +0 -80
- package/src/tools/pools/fetchAllPools.ts +0 -47
- package/src/tools/pools/fetchAllPriceHistory.ts +0 -101
- package/src/tools/pools/fetchAllPrices.ts +0 -39
- 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 -106
- package/src/tools/pools/fetchPrices.ts +0 -52
- package/src/tools/pools/index.ts +0 -248
- 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 -853
- package/src/tools/utils/getAddress.ts +0 -12
- package/src/tools/utils/getCacheInfo.ts +0 -14
- package/src/tools/utils/getConfig.ts +0 -11
- 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/index.ts +0 -27
- package/src/tools/utils/isTokenGraduated.ts +0 -16
- package/src/types/mcp.ts +0 -72
- package/src/utils/__tests__/validation.test.ts +0 -147
- package/src/utils/constraints.ts +0 -146
- 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 -257
- package/src/utils/tool-registry.ts +0 -296
- package/src/utils/validation.ts +0 -336
- package/tsconfig.json +0 -23
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch All Pools Tool
|
|
3
|
-
*
|
|
4
|
-
* Convenience tool that fetches all available pools with automatic pagination.
|
|
5
|
-
* Equivalent to calling fetchPools with limit: 0.
|
|
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 fetchAllPoolsTool: MCPTool = {
|
|
13
|
-
name: 'gala_launchpad_fetch_all_pools',
|
|
14
|
-
description: 'Fetch all available 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: 'Optional search query (fuzzy match filter)',
|
|
23
|
-
},
|
|
24
|
-
tokenName: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
minLength: 3,
|
|
27
|
-
maxLength: 20,
|
|
28
|
-
pattern: '^[a-zA-Z0-9]{3,20}$',
|
|
29
|
-
description: 'Optional token name (exact match filter)',
|
|
30
|
-
},
|
|
31
|
-
type: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
enum: ['recent', 'popular'],
|
|
34
|
-
description: 'Type of pools to fetch (default: recent)',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
39
|
-
const result = await sdk.fetchAllPools({
|
|
40
|
-
...(args.search && { search: args.search }),
|
|
41
|
-
...(args.tokenName && { tokenName: args.tokenName }),
|
|
42
|
-
...(args.type && { type: args.type }),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return formatSuccess(result);
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch All Price History Tool
|
|
3
|
-
*
|
|
4
|
-
* Queries all historical token price data from MySQL database with automatic pagination.
|
|
5
|
-
* Requires MYSQL_CONNECTION_STRING environment variable to be configured.
|
|
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 fetchAllPriceHistoryTool: MCPTool = {
|
|
13
|
-
name: 'gala_launchpad_fetch_all_price_history',
|
|
14
|
-
description: `Fetch all historical price snapshots for DEX tokens with automatic pagination.
|
|
15
|
-
|
|
16
|
-
**Requirements:**
|
|
17
|
-
- MySQL connection string must be configured (MYSQL_CONNECTION_STRING env var)
|
|
18
|
-
- Node.js environment only (not available in browser)
|
|
19
|
-
- Only works for DEX tokens with price_snapshots table data
|
|
20
|
-
|
|
21
|
-
**Use Cases:**
|
|
22
|
-
- Complete historical price analysis and charting
|
|
23
|
-
- Full price trend identification over time periods
|
|
24
|
-
- Comprehensive volatility analysis
|
|
25
|
-
- Data export for external analytics
|
|
26
|
-
|
|
27
|
-
**Performance:** Automatic pagination (max 100 items per page, combined into single result).`,
|
|
28
|
-
|
|
29
|
-
inputSchema: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {
|
|
32
|
-
tokenId: {
|
|
33
|
-
oneOf: [
|
|
34
|
-
{
|
|
35
|
-
type: 'string',
|
|
36
|
-
description:
|
|
37
|
-
'Pipe-delimited format: "collection|category|type|additionalKey" (e.g., "Token|Unit|GUSDC|eth:...")',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
collection: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Token collection (e.g., "Token")',
|
|
45
|
-
},
|
|
46
|
-
category: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'Token category (e.g., "Unit")',
|
|
49
|
-
},
|
|
50
|
-
type: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
description: 'Token type (e.g., "GUSDC")',
|
|
53
|
-
},
|
|
54
|
-
additionalKey: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
description: 'Additional key (e.g., "eth:0x...")',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
required: ['collection', 'category', 'type', 'additionalKey'],
|
|
60
|
-
description: 'TokenClassKey object format',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
description: 'Token identifier (string or TokenClassKey object)',
|
|
64
|
-
},
|
|
65
|
-
from: {
|
|
66
|
-
type: 'string',
|
|
67
|
-
format: 'date-time',
|
|
68
|
-
description: 'Start date for filtering (ISO 8601 format, defaults to 30 days ago)',
|
|
69
|
-
},
|
|
70
|
-
to: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
format: 'date-time',
|
|
73
|
-
description: 'End date for filtering (ISO 8601 format, defaults to now)',
|
|
74
|
-
},
|
|
75
|
-
sortOrder: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
enum: ['ASC', 'DESC'],
|
|
78
|
-
description: 'Sort order for results (default: DESC for newest-first)',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
required: ['tokenId'],
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
85
|
-
// Convert string dates to Date objects if provided
|
|
86
|
-
const options: any = {
|
|
87
|
-
tokenId: args.tokenId,
|
|
88
|
-
sortOrder: args.sortOrder,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
if (args.from) {
|
|
92
|
-
options.from = new Date(args.from);
|
|
93
|
-
}
|
|
94
|
-
if (args.to) {
|
|
95
|
-
options.to = new Date(args.to);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const result = await sdk.fetchAllPriceHistory(options);
|
|
99
|
-
return formatSuccess(result);
|
|
100
|
-
}),
|
|
101
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch All Latest Prices Tool
|
|
3
|
-
*
|
|
4
|
-
* Queries all latest token prices from MySQL database with automatic pagination.
|
|
5
|
-
* Requires MYSQL_CONNECTION_STRING environment variable to be configured.
|
|
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 fetchAllPricesTool: MCPTool = {
|
|
13
|
-
name: 'gala_launchpad_fetch_all_prices',
|
|
14
|
-
description: `Fetch latest price for all DEX tokens with automatic pagination.
|
|
15
|
-
|
|
16
|
-
**Requirements:**
|
|
17
|
-
- MySQL connection string must be configured (MYSQL_CONNECTION_STRING env var)
|
|
18
|
-
- Node.js environment only (not available in browser)
|
|
19
|
-
- Returns most recent price snapshot per unique token
|
|
20
|
-
|
|
21
|
-
**Use Cases:**
|
|
22
|
-
- Complete market data export
|
|
23
|
-
- Bulk price analysis
|
|
24
|
-
- Full token price catalog
|
|
25
|
-
- Market-wide snapshot
|
|
26
|
-
|
|
27
|
-
**Performance:** Single optimized query using window functions, automatically handles pagination to retrieve all tokens.`,
|
|
28
|
-
|
|
29
|
-
inputSchema: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {},
|
|
32
|
-
required: [],
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
handler: withErrorHandling(async (sdk) => {
|
|
36
|
-
const result = await sdk.fetchAllPrices();
|
|
37
|
-
return formatSuccess(result);
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch Pool Details Tool
|
|
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
|
-
|
|
9
|
-
export const fetchPoolDetailsTool: MCPTool = {
|
|
10
|
-
name: 'gala_launchpad_fetch_pool_details',
|
|
11
|
-
description: 'Get detailed pool state from GalaChain bonding curve',
|
|
12
|
-
inputSchema: {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
tokenName: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
pattern: '^[a-z0-9_-]{2,20}$',
|
|
18
|
-
description: 'Token name',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
required: ['tokenName'],
|
|
22
|
-
},
|
|
23
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
24
|
-
const result = await sdk.fetchPoolDetails(args.tokenName);
|
|
25
|
-
return formatSuccess(result);
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch Pool Details for Calculation Tool (73% code reduction via factory pattern)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createSimpleTokenFetchTool } from '../../utils/tool-factory.js';
|
|
6
|
-
|
|
7
|
-
export const fetchPoolDetailsForCalculationTool = createSimpleTokenFetchTool({
|
|
8
|
-
name: 'gala_launchpad_fetch_pool_details_for_calculation',
|
|
9
|
-
description: `Get optimized pool details for local bonding curve calculations.
|
|
10
|
-
|
|
11
|
-
Returns only essential calculation parameters:
|
|
12
|
-
- currentSupply: Current token supply (computed with full precision)
|
|
13
|
-
- remainingTokens: Tokens available for purchase
|
|
14
|
-
- maxSupply: Maximum token supply
|
|
15
|
-
- reverseBondingCurveMaxFeeFactor: Maximum reverse bonding curve fee (normalized to number)
|
|
16
|
-
- reverseBondingCurveMinFeeFactor: Minimum reverse bonding curve fee (normalized to number)
|
|
17
|
-
- reverseBondingCurveNetFeeFactor: Net fee factor (max - min, for convenience)
|
|
18
|
-
|
|
19
|
-
This is more efficient than fetchPoolDetails as it returns only fields needed for calculations.
|
|
20
|
-
Perfect for use with calculateBuyAmountLocal and calculateSellAmountLocal.`,
|
|
21
|
-
handler: (sdk, tokenName) => sdk.fetchPoolDetailsForCalculation(tokenName),
|
|
22
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch Pools Tool
|
|
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
|
-
|
|
9
|
-
export const fetchPoolsTool: MCPTool = {
|
|
10
|
-
name: 'gala_launchpad_fetch_pools',
|
|
11
|
-
description: 'Fetch token pools from Gala Launchpad with filtering and pagination',
|
|
12
|
-
inputSchema: {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
type: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
enum: ['recent', 'trending', 'user'],
|
|
18
|
-
description: 'Type of pools to fetch (default: recent)',
|
|
19
|
-
},
|
|
20
|
-
creatorAddress: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
pattern: '^(0x[a-fA-F0-9]{40}|eth\\|[a-fA-F0-9]{40})$',
|
|
23
|
-
description: 'Filter by creator address (optional)',
|
|
24
|
-
},
|
|
25
|
-
page: {
|
|
26
|
-
type: 'number',
|
|
27
|
-
minimum: 1,
|
|
28
|
-
description: 'Page number (default: 1)',
|
|
29
|
-
},
|
|
30
|
-
limit: {
|
|
31
|
-
type: 'number',
|
|
32
|
-
minimum: 1,
|
|
33
|
-
maximum: 100,
|
|
34
|
-
description: 'Results per page (default: 20)',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
39
|
-
const result = await sdk.fetchPools({
|
|
40
|
-
type: args.type || 'recent',
|
|
41
|
-
page: args.page || 1,
|
|
42
|
-
limit: args.limit || 20,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return formatSuccess(result);
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch Price History Tool
|
|
3
|
-
*
|
|
4
|
-
* Queries historical token price data from MySQL database.
|
|
5
|
-
* Requires MYSQL_CONNECTION_STRING environment variable to be configured.
|
|
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
|
-
import { PAGE_SCHEMA, createLimitSchema } from '../../schemas/common-schemas.js';
|
|
12
|
-
|
|
13
|
-
export const fetchPriceHistoryTool: MCPTool = {
|
|
14
|
-
name: 'gala_launchpad_fetch_price_history',
|
|
15
|
-
description: `Fetch historical price snapshots for DEX tokens from MySQL database.
|
|
16
|
-
|
|
17
|
-
**Requirements:**
|
|
18
|
-
- MySQL connection string must be configured (MYSQL_CONNECTION_STRING env var)
|
|
19
|
-
- Node.js environment only (not available in browser)
|
|
20
|
-
- Only works for DEX tokens with price_snapshots table data
|
|
21
|
-
|
|
22
|
-
**Use Cases:**
|
|
23
|
-
- Historical price analysis and charting
|
|
24
|
-
- Price trend identification
|
|
25
|
-
- Volatility analysis over time periods
|
|
26
|
-
- Data export for external analytics
|
|
27
|
-
|
|
28
|
-
**Performance:** Direct MySQL queries with pagination support (max 100 items per page).`,
|
|
29
|
-
|
|
30
|
-
inputSchema: {
|
|
31
|
-
type: 'object',
|
|
32
|
-
properties: {
|
|
33
|
-
tokenId: {
|
|
34
|
-
oneOf: [
|
|
35
|
-
{
|
|
36
|
-
type: 'string',
|
|
37
|
-
description:
|
|
38
|
-
'Pipe-delimited format: "collection|category|type|additionalKey" (e.g., "Token|Unit|GUSDC|eth:...")',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties: {
|
|
43
|
-
collection: {
|
|
44
|
-
type: 'string',
|
|
45
|
-
description: 'Token collection (e.g., "Token")',
|
|
46
|
-
},
|
|
47
|
-
category: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
description: 'Token category (e.g., "Unit")',
|
|
50
|
-
},
|
|
51
|
-
type: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: 'Token type (e.g., "GUSDC")',
|
|
54
|
-
},
|
|
55
|
-
additionalKey: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
description: 'Additional key (e.g., "eth:0x...")',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
required: ['collection', 'category', 'type', 'additionalKey'],
|
|
61
|
-
description: 'TokenClassKey object format',
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
description: 'Token identifier (string or TokenClassKey object)',
|
|
65
|
-
},
|
|
66
|
-
from: {
|
|
67
|
-
type: 'string',
|
|
68
|
-
format: 'date-time',
|
|
69
|
-
description: 'Start date for filtering (ISO 8601 format, defaults to 30 days ago)',
|
|
70
|
-
},
|
|
71
|
-
to: {
|
|
72
|
-
type: 'string',
|
|
73
|
-
format: 'date-time',
|
|
74
|
-
description: 'End date for filtering (ISO 8601 format, defaults to now)',
|
|
75
|
-
},
|
|
76
|
-
sortOrder: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
enum: ['ASC', 'DESC'],
|
|
79
|
-
description: 'Sort order for results (default: DESC for newest-first)',
|
|
80
|
-
},
|
|
81
|
-
page: PAGE_SCHEMA,
|
|
82
|
-
limit: createLimitSchema('pool', 10),
|
|
83
|
-
},
|
|
84
|
-
required: ['tokenId'],
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
88
|
-
// Convert string dates to Date objects if provided
|
|
89
|
-
const options: any = {
|
|
90
|
-
tokenId: args.tokenId,
|
|
91
|
-
sortOrder: args.sortOrder,
|
|
92
|
-
page: args.page,
|
|
93
|
-
limit: args.limit,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (args.from) {
|
|
97
|
-
options.from = new Date(args.from);
|
|
98
|
-
}
|
|
99
|
-
if (args.to) {
|
|
100
|
-
options.to = new Date(args.to);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const result = await sdk.fetchPriceHistory(options);
|
|
104
|
-
return formatSuccess(result);
|
|
105
|
-
}),
|
|
106
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch Latest Prices Tool
|
|
3
|
-
*
|
|
4
|
-
* Queries latest token prices from MySQL database with pagination.
|
|
5
|
-
* Requires MYSQL_CONNECTION_STRING environment variable to be configured.
|
|
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
|
-
import { PAGE_SCHEMA, createLimitSchema } from '../../schemas/common-schemas.js';
|
|
12
|
-
|
|
13
|
-
export const fetchPricesTool: MCPTool = {
|
|
14
|
-
name: 'gala_launchpad_fetch_prices',
|
|
15
|
-
description: `Fetch latest price for all DEX tokens with pagination.
|
|
16
|
-
|
|
17
|
-
**Requirements:**
|
|
18
|
-
- MySQL connection string must be configured (MYSQL_CONNECTION_STRING env var)
|
|
19
|
-
- Node.js environment only (not available in browser)
|
|
20
|
-
- Returns most recent price snapshot per unique token
|
|
21
|
-
|
|
22
|
-
**Use Cases:**
|
|
23
|
-
- Market overview dashboards
|
|
24
|
-
- Bulk price comparisons
|
|
25
|
-
- Token catalog with current prices
|
|
26
|
-
- Price monitoring and alerts
|
|
27
|
-
|
|
28
|
-
**Performance:** Single optimized query using window functions, returns latest price per token with pagination.`,
|
|
29
|
-
|
|
30
|
-
inputSchema: {
|
|
31
|
-
type: 'object',
|
|
32
|
-
properties: {
|
|
33
|
-
page: PAGE_SCHEMA,
|
|
34
|
-
limit: createLimitSchema('pool', 10),
|
|
35
|
-
sortByType: {
|
|
36
|
-
type: 'string',
|
|
37
|
-
enum: ['ASC', 'DESC'],
|
|
38
|
-
description: 'Sort tokens alphabetically by type (optional)',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
required: [],
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
45
|
-
const result = await sdk.fetchPrices({
|
|
46
|
-
page: args.page,
|
|
47
|
-
limit: args.limit,
|
|
48
|
-
sortByType: args.sortByType,
|
|
49
|
-
});
|
|
50
|
-
return formatSuccess(result);
|
|
51
|
-
}),
|
|
52
|
-
};
|
package/src/tools/pools/index.ts
DELETED
|
@@ -1,248 +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 { fetchPricesTool } from './fetchPrices.js';
|
|
23
|
-
import { fetchAllPricesTool } from './fetchAllPrices.js';
|
|
24
|
-
import {
|
|
25
|
-
createSimpleTokenFetchTool,
|
|
26
|
-
createBooleanCheckTool,
|
|
27
|
-
createResolutionTool,
|
|
28
|
-
createNoParamTool,
|
|
29
|
-
} from '../../utils/tool-factory.js';
|
|
30
|
-
import { resolutionToSeconds, dateToUnixTimestamp, DEFAULT_VOLUME_RESOLUTION } from '../../utils/default-values.js';
|
|
31
|
-
|
|
32
|
-
// 1. Fetch Pools
|
|
33
|
-
export const fetchPoolsTool: MCPTool = {
|
|
34
|
-
name: 'gala_launchpad_fetch_pools',
|
|
35
|
-
description: 'Fetch token pools from Gala Launchpad with filtering and pagination',
|
|
36
|
-
inputSchema: {
|
|
37
|
-
type: 'object',
|
|
38
|
-
properties: {
|
|
39
|
-
type: {
|
|
40
|
-
type: 'string',
|
|
41
|
-
enum: Object.values(POOL_TYPES),
|
|
42
|
-
description: 'Type of pools to fetch (default: recent)',
|
|
43
|
-
},
|
|
44
|
-
creatorAddress: {
|
|
45
|
-
...ADDRESS_SCHEMA,
|
|
46
|
-
description: 'Filter by creator address (optional)',
|
|
47
|
-
},
|
|
48
|
-
page: PAGE_SCHEMA,
|
|
49
|
-
limit: createLimitSchema('pool', 20),
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
53
|
-
const result = await sdk.fetchPools({
|
|
54
|
-
type: args.type || 'recent',
|
|
55
|
-
page: args.page || 1,
|
|
56
|
-
limit: args.limit || 20,
|
|
57
|
-
});
|
|
58
|
-
return formatSuccess(result);
|
|
59
|
-
}),
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// 2. Fetch Pool Details (73% code reduction via factory pattern)
|
|
63
|
-
export const fetchPoolDetailsTool = createSimpleTokenFetchTool({
|
|
64
|
-
name: 'gala_launchpad_fetch_pool_details',
|
|
65
|
-
description: 'Get detailed pool state from GalaChain bonding curve',
|
|
66
|
-
handler: (sdk, tokenName) => sdk.fetchPoolDetails(tokenName),
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// 3. Fetch Token Distribution (73% code reduction via factory pattern)
|
|
70
|
-
export const fetchTokenDistributionTool = createSimpleTokenFetchTool({
|
|
71
|
-
name: 'gala_launchpad_fetch_token_distribution',
|
|
72
|
-
description: 'Get holder distribution and supply metrics',
|
|
73
|
-
handler: (sdk, tokenName) => sdk.fetchTokenDistribution(tokenName),
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// 4. Fetch Token Badges (73% code reduction via factory pattern)
|
|
77
|
-
export const fetchTokenBadgesTool = createSimpleTokenFetchTool({
|
|
78
|
-
name: 'gala_launchpad_fetch_token_badges',
|
|
79
|
-
description: 'Get achievement badges for volume and engagement',
|
|
80
|
-
handler: (sdk, tokenName) => sdk.fetchTokenBadges(tokenName),
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// 5. Fetch Volume Data (using centralized default values utilities)
|
|
84
|
-
export const fetchVolumeDataTool: MCPTool = {
|
|
85
|
-
name: 'gala_launchpad_fetch_volume_data',
|
|
86
|
-
description: 'Get OHLCV (candlestick) data for charting',
|
|
87
|
-
inputSchema: {
|
|
88
|
-
type: 'object',
|
|
89
|
-
properties: {
|
|
90
|
-
tokenName: TOKEN_NAME_SCHEMA,
|
|
91
|
-
from: {
|
|
92
|
-
type: 'string',
|
|
93
|
-
format: 'date-time',
|
|
94
|
-
description: 'Start date (ISO 8601)',
|
|
95
|
-
},
|
|
96
|
-
to: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
format: 'date-time',
|
|
99
|
-
description: 'End date (ISO 8601)',
|
|
100
|
-
},
|
|
101
|
-
resolution: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
enum: ['1m', '5m', '15m', '1h', '4h', '1d'],
|
|
104
|
-
description: 'Time resolution (default: 1h)',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
required: ['tokenName'],
|
|
108
|
-
},
|
|
109
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
110
|
-
const result = await sdk.fetchVolumeData({
|
|
111
|
-
tokenName: args.tokenName,
|
|
112
|
-
from: dateToUnixTimestamp(args.from),
|
|
113
|
-
to: dateToUnixTimestamp(args.to),
|
|
114
|
-
resolution: resolutionToSeconds(args.resolution, DEFAULT_VOLUME_RESOLUTION),
|
|
115
|
-
});
|
|
116
|
-
return formatSuccess(result);
|
|
117
|
-
}),
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// 6. Fetch Token Spot Price (General DEX Tokens)
|
|
121
|
-
export const fetchTokenSpotPriceTool: MCPTool = {
|
|
122
|
-
name: 'gala_launchpad_fetch_token_spot_price',
|
|
123
|
-
description: 'Fetch USD spot price for DEX tokens (GALA, SILK, MUSIC, etc.)',
|
|
124
|
-
inputSchema: {
|
|
125
|
-
type: 'object',
|
|
126
|
-
properties: {
|
|
127
|
-
symbols: {
|
|
128
|
-
oneOf: [
|
|
129
|
-
{ type: 'string' },
|
|
130
|
-
{
|
|
131
|
-
type: 'array',
|
|
132
|
-
items: { type: 'string' },
|
|
133
|
-
minItems: 1
|
|
134
|
-
}
|
|
135
|
-
],
|
|
136
|
-
description: 'Single symbol string or array of symbols (e.g., "GALA" or ["GALA", "SILK", "MUSIC"])',
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
required: ['symbols'],
|
|
140
|
-
},
|
|
141
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
142
|
-
const result = await sdk.fetchTokenSpotPrice(args.symbols);
|
|
143
|
-
return formatSuccess(result);
|
|
144
|
-
}),
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// 7. Fetch GALA Spot Price (45% code reduction via factory pattern)
|
|
148
|
-
export const fetchGalaSpotPriceTool = createNoParamTool({
|
|
149
|
-
name: 'gala_launchpad_fetch_gala_spot_price',
|
|
150
|
-
description: 'Fetch current GALA USD spot price (convenience method)',
|
|
151
|
-
handler: (sdk) => sdk.fetchGalaSpotPrice(),
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// 8. Fetch Launchpad Token Spot Price
|
|
155
|
-
export const fetchLaunchpadTokenSpotPriceTool: MCPTool = {
|
|
156
|
-
name: 'gala_launchpad_fetch_launchpad_token_spot_price',
|
|
157
|
-
description: `Fetch USD spot price for a launchpad token by name.
|
|
158
|
-
|
|
159
|
-
Performance optimization: Provide currentSupply to avoid fetching pool details twice.`,
|
|
160
|
-
inputSchema: {
|
|
161
|
-
type: 'object',
|
|
162
|
-
properties: {
|
|
163
|
-
tokenName: {
|
|
164
|
-
...TOKEN_NAME_SCHEMA,
|
|
165
|
-
description: 'Token name (e.g., "dragnrkti", "rocketri", "unicornri")',
|
|
166
|
-
},
|
|
167
|
-
calculateAmountMode: CALCULATION_MODE_SCHEMA,
|
|
168
|
-
currentSupply: CURRENT_SUPPLY_SCHEMA,
|
|
169
|
-
},
|
|
170
|
-
required: ['tokenName'],
|
|
171
|
-
},
|
|
172
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
173
|
-
// Build options object only if mode or supply provided
|
|
174
|
-
const options = args.calculateAmountMode || args.currentSupply
|
|
175
|
-
? {
|
|
176
|
-
tokenName: args.tokenName,
|
|
177
|
-
calculateAmountMode: args.calculateAmountMode,
|
|
178
|
-
currentSupply: args.currentSupply,
|
|
179
|
-
}
|
|
180
|
-
: args.tokenName;
|
|
181
|
-
|
|
182
|
-
const result = await sdk.fetchLaunchpadTokenSpotPrice(options);
|
|
183
|
-
return formatSuccess(result);
|
|
184
|
-
}),
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// 9. Check Token Name (60% code reduction via factory pattern)
|
|
188
|
-
export const checkTokenNameTool = createBooleanCheckTool({
|
|
189
|
-
name: 'gala_launchpad_check_token_name',
|
|
190
|
-
description: 'Check if token name is available',
|
|
191
|
-
paramName: 'tokenName',
|
|
192
|
-
paramSchema: TOKEN_NAME_SCHEMA,
|
|
193
|
-
handler: (sdk, tokenName) => sdk.isTokenNameAvailable(tokenName),
|
|
194
|
-
messages: {
|
|
195
|
-
true: 'Token name is available',
|
|
196
|
-
false: 'Token name is already taken',
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// 10. Check Token Symbol (60% code reduction via factory pattern)
|
|
201
|
-
export const checkTokenSymbolTool = createBooleanCheckTool({
|
|
202
|
-
name: 'gala_launchpad_check_token_symbol',
|
|
203
|
-
description: 'Check if token symbol is available',
|
|
204
|
-
paramName: 'symbol',
|
|
205
|
-
paramSchema: TOKEN_SYMBOL_SCHEMA,
|
|
206
|
-
handler: (sdk, symbol) => sdk.isTokenSymbolAvailable(symbol),
|
|
207
|
-
messages: {
|
|
208
|
-
true: 'Token symbol is available',
|
|
209
|
-
false: 'Token symbol is already taken',
|
|
210
|
-
},
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// 11. Resolve Vault Address (73% code reduction via factory pattern)
|
|
214
|
-
export const resolveVaultAddressTool = createResolutionTool({
|
|
215
|
-
name: 'gala_launchpad_resolve_vault_address',
|
|
216
|
-
description: 'Get GalaChain vault address for a token (useful for debugging)',
|
|
217
|
-
resolver: (sdk, tokenName) => sdk.resolveVaultAddress(tokenName),
|
|
218
|
-
resultKey: 'vaultAddress',
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// 12. Resolve Token Class Key (73% code reduction via factory pattern)
|
|
222
|
-
export const resolveTokenClassKeyTool = createResolutionTool({
|
|
223
|
-
name: 'gala_launchpad_resolve_token_class_key',
|
|
224
|
-
description: 'Get GalaChain TokenClassKey for a launchpad token (useful for direct GalaChain operations)',
|
|
225
|
-
resolver: (sdk, tokenName) => sdk.resolveTokenClassKey(tokenName),
|
|
226
|
-
resultKey: 'tokenClassKey',
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
export const poolTools: MCPTool[] = [
|
|
230
|
-
fetchPoolsTool,
|
|
231
|
-
fetchAllPoolsTool,
|
|
232
|
-
fetchPoolDetailsTool,
|
|
233
|
-
fetchPoolDetailsForCalculationTool,
|
|
234
|
-
fetchTokenDistributionTool,
|
|
235
|
-
fetchTokenBadgesTool,
|
|
236
|
-
fetchVolumeDataTool,
|
|
237
|
-
fetchTokenSpotPriceTool,
|
|
238
|
-
fetchGalaSpotPriceTool,
|
|
239
|
-
fetchLaunchpadTokenSpotPriceTool,
|
|
240
|
-
fetchPriceHistoryTool,
|
|
241
|
-
fetchAllPriceHistoryTool,
|
|
242
|
-
fetchPricesTool,
|
|
243
|
-
fetchAllPricesTool,
|
|
244
|
-
checkTokenNameTool,
|
|
245
|
-
checkTokenSymbolTool,
|
|
246
|
-
resolveVaultAddressTool,
|
|
247
|
-
resolveTokenClassKeyTool,
|
|
248
|
-
];
|