Skip to main content
Glama

tool_get_question_rubric

Retrieve grading rubric items for a specific question using course and question IDs, enabling instructors to access rubric data without requiring a submission ID.

Instructions

Get rubric items for a question without needing a submission ID.

Auto-discovers a submission to extract rubric data. Use when you know
the question_id from outline but don't have a submission ID yet.

Args:
    course_id: The Gradescope course ID.
    question_id: The question ID from outline.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
question_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function `get_question_rubric` fetches and returns the rubric items for a given question ID by auto-discovering a valid submission or by parsing the grading page.
    def get_question_rubric(course_id: str, question_id: str) -> str:
        """Get rubric items for a question without requiring a submission ID.
    
        Useful when you know the question_id from get_assignment_outline but
        don't have a specific submission ID. Auto-discovers a submission to
        extract rubric data.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID from outline.
        """
        if not course_id or not question_id:
            return "Error: both course_id and question_id are required."
    
        try:
            conn = get_connection()
            ctx = None
    
            # Path 1: submissions page
            url1 = (
                f"{conn.gradescope_base_url}/courses/{course_id}"
                f"/questions/{question_id}/submissions"
            )
            resp = conn.session.get(url1)
            if resp.status_code == 200:
                match = re.search(
                    rf"/courses/{course_id}/questions/{question_id}/submissions/(\d+)/grade",
                    resp.text,
                )
                if match:
                    ctx = _get_grading_context(course_id, question_id, match.group(1))
    
            # Path 2: grade page (may redirect to a specific submission)
            if ctx is None:
                url2 = (
                    f"{conn.gradescope_base_url}/courses/{course_id}"
                    f"/questions/{question_id}/grade"
                )
                resp2 = conn.session.get(url2, allow_redirects=True)
                if resp2.status_code == 200:
                    sub_match = re.search(
                        rf"/questions/{question_id}/submissions/(\d+)",
                        resp2.url,
                    )
                    if sub_match:
                        ctx = _get_grading_context(
                            course_id, question_id, sub_match.group(1)
                        )
                    else:
                        # Check if the page itself has SubmissionGrader props
                        from bs4 import BeautifulSoup
                        soup = BeautifulSoup(resp2.text, "html.parser")
                        grader = soup.find(attrs={"data-react-class": "SubmissionGrader"})
                        if grader:
                            import json as _json
                            props = _json.loads(grader.get("data-react-props", "{}"))
                            rubric_items = props.get("rubric_items", [])
                            if rubric_items:
                                question = props.get("question", {})
                                ctx = {"props": props}
    
            if ctx is None:
                return (
                    f"No submissions found for question `{question_id}`. "
                    "Cannot access rubric. The question may be in a special "
                    "assignment type. Try using `get_submission_grading_context` "
                    "with a known Question Submission ID instead."
                )
        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 rubric: {e}"
    
        props = ctx["props"]
        question = props.get("question", {})
        # Use props.rubric_items (same source as grading context), fallback to question.rubric
        rubric_items = props.get("rubric_items", []) or question.get("rubric", [])
    
        if not rubric_items:
            return f"No rubric items found for question `{question_id}`. You can create them with `tool_create_rubric_item`."
    
        weight = question.get("weight", "?")
        scoring_type = question.get("scoring_type", "negative")
    
        lines = [f"## Rubric for Question `{question_id}`\n"]
        lines.append(f"**Weight:** {weight} pts")
        lines.append(f"**Scoring:** {scoring_type}\n")
        lines.append("| ID | Description | Points |")
        lines.append("|----|-------------|--------|")
    
        for item in rubric_items:
            desc = item.get("description", "(no description)")
            # Escape pipes in description
            desc = desc.replace("|", "\\|")
            lines.append(
                f"| `{item['id']}` | {desc} | {item.get('weight', 0)} |"
            )
    
        return "\n".join(lines)
  • Tool registration for `tool_get_question_rubric` in the MCP server.
    def tool_get_question_rubric(
        course_id: str,
        question_id: str,
    ) -> str:
        """Get rubric items for a question without needing a submission ID.
    
        Auto-discovers a submission to extract rubric data. Use when you know
        the question_id from outline but don't have a submission ID yet.
    
        Args:
            course_id: The Gradescope course ID.
            question_id: The question ID from outline.
        """
        return get_question_rubric(course_id, question_id)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the key behavioral trait: 'Auto-discovers a submission to extract rubric data,' which explains how it works without a submission ID. However, it doesn't cover other important aspects like authentication requirements, rate limits, error conditions, or what happens if no submission is found. The description adds some value but leaves significant gaps.

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 perfectly concise and well-structured. It starts with the core purpose, explains the auto-discovery mechanism, provides usage guidance, and lists parameter meanings—all in four brief sentences with zero wasted words. Every sentence earns its place by adding essential information.

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 tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is reasonably complete. It covers the purpose, usage context, and parameter meanings. The presence of an output schema means the description doesn't need to explain return values. However, it lacks details on behavioral aspects like error handling or permissions, which would be helpful for full completeness.

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 schema provides no parameter documentation. The description adds basic semantics: 'course_id: The Gradescope course ID' and 'question_id: The question ID from outline.' This clarifies what the parameters represent, but it doesn't provide format details, constraints, or examples. Since there are only 2 parameters, this minimal explanation is adequate for a baseline score.

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 rubric items for a question' with the specific constraint 'without needing a submission ID.' It distinguishes itself from sibling tools like 'tool_get_submission_grading_context' or 'tool_get_student_submission' that likely require submission IDs. However, it doesn't explicitly name these alternatives, preventing a perfect score.

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 explicit guidance on when to use this tool: 'Use when you know the question_id from outline but don't have a submission ID yet.' It clearly defines the prerequisite context (having a question_id but lacking a submission ID). It doesn't specify when NOT to use it or name alternative tools, which keeps it from a score of 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