Skip to main content
Glama

calendar-create-event

Create calendar events with details like title, time, location, and attendees using the MCP Server Boilerplate tool.

Instructions

Create a new calendar event. Current time: 1/3/2026, 9:03:13 AM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryYesEvent title/summary
descriptionNoEvent description
locationNoEvent location
startDateTimeYesStart date/time in ISO format (e.g., '2025-01-15T09:00:00-07:00')
endDateTimeYesEnd date/time in ISO format (e.g., '2025-01-15T10:00:00-07:00')
attendeesNoArray of attendee email addresses
calendarIdNoCalendar ID - Available options: 'primary' (Primary Calendar)primary
timeZoneNoTime zone - defaults to local time (UTC). Examples: 'America/New_York', 'Europe/London', 'Asia/Tokyo'

Implementation Reference

  • The primary handler function that executes the calendar event creation using Google Calendar API. It constructs the event object from parameters, inserts it into the specified calendar, formats the response as Markdown, and handles errors.
    export async function createEvent(
      params: z.infer<ReturnType<typeof createEventSchema>>
    ) {
      try {
        const auth = createCalendarAuth();
        const calendar = google.calendar({ version: "v3", auth });
    
        const event: any = {
          summary: params.summary,
          description: params.description,
          location: params.location,
          start: {
            dateTime: params.startDateTime,
            timeZone: params.timeZone,
          },
          end: {
            dateTime: params.endDateTime,
            timeZone: params.timeZone,
          },
        };
    
        if (params.attendees && params.attendees.length > 0) {
          event.attendees = params.attendees.map((email) => ({ email }));
        }
    
        const response = await calendar.events.insert({
          calendarId: params.calendarId,
          requestBody: event,
          sendUpdates: "all", // Send invitations to attendees
        });
    
        const eventData = {
          id: response.data.id,
          summary: response.data.summary,
          start: response.data.start,
          end: response.data.end,
          location: response.data.location,
          description: response.data.description,
          attendees: response.data.attendees,
          htmlLink: response.data.htmlLink,
        };
    
        return {
          content: [
            {
              type: "text" as const,
              text: `# Event Created Successfully ✅\n\n${formatEventToMarkdown(eventData)}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error creating event: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for creating a calendar event, including summary, dates, attendees, calendar ID, and time zone.
    export const createEventSchema = () =>
      z.object({
        summary: z.string().describe("Event title/summary"),
        description: z.string().optional().describe("Event description"),
        location: z.string().optional().describe("Event location"),
        startDateTime: z
          .string()
          .describe(
            "Start date/time in ISO format (e.g., '2025-01-15T09:00:00-07:00')"
          ),
        endDateTime: z
          .string()
          .describe(
            "End date/time in ISO format (e.g., '2025-01-15T10:00:00-07:00')"
          ),
        attendees: z
          .array(z.string())
          .optional()
          .describe("Array of attendee email addresses"),
        calendarId: z
          .string()
          .default("primary")
          .describe(getCalendarDescription()),
        timeZone: z
          .string()
          .optional()
          .describe(
            `Time zone - defaults to local time (${systemTimezone}). Examples: 'America/New_York', 'Europe/London', 'Asia/Tokyo'`
          ),
      });
  • src/index.ts:216-222 (registration)
    Registers the 'calendar-create-event' tool with the MCP server, providing name, description, input schema from createEventSchema, and handler wrapper calling createEvent.
      "calendar-create-event",
      "Create a new calendar event. Current time: " + new Date().toLocaleString(),
      createEventSchema().shape,
      async (params) => {
        return await createEvent(params);
      }
    );
  • Helper function to format a single calendar event details into Markdown for the tool response.
    function formatEventToMarkdown(event: any): string {
      let markdown = `# ${event.summary || 'Untitled Event'}\n\n`;
      
      if (event.description) markdown += `${event.description}\n\n`;
      
      const startDate = event.start?.dateTime ? new Date(event.start.dateTime) : null;
      const endDate = event.end?.dateTime ? new Date(event.end.dateTime) : null;
      
      if (startDate) {
        markdown += `Start: ${startDate.toLocaleString()}  \n`;
      }
      if (endDate) {
        markdown += `End: ${endDate.toLocaleString()}  \n`;
      }
      
      if (event.location) markdown += `Location: ${event.location}  \n`;
      
      if (event.attendees && event.attendees.length > 0) {
        markdown += `Attendees: ${event.attendees.map((a: any) => {
          let attendee = a.email || a;
          if (a.responseStatus) {
            const status = a.responseStatus === 'accepted' ? '✅' : 
                         a.responseStatus === 'declined' ? '❌' : 
                         a.responseStatus === 'tentative' ? '❓' : '⏳';
            attendee += ` ${status}`;
          }
          return attendee;
        }).join(', ')}  \n`;
      }
      
      if (event.htmlLink) markdown += `Calendar Link: [View Event](${event.htmlLink})  \n`;
      if (event.id) markdown += `Event ID: \`${event.id}\`  \n`;
      
      return markdown;
    }
  • Helper function to create OAuth2 authentication client for Google Calendar API using environment variables.
    function createCalendarAuth() {
      const clientId = process.env.GOOGLE_CLIENT_ID;
      const clientSecret = process.env.GOOGLE_CLIENT_SECRET;
      const redirectUri =
        process.env.GOOGLE_REDIRECT_URI || "http://localhost:3000/oauth2callback";
    
      if (!clientId || !clientSecret) {
        throw new Error(
          "GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET are required. Run oauth-setup.js to configure."
        );
      }
    
      const oauth2Client = new google.auth.OAuth2(
        clientId,
        clientSecret,
        redirectUri
      );
    
      const accessToken = process.env.GOOGLE_ACCESS_TOKEN;
      const refreshToken = process.env.GOOGLE_REFRESH_TOKEN;
    
      if (!accessToken || !refreshToken) {
        throw new Error("OAuth2 tokens missing. Run oauth-setup.js to get tokens.");
      }
    
      oauth2Client.setCredentials({
        access_token: accessToken,
        refresh_token: refreshToken,
      });
    
      return oauth2Client;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool creates events but doesn't mention what permissions are required, whether events are immediately published, how conflicts are handled, or what the response looks like. The timestamp inclusion is irrelevant behavioral information.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose statement is concise, but the timestamp 'Current time: 1/3/2026, 9:03:13 AM' adds unnecessary clutter that doesn't help an AI agent understand the tool. This wasted space reduces the score despite the otherwise efficient phrasing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after creation, error conditions, authentication requirements, or response format. The timestamp inclusion doesn't address these critical gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all 8 parameters. The description adds no parameter-specific information beyond what's in the schema, meeting the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new calendar event'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'calendar-update-event' beyond the obvious create vs. update distinction, and the timestamp inclusion is irrelevant to purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'calendar-update-event' or 'calendar-list-events'. There's no mention of prerequisites, permissions needed, or contextual factors that would influence tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/CaptainCrouton89/maps-mcp'

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