Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

get_sui_balance

Retrieve SUI token balance for any Sui blockchain address on mainnet or testnet networks using Grove's MCP Server for Pocket Network.

Instructions

Get SUI balance for an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesSui address
networkNoNetwork type (defaults to mainnet)

Implementation Reference

  • The switch case in handleSuiTool that implements the execution logic for the 'get_sui_balance' tool. It parses input arguments, calls SuiService.getBalance, and returns a formatted MCP response.
    case 'get_sui_balance': { const address = args?.address as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await suiService.getBalance(address, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • The tool schema definition for 'get_sui_balance', including name, description, and input validation schema returned by registerSuiHandlers.
    { name: 'get_sui_balance', description: 'Get SUI balance for an address', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Sui address', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['address'], }, },
  • src/index.ts:88-101 (registration)
    Registration of all tools including Sui tools via registerSuiHandlers, collected into the tools array used for ListTools response.
    const tools: Tool[] = [ ...registerBlockchainHandlers(server, blockchainService), ...registerDomainHandlers(server, domainResolver), ...registerTransactionHandlers(server, advancedBlockchain), ...registerTokenHandlers(server, advancedBlockchain), ...registerMultichainHandlers(server, advancedBlockchain), ...registerContractHandlers(server, advancedBlockchain), ...registerUtilityHandlers(server, advancedBlockchain), ...registerEndpointHandlers(server, endpointManager), ...registerSolanaHandlers(server, solanaService), ...registerCosmosHandlers(server, cosmosService), ...registerSuiHandlers(server, suiService), ...registerDocsHandlers(server, docsManager), ];
  • Supporting method in SuiService that performs the suix_getBalance RPC call via blockchainService and enhances the response with human-readable SUI balance.
    async getBalance( address: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain('sui', network); if (!service) { return { success: false, error: `Sui service not found for ${network}`, }; } const result = await this.blockchainService.callRPCMethod( service.id, 'suix_getBalance', [address] ); if (result.success && result.data) { // Add human-readable balance (SUI has 9 decimals) const totalBalance = BigInt(result.data.totalBalance || '0'); const sui = Number(totalBalance) / 1e9; return { success: true, data: { address, totalBalance: result.data.totalBalance, sui, coinType: result.data.coinType || '0x2::sui::SUI', }, metadata: result.metadata, }; } return result; }

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/buildwithgrove/mcp-pocket'

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