menese_prices
Retrieve current USD prices for crypto tokens including BTC, ETH, SOL, and other major cryptocurrencies to support trading and portfolio tracking decisions.
Instructions
Get current USD prices for crypto tokens. Supports: BTC, ETH, SOL, ICP, MATIC, BNB, ADA, XRP, SUI, TON, APT, NEAR, TRX, LTC, RUNE, CLOAK, USDC, USDT, and more.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tokens | Yes | Token symbols (e.g. ['BTC', 'ETH', 'SOL']) |
Implementation Reference
- src/tools/prices.ts:42-84 (handler)The handler implementation for the menese_prices tool, which fetches prices from CoinGecko.
async ({ tokens }) => { const ids = tokens .map((t) => COINGECKO_IDS[t.toLowerCase()]) .filter(Boolean); if (ids.length === 0) { return { content: [{ type: "text" as const, text: "No recognized tokens. Try: BTC, ETH, SOL, ICP, etc." }], isError: true, }; } const idStr = [...new Set(ids)].sort().join(","); const prices = await cacheFetch( CacheKeys.prices(idStr), TTL.PRICES, async () => { const url = `https://api.coingecko.com/api/v3/simple/price?ids=${idStr}&vs_currencies=usd&include_24hr_change=true`; const res = await fetch(url); if (!res.ok) throw new Error(`CoinGecko API error: ${res.status}`); return res.json() as Promise<Record<string, { usd: number; usd_24h_change?: number }>>; }, ); // Map back to user's token symbols const result: Record<string, { usd: number; change24h?: number }> = {}; for (const token of tokens) { const id = COINGECKO_IDS[token.toLowerCase()]; if (id && prices[id]) { result[token.toUpperCase()] = { usd: prices[id].usd, change24h: prices[id].usd_24h_change, }; } } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2), }], }; }, - src/tools/prices.ts:34-40 (schema)The input schema and tool description for menese_prices.
{ description: "Get current USD prices for crypto tokens. Supports: BTC, ETH, SOL, ICP, MATIC, BNB, " + "ADA, XRP, SUI, TON, APT, NEAR, TRX, LTC, RUNE, CLOAK, USDC, USDT, and more.", inputSchema: { tokens: z.array(z.string()).min(1).max(20).describe("Token symbols (e.g. ['BTC', 'ETH', 'SOL'])"), }, - src/tools/prices.ts:31-86 (registration)Registration function for the menese_prices tool.
export function registerPricesTool(server: McpServer): void { server.registerTool( "menese_prices", { description: "Get current USD prices for crypto tokens. Supports: BTC, ETH, SOL, ICP, MATIC, BNB, " + "ADA, XRP, SUI, TON, APT, NEAR, TRX, LTC, RUNE, CLOAK, USDC, USDT, and more.", inputSchema: { tokens: z.array(z.string()).min(1).max(20).describe("Token symbols (e.g. ['BTC', 'ETH', 'SOL'])"), }, }, async ({ tokens }) => { const ids = tokens .map((t) => COINGECKO_IDS[t.toLowerCase()]) .filter(Boolean); if (ids.length === 0) { return { content: [{ type: "text" as const, text: "No recognized tokens. Try: BTC, ETH, SOL, ICP, etc." }], isError: true, }; } const idStr = [...new Set(ids)].sort().join(","); const prices = await cacheFetch( CacheKeys.prices(idStr), TTL.PRICES, async () => { const url = `https://api.coingecko.com/api/v3/simple/price?ids=${idStr}&vs_currencies=usd&include_24hr_change=true`; const res = await fetch(url); if (!res.ok) throw new Error(`CoinGecko API error: ${res.status}`); return res.json() as Promise<Record<string, { usd: number; usd_24h_change?: number }>>; }, ); // Map back to user's token symbols const result: Record<string, { usd: number; change24h?: number }> = {}; for (const token of tokens) { const id = COINGECKO_IDS[token.toLowerCase()]; if (id && prices[id]) { result[token.toUpperCase()] = { usd: prices[id].usd, change24h: prices[id].usd_24h_change, }; } } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2), }], }; }, ); }