Skip to main content
Glama

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
NameRequiredDescriptionDefault
daysNoNumber of days to look ahead (default: 7)

Implementation Reference

  • 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, }, }, }, },
  • 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) }); }); }
  • 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'); }

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/tHeMaskedMan981/ns-mcp'

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