delete_rubric
Remove a rubric from a Canvas course and eliminate all its associations to maintain clean course organization.
Instructions
Delete a rubric and remove all its associations.
Args:
course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
rubric_id: The ID of the rubric to delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_identifier | Yes | ||
| rubric_id | Yes |
Implementation Reference
- The handler function for the 'delete_rubric' tool. It resolves the course ID, fetches rubric details for confirmation, performs the Canvas API DELETE request to remove the rubric, and returns a formatted success message with details.@mcp.tool() @validate_params async def delete_rubric(course_identifier: str | int, rubric_id: str | int) -> str: """Delete a rubric and remove all its associations. Args: course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID rubric_id: The ID of the rubric to delete """ course_id = await get_course_id(course_identifier) rubric_id_str = str(rubric_id) # Get rubric details before deletion for confirmation rubric_response = await make_canvas_request( "get", f"/courses/{course_id}/rubrics/{rubric_id_str}" ) rubric_title = "Unknown Rubric" if "error" not in rubric_response: rubric_title = rubric_response.get("title", "Unknown Rubric") # Delete the rubric response = await make_canvas_request( "delete", f"/courses/{course_id}/rubrics/{rubric_id_str}" ) if "error" in response: return f"Error deleting rubric: {response['error']}" course_display = await get_course_code(course_id) or course_identifier result = f"Rubric deleted successfully from course {course_display}!\n\n" result += "Deleted Rubric Details:\n" result += f" ID: {rubric_id}\n" result += f" Title: {rubric_title}\n" result += " All associations have been removed\n" return result
- src/canvas_mcp/server.py:51-51 (registration)Registration of rubric tools (including delete_rubric) via call to register_rubric_tools(mcp) in the main server setup.register_rubric_tools(mcp)
- src/canvas_mcp/tools/rubrics.py:294-294 (registration)The register_rubric_tools function where delete_rubric is registered with @mcp.tool() decorator.def register_rubric_tools(mcp: FastMCP) -> None: