Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

getMarginInfo

Retrieve margin account details for cryptocurrency trading on Bitget, including balances and positions, to monitor risk exposure and manage leveraged positions effectively.

Instructions

Get margin account information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoFilter by symbol

Implementation Reference

  • MCP tool handler: parses arguments using GetMarginInfoSchema, calls BitgetRestClient.getMarginInfo(symbol), and returns JSON stringified result.
    case 'getMarginInfo': { const { symbol } = GetMarginInfoSchema.parse(args); const marginInfo = await this.bitgetClient.getMarginInfo(symbol); return { content: [ { type: 'text', text: JSON.stringify(marginInfo, null, 2), }, ], } as CallToolResult; }
  • Zod input schema for getMarginInfo tool: optional symbol parameter.
    export const GetMarginInfoSchema = z.object({ symbol: z.string().optional().describe('Filter by symbol') });
  • src/server.ts:228-238 (registration)
    Tool registration in MCP server's listTools handler: defines name, description, and JSON input schema.
    { name: 'getMarginInfo', description: 'Get margin account information', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'Filter by symbol' } }, required: [] }, },
  • BitgetRestClient helper method: fetches margin account details from Bitget API endpoint /api/v2/mix/account/accounts for USDT-FUTURES.
    async getMarginInfo(symbol?: string): Promise<any> { 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/account/accounts', params, true); return response.data; }

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