Skip to main content
Glama

transfer_apt

Send APT tokens to another Aptos blockchain address. This tool processes token transfers and returns transaction confirmation details.

Instructions

Transfer native APT tokens to another Aptos account. This is used for sending APT tokens from your account to another address. Returns the transaction hash upon successful transfer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipient_addressYesRecipient Aptos address, e.g., 0x1 or 0x742d35Cc6634C0532925a3b8D6Ac0C4db9c8b3
amountYesAmount of APT to transfer (e.g., '1.5' for 1.5 APT)
max_gas_amountNoMaximum gas amount for the transaction (optional)

Implementation Reference

  • The primary handler function for the 'transfer_apt' tool. It validates input arguments, calls the core transfer function, and formats success/error responses.
    export async function transferAptHandler(args: Record<string, any> | undefined) {
      if (!isTransferAptArgs(args)) {
        throw new Error("Invalid arguments for transfer_apt");
      }
    
      const { recipient_address, amount, max_gas_amount = 2000 } = args;
    
      try {
        const results = await performTransferApt(recipient_address, amount, max_gas_amount);
        return {
          content: [{ type: "text", text: results }],
          isError: false,
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error transferring APT: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool schema definition including name, description, and input schema for validation.
    export const TRANSFER_APT: Tool = {
      name: "transfer_apt",
      description: "Transfer native APT tokens to another Aptos account. This is used for sending APT tokens from your account to another address. Returns the transaction hash upon successful transfer.",
      inputSchema: {
        type: "object",
        properties: {
          recipient_address: {
            type: "string",
            description: "Recipient Aptos address, e.g., 0x1 or 0x742d35Cc6634C0532925a3b8D6Ac0C4db9c8b3",
          },
          amount: {
            type: "string",
            description: "Amount of APT to transfer (e.g., '1.5' for 1.5 APT)",
          },
          max_gas_amount: {
            type: "number",
            description: "Maximum gas amount for the transaction (optional)",
            default: 2000,
          },
        },
        required: ["recipient_address", "amount"],
      },
    };
  • Core helper function that performs the actual APT transfer using Aptos SDK: builds, signs, submits transaction, waits for confirmation, and returns formatted results.
    export async function performTransferApt(
      recipientAddress: string,
      amount: string,
      maxGasAmount: number = 2000
    ): Promise<string> {
      try {
        const aptos = getAptosClient();
        const senderAccount = getDefaultAccount();
        
        // Convert APT amount to Octas
        const amountOctas = aptToOctas(amount);
        
        // Build the transfer transaction
        const transaction = await aptos.transaction.build.simple({
          sender: senderAccount.accountAddress,
          data: {
            function: "0x1::aptos_account::transfer",
            functionArguments: [recipientAddress, amountOctas],
          },
          options: {
            maxGasAmount,
          },
        });
    
        // Sign and submit the transaction
        const committedTxn = await aptos.signAndSubmitTransaction({
          signer: senderAccount,
          transaction,
        });
    
        // Wait for transaction confirmation
        const executedTxn = await aptos.waitForTransaction({
          transactionHash: committedTxn.hash,
        });
    
        return `APT Transfer Successful:
    From: ${formatAddress(senderAccount.accountAddress.toString())}
    To: ${formatAddress(recipientAddress)}
    Amount: ${amount} APT (${amountOctas} Octas)
    Transaction Hash: ${committedTxn.hash}
    Gas Used: ${executedTxn.gas_used}
    Status: ${executedTxn.success ? 'Success' : 'Failed'}
    
    ✅ Transfer completed successfully!`;
      } catch (error) {
        console.error('Error transferring APT:', error);
        
        if (error instanceof Error) {
          if (error.message.includes('insufficient')) {
            throw new Error("Insufficient APT balance to complete the transfer");
          }
          if (error.message.includes('invalid')) {
            throw new Error("Invalid recipient address format");
          }
        }
        
        throw new Error(`Failed to transfer APT: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Type guard function for validating input arguments against the tool's schema.
    export function isTransferAptArgs(args: unknown): args is { 
      recipient_address: string; 
      amount: string; 
      max_gas_amount?: number 
    } {
      return (
        typeof args === "object" &&
        args !== null &&
        "recipient_address" in args &&
        typeof (args as any).recipient_address === "string" &&
        "amount" in args &&
        typeof (args as any).amount === "string" &&
        (!(args as any).max_gas_amount || typeof (args as any).max_gas_amount === "number")
      );
    }
  • src/index.ts:122-123 (registration)
    Tool registration in the main MCP server switch dispatcher for stdio transport.
    case "transfer_apt":
      return await transferAptHandler(args);
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 mentions the return value ('transaction hash upon successful transfer') but lacks critical details: whether this is a write operation (implied but not stated), gas fee implications, transaction finality, error conditions, or permission requirements. For a financial transfer tool, 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.

Conciseness4/5

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

The description is efficiently structured in two sentences: the first states the purpose, and the second adds behavioral context (return value). It avoids redundancy and is appropriately sized, though it could be slightly more front-loaded with key behavioral traits.

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

Completeness2/5

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

Given the complexity of a financial transfer tool with no annotations and no output schema, the description is incomplete. It omits essential context: mutation nature, security implications, error handling, and how the transaction hash is used. The return value is mentioned but not elaborated, leaving gaps for agent invocation.

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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., no examples, constraints, or relational context). The baseline score of 3 reflects adequate but no extra value.

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 ('Transfer native APT tokens') and target resource ('to another Aptos account'), distinguishing it from sibling tools like transfer_coin (which handles other coin types) and fund_account (which might have different purposes). It explicitly mentions APT tokens, making the purpose unambiguous.

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 transfer_coin or fund_account. It states 'This is used for sending APT tokens from your account to another address,' which is a tautological restatement of the purpose rather than usage context, prerequisites, or exclusions.

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