update_event
Modify an existing Google Calendar event by updating its title, description, time, location, or attendees using the specified event ID.
Instructions
Update an existing event in Google Calendar
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attendees | No | List of attendees | |
| calendarId | No | Calendar ID (default: 'primary') | primary |
| description | No | Event description | |
| end | No | ||
| eventId | Yes | Event ID to update | |
| location | No | Event location | |
| start | No | ||
| summary | No | Event title/summary |
Input Schema (JSON Schema)
{
"properties": {
"attendees": {
"description": "List of attendees",
"items": {
"properties": {
"displayName": {
"type": "string"
},
"email": {
"type": "string"
}
},
"required": [
"email"
],
"type": "object"
},
"type": "array"
},
"calendarId": {
"default": "primary",
"description": "Calendar ID (default: 'primary')",
"type": "string"
},
"description": {
"description": "Event description",
"type": "string"
},
"end": {
"properties": {
"dateTime": {
"description": "End date and time (RFC3339 timestamp)",
"type": "string"
},
"timeZone": {
"description": "Time zone (e.g., 'America/New_York')",
"type": "string"
}
},
"type": "object"
},
"eventId": {
"description": "Event ID to update",
"type": "string"
},
"location": {
"description": "Event location",
"type": "string"
},
"start": {
"properties": {
"dateTime": {
"description": "Start date and time (RFC3339 timestamp)",
"type": "string"
},
"timeZone": {
"description": "Time zone (e.g., 'America/New_York')",
"type": "string"
}
},
"type": "object"
},
"summary": {
"description": "Event title/summary",
"type": "string"
}
},
"required": [
"eventId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:423-465 (handler)The handleUpdateEvent function implements the core logic for updating a Google Calendar event. It conditionally builds the update object from provided arguments and calls the Google Calendar API's events.patch method. Returns structured success or error responses.async function handleUpdateEvent(args: z.infer<typeof UpdateEventArgsSchema>) { try { const updates: any = {}; if (args.summary !== undefined) updates.summary = args.summary; if (args.description !== undefined) updates.description = args.description; if (args.start !== undefined) updates.start = args.start; if (args.end !== undefined) updates.end = args.end; if (args.location !== undefined) updates.location = args.location; if (args.attendees !== undefined) updates.attendees = args.attendees; const response = await calendar.events.patch({ calendarId: args.calendarId, eventId: args.eventId, requestBody: updates, }); return { content: [ { type: "text", text: JSON.stringify({ success: true, event: response.data, message: `Event "${args.eventId}" updated 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, }; } }
- src/index.ts:67-85 (schema)Zod schema for input validation of the update_event tool arguments, defining required eventId and optional update fields.const UpdateEventArgsSchema = z.object({ calendarId: z.string().optional().default("primary"), eventId: z.string(), summary: z.string().optional(), description: z.string().optional(), start: z.object({ dateTime: z.string(), timeZone: z.string().optional(), }).optional(), end: z.object({ dateTime: z.string(), timeZone: z.string().optional(), }).optional(), location: z.string().optional(), attendees: z.array(z.object({ email: z.string(), displayName: z.string().optional(), })).optional(), });
- src/index.ts:223-291 (registration)The 'update_event' tool registration in the MCP tools list, providing name, description, and JSON schema for inputs.{ name: "update_event", description: "Update an existing event in Google Calendar", inputSchema: { type: "object", properties: { calendarId: { type: "string", description: "Calendar ID (default: 'primary')", default: "primary", }, eventId: { type: "string", description: "Event ID to update", }, 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')", }, }, }, 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')", }, }, }, 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", }, }, required: ["eventId"], }, },
- src/index.ts:555-558 (helper)Dispatcher switch case in CallToolRequestHandler that validates args with UpdateEventArgsSchema and invokes the handleUpdateEvent function.case "update_event": { const validatedArgs = UpdateEventArgsSchema.parse(args); return await handleUpdateEvent(validatedArgs); }