canvas_create_quiz
Create and manage quizzes in Canvas courses by specifying course ID, title, type, time limit, and due date. Publish quizzes directly with a description for structured assessments.
Instructions
Create a new quiz in a course
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ID of the course | |
| description | No | Description of the quiz | |
| due_at | No | Due date (ISO format) | |
| published | No | Is the quiz published | |
| quiz_type | No | Type of the quiz (e.g., graded) | |
| time_limit | No | Time limit in minutes | |
| title | Yes | Title of the quiz |
Implementation Reference
- src/index.ts:570-623 (registration)Registration of canvas quiz tools including canvas_create_quiz with input schema// Quizzes { name: "canvas_list_quizzes", description: "List all quizzes in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] } }, { name: "canvas_get_quiz", description: "Get details of a specific quiz", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" }, quiz_id: { type: "number", description: "ID of the quiz" } }, required: ["course_id", "quiz_id"] } }, { name: "canvas_create_quiz", description: "Create a new quiz in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" }, title: { type: "string", description: "Title of the quiz" }, quiz_type: { type: "string", description: "Type of the quiz (e.g., graded)" }, time_limit: { type: "number", description: "Time limit in minutes" }, published: { type: "boolean", description: "Is the quiz published" }, description: { type: "string", description: "Description of the quiz" }, due_at: { type: "string", description: "Due date (ISO format)" } }, required: ["course_id", "title"] } }, { name: "canvas_start_quiz_attempt", description: "Start a new quiz attempt", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" }, quiz_id: { type: "number", description: "ID of the quiz" } }, required: ["course_id", "quiz_id"] } },
- src/client.ts:707-712 (handler)Handler logic for creating a quiz using Canvas API POST requestasync createQuiz(courseId: number, quizData: Partial<CanvasQuiz>): Promise<CanvasQuiz> { const response = await this.client.post(`/courses/${courseId}/quizzes`, { quiz: quizData }); return response.data; }
- src/types.ts:292-316 (helper)Type definition for CanvasQuiz used in createQuizexport interface CanvasQuiz { id: number; title: string; html_url: string; quiz_type: CanvasQuizType; assignment_id?: number; time_limit: number | null; published: boolean; description: string | null; due_at: string | null; lock_at: string | null; unlock_at: string | null; points_possible: number; question_count: number; allowed_attempts: number; scoring_policy: 'keep_highest' | 'keep_latest'; show_correct_answers: boolean; show_correct_answers_at: string | null; hide_correct_answers_at: string | null; shuffle_answers: boolean; has_access_code: boolean; ip_filter?: string; locked_for_user: boolean; lock_explanation?: string; }
- src/index.ts:595-610 (schema)Input schema definition for the canvas_create_quiz toolname: "canvas_create_quiz", description: "Create a new quiz in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" }, title: { type: "string", description: "Title of the quiz" }, quiz_type: { type: "string", description: "Type of the quiz (e.g., graded)" }, time_limit: { type: "number", description: "Time limit in minutes" }, published: { type: "boolean", description: "Is the quiz published" }, description: { type: "string", description: "Description of the quiz" }, due_at: { type: "string", description: "Due date (ISO format)" } }, required: ["course_id", "title"] } },
- src/index.ts:1071-1075 (registration)Registration of all tools list handler which includes canvas_create_quizthis.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); // Handle tool calls with comprehensive error handling