import { z } from "zod";
import { api } from "../services/api.js";
const getEventBySlugSchema = z.object({
slug: z.string().describe("The event slug identifier"),
});
export const getEventBySlugTool = {
name: "get_event_by_slug",
description:
"Get event details by slug. Source: slug from search_markets or list_events. Returns event and associated markets. Example: slug=presidential-election-2024.",
parameters: getEventBySlugSchema,
execute: async (args: z.infer<typeof getEventBySlugSchema>) => {
try {
const data = await api.getEventBySlug(args.slug);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({
error: error instanceof Error ? error.message : String(error),
});
}
},
};