get_all_events
Retrieve all calendar events from the MCP Calendar Server to view and manage your schedule. This tool fetches every event across all categories for comprehensive oversight.
Instructions
모든 캘린더 이벤트를 조회합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:28-39 (handler)The MCP tool handler function for 'get_all_events', decorated with @mcp.tool() which also serves as registration. It fetches all events for the default user via CalendarService and converts them to response objects.@mcp.tool() def get_all_events() -> List[CalendarEventResponse]: """ 모든 캘린더 이벤트를 조회합니다. """ try: result = calendar_service.fetch_events(DEFAULT_USER_ID) if result.success and result.data: return [calendar_service.to_response(event) for event in result.data] return [] except Exception as e: raise Exception(f"이벤트 조회 중 오류가 발생했습니다: {str(e)}")
- src/models/__init__.py:79-96 (schema)Pydantic model defining the schema for individual CalendarEventResponse objects returned by get_all_events (as a list). Includes serialization for datetime fields.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):
- Core helper method in CalendarService that retrieves all events for a given user_id from the in-memory database, used by the tool handler.def fetch_events(self, user_id: int) -> McpResult: """사용자의 모든 이벤트 조회""" try: user_events = [ event for event in self.events_db.values() if event.user_id == user_id ] return McpResult(success=True, data=user_events) except Exception as e: return McpResult(success=False, error=str(e))
- Helper method to convert internal CalendarEvent entities to the public CalendarEventResponse schema used by the tool.def to_response(self, event: CalendarEvent) -> CalendarEventResponse: """Entity를 Response로 변환""" return CalendarEventResponse( id=event.id, title=event.title, description=event.description, location=event.location, start_time=event.start_time, duration=event.duration, category=event.category, stamina_cost=event.stamina_cost, status=event.status, stamina_after_completion=event.stamina_after_completion, created_at=event.created_at )
- src/models/__init__.py:10-15 (schema)Enum schema for event categories, used in CalendarEventResponse.class EventCategory(str, Enum): """이벤트 카테고리""" STUDY = "STUDY" # 학습 WORK = "WORK" # 업무 REST = "REST" # 휴식 ACTIVITY = "ACTIVITY" # 활동