getAccountInfo
Retrieve current account details including balances, positions, and trading status for cryptocurrency futures trading on the Aster exchange.
Instructions
Get current account information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:663-664 (handler)Handler implementation for the 'getAccountInfo' tool. It calls the shared makeRequest helper to perform a signed GET request to the Asterdex API endpoint '/fapi/v4/account'.case 'getAccountInfo': return makeRequest('GET', '/fapi/v4/account', args, true);
- src/index.ts:397-397 (registration)Registration of the 'getAccountInfo' tool in the ListTools response, including its description and input schema (no required parameters).{ name: 'getAccountInfo', description: 'Get current account information.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:397-397 (schema)Input schema for getAccountInfo tool: an empty object, indicating no input parameters are required.{ name: 'getAccountInfo', description: 'Get current account information.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:542-579 (helper)Shared helper function 'makeRequest' used by the getAccountInfo handler (and other signed tools) to make authenticated HTTP requests to the Asterdex futures API, including HMAC-SHA256 signing.const makeRequest = async (method: 'GET' | 'POST' | 'DELETE', path: string, params: any, isSigned = false) => { try { let config: any = { method, url: path, }; if (isSigned) { if (!API_KEY || !API_SECRET) { throw new McpError(ErrorCode.InvalidRequest, 'API_KEY and API_SECRET must be configured.'); } params.timestamp = Date.now(); const queryString = new URLSearchParams(params).toString(); const signature = crypto.createHmac('sha256', API_SECRET).update(queryString).digest('hex'); params.signature = signature; config.headers = { 'X-MBX-APIKEY': API_KEY }; } if (method === 'GET' || method === 'DELETE') { config.params = params; } else { // POST config.data = new URLSearchParams(params).toString(); config.headers = { ...config.headers, 'Content-Type': 'application/x-www-form-urlencoded' }; } const response = await this.axiosInstance.request(config); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Aster API error: ${error.response?.data?.msg || error.message}` ); } throw error; } };