@gala-chain/launchpad-mcp-server 1.13.4 → 1.13.5
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 +24 -0
- 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 -103
- 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 -108
- 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,217 +0,0 @@
|
|
|
1
|
-
# Tool Factory Pattern Examples
|
|
2
|
-
|
|
3
|
-
Demonstrates how to use `tool-factory.ts` utilities to eliminate duplication. These examples show the before/after comparison for common tool patterns.
|
|
4
|
-
|
|
5
|
-
**See**: `src/utils/tool-factory.ts`
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Example 1: Simple Token Fetch Tool (BEFORE vs AFTER)
|
|
10
|
-
|
|
11
|
-
### ❌ BEFORE: Manual duplication (22 lines)
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
export const fetchPoolDetailsToolOLD: MCPTool = {
|
|
15
|
-
name: 'gala_launchpad_fetch_pool_details',
|
|
16
|
-
description: 'Get detailed pool state from GalaChain bonding curve',
|
|
17
|
-
inputSchema: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {
|
|
20
|
-
tokenName: TOKEN_NAME_SCHEMA,
|
|
21
|
-
},
|
|
22
|
-
required: ['tokenName'],
|
|
23
|
-
},
|
|
24
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
25
|
-
const result = await sdk.fetchPoolDetails(args.tokenName);
|
|
26
|
-
return formatSuccess(result);
|
|
27
|
-
}),
|
|
28
|
-
};
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### ✅ AFTER: Using factory (6 lines - 73% reduction)
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
export const fetchPoolDetailsToolNEW = createSimpleTokenFetchTool({
|
|
35
|
-
name: 'gala_launchpad_fetch_pool_details',
|
|
36
|
-
description: 'Get detailed pool state from GalaChain bonding curve',
|
|
37
|
-
handler: (sdk, tokenName) => sdk.fetchPoolDetails(tokenName),
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Example 2: Boolean Check Tool (BEFORE vs AFTER)
|
|
44
|
-
|
|
45
|
-
### ❌ BEFORE: Manual duplication (25 lines)
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
export const checkTokenNameToolOLD: MCPTool = {
|
|
49
|
-
name: 'gala_launchpad_check_token_name',
|
|
50
|
-
description: 'Check if token name is available',
|
|
51
|
-
inputSchema: {
|
|
52
|
-
type: 'object',
|
|
53
|
-
properties: {
|
|
54
|
-
tokenName: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
pattern: '^[a-z0-9_-]{2,20}$',
|
|
57
|
-
description: 'Token name to check',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
required: ['tokenName'],
|
|
61
|
-
},
|
|
62
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
63
|
-
const available = await sdk.isTokenNameAvailable(args.tokenName);
|
|
64
|
-
return formatBoolean(
|
|
65
|
-
available,
|
|
66
|
-
available ? 'Token name is available' : 'Token name is already taken'
|
|
67
|
-
);
|
|
68
|
-
}),
|
|
69
|
-
};
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### ✅ AFTER: Using factory (10 lines - 60% reduction)
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
export const checkTokenNameToolNEW = createBooleanCheckTool({
|
|
76
|
-
name: 'gala_launchpad_check_token_name',
|
|
77
|
-
description: 'Check if token name is available',
|
|
78
|
-
paramName: 'tokenName',
|
|
79
|
-
paramSchema: TOKEN_NAME_SCHEMA,
|
|
80
|
-
handler: (sdk, tokenName) => sdk.isTokenNameAvailable(tokenName),
|
|
81
|
-
messages: {
|
|
82
|
-
true: 'Token name is available',
|
|
83
|
-
false: 'Token name is already taken',
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## Example 3: Resolution Tool (BEFORE vs AFTER)
|
|
91
|
-
|
|
92
|
-
### ❌ BEFORE: Manual duplication (22 lines)
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
export const resolveVaultAddressToolOLD: MCPTool = {
|
|
96
|
-
name: 'gala_launchpad_resolve_vault_address',
|
|
97
|
-
description: 'Get GalaChain vault address for a token (useful for debugging)',
|
|
98
|
-
inputSchema: {
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
tokenName: TOKEN_NAME_SCHEMA,
|
|
102
|
-
},
|
|
103
|
-
required: ['tokenName'],
|
|
104
|
-
},
|
|
105
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
106
|
-
const vaultAddress = await sdk.resolveVaultAddress(args.tokenName);
|
|
107
|
-
return formatSuccess({ tokenName: args.tokenName, vaultAddress });
|
|
108
|
-
}),
|
|
109
|
-
};
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### ✅ AFTER: Using factory (6 lines - 73% reduction)
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
export const resolveVaultAddressToolNEW = createResolutionTool({
|
|
116
|
-
name: 'gala_launchpad_resolve_vault_address',
|
|
117
|
-
description: 'Get GalaChain vault address for a token (useful for debugging)',
|
|
118
|
-
resolver: (sdk, tokenName) => sdk.resolveVaultAddress(tokenName),
|
|
119
|
-
resultKey: 'vaultAddress',
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## Example 4: Complex Fetch Tool with Custom Schema (BEFORE vs AFTER)
|
|
126
|
-
|
|
127
|
-
### ❌ BEFORE: Manual duplication (28 lines)
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
export const fetchPoolsToolOLD: MCPTool = {
|
|
131
|
-
name: 'gala_launchpad_fetch_pools',
|
|
132
|
-
description: 'Fetch token pools from Gala Launchpad with filtering and pagination',
|
|
133
|
-
inputSchema: {
|
|
134
|
-
type: 'object',
|
|
135
|
-
properties: {
|
|
136
|
-
type: {
|
|
137
|
-
type: 'string',
|
|
138
|
-
enum: Object.values(POOL_TYPES),
|
|
139
|
-
description: 'Type of pools to fetch (default: recent)',
|
|
140
|
-
},
|
|
141
|
-
page: PAGE_SCHEMA,
|
|
142
|
-
limit: createLimitSchema('pool', 20),
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
handler: withErrorHandling(async (sdk, args) => {
|
|
146
|
-
const result = await sdk.fetchPools({
|
|
147
|
-
type: args.type || 'recent',
|
|
148
|
-
page: args.page || 1,
|
|
149
|
-
limit: args.limit || 20,
|
|
150
|
-
});
|
|
151
|
-
return formatSuccess(result);
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### ✅ AFTER: Using factory (21 lines - 25% reduction)
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
export const fetchPoolsToolNEW = createFetchTool({
|
|
160
|
-
name: 'gala_launchpad_fetch_pools',
|
|
161
|
-
description: 'Fetch token pools from Gala Launchpad with filtering and pagination',
|
|
162
|
-
inputSchema: {
|
|
163
|
-
type: 'object',
|
|
164
|
-
properties: {
|
|
165
|
-
type: {
|
|
166
|
-
type: 'string',
|
|
167
|
-
enum: Object.values(POOL_TYPES),
|
|
168
|
-
description: 'Type of pools to fetch (default: recent)',
|
|
169
|
-
},
|
|
170
|
-
page: PAGE_SCHEMA,
|
|
171
|
-
limit: createLimitSchema('pool', 20),
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
handler: (sdk, args) =>
|
|
175
|
-
sdk.fetchPools({
|
|
176
|
-
type: args.type || 'recent',
|
|
177
|
-
page: args.page || 1,
|
|
178
|
-
limit: args.limit || 20,
|
|
179
|
-
}),
|
|
180
|
-
});
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Summary Statistics
|
|
186
|
-
|
|
187
|
-
### IMPACT ANALYSIS:
|
|
188
|
-
|
|
189
|
-
**Tools that can use createSimpleTokenFetchTool (73% reduction):**
|
|
190
|
-
- fetchPoolDetailsTool
|
|
191
|
-
- fetchTokenDistributionTool
|
|
192
|
-
- fetchTokenBadgesTool
|
|
193
|
-
- Total: ~15 tools across the codebase
|
|
194
|
-
|
|
195
|
-
**Tools that can use createBooleanCheckTool (60% reduction):**
|
|
196
|
-
- checkTokenNameTool
|
|
197
|
-
- checkTokenSymbolTool
|
|
198
|
-
- isTokenGraduatedTool
|
|
199
|
-
- Total: ~3 tools
|
|
200
|
-
|
|
201
|
-
**Tools that can use createResolutionTool (73% reduction):**
|
|
202
|
-
- resolveVaultAddressTool
|
|
203
|
-
- resolveTokenClassKeyTool
|
|
204
|
-
- Total: ~2 tools
|
|
205
|
-
|
|
206
|
-
**Tools that can use createFetchTool (25% reduction):**
|
|
207
|
-
- fetchPoolsTool
|
|
208
|
-
- fetchTradesTool
|
|
209
|
-
- fetchTokensHeldTool
|
|
210
|
-
- fetchTokensCreatedTool
|
|
211
|
-
- Total: ~10 tools
|
|
212
|
-
|
|
213
|
-
### OVERALL IMPACT:
|
|
214
|
-
- ~30 out of 47 tools can use factory pattern
|
|
215
|
-
- Average reduction: 50% fewer lines per tool
|
|
216
|
-
- Total saved: ~500-700 lines of duplicated code
|
|
217
|
-
- Improved maintainability: Changes to error handling, formatting, etc. only need to be made once
|
package/jest.config.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jest Configuration for Gala Launchpad MCP Server
|
|
3
|
-
*
|
|
4
|
-
* TypeScript-first testing configuration with comprehensive coverage thresholds
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
// Use ts-jest for TypeScript support
|
|
9
|
-
preset: 'ts-jest',
|
|
10
|
-
|
|
11
|
-
// Node.js environment (MCP server is server-side)
|
|
12
|
-
testEnvironment: 'node',
|
|
13
|
-
|
|
14
|
-
// Test file location patterns
|
|
15
|
-
roots: ['<rootDir>/src'],
|
|
16
|
-
testMatch: [
|
|
17
|
-
'**/__tests__/**/*.test.ts',
|
|
18
|
-
'**/__tests__/**/*.spec.ts',
|
|
19
|
-
],
|
|
20
|
-
|
|
21
|
-
// Coverage collection
|
|
22
|
-
collectCoverageFrom: [
|
|
23
|
-
'src/**/*.ts',
|
|
24
|
-
'!src/**/__tests__/**',
|
|
25
|
-
'!src/**/*.d.ts',
|
|
26
|
-
'!src/index.ts', // Entry point - covered by integration tests
|
|
27
|
-
],
|
|
28
|
-
|
|
29
|
-
// Coverage thresholds disabled for mixed codebase
|
|
30
|
-
// Note: New code has 92%+ coverage (validation.ts, prompt refactoring)
|
|
31
|
-
// Existing tools (47 MCP tools) are tested via integration, not unit tests
|
|
32
|
-
// This is intentional - unit testing tools would require mocking entire SDK
|
|
33
|
-
//
|
|
34
|
-
// Coverage Summary:
|
|
35
|
-
// - validation.ts: 92% branches, 100% functions, 91% lines (EXCELLENT)
|
|
36
|
-
// - Prompt tests: 119/119 passing with comprehensive edge cases
|
|
37
|
-
// - Overall: 30% due to untested tools (tested via real SDK integration)
|
|
38
|
-
//
|
|
39
|
-
// Uncomment below to enforce thresholds when tool coverage is added:
|
|
40
|
-
// coverageThreshold: {
|
|
41
|
-
// global: { branches: 80, functions: 80, lines: 80, statements: 80 },
|
|
42
|
-
// },
|
|
43
|
-
|
|
44
|
-
// Coverage reporters
|
|
45
|
-
coverageReporters: ['text', 'text-summary', 'html', 'lcov'],
|
|
46
|
-
|
|
47
|
-
// Module path aliases and extension mapping
|
|
48
|
-
moduleNameMapper: {
|
|
49
|
-
'^@/(.*)$': '<rootDir>/src/$1',
|
|
50
|
-
'^(\\.{1,2}/.*)\\.js$': '$1', // Map .js imports to .ts files
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// Transform files with ts-jest
|
|
54
|
-
transform: {
|
|
55
|
-
'^.+\\.ts$': ['ts-jest', {
|
|
56
|
-
tsconfig: {
|
|
57
|
-
// Use ES modules
|
|
58
|
-
module: 'commonjs',
|
|
59
|
-
// Ensure strict type checking in tests
|
|
60
|
-
strict: true,
|
|
61
|
-
esModuleInterop: true,
|
|
62
|
-
skipLibCheck: true,
|
|
63
|
-
},
|
|
64
|
-
}],
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
// File extensions to consider
|
|
68
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
69
|
-
|
|
70
|
-
// Ignore patterns
|
|
71
|
-
testPathIgnorePatterns: [
|
|
72
|
-
'/node_modules/',
|
|
73
|
-
'/dist/',
|
|
74
|
-
'/.history/',
|
|
75
|
-
'/integration/', // Integration tests have their own config
|
|
76
|
-
],
|
|
77
|
-
|
|
78
|
-
// Transform ESM packages in node_modules
|
|
79
|
-
transformIgnorePatterns: [
|
|
80
|
-
'node_modules/(?!(uuid|@gala-chain)/)',
|
|
81
|
-
],
|
|
82
|
-
|
|
83
|
-
// Setup files (if needed for global test setup)
|
|
84
|
-
// setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
|
|
85
|
-
|
|
86
|
-
// Clear mocks between tests
|
|
87
|
-
clearMocks: true,
|
|
88
|
-
|
|
89
|
-
// Verbose output
|
|
90
|
-
verbose: true,
|
|
91
|
-
|
|
92
|
-
// Maximum worker threads (optimize for CI/CD)
|
|
93
|
-
maxWorkers: '50%',
|
|
94
|
-
};
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Tests for Pool Tools
|
|
3
|
-
*
|
|
4
|
-
* These tests use real SDK instances and make actual API calls.
|
|
5
|
-
* Requires valid PRIVATE_KEY environment variable.
|
|
6
|
-
*
|
|
7
|
-
* Run with: npm run test:integration
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { AgentConfig } from '@gala-chain/launchpad-sdk';
|
|
11
|
-
import { fetchPoolsTool, fetchPoolDetailsTool } from '../../tools/pools/index.js';
|
|
12
|
-
|
|
13
|
-
describe('Pool Tools Integration', () => {
|
|
14
|
-
let sdk: any;
|
|
15
|
-
|
|
16
|
-
beforeAll(async () => {
|
|
17
|
-
// Skip tests if no private key available
|
|
18
|
-
if (!process.env.PRIVATE_KEY) {
|
|
19
|
-
console.warn('⚠️ Skipping integration tests: PRIVATE_KEY environment variable not set');
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Initialize SDK with AgentConfig
|
|
24
|
-
const { sdk: initializedSdk } = await AgentConfig.quickSetup({
|
|
25
|
-
environment: (process.env.ENVIRONMENT as any) || 'development',
|
|
26
|
-
privateKey: process.env.PRIVATE_KEY,
|
|
27
|
-
timeout: 30000,
|
|
28
|
-
debug: false,
|
|
29
|
-
autoValidate: false,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
sdk = initializedSdk;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
afterAll(() => {
|
|
36
|
-
if (sdk) {
|
|
37
|
-
sdk.cleanup();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('fetchPoolsTool', () => {
|
|
42
|
-
it('should fetch recent pools successfully', async () => {
|
|
43
|
-
if (!sdk) {
|
|
44
|
-
return; // Skip if SDK not initialized
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
48
|
-
type: 'recent',
|
|
49
|
-
limit: 5,
|
|
50
|
-
page: 1,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
expect(result).toBeDefined();
|
|
54
|
-
expect(result.content).toBeDefined();
|
|
55
|
-
expect(Array.isArray(result.content)).toBe(true);
|
|
56
|
-
expect(result.content.length).toBeGreaterThan(0);
|
|
57
|
-
|
|
58
|
-
const response = JSON.parse(result.content[0].text!);
|
|
59
|
-
expect(response).toHaveProperty('pools');
|
|
60
|
-
expect(Array.isArray(response.pools)).toBe(true);
|
|
61
|
-
expect(response.pools.length).toBeLessThanOrEqual(5);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should fetch popular pools successfully', async () => {
|
|
65
|
-
if (!sdk) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
70
|
-
type: 'popular',
|
|
71
|
-
limit: 3,
|
|
72
|
-
page: 1,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
expect(result).toBeDefined();
|
|
76
|
-
const response = JSON.parse(result.content[0].text!);
|
|
77
|
-
expect(response).toHaveProperty('pools');
|
|
78
|
-
expect(response.pools.length).toBeLessThanOrEqual(3);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should handle pagination correctly', async () => {
|
|
82
|
-
if (!sdk) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const page1 = await fetchPoolsTool.handler(sdk, {
|
|
87
|
-
type: 'recent',
|
|
88
|
-
limit: 2,
|
|
89
|
-
page: 1,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const page2 = await fetchPoolsTool.handler(sdk, {
|
|
93
|
-
type: 'recent',
|
|
94
|
-
limit: 2,
|
|
95
|
-
page: 2,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const response1 = JSON.parse(page1.content[0].text!);
|
|
99
|
-
const response2 = JSON.parse(page2.content[0].text!);
|
|
100
|
-
|
|
101
|
-
expect(response1.page).toBe(1);
|
|
102
|
-
expect(response2.page).toBe(2);
|
|
103
|
-
|
|
104
|
-
// Different pools on different pages
|
|
105
|
-
if (response1.pools.length > 0 && response2.pools.length > 0) {
|
|
106
|
-
expect(response1.pools[0].name).not.toBe(response2.pools[0].name);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('fetchPoolDetailsTool', () => {
|
|
112
|
-
it('should fetch pool details for a known token', async () => {
|
|
113
|
-
if (!sdk) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// First get a pool name from recent pools
|
|
118
|
-
const pools = await fetchPoolsTool.handler(sdk, {
|
|
119
|
-
type: 'recent',
|
|
120
|
-
limit: 1,
|
|
121
|
-
page: 1,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
const poolsResponse = JSON.parse(pools.content[0].text!);
|
|
125
|
-
|
|
126
|
-
if (poolsResponse.pools.length === 0) {
|
|
127
|
-
console.warn('⚠️ No pools available for testing');
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const tokenName = poolsResponse.pools[0].name;
|
|
132
|
-
|
|
133
|
-
// Fetch details for that token
|
|
134
|
-
const result = await fetchPoolDetailsTool.handler(sdk, {
|
|
135
|
-
tokenName,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
expect(result).toBeDefined();
|
|
139
|
-
const response = JSON.parse(result.content[0].text!);
|
|
140
|
-
|
|
141
|
-
expect(response).toHaveProperty('name', tokenName);
|
|
142
|
-
expect(response).toHaveProperty('symbol');
|
|
143
|
-
expect(response).toHaveProperty('saleStatus');
|
|
144
|
-
expect(response).toHaveProperty('currentSupply');
|
|
145
|
-
expect(response).toHaveProperty('maxSupply');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should handle non-existent token gracefully', async () => {
|
|
149
|
-
if (!sdk) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const result = await fetchPoolDetailsTool.handler(sdk, {
|
|
154
|
-
tokenName: 'nonexistenttoken123456',
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Should return error response
|
|
158
|
-
expect(result).toBeDefined();
|
|
159
|
-
expect(result.isError).toBe(true);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe('MCP Response Format', () => {
|
|
164
|
-
it('should return valid MCP response structure', async () => {
|
|
165
|
-
if (!sdk) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const result = await fetchPoolsTool.handler(sdk, {
|
|
170
|
-
type: 'recent',
|
|
171
|
-
limit: 1,
|
|
172
|
-
page: 1,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// Validate MCP response structure
|
|
176
|
-
expect(result).toHaveProperty('content');
|
|
177
|
-
expect(Array.isArray(result.content)).toBe(true);
|
|
178
|
-
expect(result.content[0]).toHaveProperty('type', 'text');
|
|
179
|
-
expect(result.content[0]).toHaveProperty('text');
|
|
180
|
-
|
|
181
|
-
// Validate JSON parseable
|
|
182
|
-
expect(() => JSON.parse(result.content[0].text!)).not.toThrow();
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Name Constants
|
|
3
|
-
*
|
|
4
|
-
* Centralized constants for all Gala Launchpad MCP tool names.
|
|
5
|
-
* Use these constants instead of hardcoded strings to prevent typos
|
|
6
|
-
* and enable IDE autocomplete.
|
|
7
|
-
*
|
|
8
|
-
* Total: 48 tools across 7 categories
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Pool Management & Pricing Tools (13 tools)
|
|
13
|
-
*/
|
|
14
|
-
export const POOL_TOOLS = {
|
|
15
|
-
FETCH_POOLS: 'gala_launchpad_fetch_pools',
|
|
16
|
-
FETCH_ALL_POOLS: 'gala_launchpad_fetch_all_pools',
|
|
17
|
-
FETCH_POOL_DETAILS: 'gala_launchpad_fetch_pool_details',
|
|
18
|
-
FETCH_POOL_DETAILS_FOR_CALCULATION: 'gala_launchpad_fetch_pool_details_for_calculation',
|
|
19
|
-
FETCH_TOKEN_DISTRIBUTION: 'gala_launchpad_fetch_token_distribution',
|
|
20
|
-
FETCH_TOKEN_BADGES: 'gala_launchpad_fetch_token_badges',
|
|
21
|
-
FETCH_VOLUME_DATA: 'gala_launchpad_fetch_volume_data',
|
|
22
|
-
FETCH_GALA_SPOT_PRICE: 'gala_launchpad_fetch_gala_spot_price',
|
|
23
|
-
FETCH_TOKEN_SPOT_PRICE: 'gala_launchpad_fetch_token_spot_price',
|
|
24
|
-
FETCH_LAUNCHPAD_TOKEN_SPOT_PRICE: 'gala_launchpad_fetch_launchpad_token_spot_price',
|
|
25
|
-
CHECK_TOKEN_NAME: 'gala_launchpad_check_token_name',
|
|
26
|
-
CHECK_TOKEN_SYMBOL: 'gala_launchpad_check_token_symbol',
|
|
27
|
-
IS_TOKEN_GRADUATED: 'gala_launchpad_is_token_graduated',
|
|
28
|
-
} as const;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Trading Operations Tools (9 tools)
|
|
32
|
-
*/
|
|
33
|
-
export const TRADING_TOOLS = {
|
|
34
|
-
CALCULATE_BUY_AMOUNT: 'gala_launchpad_calculate_buy_amount',
|
|
35
|
-
CALCULATE_BUY_AMOUNT_LOCAL: 'gala_launchpad_calculate_buy_amount_local',
|
|
36
|
-
CALCULATE_BUY_AMOUNT_EXTERNAL: 'gala_launchpad_calculate_buy_amount_external',
|
|
37
|
-
CALCULATE_SELL_AMOUNT: 'gala_launchpad_calculate_sell_amount',
|
|
38
|
-
CALCULATE_SELL_AMOUNT_LOCAL: 'gala_launchpad_calculate_sell_amount_local',
|
|
39
|
-
CALCULATE_SELL_AMOUNT_EXTERNAL: 'gala_launchpad_calculate_sell_amount_external',
|
|
40
|
-
CALCULATE_BUY_AMOUNT_FOR_GRADUATION: 'gala_launchpad_calculate_buy_amount_for_graduation',
|
|
41
|
-
BUY_TOKENS: 'gala_launchpad_buy_tokens',
|
|
42
|
-
SELL_TOKENS: 'gala_launchpad_sell_tokens',
|
|
43
|
-
GRADUATE_TOKEN: 'gala_launchpad_graduate_token',
|
|
44
|
-
FETCH_TRADES: 'gala_launchpad_fetch_trades',
|
|
45
|
-
GET_BUNDLER_TRANSACTION_RESULT: 'gala_launchpad_get_bundler_transaction_result',
|
|
46
|
-
} as const;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Balance & Portfolio Tools (6 tools)
|
|
50
|
-
*/
|
|
51
|
-
export const BALANCE_TOOLS = {
|
|
52
|
-
FETCH_GALA_BALANCE: 'gala_launchpad_fetch_gala_balance',
|
|
53
|
-
FETCH_TOKEN_BALANCE: 'gala_launchpad_fetch_token_balance',
|
|
54
|
-
FETCH_TOKENS_HELD: 'gala_launchpad_fetch_tokens_held',
|
|
55
|
-
FETCH_TOKENS_CREATED: 'gala_launchpad_fetch_tokens_created',
|
|
56
|
-
FETCH_PROFILE: 'gala_launchpad_fetch_profile',
|
|
57
|
-
UPDATE_PROFILE: 'gala_launchpad_update_profile',
|
|
58
|
-
} as const;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Token Creation Tools (4 tools)
|
|
62
|
-
*/
|
|
63
|
-
export const CREATION_TOOLS = {
|
|
64
|
-
LAUNCH_TOKEN: 'gala_launchpad_launch_token',
|
|
65
|
-
UPLOAD_TOKEN_IMAGE: 'gala_launchpad_upload_token_image',
|
|
66
|
-
UPLOAD_PROFILE_IMAGE: 'gala_launchpad_upload_profile_image',
|
|
67
|
-
FETCH_LAUNCH_TOKEN_FEE: 'gala_launchpad_fetch_launch_token_fee',
|
|
68
|
-
CALCULATE_INITIAL_BUY: 'gala_launchpad_calculate_initial_buy',
|
|
69
|
-
} as const;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Social & Comments Tools (2 tools)
|
|
73
|
-
*/
|
|
74
|
-
export const SOCIAL_TOOLS = {
|
|
75
|
-
POST_COMMENT: 'gala_launchpad_post_comment',
|
|
76
|
-
FETCH_COMMENTS: 'gala_launchpad_fetch_comments',
|
|
77
|
-
} as const;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Token Transfer Tools (2 tools)
|
|
81
|
-
*/
|
|
82
|
-
export const TRANSFER_TOOLS = {
|
|
83
|
-
TRANSFER_GALA: 'gala_launchpad_transfer_gala',
|
|
84
|
-
TRANSFER_TOKEN: 'gala_launchpad_transfer_token',
|
|
85
|
-
} as const;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Utility Tools (6 tools)
|
|
89
|
-
*/
|
|
90
|
-
export const UTILITY_TOOLS = {
|
|
91
|
-
CREATE_WALLET: 'gala_launchpad_create_wallet',
|
|
92
|
-
GET_ADDRESS: 'gala_launchpad_get_address',
|
|
93
|
-
GET_ETHEREUM_ADDRESS: 'gala_launchpad_get_ethereum_address',
|
|
94
|
-
GET_CONFIG: 'gala_launchpad_get_config',
|
|
95
|
-
GET_URL_BY_TOKEN_NAME: 'gala_launchpad_get_url_by_token_name',
|
|
96
|
-
RESOLVE_TOKEN_CLASS_KEY: 'gala_launchpad_resolve_token_class_key',
|
|
97
|
-
RESOLVE_VAULT_ADDRESS: 'gala_launchpad_resolve_vault_address',
|
|
98
|
-
EXPLAIN_SDK_USAGE: 'gala_launchpad_explain_sdk_usage',
|
|
99
|
-
} as const;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* All MCP Tools - Flat structure for easy access
|
|
103
|
-
*
|
|
104
|
-
* Use specific category constants above for better organization,
|
|
105
|
-
* or use this flat object for backwards compatibility.
|
|
106
|
-
*/
|
|
107
|
-
export const MCP_TOOLS = {
|
|
108
|
-
// Pool Management & Pricing
|
|
109
|
-
...POOL_TOOLS,
|
|
110
|
-
// Trading Operations
|
|
111
|
-
...TRADING_TOOLS,
|
|
112
|
-
// Balance & Portfolio
|
|
113
|
-
...BALANCE_TOOLS,
|
|
114
|
-
// Token Creation
|
|
115
|
-
...CREATION_TOOLS,
|
|
116
|
-
// Social & Comments
|
|
117
|
-
...SOCIAL_TOOLS,
|
|
118
|
-
// Token Transfers
|
|
119
|
-
...TRANSFER_TOOLS,
|
|
120
|
-
// Utilities
|
|
121
|
-
...UTILITY_TOOLS,
|
|
122
|
-
} as const;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Type helper for tool names
|
|
126
|
-
*/
|
|
127
|
-
export type MCPToolName = (typeof MCP_TOOLS)[keyof typeof MCP_TOOLS];
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Get all tool names as an array
|
|
131
|
-
*/
|
|
132
|
-
export function getAllToolNames(): string[] {
|
|
133
|
-
return Object.values(MCP_TOOLS);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Check if a string is a valid MCP tool name
|
|
138
|
-
*/
|
|
139
|
-
export function isValidToolName(name: string): name is MCPToolName {
|
|
140
|
-
return getAllToolNames().includes(name);
|
|
141
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Gala Launchpad MCP Server Entry Point
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { LaunchpadMCPServer } from './server.js';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
const server = new LaunchpadMCPServer();
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
await server.start();
|
|
13
|
-
} catch (error) {
|
|
14
|
-
console.error('[MCP Server] Fatal error:', error);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
main();
|