Skip to main content
Glama

get_market_depth

Retrieve order book data for specified currency pairs to analyze market liquidity, bid-ask spreads, and support/resistance levels. Useful for assessing trading pressure and planning large orders.

Instructions

    指定した通貨ペアの板情報を取得します。

    市場全体の売買注文状況を表示し、あなた個人の注文一覧(get_open_orders)とは異なります。
    全市場参加者の注文が価格順に並んだ情報で、以下の用途で使用します:
    - 市場の流動性と売買圧力を分析したい場合
    - 大量注文前に市場の深さを確認したい場合
    - サポート・レジスタンスレベルを特定したい場合

    使用例:
    - 大きな注文を出す前に市場の流動性を確認したい場合
    - 現在のビッド・アスクスプレッドを詳細に分析したい場合
    - 特定価格帯での注文量を確認したい場合

    Args:
        currency_pair: 通貨ペア('btc_jpy': ビットコイン/円、'eth_jpy': イーサリアム/円、'xym_jpy': シンボル/円)

    Returns:
        OrderBook: 市場全体の板情報
            - asks: 売り注文一覧(price・quantity)
            - bids: 買い注文一覧(price・quantity)

    Raises:
        ValueError: 通貨ペアが無効な場合や、APIエラーが発生した場合
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currency_pairYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
asksYes
bidsYes

Implementation Reference

  • The handler function for the 'get_market_depth' tool. It takes a SupportedPair as input and returns an OrderBook by calling the ZaifApi market depth method.
    @mcp.tool()
    def get_market_depth(currency_pair: SupportedPair) -> OrderBook:
        """
        指定した通貨ペアの板情報を取得します。
    
        市場全体の売買注文状況を表示し、あなた個人の注文一覧(get_open_orders)とは異なります。
        全市場参加者の注文が価格順に並んだ情報で、以下の用途で使用します:
        - 市場の流動性と売買圧力を分析したい場合
        - 大量注文前に市場の深さを確認したい場合
        - サポート・レジスタンスレベルを特定したい場合
    
        使用例:
        - 大きな注文を出す前に市場の流動性を確認したい場合
        - 現在のビッド・アスクスプレッドを詳細に分析したい場合
        - 特定価格帯での注文量を確認したい場合
    
        Args:
            currency_pair: 通貨ペア('btc_jpy': ビットコイン/円、'eth_jpy': イーサリアム/円、'xym_jpy': シンボル/円)
    
        Returns:
            OrderBook: 市場全体の板情報
                - asks: 売り注文一覧(price・quantity)
                - bids: 買い注文一覧(price・quantity)
    
        Raises:
            ValueError: 通貨ペアが無効な場合や、APIエラーが発生した場合
        """
        return api.market.get_depth(currency_pair)
  • Registration of market tools (including get_market_depth) via register_market_tools call in the main server setup.
    from zaifer_mcp.tools.market import register_market_tools
    from zaifer_mcp.tools.account import register_account_tools
    from zaifer_mcp.tools.trade import register_trade_tools
    from zaifer_mcp.tools.chart import register_chart_tools
    
    register_market_tools(mcp, zaif_api)
    register_account_tools(mcp, zaif_api)
    register_trade_tools(mcp, zaif_api)
    register_chart_tools(mcp, zaif_api)
  • Input schema: SupportedPair type, restricting currency pairs to supported ones.
    SupportedPair = Literal["btc_jpy", "eth_jpy", "xym_jpy"]
  • Output schema: OrderBook dataclass defining the structure of market depth data with asks and bids lists.
    class OrderBook:
        """
        板情報を表すデータクラス。
        
        Attributes:
            asks: 売り注文リスト
            bids: 買い注文リスト
        """
        asks: List[OrderBookItem]
        bids: List[OrderBookItem]
        
        @classmethod
        def from_dict(cls, data: Dict[str, Any]) -> 'OrderBook':
            """
            APIレスポンスからOrderBookインスタンスを作成します。
            
            Args:
                data: APIレスポンスの辞書
                
            Returns:
                OrderBookインスタンス
            """
            asks = [OrderBookItem(Decimal(str(item[0])), Decimal(str(item[1]))) 
                    for item in data.get('asks', [])]
            bids = [OrderBookItem(Decimal(str(item[0])), Decimal(str(item[1]))) 
                    for item in data.get('bids', [])]
            return cls(asks=asks, bids=bids)
        
        def to_dict(self) -> Dict[str, Any]:
            """
            OrderBookインスタンスをAPIレスポンス形式の辞書に変換します。
            
            Returns:
                APIレスポンス形式の辞書
            """
            return {
                'asks': [[str(item.price), str(item.quantity)] for item in self.asks],
                'bids': [[str(item.price), str(item.quantity)] for item in self.bids]
            }
  • The register_market_tools function where the @mcp.tool() decorator for get_market_depth is applied.
    def register_market_tools(mcp: FastMCP, api: ZaifApi):
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. It explains this shows market-wide data (not personal), describes the return structure (asks/bids with price/quantity), mentions error conditions (invalid currency pairs, API errors), and implies this is a read-only operation (no destructive language). It doesn't mention rate limits or authentication requirements, but provides substantial behavioral context.

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?

The description is well-structured with clear sections: purpose statement, differentiation from sibling tool, usage scenarios, examples, and formal parameter/return documentation. While comprehensive, some redundancy exists between usage scenarios and examples. Every sentence adds value, but it could be slightly more concise by integrating scenarios and examples.

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?

For a single-parameter read operation with an output schema, this description is exceptionally complete. It covers purpose, differentiation from siblings, multiple usage contexts, parameter semantics, return structure, and error conditions. The output schema existence means the description doesn't need to detail return values, and it appropriately focuses on when and why to use the tool.

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

Parameters5/5

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

The schema has 0% description coverage, so the description must fully compensate. It provides a dedicated 'Args' section explaining the single parameter 'currency_pair' with specific examples ('btc_jpy', 'eth_jpy', 'xym_jpy') and their meanings. This adds significant value beyond what the bare enum in the schema provides by explaining what these codes represent.

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: '指定した通貨ペアの板情報を取得します' (get order book information for specified currency pairs). It explicitly distinguishes this from the sibling tool 'get_open_orders' by noting it shows market-wide order information rather than personal orders. The verb+resource combination is specific and unambiguous.

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 excellent usage guidance with three specific scenarios when to use this tool: analyzing market liquidity and buying/selling pressure, checking market depth before large orders, and identifying support/resistance levels. It also explicitly distinguishes when NOT to use it (for personal orders, directing to 'get_open_orders' instead). Three usage examples further clarify appropriate contexts.

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