@gala-chain/launchpad-mcp-server
Version:
MCP server for Gala Launchpad - 102 tools (pool management, event watchers, GSwap DEX trading, price history, token creation, wallet management, DEX pool discovery, liquidity positions, token locks, locked token queries, composite pool data, cross-chain b
126 lines • 4.16 kB
JavaScript
;
/**
* Central Constraints Reference
*
* This file documents the pagination limits enforced by the SDK for different operations.
* These constants are imported from the SDK's internal constraint definitions and serve
* as the single source of truth for MCP tool schema validation.
*
* IMPORTANT: Always keep these in sync with the SDK's actual constraints:
* - TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT (trade.dto.ts)
* - USER_CONSTRAINTS.PAGINATION.MAX_LIMIT (user.dto.ts)
* - PAGINATION_CONSTRAINTS.MAX_LIMIT (launchpad.dto.ts)
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MCP_CONSTRAINTS = void 0;
exports.isValidLimit = isValidLimit;
exports.getMaxLimit = getMaxLimit;
/**
* MCP Tool Constraint Constants
*
* These values MUST match the SDK's internal constraint definitions to prevent
* validation errors when AI agents use the MCP tools.
*/
exports.MCP_CONSTRAINTS = {
/**
* Trade operations limit (fetchTrades)
* Source: TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT
* SDK File: packages/sdk/src/types/trade.dto.ts:331
*/
TRADE_LIMIT: 20,
/**
* User operations limit (fetchTokensHeld, fetchTokensCreated)
* Source: USER_CONSTRAINTS.PAGINATION.MAX_LIMIT
* SDK File: packages/sdk/src/types/user.dto.ts:297
*/
USER_LIMIT: 20,
/**
* General pool operations limit (fetchPools)
* Source: PAGINATION_CONSTRAINTS.MAX_LIMIT
* SDK File: packages/sdk/src/types/launchpad.dto.ts:587
*/
POOL_LIMIT: 100,
/**
* Price history operations limit (fetchPriceHistory, fetchAllPriceHistory)
* Source: DEX Backend API /price-oracle/fetch-price endpoint
* Maximum enforced by DEX API
*/
PRICE_HISTORY_LIMIT: 50,
/**
* Minimum limit for all pagination operations
*/
MIN_LIMIT: 1,
/**
* Minimum page number for all pagination operations
*/
MIN_PAGE: 1,
/**
* Maximum page number for all pagination operations
*/
MAX_PAGE: 1000,
};
/**
* Constraint usage reference for MCP tool developers
*
* @example
* // Trading tools (fetchTrades)
* limit: {
* type: 'number',
* minimum: MCP_CONSTRAINTS.MIN_LIMIT,
* maximum: MCP_CONSTRAINTS.TRADE_LIMIT, // 20
* description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.TRADE_LIMIT})`
* }
*
* @example
* // Balance/User tools (fetchTokensHeld, fetchTokensCreated)
* limit: {
* type: 'number',
* minimum: MCP_CONSTRAINTS.MIN_LIMIT,
* maximum: MCP_CONSTRAINTS.USER_LIMIT, // 20
* description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.USER_LIMIT})`
* }
*
* @example
* // Pool tools (fetchPools)
* limit: {
* type: 'number',
* minimum: MCP_CONSTRAINTS.MIN_LIMIT,
* maximum: MCP_CONSTRAINTS.POOL_LIMIT, // 100
* description: `Results per page (default: 20, maximum: ${MCP_CONSTRAINTS.POOL_LIMIT})`
* }
*
/**
* Validation helper to check if a limit value is valid for a specific operation type
*
* @param limit The limit value to validate
* @param operationType The type of operation ('trade' | 'user' | 'pool' | 'priceHistory')
* @returns true if valid, false otherwise
*/
function isValidLimit(limit, operationType) {
if (!Number.isInteger(limit) || limit < exports.MCP_CONSTRAINTS.MIN_LIMIT) {
return false;
}
const maxLimits = {
trade: exports.MCP_CONSTRAINTS.TRADE_LIMIT,
user: exports.MCP_CONSTRAINTS.USER_LIMIT,
pool: exports.MCP_CONSTRAINTS.POOL_LIMIT,
priceHistory: exports.MCP_CONSTRAINTS.PRICE_HISTORY_LIMIT,
};
return limit <= maxLimits[operationType];
}
/**
* Get the maximum limit for a specific operation type
*
* @param operationType The type of operation
* @returns The maximum limit value
*/
function getMaxLimit(operationType) {
const maxLimits = {
trade: exports.MCP_CONSTRAINTS.TRADE_LIMIT,
user: exports.MCP_CONSTRAINTS.USER_LIMIT,
pool: exports.MCP_CONSTRAINTS.POOL_LIMIT,
priceHistory: exports.MCP_CONSTRAINTS.PRICE_HISTORY_LIMIT,
};
return maxLimits[operationType];
}
//# sourceMappingURL=constraints.js.map