import { z } from "zod";
import { GraphClient } from "../graph-client.js";
export const deleteEventSchema = z.object({
eventId: z.string().describe("The ID of the event to delete"),
calendarId: z.string().optional().describe("Calendar ID. If omitted, uses the default calendar."),
});
export const deleteEventTool = {
name: "delete-event",
description:
"Delete a calendar event. This permanently removes the event and sends cancellation notices to attendees if applicable.",
inputSchema: {
type: "object" as const,
properties: {
eventId: {
type: "string",
description: "The ID of the event to delete",
},
calendarId: {
type: "string",
description: "Calendar ID. If omitted, uses the default calendar.",
},
},
required: ["eventId"],
},
};
export async function handleDeleteEvent(
graph: GraphClient,
args: z.infer<typeof deleteEventSchema>
): Promise<string> {
const basePath = args.calendarId
? `/me/calendars/${args.calendarId}/events/${args.eventId}`
: `/me/events/${args.eventId}`;
await graph.delete(basePath);
return `Event ${args.eventId} has been deleted successfully.`;
}