Skip to main content
Glama

get-token-info

Retrieve detailed information about any Pump.fun token using its mint address to analyze token data and make informed trading 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 PumpFunSDK, fetches the bonding curve account for the given token mint address, computes the formatted total supply, and returns structured token information.
    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}`, }; }
  • src/index.ts:56-96 (registration)
    Registers the 'get-token-info' tool with the MCP server, defining its name, description, input schema, and a wrapper handler that delegates to getTokenInfo, handles errors, and formats the MCP response.
    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" }`, }, ], }; } } );
  • Zod input schema for the tool, requiring a 'tokenAddress' string parameter.
    { tokenAddress: z.string().describe("The token's mint address"), },
  • Utility function to initialize the Solana connection and PumpFunSDK using the HELIUS_RPC_URL from environment variables.
    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 with token address, supply, and Pump.fun URL.
    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"); }

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