Skip to main content
Glama

assign_peer_review

Manually assign a peer review by specifying a reviewer student and reviewee student for a Canvas assignment to facilitate structured feedback.

Instructions

Manually assign a peer review to a student for a specific assignment.

    Args:
        course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
        assignment_id: The Canvas assignment ID
        reviewer_id: The Canvas user ID of the student who will do the review
        reviewee_id: The Canvas user ID of the student whose submission will be reviewed
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_identifierYes
assignment_idYes
reviewer_idYes
reviewee_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'assign_peer_review' MCP tool. Decorated with @mcp.tool() for automatic registration and schema generation. Implements logic to assign peer reviews in Canvas by ensuring reviewee submission exists (creating placeholder if needed) and posting to Canvas peer_reviews API endpoint.
    @mcp.tool()
    async def assign_peer_review(course_identifier: str, assignment_id: str, reviewer_id: str, reviewee_id: str) -> str:
        """Manually assign a peer review to a student for a specific assignment.
    
        Args:
            course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
            assignment_id: The Canvas assignment ID
            reviewer_id: The Canvas user ID of the student who will do the review
            reviewee_id: The Canvas user ID of the student whose submission will be reviewed
        """
        course_id = await get_course_id(course_identifier)
    
        # First, we need to get the submission ID for the reviewee
        submissions = await make_canvas_request(
            "get",
            f"/courses/{course_id}/assignments/{assignment_id}/submissions",
            params={"per_page": 100}
        )
    
        if "error" in submissions:
            return f"Error fetching submissions: {submissions['error']}"
    
        # Find the submission for the reviewee
        reviewee_submission = None
        for submission in submissions:
            if str(submission.get("user_id")) == str(reviewee_id):
                reviewee_submission = submission
                break
    
        # If no submission exists, we need to create a placeholder submission
        if not reviewee_submission:
            # Create a placeholder submission for the reviewee
            placeholder_data = {
                "submission": {
                    "user_id": reviewee_id,
                    "submission_type": "online_text_entry",
                    "body": "Placeholder submission for peer review"
                }
            }
    
            reviewee_submission = await make_canvas_request(
                "post",
                f"/courses/{course_id}/assignments/{assignment_id}/submissions",
                data=placeholder_data
            )
    
            if "error" in reviewee_submission:
                return f"Error creating placeholder submission: {reviewee_submission['error']}"
    
        # Now assign the peer review using the submission ID
        submission_id = reviewee_submission.get("id")
    
        # Data for the peer review assignment
        data = {
            "user_id": reviewer_id  # The user who will do the review
        }
    
        # Make the API request to create the peer review
        response = await make_canvas_request(
            "post",
            f"/courses/{course_id}/assignments/{assignment_id}/submissions/{submission_id}/peer_reviews",
            data=data
        )
    
        if "error" in response:
            return f"Error assigning peer review: {response['error']}"
    
        # Try to get the course code for display
        course_display = await get_course_code(course_id) or course_identifier
    
        return f"Successfully assigned peer review in course {course_display}:\n" + \
               f"Assignment ID: {assignment_id}\n" + \
               f"Reviewer ID: {reviewer_id}\n" + \
               f"Reviewee ID: {reviewee_id}\n" + \
               f"Submission ID: {submission_id}"
  • Top-level registration of assignment tools (including 'assign_peer_review') by calling register_assignment_tools(mcp) in the main server setup.
    register_assignment_tools(mcp)

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