Skip to main content
Glama
peadams21

Google Calendar MCP Server

by peadams21

create_event

Add new events to Google Calendar by specifying title, time, location, attendees, and recurrence rules.

Instructions

Create a new event in Google Calendar

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarIdNoCalendar ID (default: 'primary')primary
summaryYesEvent title/summary
descriptionNoEvent description
startYes
endYes
locationNoEvent location
attendeesNoList of attendees
recurrenceNoRecurrence rules (RRULE format)

Implementation Reference

  • The main handler function for the 'create_event' tool. It constructs an event object from the validated arguments and uses the Google Calendar API to insert the new event, returning success or error response.
    async function handleCreateEvent(args: z.infer<typeof CreateEventArgsSchema>) {
      try {
        const event = {
          summary: args.summary,
          description: args.description,
          start: args.start,
          end: args.end,
          location: args.location,
          attendees: args.attendees,
          recurrence: args.recurrence,
        };
    
        const response = await calendar.events.insert({
          calendarId: args.calendarId,
          requestBody: event,
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: true,
                event: response.data,
                message: `Event "${args.summary}" created successfully`,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: error instanceof Error ? error.message : "Unknown error",
              }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the 'create_event' tool, used for validation before calling the handler.
    const CreateEventArgsSchema = z.object({
      calendarId: z.string().optional().default("primary"),
      summary: z.string(),
      description: z.string().optional(),
      start: z.object({
        dateTime: z.string(),
        timeZone: z.string().optional(),
      }),
      end: z.object({
        dateTime: z.string(),
        timeZone: z.string().optional(),
      }),
      location: z.string().optional(),
      attendees: z.array(z.object({
        email: z.string(),
        displayName: z.string().optional(),
      })).optional(),
      recurrence: z.array(z.string()).optional(),
    });
  • src/index.ts:152-222 (registration)
    Tool registration in the tools array, defining the name, description, and input schema for 'create_event' returned by ListToolsRequestHandler.
      name: "create_event",
      description: "Create a new event in Google Calendar",
      inputSchema: {
        type: "object",
        properties: {
          calendarId: {
            type: "string",
            description: "Calendar ID (default: 'primary')",
            default: "primary",
          },
          summary: {
            type: "string",
            description: "Event title/summary",
          },
          description: {
            type: "string",
            description: "Event description",
          },
          start: {
            type: "object",
            properties: {
              dateTime: {
                type: "string",
                description: "Start date and time (RFC3339 timestamp)",
              },
              timeZone: {
                type: "string",
                description: "Time zone (e.g., 'America/New_York')",
              },
            },
            required: ["dateTime"],
          },
          end: {
            type: "object",
            properties: {
              dateTime: {
                type: "string",
                description: "End date and time (RFC3339 timestamp)",
              },
              timeZone: {
                type: "string",
                description: "Time zone (e.g., 'America/New_York')",
              },
            },
            required: ["dateTime"],
          },
          location: {
            type: "string",
            description: "Event location",
          },
          attendees: {
            type: "array",
            items: {
              type: "object",
              properties: {
                email: { type: "string" },
                displayName: { type: "string" },
              },
              required: ["email"],
            },
            description: "List of attendees",
          },
          recurrence: {
            type: "array",
            items: { type: "string" },
            description: "Recurrence rules (RRULE format)",
          },
        },
        required: ["summary", "start", "end"],
      },
    },
  • src/index.ts:551-554 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that validates arguments using the schema and calls the handleCreateEvent function.
    case "create_event": {
      const validatedArgs = CreateEventArgsSchema.parse(args);
      return await handleCreateEvent(validatedArgs);
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/peadams21/Google-Calendar-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server