systemprompt-mcp-notion
Version:
A specialized Model Context Protocol (MCP) server that integrates Notion into your AI workflows. This server enables seamless access to Notion through MCP, allowing AI agents to interact with pages, databases, and comments.
69 lines (68 loc) • 2.1 kB
JavaScript
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;
}
}
}