@gala-chain/launchpad-mcp-server 1.23.1 → 1.24.1
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 +20 -0
- package/README.md +34 -6
- package/dist/constants/mcpToolNames.d.ts +6 -2
- package/dist/constants/mcpToolNames.d.ts.map +1 -1
- package/dist/constants/mcpToolNames.js +4 -2
- package/dist/constants/mcpToolNames.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/prompts/explore-dex-pools.d.ts +20 -0
- package/dist/prompts/explore-dex-pools.d.ts.map +1 -0
- package/dist/prompts/explore-dex-pools.js +132 -0
- package/dist/prompts/explore-dex-pools.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +6 -3
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/pools.js.map +1 -1
- package/dist/tools/dex/fetchAllDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchAllDexPools.js +45 -0
- package/dist/tools/dex/fetchAllDexPools.js.map +1 -0
- package/dist/tools/dex/fetchDexPools.d.ts +9 -0
- package/dist/tools/dex/fetchDexPools.d.ts.map +1 -0
- package/dist/tools/dex/fetchDexPools.js +58 -0
- package/dist/tools/dex/fetchDexPools.js.map +1 -0
- package/dist/tools/dex/index.d.ts +4 -3
- package/dist/tools/dex/index.d.ts.map +1 -1
- package/dist/tools/dex/index.js +9 -4
- package/dist/tools/dex/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +3 -3
- package/docs/AI-AGENT-PATTERNS.md +555 -0
- package/docs/CONSTRAINTS-REFERENCE.md +454 -0
- package/docs/PROMPT-TOOL-MAPPING.md +352 -0
- package/docs/examples/default-values-pattern.md +240 -0
- package/docs/examples/tool-factory-pattern.md +217 -0
- package/jest.config.js +94 -0
- package/package.json +3 -3
- package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +258 -0
- package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
- package/src/__tests__/server.test.ts +255 -0
- package/src/constants/mcpToolNames.ts +183 -0
- package/src/index.ts +19 -0
- package/src/prompts/__tests__/promptStructure.test.ts +187 -0
- package/src/prompts/__tests__/registry.test.ts +349 -0
- package/src/prompts/analysis.ts +380 -0
- package/src/prompts/balances.ts +182 -0
- package/src/prompts/create-token.ts +123 -0
- package/src/prompts/creation-utils.ts +103 -0
- package/src/prompts/dex-trading.ts +86 -0
- package/src/prompts/discover-tokens.ts +86 -0
- package/src/prompts/explore-dex-pools.ts +138 -0
- package/src/prompts/index.ts +178 -0
- package/src/prompts/liquidity-positions.ts +237 -0
- package/src/prompts/pools.ts +496 -0
- package/src/prompts/portfolio.ts +208 -0
- package/src/prompts/social.ts +94 -0
- package/src/prompts/trading-calculations.ts +414 -0
- package/src/prompts/trading.ts +160 -0
- package/src/prompts/transfers.ts +97 -0
- package/src/prompts/utility-tools.ts +266 -0
- package/src/prompts/utility.ts +77 -0
- package/src/prompts/utils/handlerHelpers.ts +55 -0
- package/src/prompts/utils/textTemplates.ts +73 -0
- package/src/prompts/utils/workflowTemplates.ts +511 -0
- package/src/schemas/common-schemas.ts +393 -0
- package/src/scripts/test-all-prompts.ts +184 -0
- package/src/server.ts +367 -0
- package/src/tools/__tests__/dex-tools.test.ts +562 -0
- package/src/tools/__tests__/liquidity-positions.test.ts +673 -0
- package/src/tools/balance/index.ts +174 -0
- package/src/tools/creation/index.ts +182 -0
- package/src/tools/dex/fetchAllDexPools.ts +45 -0
- package/src/tools/dex/fetchDexPools.ts +58 -0
- package/src/tools/dex/index.ts +231 -0
- package/src/tools/dex/liquidity-positions.ts +547 -0
- package/src/tools/index.ts +94 -0
- package/src/tools/pools/fetchAllPools.ts +47 -0
- package/src/tools/pools/fetchAllPriceHistory.ts +119 -0
- package/src/tools/pools/fetchPoolDetails.ts +27 -0
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
- package/src/tools/pools/fetchPools.ts +47 -0
- package/src/tools/pools/fetchPriceHistory.ts +124 -0
- package/src/tools/pools/fetchTokenDetails.ts +77 -0
- package/src/tools/pools/index.ts +284 -0
- package/src/tools/social/index.ts +64 -0
- package/src/tools/trading/index.ts +605 -0
- package/src/tools/transfers/index.ts +75 -0
- package/src/tools/utils/clearCache.ts +36 -0
- package/src/tools/utils/createWallet.ts +19 -0
- package/src/tools/utils/explainSdkUsage.ts +1446 -0
- package/src/tools/utils/getAddress.ts +12 -0
- package/src/tools/utils/getCacheInfo.ts +14 -0
- package/src/tools/utils/getConfig.ts +21 -0
- package/src/tools/utils/getEnvironment.ts +17 -0
- package/src/tools/utils/getEthereumAddress.ts +12 -0
- package/src/tools/utils/getUrlByTokenName.ts +12 -0
- package/src/tools/utils/getVersion.ts +25 -0
- package/src/tools/utils/getWallet.ts +25 -0
- package/src/tools/utils/hasWallet.ts +15 -0
- package/src/tools/utils/index.ts +37 -0
- package/src/tools/utils/isTokenGraduated.ts +16 -0
- package/src/tools/utils/setWallet.ts +41 -0
- package/src/tools/utils/switchEnvironment.ts +28 -0
- package/src/types/mcp.ts +72 -0
- package/src/utils/__tests__/validation.test.ts +147 -0
- package/src/utils/constraints.ts +155 -0
- package/src/utils/default-values.ts +208 -0
- package/src/utils/error-handler.ts +69 -0
- package/src/utils/error-templates.ts +273 -0
- package/src/utils/response-formatter.ts +51 -0
- package/src/utils/tool-factory.ts +303 -0
- package/src/utils/tool-registry.ts +296 -0
- package/src/utils/validation.ts +429 -0
- package/tests/wallet-management-integration.test.ts +284 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Transfer Prompts
|
|
3
|
+
*
|
|
4
|
+
* Slash commands for transferring tokens and GALA
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { MCPPrompt } from '../types/mcp.js';
|
|
8
|
+
import { MCP_TOOLS } from '../constants/mcpToolNames.js';
|
|
9
|
+
import { validateAddress, validateNumericAmount, validateTokenName } from '../utils/validation.js';
|
|
10
|
+
import { createPromptResponse } from './utils/handlerHelpers.js';
|
|
11
|
+
import { createSimpleOperationText } from './utils/textTemplates.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Transfer GALA - GALA token transfer
|
|
15
|
+
*/
|
|
16
|
+
export const transferGalaPrompt: MCPPrompt = {
|
|
17
|
+
name: 'galachain-launchpad:transfer-gala',
|
|
18
|
+
description: 'Transfer GALA tokens to another wallet',
|
|
19
|
+
arguments: [
|
|
20
|
+
{
|
|
21
|
+
name: 'recipientAddress',
|
|
22
|
+
description: 'Recipient wallet address',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'amount',
|
|
27
|
+
description: 'Amount of GALA to transfer',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
handler: (args) => {
|
|
32
|
+
validateAddress(args.recipientAddress, 'recipientAddress');
|
|
33
|
+
validateNumericAmount(args.amount, 'amount');
|
|
34
|
+
|
|
35
|
+
return createPromptResponse(
|
|
36
|
+
createSimpleOperationText({
|
|
37
|
+
operation: 'Transfer GALA tokens.',
|
|
38
|
+
parameters: {
|
|
39
|
+
recipient: `Recipient: ${args.recipientAddress}`,
|
|
40
|
+
amount: `Amount: ${args.amount} GALA`,
|
|
41
|
+
},
|
|
42
|
+
toolName: MCP_TOOLS.TRANSFER_GALA,
|
|
43
|
+
actionDescription: 'execute the transfer',
|
|
44
|
+
displayFormat: 'Display the transaction details and confirmation.',
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Transfer Token - Launchpad token transfer
|
|
52
|
+
*/
|
|
53
|
+
export const transferTokenPrompt: MCPPrompt = {
|
|
54
|
+
name: 'galachain-launchpad:transfer-token',
|
|
55
|
+
description: 'Transfer launchpad tokens to another wallet',
|
|
56
|
+
arguments: [
|
|
57
|
+
{
|
|
58
|
+
name: 'to',
|
|
59
|
+
description: 'Recipient wallet address',
|
|
60
|
+
required: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'tokenName',
|
|
64
|
+
description: 'Token name (e.g., anime)',
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'amount',
|
|
69
|
+
description: 'Token amount to transfer',
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
handler: (args) => {
|
|
74
|
+
validateAddress(args.to, 'to');
|
|
75
|
+
validateTokenName(args.tokenName, 'tokenName');
|
|
76
|
+
validateNumericAmount(args.amount, 'amount');
|
|
77
|
+
|
|
78
|
+
return createPromptResponse(
|
|
79
|
+
createSimpleOperationText({
|
|
80
|
+
operation: 'Transfer launchpad tokens.',
|
|
81
|
+
parameters: {
|
|
82
|
+
recipient: `Recipient: ${args.to}`,
|
|
83
|
+
token: `Token: ${args.tokenName}`,
|
|
84
|
+
amount: `Amount: ${args.amount}`,
|
|
85
|
+
},
|
|
86
|
+
toolName: MCP_TOOLS.TRANSFER_TOKEN,
|
|
87
|
+
actionDescription: 'execute the transfer',
|
|
88
|
+
displayFormat: 'Display the transaction details and confirmation.',
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const transferPrompts: MCPPrompt[] = [
|
|
95
|
+
transferGalaPrompt,
|
|
96
|
+
transferTokenPrompt,
|
|
97
|
+
];
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Tools Prompts
|
|
3
|
+
*
|
|
4
|
+
* Slash commands for utility and system operations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { MCPPrompt } from '../types/mcp.js';
|
|
8
|
+
import { MCP_TOOLS } from '../constants/mcpToolNames.js';
|
|
9
|
+
import { createPromptResponse } from './utils/handlerHelpers.js';
|
|
10
|
+
import { createSimpleOperationText } from './utils/textTemplates.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create Wallet - Generate new wallet
|
|
14
|
+
*/
|
|
15
|
+
export const createWalletPrompt: MCPPrompt = {
|
|
16
|
+
name: 'galachain-launchpad:create-wallet',
|
|
17
|
+
description: 'Generate a new wallet with random private key',
|
|
18
|
+
handler: () =>
|
|
19
|
+
createPromptResponse(
|
|
20
|
+
createSimpleOperationText({
|
|
21
|
+
operation: 'Create a new wallet with random private key.',
|
|
22
|
+
toolName: MCP_TOOLS.CREATE_WALLET,
|
|
23
|
+
actionDescription: 'generate new wallet address, random private key, and wallet credentials for authentication',
|
|
24
|
+
displayFormat: 'Display the wallet details with a security warning about private key storage.',
|
|
25
|
+
})
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get Address - Get GalaChain address
|
|
31
|
+
*/
|
|
32
|
+
export const getAddressPrompt: MCPPrompt = {
|
|
33
|
+
name: 'galachain-launchpad:get-address',
|
|
34
|
+
description: 'Get the GalaChain address format of authenticated wallet',
|
|
35
|
+
handler: () =>
|
|
36
|
+
createPromptResponse(
|
|
37
|
+
createSimpleOperationText({
|
|
38
|
+
operation: 'Get the GalaChain format address of the authenticated wallet.',
|
|
39
|
+
toolName: MCP_TOOLS.GET_ADDRESS,
|
|
40
|
+
actionDescription: 'retrieve the address in GalaChain format (eth|0x...)',
|
|
41
|
+
displayFormat: 'Display the wallet address.',
|
|
42
|
+
})
|
|
43
|
+
),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get Ethereum Address - Get Ethereum address
|
|
48
|
+
*/
|
|
49
|
+
export const getEthereumAddressPrompt: MCPPrompt = {
|
|
50
|
+
name: 'galachain-launchpad:get-ethereum-address',
|
|
51
|
+
description: 'Get the standard Ethereum address format of authenticated wallet',
|
|
52
|
+
handler: () =>
|
|
53
|
+
createPromptResponse(
|
|
54
|
+
createSimpleOperationText({
|
|
55
|
+
operation: 'Get the standard Ethereum format address of the authenticated wallet.',
|
|
56
|
+
toolName: MCP_TOOLS.GET_ETHEREUM_ADDRESS,
|
|
57
|
+
actionDescription: 'retrieve the address in Ethereum format (0x...)',
|
|
58
|
+
displayFormat: 'Display the wallet address.',
|
|
59
|
+
})
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get Config - View SDK configuration
|
|
65
|
+
*/
|
|
66
|
+
export const getConfigPrompt: MCPPrompt = {
|
|
67
|
+
name: 'galachain-launchpad:get-config',
|
|
68
|
+
description: 'View current SDK and MCP server configuration',
|
|
69
|
+
handler: () =>
|
|
70
|
+
createPromptResponse(
|
|
71
|
+
createSimpleOperationText({
|
|
72
|
+
operation: 'Get the current SDK and MCP server configuration.',
|
|
73
|
+
toolName: MCP_TOOLS.GET_CONFIG,
|
|
74
|
+
actionDescription: 'retrieve environment, base URLs, timeout settings, feature flags, effective slippage tolerance factors, and current MCP server state',
|
|
75
|
+
displayFormat: 'Display the configuration in a readable format.',
|
|
76
|
+
})
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get URL by Token Name - Generate launchpad URL
|
|
82
|
+
*/
|
|
83
|
+
export const getUrlByTokenNamePrompt: MCPPrompt = {
|
|
84
|
+
name: 'galachain-launchpad:get-url-by-token-name',
|
|
85
|
+
description: 'Get the launchpad frontend URL for a token',
|
|
86
|
+
arguments: [
|
|
87
|
+
{
|
|
88
|
+
name: 'tokenName',
|
|
89
|
+
description: 'Token name (e.g., anime)',
|
|
90
|
+
required: true,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
handler: (args) =>
|
|
94
|
+
createPromptResponse(
|
|
95
|
+
createSimpleOperationText({
|
|
96
|
+
operation: 'Get the launchpad frontend URL for a token.',
|
|
97
|
+
parameters: {
|
|
98
|
+
token_name: `Token: ${args.tokenName}`,
|
|
99
|
+
},
|
|
100
|
+
toolName: MCP_TOOLS.GET_URL_BY_TOKEN_NAME,
|
|
101
|
+
actionDescription: 'generate the URL',
|
|
102
|
+
displayFormat: 'Display the complete launchpad URL for viewing/trading the token.',
|
|
103
|
+
})
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Explain SDK Usage - SDK documentation helper
|
|
109
|
+
*/
|
|
110
|
+
export const explainSdkUsagePrompt: MCPPrompt = {
|
|
111
|
+
name: 'galachain-launchpad:explain-sdk-usage',
|
|
112
|
+
description: 'Get detailed SDK usage examples for a topic',
|
|
113
|
+
arguments: [
|
|
114
|
+
{
|
|
115
|
+
name: 'topic',
|
|
116
|
+
description: 'Topic: buy-tokens, sell-tokens, pool-graduation, fetch-pools, balances, dex-trading, liquidity-positions, price-history, token-details, token-distribution, token-creation, profile-management, multi-wallet, transfers, error-handling, installation, local-calculations, mcp-to-sdk-mapping',
|
|
117
|
+
required: true,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
handler: (args) =>
|
|
121
|
+
createPromptResponse(
|
|
122
|
+
createSimpleOperationText({
|
|
123
|
+
operation: `Get detailed SDK usage examples for topic: ${args.topic}.`,
|
|
124
|
+
toolName: MCP_TOOLS.EXPLAIN_SDK_USAGE,
|
|
125
|
+
actionDescription: 'retrieve complete runnable code examples',
|
|
126
|
+
displayFormat: 'Display the examples with explanations for integrating the SDK directly.',
|
|
127
|
+
})
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get Cache Info - Cache statistics
|
|
133
|
+
*/
|
|
134
|
+
export const getCacheInfoPrompt: MCPPrompt = {
|
|
135
|
+
name: 'galachain-launchpad:get-cache-info',
|
|
136
|
+
description: 'Get token metadata cache statistics',
|
|
137
|
+
handler: () =>
|
|
138
|
+
createPromptResponse(
|
|
139
|
+
createSimpleOperationText({
|
|
140
|
+
operation: 'Get token metadata cache statistics.',
|
|
141
|
+
toolName: MCP_TOOLS.GET_CACHE_INFO,
|
|
142
|
+
actionDescription: 'retrieve total tokens cached, cache size in bytes, and timestamp of oldest entry',
|
|
143
|
+
displayFormat: 'Display the cache information.',
|
|
144
|
+
})
|
|
145
|
+
),
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Clear Cache - Cache management
|
|
150
|
+
*/
|
|
151
|
+
export const clearCachePrompt: MCPPrompt = {
|
|
152
|
+
name: 'galachain-launchpad:clear-cache',
|
|
153
|
+
description: 'Clear token metadata cache',
|
|
154
|
+
arguments: [
|
|
155
|
+
{
|
|
156
|
+
name: 'tokenName',
|
|
157
|
+
description: 'Token name to clear (optional, clears all if not provided)',
|
|
158
|
+
required: false,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
handler: (args) =>
|
|
162
|
+
createPromptResponse(
|
|
163
|
+
createSimpleOperationText({
|
|
164
|
+
operation: 'Clear token metadata cache.',
|
|
165
|
+
parameters: {
|
|
166
|
+
token_name: args.tokenName ? `Token: ${args.tokenName}` : 'Clearing entire cache',
|
|
167
|
+
},
|
|
168
|
+
toolName: MCP_TOOLS.CLEAR_CACHE,
|
|
169
|
+
actionDescription: 'clear the cache',
|
|
170
|
+
displayFormat: 'Display confirmation of cache clearing.',
|
|
171
|
+
})
|
|
172
|
+
),
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Has Wallet - Check wallet status
|
|
177
|
+
*/
|
|
178
|
+
export const hasWalletPrompt: MCPPrompt = {
|
|
179
|
+
name: 'galachain-launchpad:has-wallet',
|
|
180
|
+
description: 'Check if a wallet is configured in the MCP server',
|
|
181
|
+
handler: () =>
|
|
182
|
+
createPromptResponse(
|
|
183
|
+
createSimpleOperationText({
|
|
184
|
+
operation: 'Check wallet configuration status.',
|
|
185
|
+
toolName: MCP_TOOLS.HAS_WALLET,
|
|
186
|
+
actionDescription: 'determine whether a wallet is configured and whether MCP server is in full-access or read-only mode',
|
|
187
|
+
displayFormat: 'Display the wallet status clearly.',
|
|
188
|
+
})
|
|
189
|
+
),
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get Wallet - Get wallet instance
|
|
194
|
+
*/
|
|
195
|
+
export const getWalletPrompt: MCPPrompt = {
|
|
196
|
+
name: 'galachain-launchpad:get-wallet',
|
|
197
|
+
description: 'Get the currently configured wallet instance',
|
|
198
|
+
handler: () =>
|
|
199
|
+
createPromptResponse(
|
|
200
|
+
createSimpleOperationText({
|
|
201
|
+
operation: 'Get the currently configured wallet instance.',
|
|
202
|
+
toolName: MCP_TOOLS.GET_WALLET,
|
|
203
|
+
actionDescription: 'retrieve wallet object if available (null if in read-only mode)',
|
|
204
|
+
displayFormat: 'Display the wallet information.',
|
|
205
|
+
})
|
|
206
|
+
),
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Set Wallet - Configure wallet
|
|
211
|
+
*/
|
|
212
|
+
export const setWalletPrompt: MCPPrompt = {
|
|
213
|
+
name: 'galachain-launchpad:set-wallet',
|
|
214
|
+
description: 'Configure a wallet for signing operations',
|
|
215
|
+
arguments: [
|
|
216
|
+
{
|
|
217
|
+
name: 'privateKey',
|
|
218
|
+
description: 'Private key in hex format (0x + 64 hex characters)',
|
|
219
|
+
required: true,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
handler: (args) =>
|
|
223
|
+
createPromptResponse(
|
|
224
|
+
createSimpleOperationText({
|
|
225
|
+
operation: 'Configure wallet for signing operations.',
|
|
226
|
+
parameters: {
|
|
227
|
+
private_key: `Private Key: ${args.privateKey.substring(0, 10)}...${args.privateKey.substring(60)}`,
|
|
228
|
+
},
|
|
229
|
+
toolName: MCP_TOOLS.SET_WALLET,
|
|
230
|
+
actionDescription: 'configure the wallet',
|
|
231
|
+
displayFormat: 'Display confirmation that wallet is configured for full-access mode.',
|
|
232
|
+
})
|
|
233
|
+
),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Get Environment - Current environment query
|
|
238
|
+
*/
|
|
239
|
+
export const getEnvironmentPrompt: MCPPrompt = {
|
|
240
|
+
name: 'galachain-launchpad:get-environment',
|
|
241
|
+
description: 'Get the current MCP server environment',
|
|
242
|
+
handler: () =>
|
|
243
|
+
createPromptResponse(
|
|
244
|
+
createSimpleOperationText({
|
|
245
|
+
operation: 'Get the current MCP server environment.',
|
|
246
|
+
toolName: MCP_TOOLS.GET_ENVIRONMENT,
|
|
247
|
+
actionDescription: 'retrieve the active environment',
|
|
248
|
+
displayFormat: 'Display the current environment (production, development, or testing).',
|
|
249
|
+
})
|
|
250
|
+
),
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export const utilityToolPrompts: MCPPrompt[] = [
|
|
254
|
+
createWalletPrompt,
|
|
255
|
+
getAddressPrompt,
|
|
256
|
+
getEthereumAddressPrompt,
|
|
257
|
+
getConfigPrompt,
|
|
258
|
+
getUrlByTokenNamePrompt,
|
|
259
|
+
explainSdkUsagePrompt,
|
|
260
|
+
getCacheInfoPrompt,
|
|
261
|
+
clearCachePrompt,
|
|
262
|
+
hasWalletPrompt,
|
|
263
|
+
getWalletPrompt,
|
|
264
|
+
setWalletPrompt,
|
|
265
|
+
getEnvironmentPrompt,
|
|
266
|
+
];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Prompts
|
|
3
|
+
*
|
|
4
|
+
* Slash commands for utility and information operations on Gala Launchpad
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { MCPPrompt } from '../types/mcp.js';
|
|
8
|
+
import { createPromptResponse } from './utils/handlerHelpers.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get Version - Display SDK and MCP server version information
|
|
12
|
+
*
|
|
13
|
+
* Shows the current versions of both the Gala Launchpad SDK and the MCP server,
|
|
14
|
+
* useful for debugging version mismatch issues or verifying installed versions.
|
|
15
|
+
*/
|
|
16
|
+
export const getVersionPrompt: MCPPrompt = {
|
|
17
|
+
name: 'galachain-launchpad:version',
|
|
18
|
+
description: 'Get SDK and MCP server version information',
|
|
19
|
+
handler: () => {
|
|
20
|
+
return createPromptResponse(`Get version information for the Gala Launchpad SDK and MCP server.
|
|
21
|
+
|
|
22
|
+
Use the gala_launchpad_get_version tool to fetch the version details.
|
|
23
|
+
|
|
24
|
+
Display the results in a clear, formatted response showing:
|
|
25
|
+
1. SDK Version
|
|
26
|
+
2. MCP Server Version
|
|
27
|
+
3. Timestamp
|
|
28
|
+
|
|
29
|
+
This is helpful for debugging version compatibility issues or confirming installed versions.`);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Switch Environment - Dynamically change the MCP server environment
|
|
35
|
+
*
|
|
36
|
+
* Allows switching between production, development, and testing environments
|
|
37
|
+
* while preserving wallet configuration. Useful for testing against different
|
|
38
|
+
* backends or performing administrative operations.
|
|
39
|
+
*/
|
|
40
|
+
export const switchEnvironmentPrompt: MCPPrompt = {
|
|
41
|
+
name: 'galachain-launchpad:switch-environment',
|
|
42
|
+
description: 'Switch the MCP server to a different environment (production, development, or testing)',
|
|
43
|
+
arguments: [
|
|
44
|
+
{
|
|
45
|
+
name: 'environment',
|
|
46
|
+
description: 'Target environment: production, development, or testing',
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
handler: (args) => {
|
|
51
|
+
const targetEnv = args.environment?.toLowerCase() || '';
|
|
52
|
+
const validEnvs = ['production', 'development', 'testing'];
|
|
53
|
+
const isValidEnv = validEnvs.includes(targetEnv);
|
|
54
|
+
|
|
55
|
+
return createPromptResponse(`Switch the Gala Launchpad MCP server to a different environment.
|
|
56
|
+
|
|
57
|
+
Current task: Switch to the ${isValidEnv ? targetEnv : 'specified'} environment
|
|
58
|
+
|
|
59
|
+
Steps:
|
|
60
|
+
1. First, get the current environment using the gala_launchpad_get_environment tool to see what we're currently on
|
|
61
|
+
2. If switching is needed, use the gala_launchpad_switch_environment tool with environment="${targetEnv || 'production'}"
|
|
62
|
+
3. After switching, verify the change by calling gala_launchpad_get_environment again
|
|
63
|
+
4. Confirm the environment switch was successful and display the results
|
|
64
|
+
|
|
65
|
+
Available environments:
|
|
66
|
+
- production: Production environment (default)
|
|
67
|
+
- development: Development environment for testing features
|
|
68
|
+
- testing: Testing environment for local/staging tests
|
|
69
|
+
|
|
70
|
+
Wallet Preservation: The wallet configuration will be preserved during the switch, maintaining your current signing capabilities if configured.`);
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* All utility prompts
|
|
76
|
+
*/
|
|
77
|
+
export const utilityPrompts: MCPPrompt[] = [getVersionPrompt, switchEnvironmentPrompt];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides reusable utilities for creating MCP prompt handlers with
|
|
5
|
+
* standardized response formatting and validation patterns.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { PromptMessage } from '../../types/mcp.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Create a standard MCP prompt response with user role
|
|
12
|
+
*
|
|
13
|
+
* @param text - The prompt text to send to the user
|
|
14
|
+
* @returns Array containing formatted MCP message
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* handler: (args) => {
|
|
18
|
+
* validateTokenName(args.tokenName);
|
|
19
|
+
* return createPromptResponse(`Fetch token ${args.tokenName}...`);
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export function createPromptResponse(text: string): PromptMessage[] {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
role: 'user',
|
|
26
|
+
content: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
text,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a handler function that validates arguments and returns a prompt response
|
|
36
|
+
*
|
|
37
|
+
* @param validator - Function to validate the arguments
|
|
38
|
+
* @param textGenerator - Function that generates the prompt text from arguments
|
|
39
|
+
* @returns A handler function ready to use in a prompt definition
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* handler: createValidatedHandler(
|
|
43
|
+
* (args) => validateTokenName(args.tokenName),
|
|
44
|
+
* (args) => `Fetch token ${args.tokenName}...`
|
|
45
|
+
* )
|
|
46
|
+
*/
|
|
47
|
+
export function createValidatedHandler<T>(
|
|
48
|
+
validator: (args: T) => void,
|
|
49
|
+
textGenerator: (args: T) => string
|
|
50
|
+
): (args: T) => PromptMessage[] {
|
|
51
|
+
return (args: T) => {
|
|
52
|
+
validator(args);
|
|
53
|
+
return createPromptResponse(textGenerator(args));
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Text Templates
|
|
3
|
+
*
|
|
4
|
+
* Provides reusable template generators for common MCP prompt patterns.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for simple operation prompts
|
|
9
|
+
*/
|
|
10
|
+
export interface SimpleOperationConfig {
|
|
11
|
+
/** Operation description (e.g., "Fetch GALA balance for wallet.") */
|
|
12
|
+
operation: string;
|
|
13
|
+
|
|
14
|
+
/** Parameter descriptions as key-value pairs (optional) */
|
|
15
|
+
parameters?: Record<string, string | undefined>;
|
|
16
|
+
|
|
17
|
+
/** MCP tool name (e.g., MCP_TOOLS.FETCH_GALA_BALANCE) */
|
|
18
|
+
toolName: string;
|
|
19
|
+
|
|
20
|
+
/** Description of what the tool does (e.g., "retrieve the GALA balance") */
|
|
21
|
+
actionDescription: string;
|
|
22
|
+
|
|
23
|
+
/** Optional display format instructions */
|
|
24
|
+
displayFormat?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generate text for simple operation prompts
|
|
29
|
+
*
|
|
30
|
+
* Creates a standardized prompt text with operation, parameters, tool usage,
|
|
31
|
+
* and optional display format instructions.
|
|
32
|
+
*
|
|
33
|
+
* @param config - Configuration for the operation
|
|
34
|
+
* @returns Formatted prompt text
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* text: createSimpleOperationText({
|
|
38
|
+
* operation: 'Get GALA balance for wallet.',
|
|
39
|
+
* parameters: {
|
|
40
|
+
* address: args.address ? `Address: ${args.address}` : 'Using default wallet'
|
|
41
|
+
* },
|
|
42
|
+
* toolName: MCP_TOOLS.FETCH_GALA_BALANCE,
|
|
43
|
+
* actionDescription: 'retrieve the GALA balance',
|
|
44
|
+
* displayFormat: 'Display the balance in a clear format.'
|
|
45
|
+
* })
|
|
46
|
+
*/
|
|
47
|
+
export function createSimpleOperationText(config: SimpleOperationConfig): string {
|
|
48
|
+
const { operation, parameters, toolName, actionDescription, displayFormat } = config;
|
|
49
|
+
|
|
50
|
+
const parts: string[] = [operation];
|
|
51
|
+
|
|
52
|
+
// Add parameters section
|
|
53
|
+
if (parameters && Object.values(parameters).some((v) => v !== undefined)) {
|
|
54
|
+
parts.push('');
|
|
55
|
+
Object.entries(parameters).forEach(([, value]) => {
|
|
56
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
57
|
+
parts.push(value);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Add tool usage instruction
|
|
63
|
+
parts.push('');
|
|
64
|
+
parts.push(`Use ${toolName} to ${actionDescription}.`);
|
|
65
|
+
|
|
66
|
+
// Add display format if provided
|
|
67
|
+
if (displayFormat) {
|
|
68
|
+
parts.push('');
|
|
69
|
+
parts.push(displayFormat);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return parts.join('\n');
|
|
73
|
+
}
|