get_account_info
Retrieve account details, including balance and assets, from the Algorand blockchain network by providing an Algorand account address.
Instructions
Get account information including balance and assets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Algorand account address |
Implementation Reference
- src/index.ts:523-552 (handler)MCP tool handler for 'get_account_info': parses arguments using Zod schema, fetches account info via algorandService, formats and returns text response or error.case 'get_account_info': { const parsed = GetAccountInfoArgsSchema.parse(args); try { const accountInfo = await algorandService.getAccountInfo(parsed.address); return { content: [ { type: 'text', text: `Account Information for ${parsed.address}:\n` + `Balance: ${Number(accountInfo.balance) / 1000000} ALGO\n` + `Minimum Balance: ${Number(accountInfo.minBalance) / 1000000} ALGO\n` + `Status: ${accountInfo.status}\n` + `Assets: ${accountInfo.assets.length}\n` + `Created Apps: ${accountInfo.createdApps.length}\n` + `Created Assets: ${accountInfo.createdAssets.length}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting account info: ${error}`, }, ], isError: true, }; } }
- src/index.ts:36-38 (schema)Zod schema for validating input arguments (address: string) used in the get_account_info handler.const GetAccountInfoArgsSchema = z.object({ address: z.string(), });
- src/index.ts:165-178 (registration)Tool registration in TOOLS array with name, description, and JSON inputSchema matching the Zod schema.{ name: 'get_account_info', description: 'Get account information including balance and assets', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Algorand account address', }, }, required: ['address'], }, },
- src/algorand.ts:118-134 (helper)Core helper function in AlgorandService that queries the Algorand node for account information and returns formatted account details.async getAccountInfo(address: string) { try { const accountInfo = await this.algodClient.accountInformation(address).do(); return { address: accountInfo.address, balance: accountInfo.amount, minBalance: accountInfo.minBalance, status: accountInfo.status, assets: accountInfo.assets || [], appsLocalState: accountInfo.appsLocalState || [], createdApps: accountInfo.createdApps || [], createdAssets: accountInfo.createdAssets || [] }; } catch (error) { throw new Error(`Failed to get account info: ${error}`); } }