delete_event
Remove an event from the EventHorizon platform. This action is restricted to the event organizer to manage their scheduled activities.
Instructions
Delete an event. Only the organizer can delete their events.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes | The ID of the event to delete |
Implementation Reference
- src/index.ts:178-198 (registration)Registration of the 'delete_event' MCP tool using server.tool(), including description, input schema, and inline handler function.server.tool( 'delete_event', 'Delete an event. Only the organizer can delete their events.', { event_id: z.number().describe('The ID of the event to delete') }, async ({ event_id }) => { try { const apiClient = getClient(); await apiClient.deleteEvent(event_id); return { content: [{ type: 'text', text: `Event ${event_id} deleted successfully.` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/index.ts:184-197 (handler)The handler function for the 'delete_event' tool. It retrieves the API client, calls deleteEvent on it with the provided event_id, and returns a success or error message.async ({ event_id }) => { try { const apiClient = getClient(); await apiClient.deleteEvent(event_id); return { content: [{ type: 'text', text: `Event ${event_id} deleted successfully.` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/index.ts:181-183 (schema)Zod input schema for the 'delete_event' tool, requiring a single 'event_id' parameter of type number.{ event_id: z.number().describe('The ID of the event to delete') },
- src/api-client.ts:148-154 (helper)API client method that performs the HTTP DELETE request to remove the event from the backend API.async deleteEvent(eventId: number): Promise<void> { try { await this.client.delete(`/api/events/${eventId}/`); } catch (error) { throw new Error(`Failed to delete event ${eventId}: ${getErrorMessage(error)}`); } }