Skip to main content
Glama

get_bitcoin_dominance

Calculate Bitcoin's market share percentage relative to all cryptocurrencies to analyze market trends and investment opportunities.

Instructions

Bitcoin (BTC) dominance is a metric used to measure the relative market share or dominance of Bitcoin in the overall cryptocurrency sector. It represents the percentage of Bitcoin's total market capitalization compared to the total market capitalization of all cryptocurrencies combined

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements the logic for the 'get_bitcoin_dominance' tool by fetching data from the external API endpoint.
    async def get_bitcoin_dominance() -> dict: """ Get Bitcoin (BTC) dominance metric. :return: Bitcoin dominance data """ url = 'https://mcp.desk3.io/v1/market/bitcoin/dominance' try: return request_api('get', url) except Exception as e: raise RuntimeError(f"Failed to fetch Bitcoin dominance data: {e}")
  • Registration of the 'get_bitcoin_dominance' tool in the MCP server's list_tools handler, including name, description, and empty input schema.
    types.Tool( name="get_bitcoin_dominance", description="Bitcoin (BTC) dominance is a metric used to measure the relative market share or dominance of Bitcoin in the overall cryptocurrency sector. It represents the percentage of Bitcoin's total market capitalization compared to the total market capitalization of all cryptocurrencies combined", inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
  • JSON schema definition for the tool's input parameters (none required).
    "type": "object", "properties": {}, "required": [], }, ),
  • Tool execution handler in the MCP server's call_tool method, which invokes the get_bitcoin_dominance function and formats the response.
    case "get_bitcoin_dominance": try: data = await get_bitcoin_dominance() return [ types.TextContent( type="text", text=json.dumps(data, indent=2), ) ] except Exception as e: raise RuntimeError(f"Failed to fetch Bitcoin dominance data: {e}")
  • Shared helper function used by get_bitcoin_dominance to make authenticated HTTP requests to the Desk3 API.
    def request_api(method: str, url: str, params: dict = None, data: dict = None) -> any: headers = { 'Accepts': 'application/json', 'X-DESK3_PRO_API_KEY': API_KEY, } try: logging.info(f"Requesting {method.upper()} {url} params={params} data={data}") if method.lower() == 'get': response = requests.get(url, headers=headers, params=params) elif method.lower() == 'post': response = requests.post(url, headers=headers, json=data) else: raise ValueError(f"Unsupported HTTP method: {method}") response.raise_for_status() logging.info(f"Response {response.status_code} for {url}") return json.loads(response.text) except Exception as e: logging.error(f"Error during {method.upper()} {url}: {e}") raise

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/desk3/cryptocurrency-mcp-server'

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