Skip to content

Commands

github-actions[bot] edited this page Oct 12, 2026 · 8 revisions

Command guide

繁體中文 · Home

Use moodle <command> --help as the authoritative flag reference. IDs shown below can often be replaced by a pasted Moodle URL.

The generated complete command reference documents every command and flag; feature coverage lists every core function in the three-version registry.

Sites and authentication

moodle site add <name> <url>
moodle site list
moodle site use <name>
moodle site remove <name>

moodle auth methods
moodle auth login [--method token|password|qr|mobilelaunch|browser-session|manual]
moodle auth status
moodle auth logout
moodle auth import-browser [--list-profiles|--store]
moodle auth import-browser --browser safari --store   # macOS Safari
moodle auth import-session --site <name>              # hidden paste prompt when Safari's cookie is absent from disk
moodle auth register-handler         # Linux and macOS; macOS also registers on first mobilelaunch sign-in
moodle auth handler-status
moodle auth unregister-handler

Role-aware reads

moodle doctor
moodle course list
moodle calendar upcoming
moodle grade overview
moodle grade list --course <id|url>
moodle assignment list
moodle assignment overview
moodle assignment show <id|url>
moodle assignment status <id|url>
moodle quiz list
moodle quiz show <id|url>
moodle forum list
moodle forum discussions <id|url>
moodle forum read <id|url>
moodle file download <url>
moodle resolve <url>

doctor explains the available backend and missing capability instead of assuming every site has the same functions. Forum reads do not mark discussions as read.

assignment overview checks each submission in one CLI invocation. If a status is unreadable, submission is null and status_error explains why; that does not mean the assignment is unsubmitted. quiz list reads the visible quizzes in your courses, not only calendar events. With a browser session, some quiz settings may remain unknown; check meta.missing before interpreting a null date. The MCP tools assignment_overview, quiz_list, and quiz_show offer the same read-only use cases.

Assignment submission

moodle assignment submit <id|url> report.pdf --dry-run
moodle assignment submit <id|url> report.pdf --yes
moodle assignment submit <id|url> report.pdf --draft --yes

The non-draft path uploads, saves, performs the separate “submit for grading” step when required, and reads the state back. --draft deliberately stops before handing work in. The JSON field handed_in is the final truth reported by Moodle.

Typed core services and the plugin escape hatch

moodle api functions --match assign
moodle api call core_enrol_get_users_courses --param userid=4
moodle ws list --version v52
moodle ws describe core_course_update_courses

The raw call still passes through the safety policy. Unreviewed functions are treated as writes and are not retried. Use it to reach an official function that has no high-level command, not to bypass the safety model.

Automation and agents

moodle version --json
moodle commands --json
moodle schema
moodle schema assignment.submit
moodle schema assignment submit --json
moodle assignment list --current --json --fields name,due_date --no-input
moodle mcp serve
moodle mcp serve --allow-write
moodle mcp host                # starts a public Cloudflare quick tunnel
moodle mcp host --public-url https://moodle-mcp.example.com
moodle course list --read-only
moodle course list -v          # redacted HTTP diagnostics on stderr
moodle shell-completion zsh   # tab completion; not "completion", which is Moodle's

--read-only removes write commands. MCP is read-only unless --allow-write is explicitly present. --fields keeps only the named data fields, and --no-input makes a command fail instead of waiting for an answer. See JSON contract before consuming output in a program, and automation recipes for worked examples and rules to give an agent.

Clone this wiki locally