Skip to main content
Glama

edit_page_content

Modify Canvas course page content and titles by providing new HTML content and optional title updates for specific pages within courses.

Instructions

Edit the content of a specific page.

    Args:
        course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
        page_url_or_id: The page URL or page ID
        new_content: The new HTML content for the page
        title: Optional new title for the page
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_identifierYes
page_url_or_idYes
new_contentYes
titleNo

Implementation Reference

  • The main handler function for the 'edit_page_content' tool. It updates the content (and optionally title) of a Canvas course page using the PUT /courses/{course_id}/pages/{page_id} API endpoint.
    @mcp.tool()
    @validate_params
    async def edit_page_content(course_identifier: str | int,
                               page_url_or_id: str,
                               new_content: str,
                               title: str | None = None) -> str:
        """Edit the content of a specific page.
    
        Args:
            course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
            page_url_or_id: The page URL or page ID
            new_content: The new HTML content for the page
            title: Optional new title for the page
        """
        course_id = await get_course_id(course_identifier)
    
        # Prepare the data for updating the page
        update_data = {
            "wiki_page": {
                "body": new_content
            }
        }
    
        if title:
            update_data["wiki_page"]["title"] = title
    
        # Update the page
        response = await make_canvas_request(
            "put",
            f"/courses/{course_id}/pages/{page_url_or_id}",
            data=update_data
        )
    
        if "error" in response:
            return f"Error updating page: {response['error']}"
    
        page_title = response.get("title", "Unknown page")
        updated_at = format_date(response.get("updated_at"))
        course_display = await get_course_code(course_id) or course_identifier
    
        return f"Successfully updated page '{page_title}' in course {course_display}. Last updated: {updated_at}"
  • The call to register_other_tools(mcp) within register_all_tools, which defines and registers the edit_page_content tool (among other page tools) to the MCP server instance.
    register_other_tools(mcp)
  • Import of register_other_tools from the tools module in the main server.py file.
    register_other_tools,
  • The docstring parameters define the input schema for the tool.
    """Edit the content of a specific page.
    
    Args:
        course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
        page_url_or_id: The page URL or page ID
        new_content: The new HTML content for the page
        title: Optional new title for the page
    """
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