@gala-chain/launchpad-mcp-server 1.22.0 → 1.22.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/generated/version.d.ts +1 -1
  3. package/dist/generated/version.js +1 -1
  4. package/package.json +2 -2
  5. package/docs/AI-AGENT-PATTERNS.md +0 -555
  6. package/docs/CONSTRAINTS-REFERENCE.md +0 -454
  7. package/docs/PROMPT-TOOL-MAPPING.md +0 -352
  8. package/docs/examples/default-values-pattern.md +0 -240
  9. package/docs/examples/tool-factory-pattern.md +0 -217
  10. package/jest.config.js +0 -94
  11. package/src/__tests__/integration/fetchTokenDetails.integration.test.ts +0 -258
  12. package/src/__tests__/integration/poolTools.integration.test.ts +0 -185
  13. package/src/constants/mcpToolNames.ts +0 -141
  14. package/src/index.ts +0 -19
  15. package/src/prompts/__tests__/promptStructure.test.ts +0 -137
  16. package/src/prompts/__tests__/registry.test.ts +0 -191
  17. package/src/prompts/analysis.ts +0 -429
  18. package/src/prompts/create-token.ts +0 -123
  19. package/src/prompts/dex-trading.ts +0 -86
  20. package/src/prompts/discover-tokens.ts +0 -86
  21. package/src/prompts/index.ts +0 -154
  22. package/src/prompts/liquidity-positions.ts +0 -270
  23. package/src/prompts/portfolio.ts +0 -242
  24. package/src/prompts/trading.ts +0 -191
  25. package/src/prompts/utility.ts +0 -43
  26. package/src/prompts/utils/workflowTemplates.ts +0 -511
  27. package/src/schemas/common-schemas.ts +0 -393
  28. package/src/scripts/test-all-prompts.ts +0 -184
  29. package/src/server.ts +0 -277
  30. package/src/tools/__tests__/dex-tools.test.ts +0 -562
  31. package/src/tools/__tests__/liquidity-positions.test.ts +0 -673
  32. package/src/tools/balance/index.ts +0 -174
  33. package/src/tools/creation/index.ts +0 -182
  34. package/src/tools/dex/index.ts +0 -226
  35. package/src/tools/dex/liquidity-positions.ts +0 -547
  36. package/src/tools/index.ts +0 -86
  37. package/src/tools/pools/fetchAllPools.ts +0 -47
  38. package/src/tools/pools/fetchAllPriceHistory.ts +0 -119
  39. package/src/tools/pools/fetchPoolDetails.ts +0 -27
  40. package/src/tools/pools/fetchPoolDetailsForCalculation.ts +0 -22
  41. package/src/tools/pools/fetchPools.ts +0 -47
  42. package/src/tools/pools/fetchPriceHistory.ts +0 -124
  43. package/src/tools/pools/fetchTokenDetails.ts +0 -77
  44. package/src/tools/pools/index.ts +0 -284
  45. package/src/tools/social/index.ts +0 -64
  46. package/src/tools/trading/index.ts +0 -605
  47. package/src/tools/transfers/index.ts +0 -75
  48. package/src/tools/utils/clearCache.ts +0 -36
  49. package/src/tools/utils/createWallet.ts +0 -19
  50. package/src/tools/utils/explainSdkUsage.ts +0 -1446
  51. package/src/tools/utils/getAddress.ts +0 -12
  52. package/src/tools/utils/getCacheInfo.ts +0 -14
  53. package/src/tools/utils/getConfig.ts +0 -11
  54. package/src/tools/utils/getEthereumAddress.ts +0 -12
  55. package/src/tools/utils/getUrlByTokenName.ts +0 -12
  56. package/src/tools/utils/getVersion.ts +0 -25
  57. package/src/tools/utils/getWallet.ts +0 -25
  58. package/src/tools/utils/hasWallet.ts +0 -15
  59. package/src/tools/utils/index.ts +0 -33
  60. package/src/tools/utils/isTokenGraduated.ts +0 -16
  61. package/src/tools/utils/setWallet.ts +0 -41
  62. package/src/types/mcp.ts +0 -72
  63. package/src/utils/__tests__/validation.test.ts +0 -147
  64. package/src/utils/constraints.ts +0 -155
  65. package/src/utils/default-values.ts +0 -208
  66. package/src/utils/error-handler.ts +0 -69
  67. package/src/utils/error-templates.ts +0 -273
  68. package/src/utils/response-formatter.ts +0 -51
  69. package/src/utils/tool-factory.ts +0 -257
  70. package/src/utils/tool-registry.ts +0 -296
  71. package/src/utils/validation.ts +0 -371
  72. package/tests/wallet-management-integration.test.ts +0 -284
  73. package/tsconfig.json +0 -23
