import { z } from "zod";
import { getPositionsValue } from "../services/data-api.js";
const schema = z.object({
user: z.string().describe("User Ethereum address (0x...)"),
});
export const getPositionsValueTool = {
name: "get_positions_value",
description: "Get total value of a user's positions (public data). Use user address. Example: user=0xabc....",
parameters: schema,
execute: async (args: z.infer<typeof schema>) => {
try {
const data = await getPositionsValue(args);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
}
},
};