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
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | Yes | ID of the account | |
| completed | No | Include completed courses | |
| order | No | Sort direction | |
| published | No | Only include published courses | |
| search_term | No | Search term to filter courses | |
| sort | No | Sort order | |
| with_enrollments | No | Include enrollment data |
Input Schema (JSON Schema)
{
"properties": {
"account_id": {
"description": "ID of the account",
"type": "number"
},
"completed": {
"description": "Include completed courses",
"type": "boolean"
},
"order": {
"description": "Sort direction",
"enum": [
"asc",
"desc"
],
"type": "string"
},
"published": {
"description": "Only include published courses",
"type": "boolean"
},
"search_term": {
"description": "Search term to filter courses",
"type": "string"
},
"sort": {
"description": "Sort order",
"enum": [
"course_name",
"sis_course_id",
"teacher",
"account_name"
],
"type": "string"
},
"with_enrollments": {
"description": "Include enrollment data",
"type": "boolean"
}
},
"required": [
"account_id"
],
"type": "object"
}
Implementation Reference
- src/client.ts:759-763 (handler)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; }
- src/index.ts:1383-1393 (handler)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"] } },
- src/types.ts:781-799 (schema)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'; }