Skip to main content
Glama

get_orderbook

Retrieve real-time orderbook data for cryptocurrency trading pairs on Bybit to analyze market depth, identify support/resistance levels, and make informed trading decisions.

Instructions

Get orderbook data for a specific symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
symbolYesSymbol (e.g., BTCUSDT)
limitNoNumber of orderbook entries to retrieve

Implementation Reference

  • Handler for the 'get_orderbook' tool. Extracts parameters from request and calls BybitService.getOrderbook, then returns the result as JSON text content.
    case 'get_orderbook': {
      const result = await this.bybitService.getOrderbook(
        typedArgs.category,
        typedArgs.symbol,
        typedArgs.limit
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:63-85 (registration)
    Registration of the 'get_orderbook' tool including name, description, and input schema definition in the tools array passed to MCP server.
    {
      name: 'get_orderbook',
      description: 'Get orderbook data for a specific symbol',
      inputSchema: {
        type: 'object',
        properties: {
          category: {
            type: 'string',
            description: 'Category (spot, linear, inverse, etc.)',
          },
          symbol: {
            type: 'string',
            description: 'Symbol (e.g., BTCUSDT)',
          },
          limit: {
            type: 'number',
            description: 'Number of orderbook entries to retrieve',
            default: 50,
          },
        },
        required: ['category', 'symbol'],
      },
    },
  • Core implementation of getOrderbook in BybitService class, which makes the HTTP request to Bybit's /v5/market/orderbook endpoint.
    async getOrderbook(category: string, symbol: string, limit: number = 50): Promise<BybitResponse<OrderbookData> | { error: string }> {
      return this.makeBybitRequest('/v5/market/orderbook', 'GET', { category, symbol, limit });
    }
  • TypeScript interface defining the structure of the orderbook response data (output schema).
    export interface OrderbookData {
      symbol: string;
      bids: [string, string][];
      asks: [string, string][];
      ts: number;
      u: number;
    }
  • JSON Schema for input validation of the 'get_orderbook' tool parameters.
    inputSchema: {
      type: 'object',
      properties: {
        category: {
          type: 'string',
          description: 'Category (spot, linear, inverse, etc.)',
        },
        symbol: {
          type: 'string',
          description: 'Symbol (e.g., BTCUSDT)',
        },
        limit: {
          type: 'number',
          description: 'Number of orderbook entries to retrieve',
          default: 50,
        },
      },
      required: ['category', 'symbol'],
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states what the tool does without mentioning critical details like rate limits, authentication requirements, response format, or whether it's a read-only operation. For a data retrieval tool in a trading context, this leaves significant gaps in understanding its 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 purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 and the absence of both annotations and an output schema, the description is insufficient. It doesn't explain what orderbook data includes (e.g., bids/asks), how results are structured, or any limitations like real-time vs. delayed data, making it incomplete for effective tool use.

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 100%, so the input schema fully documents all three parameters (category, symbol, limit). The description doesn't add any additional meaning beyond what's in the schema, such as explaining category options (spot, linear, inverse) or symbol format conventions, but the schema provides adequate baseline information.

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 verb 'Get' and resource 'orderbook data for a specific symbol', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like get_tickers or get_kline, which also retrieve market data but for different resources.

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 like get_tickers (for price data) or get_kline (for historical candlestick data). It also doesn't mention prerequisites such as needing a valid symbol or category, leaving usage context implied rather than explicit.

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/kondisettyravi/mcp-bybit-node'

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