Skip to main content
Glama
ethancod1ng

Bybit MCP Server

by ethancod1ng

get_open_orders

Retrieve active orders from Bybit trading accounts to monitor positions and manage trades across spot, linear, inverse, and option markets.

Instructions

Get list of open/active orders

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes
symbolNo
limitNo

Implementation Reference

  • Core handler function that executes the tool logic by calling Bybit API's getActiveOrders.
    async getOpenOrders(category: string, symbol?: string, limit: number = 20) {
      try {
        const response = await this.client.getActiveOrders({
          category: category as any,
          symbol: symbol,
          limit: limit
        });
        return response;
      } catch (error) {
        throw new Error(`Failed to get open orders: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
      }
    }
  • Server dispatch handler that routes the 'get_open_orders' tool call to the client implementation.
    case 'get_open_orders':
      result = await this.client.getOpenOrders(
        args.category as string,
        args.symbol as string,
        args.limit as number
      );
      break;
  • src/tools.ts:69-77 (registration)
    Tool registration defining name, description, and input schema reference.
    {
      name: 'get_open_orders',
      description: 'Get list of open/active orders',
      inputSchema: {
        type: 'object',
        properties: OpenOrdersSchema.shape,
        required: ['category']
      }
    },
  • Zod schema for input validation of get_open_orders parameters.
    export const OpenOrdersSchema = z.object({
      category: z.enum(['spot', 'linear', 'inverse', 'option']).describe('Product type'),
      symbol: z.string().optional().describe('Trading symbol'),
      limit: z.number().min(1).max(50).optional().describe('Number of records to return (default: 20)')
    });

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