complete_event
Mark events as completed and update stamina levels using the MCP Calendar Server. Input the event ID and desired stamina value to finalize events and manage resources.
Instructions
이벤트를 완료 상태로 변경하고 완료 후 스태미나를 설정합니다.
Args:
event_id: 완료할 이벤트 ID
stamina_after: 완료 후 스태미나 수치
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes | ||
| stamina_after | Yes |
Implementation Reference
- src/main.py:201-221 (handler)Primary MCP tool handler decorated with @mcp.tool(). Handles input parameters event_id and stamina_after, delegates to calendar_service.complete_event, and returns formatted response.@mcp.tool() def complete_event(event_id: int, stamina_after: int) -> CalendarEventResponse: """ 이벤트를 완료 상태로 변경하고 완료 후 스태미나를 설정합니다. Args: event_id: 완료할 이벤트 ID stamina_after: 완료 후 스태미나 수치 """ try: result = calendar_service.complete_event(event_id, DEFAULT_USER_ID, stamina_after) 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)}")
- Core service method implementing event completion logic: validates ownership, updates event status to COMPLETED and stamina_after_completion field.def complete_event(self, event_id: int, user_id: int, stamina_after: int) -> McpResult: """이벤트 완료 처리""" try: if event_id not in self.events_db: raise EventNotFound(event_id) event = self.events_db[event_id] if event.user_id != user_id: raise UnauthorizedAccess(user_id, event_id) event.status = EventStatus.COMPLETED event.stamina_after_completion = stamina_after return McpResult(success=True, data=event) except CalendarException: raise except Exception as e: return McpResult(success=False, error=str(e))
- src/models/__init__.py:79-96 (schema)Pydantic model defining the output schema for the complete_event tool response, including the new stamina_after_completion field.class CalendarEventResponse(BaseModel): """캘린더 이벤트 응답""" id: int title: str description: Optional[str] = None location: Optional[str] = None start_time: datetime duration: int category: EventCategory stamina_cost: int status: EventStatus stamina_after_completion: Optional[int] = None created_at: datetime @field_serializer('start_time', 'created_at') def serialize_datetime(self, value: datetime) -> str: return value.isoformat() class ApiResponse(BaseModel):
- http_server.py:172-184 (registration)Dispatch/registration block in HTTP server wrapper for handling 'complete_event' tool calls via FastAPI /mcp endpoint.elif function_name == "complete_event": event_id = args.get("event_id") stamina_after = args.get("stamina_after") if not event_id: raise ValueError("event_id is required") if stamina_after is None: raise ValueError("stamina_after is required") result = calendar_service.complete_event(event_id, DEFAULT_USER_ID, stamina_after) if result.success and result.data: return calendar_service.to_response(result.data).dict() raise ValueError(result.error or "Failed to complete event")