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
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ||
| assignment_id | Yes |
Implementation Reference
- src/gradescope_mcp/server.py:139-149 (handler)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( - src/gradescope_mcp/server.py:138-139 (registration)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: