Skip to main content
Glama
highthon-16

MCP Calendar Server

by highthon-16

get_events_by_category

Retrieve calendar events filtered by specific categories like STUDY, WORK, REST, or ACTIVITY to organize and view related schedules efficiently.

Instructions

카테고리별로 이벤트를 조회합니다.

Args:
    category: 카테고리 (STUDY, WORK, REST, ACTIVITY)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes

Implementation Reference

  • The primary MCP tool handler for get_events_by_category. Decorated with @mcp.tool() for automatic registration. Fetches all events, filters by category, and maps to response models.
    @mcp.tool()
    def get_events_by_category(category: str) -> List[CalendarEventResponse]:
        """
        카테고리별로 이벤트를 조회합니다.
        
        Args:
            category: 카테고리 (STUDY, WORK, REST, ACTIVITY)
        """
        try:
            if category not in [cat.value for cat in EventCategory]:
                raise InvalidEventData("category", category)
            
            result = calendar_service.fetch_events(DEFAULT_USER_ID)
            if result.success and result.data:
                filtered_events = [
                    event for event in result.data 
                    if event.category == category
                ]
                return [calendar_service.to_response(event) for event in filtered_events]
            return []
            
        except CalendarException:
            raise
        except Exception as e:
            raise Exception(f"카테고리별 이벤트 조회 중 오류가 발생했습니다: {str(e)}")
  • Pydantic model defining the output schema for individual events returned by the tool (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()
    class ApiResponse(BaseModel):
  • Enum defining valid category values used for input validation in the tool handler.
    class EventCategory(str, Enum):
        """이벤트 카테고리"""
        STUDY = "STUDY"      # 학습
        WORK = "WORK"        # 업무
        REST = "REST"        # 휴식
        ACTIVITY = "ACTIVITY" # 활동
  • src/main.py:279-280 (registration)
    MCP server startup which registers and runs all @mcp.tool() decorated functions.
    if __name__ == "__main__":
        mcp.run()

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