get_all_events
Retrieve all calendar events stored in the MCP Calendar Server, enabling users to view and manage their schedules efficiently.
Instructions
모든 캘린더 이벤트를 조회합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:28-39 (handler)The primary handler function for the 'get_all_events' MCP tool, decorated with @mcp.tool() which also handles registration. It fetches all events using CalendarService and converts them to response format.@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-95 (schema)Pydantic model defining the output schema for individual calendar events returned by get_all_events (as List[CalendarEventResponse]).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()
- src/main.py:28-39 (registration)The @mcp.tool() decorator registers the get_all_events function as an MCP tool.@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)}")
- Helper method in CalendarService used by the handler to convert internal CalendarEvent to CalendarEventResponse format. Note: fetch_events is the main helper called but its full impl not excerpted here.def to_response(self, event: CalendarEvent) -> CalendarEventResponse: