get_page
Retrieve a specific wiki page from a Canvas course using the page's URL slug.
Instructions
Fetch a course wiki page by its url slug.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ||
| page_url | Yes |
Implementation Reference
- canvas_local_mcp/server.py:122-125 (handler)The tool handler for 'get_page'. Calls the Canvas API to fetch a course wiki page by its URL slug.
@mcp.tool() def get_page(course_id: int, page_url: str) -> dict: """Fetch a course wiki page by its url slug.""" return _get(f"/api/v1/courses/{course_id}/pages/{page_url}") - canvas_local_mcp/server.py:122-122 (registration)Registration: decorator @mcp.tool() registers the function as an MCP tool named 'get_page'.
@mcp.tool() - canvas_local_mcp/server.py:30-49 (helper)Helper function _get() used by get_page to make authenticated HTTP GET requests to the Canvas API, with pagination support.
def _get(path: str, **params) -> Any: params.setdefault("per_page", 100) url = f"{BASE}{path}" out = [] with httpx.Client(headers=HEAD, timeout=30) as c: while url: r = c.get(url, params=params) r.raise_for_status() data = r.json() if isinstance(data, list): out.extend(data) else: return data url = None params = {} link = r.headers.get("Link", "") for part in link.split(","): if 'rel="next"' in part: url = part[part.find("<")+1:part.find(">")] return out