get_grades
Retrieve current grades for a specific course or all enrollments. Supports filtering by course ID.
Instructions
Current grades. Per-course if course_id provided, otherwise all enrollments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- canvas_local_mcp/server.py:113-120 (handler)The 'get_grades' tool handler function. Decorated with @mcp.tool(), it fetches grades from Canvas LMS API. If course_id is provided, it fetches enrollments for that course; otherwise it fetches all active enrollments for the self user. Returns a list of dicts with course_id, grade, and type.
@mcp.tool() def get_grades(course_id: int | None = None) -> list[dict]: """Current grades. Per-course if course_id provided, otherwise all enrollments.""" if course_id: en = _get(f"/api/v1/courses/{course_id}/enrollments", user_id="self") else: en = _get("/api/v1/users/self/enrollments", **{"state[]": "active"}) return [{"course_id": e.get("course_id"), "grade": e.get("grades"), "type": e.get("type")} for e in en] - canvas_local_mcp/server.py:14-14 (registration)The FastMCP server instance used to register the tool via the @mcp.tool() decorator on line 113.
mcp = FastMCP("canvas-local")