Skip to main content
Glama

delete_page

Destructive

Delete a Canvas course page by specifying the course identifier and page URL or ID. Optionally require exact title match as a safety check.

Instructions

Delete a page from a Canvas course.

    Permanent — Canvas may retain a recycle-bin copy depending on admin settings.

    Args:
        course_identifier: Course code or Canvas ID
        page_url_or_id: Page URL slug or page ID to delete
        require_title_match: Safety check — only delete if page title matches exactly
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_identifierYes
page_url_or_idYes
require_title_matchNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The delete_page handler function that executes the tool logic: fetches page details, performs a safety title match check, then sends a DELETE request to the Canvas API.
    async def delete_page(
        course_identifier: str | int,
        page_url_or_id: str,
        require_title_match: str | None = None
    ) -> str:
        """Delete a page from a Canvas course.
    
        Permanent — Canvas may retain a recycle-bin copy depending on admin settings.
    
        Args:
            course_identifier: Course code or Canvas ID
            page_url_or_id: Page URL slug or page ID to delete
            require_title_match: Safety check — only delete if page title matches exactly
        """
        course_id = await get_course_id(course_identifier)
    
        # Fetch page details first for confirmation and safety check
        page = await make_canvas_request(
            "get", f"/courses/{course_id}/pages/{page_url_or_id}"
        )
    
        if "error" in page:
            return f"Error fetching page details: {page['error']}"
    
        page_title = page.get("title", "Unknown Title")
        page_url = page.get("url", page_url_or_id)
    
        # Safety check: verify title match if requested
        if require_title_match and page_title != require_title_match:
            return (
                f"❌ Title mismatch — deletion aborted.\n\n"
                f"  Expected: {require_title_match}\n"
                f"  Actual:   {page_title}\n\n"
                f"  Page URL: {page_url}"
            )
    
        # Proceed with deletion
        response = await make_canvas_request(
            "delete", f"/courses/{course_id}/pages/{page_url_or_id}"
        )
    
        if "error" in response:
            return f"Error deleting page '{page_title}': {response['error']}"
    
        course_display = await get_course_code(course_id) or course_identifier
        return (
            f"✅ Page deleted successfully!\n\n"
            f"  **{page_title}**\n"
            f"  Course: {course_display}\n"
            f"  URL slug: {page_url}\n"
            f"  Status: deleted"
        )
  • The @mcp.tool decorator with destructiveHint=True annotation and @validate_params decorator, plus the function signature defining the input schema.
    @mcp.tool(annotations=ToolAnnotations(destructiveHint=True))
    @validate_params
    async def delete_page(
        course_identifier: str | int,
        page_url_or_id: str,
        require_title_match: str | None = None
    ) -> str:
  • Registration of the page tools (including delete_page) via register_page_tools(mcp) call, only for educator or all roles.
    register_page_tools(mcp)
    register_educator_page_crud_tools(mcp)
  • The register_educator_page_crud_tools function that defines delete_page (and other page CRUD tools) and registers them via @mcp.tool decorators.
    def register_educator_page_crud_tools(mcp: FastMCP):
Behavior4/5

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

Annotations provide destructiveHint: true, but the description adds important context: the deletion is permanent (though Canvas may retain a recycle-bin copy) and describes the safety require_title_match parameter.

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

Conciseness4/5

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

The description is concise with front-loaded purpose, includes a brief note on permanence, and uses a clear Args list. Minor improvement could combine the first two sentences.

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

Completeness3/5

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

For a delete tool with an output schema, the description covers key aspects (purpose, parameters, safety, permanence) but does not address return values or error behaviors. Adequate but not overly complete.

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 coverage is 0%, so the description carries full burden. It explains course_identifier as 'Course code or Canvas ID', page_url_or_id as 'Page URL slug or page ID', and require_title_match as 'Safety check — only delete if page title matches exactly', adding essential meaning.

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 'Delete a page from a Canvas course' with a specific verb and resource, distinguishing it from sibling tools like delete_announcement or delete_module.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives (e.g., when to use create_page or update_page). The description lacks explicit usage context or exclusions.

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/vishalsachdev/canvas-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server