Skip to main content
Glama

associate_rubric_with_assignment

Link an existing rubric to a Canvas assignment to establish grading criteria and evaluation standards for student work.

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
NameRequiredDescriptionDefault
course_identifierYes
rubric_idYes
assignment_idYes
use_for_gradingNo
purposeNograding

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function that implements the associate_rubric_with_assignment tool. It performs a PUT request to the Canvas API endpoint /courses/{course_id}/rubrics/{rubric_id} to associate the rubric with the specified assignment, handling parameters like use_for_grading and purpose, and returns a formatted success message with details.
    @mcp.tool()
    @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
  • The call to register_rubric_tools(mcp) in the register_all_tools function, which triggers the registration of the associate_rubric_with_assignment tool among others in the rubrics module.
    register_rubric_tools(mcp)
  • Import of register_rubric_tools from rubrics.py, enabling its use in the top-level tools registration.
    from .rubrics import register_rubric_tools

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other 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/vishalsachdev/canvas-mcp'

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