Skip to main content
Glama

get_upcoming_due_dates

Retrieve upcoming assignments, quizzes, and deadlines from your D2L Brightspace course calendar within a specified time range.

Instructions

Get calendar events and due dates for a course within a time range. Returns: event title, start/end date, associated entity (assignment, quiz, etc.), course name. By default returns events from 7 days ago to 30 days ahead. Use to answer: "What's due this week?", "When is the assignment due?", "What are my upcoming deadlines?", "What do I need to submit?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orgUnitIdNoThe course ID. Optional if D2L_COURSE_ID env var is set.
daysBackNoNumber of days in the past to include (default: 7)
daysAheadNoNumber of days in the future to include (default: 30)

Implementation Reference

  • The handler function implements the core logic: calculates date range, fetches calendar events via client, marshals and returns as JSON.
    handler: async (args: { orgUnitId?: number; daysBack?: number; daysAhead?: number }): Promise<string> => { const orgUnitId = getOrgUnitId(args.orgUnitId); const daysBack = args.daysBack ?? 7; const daysAhead = args.daysAhead ?? 30; const now = new Date(); const startDate = new Date(now.getTime() - daysBack * 24 * 60 * 60 * 1000); const endDate = new Date(now.getTime() + daysAhead * 24 * 60 * 60 * 1000); const events = await client.getMyCalendarEvents( orgUnitId, startDate.toISOString(), endDate.toISOString() ) as { Objects: RawCalendarEvent[] }; return JSON.stringify(marshalCalendarEvents(events), null, 2); },
  • Zod schema defining input parameters for the tool.
    schema: { orgUnitId: z.number().optional().describe('The course ID. Optional if D2L_COURSE_ID env var is set.'), daysBack: z.number().optional().describe('Number of days in the past to include (default: 7)'), daysAhead: z.number().optional().describe('Number of days in the future to include (default: 30)'), },
  • src/index.ts:114-126 (registration)
    Tool registration with McpServer, referencing schema and handler from calendarTools.
    server.tool( 'get_upcoming_due_dates', calendarTools.get_upcoming_due_dates.description, { orgUnitId: calendarTools.get_upcoming_due_dates.schema.orgUnitId, daysBack: calendarTools.get_upcoming_due_dates.schema.daysBack, daysAhead: calendarTools.get_upcoming_due_dates.schema.daysAhead, }, async (args) => { const result = await calendarTools.get_upcoming_due_dates.handler(args as { orgUnitId?: number; daysBack?: number; daysAhead?: number }); return { content: [{ type: 'text', text: result }] }; } );
  • Helper function to resolve orgUnitId from parameter or environment variable.
    function getOrgUnitId(provided?: number): number { const orgUnitId = provided ?? DEFAULT_COURSE_ID; if (!orgUnitId) { throw new Error('orgUnitId is required. Either provide it or set D2L_COURSE_ID environment variable.'); } return orgUnitId; }

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/bencered/d2l-mcp-server'

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