Skip to main content
Glama

get_submissions

Retrieve student assignment submissions from Moodle courses, optionally filtered by student or specific assignment.

Instructions

Obtiene las entregas de tareas en el curso configurado

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
studentIdNoID opcional del estudiante. Si no se proporciona, se devolverán entregas de todos los estudiantes
assignmentIdNoID opcional de la tarea. Si no se proporciona, se devolverán todas las entregas

Implementation Reference

  • The primary handler function for the 'get_submissions' tool. It retrieves assignments, fetches submissions and grades from Moodle API, filters by optional studentId and assignmentId parameters, processes the data, and returns formatted JSON.
    private async getSubmissions(args: any) {
      const studentId = args.studentId;
      const assignmentId = args.assignmentId;
      
      console.error(`[API] Requesting submissions${studentId ? ` for student ${studentId}` : ''}`);
      
      // Primero obtenemos todas las tareas
      const assignmentsResponse = await this.axiosInstance.get('', {
        params: {
          wsfunction: 'mod_assign_get_assignments',
          courseids: [MOODLE_COURSE_ID],
        },
      });
    
      const assignments = assignmentsResponse.data.courses[0]?.assignments || [];
      
      // Si se especificó un ID de tarea, filtramos solo esa tarea
      const targetAssignments = assignmentId
        ? assignments.filter((a: any) => a.id === assignmentId)
        : assignments;
      
      if (targetAssignments.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: 'No se encontraron tareas para el criterio especificado.',
            },
          ],
        };
      }
    
      // Para cada tarea, obtenemos todas las entregas
      const submissionsPromises = targetAssignments.map(async (assignment: any) => {
        const submissionsResponse = await this.axiosInstance.get('', {
          params: {
            wsfunction: 'mod_assign_get_submissions',
            assignmentids: [assignment.id],
          },
        });
    
        const submissions = submissionsResponse.data.assignments[0]?.submissions || [];
        
        // Obtenemos las calificaciones para esta tarea
        const gradesResponse = await this.axiosInstance.get('', {
          params: {
            wsfunction: 'mod_assign_get_grades',
            assignmentids: [assignment.id],
          },
        });
    
        const grades = gradesResponse.data.assignments[0]?.grades || [];
        
        // Si se especificó un ID de estudiante, filtramos solo sus entregas
        const targetSubmissions = studentId
          ? submissions.filter((s: any) => s.userid === studentId)
          : submissions;
        
        // Procesamos cada entrega
        const processedSubmissions = targetSubmissions.map((submission: any) => {
          const studentGrade = grades.find((g: any) => g.userid === submission.userid);
          
          return {
            userid: submission.userid,
            status: submission.status,
            timemodified: new Date(submission.timemodified * 1000).toISOString(),
            grade: studentGrade ? studentGrade.grade : 'No calificado',
          };
        });
        
        return {
          assignment: assignment.name,
          assignmentId: assignment.id,
          submissions: processedSubmissions.length > 0 ? processedSubmissions : 'No hay entregas',
        };
      });
    
      const results = await Promise.all(submissionsPromises);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • Input schema defining optional parameters studentId and assignmentId for filtering submissions.
    inputSchema: {
      type: 'object',
      properties: {
        studentId: {
          type: 'number',
          description: 'ID opcional del estudiante. Si no se proporciona, se devolverán entregas de todos los estudiantes',
        },
        assignmentId: {
          type: 'number',
          description: 'ID opcional de la tarea. Si no se proporciona, se devolverán todas las entregas',
        },
      },
      required: [],
    },
  • src/index.ts:156-172 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
      name: 'get_submissions',
      description: 'Obtiene las entregas de tareas en el curso configurado',
      inputSchema: {
        type: 'object',
        properties: {
          studentId: {
            type: 'number',
            description: 'ID opcional del estudiante. Si no se proporciona, se devolverán entregas de todos los estudiantes',
          },
          assignmentId: {
            type: 'number',
            description: 'ID opcional de la tarea. Si no se proporciona, se devolverán todas las entregas',
          },
        },
        required: [],
      },
    },
  • src/index.ts:249-250 (registration)
    Switch case in CallToolRequestHandler that routes calls to the getSubmissions handler.
    case 'get_submissions':
      return await this.getSubmissions(request.params.arguments);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'obtiene' implies a read operation, it doesn't specify whether this requires authentication, what permissions are needed, whether results are paginated, what format the returns take, or any rate limits. For a read tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient Spanish sentence that directly states the tool's purpose. There's zero waste - every word contributes to understanding what the tool does. It's appropriately sized for a simple retrieval tool and front-loads the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read operation with 2 optional parameters and 100% schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it should ideally provide more behavioral context about what gets returned (list of submissions? with what fields?) and any authentication requirements. The description covers the basic 'what' but not the 'how' or 'what comes back'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (studentId and assignmentId) with their optional nature and behavior. The description doesn't add any parameter semantics beyond what's in the schema - it doesn't explain parameter interactions, format requirements, or provide examples. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('obtiene' - gets/retrieves) and resource ('entregas de tareas' - task submissions) with scope ('en el curso configurado' - in the configured course). It distinguishes from siblings like get_assignments (which gets assignments rather than submissions) and get_submission_content (which gets content of specific submissions rather than submissions list). However, it doesn't explicitly contrast with all siblings like get_quiz_grade.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use get_submissions versus get_submission_content (for content of specific submissions) or get_quiz_grade (for quiz grades specifically). There's no discussion of prerequisites, timing considerations, or exclusions for this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cfsandoval/Mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server