Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

get_price

Retrieve current market prices for trading symbols like BTCUSDT to monitor cryptocurrency values in real-time through the Bybit exchange integration.

Instructions

Get the current price for a trading symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • Core handler function that executes the get_price tool logic by calling Bybit API's getTickers for the spot category to retrieve the current price.
    async getPrice(symbol: string) { try { const response = await this.client.getTickers({ category: 'spot', symbol: symbol }); return response; } catch (error) { throw new Error(`Failed to get price for ${symbol}: ${error instanceof Error ? error.message : JSON.stringify(error)}`); } }
  • Zod schema definition for the input parameters of the get_price tool, requiring a 'symbol' string.
    export const PriceSchema = z.object({ symbol: z.string().describe('Trading symbol (e.g., BTCUSDT)') });
  • src/tools.ts:15-22 (registration)
    Tool registration in the tools array, defining name, description, and input schema reference for get_price.
    { name: 'get_price', description: 'Get the current price for a trading symbol', inputSchema: { type: 'object', properties: PriceSchema.shape, required: ['symbol'] }
  • Server-side tool dispatcher that handles the 'get_price' case by invoking the client.getPrice method.
    case 'get_price': result = await this.client.getPrice(args.symbol as string);

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/ethancod1ng/bybit-mcp-server'

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