import { z } from 'zod';
import { createSuccessResponse } from '../utils/helpers.js';
import { CurrencySchema } from '../schemas/index.js';
export function createAccountTools(exchange, mode) {
return {
get_balance: {
description: 'Get account balance. Returns free, used, and total balance for all currencies or a specific one.',
inputSchema: z.object({
currency: CurrencySchema.optional()
}),
handler: async (input) => {
const balance = await exchange.getBalance(input.currency);
return createSuccessResponse(balance, mode);
}
},
get_positions: {
description: 'Get open positions with P&L (futures/perpetual only)',
inputSchema: z.object({}),
handler: async () => {
const positions = await exchange.getPositions();
return createSuccessResponse(
{ positions, count: positions.length },
mode
);
}
}
};
}