Skip to main content
Glama

calendar-delete-event

Remove calendar events by specifying the event ID and calendar ID to manage schedules and clean up outdated appointments.

Instructions

Delete a calendar event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventIdYesEvent ID
calendarIdNoCalendar ID - Available options: 'primary' (Primary Calendar)primary

Implementation Reference

  • The handler function that performs the actual deletion of a calendar event using the Google Calendar API. It takes eventId and optional calendarId, deletes the event, and returns a success or error message.
    export async function deleteEvent(
      params: z.infer<ReturnType<typeof deleteEventSchema>>
    ) {
      try {
        const auth = createCalendarAuth();
        const calendar = google.calendar({ version: "v3", auth });
    
        await calendar.events.delete({
          calendarId: params.calendarId,
          eventId: params.eventId,
          sendUpdates: "all",
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: `# Event Deleted Successfully ✅\n\nEvent \`${params.eventId}\` has been deleted from your calendar.`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error deleting event: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the delete event tool: eventId (required) and calendarId (optional, defaults to 'primary').
    export const deleteEventSchema = () =>
      z.object({
        eventId: z.string().describe("Event ID"),
        calendarId: z
          .string()
          .default("primary")
          .describe(getCalendarDescription()),
      });
  • src/index.ts:251-258 (registration)
    Registration of the 'calendar-delete-event' tool on the MCP server, linking the name, description, schema, and handler function.
    server.tool(
      "calendar-delete-event",
      "Delete a calendar event",
      deleteEventSchema().shape,
      async (params) => {
        return await deleteEvent(params);
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CaptainCrouton89/maps-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server