getTokenDetails
Retrieve comprehensive cryptocurrency token details including price, volume, and market data from multiple blockchain networks using DexPaprika's API.
Instructions
Get detailed information about a specific token on a network. First use getNetworks to get valid network IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | Network ID from getNetworks (e.g., "ethereum", "solana") | |
| tokenAddress | Yes | Token address or identifier |
Implementation Reference
- src/index.js:155-158 (handler)The handler function for the getTokenDetails tool. It takes network and tokenAddress parameters, fetches data from the DexPaprika API, and returns a formatted MCP response.async ({ network, tokenAddress }) => { const data = await fetchFromAPI(`/networks/${network}/tokens/${tokenAddress}`); return formatMcpResponse(data); }
- src/index.js:151-154 (schema)Input schema definition using Zod for the getTokenDetails tool, specifying required network and tokenAddress parameters.{ network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), tokenAddress: z.string().describe('Token address or identifier') },
- src/index.js:148-159 (registration)Registration of the getTokenDetails MCP tool using server.tool(), including name, description, input schema, and handler function.server.tool( 'getTokenDetails', 'Get detailed information about a specific token on a network. First use getNetworks to get valid network IDs.', { network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), tokenAddress: z.string().describe('Token address or identifier') }, async ({ network, tokenAddress }) => { const data = await fetchFromAPI(`/networks/${network}/tokens/${tokenAddress}`); return formatMcpResponse(data); } );
- src/index.js:10-34 (helper)Helper function fetchFromAPI used by getTokenDetails to make API requests to DexPaprika and handle errors.async function fetchFromAPI(endpoint) { try { const response = await fetch(`${API_BASE_URL}${endpoint}`); if (!response.ok) { if (response.status === 410) { throw new Error( 'This endpoint has been permanently removed. Please use network-specific endpoints instead. ' + 'For example, use /networks/{network}/pools instead of /pools. ' + 'Get available networks first using the getNetworks function.' ); } if (response.status === 429) { throw new Error( 'Rate limit exceeded. You have reached the maximum number of requests allowed for the free tier. ' + 'To increase your rate limits and access additional features, please consider upgrading to a paid plan at https://docs.dexpaprika.com/' ); } throw new Error(`API request failed with status ${response.status}`); } return await response.json(); } catch (error) { console.error(`Error fetching from API: ${error.message}`); throw error; } }
- src/index.js:37-46 (helper)Helper function formatMcpResponse used by getTokenDetails to format the API response for MCP protocol.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }