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
| Name | Required | Description | Default |
|---|---|---|---|
| course_identifier | Yes | ||
| page_url_or_id | Yes | ||
| new_content | Yes | ||
| title | No |
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}"
- src/canvas_mcp/server.py:50-50 (registration)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)
- src/canvas_mcp/server.py:27-27 (registration)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 """