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
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | Moodle error, missing token, missing file or drafts disabled |
| 2 | write blocked: --yes is missing |
| 3 | install, update or doctor found a problem |
Account
| Command | Options | What it does |
|---|---|---|
upb-moodle login | --method auto|browser|manual --timeout N --token TOKEN --token-stdin --base-url URL | Obtain the token in a browser, or save an existing one from --token or stdin. |
upb-moodle logout | --forget-browser | Delete 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
| Command | Options | What it does |
|---|---|---|
upb-moodle courses | --year N --sem N --ay AN --faculty FACULTY --program PROGRAM --series SERIES --search TEXT | List the enrolled courses, filtered by faculty, programme, year, semester, series or name. |
upb-moodle outline | course_id | Raw 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 --shallow | Download course materials in parallel; a second run skips complete files. |
Assignments
| Command | Options | What it does |
|---|---|---|
upb-moodle assignments | --course N | Assignments with due dates, submission types, instructions. |
upb-moodle assignment | assign_id | Submission state for one assignment: drafts, submitted files or text, grade, feedback. |
upb-moodle submit | assign_id file --submit --allow-direct --yes | Upload a file as the assignment submission; a draft unless --submit. |
upb-moodle submit-text | assign_id --text TEXT --file FILE --submit --allow-direct --yes | Write the online-text submission for an assignment. |
Forums
| Command | Options | What it does |
|---|---|---|
upb-moodle forums | --course N | List the forums of the given courses or of every course. |
upb-moodle forum | forum_id | The discussions of one forum. |
upb-moodle discussion | discussion_id | One discussion's posts, with text and attachments. |
upb-moodle reply | post_id --subject TEXT --text TEXT --file FILE --yes | Reply to a forum post; needs --yes after you approve the message. |
upb-moodle new-discussion | forum_id --subject TEXT --text TEXT --file FILE --yes | Start a new forum discussion; needs --yes after you approve the message. |
Grades
| Command | Options | What it does |
|---|---|---|
upb-moodle grades | --course N | Every course's grades, or one course's grade items. |
Quizzes
| Command | Options | What it does |
|---|---|---|
upb-moodle quizzes | --course N | List quizzes with open and close times and attempt limits. |
upb-moodle quiz-attempts | quiz_id | Your attempts at one quiz, with state and grades. |
upb-moodle quiz-start | quiz_id --force-new --yes | Start or resume an attempt; it counts against the attempt limit. |
upb-moodle quiz-questions | attempt_id | The questions of an attempt, with the answer field names and options. |
upb-moodle quiz-answer | attempt_id --answers JSON --answers-file FILE --finish --yes | Save answers, or submit the attempt with --finish (irreversible). |
upb-moodle quiz-review | attempt_id | Review a finished attempt: questions, answers and marks. |
Notifications and deadlines
| Command | Options | What it does |
|---|---|---|
upb-moodle notifications | --limit N --unread | Recent notifications and the unread count. |
upb-moodle read-notification | notification_id --yes | Mark a notification as read; needs --yes. |
upb-moodle deadlines | --days N | Upcoming deadlines in the next N days, by time. |
Moodle API
| Command | Options | What it does |
|---|---|---|
upb-moodle functions | --filter REGEX | Every Web Service function available to the token, with an optional regex filter. |
upb-moodle call | function --json-params JSON --yes | Call any Moodle Web Service function with a JSON parameters object. |
Install and maintenance
| Command | Options | What it does |
|---|---|---|
upb-moodle install | targets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODE | Configure the plugin or the MCP server in the chosen CLIs. |
upb-moodle uninstall | targets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODE | Remove the configuration from the chosen CLIs and scope. |
upb-moodle update | targets... --source SOURCE --scope SCOPE --project-dir DIR --mode MODE | Bring 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
| Command | Options | What it does |
|---|---|---|
upb-moodle claude | install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODE | Claude Code only: install, update, uninstall or doctor. |
upb-moodle codex | install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODE | Codex only: install, update, uninstall or doctor. |
upb-moodle opencode | install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODE | opencode only: install, update, uninstall or doctor. |
upb-moodle opencode2 | install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODE | OpenCode 2 only: install, update, uninstall or doctor, with mcp.servers. |
upb-moodle antigravity | install update uninstall doctor --project-dir DIR --scope global|project|all --source SOURCE --mode MODE | Antigravity 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.