create_event
Schedule new Google Calendar events by specifying summary, start and end times, location, description, and attendee emails via the MCP server.
Instructions
새로운 일정 생성 (attendees: 이메일 리스트)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attendees | No | ||
| description | No | ||
| end | Yes | ||
| location | No | ||
| start | Yes | ||
| summary | Yes |
Implementation Reference
- google_calendar_mcp/server.py:54-69 (handler)The main handler function for the 'create_event' tool. It is decorated with @mcp.tool() which registers it, constructs an event body from parameters, and inserts it into the primary Google Calendar using the authenticated service.@mcp.tool() def create_event(summary: str, start: str, end: str, description: str = None, location: str = None, attendees: Optional[List[str]] = None) -> dict[str, Any]: """새로운 일정 생성 (attendees: 이메일 리스트)""" service = get_calendar_service() event_body = { "summary": summary, "description": description, "start": {"dateTime": start}, "end": {"dateTime": end}, } if location: event_body["location"] = location if attendees: event_body["attendees"] = [{"email": email} for email in attendees] event = service.events().insert(calendarId='primary', body=event_body).execute() return {"message": "일정이 등록되었습니다.", "event": event}
- Helper function that provides the authenticated Google Calendar API service, handling OAuth token management and refresh. Used by the create_event 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
- google_calendar_mcp/server.py:54-54 (registration)The @mcp.tool() decorator registers the create_event function as an MCP tool.@mcp.tool()