list_day_events
Retrieve a detailed list of all events scheduled for a specific date (YYYY-MM-DD) on Google Calendar through the MCP protocol.
Instructions
지정한 날짜(YYYY-MM-DD)의 모든 일정 목록 조회
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes |
Implementation Reference
- google_calendar_mcp/server.py:29-45 (handler)The handler function for the 'list_day_events' tool, decorated with @mcp.tool(), which fetches events for a specific date from Google Calendar.@mcp.tool() def list_day_events(date: str) -> dict[str, Any]: """지정한 날짜(YYYY-MM-DD)의 모든 일정 목록 조회""" service = get_calendar_service() start_date = datetime.strptime(date, "%Y-%m-%d") end_date = start_date + timedelta(days=1) time_min = start_date.isoformat() + 'Z' time_max = end_date.isoformat() + 'Z' events_result = service.events().list( calendarId='primary', timeMin=time_min, timeMax=time_max, singleEvents=True, orderBy='startTime' ).execute() events = events_result.get('items', []) return {"count": len(events), "events": events}
- Supporting helper function that handles Google OAuth authentication and returns the Calendar API service instance, imported and used in the handler.def get_calendar_service(): creds = None if os.path.exists(TOKEN_FILE): with open(TOKEN_FILE, "rb") as token: creds = pickle.load(token) if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file(CLIENT_SECRET_FILE, SCOPES) creds = flow.run_local_server(port=0) with open(TOKEN_FILE, "wb") as token: pickle.dump(creds, token) service = build("calendar", "v3", credentials=creds) return service