create_page
Create a new page in a Canvas course with custom HTML content, publishing options, and editing permissions for course materials.
Instructions
Create a new page in a Canvas course.
Args:
course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
title: The title of the new page
body: The HTML content for the page
published: Whether the page should be published (default: True)
front_page: Whether this should be the course front page (default: False)
editing_roles: Who can edit the page (default: "teachers")
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | ||
| course_identifier | Yes | ||
| editing_roles | No | teachers | |
| front_page | No | ||
| published | No | ||
| title | Yes |
Implementation Reference
- Core handler function for the 'create_page' MCP tool. Handles Canvas API POST to /courses/{course_id}/pages with wiki_page data, processes response, and formats success message.@mcp.tool() @validate_params async def create_page(course_identifier: str | int, title: str, body: str, published: bool = True, front_page: bool = False, editing_roles: str = "teachers") -> str: """Create a new page in a Canvas course. Args: course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID title: The title of the new page body: The HTML content for the page published: Whether the page should be published (default: True) front_page: Whether this should be the course front page (default: False) editing_roles: Who can edit the page (default: "teachers") """ course_id = await get_course_id(course_identifier) data = { "wiki_page": { "title": title, "body": body, "published": published, "front_page": front_page, "editing_roles": editing_roles } } response = await make_canvas_request("post", f"/courses/{course_id}/pages", data=data) if "error" in response: return f"Error creating page: {response['error']}" page_url = response.get("url", "") page_title = response.get("title", title) created_at = format_date(response.get("created_at")) published_status = "Published" if response.get("published", False) else "Unpublished" course_display = await get_course_code(course_id) or course_identifier result = f"Successfully created page in Course {course_display}:\n\n" result += f"Title: {page_title}\n" result += f"URL: {page_url}\n" result += f"Status: {published_status}\n" result += f"Created: {created_at}\n" if front_page: result += "Set as front page: Yes\n" return result
- src/canvas_mcp/server.py:50-50 (registration)Registration call for other_tools module within register_all_tools, which defines and registers the create_page tool via @mcp.tool() decorator.register_other_tools(mcp)
- src/canvas_mcp/tools/other_tools.py:13-13 (registration)The register_other_tools function that contains the definition of create_page and applies the @mcp.tool() decorator for registration.def register_other_tools(mcp: FastMCP):