@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
114 lines (109 loc) • 4.77 kB
JavaScript
"use strict";
/**
* Fetch All Price History Tool
*
* Queries all historical token price data from DEX Backend API with automatic pagination.
* Uses the /price-oracle/fetch-price endpoint for complete price history retrieval.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchAllPriceHistoryTool = void 0;
const response_formatter_js_1 = require("../../utils/response-formatter.js");
const error_handler_js_1 = require("../../utils/error-handler.js");
exports.fetchAllPriceHistoryTool = {
name: 'gala_launchpad_fetch_all_price_history',
description: `Fetch all historical price snapshots for DEX tokens from the DEX Backend API with automatic pagination.
**Endpoint:** \`/price-oracle/fetch-price\`
**Requirements:**
- DEX Backend API must be configured (dexBackendBaseUrl in SDK config)
- Node.js environment only (not available in browser)
- Either tokenName OR tokenId is required (not both)
**Token Identification:**
- Use \`tokenName\` for convenience (e.g., "demonkpop") - automatically resolved to full token ID
- Use \`tokenId\` for direct specification (e.g., "Token|Unit|DKP|eth:...")
- Provide exactly ONE of these parameters
**Use Cases:**
- Complete historical price analysis and charting
- Full price trend identification over time periods
- Comprehensive volatility analysis
- Data export for external analytics
**Performance:** API-based queries with automatic pagination (max 100 items per page, combined into single result).`,
inputSchema: {
type: 'object',
properties: {
tokenName: {
type: 'string',
description: 'Simple token name for convenience (e.g., "demonkpop", "shoewars") - automatically resolves to full token ID. Use this OR tokenId, not both.',
},
tokenId: {
oneOf: [
{
type: 'string',
description: 'Pipe-delimited format: "collection|category|type|additionalKey" (e.g., "GUSDC|Unit|none|eth:...")',
},
{
type: 'object',
properties: {
collection: {
type: 'string',
description: 'Token collection (e.g., "Token")',
},
category: {
type: 'string',
description: 'Token category (e.g., "Unit")',
},
type: {
type: 'string',
description: 'Token type (e.g., "GUSDC")',
},
additionalKey: {
type: 'string',
description: 'Additional key (e.g., "eth:0x...")',
},
},
required: ['collection', 'category', 'type', 'additionalKey'],
description: 'TokenClassKey object format',
},
],
description: 'Token identifier (string or TokenClassKey object). Use this OR tokenName, not both.',
},
from: {
type: 'string',
format: 'date-time',
description: 'Start date for filtering (ISO 8601 format, defaults to 30 days ago)',
},
to: {
type: 'string',
format: 'date-time',
description: 'End date for filtering (ISO 8601 format, defaults to now)',
},
sortOrder: {
type: 'string',
enum: ['ASC', 'DESC'],
description: 'Sort order for results (default: DESC for newest-first)',
},
},
required: [],
},
handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => {
// Convert string dates to Date objects if provided
const options = {
sortOrder: args.sortOrder,
};
// Support both tokenName and tokenId (mutual exclusivity validation happens in SDK)
if (args.tokenName) {
options.tokenName = args.tokenName;
}
else {
options.tokenId = args.tokenId;
}
if (args.from) {
options.from = new Date(args.from);
}
if (args.to) {
options.to = new Date(args.to);
}
const result = await sdk.fetchAllPriceHistory(options);
return (0, response_formatter_js_1.formatSuccess)(result);
}),
};
//# sourceMappingURL=fetchAllPriceHistory.js.map