delete_calendar_event
Remove calendar events from MCP Calendar Server by specifying the event ID. This tool helps manage and organize schedules by deleting unnecessary or outdated events efficiently.
Instructions
캘린더 이벤트를 삭제합니다.
Args:
event_id: 삭제할 이벤트 ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes |
Implementation Reference
- src/main.py:180-198 (handler)Primary MCP tool handler implementation using @mcp.tool() decorator. Handles input validation via type hints and delegates to CalendarService.delete_event.@mcp.tool() def delete_calendar_event(event_id: int) -> str: """ 캘린더 이벤트를 삭제합니다. Args: event_id: 삭제할 이벤트 ID """ try: result = calendar_service.delete_event(event_id, DEFAULT_USER_ID) if result.success: return f"이벤트 ID {event_id}가 성공적으로 삭제되었습니다" raise Exception(result.error or "이벤트 삭제에 실패했습니다") except CalendarException: raise except Exception as e: raise Exception(f"이벤트 삭제 중 오류가 발생했습니다: {str(e)}")
- Core service method that implements the deletion logic: checks existence and ownership, then removes the event from the in-memory database.def delete_event(self, event_id: int, user_id: int) -> McpResult: """이벤트 삭제""" try: if event_id not in self.events_db: raise EventNotFound(event_id) existing_event = self.events_db[event_id] if existing_event.user_id != user_id: raise UnauthorizedAccess(user_id, event_id) del self.events_db[event_id] return McpResult(success=True, data=None) except CalendarException: raise except Exception as e: return McpResult(success=False, error=str(e))
- http_server.py:162-170 (handler)Secondary HTTP/FastAPI-based handler for the delete_calendar_event tool in the MCP dispatch logic.elif function_name == "delete_calendar_event": event_id = args.get("event_id") if not event_id: raise ValueError("event_id is required") result = calendar_service.delete_event(event_id, DEFAULT_USER_ID) if result.success: return f"Event {event_id} deleted successfully" raise ValueError(result.error or "Failed to delete event")