Skip to main content
Glama

get_account_info

Retrieve Aptos account details including sequence number and authentication key to verify account status and transaction readiness.

Instructions

Get detailed information about an Aptos account including sequence number and authentication key. This is used for checking account status and transaction readiness. Returns comprehensive account information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_addressYesAptos account address, e.g., 0x1 or 0x742d35Cc6634C0532925a3b8D6Ac0C4db9c8b3

Implementation Reference

  • Main handler function for the get_account_info tool. Validates input arguments, calls the performGetAccountInfo helper, formats the response or error.
    export async function getAccountInfoHandler(args: Record<string, any> | undefined) { if (!isGetAccountInfoArgs(args)) { throw new Error("Invalid arguments for get_account_info"); } const { account_address } = args; try { const results = await performGetAccountInfo(account_address); return { content: [{ type: "text", text: results }], isError: false, }; } catch (error) { return { content: [ { type: "text", text: `Error getting account info: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Tool definition and input schema for get_account_info, specifying the required account_address parameter.
    export const GET_ACCOUNT_INFO: Tool = { name: "get_account_info", description: "Get detailed information about an Aptos account including sequence number and authentication key. This is used for checking account status and transaction readiness. Returns comprehensive account information.", inputSchema: { type: "object", properties: { account_address: { type: "string", description: "Aptos account address, e.g., 0x1 or 0x742d35Cc6634C0532925a3b8D6Ac0C4db9c8b3", }, }, required: ["account_address"], }, };
  • Core helper function that fetches account information from the Aptos client, formats the output, and handles cases where the account does not exist.
    export async function performGetAccountInfo(accountAddress: string): Promise<string> { try { const aptos = getAptosClient(); // Get account info const accountInfo = await aptos.getAccountInfo({ accountAddress }); return `Account Information: Address: ${accountAddress} Sequence Number: ${accountInfo.sequence_number} Authentication Key: ${accountInfo.authentication_key} Formatted Address: ${formatAddress(accountAddress)}`; } catch (error) { console.error('Error getting account info:', error); // Check if account doesn't exist if (error instanceof Error && error.message.includes('not found')) { return `Account Information: Address: ${accountAddress} Status: Account does not exist or has not been initialized Note: Account needs to receive at least one transaction to be initialized on-chain`; } throw new Error(`Failed to get account info: ${error instanceof Error ? error.message : String(error)}`); } }
  • src/index.ts:37-57 (registration)
    Registration of get_account_info tool (as GET_ACCOUNT_INFO) in the TOOLS_LIST array used by listTools handler.
    const TOOLS_LIST = [ // Account tools CREATE_ACCOUNT, GET_ACCOUNT_INFO, FUND_ACCOUNT, // Native APT tools GET_APT_BALANCE, TRANSFER_APT, // Coin tools GET_COIN_BALANCE, TRANSFER_COIN, DEPLOY_COIN, MINT_COIN, REGISTER_COIN, // Transaction tools GET_TRANSACTION_STATUS, GET_ACCOUNT_TRANSACTIONS, ];
  • src/index.ts:114-115 (registration)
    Tool call dispatching/registration in the switch statement for handling get_account_info calls.
    case "get_account_info": return await getAccountInfoHandler(args);

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