Skip to main content
Glama

get_wallet_balance

Retrieve wallet balance details for specified account types (UNIFIED, CONTRACT, SPOT) and optional coin on Bybit. Provides accurate balance information for better account management.

Instructions

Get wallet balance

Args:
    accountType (str): Account type (UNIFIED, CONTRACT, SPOT)
    coin (Optional[str]): Coin symbol

Returns:
    Dict: Wallet balance information

Example:
    get_wallet_balance("UNIFIED", "BTC")

Reference:
    https://bybit-exchange.github.io/docs/v5/account/wallet-balance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountTypeYesAccount type (UNIFIED, CONTRACT, SPOT)
coinNoCoin symbol

Implementation Reference

  • The primary MCP tool handler for 'get_wallet_balance', decorated with @mcp.tool(). It validates inputs using Pydantic Field, calls the BybitService, handles errors, and returns the balance information.
    @mcp.tool()
    def get_wallet_balance(
        accountType: str = Field(description="Account type (UNIFIED, CONTRACT, SPOT)"),
        coin: Optional[str] = Field(default=None, description="Coin symbol")
    ) -> Dict:
        """
        Get wallet balance
    
        Args:
            accountType (str): Account type (UNIFIED, CONTRACT, SPOT)
            coin (Optional[str]): Coin symbol
    
        Returns:
            Dict: Wallet balance information
    
        Example:
            get_wallet_balance("UNIFIED", "BTC")
    
        Reference:
            https://bybit-exchange.github.io/docs/v5/account/wallet-balance
        """
        try:
            result = bybit_service.get_wallet_balance(accountType, coin)
            if result.get("retCode") != 0:
                logger.error(f"Failed to get wallet balance: {result.get('retMsg')}")
                return {"error": result.get("retMsg")}
            return result
        except Exception as e:
            logger.error(f"Failed to get wallet balance: {e}", exc_info=True)
            return {"error": str(e)}
  • Helper method in BybitService class that proxies the get_wallet_balance call to the underlying HTTP client (likely pybit).
    def get_wallet_balance(self, accountType: str, coin: Optional[str] = None) -> Dict:
        """
        Get wallet balance
    
        Args:
            accountType (str): Account type (UNIFIED, CONTRACT, SPOT)
            coin (Optional[str]): Coin symbol
    
        Returns:
            Dict: Wallet balance information
        """
        return self.client.get_wallet_balance(
            accountType=accountType,
            coin=coin
        )
  • Input schema definition using Pydantic Field annotations for MCP tool parameters, providing descriptions and defaults for validation and documentation.
    def get_wallet_balance(
        accountType: str = Field(description="Account type (UNIFIED, CONTRACT, SPOT)"),
        coin: Optional[str] = Field(default=None, description="Coin symbol")
    ) -> Dict:
  • src/server.py:163-163 (registration)
    The @mcp.tool() decorator registers this function as an MCP tool, making it available via mcp.run().
    @mcp.tool()
  • Tool description in the @mcp.prompt() function used for AI context, listing available tools.
    - get_wallet_balance(accountType, coin) - Get wallet balance: Retrieve wallet balance information for a specific account type and coin.
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention authentication requirements, rate limits, error conditions, or what specific information is returned in the 'Dict'. This leaves significant behavioral gaps for a financial data tool.

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

Conciseness3/5

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

The description is reasonably structured with sections for Args, Returns, Example, and Reference, but includes redundant information (repeating schema details) and could be more front-loaded. The core purpose is clear in the first line, but subsequent sections don't efficiently add value beyond what structured fields could provide.

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?

For a financial data tool with no annotations and no output schema, the description is insufficient. It doesn't explain what balance information is returned, how to interpret the results, or address common use cases. The example helps but doesn't compensate for the lack of behavioral and output context needed for proper tool invocation.

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?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description repeats the parameter information but doesn't add meaningful context beyond what's in the schema, such as explaining the relationship between account types or when coin filtering is useful. This meets the baseline for high schema coverage.

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 with a specific verb ('Get') and resource ('wallet balance'), making it immediately understandable. However, it doesn't differentiate this tool from potential siblings like 'get_positions' or 'get_order_history' that might also return financial information, preventing 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. While it mentions account types and coin parameters, it doesn't explain when to query balance versus positions, orders, or other financial data from sibling tools, leaving the agent without contextual usage instructions.

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

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/dlwjdtn535/mcp-bybit-server'

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