get_students
Retrieve the list of students enrolled in the configured Moodle course to manage class rosters and student information.
Instructions
Obtiene la lista de estudiantes inscritos en el curso configurado
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:283-311 (handler)The handler function `getStudents()` that calls the Moodle API to get enrolled users, filters for students, and returns their details as JSON.private async getStudents() { console.error('[API] Requesting enrolled users'); const response = await this.axiosInstance.get('', { params: { wsfunction: 'core_enrol_get_enrolled_users', courseid: MOODLE_COURSE_ID, }, }); const students = response.data .filter((user: any) => user.roles.some((role: any) => role.shortname === 'student')) .map((student: any) => ({ id: student.id, username: student.username, firstname: student.firstname, lastname: student.lastname, email: student.email, })); return { content: [ { type: 'text', text: JSON.stringify(students, null, 2), }, ], }; }
- src/index.ts:129-136 (registration)Tool registration in the ListTools response, defining name, description, and input schema.name: 'get_students', description: 'Obtiene la lista de estudiantes inscritos en el curso configurado', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:131-135 (schema)Input schema for the get_students tool, which takes no parameters.inputSchema: { type: 'object', properties: {}, required: [], },
- src/index.ts:243-244 (registration)Dispatch in the CallToolRequestHandler switch statement that routes to the getStudents handler.case 'get_students': return await this.getStudents();
- src/index.ts:31-37 (helper)TypeScript interface defining the structure of a Student object used in the response.interface Student { id: number; username: string; firstname: string; lastname: string; email: string; }