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
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- src/client.ts:23-33 (handler)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)}`); } }
- src/types.ts:26-28 (schema)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'] }
- src/server.ts:58-59 (handler)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);