update_event
Modify existing events by updating specific fields like title, time, location, or capacity. Provide only the fields you need to change.
Instructions
Update an existing event. Only provide the fields you want to change.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes | The ID of the event to update | |
| title | No | New title for the event | |
| description | No | New description for the event | |
| start_time | No | New start time in ISO 8601 format | |
| end_time | No | New end time in ISO 8601 format | |
| location | No | New location for the event | |
| capacity | No | New capacity for the event |
Implementation Reference
- src/index.ts:154-176 (handler)The main handler function for the 'update_event' tool. It collects optional update fields into updateData, calls the API client's updateEvent method, formats the response with formatEvent, or returns an error.async ({ event_id, title, description, start_time, end_time, location, capacity }) => { try { const apiClient = getClient(); const updateData: Record<string, unknown> = {}; if (title !== undefined) updateData.title = title; if (description !== undefined) updateData.description = description; if (start_time !== undefined) updateData.start_time = start_time; if (end_time !== undefined) updateData.end_time = end_time; if (location !== undefined) updateData.location = location; if (capacity !== undefined) updateData.capacity = capacity; const event = await apiClient.updateEvent(event_id, updateData); return { content: [{ type: 'text', text: `Event updated successfully!\n\n${formatEvent(event)}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/index.ts:145-153 (schema)Zod schema defining the input parameters for the update_event tool, with event_id required and others optional.{ event_id: z.number().describe('The ID of the event to update'), title: z.string().optional().describe('New title for the event'), description: z.string().optional().describe('New description for the event'), start_time: z.string().optional().describe('New start time in ISO 8601 format'), end_time: z.string().optional().describe('New end time in ISO 8601 format'), location: z.string().optional().describe('New location for the event'), capacity: z.number().optional().describe('New capacity for the event') },
- src/index.ts:142-143 (registration)Registration of the 'update_event' tool on the MCP server, specifying name and description.server.tool( 'update_event',
- src/api-client.ts:139-146 (helper)Helper method in EventHorizonClient that performs the HTTP PUT request to update an event on the backend API.async updateEvent(eventId: number, eventData: Partial<EventCreateRequest>): Promise<Event> { try { const response: AxiosResponse<Event> = await this.client.put(`/api/events/${eventId}/`, eventData); return response.data; } catch (error) { throw new Error(`Failed to update event ${eventId}: ${getErrorMessage(error)}`); } }
- src/api-client.ts:53-61 (schema)TypeScript interface used for event creation and update data (Partial<EventCreateRequest> in updateEvent).export interface EventCreateRequest { title: string; description: string; start_time: string; end_time: string; location: string; capacity: number; registration_schema?: Record<string, unknown>[]; }