import { z } from "zod";
import { api } from "../services/api.js";
const getMarketBySlugSchema = z.object({
slug: z
.string()
.describe("The market slug identifier (e.g., 'will-trump-win-2024')"),
});
export const getMarketBySlugTool = {
name: "get_market_by_slug",
description:
"Get detailed market info by slug. Source: slug from search_markets or list_markets. Returns market with clobTokenIds for CLOB tools. Example: slug=will-biden-win-2024.",
parameters: getMarketBySlugSchema,
execute: async (args: z.infer<typeof getMarketBySlugSchema>) => {
try {
const data = await api.getMarketBySlug(args.slug);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({
error: error instanceof Error ? error.message : String(error),
});
}
},
};