Skip to main content
Glama

canvas_get_course_grades

Retrieve course grades by providing the course ID, enabling easy access to student performance data within the Canvas Learning Management System.

Instructions

Get grades for a course

Input Schema

NameRequiredDescriptionDefault
course_idYesID of the course

Input Schema (JSON Schema)

{ "properties": { "course_id": { "description": "ID of the course", "type": "number" } }, "required": [ "course_id" ], "type": "object" }

Implementation Reference

  • src/index.ts:389-399 (registration)
    Registration of the canvas_get_course_grades tool in the TOOLS array, including name, description, and input schema requiring a course_id.
    { name: "canvas_get_course_grades", description: "Get grades for a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] } },
  • Execution handler for canvas_get_course_grades tool within the CallToolRequestSchema switch statement. Extracts course_id from arguments and calls CanvasClient.getCourseGrades().
    case "canvas_get_course_grades": { const { course_id } = args as { course_id: number }; if (!course_id) throw new Error("Missing required field: course_id"); const grades = await this.client.getCourseGrades(course_id); return { content: [{ type: "text", text: JSON.stringify(grades, null, 2) }] }; }
  • Core implementation of getCourseGrades in CanvasClient class. Makes API request to /courses/{courseId}/enrollments?include[]=grades&include[]=observed_users to fetch grades data.
    async getCourseGrades(courseId: number): Promise<CanvasEnrollment[]> { const response = await this.client.get(`/courses/${courseId}/enrollments`, { params: { include: ['grades', 'observed_users'] } }); return response.data; } async getUserGrades(): Promise<any> {
  • Type definitions for CanvasEnrollment (containing grades field) and CanvasGrades interfaces, defining the structure of the output data returned by getCourseGrades.
    export interface CanvasEnrollment { readonly id: EnrollmentId; readonly user_id: UserId; readonly course_id: CourseId; readonly type: CanvasEnrollmentType; readonly role: string; readonly enrollment_state: CanvasEnrollmentState; readonly grades?: CanvasGrades; readonly user?: CanvasUser; readonly observed_users?: CanvasUser[]; } export type CanvasEnrollmentType = | 'StudentEnrollment' | 'TeacherEnrollment' | 'TaEnrollment' | 'DesignerEnrollment' | 'ObserverEnrollment'; export type CanvasEnrollmentState = | 'active' | 'invited' | 'inactive' | 'completed' | 'rejected'; export interface CanvasGrades { readonly current_score: number | null; readonly final_score: number | null; readonly current_grade: string | null; readonly final_grade: string | null; readonly override_score?: number | null; readonly override_grade?: string | null; }

Other Tools

Related Tools

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/DMontgomery40/mcp-canvas-lms'

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