Skip to main content
Glama

get_event_by_id

Retrieve specific calendar events by their unique ID to view details, manage schedules, or integrate with other systems.

Instructions

ID로 특정 캘린더 이벤트를 조회합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYes

Implementation Reference

  • The MCP tool handler for 'get_event_by_id', decorated with @mcp.tool(). It calls the calendar service, handles errors, and returns a CalendarEventResponse.
    @mcp.tool() def get_event_by_id(event_id: int) -> CalendarEventResponse: """ ID로 특정 캘린더 이벤트를 조회합니다. """ try: result = calendar_service.get_event_by_id(event_id, DEFAULT_USER_ID) if result.success and result.data: return calendar_service.to_response(result.data) raise EventNotFound(event_id) except CalendarException: raise except Exception as e: raise Exception(f"이벤트 조회 중 오류가 발생했습니다: {str(e)}")
  • Pydantic BaseModel defining the output schema (CalendarEventResponse) used by the get_event_by_id 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):
  • Supporting service method that implements the core logic: fetches event from in-memory DB, authorizes user, and returns McpResult.
    def get_event_by_id(self, event_id: int, user_id: int) -> McpResult: """ID로 특정 이벤트 조회""" 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) return McpResult(success=True, data=event) except CalendarException: raise except Exception as e: return McpResult(success=False, error=str(e))
  • src/main.py:42-55 (registration)
    The @mcp.tool() decorator registers the get_event_by_id function as an MCP tool.
    @mcp.tool() def get_event_by_id(event_id: int) -> CalendarEventResponse: """ ID로 특정 캘린더 이벤트를 조회합니다. """ try: result = calendar_service.get_event_by_id(event_id, DEFAULT_USER_ID) if result.success and result.data: return calendar_service.to_response(result.data) raise EventNotFound(event_id) 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