Skip to main content
Glama
gagarinyury

MCP Bitget Trading Server

by gagarinyury

getMarginInfo

Retrieve detailed margin account information from Bitget crypto exchange, enabling users to monitor and manage positions, leverage, and balances efficiently. Supports filtering by symbol for targeted insights.

Instructions

Get margin account information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoFilter by symbol

Implementation Reference

  • MCP tool handler for getMarginInfo that parses input using Zod schema, delegates to BitgetRestClient.getMarginInfo, and formats response as MCP CallToolResult.
    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 definition for the getMarginInfo tool, defining 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 the ListTools response, specifying name, description, and JSON schema matching the Zod schema.
    { name: 'getMarginInfo', description: 'Get margin account information', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'Filter by symbol' } }, required: [] }, },
  • Core implementation in BitgetRestClient that calls Bitget's /api/v2/mix/account/accounts endpoint to retrieve futures margin account information.
    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; }

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

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