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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavioral traits. It only states the basic action without covering critical aspects: whether this is a read-only operation, potential rate limits, error conditions (e.g., invalid addresses), return format (e.g., numeric balance with decimals), or performance implications. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single, clear sentence—with zero wasted words. It's front-loaded with the core purpose, making it easy to parse. This efficiency is ideal for a simple tool, as every word earns its place without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what the balance output looks like (e.g., units, format), error handling, or dependencies like network connectivity. For a balance-fetching tool in a blockchain context, this omission could lead to misuse or confusion by the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('address' and 'network' with enum values). The description adds no additional semantic context beyond implying an address is required. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't enhance parameter understanding but doesn't detract either.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get SUI balance for an address'. It specifies the verb ('Get'), resource ('SUI balance'), and target ('address'), making the function unambiguous. However, it doesn't differentiate from sibling tools like 'get_sui_all_balances' or 'get_solana_balance', which would require explicit comparison for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools such as 'get_sui_all_balances' (which might return multiple balances) or 'get_historical_balance' (for time-based queries), nor does it specify prerequisites like network availability or address validity. Without such context, the agent lacks direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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