get_my_registrations
Retrieve a list of events you have registered to attend through the EventHorizon platform.
Instructions
Get all events the current user is registered for.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:336-362 (registration)Registration of the MCP tool 'get_my_registrations' with server.tool(). Includes tool name, description, empty input schema ({}), and the inline asynchronous handler function that executes the tool logic by calling the API client.server.tool( 'get_my_registrations', 'Get all events the current user is registered for.', {}, async () => { try { const apiClient = getClient(); const registrations = await apiClient.getUserRegistrations(); if (registrations.length === 0) { return { content: [{ type: 'text', text: 'You are not registered for any events.' }] }; } const formatted = registrations.map(formatRegistration).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `You have ${registrations.length} registration(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/index.ts:340-361 (handler)The inline handler function for the 'get_my_registrations' tool. It fetches the user's registrations using the EventHorizonClient, formats them using formatRegistration, and returns a formatted text response or error.async () => { try { const apiClient = getClient(); const registrations = await apiClient.getUserRegistrations(); if (registrations.length === 0) { return { content: [{ type: 'text', text: 'You are not registered for any events.' }] }; } const formatted = registrations.map(formatRegistration).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `You have ${registrations.length} registration(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/api-client.ts:201-208 (helper)The getUserRegistrations method in EventHorizonClient class, which performs the actual API call to retrieve the current user's registrations from '/api/registrations/' endpoint.async getUserRegistrations(): Promise<Registration[]> { try { const response: AxiosResponse<Registration[]> = await this.client.get('/api/registrations/'); return response.data; } catch (error) { throw new Error(`Failed to get user registrations: ${getErrorMessage(error)}`); } }
- src/api-client.ts:43-51 (schema)TypeScript interface defining the Registration type used by the tool's response data.export interface Registration { id: number; event: Event | number; user: User | number; status: 'pending' | 'approved' | 'waitlisted' | 'cancelled'; answers: Record<string, unknown>; registered_at: string; updated_at: string; }