38 commands · JSON on stdout

CLI commands

The upb-moodle CLI command reference is generated from the real parser: the names, options and help text come from src/upb_moodle/cli.py. Every command writes JSON on stdout, and errors go to stderr.

How to read the table

Each row is a subcommand with its options. Options that take a value show the kind after the name: --year N takes a number, --faculty TEXT takes text, --answers JSON takes a JSON object. Options without a value are flags.

Per-harness commands (claude, codex, opencode, opencode2, antigravity) carry only the options that make sense for that CLI. An unsupported scope is refused by the parser, not ignored.

Exit codes

The codes are the ones in docs/USAGE.md and in main() in cli.py.
CodeMeaning
0success
1Moodle error, missing token, missing file or drafts disabled
2write blocked: --yes is missing
3install, update or doctor found a problem

Account

CommandOptionsWhat it does
upb-moodle login--method auto|browser|manual --timeout N --token TOKEN --token-stdin --base-url URLObtain the token in a browser, or save an existing one from --token or stdin.
upb-moodle logout--forget-browserDelete the saved token, and optionally the UPB browser session.
upb-moodle auth-status—Check the saved token with a real call.
upb-moodle whoami—Show the account, the site and the number of available Web Service functions.

Courses and materials

CommandOptionsWhat it does
upb-moodle courses--year N --sem N --ay AN --faculty FACULTY --program PROGRAM --series SERIES --search TEXTList the enrolled courses, filtered by faculty, programme, year, semester, series or name.
upb-moodle outlinecourse_idRaw course structure: sections, modules, contents, file URLs.
upb-moodle download--year N --sem N --ay AN --faculty FACULTY --program PROGRAM --series SERIES --course N --out DIR --shallowDownload course materials in parallel; a second run skips complete files.

Assignments

CommandOptionsWhat it does
upb-moodle assignments--course NAssignments with due dates, submission types, instructions.
upb-moodle assignmentassign_idSubmission state for one assignment: drafts, submitted files or text, grade, feedback.
upb-moodle submitassign_id file --submit --allow-direct --yesUpload a file as the assignment submission; a draft unless --submit.
upb-moodle submit-textassign_id --text TEXT --file FILE --submit --allow-direct --yesWrite the online-text submission for an assignment.

Forums

CommandOptionsWhat it does
upb-moodle forums--course NList the forums of the given courses or of every course.
upb-moodle forumforum_idThe discussions of one forum.
upb-moodle discussiondiscussion_idOne discussion's posts, with text and attachments.
upb-moodle replypost_id --subject TEXT --text TEXT --file FILE --yesReply to a forum post; needs --yes after you approve the message.
upb-moodle new-discussionforum_id --subject TEXT --text TEXT --file FILE --yesStart a new forum discussion; needs --yes after you approve the message.

Grades

CommandOptionsWhat it does
upb-moodle grades--course NEvery course's grades, or one course's grade items.

Quizzes

CommandOptionsWhat it does
upb-moodle quizzes--course NList quizzes with open and close times and attempt limits.
upb-moodle quiz-attemptsquiz_idYour attempts at one quiz, with state and grades.
upb-moodle quiz-startquiz_id --force-new --yesStart or resume an attempt; it counts against the attempt limit.
upb-moodle quiz-questionsattempt_idThe questions of an attempt, with the answer field names and options.
upb-moodle quiz-answerattempt_id --answers JSON --answers-file FILE --finish --yesSave answers, or submit the attempt with --finish (irreversible).
upb-moodle quiz-reviewattempt_idReview a finished attempt: questions, answers and marks.

Notifications and deadlines

CommandOptionsWhat it does
upb-moodle notifications--limit N --unreadRecent notifications and the unread count.
upb-moodle read-notificationnotification_id --yesMark a notification as read; needs --yes.
upb-moodle deadlines--days NUpcoming deadlines in the next N days, by time.

Moodle API

CommandOptionsWhat it does
upb-moodle functions--filter REGEXEvery Web Service function available to the token, with an optional regex filter.
upb-moodle callfunction --json-params JSON --yesCall any Moodle Web Service function with a JSON parameters object.

Install and maintenance

CommandOptionsWhat it does
upb-moodle installtargets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODEConfigure the plugin or the MCP server in the chosen CLIs.
upb-moodle uninstalltargets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODERemove the configuration from the chosen CLIs and scope.
upb-moodle updatetargets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODEBring the latest marketplace version into the chosen CLIs.
upb-moodle doctor—Check the installation, the token and the MCP processes; changes nothing.
upb-moodle sync-plugin—Development: copy the canonical SKILL.md into the plugin.

Per-harness commands

CommandOptionsWhat it does
upb-moodle claudeinstall update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODEClaude Code only: install, update, uninstall or doctor.
upb-moodle codexinstall update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODECodex only: install, update, uninstall or doctor.
upb-moodle opencodeinstall update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODEopencode only: install, update, uninstall or doctor.
upb-moodle opencode2install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODEOpenCode 2 only: install, update, uninstall or doctor, with mcp.servers.
upb-moodle antigravityinstall update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODEAntigravity only: install, update, uninstall or doctor; global only.

Running

Commands run as upb-moodle <command> after installation, as npx -y upb-moodle-mcp <command> without a global install, or as python -m upb_moodle.cli <command> from a clone. The upb-moodle-mcp binary with arguments runs the same CLI; without arguments it starts the MCP server.

Commands with text (submit-text, reply, new-discussion) take the text from --text, from a --file or from stdin. Commands that change the account need --yes.