Skip to main content
Glama

tool_get_submission_grading_context

Retrieve grading context for a submission, including rubric items, evaluations, scores, comments, and navigation URLs to prepare for grading.

Instructions

Get full grading context for a question submission.

Returns current rubric items (with IDs), applied evaluations, score,
comments, point adjustment, navigation URLs (next/prev/ungraded),
and submission page images. Use this before applying grades.

Args:
    course_id: The Gradescope course ID.
    question_id: The question ID.
    submission_id: The question submission ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
question_idYes
submission_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool definition for `tool_get_submission_grading_context` which acts as an entry point in the MCP server.
    def tool_get_submission_grading_context(
        course_id: str, question_id: str, submission_id: str
    ) -> str:
        """Get full grading context for a question submission.
    
        Returns current rubric items (with IDs), applied evaluations, score,
        comments, point adjustment, navigation URLs (next/prev/ungraded),
        and submission page images. Use this before applying grades.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID.
            submission_id: The question submission ID.
        """
        return get_submission_grading_context(course_id, question_id, submission_id)
  • The core implementation function `get_submission_grading_context` that fetches and processes grading context from Gradescope.
    def get_submission_grading_context(
        course_id: str,
        question_id: str,
        submission_id: str,
        output_format: str = "markdown",
    ) -> str:
        """Get the full grading context for a specific question submission.
    
        Returns the current rubric items, applied evaluations, score, comments,
        navigation URLs, and student info. This is what you need before grading.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID.
            submission_id: The question submission ID (NOT the assignment submission ID).
            output_format: "markdown" (default) or "json" for structured output.
        """
        if not course_id or not question_id or not submission_id:
            return "Error: course_id, question_id, and submission_id are required."
    
        try:
            ctx = _get_grading_context(course_id, question_id, submission_id)
        except AuthError as e:
            return f"Authentication error: {e}"
        except ValueError as e:
            return f"Error: {e}"
        except Exception as e:
            return f"Error fetching grading context: {e}"
    
        props = ctx["props"]
        question = props.get("question", {})
        submission = props.get("submission", {})
        evaluation = props.get("evaluation", {})
        nav = props.get("navigation_urls", {})
    
        # Rubric items + evaluations
        rubric_items = props.get("rubric_items", [])
        evaluations = props.get("rubric_item_evaluations", [])
        applied_ids = {e["rubric_item_id"] for e in evaluations if e.get("present")}
    
        # Navigation parsing — filter out self-referencing ungraded links
        # (Gradescope sets next_ungraded/previous_ungraded to the current
        # submission when it is itself ungraded, which misleads agents)
        nav_parsed = {}
        for label, key in [
            ("previous_ungraded", "previous_ungraded"),
            ("next_ungraded", "next_ungraded"),
            ("previous_submission", "previous_submission"),
            ("next_submission", "next_submission"),
            ("previous_question", "previous_question"),
            ("next_question", "next_question"),
        ]:
            url = nav.get(key, "")
            if url:
                qid_m = re.search(r"/questions/(\d+)", url)
                sid_m = re.search(r"/submissions/(\d+)", url)
                if qid_m and sid_m:
                    parsed_sid = sid_m.group(1)
                    # Skip self-referencing ungraded links
                    if key in ("previous_ungraded", "next_ungraded") and parsed_sid == submission_id:
                        continue
                    nav_parsed[label] = {
                        "question_id": qid_m.group(1),
                        "submission_id": parsed_sid,
Behavior3/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 describes the return data comprehensively (rubric items, evaluations, score, comments, navigation URLs, images) and implies a read-only operation, but does not disclose behavioral traits like authentication needs, rate limits, or error conditions.

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 front-loaded with the purpose, followed by a detailed list of returns, and ends with usage guidance and parameter explanations. Every sentence adds value with zero waste, making it efficient and well-structured.

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 the complexity (grading context tool), no annotations, and an output schema exists, the description is mostly complete. It details what the tool returns and when to use it, but lacks information on permissions, errors, or pagination that could enhance completeness.

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

Parameters4/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 lists all three parameters (course_id, question_id, submission_id) and clarifies they are IDs for Gradescope entities, adding meaning beyond the bare schema. However, it does not provide format examples or constraints.

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

Purpose5/5

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

The description clearly states the verb 'Get' and resource 'full grading context for a question submission', specifying it returns rubric items, evaluations, score, comments, navigation URLs, and images. It distinguishes from siblings like tool_apply_grade (which applies grades) and tool_get_question_rubric (which focuses only on rubric).

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 by stating 'Use this before applying grades', which implicitly guides when to use it relative to tool_apply_grade. However, it does not explicitly mention when not to use it or name alternative tools for similar purposes.

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