Skip to main content
Glama
NotoriousArnav

EventHorizon MCP Server

get_event_registrations

Retrieve all attendee registrations for a specific event using the event ID. This tool is designed for event organizers to view registration details.

Instructions

Get all registrations for an event. Only available to the event organizer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYesThe ID of the event

Implementation Reference

  • The core handler function for the 'get_event_registrations' tool. It retrieves the API client, fetches registrations for the given event ID, handles empty results and errors, formats the registrations using formatRegistration, and returns a formatted text response.
    async ({ event_id }) => { try { const apiClient = getClient(); const registrations = await apiClient.getEventRegistrations(event_id); if (registrations.length === 0) { return { content: [{ type: 'text', text: 'No registrations found for this event.' }] }; } const formatted = registrations.map(formatRegistration).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `Found ${registrations.length} registration(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Input schema definition using Zod, specifying 'event_id' as a required number with description.
    { event_id: z.number().describe('The ID of the event') },
  • src/index.ts:249-277 (registration)
    The server.tool() call that registers the 'get_event_registrations' tool with the MCP server, including name, description, input schema, and handler function.
    server.tool( 'get_event_registrations', 'Get all registrations for an event. Only available to the event organizer.', { event_id: z.number().describe('The ID of the event') }, async ({ event_id }) => { try { const apiClient = getClient(); const registrations = await apiClient.getEventRegistrations(event_id); if (registrations.length === 0) { return { content: [{ type: 'text', text: 'No registrations found for this event.' }] }; } const formatted = registrations.map(formatRegistration).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `Found ${registrations.length} registration(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • API client helper method that performs the actual HTTP GET request to retrieve registrations for a specific event from the backend API.
    async getEventRegistrations(eventId: number): Promise<Registration[]> { try { const response: AxiosResponse<Registration[]> = await this.client.get(`/api/events/${eventId}/registrations/`); return response.data; } catch (error) { throw new Error(`Failed to get registrations for event ${eventId}: ${getErrorMessage(error)}`); } }
  • Utility function to format a single Registration object into a human-readable string, used in the tool handler to display results.
    function formatRegistration(reg: Registration): string { const eventInfo = typeof reg.event === 'object' ? reg.event.title : `Event ID: ${reg.event}`; const userInfo = typeof reg.user === 'object' ? reg.user.username : `User ID: ${reg.user}`; return `Registration (ID: ${reg.id}) Event: ${eventInfo} User: ${userInfo} Status: ${reg.status} Registered at: ${reg.registered_at}`; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NotoriousArnav/EventHorizon-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server