Skip to main content
Glama

tool_get_assignment_submissions

Retrieve all student submissions for a specific assignment in Gradescope, providing submission IDs and file counts for instructor or TA review.

Instructions

Get all submissions for an assignment (instructor/TA only).

Returns a list of submission IDs and file counts.
Note: May be slow for large classes as it fetches each submission individually.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
assignment_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core implementation of get_assignment_submissions that fetches submission data from the Gradescope API.
    def get_assignment_submissions(course_id: str, assignment_id: str) -> str:
        """Get all submissions for an assignment (instructor/TA only).
    
        Works for all assignment types: scanned PDF, online, and code assignments.
        Returns submission IDs, graded status, and grading progress.
    
        Note: The returned IDs are **Global Submission IDs** (the whole assignment
        submission). For grading a specific question, you may need the per-question
        submission ID from `get_submission_grading_context`.
    
        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()
            # Primary: submissions.json (works for scanned PDF/image assignments)
            resp = conn.session.get(
                f"{conn.gradescope_base_url}/courses/{course_id}"
                f"/assignments/{assignment_id}/submissions.json",
                headers={
                    "Accept": "application/json",
                    "X-Requested-With": "XMLHttpRequest",
                },
            )
    
            if resp.status_code == 200:
                return _format_submissions_json(resp.json(), assignment_id, course_id)
    
            # Fallback: scrape review_grades HTML table (works for online assignments)
            return _get_submissions_from_review_grades(conn, course_id, assignment_id)
    
        except AuthError as e:
            return f"Authentication error: {e}"
        except Exception as e:
            return f"Error fetching submissions: {e}"
    
    
    def _format_submissions_json(data: dict, assignment_id: str, course_id: str) -> str:
        """Format submission data from the submissions.json endpoint."""
        detailed = data.get("detailed_submissions", {})
        basic = data.get("submissions", {})
    
        if not detailed and not basic:
            return f"No submissions found for assignment `{assignment_id}` in course `{course_id}`."
    
        subs = detailed or basic
        total = len(subs)
  • The registration of the tool_get_assignment_submissions function as an MCP tool using the @mcp.tool decorator.
    @mcp.tool()
    def tool_get_assignment_submissions(
        course_id: str, assignment_id: str
    ) -> str:
        """Get all submissions for an assignment (instructor/TA only).
    
        Returns a list of submission IDs and file counts.
        Note: May be slow for large classes as it fetches each submission individually.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
        """
        return get_assignment_submissions(course_id, assignment_id)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: access restrictions ('instructor/TA only'), performance characteristics ('May be slow for large classes'), and return format ('Returns a list of submission IDs and file counts'). This covers important operational context beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured: purpose statement first, return format second, performance note third, and parameter explanations last. Every sentence adds value with zero waste, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters, no annotations, and an output schema (which handles return values), the description is reasonably complete. It covers purpose, access, performance, and parameters. It could mention pagination or error cases, but for a read-only tool with output schema, it's mostly adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It documents both parameters (course_id, assignment_id) with brief explanations, adding meaning beyond the schema's titles. However, it doesn't provide format details, examples, or constraints, so it only partially compensates for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get all submissions for an assignment' with the specific resource (submissions) and verb (get). It distinguishes from siblings like 'tool_get_student_submission' (singular) and 'tool_get_assignment_details' (metadata). However, it doesn't explicitly contrast with all relevant siblings, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: 'instructor/TA only' specifies the required role, and 'May be slow for large classes' warns about performance limitations. It doesn't explicitly state when NOT to use it or name alternatives (e.g., 'tool_get_student_submission' for individual submissions), so it's not a full 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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