Skip to main content
Glama

tool_export_assignment_scores

Export detailed per-question student scores and statistics for a Gradescope assignment to analyze performance and grading patterns.

Instructions

Export per-question scores for an assignment.

Returns a summary table with student names, total scores, statistics,
and per-question breakdowns. Requires instructor/TA access.

Args:
    course_id: The Gradescope course ID.
    assignment_id: The assignment ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
assignment_idYes

Implementation Reference

  • The core implementation of the export_assignment_scores function.
    def export_assignment_scores(course_id: str, assignment_id: str) -> str:
        """Export per-question scores for an assignment as a formatted table.
    
        Returns a summary table with student names, total scores, and per-question
        breakdowns. Requires instructor/TA access.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
        """
        if not course_id or not assignment_id:
            return "Error: both course_id and assignment_id are required."
    
        try:
            conn = get_connection()
            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: {e}"
    
        if resp.status_code != 200:
            return f"Error: Cannot access scores (status {resp.status_code}). Check permissions."
    
        content_type = resp.headers.get("content-type", "")
        if "csv" not in content_type and "text" not in content_type:
            return f"Error: Unexpected content type: {content_type}"
    
        # Parse the CSV
        reader = csv.DictReader(io.StringIO(resp.text))
  • Registration of the tool_export_assignment_scores as an MCP tool, which calls the grading utility function.
    @mcp.tool()
    def tool_export_assignment_scores(course_id: str, assignment_id: str) -> str:
        """Export per-question scores for an assignment.
    
        Returns a summary table with student names, total scores, statistics,
        and per-question breakdowns. Requires instructor/TA access.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
        """
        return export_assignment_scores(course_id, assignment_id)

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