Skip to main content
Glama
highthon-16

MCP Calendar Server

by highthon-16

update_calendar_event

Modify existing calendar events by updating details like title, time, category, and status to keep schedules accurate and organized.

Instructions

기존 캘린더 이벤트를 수정합니다.

Args:
    event_id: 수정할 이벤트 ID
    title: 이벤트 제목
    start_time: 시작 시간 (ISO 형식: 2025-08-02T10:00:00)
    duration: 지속 시간(분)
    category: 카테고리 (STUDY, WORK, REST, ACTIVITY)
    description: 이벤트 설명 (선택)
    location: 장소 (선택)
    stamina_cost: 스태미나 소모량 (기본값: 0)
    status: 이벤트 상태 (PLANNED, COMPLETED, CANCELED) (선택)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYes
titleYes
start_timeYes
durationYes
categoryYes
descriptionNo
locationNo
stamina_costNo
statusNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
titleYes
statusYes
categoryYes
durationYes
locationNo
created_atYes
start_timeYes
descriptionNo
stamina_costYes
stamina_after_completionNo

Implementation Reference

  • The primary handler function for the 'update_calendar_event' MCP tool. It performs input validation, parses datetime and enums, constructs CalendarEventRequest, delegates to CalendarService.update_event, and returns a CalendarEventResponse or raises exceptions.
    @mcp.tool()
    def update_calendar_event(
        event_id: int,
        title: str,
        start_time: str,
        duration: int,
        category: str,
        description: Optional[str] = None,
        location: Optional[str] = None,
        stamina_cost: int = 0,
        status: Optional[str] = None
    ) -> CalendarEventResponse:
        """
        기존 캘린더 이벤트를 수정합니다.
        
        Args:
            event_id: 수정할 이벤트 ID
            title: 이벤트 제목
            start_time: 시작 시간 (ISO 형식: 2025-08-02T10:00:00)
            duration: 지속 시간(분)
            category: 카테고리 (STUDY, WORK, REST, ACTIVITY)
            description: 이벤트 설명 (선택)
            location: 장소 (선택)
            stamina_cost: 스태미나 소모량 (기본값: 0)
            status: 이벤트 상태 (PLANNED, COMPLETED, CANCELED) (선택)
        """
        try:
            # 카테고리 유효성 검사
            if category not in [cat.value for cat in EventCategory]:
                raise InvalidEventData("category", category)
            
            # 상태 유효성 검사
            event_status = None
            if status and status not in [stat.value for stat in EventStatus]:
                raise InvalidEventData("status", status)
            elif status:
                event_status = EventStatus(status)
            
            # 시간 파싱
            try:
                parsed_start_time = datetime.fromisoformat(start_time.replace('Z', '+00:00'))
            except ValueError:
                raise InvalidEventData("start_time", start_time)
            
            request = CalendarEventRequest(
                title=title,
                description=description,
                location=location,
                start_time=parsed_start_time,
                duration=duration,
                category=EventCategory(category),
                stamina_cost=stamina_cost,
                status=event_status
            )
            
            result = calendar_service.update_event(event_id, request, DEFAULT_USER_ID)
            if result.success and result.data:
                return calendar_service.to_response(result.data)
            
            raise Exception(result.error or "이벤트 수정에 실패했습니다")
            
        except CalendarException:
            raise
        except Exception as e:
            raise Exception(f"이벤트 수정 중 오류가 발생했습니다: {str(e)}")
  • Pydantic BaseModel used as the input schema for event updates. Defines fields with validation (e.g., duration > 0, datetime parsing) and is instantiated in the handler.
    class CalendarEventRequest(BaseModel):
        """캘린더 이벤트 생성/수정 요청"""
        title: str
        description: Optional[str] = None
        location: Optional[str] = None
        start_time: datetime
        duration: int = Field(gt=0, description="지속 시간(분)")
        category: EventCategory
        stamina_cost: int = Field(ge=0, default=0, description="스태미나 소모량")
        created_at: Optional[datetime] = None
        status: Optional[EventStatus] = None
    
        @field_validator('start_time', 'created_at')
        @classmethod
        def validate_datetime(cls, v):
            if v is None:
                return v
            if isinstance(v, str):
                return datetime.fromisoformat(v.replace('Z', '+00:00'))
            return v
  • Enum defining valid event categories (STUDY, WORK, REST, ACTIVITY), validated in the handler and service.
    class EventCategory(str, Enum):
        """이벤트 카테고리"""
        STUDY = "STUDY"      # 학습
        WORK = "WORK"        # 업무
        REST = "REST"        # 휴식
        ACTIVITY = "ACTIVITY" # 활동
  • Enum defining event statuses, optionally validated and set in updates.
    class EventStatus(str, Enum):
        """이벤트 상태"""
        PLANNED = "PLANNED"     # 계획됨
        COMPLETED = "COMPLETED" # 완료됨
        CANCELED = "CANCELED"   # 취소됨
  • Supporting method in CalendarService that executes the core business logic: authorization check, time conflict detection, entity update in in-memory DB, and result wrapping.
    def update_event(self, event_id: int, request: CalendarEventRequest, 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)
            
            # 시간 충돌 검사 (자기 자신 제외)
            if self._has_time_conflict(request.start_time, request.duration, user_id, exclude_id=event_id):
                return McpResult(
                    success=False, 
                    error="해당 시간에 이미 다른 일정이 있습니다"
                )
            
            updated_event = CalendarEvent(
                id=event_id,
                user_id=user_id,
                title=request.title,
                description=request.description,
                location=request.location,
                start_time=request.start_time,
                duration=request.duration,
                category=request.category,
                stamina_cost=request.stamina_cost,
                status=request.status or existing_event.status,
                stamina_after_completion=existing_event.stamina_after_completion,
                created_at=existing_event.created_at
            )
            
            self.events_db[event_id] = updated_event
            return McpResult(success=True, data=updated_event)
            
        except CalendarException:
            raise
        except Exception as e:
            return McpResult(success=False, error=str(e))
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While '수정합니다' (modify) implies a mutation operation, the description doesn't disclose important behavioral traits: whether this requires specific permissions, what happens when updating only some fields (partial updates), whether changes are reversible, error conditions, or how it interacts with other tools. The description provides basic parameter information but lacks behavioral context needed for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured with a clear purpose statement followed by organized parameter documentation. Each parameter explanation is concise and adds value. While slightly longer than minimal, every sentence serves a purpose given the 9 parameters with no schema descriptions. The structure helps the agent understand parameter roles efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (9 parameters, mutation operation) with no annotations but with an output schema, the description is moderately complete. It covers parameter semantics well but lacks behavioral context needed for a mutation tool. The presence of an output schema means the description doesn't need to explain return values, but it should address mutation-specific concerns like permissions, partial updates, and error handling that aren't covered elsewhere.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by providing semantic context for all 9 parameters. It explains event_id identifies what to modify, clarifies ISO format for start_time, specifies duration in minutes, enumerates category options, identifies optional parameters, provides default values, and explains stamina_cost units. This adds substantial meaning beyond what the bare schema provides, though it doesn't cover all edge cases or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '기존 캘린더 이벤트를 수정합니다' (modify existing calendar events), which is a specific verb+resource combination. It distinguishes itself from siblings like create_calendar_event and delete_calendar_event by focusing on modification rather than creation or deletion. However, it doesn't explicitly differentiate from complete_event which might also modify event status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose update_calendar_event over complete_event for status changes, or when to use it versus creating a new event. There's also no information about prerequisites, permissions, or constraints beyond what's implied by the parameter list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/highthon-16/MCP'

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