Skip to main content
Glama

tool_cache_relevant_pages

Download exam page images and adjacent pages to local storage for review, enabling agents to inspect scanned content before grading assignments.

Instructions

Download the crop page and neighboring pages to /tmp for local review.

This is useful for scanned exams where the prompt is only available in page
images and where agents may need to inspect adjacent pages before grading.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
assignment_idYes
question_idYes
submission_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of the tool logic.
    def cache_relevant_pages(
        course_id: str,
        assignment_id: str,
        question_id: str,
        submission_id: str,
    ) -> str:
        """Download the crop page and its neighbors to /tmp for local inspection."""
        if not course_id or not assignment_id or not question_id or not submission_id:
            return (
                "Error: course_id, assignment_id, question_id, and submission_id "
                "are required."
            )
    
        try:
            ctx = _get_grading_context(course_id, question_id, submission_id)
            conn = get_connection()
        except AuthError as e:
            return f"Authentication error: {e}"
        except ValueError as e:
            return f"Error: {e}"
        except Exception as e:
            return f"Error caching relevant pages: {e}"
    
        props = ctx["props"]
        question = props.get("question", {})
        parameters = question.get("parameters") or {}
        crop_rects = parameters.get("crop_rect_list", [])
        pages = [
            page for page in props.get("pages", [])
            if isinstance(page, dict) and page.get("url")
        ]
        relevant_pages = _select_relevant_pages(pages, crop_rects)
        if not relevant_pages:
            return "No relevant pages were found for this submission."
  • The MCP tool registration and handler wrapper for tool_cache_relevant_pages.
    @mcp.tool()
    def tool_cache_relevant_pages(
        course_id: str,
        assignment_id: str,
        question_id: str,
        submission_id: str,
    ) -> str:
        """Download the crop page and neighboring pages to /tmp for local review.
    
        This is useful for scanned exams where the prompt is only available in page
        images and where agents may need to inspect adjacent pages before grading.
    
        Args:
            course_id: The Gradescope course ID.
            assignment_id: The assignment ID.
            question_id: The question ID.
            submission_id: The question submission ID.
        """
        return cache_relevant_pages(
            course_id, assignment_id, question_id, submission_id
        )
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 discloses the tool downloads files to /tmp for local review, which implies read-only caching behavior. However, it doesn't mention permissions needed, rate limits, file cleanup, or error handling, leaving gaps for a tool that interacts with file systems.

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 well-structured and front-loaded with the core action, followed by usage context and parameter list. Every sentence adds value without redundancy, making it efficient and easy to parse.

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 4 parameters with 0% schema coverage and no annotations, the description does a good job explaining purpose and usage. The presence of an output schema means return values don't need description. However, it lacks details on error cases or system interactions, which could be important for a file-download tool.

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 four parameters (course_id, assignment_id, question_id, submission_id) in the Args section, providing basic semantics. However, it doesn't explain what these IDs represent or their formats, which limits understanding.

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 downloads specific pages to a local directory for review, with a specific verb ('Download') and resource ('crop page and neighboring pages'). It distinguishes from siblings by focusing on page caching rather than grading or management tasks, though it doesn't explicitly name alternatives.

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 for when to use this tool: for scanned exams where prompts are in page images and agents need to inspect adjacent pages before grading. It doesn't explicitly state when not to use it or name specific alternatives among siblings, but the context is well-defined.

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