Skip to main content
Glama

delete_calendar_event

Remove Google Calendar events directly from your Obsidian workflow to maintain organized schedules and prevent outdated appointments.

Instructions

Delete a Google Calendar event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmNo
event_idYes
update_noteNo

Implementation Reference

  • MCP tool handler that deletes the specified Google Calendar event by ID, optionally cleans up linked Obsidian note frontmatter, and requires confirmation.
        name="delete_calendar_event",
        description="Delete a Google Calendar event",
    )
    async def delete_calendar_event(
        event_id: str, update_note: bool = True, confirm: bool = False
    ) -> str:
        """
        Delete a calendar event.
    
        Args:
            event_id: Calendar event ID
            update_note: If true, remove event info from linked note (default: true)
            confirm: Must be set to true to confirm event deletion
    
        Returns:
            Success message
        """
        if not confirm:
            return (
                "Error: Calendar event deletion requires explicit confirmation. "
                "Please set confirm=true to proceed with deleting this event."
            )
        if not event_id or not event_id.strip():
            return "Error: Event ID cannot be empty"
    
        context = _get_context()
    
        try:
            # Get event details before deleting (for note update)
            calendar = context.get_calendar()
    
            if update_note:
                try:
                    event = calendar.get_event(event_id)
                    description = event.get("description", "")
    
                    # Extract note path from obsidian:// link
                    if "obsidian://" in description:
                        # Find the note path in the link
                        start_idx = description.find(context.config.obsidian_url_base)
                        if start_idx != -1:
                            note_path = description[start_idx + len(context.config.obsidian_url_base) :]
                            # Extract until next whitespace or newline
                            note_path = note_path.split()[0] if note_path else ""
    
                            if note_path and context.vault.note_exists(note_path):
                                # Remove calendar event info from frontmatter
                                note = await context.vault.read_note(note_path)
                                if note.frontmatter:
                                    frontmatter = dict(note.frontmatter)
                                    frontmatter.pop("calendar_event_id", None)
                                    frontmatter.pop("calendar_event_link", None)
                                    frontmatter.pop("calendar_event_date", None)
                                    frontmatter.pop("calendar_event_time", None)
                                    await context.vault.update_note(note_path, note.body, frontmatter)
                except Exception as e:
                    logger.warning(f"Failed to update note: {e}")
    
            # Delete the event
            calendar.delete_event(event_id)
    
            return f"✓ Deleted calendar event: {event_id}"
    
        except CalendarAuthError as e:
            return f"Error: Calendar not configured: {e}"
        except CalendarError as e:
            return f"Error deleting event: {e}"
        except Exception as e:
            logger.exception("Error deleting calendar event")
            return f"Error deleting calendar event: {e}"
  • Core CalendarService method that calls Google Calendar API to delete the event by ID.
    def delete_event(self, event_id: str) -> None:
        """
        Delete a calendar event.
    
        Args:
            event_id: Event ID to delete
    
        Raises:
            CalendarError: If deletion fails
        """
        service = self.get_service()
    
        try:
            service.events().delete(calendarId=self.calendar_id, eventId=event_id).execute()
            logger.info(f"Deleted calendar event: {event_id}")
        except HttpError as e:
            raise CalendarError(f"Failed to delete event: {e}") from e

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/getglad/obsidian_mcp'

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