publish_exam_lesson
Create or update a Moodle quiz from GIFT text, then repair and promote it so students can attempt it immediately. Idempotent by course and slug.
Instructions
Create or update a quiz and populate it with GIFT questions in one call. Runs plugin repair+promote steps after import so the quiz is immediately attemptable. Idempotent by (course_id, slug).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"course_id": "<course_id>",
"slug": "<slug>",
"name": "<name>",
"gift_text": "<gift_text>"
},
"name": "publish_exam_lesson"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| slug | Yes | Stable slug for this quiz. Same slug → same quiz (idempotent). | |
| grade | No | ||
| intro | No | ||
| visible | No | ||
| attempts | No | ||
| course_id | Yes | ||
| gift_text | Yes | GIFT-formatted question block. Will be imported into the quiz. | |
| grademethod | No | highest | |
| section_num | No | ||
| category_name | No | ||
| repair_sections | No | After import, call repair_quiz_sections to ensure the quiz has a default quiz_sections row (fixes "noquestionsfound" attempts). | |
| promote_questions | No | After import, promote question_versions from draft to ready (makes them visible in attempts). | |
| timelimit_seconds | No |