Skip to main content
Glama

tool_get_student_submission

Retrieve a student's latest submission files from Gradescope to review or grade their work. Requires course ID, assignment ID, and student email.

Instructions

Get a specific student's most recent submission (instructor/TA only).

Returns links to the submission files.

Args:
    course_id: The Gradescope course ID.
    assignment_id: The assignment ID.
    student_email: The student's email address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
assignment_idYes
student_emailYes

Implementation Reference

  • Actual implementation logic for getting student submission content.
    def get_student_submission_content(course_id: str, assignment_id: str,
                                        student_email: str) -> str:
        """Get the full content of a student's submission, including text answers and image URLs.
    
        Supports two submission formats:
        1. **Online assignments**: Extracts text answers and uploaded file URLs from
           the AssignmentSubmissionViewer React component.
        2. **Scanned PDF exams**: Extracts per-page scanned images and the full PDF
           from embedded JSON in the raw HTML.
    
        Requires instructor/TA access.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
            student_email: The student's email address.
        """
        if not course_id or not assignment_id or not student_email:
            return "Error: course_id, assignment_id, and student_email are required."
    
        try:
            conn = get_connection()
            # First, find the submission ID for the student
            url = f"{conn.gradescope_base_url}/courses/{course_id}/assignments/{assignment_id}/scores"
            resp = conn.session.get(url)
        except AuthError as e:
            return f"Authentication error: {e}"
        except Exception as e:
            return f"Error fetching scores to find submission: {e}"
    
        if resp.status_code != 200:
            return f"Error accessing scores (status {resp.status_code})."
    
        # Find the student's submission ID
        reader = csv.DictReader(io.StringIO(resp.text))
        sub_id = None
        student_name = student_email
        for row in reader:
            if row.get("Email") == student_email:
                if row.get("Status") == "Missing" or not row.get("Submission ID"):
                    return f"Student {student_email} has no submission for this assignment."
                sub_id = row.get("Submission ID")
                student_name = f"{row.get('First Name', '')} {row.get('Last Name', '')}".strip()
  • MCP tool wrapper registration for get_student_submission.
    def tool_get_student_submission(
        course_id: str, assignment_id: str, student_email: str
    ) -> str:
        """Get a specific student's most recent submission (instructor/TA only).
    
        Returns links to the submission files.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
            student_email: The student's email address.
        """
        return get_student_submission(course_id, assignment_id, student_email)
  • Intermediate helper function that bridges the MCP tool wrapper and the core logic.
    def get_student_submission(
        course_id: str, assignment_id: str, student_email: str
    ) -> str:
        """Get the full content of a specific student's submission.
    
        Requires instructor/TA access. Returns the student's text answers for each
        question, as well as direct URLs to any uploaded files or images.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
            student_email: The student's email address.
        """
        if not course_id or not assignment_id or not student_email:
            return "Error: course_id, assignment_id, and student_email are required."
    
        return get_student_submission_content(course_id, assignment_id, student_email)

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