import { z } from "zod";
import { fetchMarketById } from "../services/gamma.js";
const schema = z.object({
id: z.string().describe("The numeric market ID"),
});
export const getMarketByIdTool = {
name: "get_market_by_id",
description: "Get market details by numeric id. Source: id from list_markets. Returns clobTokenIds and conditionId. Example: id=680392.",
parameters: schema,
execute: async (args: z.infer<typeof schema>) => {
try {
const data = await fetchMarketById(args.id);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
}
},
};