Enable Moodle web services in Site Administration, create a service, add the required functions (core_enrol_get_enrolled_users, core_files_upload), and generate a user token
Call core_enrol_get_enrolled_users via REST: POST to /webservice/rest/server.php with wstoken, wsfunction, moodlewsrestformat=json, and courseid as parameters
Parse the returned array of user objects, each containing id, fullname, email, roles, and lastcourseaccess
To upload a file, call core_files_upload: POST the file content base64-encoded along with component, filearea, filepath, filename, and contextid parameters
Capture the itemid returned from the upload response; use it as a draft file reference in subsequent content creation calls
Call core_course_get_contents to retrieve the course module structure and verify uploaded content appears in the expected section
Known gotchas
Moodle web service tokens are bound to a specific user account; the permissions of that account determine what data and functions are accessible, not just the functions added to the service
The REST format endpoint returns PHP-serialized data by default; always pass moodlewsrestformat=json explicitly to receive JSON
File uploads via web services are staged as draft files and must be finalized by attaching them to a module or resource; unattached draft files are cleaned up by Moodle's cron
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp