Skip to main content
Glama

get-token-info

Retrieve detailed information about any Pump.fun token on Solana by providing its mint address, enabling users to verify token data and make informed decisions.

Instructions

Get information about a Pump.fun token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenAddressYesThe token's mint address

Implementation Reference

  • Core handler function that initializes SDK, fetches bonding curve account for the token, computes formatted supply, and returns token info.
    export async function getTokenInfo(tokenAddress: string) {
      const { sdk } = initializeSDK();
      console.log("SDK initialized");
    
      const mintPublicKey = new PublicKey(tokenAddress);
      console.log("Getting bonding curve account...");
      const bondingCurveAccount = await sdk.getBondingCurveAccount(mintPublicKey);
    
      if (!bondingCurveAccount) {
        console.log(`No token found with address ${tokenAddress}`);
        return null;
      }
    
      const tokenTotalSupply = (bondingCurveAccount as any).tokenTotalSupply;
      const formattedSupply = tokenTotalSupply
        ? Number(tokenTotalSupply) / Math.pow(10, DEFAULT_DECIMALS)
        : "Unknown";
    
      return {
        tokenAddress,
        bondingCurveAccount,
        formattedSupply,
        pumpfunUrl: `https://pump.fun/${tokenAddress}`,
      };
    }
  • Zod input schema defining the 'tokenAddress' parameter for the tool.
    {
      tokenAddress: z.string().describe("The token's mint address"),
    },
  • src/index.ts:56-96 (registration)
    Registers the 'get-token-info' tool on the MCP server, including schema, description, and wrapper handler that calls the core getTokenInfo function.
    server.tool(
      "get-token-info",
      "Get information about a Pump.fun token",
      {
        tokenAddress: z.string().describe("The token's mint address"),
      },
      async ({ tokenAddress }, extra) => {
        try {
          console.error(`Checking token info for: ${tokenAddress}`);
    
          const tokenInfo = await getTokenInfo(tokenAddress);
    
          if (!tokenInfo) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `No token found with address ${tokenAddress}`,
                },
              ],
            };
          }
    
          const formattedInfo = formatTokenInfo(tokenInfo);
    
          return createMcpResponse(formattedInfo);
        } catch (error: any) {
          console.error("Error getting token info:", error);
          return {
            content: [
              {
                type: "text" as const,
                text: `Error getting token info: ${
                  error?.message || "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Helper function to initialize the PumpFunSDK and Solana connection using environment RPC URL.
    export function initializeSDK() {
      const rpcUrl = process.env.HELIUS_RPC_URL;
      if (!rpcUrl) {
        throw new Error("HELIUS_RPC_URL environment variable is not set");
      }
    
      const connection = new Connection(rpcUrl);
      const provider = new AnchorProvider(
        connection,
        {
          publicKey: new PublicKey("11111111111111111111111111111111"),
          signTransaction: async () => {
            throw new Error("Not implemented");
          },
          signAllTransactions: async () => {
            throw new Error("Not implemented");
          },
        },
        { commitment: "confirmed" }
      );
    
      return {
        sdk: new PumpFunSDK(provider),
        connection,
      };
    }
  • Helper function to format the token information into a human-readable string.
    export function formatTokenInfo(
      tokenInfo: ReturnType<typeof getTokenInfo> extends Promise<infer T>
        ? NonNullable<T>
        : never
    ) {
      return [
        `Token: ${tokenInfo.tokenAddress}`,
        `Supply: ${tokenInfo.formattedSupply}`,
        `Pump.fun URL: ${tokenInfo.pumpfunUrl}`,
      ].join("\n");
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/dexoryn/pumpfun-mcp-server'

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