Skip to main content
Glama

deploy_coin

Create and deploy custom tokens on the Aptos blockchain to enable minting, transfers, and management of new coin types.

Instructions

Deploy a new custom coin/token on Aptos blockchain. This creates a new coin type that can be minted, transferred, and managed. Returns the coin type identifier and deployment transaction details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the coin (e.g., 'My Token')
symbolYesSymbol of the coin (e.g., 'MTK')
decimalsNoNumber of decimal places for the coin (typically 6 or 8)
icon_urlNoURL to the coin icon/logo (optional)
project_urlNoURL to the project website (optional)
max_gas_amountNoMaximum gas amount for the transaction (optional)

Implementation Reference

  • Main handler function for the deploy_coin tool. Validates input arguments and orchestrates the deployment by calling performDeployCoin.
    export async function deployCoinHandler(args: Record<string, any> | undefined) {
      if (!isDeployCoinArgs(args)) {
        throw new Error("Invalid arguments for deploy_coin");
      }
    
      const { 
        name, 
        symbol, 
        decimals = 8, 
        icon_url, 
        project_url, 
        max_gas_amount = 5000 
      } = args;
    
      try {
        const results = await performDeployCoin(
          name, 
          symbol, 
          decimals, 
          icon_url, 
          project_url, 
          max_gas_amount
        );
        return {
          content: [{ type: "text", text: results }],
          isError: false,
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error deploying coin: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool definition object for deploy_coin, including input schema with properties for name, symbol, decimals, etc.
    export const DEPLOY_COIN: Tool = {
      name: "deploy_coin",
      description: "Deploy a new custom coin/token on Aptos blockchain. This creates a new coin type that can be minted, transferred, and managed. Returns the coin type identifier and deployment transaction details.",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of the coin (e.g., 'My Token')",
          },
          symbol: {
            type: "string",
            description: "Symbol of the coin (e.g., 'MTK')",
          },
          decimals: {
            type: "number",
            description: "Number of decimal places for the coin (typically 6 or 8)",
            default: 8,
            minimum: 0,
            maximum: 32,
          },
          icon_url: {
            type: "string",
            description: "URL to the coin icon/logo (optional)",
          },
          project_url: {
            type: "string",
            description: "URL to the project website (optional)",
          },
          max_gas_amount: {
            type: "number",
            description: "Maximum gas amount for the transaction (optional)",
            default: 5000,
          },
        },
        required: ["name", "symbol"],
      },
    };
  • src/index.ts:130-131 (registration)
    Registration and dispatch of the deploy_coin handler in the main tool call switch statement.
    case "deploy_coin":
      return await deployCoinHandler(args);
  • Core helper function that performs the actual coin deployment: validates params, builds transaction using managed_coin::initialize, signs, submits, waits for confirmation, and formats results with coin type.
    export async function performDeployCoin(
      name: string,
      symbol: string,
      decimals: number = 8,
      iconUrl?: string,
      projectUrl?: string,
      maxGasAmount: number = 5000
    ): Promise<string> {
      try {
        const aptos = getAptosClient();
        const deployerAccount = getDefaultAccount();
        const deployerAddress = deployerAccount.accountAddress.toString();
    
        // Validate inputs
        if (!name || name.trim().length === 0) {
          throw new Error("Coin name cannot be empty");
        }
        if (!symbol || symbol.trim().length === 0) {
          throw new Error("Coin symbol cannot be empty");
        }
        if (symbol.length > 10) {
          throw new Error("Coin symbol should be 10 characters or less");
        }
        if (decimals < 0 || decimals > 32) {
          throw new Error("Decimals must be between 0 and 32");
        }
    
        // Create the coin deployment transaction
        const transaction = await aptos.transaction.build.simple({
          sender: deployerAccount.accountAddress,
          data: {
            function: "0x1::managed_coin::initialize",
            typeArguments: [],
            functionArguments: [
              name.trim(),
              symbol.trim().toUpperCase(),
              decimals,
              false, // monitor_supply
            ],
          },
          options: {
            maxGasAmount,
          },
        });
    
        // Sign and submit the transaction
        const committedTxn = await aptos.signAndSubmitTransaction({
          signer: deployerAccount,
          transaction,
        });
    
        // Wait for transaction confirmation
        const executedTxn = await aptos.waitForTransaction({
          transactionHash: committedTxn.hash,
        });
    
        // Generate the coin type identifier
        const coinType = `${deployerAddress}::coin::T`;
    
        let result = `šŸŖ™ Coin Deployment Successful!
    
    Coin Details:
    Name: ${name}
    Symbol: ${symbol}
    Decimals: ${decimals}
    Deployer: ${formatAddress(deployerAddress)}
    
    Blockchain Information:
    Coin Type: ${coinType}
    Transaction Hash: ${committedTxn.hash}
    Gas Used: ${executedTxn.gas_used}
    Status: ${executedTxn.success ? 'Success' : 'Failed'}`;
    
        if (iconUrl) {
          result += `
    Icon URL: ${iconUrl}`;
        }
    
        if (projectUrl) {
          result += `
    Project URL: ${projectUrl}`;
        }
    
        result += `
    
    šŸ“‹ Next Steps:
    1. Mint coins using the mint_coin tool with coin type: ${coinType}
    2. Register the coin for accounts that want to receive it
    3. Transfer coins using the transfer_coin tool
    
    āš ļø  Important Notes:
    - Save the coin type identifier: ${coinType}
    - Only the deployer (${formatAddress(deployerAddress)}) can mint new coins
    - Recipients must register for this coin type before receiving transfers
    - This coin follows the Aptos Managed Coin standard
    
    āœ… Your custom coin is now live on Aptos ${getCurrentNetwork()}!`;
    
        return result;
      } catch (error) {
        console.error('Error deploying coin:', error);
        
        if (error instanceof Error) {
          if (error.message.includes('insufficient')) {
            throw new Error("Insufficient APT balance to pay for coin deployment transaction fees");
          }
          if (error.message.includes('already exists')) {
            throw new Error("A coin with this configuration already exists for this account");
          }
          if (error.message.includes('invalid')) {
            throw new Error("Invalid coin parameters. Check name, symbol, and decimals");
          }
        }
        
        throw new Error(`Failed to deploy coin: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Type guard function for validating the structure and types of deploy_coin input arguments.
    export function isDeployCoinArgs(args: unknown): args is { 
      name: string; 
      symbol: string; 
      decimals?: number;
      icon_url?: string;
      project_url?: string;
      max_gas_amount?: number;
    } {
      return (
        typeof args === "object" &&
        args !== null &&
        "name" in args &&
        typeof (args as any).name === "string" &&
        "symbol" in args &&
        typeof (args as any).symbol === "string" &&
        (!(args as any).decimals || typeof (args as any).decimals === "number") &&
        (!(args as any).icon_url || typeof (args as any).icon_url === "string") &&
        (!(args as any).project_url || typeof (args as any).project_url === "string") &&
        (!(args as any).max_gas_amount || typeof (args as any).max_gas_amount === "number")
      );
    }
  • src/index.ts:50-52 (registration)
    Addition of DEPLOY_COIN tool to the TOOLS_LIST array for listTools response.
    DEPLOY_COIN,
    MINT_COIN,
    REGISTER_COIN,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a creation/deployment operation and mentions the return values, but lacks critical details: it doesn't specify if this requires authentication, gas fees, or special permissions; whether it's irreversible; or potential rate limits. For a blockchain write operation, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences that are front-loaded with the core purpose and efficiently cover the outcome and return values. Every word earns its place with zero redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a blockchain deployment tool with no annotations and no output schema, the description is moderately complete. It covers the purpose and return values but lacks behavioral context (e.g., authentication needs, costs, idempotency). The absence of an output schema means the description should ideally explain return values more thoroughly, which it does partially.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so parameters are well-documented in the schema itself. The description adds no additional parameter semantics beyond implying that 'name' and 'symbol' are core identifiers and that deployment results in a 'coin type identifier'. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Deploy a new custom coin/token'), the resource ('on Aptos blockchain'), and the outcome ('creates a new coin type that can be minted, transferred, and managed'). It distinguishes itself from siblings like 'mint_coin' (which presumably mints existing coins) and 'register_coin' (which may have a different function).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'mint_coin' or 'register_coin'. It mentions the tool's purpose but offers no context about prerequisites (e.g., needing an account first) or exclusions (e.g., not for modifying existing coins).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/punkpeye/aptos-mcp'

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