Skip to main content
Glama

canvas_list_account_courses

Retrieve and filter courses for a specific Canvas account. Manage course lists by publication status, enrollment data, completion status, search terms, and sorting preferences.

Instructions

List courses for an account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYesID of the account
completedNoInclude completed courses
orderNoSort direction
publishedNoOnly include published courses
search_termNoSearch term to filter courses
sortNoSort order
with_enrollmentsNoInclude enrollment data

Implementation Reference

  • Core handler function implementing the Canvas API call to list courses for a specific account.
    async listAccountCourses(args: ListAccountCoursesArgs): Promise<CanvasCourse[]> {
      const { account_id, ...params } = args;
      const response = await this.client.get(`/accounts/${account_id}/courses`, { params });
      return response.data;
    }
  • MCP tool call handler that validates input and delegates to CanvasClient.listAccountCourses.
    case "canvas_list_account_courses": {
      const accountCoursesArgs = args as unknown as ListAccountCoursesArgs;
      if (!accountCoursesArgs.account_id) {
        throw new Error("Missing required field: account_id");
      }
      
      const courses = await this.client.listAccountCourses(accountCoursesArgs);
      return {
        content: [{ type: "text", text: JSON.stringify(courses, null, 2) }]
      };
    }
  • src/index.ts:725-740 (registration)
    Tool registration in the MCP TOOLS array, defining name, description, and input schema.
      name: "canvas_list_account_courses",
      description: "List courses for an account",
      inputSchema: {
        type: "object",
        properties: {
          account_id: { type: "number", description: "ID of the account" },
          with_enrollments: { type: "boolean", description: "Include enrollment data" },
          published: { type: "boolean", description: "Only include published courses" },
          completed: { type: "boolean", description: "Include completed courses" },
          search_term: { type: "string", description: "Search term to filter courses" },
          sort: { type: "string", enum: ["course_name", "sis_course_id", "teacher", "account_name"], description: "Sort order" },
          order: { type: "string", enum: ["asc", "desc"], description: "Sort direction" }
        },
        required: ["account_id"]
      }
    },
  • TypeScript interface defining the input parameters for the listAccountCourses tool.
    export interface ListAccountCoursesArgs {
      account_id: number;
      with_enrollments?: boolean;
      enrollment_type?: string[];
      published?: boolean;
      completed?: boolean;
      blueprint?: boolean;
      blueprint_associated?: boolean;
      by_teachers?: number[];
      by_subaccounts?: number[];
      hide_enrollmentless_courses?: boolean;
      state?: ('created' | 'claimed' | 'available' | 'completed' | 'deleted' | 'all')[];
      enrollment_term_id?: number;
      search_term?: string;
      include?: string[];
      sort?: 'course_name' | 'sis_course_id' | 'teacher' | 'account_name';
      order?: 'asc' | 'desc';
      search_by?: 'course' | 'teacher';
    }
Install Server

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