edit_page_content
Update HTML content and title for specific pages in Canvas courses using course identifiers and page references to modify learning materials.
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 | ||
| new_content | Yes | ||
| page_url_or_id | Yes | ||
| title | No |
Implementation Reference
- The main handler function decorated with @mcp.tool() that implements the edit_page_content tool. It updates the content (and optionally title) of a Canvas course page using the Canvas API.@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) in the register_all_tools function, which triggers the definition and registration of the edit_page_content tool via its @mcp.tool() decorator.register_other_tools(mcp)
- src/canvas_mcp/tools/other_tools.py:13-13 (registration)The registration function that contains the definition of the edit_page_content tool handler. When called, it registers all 'other tools' including edit_page_content.def register_other_tools(mcp: FastMCP):