Skip to main content
Glama

freeze_account

Prevent token transfers by freezing a specific Solana token account using freeze authority from a designated wallet.

Instructions

Freeze a token account to prevent transfers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNameYesName of the wallet with freeze authority
tokenMintYesToken mint address
accountAddressYesAddress of the token account to freeze

Implementation Reference

  • The handler function that executes the freeze_account tool. It retrieves the wallet, ensures connection, and calls the SPL freezeAccount function to freeze the specified token account.
    async function handleFreezeAccount(args: any) {
      const { walletName, tokenMint, accountAddress } = args;
    
      const wallet = wallets.get(walletName);
      if (!wallet) {
        throw new Error(`Wallet '${walletName}' not found`);
      }
    
      ensureConnection();
      const tokenMintPubkey = new PublicKey(tokenMint);
      const accountPubkey = new PublicKey(accountAddress);
    
      const signature = await freezeAccount(
        connection,
        wallet.keypair,
        accountPubkey,
        tokenMintPubkey,
        wallet.keypair
      );
    
      return {
        success: true,
        signature,
        accountAddress,
        explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}`
      };
    }
  • The tool definition including name, description, and input schema for validation in the MCP tools list.
    {
      name: "freeze_account",
      description: "Freeze a token account to prevent transfers",
      inputSchema: {
        type: "object",
        properties: {
          walletName: {
            type: "string",
            description: "Name of the wallet with freeze authority"
          },
          tokenMint: {
            type: "string",
            description: "Token mint address"
          },
          accountAddress: {
            type: "string",
            description: "Address of the token account to freeze"
          }
        },
        required: ["walletName", "tokenMint", "accountAddress"]
      }
    },
  • src/index.ts:1339-1341 (registration)
    Registration in the main tool dispatch switch statement that routes freeze_account calls to the handler.
    case "freeze_account":
      result = await handleFreezeAccount(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