Skip to main content
Glama

canvas_list_courses

Retrieve a list of all courses for the current user in Canvas, with the option to include ended courses, enabling efficient course management and navigation within the learning management system.

Instructions

List all courses for the current user

Input Schema

NameRequiredDescriptionDefault
include_endedNoInclude ended courses

Input Schema (JSON Schema)

{ "properties": { "include_ended": { "description": "Include ended courses", "type": "boolean" } }, "required": [], "type": "object" }

Implementation Reference

  • src/index.ts:51-61 (registration)
    Registration of the canvas_list_courses tool in the TOOLS array, including name, description, and input schema.
    { name: "canvas_list_courses", description: "List all courses for the current user", inputSchema: { type: "object", properties: { include_ended: { type: "boolean", description: "Include ended courses" } }, required: [] } },
  • MCP server handler that processes the tool call, extracts arguments, calls CanvasClient.listCourses, and returns JSON response.
    case "canvas_list_courses": { const { include_ended = false } = args as { include_ended?: boolean }; const courses = await this.client.listCourses(include_ended); return { content: [{ type: "text", text: JSON.stringify(courses, null, 2) }] }; }
  • Core implementation in CanvasClient that makes the API call to Canvas /courses endpoint with appropriate parameters based on includeEnded flag.
    async listCourses(includeEnded: boolean = false): Promise<CanvasCourse[]> { const params: any = { include: ['total_students', 'teachers', 'term', 'course_progress'] }; if (!includeEnded) { params.state = ['available', 'completed']; } const response = await this.client.get('/courses', { params }); return response.data; }
  • TypeScript interface defining the CanvasCourse type returned by the listCourses method.
    export interface CanvasCourse { readonly id: CourseId; readonly name: string; readonly course_code: string; readonly workflow_state: CanvasCourseState; readonly account_id: number; readonly start_at: string | null; readonly end_at: string | null; readonly enrollments?: ReadonlyArray<CanvasEnrollment>; readonly total_students?: number; readonly syllabus_body?: string; readonly term?: CanvasTerm; readonly course_progress?: CanvasCourseProgress; }

Other Tools

Related 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/DMontgomery40/mcp-canvas-lms'

If you have feedback or need assistance with the MCP directory API, please join our Discord server