Skip to main content
Glama

Google Calendar MCP Server

by bezael
deleteEvent.ts1.9 kB
/** * Tool para eliminar eventos de Google Calendar */ import { getCalendarClient, resolveCalendarId } from '../gcalClient.js'; import { validateRequired, parseGoogleError, createNotFoundError } from '../utils/errors.js'; import { logger } from '../utils/logger.js'; import type { DeleteEventParams, DeleteResponse } from '../types/index.js'; /** * Elimina un evento del calendario * * @param params - Parámetros con eventId y calendarId opcional * @returns Objeto con success: true si se eliminó correctamente */ export async function deleteEvent(params: DeleteEventParams): Promise<DeleteResponse> { logger.toolRequest('delete_event', params as unknown as Record<string, unknown>); // Validar campo requerido validateRequired(params.eventId, 'eventId'); const calendarId = resolveCalendarId(params.calendarId); try { const calendar = await getCalendarClient(); // Primero verificar que el evento existe try { await calendar.events.get({ calendarId, eventId: params.eventId, }); } catch (getError) { const err = getError as { response?: { status?: number } }; if (err.response?.status === 404) { throw createNotFoundError( `El evento con id '${params.eventId}' no existe en el calendario`, { eventId: params.eventId, calendarId } ); } throw getError; } // Eliminar el evento await calendar.events.delete({ calendarId, eventId: params.eventId, sendUpdates: 'all', }); const result: DeleteResponse = { success: true, message: `Evento '${params.eventId}' eliminado correctamente`, }; logger.toolResponse('delete_event', { eventId: params.eventId, success: true }); return result; } catch (error) { throw parseGoogleError(error); } }

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/bezael/mcp-calendar'

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