Skip to main content
Glama

set_token_authority

Assign or modify authority permissions for Solana token mints and accounts, including minting tokens, freezing accounts, changing ownership, or closing accounts.

Instructions

Set or change authority for a token mint or account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNameYesName of the wallet with current authority
tokenMintYesToken mint address
authorityTypeYesType of authority to set
newAuthorityNoAddress of new authority (or null to revoke authority)

Implementation Reference

  • The handler function that implements the set_token_authority tool. It uses the Solana SPL token library's setAuthority function to change the authority type (MintTokens, FreezeAccount, etc.) for a given token mint.
    async function handleSetTokenAuthority(args: any) { const { walletName, tokenMint, authorityType, newAuthority } = args; const wallet = wallets.get(walletName); if (!wallet) { throw new Error(`Wallet '${walletName}' not found`); } ensureConnection(); const tokenMintPubkey = new PublicKey(tokenMint); const newAuthorityPubkey = newAuthority ? new PublicKey(newAuthority) : null; const authorityTypeMap: { [key: string]: AuthorityType } = { "MintTokens": AuthorityType.MintTokens, "FreezeAccount": AuthorityType.FreezeAccount, "AccountOwner": AuthorityType.AccountOwner, "CloseAccount": AuthorityType.CloseAccount }; const signature = await setAuthority( connection, wallet.keypair, tokenMintPubkey, wallet.keypair, authorityTypeMap[authorityType], newAuthorityPubkey ); return { success: true, signature, authorityType, newAuthority: newAuthority || "revoked", explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}` }; }
  • Input schema definition for the set_token_authority tool, specifying parameters like walletName, tokenMint, authorityType, and optional newAuthority.
    inputSchema: { type: "object", properties: { walletName: { type: "string", description: "Name of the wallet with current authority" }, tokenMint: { type: "string", description: "Token mint address" }, authorityType: { type: "string", enum: ["MintTokens", "FreezeAccount", "AccountOwner", "CloseAccount"], description: "Type of authority to set" }, newAuthority: { type: "string", description: "Address of new authority (or null to revoke authority)" } }, required: ["walletName", "tokenMint", "authorityType"] }
  • src/index.ts:417-443 (registration)
    Tool registration in the tools array, including name, description, and input schema. This array is returned by the ListToolsRequestSchema handler.
    { name: "set_token_authority", description: "Set or change authority for a token mint or account", inputSchema: { type: "object", properties: { walletName: { type: "string", description: "Name of the wallet with current authority" }, tokenMint: { type: "string", description: "Token mint address" }, authorityType: { type: "string", enum: ["MintTokens", "FreezeAccount", "AccountOwner", "CloseAccount"], description: "Type of authority to set" }, newAuthority: { type: "string", description: "Address of new authority (or null to revoke authority)" } }, required: ["walletName", "tokenMint", "authorityType"] } },
  • Switch case in the main CallToolRequestSchema handler that dispatches calls to the set_token_authority handler function.
    case "set_token_authority": result = await handleSetTokenAuthority(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