Skip to main content
Glama

tool_get_assignment_outline

Retrieve the hierarchical question structure, rubric outline, IDs, types, and weights for a Gradescope assignment to understand its organization and requirements.

Instructions

Get the question/rubric outline for an assignment.

Returns the hierarchical question structure with IDs, types, weights, and
question text. Essential for understanding how an assignment is structured.
Requires instructor/TA access.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
assignment_idYes

Implementation Reference

  • The handler implementation for `tool_get_assignment_outline` which fetches assignment structure and formats it into a markdown outline.
    def get_assignment_outline(course_id: str, assignment_id: str) -> str:
        """Get the question/rubric outline for an assignment.
    
        Returns the hierarchical question structure with IDs, types, weights,
        and question text. This is the foundation for rubric creation and grading.
    
        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:
            props = _get_outline_data(course_id, assignment_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 outline: {e}"
    
        questions = props.get("questions", {})
        if not questions:
            return f"No questions found for assignment `{assignment_id}`."
    
        tree = _build_question_tree(questions)
    
        # Format output
        assignment_info = props.get("assignment", {})
        lines = [f"## Assignment Outline\n"]
    
        if assignment_info:
            atype = assignment_info.get("type", "Unknown")
            lines.append(f"**Type:** {atype}")
    
        lines.append(f"**Total questions:** {len(questions)}\n")
    
        group_num = 0
        for group in tree:
            group_num += 1
            group_title = group["title"] or f"Question Group {group_num}"
            group_weight = group["weight"]
            lines.append(f"### {group_title} ({group_weight} pts)\n")
    
            if group["children"]:
                lines.append("| # | Question ID | Weight | Type | Question Text |")
                lines.append("|---|-------------|--------|------|---------------|")
                for i, child in enumerate(group["children"], 1):
                    text = _extract_text_content(child["content"])
                    # Truncate for table display
                    if len(text) > 120:
                        text = text[:117] + "..."
                    # Escape pipes in text
                    text = text.replace("|", "\\|")
                    lines.append(
                        f"| {group_num}.{i} | `{child['id']}` | {child['weight']} | "
                        f"{child['type']} | {text} |"
                    )
                lines.append("")
            else:
                # It's a standalone question (no children)
                if group["id"]:
                    lines.append(f"**Question ID:** `{group['id']}`")
                text = _extract_text_content(group["content"])
                if text:
                    lines.append(f"_{text[:200]}_\n")
                else:
                    lines.append("")
    
        return "\n".join(lines)
  • Tool registration for `tool_get_assignment_outline` in the MCP server.
    def tool_get_assignment_outline(course_id: str, assignment_id: str) -> str:
        """Get the question/rubric outline for an assignment.
    
        Returns the hierarchical question structure with IDs, types, weights, and
        question text. Essential for understanding how an assignment is structured.
        Requires instructor/TA access.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
        """
        return get_assignment_outline(course_id, assignment_id)

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