Skip to main content
Glama

tool_delete_rubric_item

Remove a rubric item from a question in Gradescope, automatically updating all submissions and recalculating scores.

Instructions

Delete a rubric item from a question.

**WARNING**: Removes the item from ALL submissions and recalculates scores.

Args:
    course_id: The Gradescope course ID.
    question_id: The question ID.
    rubric_item_id: The rubric item ID to delete.
    confirm_write: Must be True to delete the item.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
question_idYes
rubric_item_idYes
confirm_writeNo

Implementation Reference

  • The implementation of the delete_rubric_item tool handler.
    def delete_rubric_item(
        course_id: str,
        question_id: str,
        rubric_item_id: str,
        confirm_write: bool = False,
    ) -> str:
        """Delete a rubric item from a question.
    
        **WARNING**: Deleting a rubric item removes it from ALL submissions.
        Any students who had this item applied will have their scores recalculated.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID.
            rubric_item_id: The rubric item ID to delete.
            confirm_write: Must be True to delete the item.
        """
        if not course_id or not question_id or not rubric_item_id:
            return "Error: course_id, question_id, and rubric_item_id are required."
    
        if not confirm_write:
            return write_confirmation_required(
                "delete_rubric_item",
                [
                    f"course_id=`{course_id}`",
                    f"question_id=`{question_id}`",
                    f"rubric_item_id=`{rubric_item_id}`",
                    "⚠️ This permanently deletes the item and recalculates ALL affected scores.",
                ],
            )
    
        try:
            conn = get_connection()
            subs_url = (
                f"{conn.gradescope_base_url}/courses/{course_id}"
                f"/questions/{question_id}/submissions"
            )
            resp = conn.session.get(subs_url)
            if resp.status_code != 200:
                return f"Error accessing question page (status {resp.status_code})."
    
            soup = BeautifulSoup(resp.text, "html.parser")
            csrf_meta = soup.find("meta", {"name": "csrf-token"})
            csrf_token = csrf_meta.get("content", "") if csrf_meta else ""
        except AuthError as e:
            return f"Authentication error: {e}"
        except Exception as e:
            return f"Error: {e}"
    
        delete_url = (
            f"{conn.gradescope_base_url}/courses/{course_id}"
            f"/questions/{question_id}/rubric_items/{rubric_item_id}"
        )
    
        headers = {
            "X-CSRF-Token": csrf_token,
            "Accept": "application/json",
            "X-Requested-With": "XMLHttpRequest",
        }
    
        try:
            resp = conn.session.delete(delete_url, headers=headers)
        except Exception as e:
            return f"Error deleting rubric item: {e}"
    
        if resp.status_code in (200, 204):
            return (
                f"✅ Rubric item `{rubric_item_id}` deleted.\n"
                f"All affected submissions have been recalculated."
            )
        else:
            return f"Error: Delete failed (status {resp.status_code}). Response: {resp.text[:300]}"
  • The registration of tool_delete_rubric_item with the MCP server.
    def tool_delete_rubric_item(
        course_id: str,
        question_id: str,
        rubric_item_id: str,
        confirm_write: bool = False,
    ) -> str:
        """Delete a rubric item from a question.
    
        **WARNING**: Removes the item from ALL submissions and recalculates scores.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID.
            rubric_item_id: The rubric item ID to delete.
            confirm_write: Must be True to delete the item.
        """
        return delete_rubric_item(
            course_id, question_id, rubric_item_id, confirm_write
        )

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/Yuanpeng-Li/gradescope-mcp'

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