complete_event
Mark calendar events as completed and update stamina levels after finishing tasks to track progress and manage energy 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 for 'complete_event' decorated with @mcp.tool(). Handles parameters, calls 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 the event completion logic: updates status to COMPLETED and sets stamina_after_completion.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))
- http_server.py:172-184 (handler)Secondary HTTP wrapper handler for 'complete_event' in 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")