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
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Filter by symbol |
Implementation Reference
- src/server.ts:455-466 (handler)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; }
- src/types/mcp.ts:93-95 (schema)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: [] }, },
- src/api/rest-client.ts:802-811 (helper)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; }