get_page_content
Retrieve the complete content body of a specific page from a Canvas course using either the course code or ID and page URL or identifier.
Instructions
Get the full content body 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
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_identifier | Yes | ||
| page_url_or_id | Yes |
Implementation Reference
- The core handler function for the 'get_page_content' MCP tool. It fetches the content of a Canvas course page using the Canvas API and formats the response with title, status, and course information. Registered via @mcp.tool() decorator inside register_other_tools.@mcp.tool() @validate_params async def get_page_content(course_identifier: str | int, page_url_or_id: str) -> str: """Get the full content body 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 """ course_id = await get_course_id(course_identifier) response = await make_canvas_request("get", f"/courses/{course_id}/pages/{page_url_or_id}") if "error" in response: return f"Error fetching page content: {response['error']}" title = response.get("title", "Untitled") body = response.get("body", "") published = response.get("published", False) if not body: return f"Page '{title}' has no content." course_display = await get_course_code(course_id) or course_identifier status = "Published" if published else "Unpublished" return f"Page Content for '{title}' in Course {course_display} ({status}):\n\n{body}"
- src/canvas_mcp/server.py:50-50 (registration)Top-level registration call to register_other_tools(mcp) in the register_all_tools function of the main server.py file, which triggers the definition and registration of the get_page_content tool.register_other_tools(mcp)
- src/canvas_mcp/tools/other_tools.py:13-13 (registration)The registration function register_other_tools that contains the nested definition of the get_page_content handler with @mcp.tool() decorator.def register_other_tools(mcp: FastMCP):