import { z } from "zod";
import { getOpenInterest } from "../services/data-api.js";
const schema = z.object({
market: z.string().describe("Market condition ID (0x...)"),
});
export const getOpenInterestTool = {
name: "get_open_interest",
description: "Get open interest for a market. Source: market conditionId from list_markets. Example: market=0x...",
parameters: schema,
execute: async (args: z.infer<typeof schema>) => {
try {
const data = await getOpenInterest(args);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
}
},
};