Skip to main content
Glama

create_page

Add a new page to a Canvas course with custom HTML content, title, and publishing options for course organization.

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
NameRequiredDescriptionDefault
course_identifierYes
titleYes
bodyYes
publishedNo
front_pageNo
editing_rolesNoteachers

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'create_page' MCP tool. It creates a new wiki page in a Canvas course via POST /courses/{course_id}/pages, handles parameters with type hints and validation, formats response, and returns success message with page details.
    @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
  • Invocation of register_other_tools(mcp) in the main server setup, which defines and registers the create_page tool via @mcp.tool() decorator.
    register_other_tools(mcp)
  • Function signature and docstring defining the input schema (parameters with types and descriptions) and output as str for the create_page tool.
    async def create_page(course_identifier: str | int,
                         title: str,
                         body: str,
                         published: bool = True,
                         front_page: bool = False,
                         editing_roles: str = "teachers") -> str:

Tool Definition Quality

Score is being calculated. Check back soon.

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