createCalendar
Generate and manage Apple Calendars on macOS using a structured input format. Define calendar title and color for streamlined organization within the MCP Apple Calendars server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | ||
| title | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"color": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
Implementation Reference
- src/calendars.ts:111-122 (handler)Core implementation of createCalendar: sends POST request to the Calendar API Bridge to create a new calendar with given title and optional color.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}`); } }
- src/index.ts:67-70 (schema)Zod input schema for createCalendar tool: requires 'title' as string, optional 'color' as string.{ title: z.string(), color: z.string().optional() },
- src/index.ts:65-94 (registration)MCP server registration of the createCalendar tool, including schema and wrapper handler that calls the core implementation and formats response.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 }; } } );