Skip to main content
Glama
recallnet

Trading Simulator MCP Server

by recallnet

get_price_history

Retrieve historical price data for tokens by specifying time range and interval to analyze market trends in trading simulations.

Instructions

Get historical price data for a token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesToken address
startTimeNoStart time as ISO timestamp
endTimeNoEnd time as ISO timestamp
intervalNoTime interval for price points
chainNoOptional blockchain type
specificChainNoOptional specific chain for EVM tokens

Implementation Reference

  • src/index.ts:212-250 (registration)
    Registers the 'get_price_history' tool in the TRADING_SIM_TOOLS array used by the MCP server, including name, description, and detailed JSON input schema.
    { name: "get_price_history", description: "Get historical price data for a token", inputSchema: { type: "object", properties: { token: { type: "string", description: "Token address" }, startTime: { type: "string", description: "Start time as ISO timestamp" }, endTime: { type: "string", description: "End time as ISO timestamp" }, interval: { type: "string", enum: ["1m", "5m", "15m", "1h", "4h", "1d"], description: "Time interval for price points" }, chain: { type: "string", enum: ["svm", "evm"], description: "Optional blockchain type" }, specificChain: { type: "string", enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"], description: "Optional specific chain for EVM tokens" } }, required: ["token"], additionalProperties: false, $schema: "http://json-schema.org/draft-07/schema#" } },
  • The main handler logic for the 'get_price_history' tool call within the MCP server's CallToolRequestSchema handler. Validates arguments, builds PriceHistoryParams, calls the tradingClient helper, and formats the response.
    case "get_price_history": { if (!args || typeof args !== "object" || !("token" in args)) { throw new Error("Invalid arguments for get_price_history"); } const historyParams: PriceHistoryParams = { token: args.token as string }; if ("startTime" in args) historyParams.startTime = args.startTime as string; if ("endTime" in args) historyParams.endTime = args.endTime as string; if ("interval" in args) historyParams.interval = args.interval as PriceHistoryParams['interval']; if ("chain" in args) historyParams.chain = args.chain as BlockchainType; if ("specificChain" in args) historyParams.specificChain = args.specificChain as SpecificChain; const response = await tradingClient.getPriceHistory(historyParams); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false }; }
  • Helper method in TradingSimulatorClient that implements the actual API call for price history. Constructs query parameters and performs GET request to the backend /api/price/history endpoint.
    async getPriceHistory( tokenOrParams: string | PriceHistoryParams, interval?: string, chain?: BlockchainType, specificChain?: SpecificChain, startTime?: string, endTime?: string ): Promise<PriceHistoryResponse | ErrorResponse> { const urlParams = new URLSearchParams(); // Handle both object-based and individual parameter calls if (typeof tokenOrParams === 'object') { // Object parameter version const params = tokenOrParams; urlParams.append('token', params.token); if (params.startTime) urlParams.append('startTime', params.startTime); if (params.endTime) urlParams.append('endTime', params.endTime); if (params.interval) urlParams.append('interval', params.interval); if (params.chain) urlParams.append('chain', params.chain); if (params.specificChain) urlParams.append('specificChain', params.specificChain); } else { // Individual parameters version urlParams.append('token', tokenOrParams); if (interval) urlParams.append('interval', interval); if (chain) urlParams.append('chain', chain); if (specificChain) urlParams.append('specificChain', specificChain); if (startTime) urlParams.append('startTime', startTime); if (endTime) urlParams.append('endTime', endTime); } return this.request<PriceHistoryResponse>( 'GET', `/api/price/history?${urlParams.toString()}`, null, 'get price history' ); }
  • TypeScript interface definition for PriceHistoryParams used in the tool handler and API client for input validation and typing.
    export interface PriceHistoryParams { token: string; startTime?: string; endTime?: string; interval?: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; chain?: BlockchainType; specificChain?: SpecificChain; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/recallnet/trading-simulator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server