Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

getPositions

Retrieve current futures positions on Bitget exchange to monitor open trades, track exposure, and manage risk with optional symbol filtering.

Instructions

Get current futures positions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoFilter by symbol

Implementation Reference

  • Core handler function that executes the logic to fetch current futures positions from Bitget API via REST endpoint '/api/v2/mix/position/all-position' and maps response to Position objects
    async getFuturesPositions(symbol?: string): Promise<Position[]> {
      const params: any = { productType: 'USDT-FUTURES' };
      if (symbol) {
        // Add _UMCBL suffix for futures if not present
        params.symbol = symbol.includes('_') ? symbol : `${symbol}_UMCBL`;
      }
    
      const response = await this.request<any>('GET', '/api/v2/mix/position/all-position', params, true);
    
      const positions = response.data || [];
      return positions.map((position: any) => ({
        symbol: position.symbol,
        side: position.holdSide || (parseFloat(position.size || '0') > 0 ? 'long' : 'short'),
        size: Math.abs(parseFloat(position.size || position.total || '0')).toString(),
        entryPrice: position.averageOpenPrice || position.openPriceAvg,
        markPrice: position.markPrice,
        pnl: position.unrealizedPL || position.achievedProfits,
        pnlPercent: position.unrealizedPLR || '0',
        margin: position.margin || position.marginSize,
        leverage: position.leverage,
        timestamp: parseInt(position.cTime || Date.now().toString())
      }));
    }
  • MCP server tool call handler for 'getPositions' that validates input and delegates to BitgetRestClient.getFuturesPositions
    case 'getPositions': {
      const { symbol } = GetPositionsSchema.parse(args);
      const positions = await this.bitgetClient.getFuturesPositions(symbol);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(positions, null, 2),
          },
        ],
      } as CallToolResult;
    }
  • src/server.ts:205-215 (registration)
    Registration of the 'getPositions' tool in the ListTools response, defining name, description, and input schema
    {
      name: 'getPositions',
      description: 'Get current futures positions',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: { type: 'string', description: 'Filter by symbol' }
        },
        required: []
      },
    },
  • Zod schema defining input validation for getPositions tool parameters
    export const GetPositionsSchema = z.object({
      symbol: z.string().optional().describe('Filter by symbol')
    });
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. 'Get current futures positions' implies a read-only operation, but it doesn't specify whether this requires authentication, has rate limits, returns real-time or cached data, or what happens on errors. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 ('Get current futures positions') that is front-loaded and wastes no words. It directly conveys the core purpose without unnecessary elaboration, making it highly concise and well-structured.

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 tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'current futures positions' entails (e.g., open positions, margin details, or historical data), the return format, or error handling. Given the complexity of trading data and lack of structured support, more context is needed for effective 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?

The input schema has 100% description coverage, with the 'symbol' parameter documented as 'Filter by symbol'. The description doesn't add any parameter details beyond this, such as format examples or filtering behavior. Given the high schema coverage, the baseline score of 3 is appropriate, as the 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 'Get current futures positions' clearly states the verb ('Get') and resource ('current futures positions'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'getOrders' or 'getBalance', which could also relate to trading positions, so it doesn't reach the highest score.

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, timing, or comparisons to siblings like 'getOrders' (which might show open orders) or 'getBalance' (which might show account balances), leaving the agent without contextual usage instructions.

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/gagarinyury/MCP-bitget-trading'

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