Skip to main content
Glama
NotoriousArnav

EventHorizon MCP Server

list_events

Find and filter events by title, description, or location to discover available activities and gatherings.

Instructions

List all available events. Optionally filter by search term or location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchNoSearch term to filter events by title or description
locationNoFilter events by location

Implementation Reference

  • The asynchronous handler function implementing the core logic of the 'list_events' MCP tool. It calls the API client to fetch events (optionally filtered), handles empty results and errors, formats the output using formatEvent, and returns MCP-formatted content.
    async ({ search, location }) => { try { const apiClient = getClient(); const events = await apiClient.listEvents({ search, location }); if (events.length === 0) { return { content: [{ type: 'text', text: 'No events found matching your criteria.' }] }; } const formatted = events.map(formatEvent).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `Found ${events.length} event(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Zod input schema for the list_events tool parameters: optional 'search' and 'location' strings.
    { search: z.string().optional().describe('Search term to filter events by title or description'), location: z.string().optional().describe('Filter events by location') },
  • src/index.ts:55-84 (registration)
    Registration of the 'list_events' tool with the MCP server using server.tool(), including name, description, schema, and handler reference.
    server.tool( 'list_events', 'List all available events. Optionally filter by search term or location.', { search: z.string().optional().describe('Search term to filter events by title or description'), location: z.string().optional().describe('Filter events by location') }, async ({ search, location }) => { try { const apiClient = getClient(); const events = await apiClient.listEvents({ search, location }); if (events.length === 0) { return { content: [{ type: 'text', text: 'No events found matching your criteria.' }] }; } const formatted = events.map(formatEvent).join('\n\n---\n\n'); return { content: [{ type: 'text', text: `Found ${events.length} event(s):\n\n${formatted}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • Utility function to format an individual Event object into a multi-line human-readable string, used by the list_events handler and other tools.
    function formatEvent(event: Event): string { return `Event: ${event.title} (ID: ${event.id}) Description: ${event.description} Location: ${event.location} Start: ${event.start_time} End: ${event.end_time} Capacity: ${event.capacity} Organizer: ${event.organizer.username} Registered: ${event.is_registered ? 'Yes' : 'No'}`; }
  • TypeScript interface defining the EventListParams type used by the apiClient.listEvents method, matching the tool's input schema.
    export interface EventListParams { search?: string; location?: 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