Skip to main content
Glama

get_symbol_price

Fetch the current cryptocurrency pair price from Binance exchange to monitor market values and support trading decisions.

Instructions

Get the current price of a cryptocurrency pair.

Args: symbol: The cryptocurrency pair, e.g., BTCUSDT.

Returns: Price information from Binance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • The main handler function for the 'get_symbol_price' tool. It is decorated with @mcp.tool() for registration and @lru_cache for caching. Fetches the current price from Binance public API endpoint.
    @mcp.tool() @lru_cache(maxsize=100) def get_symbol_price(symbol: str) -> Any: """ Get the current price of a cryptocurrency pair. Args: symbol: The cryptocurrency pair, e.g., BTCUSDT. Returns: Price information from Binance. """ url = "https://api.binance.com/api/v3/ticker/price" params = {"symbol": symbol} response = requests.get(url, params=params) if response.status_code == 200: data = response.json() return {"price": data['price'], "symbol": symbol} return {"error": response.text}

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/mixuechu/binance-mcp'

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