Skip to main content
Glama

assign_peer_review

Assign a peer review to a student for a Canvas assignment by specifying the reviewer, reviewee, course, and assignment details.

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
assignment_idYes
course_identifierYes
reviewee_idYes
reviewer_idYes

Implementation Reference

  • Main handler function for the 'assign_peer_review' tool. It resolves the course ID, fetches or creates a placeholder submission for the reviewee, and assigns the specified reviewer via the Canvas API peer_reviews endpoint.
    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}"
  • Registration call to register_assignment_tools(mcp) within register_all_tools, which defines and registers the assign_peer_review tool among others via @mcp.tool() decorators.
    register_assignment_tools(mcp)

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