Skip to main content
Glama

get_quiz_grade

Retrieve a student's grade for a specific quiz from the Moodle platform using student and quiz IDs.

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 main execution handler for the 'get_quiz_grade' tool. Validates studentId and quizId, calls Moodle API 'mod_quiz_get_user_best_grade', formats response with 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;
      }
    }
  • Input schema defining required numeric parameters: studentId and quizId.
    inputSchema: {
      type: 'object',
      properties: {
        studentId: {
          type: 'number',
          description: 'ID del estudiante',
        },
        quizId: {
          type: 'number',
          description: 'ID del quiz',
        },
      },
      required: ['studentId', 'quizId'],
    },
  • src/index.ts:217-234 (registration)
    Tool registration in the MCP server's tools list, specifying name, description, and input schema.
    {
      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'],
      },
    },
  • Switch case dispatcher that routes 'get_quiz_grade' tool calls to the handler method.
    case 'get_quiz_grade':
      return await this.getQuizGrade(request.params.arguments);
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 of behavioral disclosure. While 'obtiene' implies a read-only operation, it doesn't specify authentication requirements, error conditions (e.g., invalid IDs), rate limits, or what happens if no grade exists. For a 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 sentence in Spanish that directly states the tool's purpose. It's front-loaded with the core action and resource, with no unnecessary words or redundancy. Every word earns its place.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what the return value looks like (e.g., numeric grade, letter grade, or structured object), error handling, or any side effects. For a grade retrieval tool, this leaves too much ambiguity for an AI agent.

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 clearly documented in the schema. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., format constraints or examples). Baseline 3 is appropriate when the schema fully documents parameters.

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 action ('obtiene' - gets/retrieves) and the target resource ('calificación de un estudiante en un quiz específico' - a student's grade on a specific quiz). It distinguishes from siblings like 'get_assignments' or 'get_quizzes' by focusing on grade retrieval rather than lists of resources. However, it doesn't explicitly mention that this is for a single student-quiz pair versus bulk operations.

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 (e.g., whether the student must be enrolled or the quiz must be completed), nor does it suggest when to use siblings like 'get_submissions' or 'provide_feedback' instead. Usage is implied by the name 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/cfsandoval/Mcp'

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