Skip to main content
Glama

burn_tokens

Remove tokens permanently from a Solana wallet by burning them, reducing total supply and managing token economics.

Instructions

Burn tokens from a wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNameYesName of the wallet to burn tokens from
tokenMintYesToken mint address
amountYesAmount of tokens to burn (in token units)

Implementation Reference

  • The handler function that executes the burn_tokens tool. It retrieves the wallet, calculates the raw token amount based on decimals, gets the associated token account, and calls the Solana SPL `burn` instruction to burn the specified amount of tokens.
    async function handleBurnTokens(args: any) { const { walletName, tokenMint, amount } = args; const wallet = wallets.get(walletName); if (!wallet) { throw new Error(`Wallet '${walletName}' not found`); } ensureConnection(); const tokenMintPubkey = new PublicKey(tokenMint); const mintInfo = await getMint(connection, tokenMintPubkey); const rawAmount = BigInt(Math.floor(amount * Math.pow(10, mintInfo.decimals))); const tokenAccount = await getAssociatedTokenAddress( tokenMintPubkey, wallet.keypair.publicKey ); const signature = await burn( connection, wallet.keypair, tokenAccount, tokenMintPubkey, wallet.keypair, rawAmount ); return { success: true, signature, amount, tokenMint: tokenMint, explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}` }; }
  • The input schema definition for the burn_tokens tool, specifying parameters: walletName, tokenMint, and amount.
    name: "burn_tokens", description: "Burn tokens from a wallet", inputSchema: { type: "object", properties: { walletName: { type: "string", description: "Name of the wallet to burn tokens from" }, tokenMint: { type: "string", description: "Token mint address" }, amount: { type: "number", description: "Amount of tokens to burn (in token units)" } }, required: ["walletName", "tokenMint", "amount"] } },
  • src/index.ts:1336-1338 (registration)
    The registration/dispatch case in the main CallToolRequestSchema handler's switch statement that routes calls to the handleBurnTokens function.
    case "burn_tokens": result = await handleBurnTokens(args); break;

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/ExpertVagabond/solana-mcp-server'

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