Skip to main content
Glama
shadowfax92

MCP Apple Calendars

by shadowfax92

createCalendar

Create a new calendar in Apple Calendar on macOS. Specify a title and optional color to organize events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
colorNo

Implementation Reference

  • MCP handler function for the 'createCalendar' tool. It calls the helper function calendars.createCalendar(title, color) and formats the response as MCP content or error.
    async ({ title, color }) => {
      try {
        const result = await calendars.createCalendar(title, color);
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: true, 
              message: "Calendar created", 
              calendar: result 
            }) 
          }]
        };
      } catch (error) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ error: "Failed to create calendar" }) 
          }],
          isError: true
        };
      }
    }
  • Input schema using Zod validation: required 'title' string and optional 'color' string.
    { 
      title: z.string(),
      color: z.string().optional()
    },
  • src/index.ts:65-94 (registration)
    Registration of the 'createCalendar' tool with the MCP server using server.tool(name, schema, handler).
    server.tool(
      "createCalendar",
      { 
        title: z.string(),
        color: z.string().optional()
      },
      async ({ title, color }) => {
        try {
          const result = await calendars.createCalendar(title, color);
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                success: true, 
                message: "Calendar created", 
                calendar: result 
              }) 
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ error: "Failed to create calendar" }) 
            }],
            isError: true
          };
        }
      }
    );
  • Helper function that executes the core logic: POST request to the calendar API bridge to create a new calendar.
    export async function createCalendar(title: string, color?: string): Promise<any> {
      try {
        const response = await axios.post(`${API_BASE_URL}/calendars`, {
          title,
          color
        });
        return response.data;
      } catch (error) {
        console.error(`Failed to create calendar "${title}":`, error);
        throw new Error(`Failed to create calendar: ${error}`);
      }
    }

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/shadowfax92/apple-calendar-mcp'

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