Skip to main content
Glama

get_course_details

Retrieve comprehensive course information from Canvas LMS using a course code or ID to access details, materials, and structure.

Instructions

Get detailed information about a specific course.

    Args:
        course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_identifierYes

Implementation Reference

  • The MCP tool handler function for 'get_course_details'. Resolves course ID from identifier, fetches course details via Canvas API, updates caches, and formats output with key course properties.
    @mcp.tool()
    @validate_params
    async def get_course_details(course_identifier: str | int) -> str:
        """Get detailed information about a specific course.
    
        Args:
            course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
        """
        course_id = await get_course_id(course_identifier)
    
        response = await make_canvas_request("get", f"/courses/{course_id}")
    
        if "error" in response:
            return f"Error fetching course details: {response['error']}"
    
        # Update our caches with the course data
        if "id" in response and "course_code" in response:
            course_code_to_id_cache[response["course_code"]] = str(response["id"])
            id_to_course_code_cache[str(response["id"])] = response["course_code"]
    
        details = [
            f"Code: {response.get('course_code', 'N/A')}",
            f"Name: {response.get('name', 'N/A')}",
            f"Start Date: {format_date(response.get('start_at'))}",
            f"End Date: {format_date(response.get('end_at'))}",
            f"Time Zone: {response.get('time_zone', 'N/A')}",
            f"Default View: {response.get('default_view', 'N/A')}",
            f"Public: {response.get('is_public', False)}",
            f"Blueprint: {response.get('blueprint', False)}"
        ]
    
        # Prefer to show course code in the output
        course_display = response.get("course_code", course_identifier)
        return f"Course Details for {course_display}:\n\n" + "\n".join(details)
  • Top-level registration call in the server setup that invokes the course tools registration, including 'get_course_details'.
    register_course_tools(mcp)
  • Function signature and docstring defining the input schema (course_identifier: str | int) and description for the tool.
    async def get_course_details(course_identifier: str | int) -> str:
        """Get detailed information about a specific course.
    
        Args:
            course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID
        """
  • TypeScript API client helper function and interfaces for fetching course details, usable in code_execution tool.
    export interface GetCourseDetailsInput {
      courseIdentifier: string | number;
    }
    
    export interface CourseDetails {
      id: number;
      name: string;
      course_code: string;
      workflow_state: string;
      start_at?: string;
      end_at?: string;
      time_zone?: string;
      syllabus_body?: string;
      enrollment_term_id?: number;
    }
    
    /**
     * Get detailed information about a specific course.
     *
     * @param input - Course identifier (code or ID)
     * @returns Detailed course information including syllabus and timezone
     */
    export async function getCourseDetails(
      input: GetCourseDetailsInput
    ): Promise<CourseDetails> {
      const { courseIdentifier } = input;
      return canvasGet<CourseDetails>(`/courses/${courseIdentifier}`);
    }
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