@@ -1,12 +0,0 @@
1
- /**
2
- * Get Address Tool (45% code reduction via factory pattern)
3
- */
4
-
5
- import { createNoParamTool } from '../../utils/tool-factory.js';
6
-
7
- export const getAddressTool = createNoParamTool({
8
- name: 'gala_launchpad_get_address',
9
- description: 'Get the GalaChain address format (eth|0x...) for the authenticated wallet.',
10
- handler: (sdk) => sdk.getAddress(),
11
- resultKey: 'address',
12
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * Get Cache Info Tool
3
- *
4
- * Returns statistics about the token metadata cache for monitoring and debugging.
5
- * The cache persists entire MCP server lifetime and accumulates metadata across conversations.
6
- */
7
-
8
- import { createNoParamTool } from '../../utils/tool-factory.js';
9
-
10
- export const getCacheInfoTool = createNoParamTool({
11
- name: 'gala_launchpad_get_cache_info',
12
- description: 'Get token metadata cache statistics including total tokens cached, cache size in bytes, and timestamp of oldest entry. The cache persists for the entire MCP server lifetime.',
13
- handler: (sdk) => sdk.getCacheInfo(),
14
- });
@@ -1,11 +0,0 @@
1
- /**
2
- * Get Config Tool (45% code reduction via factory pattern)
3
- */
4
-
5
- import { createNoParamTool } from '../../utils/tool-factory.js';
6
-
7
- export const getConfigTool = createNoParamTool({
8
- name: 'gala_launchpad_get_config',
9
- description: 'Get the current SDK configuration including environment, base URLs, timeouts, feature flags, and effective slippage tolerance factors.',
10
- handler: (sdk) => sdk.getConfig(),
11
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Get Ethereum Address Tool (45% code reduction via factory pattern)
3
- */
4
-
5
- import { createNoParamTool } from '../../utils/tool-factory.js';
6
-
7
- export const getEthereumAddressTool = createNoParamTool({
8
- name: 'gala_launchpad_get_ethereum_address',
9
- description: 'Get the standard Ethereum address format (0x...) for the authenticated wallet.',
10
- handler: (sdk) => sdk.getEthereumAddress(),
11
- resultKey: 'address',
12
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * Get URL by Token Name Tool (73% code reduction via factory pattern)
3
- */
4
-
5
- import { createResolutionTool } from '../../utils/tool-factory.js';
6
-
7
- export const getUrlByTokenNameTool = createResolutionTool({
8
- name: 'gala_launchpad_get_url_by_token_name',
9
- description: 'Get the launchpad frontend URL for a specific token. Returns the complete URL for viewing/trading the token in the web interface.',
10
- resolver: async (sdk, tokenName) => sdk.getUrlByTokenName(tokenName),
11
- resultKey: 'url',
12
- });
@@ -1,25 +0,0 @@
1
- /**
2
- * Get Version Tool
3
- *
4
- * Returns version information for both the SDK and MCP server.
5
- * Both versions are dynamically read from their respective package.json files.
6
- */
7
-
8
- import { createNoParamTool } from '../../utils/tool-factory.js';
9
- import { MCP_SERVER_VERSION } from '../../generated/version.js';
10
-
11
- export const getVersionTool = createNoParamTool({
12
- name: 'gala_launchpad_get_version',
13
- description: 'Get SDK and MCP server version information. Returns both versions which are dynamically read from package.json files.',
14
- handler: async (sdk) => {
15
- const sdkVersion = sdk.getVersion();
16
- const mcpVersion = MCP_SERVER_VERSION;
17
- const timestamp = new Date().toISOString();
18
-
19
- return {
20
- sdk: sdkVersion,
21
- mcpServer: mcpVersion,
22
- timestamp,
23
- };
24
- },
25
- });
@@ -1,25 +0,0 @@
1
- /**
2
- * Get Wallet Tool
3
- *
4
- * Retrieves the wallet instance currently configured in the SDK.
5
- * Returns the wallet object if configured, or null if in read-only mode.
6
- */
7
-
8
- import { createNoParamTool } from '../../utils/tool-factory.js';
9
-
10
- export const getWalletTool = createNoParamTool({
11
- name: 'gala_launchpad_get_wallet',
12
- description: 'Get the wallet instance currently configured in the SDK. Returns wallet object if available, or null if in read-only mode.',
13
- handler: (sdk) => {
14
- const wallet = sdk.getWallet();
15
- // Return wallet metadata if available, or null
16
- if (wallet && typeof wallet === 'object' && 'address' in wallet) {
17
- return {
18
- address: wallet.address,
19
- hasPrivateKey: 'privateKey' in wallet && Boolean(wallet.privateKey),
20
- };
21
- }
22
- return null;
23
- },
24
- resultKey: 'wallet',
25
- });
@@ -1,15 +0,0 @@
1
- /**
2
- * Has Wallet Tool
3
- *
4
- * Checks if the SDK has a wallet configured for signing operations.
5
- * Returns true if wallet is available, false for read-only mode.
6
- */
7
-
8
- import { createNoParamTool } from '../../utils/tool-factory.js';
9
-
10
- export const hasWalletTool = createNoParamTool({
11
- name: 'gala_launchpad_has_wallet',
12
- description: 'Check if wallet is configured in the SDK. Returns true if wallet is available for signing operations, false if in read-only mode.',
13
- handler: (sdk) => sdk.hasWallet(),
14
- resultKey: 'hasWallet',
15
- });
@@ -1,33 +0,0 @@
1
- /**
2
- * Utility Tools
3
- */
4
-
5
- import { createWalletTool } from './createWallet.js';
6
- import { getAddressTool } from './getAddress.js';
7
- import { getEthereumAddressTool } from './getEthereumAddress.js';
8
- import { getConfigTool } from './getConfig.js';
9
- import { getUrlByTokenNameTool } from './getUrlByTokenName.js';
10
- import { explainSdkUsageTool } from './explainSdkUsage.js';
11
- import { isTokenGraduatedTool } from './isTokenGraduated.js';
12
- import { getCacheInfoTool } from './getCacheInfo.js';
13
- import { clearCacheTool } from './clearCache.js';
14
- import { getVersionTool } from './getVersion.js';
15
- import { hasWalletTool } from './hasWallet.js';
16
- import { getWalletTool } from './getWallet.js';
17
- import { setWalletTool } from './setWallet.js';
18
-
19
- export const utilityTools = [
20
- createWalletTool,
21
- getAddressTool,
22
- getEthereumAddressTool,
23
- getConfigTool,
24
- getUrlByTokenNameTool,
25
- explainSdkUsageTool,
26
- isTokenGraduatedTool,
27
- getCacheInfoTool,
28
- clearCacheTool,
29
- getVersionTool,
30
- hasWalletTool,
31
- getWalletTool,
32
- setWalletTool,
33
- ];
@@ -1,16 +0,0 @@
1
- /**
2
- * Check if token has graduated from bonding curve (73% code reduction via factory pattern)
3
- */
4
-
5
- import { createResolutionTool } from '../../utils/tool-factory.js';
6
-
7
- export const isTokenGraduatedTool = createResolutionTool({
8
- name: 'gala_launchpad_is_token_graduated',
9
- description: `Check if a token has completed the bonding curve phase and graduated to full DEX trading.
10
-
11
- RETURNS: Boolean indicating if pool saleStatus is "Completed"
12
-
13
- USAGE: Useful for conditional logic before attempting graduation or checking pool state.`,
14
- resolver: (sdk, tokenName) => sdk.isTokenGraduated(tokenName),
15
- resultKey: 'graduated',
16
- });
@@ -1,41 +0,0 @@
1
- /**
2
- * Set Wallet Tool
3
- *
4
- * Configures a wallet for signing operations.
5
- * Takes a private key string and sets it as the active wallet in the SDK.
6
- */
7
-
8
- import { createFetchTool } from '../../utils/tool-factory.js';
9
- import { createWallet } from '@gala-chain/launchpad-sdk';
10
-
11
- export const setWalletTool = createFetchTool({
12
- name: 'gala_launchpad_set_wallet',
13
- description: 'Configure a wallet for signing operations. Takes a private key and sets it as the active wallet.',
14
- inputSchema: {
15
- type: 'object',
16
- properties: {
17
- privateKey: {
18
- type: 'string',
19
- description: 'Private key (0x prefixed hexadecimal string) to configure as the active wallet',
20
- pattern: '^0x[a-fA-F0-9]{64}$',
21
- },
22
- },
23
- required: ['privateKey'],
24
- },
25
- handler: async (sdk, args) => {
26
- const privateKey = args.privateKey as string;
27
-
28
- // Create wallet from private key
29
- const generatedWallet = createWallet(privateKey);
30
-
31
- // Set the wallet on the SDK
32
- sdk.setWallet(generatedWallet.wallet);
33
-
34
- return {
35
- success: true,
36
- message: 'Wallet configured successfully',
37
- address: generatedWallet.wallet.address,
38
- walletConfigured: sdk.hasWallet(),
39
- };
40
- },
41
- });
package/src/types/mcp.ts DELETED
@@ -1,72 +0,0 @@
1
- /**
2
- * MCP Protocol Types
3
- */
4
-
5
- import type { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
6
-
7
- /**
8
- * MCP Tool Definition
9
- */
10
- export interface MCPTool {
11
- name: string;
12
- description: string;
13
- inputSchema: {
14
- type: 'object';
15
- properties: Record<string, any>;
16
- required?: string[];
17
- };
18
- handler: (sdk: LaunchpadSDK, args: any) => Promise<MCPToolResponse>;
19
- }
20
-
21
- /**
22
- * MCP Tool Response
23
- */
24
- export interface MCPToolResponse {
25
- content: Array<{
26
- type: 'text' | 'image' | 'resource';
27
- text?: string;
28
- data?: string;
29
- mimeType?: string;
30
- }>;
31
- isError?: boolean;
32
- }
33
-
34
- /**
35
- * Tool execution context
36
- */
37
- export interface ToolContext {
38
- sdk: LaunchpadSDK;
39
- debug: boolean;
40
- }
41
-
42
- /**
43
- * MCP Prompt Argument Definition
44
- */
45
- export interface MCPPromptArgument {
46
- name: string;
47
- description: string;
48
- required: boolean;
49
- }
50
-
51
- /**
52
- * MCP Prompt Definition
53
- */
54
- export interface MCPPrompt {
55
- name: string;
56
- description: string;
57
- arguments?: MCPPromptArgument[];
58
- handler: (args: Record<string, string>) => PromptMessage[];
59
- }
60
-
61
- /**
62
- * Prompt Message (from MCP spec)
63
- */
64
- export interface PromptMessage {
65
- role: 'user' | 'assistant';
66
- content: {
67
- type: 'text' | 'image' | 'resource';
68
- text?: string;
69
- data?: string;
70
- mimeType?: string;
71
- };
72
- }
@@ -1,147 +0,0 @@
1
- /**
2
- * Validation Utilities Tests
3
- *
4
- * Tests for input validation functions
5
- */
6
-
7
- import {
8
- validateTokenName,
9
- validateNumericAmount,
10
- validateSlippage,
11
- validateAddress,
12
- validateTokenSymbol,
13
- validatePaginationLimit,
14
- validateTokenList,
15
- safeValidate,
16
- ValidationError,
17
- } from '../validation';
18
-
19
- describe('Validation Utilities', () => {
20
- describe('validateTokenName()', () => {
21
- it('should accept valid token names', () => {
22
- expect(() => validateTokenName('anime')).not.toThrow();
23
- expect(() => validateTokenName('test123')).not.toThrow();
24
- expect(() => validateTokenName('my-token')).not.toThrow();
25
- expect(() => validateTokenName('my_token')).not.toThrow();
26
- expect(() => validateTokenName('TEST-123')).not.toThrow();
27
- });
28
-
29
- it('should reject invalid token names', () => {
30
- expect(() => validateTokenName('')).toThrow(ValidationError);
31
- expect(() => validateTokenName('a')).toThrow(ValidationError);
32
- expect(() => validateTokenName('verylongtokennamethatexceedstwentycharacters')).toThrow(ValidationError);
33
- expect(() => validateTokenName('token@#$')).toThrow(ValidationError);
34
- expect(() => validateTokenName('token with spaces')).toThrow(ValidationError);
35
- });
36
- });
37
-
38
- describe('validateNumericAmount()', () => {
39
- it('should accept valid numeric amounts', () => {
40
- expect(() => validateNumericAmount('100', 'amount')).not.toThrow();
41
- expect(() => validateNumericAmount('0.5', 'amount')).not.toThrow();
42
- expect(() => validateNumericAmount('99999.99', 'amount')).not.toThrow();
43
- expect(() => validateNumericAmount(100, 'amount')).not.toThrow();
44
- });
45
-
46
- it('should reject invalid numeric amounts', () => {
47
- expect(() => validateNumericAmount('', 'amount')).toThrow(ValidationError);
48
- expect(() => validateNumericAmount('abc', 'amount')).toThrow(ValidationError);
49
- expect(() => validateNumericAmount('-5', 'amount')).toThrow(ValidationError);
50
- expect(() => validateNumericAmount('0', 'amount')).toThrow(ValidationError);
51
- expect(() => validateNumericAmount(Infinity, 'amount')).toThrow(ValidationError);
52
- });
53
- });
54
-
55
- describe('validateSlippage()', () => {
56
- it('should accept valid slippage values', () => {
57
- expect(() => validateSlippage('1')).not.toThrow();
58
- expect(() => validateSlippage('0.5')).not.toThrow();
59
- expect(() => validateSlippage('50')).not.toThrow();
60
- expect(() => validateSlippage('0.01')).not.toThrow();
61
- expect(() => validateSlippage('100')).not.toThrow();
62
- });
63
-
64
- it('should reject invalid slippage values', () => {
65
- expect(() => validateSlippage('0')).toThrow(ValidationError);
66
- expect(() => validateSlippage('0.005')).toThrow(ValidationError);
67
- expect(() => validateSlippage('101')).toThrow(ValidationError);
68
- expect(() => validateSlippage('-1')).toThrow(ValidationError);
69
- });
70
- });
71
-
72
- describe('validateAddress()', () => {
73
- it('should accept valid addresses', () => {
74
- expect(() => validateAddress('eth|0x1234567890abcdef1234567890abcdef12345678')).not.toThrow();
75
- expect(() => validateAddress('0x1234567890abcdef1234567890abcdef12345678')).not.toThrow();
76
- expect(() => validateAddress('0xABCDEF1234567890abcdef1234567890ABCDEF12')).not.toThrow();
77
- });
78
-
79
- it('should reject invalid addresses', () => {
80
- expect(() => validateAddress('')).toThrow(ValidationError);
81
- expect(() => validateAddress('invalid')).toThrow(ValidationError);
82
- expect(() => validateAddress('0x123')).toThrow(ValidationError);
83
- expect(() => validateAddress('eth|123')).toThrow(ValidationError);
84
- });
85
- });
86
-
87
- describe('validateTokenSymbol()', () => {
88
- it('should accept valid symbols', () => {
89
- expect(() => validateTokenSymbol('GALA')).not.toThrow();
90
- expect(() => validateTokenSymbol('TEST')).not.toThrow();
91
- expect(() => validateTokenSymbol('A')).not.toThrow();
92
- expect(() => validateTokenSymbol('ABCDEFGH')).not.toThrow();
93
- });
94
-
95
- it('should reject invalid symbols', () => {
96
- expect(() => validateTokenSymbol('')).toThrow(ValidationError);
97
- expect(() => validateTokenSymbol('test')).toThrow(ValidationError);
98
- expect(() => validateTokenSymbol('TOOLONG123')).toThrow(ValidationError);
99
- expect(() => validateTokenSymbol('TEST123')).toThrow(ValidationError);
100
- });
101
- });
102
-
103
- describe('validatePaginationLimit()', () => {
104
- it('should accept valid limits', () => {
105
- expect(() => validatePaginationLimit('1')).not.toThrow();
106
- expect(() => validatePaginationLimit('20')).not.toThrow();
107
- expect(() => validatePaginationLimit('100')).not.toThrow();
108
- expect(() => validatePaginationLimit(50)).not.toThrow();
109
- });
110
-
111
- it('should reject invalid limits', () => {
112
- expect(() => validatePaginationLimit('0')).toThrow(ValidationError);
113
- expect(() => validatePaginationLimit('101')).toThrow(ValidationError);
114
- expect(() => validatePaginationLimit('-1')).toThrow(ValidationError);
115
- expect(() => validatePaginationLimit('abc')).toThrow(ValidationError);
116
- });
117
- });
118
-
119
- describe('validateTokenList()', () => {
120
- it('should accept valid token lists', () => {
121
- const result1 = validateTokenList('anime,test,dragon');
122
- expect(result1).toEqual(['anime', 'test', 'dragon']);
123
-
124
- const result2 = validateTokenList('token1');
125
- expect(result2).toEqual(['token1']);
126
- });
127
-
128
- it('should reject invalid token lists', () => {
129
- expect(() => validateTokenList('')).toThrow(ValidationError);
130
- expect(() => validateTokenList('token1,invalid@#$')).toThrow(ValidationError);
131
- });
132
- });
133
-
134
- describe('safeValidate()', () => {
135
- it('should return success for valid input', () => {
136
- const result = safeValidate(() => validateTokenName('anime'));
137
- expect(result.success).toBe(true);
138
- expect(result.error).toBeUndefined();
139
- });
140
-
141
- it('should return error for invalid input', () => {
142
- const result = safeValidate(() => validateTokenName('invalid@#$'));
143
- expect(result.success).toBe(false);
144
- expect(result.error).toBeDefined();
145
- });
146
- });
147
- });
@@ -1,155 +0,0 @@
1
- /**
2
- * Central Constraints Reference
3
- *
4
- * This file documents the pagination limits enforced by the SDK for different operations.
5
- * These constants are imported from the SDK's internal constraint definitions and serve
6
- * as the single source of truth for MCP tool schema validation.
7
- *
8
- * IMPORTANT: Always keep these in sync with the SDK's actual constraints:
9
- * - TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT (trade.dto.ts)
10
- * - USER_CONSTRAINTS.PAGINATION.MAX_LIMIT (user.dto.ts)
11
- * - PAGINATION_CONSTRAINTS.MAX_LIMIT (launchpad.dto.ts)
12
- * - COMMENT_CONSTRAINTS.PAGINATION.MAX_LIMIT (comment.dto.ts)
13
- */
14
-
15
- /**
16
- * MCP Tool Constraint Constants
17
- *
18
- * These values MUST match the SDK's internal constraint definitions to prevent
19
- * validation errors when AI agents use the MCP tools.
20
- */
21
- export const MCP_CONSTRAINTS = {
22
- /**
23
- * Trade operations limit (fetchTrades)
24
- * Source: TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT
25
- * SDK File: packages/sdk/src/types/trade.dto.ts:331
26
- */
27
- TRADE_LIMIT: 20,
28
-
29
- /**
30
- * User operations limit (fetchTokensHeld, fetchTokensCreated)
31
- * Source: USER_CONSTRAINTS.PAGINATION.MAX_LIMIT
32
- * SDK File: packages/sdk/src/types/user.dto.ts:297
33
- */
34
- USER_LIMIT: 20,
35
-
36
- /**
37
- * General pool operations limit (fetchPools)
38
- * Source: PAGINATION_CONSTRAINTS.MAX_LIMIT
39
- * SDK File: packages/sdk/src/types/launchpad.dto.ts:587
40
- */
41
- POOL_LIMIT: 100,
42
-
43
- /**
44
- * Comment operations limit (fetchComments)
45
- * Source: COMMENT_CONSTRAINTS.PAGINATION.MAX_LIMIT
46
- * SDK File: packages/sdk/src/types/comment.dto.ts:149
47
- */
48
- COMMENT_LIMIT: 50,
49
-
50
- /**
51
- * Price history operations limit (fetchPriceHistory, fetchAllPriceHistory)
52
- * Source: DEX Backend API /price-oracle/fetch-price endpoint
53
- * Maximum enforced by DEX API
54
- */
55
- PRICE_HISTORY_LIMIT: 50,
56
-
57
- /**
58
- * Minimum limit for all pagination operations
59
- */
60
- MIN_LIMIT: 1,
61
-
62
- /**
63
- * Minimum page number for all pagination operations
64
- */
65
- MIN_PAGE: 1,
66
-
67
- /**
68
- * Maximum page number for all pagination operations
69
- */
70
- MAX_PAGE: 1000,
71
- } as const;
72
-
73
- /**
74
- * Constraint usage reference for MCP tool developers
75
- *
76
- * @example
77
- * // Trading tools (fetchTrades)
78
- * limit: {
79
- * type: 'number',
80
- * minimum: MCP_CONSTRAINTS.MIN_LIMIT,
81
- * maximum: MCP_CONSTRAINTS.TRADE_LIMIT, // 20
82
- * description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.TRADE_LIMIT})`
83
- * }
84
- *
85
- * @example
86
- * // Balance/User tools (fetchTokensHeld, fetchTokensCreated)
87
- * limit: {
88
- * type: 'number',
89
- * minimum: MCP_CONSTRAINTS.MIN_LIMIT,
90
- * maximum: MCP_CONSTRAINTS.USER_LIMIT, // 20
91
- * description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.USER_LIMIT})`
92
- * }
93
- *
94
- * @example
95
- * // Pool tools (fetchPools)
96
- * limit: {
97
- * type: 'number',
98
- * minimum: MCP_CONSTRAINTS.MIN_LIMIT,
99
- * maximum: MCP_CONSTRAINTS.POOL_LIMIT, // 100
100
- * description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.POOL_LIMIT})`
101
- * }
102
- *
103
- * @example
104
- * // Social tools (fetchComments)
105
- * limit: {
106
- * type: 'number',
107
- * minimum: MCP_CONSTRAINTS.MIN_LIMIT,
108
- * maximum: MCP_CONSTRAINTS.COMMENT_LIMIT, // 50
109
- * description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.COMMENT_LIMIT})`
110
- * }
111
- */
112
-
113
- /**
114
- * Validation helper to check if a limit value is valid for a specific operation type
115
- *
116
- * @param limit The limit value to validate
117
- * @param operationType The type of operation ('trade' | 'user' | 'pool' | 'comment' | 'priceHistory')
118
- * @returns true if valid, false otherwise
119
- */
120
- export function isValidLimit(
121
- limit: number,
122
- operationType: 'trade' | 'user' | 'pool' | 'comment' | 'priceHistory'
123
- ): boolean {
124
- if (!Number.isInteger(limit) || limit < MCP_CONSTRAINTS.MIN_LIMIT) {
125
- return false;
126
- }
127
-
128
- const maxLimits = {
129
- trade: MCP_CONSTRAINTS.TRADE_LIMIT,
130
- user: MCP_CONSTRAINTS.USER_LIMIT,
131
- pool: MCP_CONSTRAINTS.POOL_LIMIT,
132
- comment: MCP_CONSTRAINTS.COMMENT_LIMIT,
133
- priceHistory: MCP_CONSTRAINTS.PRICE_HISTORY_LIMIT,
134
- };
135
-
136
- return limit <= maxLimits[operationType];
137
- }
138
-
139
- /**
140
- * Get the maximum limit for a specific operation type
141
- *
142
- * @param operationType The type of operation
143
- * @returns The maximum limit value
144
- */
145
- export function getMaxLimit(operationType: 'trade' | 'user' | 'pool' | 'comment' | 'priceHistory'): number {
146
- const maxLimits = {
147
- trade: MCP_CONSTRAINTS.TRADE_LIMIT,
148
- user: MCP_CONSTRAINTS.USER_LIMIT,
149
- pool: MCP_CONSTRAINTS.POOL_LIMIT,
150
- comment: MCP_CONSTRAINTS.COMMENT_LIMIT,
151
- priceHistory: MCP_CONSTRAINTS.PRICE_HISTORY_LIMIT,
152
- };
153
-
154
- return maxLimits[operationType];
155
- }