Skip to main content
Glama

get_quiz_grade

Retrieve a student's quiz grade by providing their student ID and the quiz ID to access assessment results from Moodle.

Instructions

Obtiene la calificación de un estudiante en un quiz específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
studentIdYesID del estudiante
quizIdYesID del quiz

Implementation Reference

  • The core handler function for the 'get_quiz_grade' tool. Validates input (studentId, quizId), calls Moodle API 'mod_quiz_get_user_best_grade', formats response with hasGrade and grade or 'No calificado', handles errors.
    private async getQuizGrade(args: any) {
      if (!args.studentId || !args.quizId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Student ID and Quiz ID are required'
        );
      }
    
      console.error(`[API] Requesting quiz grade for student ${args.studentId} on quiz ${args.quizId}`);
      
      try {
        const response = await this.axiosInstance.get('', {
          params: {
            wsfunction: 'mod_quiz_get_user_best_grade',
            quizid: args.quizId,
            userid: args.studentId,
          },
        });
    
        // Procesamos la respuesta
        const result = {
          quizId: args.quizId,
          studentId: args.studentId,
          hasGrade: response.data.hasgrade,
          grade: response.data.hasgrade ? response.data.grade : 'No calificado',
        };
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        console.error('[Error]', error);
        if (axios.isAxiosError(error)) {
          return {
            content: [
              {
                type: 'text',
                text: `Error al obtener la calificación del quiz: ${
                  error.response?.data?.message || error.message
                }`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • src/index.ts:217-234 (registration)
    Tool registration in ListToolsRequestHandler, defines name, description, and inputSchema for get_quiz_grade requiring studentId (number) and quizId (number).
    {
      name: 'get_quiz_grade',
      description: 'Obtiene la calificación de un estudiante en un quiz específico',
      inputSchema: {
        type: 'object',
        properties: {
          studentId: {
            type: 'number',
            description: 'ID del estudiante',
          },
          quizId: {
            type: 'number',
            description: 'ID del quiz',
          },
        },
        required: ['studentId', 'quizId'],
      },
    },
  • src/index.ts:255-256 (registration)
    Dispatch case in CallToolRequestHandler switch that routes 'get_quiz_grade' calls to the getQuizGrade handler method.
    case 'get_quiz_grade':
      return await this.getQuizGrade(request.params.arguments);
  • Input schema definition for the get_quiz_grade tool, specifying object with required number properties studentId and quizId.
    inputSchema: {
      type: 'object',
      properties: {
        studentId: {
          type: 'number',
          description: 'ID del estudiante',
        },
        quizId: {
          type: 'number',
          description: 'ID del quiz',
        },
      },
      required: ['studentId', 'quizId'],
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states it 'gets' a grade, implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what happens if the student or quiz doesn't exist. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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, clear sentence in Spanish that directly states the tool's purpose. It is front-loaded with no unnecessary words, making it highly concise and well-structured for quick understanding.

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?

Given the tool's low complexity (2 required parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage guidelines, behavioral transparency, and output format. Without annotations or an output schema, more context would be helpful, but it's not severely incomplete.

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?

The schema description coverage is 100%, with both parameters (studentId and quizId) clearly documented in the schema. The description adds no additional meaning beyond implying these IDs are needed, so it meets the baseline of 3 where the schema does the heavy lifting without extra value from the description.

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 tool's purpose: 'Obtiene la calificación de un estudiante en un quiz específico' (Gets a student's grade on a specific quiz). It specifies the verb (obtiene/gets) and resource (calificación/grade) with context (student, quiz). However, it doesn't explicitly differentiate from sibling tools like get_submissions or get_quizzes, which might also involve grades or quizzes.

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 prerequisites, such as needing student and quiz IDs, or compare it to siblings like get_submissions (which might return grades among other data) or get_quizzes (which might list quizzes without grades). Usage is implied but not explicitly stated.

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/peancor/moodle-mcp-server'

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