get_upcoming_events
Retrieve upcoming Network School calendar events for the next specified days to help users plan and stay informed about available 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)Handler logic for 'get_upcoming_events' tool: validates input days, fetches events via LumaClient, filters upcoming events using filterUpcomingEvents, formats the list, and returns formatted text response.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)Registration of the 'get_upcoming_events' tool in the list_tools handler, including name, description, and input schema definition.{ 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/index.ts:56-65 (schema)Input schema definition for the 'get_upcoming_events' tool, specifying the 'days' parameter.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 filterUpcomingEvents that filters Luma events starting within the next N days, used in the tool handler.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 formatEventsList that formats a list of events into a readable string, used in the tool handler.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'); }