Skip to main content
Glama

cancel_calendar_event

Remove a scheduled event from Google Calendar by specifying the calendar and event identifiers to clear your schedule.

Instructions

Cancel (delete) a specific event from Google Calendar

Args: calendar_id: Calendar ID where the event exists event_id: The unique identifier of the event to cancel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendar_idYes
event_idYes

Implementation Reference

  • main.py:415-436 (handler)
    MCP tool registration and handler function for 'cancel_calendar_event'. This is the entry point called by the MCP server, which delegates to the GoogleCalendarTools helper.
    @mcp.tool()
    def cancel_calendar_event(calendar_id: str, event_id: str) -> str:
        """
        Cancel (delete) a specific event from Google Calendar
        
        Args:
            calendar_id: Calendar ID where the event exists
            event_id: The unique identifier of the event to cancel
        """
        try:
            result = GoogleCalendarTools.cancel_calendar_event(
                NANGO_CONNECTION_ID, NANGO_INTEGRATION_ID, calendar_id, event_id
            )
            
            return json.dumps(result, indent=2)
        except Exception as e:
            logger.error(f"Error in cancel_calendar_event: {e}")
            return json.dumps({
                "success": False,
                "error": str(e),
                "message": "Failed to cancel calendar event"
            }, indent=2)
  • Core helper method in GoogleCalendarTools class that performs the actual event deletion using Google Calendar API after authentication.
    @staticmethod
    def cancel_calendar_event(connection_id: str, provider_config_key: str, 
                             calendar_id: str, event_id: str) -> Dict:
        """Cancel (delete) a specific event from Google Calendar"""
        try:
            service = GoogleCalendarAuth.authenticate_google_calendar(connection_id, provider_config_key)
            
            service.events().delete(
                calendarId=calendar_id,
                eventId=event_id,
                sendUpdates='all'
            ).execute()
            
            return {
                "success": True,
                "message": f"Event {event_id} successfully cancelled",
                "event_id": event_id,
                "calendar_id": calendar_id
            }
            
        except HttpError as error:
            if hasattr(error, 'resp'):
                if error.resp.status == 404:
                    return {
                        "success": False,
                        "message": f"Event not found: {event_id}",
                        "error": "event_not_found",
                        "event_id": event_id
                    }
                elif error.resp.status == 403:
                    return {
                        "success": False,
                        "message": "Insufficient permissions to cancel this event",
                        "error": "permission_denied",
                        "event_id": event_id
                    }
            
            return {
                "success": False,
                "message": f"HTTP error occurred: {error}",
                "error": "http_error",
                "event_id": event_id
            }
        
        except Exception as error:
            logger.error(f'Unexpected error in cancel_calendar_event: {error}')
            return {
                "success": False,
                "message": f"Unexpected error occurred: {str(error)}",
                "error": "unexpected_error",
                "event_id": event_id
            }

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

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