Skip to main content
Glama

get_symbol_price

Fetch real-time cryptocurrency pair prices directly from Binance using the provided symbol (e.g., BTCUSDT). Retrieve accurate price data for trading or analysis.

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 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 of a given symbol from the Binance spot API.
    @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}
  • binance.py:26-26 (registration)
    The @mcp.tool() decorator registers the get_symbol_price function as an MCP tool.
    @mcp.tool()
  • Docstring defining the input schema (symbol: str) and output format for the tool.
    """ Get the current price of a cryptocurrency pair. Args: symbol: The cryptocurrency pair, e.g., BTCUSDT. Returns: Price information from Binance. """

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

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