nano_my_account_info
Retrieve detailed Nano account information including balance, representative, and frontier block for the address used to send Nano.
Instructions
Retrieve detailed information about my Nano account/address, including balance (in Nano and raw units), representative, and frontier block. This is the account that is used to send Nano from.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- nano-currency.js:284-297 (handler)The main handler function for the 'nano_my_account_info' tool. It validates the NANO_PRIVATE_KEY, derives the account address using getAddress(), fetches account info via getAccountInfo(), formats the balance with friendlyAmount(), and returns a formatted text response.async function () { try { NANO_PRIVATE_KEY_SCHEMA.parse(process.env.NANO_PRIVATE_KEY) const myAddress = getAddress() let myAccountInfo = await getAccountInfo(myAddress) return createTextResponse(`The account information for ${myAddress} is ` + JSON.stringify({ ...myAccountInfo, balance: friendlyAmount(myAccountInfo.balance) })) } catch (error) { console.error('[nano_my_account_info] Error:', error.message || error); return createErrorResponse(error) } }
- nano-currency.js:280-298 (registration)Registration of the 'nano_my_account_info' tool using server.tool(), including the tool name, description, empty parameters schema ({}), and the handler function.server.tool( 'nano_my_account_info', 'Retrieve detailed information about my Nano account/address, including balance (in Nano and raw units), representative, and frontier block. This is the account that is used to send Nano from.', {}, async function () { try { NANO_PRIVATE_KEY_SCHEMA.parse(process.env.NANO_PRIVATE_KEY) const myAddress = getAddress() let myAccountInfo = await getAccountInfo(myAddress) return createTextResponse(`The account information for ${myAddress} is ` + JSON.stringify({ ...myAccountInfo, balance: friendlyAmount(myAccountInfo.balance) })) } catch (error) { console.error('[nano_my_account_info] Error:', error.message || error); return createErrorResponse(error) } } )
- nano-currency.js:45-49 (schema)Zod schema used within the handler to validate the NANO_PRIVATE_KEY environment variable.const NANO_PRIVATE_KEY_SCHEMA = z.string({ required_error: `NANO_PRIVATE_KEY is required`, }) .refine(val => N.checkKey(val), { message: `NANO_PRIVATE_KEY is not valid` })
- nano-currency.js:152-163 (helper)Helper function called by the handler to fetch detailed account information from the Nano RPC endpoint.async function getAccountInfo(address) { return ( await rpcCall( NANO_RPC_URL_KEY, 'account_info', { account: address, representative: 'true' } ) ) }
- nano-currency.js:131-133 (helper)Helper function used by the handler to derive the Nano address from the private key.function getAddress () { return N.deriveAddress(N.derivePublicKey(process.env.NANO_PRIVATE_KEY), { useNanoPrefix: true }) }