Skip to main content
Glama

get-leverage-tiers

Retrieve futures leverage tiers for specific trading pairs on cryptocurrency exchanges. Define exchange, symbol, and market type to access precise leverage data for informed trading decisions.

Instructions

Get futures leverage tiers for trading pairs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeYesExchange ID (e.g., binance, bybit)
marketTypeNoMarket type (default: future)future
symbolNoTrading pair symbol (optional, e.g., BTC/USDT)

Implementation Reference

  • The handler function that implements the core logic of the 'get-leverage-tiers' tool. It fetches leverage tiers for futures/swap markets using the exchange API, with caching and rate limiting.
    }, async ({ exchange, symbol, marketType }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          // Get futures exchange
          const ex = getExchangeWithMarketType(exchange, marketType);
          const cacheKey = `leverage_tiers:${exchange}:${marketType}:${symbol || 'all'}`;
          
          const tiers = await getCachedData(cacheKey, async () => {
            log(LogLevel.INFO, `Fetching leverage tiers for ${symbol || 'all symbols'} on ${exchange} (${marketType})`);
            if (symbol) {
              return await ex.fetchMarketLeverageTiers(symbol);
            } else {
              return await ex.fetchLeverageTiers();
            }
          }, 3600000); // Cache for 1 hour
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(tiers, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching leverage tiers: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
  • Zod schema defining the input parameters for the 'get-leverage-tiers' tool: required exchange, optional symbol, and marketType.
    exchange: z.string().describe("Exchange ID (e.g., binance, bybit)"),
    symbol: z.string().optional().describe("Trading pair symbol (optional, e.g., BTC/USDT)"),
    marketType: z.enum(["future", "swap"]).default("future").describe("Market type (default: future)")
  • Registration of the 'get-leverage-tiers' tool on the MCP server within the registerPublicTools function.
    server.tool("get-leverage-tiers", "Get futures leverage tiers for trading pairs", {
      exchange: z.string().describe("Exchange ID (e.g., binance, bybit)"),
      symbol: z.string().optional().describe("Trading pair symbol (optional, e.g., BTC/USDT)"),
      marketType: z.enum(["future", "swap"]).default("future").describe("Market type (default: future)")
    }, async ({ exchange, symbol, marketType }) => {
      try {
        return await rateLimiter.execute(exchange, async () => {
          // Get futures exchange
          const ex = getExchangeWithMarketType(exchange, marketType);
          const cacheKey = `leverage_tiers:${exchange}:${marketType}:${symbol || 'all'}`;
          
          const tiers = await getCachedData(cacheKey, async () => {
            log(LogLevel.INFO, `Fetching leverage tiers for ${symbol || 'all symbols'} on ${exchange} (${marketType})`);
            if (symbol) {
              return await ex.fetchMarketLeverageTiers(symbol);
            } else {
              return await ex.fetchLeverageTiers();
            }
          }, 3600000); // Cache for 1 hour
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(tiers, null, 2)
            }]
          };
        });
      } catch (error) {
        log(LogLevel.ERROR, `Error fetching leverage tiers: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    });
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. It states a read operation ('Get'), implying it's likely non-destructive, but doesn't specify permissions, rate limits, response format, or error handling. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves in practice.

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 with no wasted words. It's front-loaded with the core purpose and avoids unnecessary elaboration, making it easy to parse quickly while conveying the essential action.

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 lack of annotations and output schema, the description is incomplete for a tool that likely returns structured financial data. It doesn't explain what leverage tiers entail (e.g., margin requirements, tier levels) or the format of the response, leaving the agent with insufficient context to use the tool effectively beyond basic parameter passing.

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 the input schema fully documents all parameters (exchange, marketType, symbol). The description adds no additional semantic context beyond implying these parameters are used to fetch leverage tiers, which the schema already covers. This meets the baseline for high schema coverage.

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 ('Get') and resource ('futures leverage tiers for trading pairs'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'set-leverage' or 'get-exchange-info', which would require more specific language about what distinguishes this retrieval operation.

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 prerequisites, context (e.g., for risk management or trading setup), or comparisons to siblings like 'get-exchange-info' or 'set-leverage', leaving the agent to infer usage scenarios without explicit direction.

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

Related 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/doggybee/mcp-server-ccxt'

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