cancel_calendar_event
Remove scheduled events from Google Calendar by providing the calendar ID and event ID to delete specific appointments or meetings.
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
| Name | Required | Description | Default |
|---|---|---|---|
| calendar_id | Yes | ||
| event_id | Yes |
Implementation Reference
- main.py:415-437 (handler)MCP tool handler function for canceling a calendar event. It invokes the GoogleCalendarTools helper and serializes the result to JSON.@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)
- main.py:260-312 (helper)Core helper function in GoogleCalendarTools that performs authentication and deletes the specified event from the Google Calendar API, handling various errors.@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 }