Skip to main content
Glama

get_ticker

Retrieve real-time ticker data for cryptocurrency pairs (BTC/JPY, ETH/JPY, XYM/JPY) to view market prices, 24-hour price ranges, trade volumes, and optimal bid/ask prices for informed trading decisions.

Instructions

    指定した通貨ペアのティッカー情報を取得します。

    現在の市場価格統計を提供し、以下の用途で使用します:
    - 現在の市場価格と24時間の価格変動を確認したい場合
    - 売買注文の価格設定の参考にしたい場合
    - 市場の活発さ(取引量)を把握したい場合

    使用例:
    - ビットコインの現在価格を確認したい場合
    - 最適な注文価格を決定するため最良売買価格を確認したい場合
    - 24時間の価格レンジを分析したい場合

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

    Returns:
        Ticker: ティッカー情報
            - last_price: 最終取引価格
            - high_price: 24時間最高値
            - low_price: 24時間最安値
            - ask_price: 最良売り価格
            - bid_price: 最良買い価格
            - volume: 24時間取引量

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currency_pairYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
volumeYes
ask_priceYes
bid_priceYes
low_priceYes
high_priceYes
last_priceYes

Implementation Reference

  • The primary MCP tool handler for 'get_ticker'. Decorated with @mcp.tool() for registration, it delegates to the Zaif API's market.get_ticker method to retrieve real-time ticker data for the specified currency pair.
    @mcp.tool()
    def get_ticker(currency_pair: SupportedPair) -> Ticker:
        """
        指定した通貨ペアのティッカー情報を取得します。
    
        現在の市場価格統計を提供し、以下の用途で使用します:
        - 現在の市場価格と24時間の価格変動を確認したい場合
        - 売買注文の価格設定の参考にしたい場合
        - 市場の活発さ(取引量)を把握したい場合
    
        使用例:
        - ビットコインの現在価格を確認したい場合
        - 最適な注文価格を決定するため最良売買価格を確認したい場合
        - 24時間の価格レンジを分析したい場合
    
        Args:
            currency_pair: 通貨ペア('btc_jpy': ビットコイン/円、'eth_jpy': イーサリアム/円、'xym_jpy': シンボル/円)
    
        Returns:
            Ticker: ティッカー情報
                - last_price: 最終取引価格
                - high_price: 24時間最高値
                - low_price: 24時間最安値
                - ask_price: 最良売り価格
                - bid_price: 最良買い価格
                - volume: 24時間取引量
    
        Raises:
            ValueError: 通貨ペアが無効な場合や、APIエラーが発生した場合
        """
        return api.market.get_ticker(currency_pair)
  • Data class defining the output structure of the get_ticker tool, including fields for last price, high/low, bid/ask, and volume, with from_dict factory for API response parsing.
    @dataclass
    class Ticker:
        """
        ティッカー情報を表すデータクラス。
        
        Attributes:
            last_price: 最終取引価格
            high_price: 最高値(24時間)
            low_price: 最安値(24時間)
            ask_price: 売り注文最安値
            bid_price: 買い注文最高値
            volume: 24時間取引量
        """
        last_price: Decimal
        high_price: Decimal
        low_price: Decimal
        ask_price: Decimal
        bid_price: Decimal
        volume: Decimal
        
        @classmethod
        def from_dict(cls, data: Dict[str, Any]) -> 'Ticker':
            """
            APIレスポンスからTickerインスタンスを作成します。
            
            Args:
                data: APIレスポンスの辞書
                
            Returns:
                Tickerインスタンス
            """
            return cls(
                last_price=Decimal(str(data['last'])),
                high_price=Decimal(str(data['high'])),
                low_price=Decimal(str(data['low'])),
                ask_price=Decimal(str(data['ask'])),
                bid_price=Decimal(str(data['bid'])),
                volume=Decimal(str(data['volume']))
            )
        
        def to_dict(self) -> Dict[str, Any]:
            """
            TickerインスタンスをAPIレスポンス形式の辞書に変換します。
            
            Returns:
                APIレスポンス形式の辞書
            """
            return {
                'last': str(self.last_price),
                'high': str(self.high_price),
                'low': str(self.low_price),
                'ask': str(self.ask_price),
                'bid': str(self.bid_price),
                'volume': str(self.volume)
            }
  • Literal type defining the valid input values for the currency_pair parameter: only 'btc_jpy', 'eth_jpy', 'xym_jpy' are supported.
    from typing import Literal
    
    # 対応する通貨ペアを明示的に制限
    SupportedPair = Literal["btc_jpy", "eth_jpy", "xym_jpy"]
  • Helper method in MarketApi class that performs the actual HTTP GET request to Zaif's ticker endpoint and parses the response into a Ticker object.
    def get_ticker(self, currency_pair: str) -> Ticker:
        """
        ティッカー情報を取得
    
        Args:
            currency_pair: 通貨ペア(例: 'btc_jpy')
    
        Returns:
            Tickerオブジェクト
        """
        url = f"{self.base_url}/1/ticker/{currency_pair}"
        data = self.http.get(url)
        return Ticker.from_dict(data)
  • Import and invocation of register_market_tools during server initialization, which defines and registers the get_ticker tool (among others) to the FastMCP instance.
    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)
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 the tool's behavior: it provides current market price statistics, specifies what data is returned, mentions potential errors (ValueError for invalid currency pairs or API errors), and describes the return structure. It doesn't mention rate limits, authentication requirements, or data freshness, but provides substantial behavioral context for a read-only data retrieval tool.

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, usage scenarios, examples, Args, Returns, Raises) and every sentence adds value. It could be slightly more concise by combining some bullet points, but the information density is high and the structure helps with comprehension. No wasted sentences or redundant information.

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's moderate complexity (single parameter, read-only data retrieval), no annotations, and the presence of an output schema, the description provides excellent completeness. It covers purpose, usage guidelines, parameter details, return value structure, and error conditions. The output schema existence means the description doesn't need to fully document return values, but it still provides helpful semantic context about what each field represents.

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 compensate fully. It provides excellent parameter semantics: explains what 'currency_pair' represents, lists all valid enum values with clear explanations ('btc_jpy': Bitcoin/Yen, etc.), and provides the parameter in both the Args section and implicitly through usage examples. This completely compensates for the schema's lack of descriptions.

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 verb ('取得します' - get/retrieve) and resource ('ティッカー情報' - ticker information). It distinguishes from siblings by focusing specifically on current market price statistics rather than order management (cancel_order, place_order), account information (get_account_balance), or other market data (get_market_depth, get_price_chart).

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 bullet points detailing when to use this tool: checking current market prices and 24-hour price changes, reference for order pricing, and understanding market activity. It includes concrete examples (checking Bitcoin price, determining optimal order prices, analyzing 24-hour price ranges) that clearly differentiate when this tool is appropriate versus alternatives.

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