tool_list_courses
Retrieve all Gradescope courses for authenticated users, organized by instructor or student roles with details like course ID, name, semester, and assignment counts.
Instructions
List all Gradescope courses for the authenticated user.
Returns courses grouped by role (instructor vs student), including course ID, name, semester, and assignment count.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The actual implementation of the logic for listing courses.
def list_courses() -> str: """List all courses for the authenticated user. Returns courses grouped by role (instructor vs student). """ try: conn = get_connection() courses = conn.account.get_courses() except AuthError as e: return f"Authentication error: {e}" except Exception as e: return f"Error fetching courses: {e}" lines = [] instructor_courses = courses.get("instructor", {}) if instructor_courses: lines.append("## Instructor Courses\n") for course_id, course in instructor_courses.items(): lines.append( f"- **{course.name}** ({course.full_name})\n" - src/gradescope_mcp/server.py:68-75 (registration)The registration of the 'tool_list_courses' tool using @mcp.tool() decorator.
@mcp.tool() def tool_list_courses() -> str: """List all Gradescope courses for the authenticated user. Returns courses grouped by role (instructor vs student), including course ID, name, semester, and assignment count. """ return list_courses()