update_event
Modify calendar event details such as summary, start time, end time, location, description, or attendees using the event ID.
Instructions
Update an existing calendar event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attendees | No | ||
| description | No | ||
| end | No | ||
| event_id | Yes | ||
| location | No | ||
| start | No | ||
| summary | No |
Implementation Reference
- server.py:514-517 (registration)Registers the 'update_event' tool using the @mcp.tool decorator with name and description.@mcp.tool( name="update_event", description="Update an existing calendar event", )
- server.py:518-569 (handler)The handler function that implements the update_event tool logic: authenticates with Google, fetches the existing event, applies provided updates (summary, start, end, etc.), and updates the event via the Google Calendar API.async def update_event(event_id: str, summary: Optional[str] = None, start: Optional[str] = None, end: Optional[str] = None, location: Optional[str] = None, description: Optional[str] = None, attendees: Optional[List[EmailStr]] = None) -> str: """ Update an existing calendar event Args: event_id (str): Event ID to update summary (str, optional): New event title start (str, optional): New start datetime in ISO format end (str, optional): New end datetime in ISO format location (str, optional): New event location description (str, optional): New event description attendees (array, optional): New list of attendee email addresses Returns: str: Success message """ creds = get_google_credentials() if not creds: return "Google authentication failed." try: service = build('calendar', 'v3', credentials=creds) event_tz = 'Asia/Seoul' # 기존 이벤트 정보 가져오기 event = service.events().get(calendarId='primary', eventId=event_id).execute() # 입력 파라미터 기반으로 업데이트할 필드 구성 update_payload = {} if summary is not None: update_payload['summary'] = summary if location is not None: update_payload['location'] = location if description is not None: update_payload['description'] = description if start is not None: update_payload['start'] = {'dateTime': start, 'timeZone': event_tz} if end is not None: update_payload['end'] = {'dateTime': end, 'timeZone': event_tz} if attendees is not None: update_payload['attendees'] = [{'email': email} for email in attendees] # 가져온 이벤트 정보에 업데이트 내용 반영 후 API 호출 event.update(update_payload) updated_event = service.events().update(calendarId='primary', eventId=event_id, body=event).execute() logger.info(f"이벤트 업데이트됨: {updated_event.get('htmlLink')}") return f"이벤트 업데이트 성공. 이벤트 ID: {updated_event['id']}" except HttpError as error: logger.error(f"API 오류 발생: {error}") if error.resp.status == 404: return f"ID '{event_id}'의 이벤트를 찾을 수 없습니다." return f"Calendar API 오류: {error.resp.status} - {error.content.decode()}" except Exception as e: logger.exception("이벤트 업데이트 중 오류:") return f"예상치 못한 오류 발생: {str(e)}"