get_account_info
Retrieve Algorand account details such as balance and asset holdings by providing the 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, calls algorandService.getAccountInfo, formats and returns the response.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 defining input validation for the tool: requires 'address' as string.const GetAccountInfoArgsSchema = z.object({ address: z.string(), });
- src/index.ts:165-178 (registration)Tool registration in TOOLS array: defines name, description, and JSON input schema for MCP server.{ 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 implementation in AlgorandService: fetches account details from Algorand node via algodClient and formats the response.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}`); } }