canvas_list_pages
Retrieve a list of pages within a Canvas course using the course ID to organize and manage course content efficiently through the Canvas LMS API.
Instructions
List pages 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:319-328 (registration)Registration of the canvas_list_pages tool including its name, description, and input schema requiring course_id.{ name: "canvas_list_pages", description: "List pages in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] }
- src/index.ts:1270-1278 (handler)Handler for canvas_list_pages tool: extracts course_id, calls client.listPages, returns JSON stringified pages.case "canvas_list_pages": { const { course_id } = args as { course_id: number }; if (!course_id) throw new Error("Missing required field: course_id"); const pages = await this.client.listPages(course_id); return { content: [{ type: "text", text: JSON.stringify(pages, null, 2) }] }; }
- src/client.ts:428-431 (helper)CanvasClient.listPages implementation: makes GET request to /courses/{courseId}/pages and returns the pages data.async listPages(courseId: number): Promise<CanvasPage[]> { const response = await this.client.get(`/courses/${courseId}/pages`); return response.data; }
- src/types.ts:354-367 (schema)TypeScript interface definition for CanvasPage, the return type of listPages.export interface CanvasPage { page_id: number; url: string; title: string; body: string; created_at: string; updated_at: string; published: boolean; front_page: boolean; locked_for_user: boolean; lock_explanation?: string; editing_roles: string; html_url: string; }