crypto_search
Search for cryptocurrency information by name or symbol to identify digital assets and retrieve their details.
Instructions
Search for a cryptocurrency by name or symbol
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (e.g. 'sol' or 'chainlink') |
Implementation Reference
- src/modules/crypto.ts:56-63 (handler)The crypto_search tool handler implementation in src/modules/crypto.ts. It takes a query, fetches data from the CoinGecko search API, and returns the top 5 results as a markdown table.
server.tool("crypto_search", "Search for a cryptocurrency by name or symbol", { query: z.string().describe("Search query (e.g. 'sol' or 'chainlink')") }, async ({ query }) => { const data = await safeFetch(`https://api.coingecko.com/api/v3/search?query=${encodeURIComponent(query)}`); const coins = data.coins.slice(0, 5); const rows = coins.map((c: any) => [c.id, c.name, c.symbol.toUpperCase(), `#${c.market_cap_rank || "N/A"}`]); return { content: [{ type: "text", text: `**Search: "${query}"**\n${mdTable(["ID", "Name", "Symbol", "Rank"], rows)}\n\nUse the ID with crypto_price for details.` }] }; });