import { z } from "zod";
import { gammaFetch } from "../services/gamma.js";
const schema = z.object({
limit: z.number().optional().default(20).describe("Number of events to return (default: 20)"),
offset: z.number().optional().default(0).describe("Pagination offset (default: 0)"),
order: z.string().optional().describe("Sort field"),
ascending: z.boolean().optional().describe("Sort ascending"),
active: z.boolean().optional().describe("Filter by active status"),
closed: z.boolean().optional().describe("Filter by closed status"),
tag: z.string().optional().describe("Filter by tag"),
});
export const listEventsTool = {
name: "list_events",
description: "List events with filters and pagination. Use event id for list_comments/get_event_by_id/get_live_volume. Example: active=true, limit=20.",
parameters: schema,
execute: async (args: z.infer<typeof schema>) => {
try {
const data = await gammaFetch("/events", args as Record<string, string | number | boolean>);
return JSON.stringify(data, null, 2);
} catch (error) {
return JSON.stringify({ error: error instanceof Error ? error.message : String(error) });
}
},
};