get_upcoming_events
Retrieve Network School calendar events scheduled for the upcoming days to stay informed about workshops, classes, and activities.
Instructions
Get Network School events happening in the next N days
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days to look ahead (default: 7) |
Implementation Reference
- src/index.ts:188-218 (handler)The main handler logic for the 'get_upcoming_events' tool. It validates the 'days' parameter, fetches events from Luma API, filters upcoming events using filterUpcomingEvents helper, formats the list, and returns the result as text content.case 'get_upcoming_events': { const days = (args?.days as number) || 7; if (typeof days !== 'number' || days < 1) { return { content: [ { type: 'text', text: 'Error: days parameter must be a positive number', }, ], isError: true, }; } const response = await lumaClient.fetchEvents(); const upcomingEvents = filterUpcomingEvents(response.entries, days); const formatted = formatEventsList( upcomingEvents, `No events scheduled in the next ${days} day${days !== 1 ? 's' : ''}.` ); return { content: [ { type: 'text', text: formatted, }, ], }; }
- src/index.ts:53-66 (registration)Tool registration entry in the list_tools handler, defining the tool name, description, and input schema for 'get_upcoming_events'.{ name: 'get_upcoming_events', description: 'Get Network School events happening in the next N days', inputSchema: { type: 'object', properties: { days: { type: 'number', description: 'Number of days to look ahead (default: 7)', default: 7, }, }, }, },
- src/formatters.ts:85-96 (helper)Helper function specifically used by get_upcoming_events to filter Luma event entries to those starting within the specified number of days from now.export function filterUpcomingEvents(entries: LumaEntry[], days: number): LumaEntry[] { const now = new Date(); const futureDate = addDays(now, days); return entries.filter(entry => { const startDate = parseISO(entry.event.start_at); return isWithinInterval(startDate, { start: startOfDay(now), end: endOfDay(futureDate) }); }); }
- src/formatters.ts:114-120 (helper)Helper function used by get_upcoming_events (and other event tools) to format the filtered event list into a readable string, with custom empty message.export function formatEventsList(entries: LumaEntry[], emptyMessage: string = 'No events found.'): string { if (entries.length === 0) { return emptyMessage; } return entries.map(entry => formatEvent(entry)).join('\n\n'); }