Skip to main content
Glama

get_page_details

Retrieve detailed information about a specific page in a Canvas course using the course identifier and page URL or ID.

Instructions

Get detailed information about 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
NameRequiredDescriptionDefault
course_identifierYes
page_url_or_idYes

Implementation Reference

  • Handler function for the 'get_page_details' tool. Fetches page details from Canvas API using make_canvas_request, processes and formats the response including title, URL, status, dates, editor info, and a content preview.
    @mcp.tool()
    @validate_params
    async def get_page_details(course_identifier: str | int, page_url_or_id: str) -> str:
        """Get detailed information about 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 details: {response['error']}"
    
        title = response.get("title", "Untitled")
        url = response.get("url", "N/A")
        body = response.get("body", "")
        created_at = format_date(response.get("created_at"))
        updated_at = format_date(response.get("updated_at"))
        published = response.get("published", False)
        front_page = response.get("front_page", False)
        locked_for_user = response.get("locked_for_user", False)
        editing_roles = response.get("editing_roles", "")
    
        # Handle last edited by user info
        last_edited_by = response.get("last_edited_by", {})
        editor_name = last_edited_by.get("display_name", "Unknown") if last_edited_by else "Unknown"
    
        # Clean up body text for display
        if body:
            # Remove HTML tags for cleaner display
            import re
            body_clean = re.sub(r'<[^>]+>', '', body)
            body_clean = body_clean.strip()
            if len(body_clean) > 500:
                body_clean = body_clean[:500] + "..."
        else:
            body_clean = "No content"
    
        status_info = []
        if published:
            status_info.append("Published")
        else:
            status_info.append("Unpublished")
    
        if front_page:
            status_info.append("Front Page")
    
        if locked_for_user:
            status_info.append("Locked")
    
        course_display = await get_course_code(course_id) or course_identifier
    
        result = f"Page Details for Course {course_display}:\n\n"
        result += f"Title: {title}\n"
        result += f"URL: {url}\n"
        result += f"Status: {', '.join(status_info)}\n"
        result += f"Created: {created_at}\n"
        result += f"Updated: {updated_at}\n"
        result += f"Last Edited By: {editor_name}\n"
        result += f"Editing Roles: {editing_roles or 'Not specified'}\n"
        result += f"\nContent Preview:\n{body_clean}"
    
        return result
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