Skip to main content
Glama
NotoriousArnav

EventHorizon MCP Server

register_for_event

Register users for events by providing an event ID and optional form answers. This tool handles attendee sign-ups through the EventHorizon platform.

Instructions

Register the current user for an event.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYesThe ID of the event to register for
answersNoAnswers to registration form questions (if any)

Implementation Reference

  • MCP tool handler function for 'register_for_event'. It retrieves the API client, calls registerForEvent on it with event_id and answers, formats the registration response, or returns an error.
    async ({ event_id, answers }) => {
      try {
        const apiClient = getClient();
        const registration = await apiClient.registerForEvent(event_id, answers || {});
        return {
          content: [{ type: 'text', text: `Successfully registered!\n\n${formatRegistration(registration)}` }]
        };
      } catch (error) {
        return {
          content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true
        };
      }
    }
  • Zod input schema for the 'register_for_event' tool, defining event_id (required number) and optional answers (record).
    {
      event_id: z.number().describe('The ID of the event to register for'),
      answers: z.record(z.unknown()).optional().describe('Answers to registration form questions (if any)')
    },
  • src/index.ts:204-225 (registration)
    Registration of the 'register_for_event' tool with the MCP server using server.tool(), including description, input schema, and handler function.
    server.tool(
      'register_for_event',
      'Register the current user for an event.',
      {
        event_id: z.number().describe('The ID of the event to register for'),
        answers: z.record(z.unknown()).optional().describe('Answers to registration form questions (if any)')
      },
      async ({ event_id, answers }) => {
        try {
          const apiClient = getClient();
          const registration = await apiClient.registerForEvent(event_id, answers || {});
          return {
            content: [{ type: 'text', text: `Successfully registered!\n\n${formatRegistration(registration)}` }]
          };
        } catch (error) {
          return {
            content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true
          };
        }
      }
    );
  • Helper method in EventHorizonClient that performs the actual API call to register for an event via POST to /api/events/{eventId}/register/.
    async registerForEvent(eventId: number, answers: Record<string, unknown> = {}): Promise<Registration> {
      try {
        const response: AxiosResponse<Registration> = await this.client.post(`/api/events/${eventId}/register/`, { answers });
        return response.data;
      } catch (error) {
        throw new Error(`Failed to register for event ${eventId}: ${getErrorMessage(error)}`);
      }
    }
  • TypeScript interface defining the Registration object returned by the API, used in the tool's response formatting.
    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;
    }

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