Skip to main content
Glama

tool_get_extensions

Retrieve student extensions for a specific Gradescope assignment, displaying user IDs, names, and modified dates for instructor or TA access.

Instructions

Get all student extensions for a specific assignment.

Returns a table of extensions with user ID, name, and modified dates.
Requires instructor or 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 MCP tool handler function for 'tool_get_extensions'. It wraps the core 'get_extensions' logic.
    def tool_get_extensions(course_id: str, assignment_id: str) -> str:
        """Get all student extensions for a specific assignment.
    
        Returns a table of extensions with user ID, name, and modified dates.
        Requires instructor or TA access.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
        """
        return get_extensions(course_id, assignment_id)
  • The actual implementation of 'get_extensions' which communicates with the Gradescope API.
    def get_extensions(course_id: str, assignment_id: str) -> str:
        """Get all extensions for a specific assignment.
    
        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()
            extensions = gs_get_extensions(
                session=conn.session,
                course_id=course_id,
                assignment_id=assignment_id,
            )
        except AuthError as e:
            return f"Authentication error: {e}"
        except Exception as e:
            err = str(e)
            if "401" in err or "Status code: 401" in err:
                return (
                    f"⚠️ Extensions are not available for assignment `{assignment_id}`. "
                    "Some assignment types (e.g. exam-style or scanned PDF assignments) "
                    "do not support the extensions API endpoint, even for instructors. "
                    "You can still manage extensions via the Gradescope web UI."
                )
            return f"Error fetching extensions: {e}"
    
        if not extensions:
            return f"No extensions found for assignment `{assignment_id}` in course `{course_id}`."
    
        lines = [f"## Extensions for Assignment {assignment_id}\n"]
        lines.append("| User ID | Name | Release Date | Due Date | Late Due Date |")
        lines.append("|---------|------|-------------|----------|---------------|")
    
        for user_id, ext in extensions.items():
            lines.append(
  • The registration of 'tool_get_extensions' as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()
    def tool_get_extensions(course_id: str, assignment_id: str) -> str:

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