@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,393 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common MCP Tool Schema Definitions
|
|
3
|
-
*
|
|
4
|
-
* Reusable schema components to eliminate duplication across 37 MCP tools.
|
|
5
|
-
* These schemas are imported and composed into tool-specific inputSchema definitions.
|
|
6
|
-
*
|
|
7
|
-
* UNIFIED APPROACH: Uses SDK Zod schemas as single source of truth, converting to JSON Schema for MCP.
|
|
8
|
-
*
|
|
9
|
-
* @see https://modelcontextprotocol.io/docs/concepts/tools
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
13
|
-
import {
|
|
14
|
-
tokenNameSchema,
|
|
15
|
-
tokenSymbolSchema,
|
|
16
|
-
tokenDescriptionSchema,
|
|
17
|
-
flexibleAddressSchema,
|
|
18
|
-
positiveDecimalStringSchema,
|
|
19
|
-
fullNameSchema,
|
|
20
|
-
searchQuerySchema,
|
|
21
|
-
commentMessageSchema,
|
|
22
|
-
urlSchema,
|
|
23
|
-
privateKeySchema,
|
|
24
|
-
transactionIdSchema,
|
|
25
|
-
uniqueKeySchema,
|
|
26
|
-
nonNegativeDecimalStringSchema,
|
|
27
|
-
isoDateStringSchema,
|
|
28
|
-
pageNumberSchema,
|
|
29
|
-
createLimitSchema as zodCreateLimitSchema,
|
|
30
|
-
} from '@gala-chain/launchpad-sdk';
|
|
31
|
-
import { MCP_CONSTRAINTS } from '../utils/constraints.js';
|
|
32
|
-
|
|
33
|
-
// =============================================================================
|
|
34
|
-
// Helper: Convert Zod schema to MCP-compatible JSON Schema
|
|
35
|
-
// =============================================================================
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Converts a Zod schema to JSON Schema format suitable for MCP tool definitions
|
|
39
|
-
* Extracts only the properties we need (type, pattern, description, etc.)
|
|
40
|
-
*/
|
|
41
|
-
function toMCPSchema(zodSchema: any, customDescription?: string): any {
|
|
42
|
-
const jsonSchema = zodToJsonSchema(zodSchema, { $refStrategy: 'none' });
|
|
43
|
-
|
|
44
|
-
// Extract the schema properties (removing $schema metadata)
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
|
-
const { $schema, ...schemaProps } = jsonSchema;
|
|
47
|
-
|
|
48
|
-
// Override description if provided
|
|
49
|
-
if (customDescription) {
|
|
50
|
-
schemaProps.description = customDescription;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return schemaProps;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// =============================================================================
|
|
57
|
-
// Token Schemas (from SDK)
|
|
58
|
-
// =============================================================================
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Token name schema - used in 11+ tools
|
|
62
|
-
*
|
|
63
|
-
* @description Generated from SDK tokenNameSchema
|
|
64
|
-
* @pattern ^[a-zA-Z0-9]{3,20}$
|
|
65
|
-
* @minLength 3
|
|
66
|
-
* @maxLength 20
|
|
67
|
-
* @example "boba", "testtoken", "mytoken123"
|
|
68
|
-
*/
|
|
69
|
-
export const TOKEN_NAME_SCHEMA = toMCPSchema(tokenNameSchema, 'Token name');
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Token symbol schema - used in creation tools
|
|
73
|
-
*
|
|
74
|
-
* @description Generated from SDK tokenSymbolSchema
|
|
75
|
-
* @pattern ^[A-Z]{1,8}$
|
|
76
|
-
* @minLength 1
|
|
77
|
-
* @maxLength 8
|
|
78
|
-
* @example "GALA", "TEST", "MTK"
|
|
79
|
-
*/
|
|
80
|
-
export const TOKEN_SYMBOL_SCHEMA = toMCPSchema(tokenSymbolSchema, 'Token symbol');
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Token description schema
|
|
84
|
-
*
|
|
85
|
-
* @description Generated from SDK tokenDescriptionSchema
|
|
86
|
-
* @minLength 1
|
|
87
|
-
* @maxLength 500
|
|
88
|
-
* @example "A revolutionary new token for decentralized gaming"
|
|
89
|
-
*/
|
|
90
|
-
export const TOKEN_DESCRIPTION_SCHEMA = toMCPSchema(
|
|
91
|
-
tokenDescriptionSchema,
|
|
92
|
-
'Token description'
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
// =============================================================================
|
|
96
|
-
// Authentication & Address Schemas (from SDK)
|
|
97
|
-
// =============================================================================
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Private key schema - used in 18+ tools
|
|
101
|
-
*
|
|
102
|
-
* @description Generated from SDK privateKeySchema
|
|
103
|
-
* @pattern ^0x[a-fA-F0-9]{64}$
|
|
104
|
-
* @example "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
|
|
105
|
-
* @security Sensitive - should never be logged or exposed
|
|
106
|
-
*/
|
|
107
|
-
export const PRIVATE_KEY_SCHEMA = toMCPSchema(
|
|
108
|
-
privateKeySchema,
|
|
109
|
-
'Optional private key override for this operation (format: "0x" + 64 hex characters). If provided, uses this wallet instead of the default MCP server wallet.'
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Wallet address schema - supports both Ethereum (0x...) and GalaChain (eth|...) formats
|
|
114
|
-
*
|
|
115
|
-
* @description Generated from SDK flexibleAddressSchema
|
|
116
|
-
* @example "0x1234567890abcdef1234567890abcdef12345678"
|
|
117
|
-
* @example "eth|1234567890abcdef1234567890abcdef12345678"
|
|
118
|
-
*/
|
|
119
|
-
export const ADDRESS_SCHEMA = toMCPSchema(flexibleAddressSchema, 'Wallet address');
|
|
120
|
-
|
|
121
|
-
// =============================================================================
|
|
122
|
-
// Amount Schemas (from SDK)
|
|
123
|
-
// =============================================================================
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Decimal amount schema - used in trading and transfer tools
|
|
127
|
-
*
|
|
128
|
-
* @description Generated from SDK positiveDecimalStringSchema
|
|
129
|
-
* @pattern ^\d+(\.\d+)?$
|
|
130
|
-
* @example "100", "1.5", "0.001"
|
|
131
|
-
* @note Must be positive (greater than zero)
|
|
132
|
-
*/
|
|
133
|
-
export const DECIMAL_AMOUNT_SCHEMA = toMCPSchema(
|
|
134
|
-
positiveDecimalStringSchema,
|
|
135
|
-
'Amount in standard decimal format (e.g., "1" for 1 GALA)'
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Pre-buy quantity schema - used in token creation
|
|
140
|
-
*
|
|
141
|
-
* @description Generated from SDK nonNegativeDecimalStringSchema
|
|
142
|
-
* @pattern ^\d+(\.\d+)?$
|
|
143
|
-
* @example "0", "100", "1500.5"
|
|
144
|
-
* @note Can be zero or positive (non-negative)
|
|
145
|
-
*/
|
|
146
|
-
export const PRE_BUY_QUANTITY_SCHEMA = toMCPSchema(
|
|
147
|
-
nonNegativeDecimalStringSchema,
|
|
148
|
-
'Pre-buy quantity as decimal string (defaults to "0")'
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Integer amount schema - used in token transfers
|
|
153
|
-
*
|
|
154
|
-
* @description Manual schema (not from SDK primitives)
|
|
155
|
-
* @pattern ^[0-9]+$
|
|
156
|
-
* @example "100", "1000", "5000000"
|
|
157
|
-
* @note Integer only (no decimals) - for token transfer operations
|
|
158
|
-
*/
|
|
159
|
-
export const INTEGER_AMOUNT_SCHEMA = {
|
|
160
|
-
type: 'string' as const,
|
|
161
|
-
pattern: '^[0-9]+$',
|
|
162
|
-
description: 'Token amount',
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// =============================================================================
|
|
166
|
-
// URL & Text Schemas (from SDK)
|
|
167
|
-
// =============================================================================
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* URL schema - used for social URLs and token images
|
|
171
|
-
*
|
|
172
|
-
* @description Generated from SDK urlSchema
|
|
173
|
-
* @pattern ^https?:\/\/
|
|
174
|
-
* @format uri
|
|
175
|
-
* @example "https://example.com", "https://twitter.com/username"
|
|
176
|
-
* @note Must start with http:// or https://
|
|
177
|
-
*/
|
|
178
|
-
export const URL_SCHEMA = toMCPSchema(urlSchema);
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Comment message schema
|
|
182
|
-
*
|
|
183
|
-
* @description Generated from SDK commentMessageSchema
|
|
184
|
-
* @minLength 1
|
|
185
|
-
* @maxLength 500
|
|
186
|
-
* @example "Great token!", "Looking forward to this project"
|
|
187
|
-
*/
|
|
188
|
-
export const COMMENT_MESSAGE_SCHEMA = toMCPSchema(
|
|
189
|
-
commentMessageSchema,
|
|
190
|
-
'Comment message text'
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Profile name schema
|
|
195
|
-
*
|
|
196
|
-
* @description Generated from SDK fullNameSchema
|
|
197
|
-
* @pattern ^[a-zA-Z\s]+$
|
|
198
|
-
* @minLength 1
|
|
199
|
-
* @maxLength 100
|
|
200
|
-
* @example "John Doe", "Alice Smith"
|
|
201
|
-
* @note Only letters and spaces allowed
|
|
202
|
-
*/
|
|
203
|
-
export const FULL_NAME_SCHEMA = toMCPSchema(fullNameSchema, 'Full name');
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Search query schema - used in user tools
|
|
207
|
-
*
|
|
208
|
-
* @description Generated from SDK searchQuerySchema
|
|
209
|
-
* @minLength 1
|
|
210
|
-
* @maxLength 100
|
|
211
|
-
* @example "dragon", "test", "my token"
|
|
212
|
-
* @note Fuzzy match - case-insensitive, partial matching
|
|
213
|
-
*/
|
|
214
|
-
export const SEARCH_SCHEMA = toMCPSchema(
|
|
215
|
-
searchQuerySchema,
|
|
216
|
-
'Optional search query (fuzzy match filter)'
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Transaction ID schema - used for getBundlerTransactionResult
|
|
221
|
-
*
|
|
222
|
-
* @description Generated from SDK transactionIdSchema
|
|
223
|
-
* @pattern ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
|
|
224
|
-
* @format uuid
|
|
225
|
-
* @example "550e8400-e29b-41d4-a716-446655440000"
|
|
226
|
-
* @note UUID v4 format - returned from buy(), sell(), launchToken()
|
|
227
|
-
*/
|
|
228
|
-
export const TRANSACTION_ID_SCHEMA = toMCPSchema(
|
|
229
|
-
transactionIdSchema,
|
|
230
|
-
'Transaction ID (UUID format) from buy(), sell(), or launchToken()'
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Idempotency key schema - used in transfer tools
|
|
235
|
-
*
|
|
236
|
-
* @description Generated from SDK uniqueKeySchema
|
|
237
|
-
* @pattern ^galaconnect-operation-[a-z0-9-]+$
|
|
238
|
-
* @example "galaconnect-operation-abc123-def456"
|
|
239
|
-
* @note Prevents duplicate transactions - optional but recommended
|
|
240
|
-
*/
|
|
241
|
-
export const UNIQUE_KEY_SCHEMA = toMCPSchema(uniqueKeySchema, 'Optional idempotency key');
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Date-time schema - used in trade and volume queries
|
|
245
|
-
*
|
|
246
|
-
* @description Generated from SDK isoDateStringSchema
|
|
247
|
-
* @format date-time
|
|
248
|
-
* @example "2024-01-15T14:30:25", "2024-01-15T14:30:25Z"
|
|
249
|
-
* @note ISO 8601 format
|
|
250
|
-
*/
|
|
251
|
-
export const DATE_TIME_SCHEMA = toMCPSchema(isoDateStringSchema);
|
|
252
|
-
|
|
253
|
-
// =============================================================================
|
|
254
|
-
// Pagination Schemas (from SDK)
|
|
255
|
-
// =============================================================================
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Page number schema - used in ~15 tools
|
|
259
|
-
*
|
|
260
|
-
* @description Generated from SDK pageNumberSchema
|
|
261
|
-
* @type number
|
|
262
|
-
* @minimum 1
|
|
263
|
-
* @maximum 1000
|
|
264
|
-
* @example 1, 2, 50
|
|
265
|
-
* @note Default: 1 (first page)
|
|
266
|
-
*/
|
|
267
|
-
export const PAGE_SCHEMA = toMCPSchema(pageNumberSchema, 'Page number (default: 1)');
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Creates a limit schema with operation-specific maximum
|
|
271
|
-
* Uses SDK Zod schemas and converts to JSON Schema
|
|
272
|
-
*
|
|
273
|
-
* @param operationType - The type of operation (trade, user, pool, comment)
|
|
274
|
-
* @param defaultLimit - Default limit value (typically 20)
|
|
275
|
-
* @returns Limit schema with appropriate maximum
|
|
276
|
-
*/
|
|
277
|
-
export function createLimitSchema(
|
|
278
|
-
operationType: 'trade' | 'user' | 'pool' | 'comment' | 'priceHistory',
|
|
279
|
-
defaultLimit: number = 20
|
|
280
|
-
): {
|
|
281
|
-
type: 'number';
|
|
282
|
-
minimum: number;
|
|
283
|
-
maximum: number;
|
|
284
|
-
description: string;
|
|
285
|
-
} {
|
|
286
|
-
const maxLimits = {
|
|
287
|
-
trade: MCP_CONSTRAINTS.TRADE_LIMIT, // 20
|
|
288
|
-
user: MCP_CONSTRAINTS.USER_LIMIT, // 20
|
|
289
|
-
pool: MCP_CONSTRAINTS.POOL_LIMIT, // 100
|
|
290
|
-
comment: MCP_CONSTRAINTS.COMMENT_LIMIT, // 50
|
|
291
|
-
priceHistory: MCP_CONSTRAINTS.PRICE_HISTORY_LIMIT, // 50
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
// Use SDK Zod createLimitSchema and convert to JSON Schema
|
|
295
|
-
const zodLimit = zodCreateLimitSchema(maxLimits[operationType]);
|
|
296
|
-
const jsonSchemaLimit = toMCPSchema(
|
|
297
|
-
zodLimit,
|
|
298
|
-
`Results per page (default: ${defaultLimit}, maximum: ${maxLimits[operationType]})`
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
return jsonSchemaLimit as {
|
|
302
|
-
type: 'number';
|
|
303
|
-
minimum: number;
|
|
304
|
-
maximum: number;
|
|
305
|
-
description: string;
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// =============================================================================
|
|
310
|
-
// Trading Schemas (manual - not in SDK primitives)
|
|
311
|
-
// =============================================================================
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Slippage tolerance factor schema
|
|
315
|
-
*
|
|
316
|
-
* @description Manual schema (not from SDK primitives)
|
|
317
|
-
* @type number
|
|
318
|
-
* @minimum 0
|
|
319
|
-
* @maximum 1
|
|
320
|
-
* @example 0.01 (1%), 0.05 (5%), 0.1 (10%)
|
|
321
|
-
* @note Decimal format - protects against price movements during transaction
|
|
322
|
-
*/
|
|
323
|
-
export const SLIPPAGE_TOLERANCE_SCHEMA = {
|
|
324
|
-
type: 'number' as const,
|
|
325
|
-
minimum: 0,
|
|
326
|
-
maximum: 1,
|
|
327
|
-
description: 'Decimal format (0.05 = 5% slippage)',
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Reverse bonding curve fee slippage schema
|
|
332
|
-
*
|
|
333
|
-
* @description Manual schema (not from SDK primitives)
|
|
334
|
-
* @type number
|
|
335
|
-
* @minimum 0
|
|
336
|
-
* @maximum 1
|
|
337
|
-
* @example 0.01 (1% - default), 0.02 (2%), 0.05 (5%)
|
|
338
|
-
* @note Applied to maxAcceptableReverseBondingCurveFee for additional protection
|
|
339
|
-
*/
|
|
340
|
-
export const RBC_FEE_SLIPPAGE_SCHEMA = {
|
|
341
|
-
type: 'number' as const,
|
|
342
|
-
minimum: 0,
|
|
343
|
-
maximum: 1,
|
|
344
|
-
description:
|
|
345
|
-
'Optional slippage tolerance for reverse bonding curve fee (decimal, e.g., 0.01 for 1%). Defaults to 0.01 (1%) if not provided. Applied to maxAcceptableReverseBondingCurveFee to increase max acceptable fee.',
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Sort order schema
|
|
350
|
-
*
|
|
351
|
-
* @description Manual schema (not from SDK primitives)
|
|
352
|
-
* @type string
|
|
353
|
-
* @enum ['ASC', 'DESC']
|
|
354
|
-
* @example "ASC" (oldest first), "DESC" (newest first - default)
|
|
355
|
-
* @note Default: DESC (descending, newest first)
|
|
356
|
-
*/
|
|
357
|
-
export const SORT_ORDER_SCHEMA = {
|
|
358
|
-
type: 'string' as const,
|
|
359
|
-
enum: ['ASC', 'DESC'],
|
|
360
|
-
description: 'Sort order (default: DESC)',
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Calculation mode schema - for calculateAmountMode parameter
|
|
365
|
-
*
|
|
366
|
-
* @description Manual schema (not from SDK primitives)
|
|
367
|
-
* @type string
|
|
368
|
-
* @enum ['local', 'external']
|
|
369
|
-
* @example "local" (instant client-side), "external" (network-based GalaChain)
|
|
370
|
-
* @note Default: SDK's calculateAmountMode setting
|
|
371
|
-
* @note Local mode: <1ms, 99.99% accurate | External mode: ~200ms, 100% accurate
|
|
372
|
-
*/
|
|
373
|
-
export const CALCULATION_MODE_SCHEMA = {
|
|
374
|
-
type: 'string' as const,
|
|
375
|
-
enum: ['local', 'external'],
|
|
376
|
-
description: `Calculation mode override (optional - defaults to SDK's calculateAmountMode).
|
|
377
|
-
Use CALCULATION_MODES.LOCAL for instant client-side calculations.
|
|
378
|
-
Use CALCULATION_MODES.EXTERNAL for network-based GalaChain calculations.`,
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Current supply schema - for performance optimization
|
|
383
|
-
*
|
|
384
|
-
* @description Extends DECIMAL_AMOUNT_SCHEMA
|
|
385
|
-
* @pattern ^\d+(\.\d+)?$
|
|
386
|
-
* @example "1000000", "5000000.5"
|
|
387
|
-
* @note Performance optimization: provide to avoid fetching pool details twice
|
|
388
|
-
* @note Only used in local calculation mode - auto-fetched if missing
|
|
389
|
-
*/
|
|
390
|
-
export const CURRENT_SUPPLY_SCHEMA = {
|
|
391
|
-
...DECIMAL_AMOUNT_SCHEMA,
|
|
392
|
-
description: 'Current token supply (optional - only used for local mode, auto-fetched if missing)',
|
|
393
|
-
};
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehensive Prompt Testing Script
|
|
3
|
-
* Tests all 14 MCP prompts with v1.5.0 enhancements
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { getPrompt } from '../../dist/prompts/index.js';
|
|
7
|
-
|
|
8
|
-
// Color codes for output
|
|
9
|
-
const GREEN = '\x1b[32m';
|
|
10
|
-
const RED = '\x1b[31m';
|
|
11
|
-
const BLUE = '\x1b[34m';
|
|
12
|
-
const YELLOW = '\x1b[33m';
|
|
13
|
-
const RESET = '\x1b[0m';
|
|
14
|
-
|
|
15
|
-
interface TestResult {
|
|
16
|
-
promptName: string;
|
|
17
|
-
success: boolean;
|
|
18
|
-
error?: string;
|
|
19
|
-
messageCount?: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const results: TestResult[] = [];
|
|
23
|
-
|
|
24
|
-
function log(color: string, ...args: any[]) {
|
|
25
|
-
console.log(color, ...args, RESET);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function testPrompt(name: string, args: Record<string, string> = {}): TestResult {
|
|
29
|
-
try {
|
|
30
|
-
const prompt = getPrompt(name);
|
|
31
|
-
|
|
32
|
-
if (!prompt) {
|
|
33
|
-
return {
|
|
34
|
-
promptName: name,
|
|
35
|
-
success: false,
|
|
36
|
-
error: 'Prompt not found in registry',
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const messages = prompt.handler(args);
|
|
41
|
-
|
|
42
|
-
if (!Array.isArray(messages) || messages.length === 0) {
|
|
43
|
-
return {
|
|
44
|
-
promptName: name,
|
|
45
|
-
success: false,
|
|
46
|
-
error: 'Handler did not return message array',
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Validate message structure
|
|
51
|
-
for (const msg of messages) {
|
|
52
|
-
if (!msg.role || !msg.content || !msg.content.type) {
|
|
53
|
-
return {
|
|
54
|
-
promptName: name,
|
|
55
|
-
success: false,
|
|
56
|
-
error: 'Invalid message structure',
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
promptName: name,
|
|
63
|
-
success: true,
|
|
64
|
-
messageCount: messages.length,
|
|
65
|
-
};
|
|
66
|
-
} catch (error) {
|
|
67
|
-
return {
|
|
68
|
-
promptName: name,
|
|
69
|
-
success: false,
|
|
70
|
-
error: error instanceof Error ? error.message : String(error),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function runAllTests() {
|
|
76
|
-
log(BLUE, '\n๐งช Testing All 14 MCP Prompts with v1.5.0 Enhancements\n');
|
|
77
|
-
log(BLUE, 'โ'.repeat(80));
|
|
78
|
-
|
|
79
|
-
// Trading Prompts (4)
|
|
80
|
-
log(YELLOW, '\n๐ Trading Prompts (4)');
|
|
81
|
-
results.push(testPrompt('galachain-launchpad:analyze-token', { tokenName: 'boba' }));
|
|
82
|
-
results.push(testPrompt('galachain-launchpad:buy-tokens', { tokenName: 'boba', galaAmount: '100' }));
|
|
83
|
-
results.push(testPrompt('galachain-launchpad:sell-tokens', { tokenName: 'boba', tokenAmount: '1000' }));
|
|
84
|
-
results.push(testPrompt('galachain-launchpad:graduate-token', { tokenName: 'boba' }));
|
|
85
|
-
|
|
86
|
-
// Portfolio Prompts (5)
|
|
87
|
-
log(YELLOW, '\n๐ผ Portfolio Prompts (5)');
|
|
88
|
-
results.push(testPrompt('galachain-launchpad:portfolio'));
|
|
89
|
-
results.push(testPrompt('galachain-launchpad:balance', { tokenName: 'boba' }));
|
|
90
|
-
results.push(testPrompt('galachain-launchpad:tokens-held', { limit: '10' }));
|
|
91
|
-
results.push(testPrompt('galachain-launchpad:tokens-created'));
|
|
92
|
-
results.push(testPrompt('galachain-launchpad:profile'));
|
|
93
|
-
|
|
94
|
-
// Analysis Prompts (5)
|
|
95
|
-
log(YELLOW, '\n๐ Analysis Prompts (5)');
|
|
96
|
-
results.push(testPrompt('galachain-launchpad:compare-tokens', { token1: 'boba', token2: 'testa' }));
|
|
97
|
-
results.push(testPrompt('galachain-launchpad:pool-details', { tokenName: 'boba' }));
|
|
98
|
-
results.push(testPrompt('galachain-launchpad:graduation-status', { tokens: 'boba,testa,dragon' }));
|
|
99
|
-
results.push(testPrompt('galachain-launchpad:spot-prices', { tokens: 'boba,testa' }));
|
|
100
|
-
results.push(testPrompt('galachain-launchpad:trade-history', { tokenName: 'boba' }));
|
|
101
|
-
|
|
102
|
-
// Print Results
|
|
103
|
-
log(BLUE, '\nโ'.repeat(80));
|
|
104
|
-
log(BLUE, '\n๐ Test Results Summary\n');
|
|
105
|
-
|
|
106
|
-
let passed = 0;
|
|
107
|
-
let failed = 0;
|
|
108
|
-
|
|
109
|
-
results.forEach((result) => {
|
|
110
|
-
if (result.success) {
|
|
111
|
-
log(GREEN, `โ
${result.promptName} - ${result.messageCount} messages`);
|
|
112
|
-
passed++;
|
|
113
|
-
} else {
|
|
114
|
-
log(RED, `โ ${result.promptName} - ${result.error}`);
|
|
115
|
-
failed++;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
log(BLUE, '\nโ'.repeat(80));
|
|
120
|
-
log(BLUE, `\n๐ Final Score: ${passed}/${results.length} prompts passed\n`);
|
|
121
|
-
|
|
122
|
-
if (failed === 0) {
|
|
123
|
-
log(GREEN, '๐ ALL PROMPTS WORKING CORRECTLY WITH v1.5.0 ENHANCEMENTS!\n');
|
|
124
|
-
log(GREEN, 'โ
MCP Tool Constants: Working');
|
|
125
|
-
log(GREEN, 'โ
Workflow Templates: Working');
|
|
126
|
-
log(GREEN, 'โ
Input Validation: Working');
|
|
127
|
-
log(GREEN, 'โ
Registry Optimization: Working\n');
|
|
128
|
-
} else {
|
|
129
|
-
log(RED, `โ ๏ธ ${failed} prompts failed validation\n`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
log(BLUE, 'โ'.repeat(80));
|
|
133
|
-
|
|
134
|
-
// Test specific v1.5.0 features
|
|
135
|
-
log(YELLOW, '\n๐ง Testing v1.5.0 Specific Features\n');
|
|
136
|
-
|
|
137
|
-
// Test O(1) lookup performance
|
|
138
|
-
log(BLUE, 'Testing O(1) Registry Lookup Performance...');
|
|
139
|
-
const iterations = 10000;
|
|
140
|
-
const start = Date.now();
|
|
141
|
-
for (let i = 0; i < iterations; i++) {
|
|
142
|
-
getPrompt('galachain-launchpad:analyze-token');
|
|
143
|
-
}
|
|
144
|
-
const duration = Date.now() - start;
|
|
145
|
-
|
|
146
|
-
if (duration < 100) {
|
|
147
|
-
log(GREEN, `โ
O(1) Performance: ${iterations} lookups in ${duration}ms (< 100ms threshold)`);
|
|
148
|
-
} else {
|
|
149
|
-
log(RED, `โ O(1) Performance: ${iterations} lookups in ${duration}ms (>= 100ms threshold)`);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Test validation error handling
|
|
153
|
-
log(BLUE, '\nTesting Input Validation Error Handling...');
|
|
154
|
-
const invalidTest = testPrompt('galachain-launchpad:analyze-token', { tokenName: 'invalid@#$' });
|
|
155
|
-
if (!invalidTest.success && invalidTest.error?.includes('Validation error')) {
|
|
156
|
-
log(GREEN, 'โ
Validation: Correctly rejects invalid token names');
|
|
157
|
-
} else {
|
|
158
|
-
log(RED, 'โ Validation: Did not catch invalid token name');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const emptyTest = testPrompt('galachain-launchpad:buy-tokens', { tokenName: '', galaAmount: '100' });
|
|
162
|
-
if (!emptyTest.success && emptyTest.error?.includes('Validation error')) {
|
|
163
|
-
log(GREEN, 'โ
Validation: Correctly rejects empty token names');
|
|
164
|
-
} else {
|
|
165
|
-
log(RED, 'โ Validation: Did not catch empty token name');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const negativeTest = testPrompt('galachain-launchpad:buy-tokens', { tokenName: 'boba', galaAmount: '-100' });
|
|
169
|
-
if (!negativeTest.success && negativeTest.error?.includes('Validation error')) {
|
|
170
|
-
log(GREEN, 'โ
Validation: Correctly rejects negative amounts');
|
|
171
|
-
} else {
|
|
172
|
-
log(RED, 'โ Validation: Did not catch negative amount');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
log(BLUE, '\nโ'.repeat(80));
|
|
176
|
-
log(GREEN, '\nโจ v1.5.0 Enhancement Verification Complete!\n');
|
|
177
|
-
|
|
178
|
-
process.exit(failed === 0 ? 0 : 1);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
runAllTests().catch((error) => {
|
|
182
|
-
log(RED, 'Fatal error:', error);
|
|
183
|
-
process.exit(1);
|
|
184
|
-
});
|