get_assignment_submissions
Retrieve assignment submissions to view submitted files, timestamps, feedback comments, and grades received in D2L Brightspace.
Instructions
Get the user's submissions for an assignment. Shows submitted files, submission timestamps, feedback comments, and grades received. Use to answer: "Did I submit this assignment?", "What grade did I get?", "When did I submit?", "What feedback did I receive?"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orgUnitId | No | The course ID. Optional if D2L_COURSE_ID env var is set. | |
| assignmentId | Yes | The assignment Id from get_assignments. Example: 37812 |
Implementation Reference
- src/tools/dropbox.ts:45-48 (handler)The core handler function that fetches assignment submissions from the D2L client using the resolved orgUnitId and assignmentId, marshals them into a user-friendly format, and returns a formatted JSON string.handler: async ({ orgUnitId, assignmentId }: { orgUnitId?: number; assignmentId: number }) => { const submissions = await client.getDropboxSubmissions(getOrgUnitId(orgUnitId), assignmentId) as RawSubmission[]; return JSON.stringify(marshalSubmissions(submissions), null, 2); },
- src/tools/dropbox.ts:41-44 (schema)Zod schema for input validation: optional orgUnitId (course ID) and required assignmentId.schema: { orgUnitId: z.number().optional().describe('The course ID. Optional if D2L_COURSE_ID env var is set.'), assignmentId: z.number().describe('The assignment Id from get_assignments. Example: 37812'), },
- src/index.ts:43-54 (registration)Registers the 'get_assignment_submissions' tool with the MCP server, using the description, schema from assignmentTools, and a wrapper handler that calls the tool's handler and formats the response.'get_assignment_submissions', assignmentTools.get_assignment_submissions.description, { orgUnitId: assignmentTools.get_assignment_submissions.schema.orgUnitId, assignmentId: assignmentTools.get_assignment_submissions.schema.assignmentId, }, async (args) => { const result = await assignmentTools.get_assignment_submissions.handler(args as { orgUnitId?: number; assignmentId: number }); return { content: [{ type: 'text', text: result }] }; } );
- src/utils/marshal.ts:308-325 (helper)Helper function that transforms raw submission data from the D2L API into a clean, LLM-friendly structure with formatted dates, sizes, and stripped HTML.export function marshalSubmissions(submissions: RawSubmission[]): MarshalledSubmission[] { return submissions.map((s) => { const latestSubmission = s.Submissions?.[0]; return removeEmpty({ submitted: s.Status === 1, submittedBy: s.Entity.DisplayName, submissionDate: formatDate(latestSubmission?.SubmissionDate), submissionDateRelative: formatRelativeDate(latestSubmission?.SubmissionDate), files: latestSubmission?.Files?.map((f) => ({ name: f.FileName, size: formatFileSize(f.Size), })) || [], comment: latestSubmission?.Comment?.Text?.trim() || null, grade: s.Feedback?.Score ?? null, feedback: stripHtml(s.Feedback?.Feedback?.Text || s.Feedback?.Feedback?.Html) || null, }); }) as MarshalledSubmission[]; }
- src/tools/dropbox.ts:7-13 (helper)Helper function to resolve the organization unit (course) ID from the input parameter or the D2L_COURSE_ID environment variable.function getOrgUnitId(orgUnitId?: number): number { const id = orgUnitId ?? DEFAULT_COURSE_ID; if (!id) { throw new Error('No course ID provided and D2L_COURSE_ID environment variable not set'); } return id; }