UNPKG

systemprompt-mcp-gmail

Version:

A specialized Model Context Protocol (MCP) server that enables you to search, read, delete and send emails from your Gmail account, leveraging an AI Agent to help with each operation.

69 lines 2.14 kB
import { google } from "googleapis"; import { GoogleBaseService } from "./google-base-service.js"; export class CalendarService extends GoogleBaseService { calendar; constructor() { super(); this.calendar = google.calendar({ version: "v3", auth: this.auth.getAuth(), }); } async listEvents(calendarId = "primary", maxResults = 10) { try { const response = await this.calendar.events.list({ calendarId, timeMin: new Date().toISOString(), maxResults, singleEvents: true, orderBy: "startTime", }); return response.data.items || []; } catch (error) { console.error("Failed to list calendar events:", error); throw error; } } async getEvent(eventId, calendarId = "primary") { try { const response = await this.calendar.events.get({ calendarId, eventId, }); return response.data; } catch (error) { console.error("Failed to get calendar event:", error); throw error; } } async listCalendars() { try { const response = await this.calendar.calendarList.list(); return response.data.items || []; } catch (error) { console.error("Failed to list calendars:", error); throw error; } } async searchEvents(query, calendarId = "primary", maxResults = 10) { try { const response = await this.calendar.events.list({ calendarId, timeMin: new Date().toISOString(), maxResults, singleEvents: true, orderBy: "startTime", q: query, }); return response.data.items || []; } catch (error) { console.error("Failed to search calendar events:", error); throw error; } } } //# sourceMappingURL=calendar-service.js.map