Skip to main content
Glama
hanweg

mcp-tool-builder

by hanweg

get_bitcoin_price

Retrieve current Bitcoin price in USD from the CoinGecko API for real-time cryptocurrency tracking and financial analysis.

Instructions

Gets current Bitcoin price in USD from CoinGecko API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the tool logic: fetches the current Bitcoin price in USD from CoinGecko API using urllib and json, formats it, and returns the result or an error message if fetch fails.
    def get_bitcoin_price():
        from urllib import request, error
        import json
        try:
            with request.urlopen('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd') as response:
                data = json.loads(response.read())
                return f"Current Bitcoin price: ${data['bitcoin']['usd']:,.2f}"
        except:
            return "Error: Unable to fetch Bitcoin price"

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/hanweg/mcp-tool-builder'

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