get_price
Retrieve the current market price of a token by providing its address and optional blockchain details (chain or specific chain) for accurate results on the Trading Simulator MCP Server.
Instructions
Get the current price for a token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Optional blockchain type | |
| specificChain | No | Optional specific chain for EVM tokens | |
| token | Yes | Token address |
Implementation Reference
- src/index.ts:160-185 (schema)Defines the tool schema including name, description, and input validation schema for get_price.{ name: "get_price", description: "Get the current price for a token", inputSchema: { type: "object", properties: { token: { type: "string", description: "Token address" }, 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#" } },
- src/index.ts:495-509 (handler)The main handler logic for the get_price tool: validates input arguments, extracts parameters, calls tradingClient.getPrice, and formats the response.case "get_price": { if (!args || typeof args !== "object" || !("token" in args)) { throw new Error("Invalid arguments for get_price"); } const token = args.token as string; const chain = "chain" in args ? args.chain as BlockchainType : undefined; const specificChain = "specificChain" in args ? args.specificChain as SpecificChain : undefined; const response = await tradingClient.getPrice(token, chain, specificChain); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false }; }
- src/index.ts:411-415 (registration)Registers the get_price tool by including it in the TRADING_SIM_TOOLS array returned for ListTools requests.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TRADING_SIM_TOOLS }; });