Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

get_klines

Retrieve historical candlestick data for trading symbols from Bybit to analyze market trends and price movements over specified time intervals.

Instructions

Get historical candlestick data for a trading symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
intervalYes
limitNo

Implementation Reference

  • Handler switch case for the 'get_klines' tool, which extracts arguments and calls the client's getKlines method.
    case 'get_klines':
      result = await this.client.getKlines(
        args.symbol as string,
        args.interval as string,
        args.limit as number
      );
      break;
  • Zod schema defining input parameters for the get_klines tool: symbol, interval, and optional limit.
    export const KlinesSchema = z.object({
      symbol: z.string().describe('Trading symbol (e.g., BTCUSDT)'),
      interval: z.enum(['1', '3', '5', '15', '30', '60', '120', '240', '360', '720', 'D', 'M', 'W']).describe('Kline interval'),
      limit: z.number().min(1).max(1000).optional().describe('Number of klines to return (default: 200)')
    });
  • src/tools.ts:33-41 (registration)
    Registration of the 'get_klines' tool in the tools array, including name, description, and reference to input schema.
    {
      name: 'get_klines',
      description: 'Get historical candlestick data for a trading symbol',
      inputSchema: {
        type: 'object',
        properties: KlinesSchema.shape,
        required: ['symbol', 'interval']
      }
    },
  • Helper method in BybitClient wrapper that implements the core logic by calling the Bybit SDK's getKline method for spot category.
    async getKlines(symbol: string, interval: string, limit: number = 200) {
      try {
        const response = await this.client.getKline({
          category: 'spot',
          symbol: symbol,
          interval: interval as any,
          limit: limit
        });
        return response;
      } catch (error) {
        throw new Error(`Failed to get klines for ${symbol}: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves historical data, implying a read-only operation, but doesn't cover critical aspects like rate limits, authentication requirements, data freshness, or error handling. For a financial data tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose, making it easy to parse quickly. Every word earns its place, achieving optimal conciseness for such a straightforward tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of financial data retrieval, lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the returned candlestick data includes (e.g., open, high, low, close, volume), time ranges, or any limitations. For a tool with 3 parameters and critical market data, more context is needed to ensure proper usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The tool description mentions 'historical candlestick data for a trading symbol,' which hints at the 'symbol' parameter's purpose but doesn't explain 'interval' or 'limit.' It adds minimal value beyond the schema's property names, failing to fully compensate for the coverage gap, warranting a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get historical candlestick data for a trading symbol.' It specifies the verb ('Get') and resource ('historical candlestick data'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'get_price' or 'get_24hr_ticker,' which also retrieve market data but for different metrics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios like technical analysis, backtesting, or comparing with real-time data from other tools. With siblings like 'get_price' for current prices and 'get_24hr_ticker' for daily summaries, the lack of differentiation leaves the agent guessing about appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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