# Moodle MCP

> Moodle MCP Server connects your AI agent directly to your Moodle Learning Management System (LMS). You get instant access to course structure, user rosters, assignment grades, and completion status without navigating the Moodle UI. Use tools like `get_course_grades` or `get_enrolled_users` to pull detailed academic data—perfect for automated reporting, student outreach, or quick administrative checks.

## Overview
- **Category:** learning-training
- **Price:** Free
- **Tags:** course-management, student-enrollment, lms, educational-technology, academic-administration

## Description

**Moodle MCP Server** hooks your AI agent right into your **Moodle Learning Management System (LMS)**. Forget clicking through menus and wading through pages; you get direct access to all the academic guts of your school's data. This setup gives your agent tools to read, track, and report on everything—from who took what test to who hasn't finished the reading material. You'll use this server when you need your AI client to act like an administrator or a TA, pulling complex records instantly without ever touching the Moodle user interface.

## Tools

### get_course_assignments
Lists all assignment types available within a specific Moodle course.

### get_course_completion
Checks and retrieves the completion status of an individual user in a given course.

### get_course_grades
Retrieves detailed gradebook data for users within a specific Moodle course.

### get_course_groups
Displays all user groups defined and utilized by the courses in the system.

### get_course_quizzes
Lists all quizzes and assessment tools built into a specific Moodle course.

### get_course_workshops
Retrieves information about workshop activities within the defined courses.

### get_courses
Provides a list of all available course names and basic details across the entire Moodle site.

### get_enrolled_users
Lists every user ID and name that is currently enrolled in a specific course.

### get_users
Searches the entire Moodle database for users by criteria like name or email address.

### send_message
Sends a direct, private instant message to any specified user ID within Moodle.

## Prompt Examples

**Prompt:** 
```
List all my available Moodle courses.
```

**Response:** 
```
I've retrieved your courses. You have access to 3 courses: 'Introduction to Computer Science', 'Advanced Mathematics', and 'World History'. Would you like to see the list of students enrolled in 'Introduction to Computer Science'?
```

**Prompt:** 
```
What are the grades for students in course ID 5?
```

**Response:** 
```
Retrieving gradebook for course 5... I've found 12 students. Top performers include 'Alice Smith' (95%), 'Bob Jones' (88%), and 'Charlie Brown' (92%). Would you like the full breakdown for any specific student?
```

**Prompt:** 
```
Check if user 'John Doe' (ID: 123) has finished the 'Cybersecurity' course (ID: 8).
```

**Response:** 
```
I've checked the completion status for John Doe in course 8. His progress is currently at 85%. He has completed all video lectures but still needs to submit the final project. Shall I send him a reminder message?
```

## Capabilities

### Retrieve Course Metadata
List all available courses or retrieve high-level details about course structures using `get_courses`.

### Manage User Enrollment Lists
Search for specific users by name or ID, and list every individual enrolled in a given course via `get_enrolled_users`.

### Gradebook and Progress Reporting
Fetch detailed grade records (`get_course_grades`) and check the overall completion percentage for any user using `get_course_completion`.

### Analyze Course Content Structure
List all assignments, quizzes, workshops, and defined groups associated with a specific course ID.

### Send Internal Messaging
Initiate direct, instant messages to any specified Moodle user ID from your agent's chat interface using `send_message`.

## Use Cases

### The Mid-Semester Grade Report
A professor needs to report the top 5 performers in 'Advanced Mathematics'. Instead of exporting and filtering a massive gradebook, they ask their agent: "Run `get_course_grades` for course ID 4. Sort by score and list the top five." The agent runs the tool, processes the data, and returns the names and percentages instantly.

### Auditing New Student Enrollment
An administrator needs to verify if a group of new hires were properly added to 'HR Training'. They ask: "Run `get_enrolled_users` for Course ID 10 and filter for the onboarding batch." The agent runs the tool, confirming every required user is present.

### Checking Assignment Status Before Review
A TA needs to know which students haven't submitted their final project. They ask: "Check `get_course_completion` for all users in the 'Cybersecurity' course.". The agent runs the tool, highlighting exactly who is missing submissions and allowing the TA to follow up.

### Quickly Contacting a Missing User
A coordinator realizes a student hasn't logged into their required module. Instead of finding their email via three different screens, they ask: "Send John Doe (ID 901) a message reminding him about the quiz." The agent uses `send_message` immediately.

## Benefits

- Stop manually checking grade sheets. Use `get_course_grades` to pull a user's entire academic record—all scores, weights, and final marks—in one API call.
- Need a roster fast? Instead of clicking through course administration pages, use `get_enrolled_users` to get a clean list of every student in minutes.
- No more guessing if students finished the material. Run `get_course_completion` on any user to see their exact progress percentage and which modules they still need to submit.
- Sending reminders is simple. Use `send_message` to instantly chat with a specific user ID, bypassing email lists or complex directory lookups.
- Get the big picture first. Start by calling `get_courses` to map out all available departments or program tracks before you drill down into any single class.

## How It Works

The bottom line is you feed your credentials once; after that, your AI client handles all the complex data mapping for you.

1. Subscribe to the server and provide your Moodle Web Service Token and Site Base URL.
2. Your AI client translates a conversational request (e.g., 'Check grades for course 12') into the required tool call (`get_course_grades`).
3. The MCP Server executes the API call, pulls the data from your LMS, and returns it to your agent in a structured format.

## Frequently Asked Questions

**How do I get the list of courses using the Moodle MCP Server?**
You use `get_courses`. This tool lists all available course names and basic details across your entire site, giving you a map of what's available before you drill down into specifics.

**Can I check grades for multiple courses at once with get_course_grades?**
You run `get_course_grades` per course. You must provide the specific Course ID and User ID in your prompt for the agent to retrieve the gradebook data accurately.

**What is the best tool for finding a student's current enrollment status?**
Use `get_enrolled_users`. This tool pulls a clean list of all users currently associated with a specific course, which is more accurate than just searching the general user directory.

**How do I send an instant message using the Moodle MCP Server?**
Use `send_message`. You only need the recipient's User ID and the text you want to send. The agent handles the delivery right from your chat client.

**How do I check the user groups defined in a course using `get_course_groups`?**
This tool lists all defined groups for a specific course ID. It returns the group name, group ID, and how many users are currently assigned to that group.

**If I want to check a student's progress percentage, should I use `get_course_completion`?**
Yes, `get_course_completion` returns the calculated completion status. It assesses progress based on required activities versus those marked as finished for that user.

**What permissions does my Moodle web service token need to use tools like `get_users` and `send_message`?**
The token must have read access to the Users/Enrollments module, plus messaging rights. This ensures your agent can search users and send messages without hitting permission walls.

**Do I need a separate tool if I only want to list quizzes for a course? Should I use `get_course_quizzes`?**
You'll use the `get_course_quizzes` tool. It specifically lists all available quiz activities within a given Course ID, giving you their titles and IDs.

**How do I enable Web Services in Moodle?**
Go to Site Administration > Server > Web services > Overview. You'll need to enable Web Services, enable the REST protocol, create a specific user, and generate a token for them.

**Can I see student grades for a course?**
Yes! Use the `get_course_grades` tool with a course ID to retrieve the gradebook data for all students enrolled in that course.

**How do I check if a student has completed a course?**
The `get_course_completion` tool allows you to check the progress and completion status for a specific User ID in a target Course ID.