unregister_from_event
Remove your registration from an event using its ID. This tool cancels your attendance for the specified event in the EventHorizon platform.
Instructions
Unregister the current user from an event.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_id | Yes | The ID of the event to unregister from |
Implementation Reference
- src/index.ts:233-246 (handler)The MCP tool handler function for 'unregister_from_event'. It invokes the API client's unregisterFromEvent method with the provided event_id, handles success by returning a confirmation message, and catches errors to return an error message.async ({ event_id }) => { try { const apiClient = getClient(); await apiClient.unregisterFromEvent(event_id); return { content: [{ type: 'text', text: `Successfully unregistered from event ${event_id}.` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/index.ts:230-232 (schema)Zod schema defining the input parameter 'event_id' as a number for the unregister_from_event tool.{ event_id: z.number().describe('The ID of the event to unregister from') },
- src/index.ts:227-247 (registration)Registration of the 'unregister_from_event' tool with the MCP server using server.tool(), specifying name, description, input schema, and inline handler function.server.tool( 'unregister_from_event', 'Unregister the current user from an event.', { event_id: z.number().describe('The ID of the event to unregister from') }, async ({ event_id }) => { try { const apiClient = getClient(); await apiClient.unregisterFromEvent(event_id); return { content: [{ type: 'text', text: `Successfully unregistered from event ${event_id}.` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/api-client.ts:165-171 (helper)ApiClient helper method that performs the HTTP DELETE request to the backend API endpoint to unregister the user from the specified event.async unregisterFromEvent(eventId: number): Promise<void> { try { await this.client.delete(`/api/events/${eventId}/unregister/`); } catch (error) { throw new Error(`Failed to unregister from event ${eventId}: ${getErrorMessage(error)}`); } }