Skip to main content
Glama
kilkelly

Nano Currency MCP Server

by kilkelly

nano_account_info

Retrieve detailed account information for a Nano address, including balance, representative, and frontier block, using the Nano Currency MCP Server.

Instructions

Retrieve detailed information about a specific Nano account/address, including balance (in Nano and raw units), representative, and frontier block.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesNano address/account to get information about

Implementation Reference

  • The handler function for nano_account_info tool. It fetches account information using getAccountInfo helper, formats the balance, and returns a formatted text response or handles errors.
    async function (parameters) {  
      try {
        let accountInfo =  await getAccountInfo(parameters.address)
    
        return createTextResponse(`The account information for ${parameters.address} is ` + JSON.stringify({ ...accountInfo, balance: friendlyAmount(accountInfo.balance) }))
      }
      catch (error) {
        console.error('[nano_account_info] Error:', error.message || error);
        return createErrorResponse(error)
      }    
    }
  • Zod schema defining the input parameter 'address' with validation and description for the nano_account_info tool.
    const nano_account_info_parameters = {
      address: z.string({ required_error: 'Address is required' })
        .refine(address_ => N.checkAddress(address_), { message: 'Nano address is not valid' })
        .describe("Nano address/account to get information about")
    }
  • Registration of the nano_account_info tool using server.tool, specifying name, description, parameters schema, and handler function.
    server.tool(
      'nano_account_info',
      'Retrieve detailed information about a specific Nano account/address, including balance (in Nano and raw units), representative, and frontier block.',
      nano_account_info_parameters,
      async function (parameters) {  
        try {
          let accountInfo =  await getAccountInfo(parameters.address)
    
          return createTextResponse(`The account information for ${parameters.address} is ` + JSON.stringify({ ...accountInfo, balance: friendlyAmount(accountInfo.balance) }))
        }
        catch (error) {
          console.error('[nano_account_info] Error:', error.message || error);
          return createErrorResponse(error)
        }    
      }
    )
  • Helper function that performs the Nano RPC 'account_info' call to retrieve detailed account information, used by the nano_account_info handler.
    async function getAccountInfo(address) {
      return (
        await rpcCall(
          NANO_RPC_URL_KEY,
          'account_info',
          {
            account: address,
            representative: 'true'
          }
        )
      )
    }
  • Helper function to format balance in both Nano and raw units, used in the response formatting.
    function friendlyAmount (balance) {
      return `${convertRawToNano(balance)} in nano units or ${balance} in raw units`
    }
Install Server

Other Tools

Related 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/kilkelly/nano-currency-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server