Skip to main content
Glama

get_submission_content

Retrieve detailed student assignment submissions including text content and attached files from Moodle. Use student and assignment IDs to access specific submission data for review or analysis.

Instructions

Obtiene el contenido detallado de una entrega específica, incluyendo texto y archivos adjuntos

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
studentIdYesID del estudiante
assignmentIdYesID de la tarea

Implementation Reference

  • The handler function that executes the tool logic: fetches detailed submission content from Moodle using mod_assign_get_submission_status, processes online text and file plugins, constructs a response object, and returns it as JSON text.
    private async getSubmissionContent(args: any) {
      if (!args.studentId || !args.assignmentId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Student ID and Assignment ID are required'
        );
      }
    
      console.error(`[API] Requesting submission content for student ${args.studentId} on assignment ${args.assignmentId}`);
      
      try {
        // Utilizamos la función mod_assign_get_submission_status para obtener el contenido detallado
        const response = await this.axiosInstance.get('', {
          params: {
            wsfunction: 'mod_assign_get_submission_status',
            assignid: args.assignmentId,
            userid: args.studentId,
          },
        });
    
        // Procesamos la respuesta para extraer el contenido relevante
        const submissionData = response.data.submission || {};
        const plugins = response.data.lastattempt?.submission?.plugins || [];
        
        // Extraemos el texto de la entrega y los archivos adjuntos
        let submissionText = '';
        const files = [];
        
        for (const plugin of plugins) {
          // Procesamos el plugin de texto en línea
          if (plugin.type === 'onlinetext') {
            const textField = plugin.editorfields?.find((field: any) => field.name === 'onlinetext');
            if (textField) {
              submissionText = textField.text || '';
            }
          }
          
          // Procesamos el plugin de archivos
          if (plugin.type === 'file') {
            const filesList = plugin.fileareas?.find((area: any) => area.area === 'submission_files');
            if (filesList && filesList.files) {
              for (const file of filesList.files) {
                files.push({
                  filename: file.filename,
                  fileurl: file.fileurl,
                  filesize: file.filesize,
                  filetype: file.mimetype,
                });
              }
            }
          }
        }
        
        // Construimos el objeto de respuesta
        const submissionContent = {
          assignment: args.assignmentId,
          userid: args.studentId,
          status: submissionData.status || 'unknown',
          submissiontext: submissionText,
          plugins: [
            {
              type: 'onlinetext',
              content: submissionText,
            },
            {
              type: 'file',
              files: files,
            },
          ],
          timemodified: submissionData.timemodified || 0,
        };
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(submissionContent, null, 2),
            },
          ],
        };
      } catch (error) {
        console.error('[Error]', error);
        if (axios.isAxiosError(error)) {
          return {
            content: [
              {
                type: 'text',
                text: `Error al obtener el contenido de la entrega: ${
                  error.response?.data?.message || error.message
                }`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • src/index.ts:199-216 (registration)
    Registration of the 'get_submission_content' tool in the ListToolsRequestSchema handler, including its name, description, and input schema.
    {
      name: 'get_submission_content',
      description: 'Obtiene el contenido detallado de una entrega específica, incluyendo texto y archivos adjuntos',
      inputSchema: {
        type: 'object',
        properties: {
          studentId: {
            type: 'number',
            description: 'ID del estudiante',
          },
          assignmentId: {
            type: 'number',
            description: 'ID de la tarea',
          },
        },
        required: ['studentId', 'assignmentId'],
      },
    },
  • Dispatch case in the CallToolRequestSchema handler that routes calls to the getSubmissionContent method.
    case 'get_submission_content':
      return await this.getSubmissionContent(request.params.arguments);
  • TypeScript interface defining the expected structure of the submission content returned by the tool.
    interface SubmissionContent {
      assignment: number;
      userid: number;
      status: string;
      submissiontext?: string;
      plugins?: Array<{
        type: string;
        content?: string;
        files?: Array<{
          filename: string;
          fileurl: string;
          filesize: number;
          filetype: string;
        }>;
      }>;
      timemodified: number;
    }
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. It states the tool retrieves detailed content including text and attachments, which implies a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns paginated results, or handles errors. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior beyond basic functionality.

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

Conciseness4/5

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

The description is a single, efficient sentence in Spanish that front-loads the core purpose. It avoids redundancy and wastes no words, making it easy to parse. However, it could be slightly more structured by explicitly separating functionality from context, but this is minor.

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 complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It explains what the tool does but lacks details on output format (e.g., structure of returned content), error handling, or integration with siblings. Without annotations or output schema, more context on behavior would improve completeness, but it meets the basic threshold for a simple retrieval tool.

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 input schema has 100% description coverage, with clear descriptions for studentId and assignmentId. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score is 3, as the description doesn't compensate but also doesn't detract from the schema's documentation.

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 el contenido detallado de una entrega específica, incluyendo texto y archivos adjuntos' (Gets the detailed content of a specific submission, including text and attached files). It specifies the verb 'obtiene' (gets) and resource 'contenido de una entrega' (submission content), distinguishing it from sibling tools like get_submissions (likely listing submissions) or get_assignments (getting assignment details). However, it doesn't explicitly differentiate from all siblings, such as get_quiz_grade, which might also retrieve submission-related data.

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 a specific submission ID or context from other tools, nor does it compare to siblings like get_submissions (which might list submissions without detailed content) or provide_feedback (which could involve submission content). Usage is implied by the description 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