Skip to main content
Glama

getTokenDetails

Retrieve detailed cryptocurrency token information including price, volume, and market data across 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
NameRequiredDescriptionDefault
networkYesNetwork ID from getNetworks (e.g., "ethereum", "solana")
tokenAddressYesToken address or identifier

Implementation Reference

  • Handler function that fetches token details from the DexPaprika API endpoint and formats the response for MCP.
    async ({ network, tokenAddress }) => {
      const data = await fetchFromAPI(`/networks/${network}/tokens/${tokenAddress}`);
      return formatMcpResponse(data);
    }
  • Zod schema defining input parameters: network (string) and tokenAddress (string).
    {
      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)
    Registers the getTokenDetails tool using server.tool, including name, description, 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);
      }
    );
  • Shared helper function used by getTokenDetails to make API requests to DexPaprika with error handling.
    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;
      }
    }
  • Shared helper function used by getTokenDetails to format API response for MCP protocol.
    function formatMcpResponse(data) {
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data)
          }
        ]
      };
    }

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/infinity-smithpl/dexpaprika-mcp'

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