Skip to main content
Glama

set_leverage

Adjust trading leverage for specific cryptocurrency pairs on Bybit to manage risk exposure and potential returns.

Instructions

Set leverage for a specific symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (linear, inverse)
symbolYesSymbol (e.g., ETHUSDT)
buyLeverageYesBuy leverage (e.g., "10" for 10x)
sellLeverageYesSell leverage (e.g., "10" for 10x)

Implementation Reference

  • Core handler function that executes the set_leverage tool logic by making an authenticated POST request to Bybit API endpoint /v5/position/set-leverage.
    async setLeverage(
      category: string,
      symbol: string,
      buyLeverage: string,
      sellLeverage: string
    ): Promise<BybitResponse<any> | { error: string }> {
      return this.makeBybitRequest('/v5/position/set-leverage', 'POST', {
        category,
        symbol,
        buyLeverage,
        sellLeverage
      });
    }
  • src/index.ts:527-552 (registration)
    Tool registration including name, description, and input schema definition for the MCP server.
    {
      name: 'set_leverage',
      description: 'Set leverage for a specific symbol',
      inputSchema: {
        type: 'object',
        properties: {
          category: {
            type: 'string',
            description: 'Category (linear, inverse)',
          },
          symbol: {
            type: 'string',
            description: 'Symbol (e.g., ETHUSDT)',
          },
          buyLeverage: {
            type: 'string',
            description: 'Buy leverage (e.g., "10" for 10x)',
          },
          sellLeverage: {
            type: 'string',
            description: 'Sell leverage (e.g., "10" for 10x)',
          },
        },
        required: ['category', 'symbol', 'buyLeverage', 'sellLeverage'],
      },
    },
  • Dispatch handler in the main tool request switch statement that extracts arguments and delegates to BybitService.setLeverage, formats and returns the result.
    case 'set_leverage': {
      const result = await this.bybitService.setLeverage(
        typedArgs.category,
        typedArgs.symbol,
        typedArgs.buyLeverage,
        typedArgs.sellLeverage
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema defining parameters for the set_leverage tool: category, symbol, buyLeverage, sellLeverage.
    inputSchema: {
      type: 'object',
      properties: {
        category: {
          type: 'string',
          description: 'Category (linear, inverse)',
        },
        symbol: {
          type: 'string',
          description: 'Symbol (e.g., ETHUSDT)',
        },
        buyLeverage: {
          type: 'string',
          description: 'Buy leverage (e.g., "10" for 10x)',
        },
        sellLeverage: {
          type: 'string',
          description: 'Sell leverage (e.g., "10" for 10x)',
        },
      },
      required: ['category', 'symbol', 'buyLeverage', 'sellLeverage'],
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Set leverage' implies a configuration/mutation operation, but the description doesn't disclose whether this requires authentication, has rate limits, affects open positions, or what happens on success/failure. For a financial trading tool with zero annotation coverage, this is a significant gap.

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, focused sentence with zero wasted words. It's appropriately sized for a tool with a straightforward purpose and well-documented schema. Every word earns its place by conveying essential information about the tool's function.

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?

For a financial trading configuration tool with 4 required parameters, no annotations, and no output schema, the description is inadequate. It doesn't address what the tool returns, error conditions, side effects, or how it interacts with other trading operations. The combination of mutation nature and financial context demands more comprehensive documentation.

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?

The schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema - it doesn't explain relationships between parameters, provide examples beyond what's in schema descriptions, or clarify edge cases. Baseline 3 is appropriate when schema does the heavy lifting.

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 action ('Set leverage') and target resource ('for a specific symbol'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'set_margin_mode' or 'set_trading_stop' which are also configuration tools, so it doesn't achieve full sibling differentiation.

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. There's no mention of prerequisites, timing considerations, or relationship to sibling tools like 'set_margin_mode' or 'set_trading_stop' that might be used in similar trading configuration contexts.

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