canvas_list_modules
Retrieve all course modules within Canvas LMS by providing the course ID. Simplify course management and module tracking with this API integration tool.
Instructions
List all modules in a course
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ID of the course |
Input Schema (JSON Schema)
{
"properties": {
"course_id": {
"description": "ID of the course",
"type": "number"
}
},
"required": [
"course_id"
],
"type": "object"
}
Implementation Reference
- src/index.ts:458-467 (registration)Registration of the 'canvas_list_modules' tool in the TOOLS array, including name, description, and input schema definition.name: "canvas_list_modules", description: "List all modules in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] } },
- src/client.ts:613-620 (handler)Core handler function that executes the Canvas API call to list modules for a given course ID. Called by the MCP tool handler.async listModules(courseId: number): Promise<CanvasModule[]> { const response = await this.client.get(`/courses/${courseId}/modules`, { params: { include: ['items'] } }); return response.data; }
- src/index.ts:460-467 (schema)Input schema validation for the canvas_list_modules tool, requiring course_id.inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] } },
- src/types.ts:236-251 (helper)Type definition for CanvasModule, used in the return type of listModules.export interface CanvasModule { id: number; name: string; position: number; unlock_at: string | null; require_sequential_progress: boolean; prerequisite_module_ids: number[]; state: CanvasModuleState; completed_at: string | null; items_count: number; items_url: string; items?: CanvasModuleItem[]; } export type CanvasModuleState = 'locked' | 'unlocked' | 'started' | 'completed';