associate_rubric_with_assignment
Link an existing rubric to a Canvas assignment to establish grading criteria and evaluation standards for student submissions.
Instructions
Associate an existing rubric with an assignment.
Args:
course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
rubric_id: The ID of the rubric to associate
assignment_id: The ID of the assignment to associate with
use_for_grading: Whether to use rubric for grade calculation (default: False)
purpose: Purpose of the association (grading, bookmark) (default: grading)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignment_id | Yes | ||
| course_identifier | Yes | ||
| purpose | No | grading | |
| rubric_id | Yes | ||
| use_for_grading | No |
Implementation Reference
- The handler function that implements the 'associate_rubric_with_assignment' MCP tool. It updates the rubric via Canvas API to associate it with the specified assignment, optionally setting it for grading.@validate_params async def associate_rubric_with_assignment(course_identifier: str | int, rubric_id: str | int, assignment_id: str | int, use_for_grading: bool = False, purpose: str = "grading") -> str: """Associate an existing rubric with an assignment. Args: course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID rubric_id: The ID of the rubric to associate assignment_id: The ID of the assignment to associate with use_for_grading: Whether to use rubric for grade calculation (default: False) purpose: Purpose of the association (grading, bookmark) (default: grading) """ course_id = await get_course_id(course_identifier) rubric_id_str = str(rubric_id) assignment_id_str = str(assignment_id) # Update the rubric with association request_data = { "rubric_association": { "association_id": assignment_id_str, "association_type": "Assignment", "use_for_grading": use_for_grading, "purpose": purpose } } # Make the API request response = await make_canvas_request( "put", f"/courses/{course_id}/rubrics/{rubric_id_str}", data=request_data ) if "error" in response: return f"Error associating rubric with assignment: {response['error']}" # Get assignment details for confirmation assignment_response = await make_canvas_request( "get", f"/courses/{course_id}/assignments/{assignment_id_str}" ) assignment_name = "Unknown Assignment" if "error" not in assignment_response: assignment_name = assignment_response.get("name", "Unknown Assignment") course_display = await get_course_code(course_id) or course_identifier result = "Rubric associated with assignment successfully!\n\n" result += f"Course: {course_display}\n" result += f"Assignment: {assignment_name} (ID: {assignment_id})\n" result += f"Rubric ID: {rubric_id}\n" result += f"Used for Grading: {'Yes' if use_for_grading else 'No'}\n" result += f"Purpose: {purpose}\n" return result
- src/canvas_mcp/tools/rubrics.py:294-294 (registration)The register_rubric_tools function defines all rubric tools using @mcp.tool() decorators, which registers 'associate_rubric_with_assignment' among others.def register_rubric_tools(mcp: FastMCP) -> None: