Skip to main content
Glama

get_account_balance

Retrieve account balance details for all currencies on Zaif cryptocurrency exchange. Use this tool to verify available funds, calculate investable amounts, or assess portfolio value. Requires API key and secret for authentication.

Instructions

    アカウントの残高情報を取得します。
    
    このツールは、取引前の残高確認や投資可能額の算出に使用します。
    すべての通貨の残高を一度に取得し、利用可能な資金を確認できます。
    
    使用例:
    - 取引前に利用可能な資金を確認したい場合
    - ポートフォリオの総資産価値を計算したい場合
    - 各通貨の保有量を確認したい場合
    - 投資可能額を把握したい場合
    
    注意: このツールを使用するには、環境変数にAPIキーとシークレットが設定されている必要があります。
    
    Returns:
        AccountBalance: アカウント残高情報
            - balances: 各通貨の残高情報(通貨コードをキーとする辞書)
            - permissions: 利用権限情報(APIの各機能に対する権限を示す辞書)
    
    Raises:
        ValueError: 認証情報が設定されていない場合や、APIエラーが発生した場合
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
balancesYes
permissionsNo

Implementation Reference

  • The core handler function for the 'get_account_balance' tool, decorated with @mcp.tool(). It checks authentication and calls the Zaif API to retrieve account balance information, returning an AccountBalance object.
    @mcp.tool()
    def get_account_balance() -> AccountBalance:
        """
        アカウントの残高情報を取得します。
        
        このツールは、取引前の残高確認や投資可能額の算出に使用します。
        すべての通貨の残高を一度に取得し、利用可能な資金を確認できます。
        
        使用例:
        - 取引前に利用可能な資金を確認したい場合
        - ポートフォリオの総資産価値を計算したい場合
        - 各通貨の保有量を確認したい場合
        - 投資可能額を把握したい場合
        
        注意: このツールを使用するには、環境変数にAPIキーとシークレットが設定されている必要があります。
        
        Returns:
            AccountBalance: アカウント残高情報
                - balances: 各通貨の残高情報(通貨コードをキーとする辞書)
                - permissions: 利用権限情報(APIの各機能に対する権限を示す辞書)
        
        Raises:
            ValueError: 認証情報が設定されていない場合や、APIエラーが発生した場合
        """
        if not api.account.http.auth_provider:
            raise ValueError("認証情報が設定されていません。APIキーとシークレットを.envファイルに設定してください。")
        
        # 全通貨の残高を取得
        return api.account.get_info()
  • The AccountBalance dataclass schema defining the input/output structure for account balance data, used as the return type of the tool handler. Includes from_dict and to_dict for serialization.
    @dataclass
    class AccountBalance:
        """
        アカウント残高情報を表すデータクラス。
        get_info, get_info2の戻り値に対応します。
        
        Attributes:
            balances: 各通貨の残高情報
            permissions: 利用権限(get_infoのみ)
        """
        balances: Dict[str, Decimal]
        permissions: Optional[Dict[str, bool]] = None
        
        @classmethod
        def from_dict(cls, data: Dict[str, Any]) -> 'AccountBalance':
            """
            APIレスポンスからAccountBalanceインスタンスを作成します。
            
            Args:
                data: APIレスポンスの辞書
                
            Returns:
                AccountBalanceインスタンス
            """
            balances = {k: Decimal(str(v)) for k, v in data.get('funds', {}).items()}
            permissions = data.get('rights')
            return cls(balances=balances, permissions=permissions)
        
        def to_dict(self) -> Dict[str, Any]:
            """
            AccountBalanceインスタンスを辞書に変換します。
            
            Returns:
                APIレスポンス形式の辞書
            """
            result = {'funds': {k: str(v) for k, v in self.balances.items()}}
            if self.permissions is not None:
                result['rights'] = self.permissions
            return result
  • Registration call within register_all_components function that invokes register_account_tools to add the get_account_balance tool to the FastMCP server instance. Includes the import.
    register_market_tools(mcp, zaif_api)
    register_account_tools(mcp, zaif_api)
    register_trade_tools(mcp, zaif_api)
    register_chart_tools(mcp, zaif_api)
  • The register_account_tools function that defines and registers the get_account_balance tool using the @mcp.tool() decorator on the MCP server.
    def register_account_tools(mcp: FastMCP, api: ZaifApi):
        """
        Zaifのアカウント情報APIをMCPツールとして登録する
        
        Args:
            mcp: FastMCPインスタンス
            api: ZaifApiインスタンス
        """
        @mcp.tool()
        def get_account_balance() -> AccountBalance:
            """
            アカウントの残高情報を取得します。
            
            このツールは、取引前の残高確認や投資可能額の算出に使用します。
            すべての通貨の残高を一度に取得し、利用可能な資金を確認できます。
            
            使用例:
            - 取引前に利用可能な資金を確認したい場合
            - ポートフォリオの総資産価値を計算したい場合
            - 各通貨の保有量を確認したい場合
            - 投資可能額を把握したい場合
            
            注意: このツールを使用するには、環境変数にAPIキーとシークレットが設定されている必要があります。
            
            Returns:
                AccountBalance: アカウント残高情報
                    - balances: 各通貨の残高情報(通貨コードをキーとする辞書)
                    - permissions: 利用権限情報(APIの各機能に対する権限を示す辞書)
            
            Raises:
                ValueError: 認証情報が設定されていない場合や、APIエラーが発生した場合
            """
            if not api.account.http.auth_provider:
                raise ValueError("認証情報が設定されていません。APIキーとシークレットを.envファイルに設定してください。")
            
            # 全通貨の残高を取得
            return api.account.get_info()
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing authentication requirements, error conditions (ValueError for missing credentials or API errors), and return structure. It mentions retrieving balances for all currencies at once and checking available funds, which adds useful behavioral context beyond basic functionality.

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

Conciseness4/5

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

Well-structured with clear sections (purpose, usage examples, prerequisites, returns, errors). The description is appropriately sized for a tool with no input parameters but significant behavioral context. Minor deduction for some redundancy in usage examples that could be more concise.

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

Completeness5/5

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

Given the tool has no input parameters, an output schema exists, and no annotations are provided, the description is complete. It covers purpose, usage guidelines, prerequisites, return structure, and error conditions - everything needed for an agent to understand when and how to use this tool effectively.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so baseline would be 4. The description appropriately doesn't discuss input parameters since none exist, focusing instead on output semantics and usage context.

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

Purpose5/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 specific verbs ('取得します' - get/retrieve) and resource ('アカウントの残高情報' - account balance information). It distinguishes itself from siblings by focusing on account balance retrieval rather than order management, market data, or trading operations.

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

Usage Guidelines5/5

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

The description provides explicit usage scenarios with four concrete examples (checking available funds before trading, calculating total portfolio value, checking currency holdings, understanding investable amounts). It also specifies prerequisites (API key and secret must be configured in environment variables).

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/curio184/zaifer-mcp'

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