Skip to main content
Glama

get_events_by_date

Retrieve calendar events for a specific date using the MCP Calendar Server. Provide a date in YYYY-MM-DD format to view scheduled events.

Instructions

특정 날짜의 이벤트를 조회합니다. Args: date: 날짜 (YYYY-MM-DD 형식)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes

Implementation Reference

  • The MCP tool handler: @mcp.tool()-decorated function that parses the date input, fetches all events using the service, filters by date, converts to responses, and handles errors.
    @mcp.tool() def get_events_by_date(date: str) -> List[CalendarEventResponse]: """ 특정 날짜의 이벤트를 조회합니다. Args: date: 날짜 (YYYY-MM-DD 형식) """ try: try: target_date = datetime.fromisoformat(date).date() except ValueError: raise InvalidEventData("date", date) result = calendar_service.fetch_events(DEFAULT_USER_ID) if result.success and result.data: filtered_events = [ event for event in result.data if event.start_time.date() == target_date ] 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 structure of CalendarEventResponse used by the get_events_by_date tool.
    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):
  • Helper service method called by the tool to retrieve all events for the default user, which are then filtered by date.
    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 service method that converts internal CalendarEvent objects to the output CalendarEventResponse format.
    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/main.py:250-277 (registration)
    The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool() def get_events_by_date(date: str) -> List[CalendarEventResponse]: """ 특정 날짜의 이벤트를 조회합니다. Args: date: 날짜 (YYYY-MM-DD 형식) """ try: try: target_date = datetime.fromisoformat(date).date() except ValueError: raise InvalidEventData("date", date) result = calendar_service.fetch_events(DEFAULT_USER_ID) if result.success and result.data: filtered_events = [ event for event in result.data if event.start_time.date() == target_date ] return [calendar_service.to_response(event) for event in filtered_events] return [] except CalendarException: raise except Exception as e: raise Exception(f"날짜별 이벤트 조회 중 오류가 발생했습니다: {str(e)}")

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