Skip to main content
Glama

get_enrollment

Read-onlyIdempotent

Retrieve an enrollment record by its ID to view or verify enrollment details.

Instructions

Get an enrollment record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the enrollment to retrieve

Implementation Reference

  • The main handler function for the 'get_enrollment' tool. Calls apiGet to fetch an enrollment by ID and formats the response.
    async ({ id }) => {
      try {
        const record = await apiGet<EduframeRecord>(`/enrollments/${id}`);
        void logResponse("get_enrollment", { id }, record);
        return formatShow(record, "enrollment");
      } catch (error) {
        return formatError(error);
      }
    },
  • Input schema for 'get_enrollment' tool: expects a positive integer 'id' parameter.
      description: "Get an enrollment record",
      annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
      inputSchema: { id: z.number().int().positive().describe("ID of the enrollment to retrieve") },
    },
  • Registration of the 'get_enrollment' tool on the MCP server via server.registerTool().
    server.registerTool(
      "get_enrollment",
      {
        description: "Get an enrollment record",
        annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
        inputSchema: { id: z.number().int().positive().describe("ID of the enrollment to retrieve") },
      },
      async ({ id }) => {
        try {
          const record = await apiGet<EduframeRecord>(`/enrollments/${id}`);
          void logResponse("get_enrollment", { id }, record);
          return formatShow(record, "enrollment");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The registerEnrollmentTools function that registers all enrollment tools (including 'get_enrollment') on the MCP server.
    export function registerEnrollmentTools(server: McpServer): void {
      server.registerTool(
        "get_enrollments",
        {
          description: "Get all enrollment records",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
            per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
            student_id: z.number().int().optional().describe("Filter results on student_id"),
            planned_course_id: z.number().int().optional().describe("Filter results on planned_course_id"),
            status: z
              .array(z.enum(["confirmed", "active", "canceled", "completed"]))
              .optional()
              .describe("Filter results on status"),
            with_canceled: z
              .boolean()
              .optional()
              .describe("Filter results based on whether they include a canceled status or not"),
          },
        },
        async ({ cursor, per_page, student_id, planned_course_id, status, with_canceled }) => {
          try {
            const result = await apiList<EduframeRecord>("/enrollments", {
              cursor,
              per_page,
              student_id,
              planned_course_id,
              status,
              with_canceled,
            });
            void logResponse(
              "get_enrollments",
              { cursor, per_page, student_id, planned_course_id, status, with_canceled },
              result,
            );
            const toolResult = formatList(result.records, "enrollments");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_enrollment",
        {
          description: "Get an enrollment record",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the enrollment to retrieve") },
        },
        async ({ id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/enrollments/${id}`);
            void logResponse("get_enrollment", { id }, record);
            return formatShow(record, "enrollment");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_enrollment",
        {
          description: "Update an enrollment",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the enrollment to update"),
            end_date: z
              .string()
              .optional()
              .describe(
                "If it is an enrollment of a fixed course, it equals the end date. For a flexible course, it returns the enrollment specific end date.",
              ),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(`/enrollments/${id}`, body);
            void logResponse("update_enrollment", { id, ...body }, record);
            return formatUpdate(record, "enrollment");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "cancel_enrollment",
        {
          description: "Cancel an enrollment",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the enrollment") },
        },
        async ({ id }) => {
          try {
            const record = await apiPut<EduframeRecord>(`/enrollments/${id}/cancel`, {});
            void logResponse("cancel_enrollment", { id }, record);
            return formatShow(record, "enrollment");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • The apiGet helper function used by the handler to perform the GET request to /enrollments/{id}.
    export async function apiGet<T>(path: string, query?: Record<string, QueryValue>): Promise<T> {
      const { token } = getConfig();
      const url = buildUrl(path, query);
    
      const response = await fetch(url.toString(), {
        method: "GET",
        headers: buildHeaders(token),
      });
    
      return handleResponse<T>(response);
    }
Behavior3/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds no further behavioral context (e.g., permissions, limits). No contradiction with annotations.

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?

Single phrase, front-loaded, no unnecessary words. Could be slightly more descriptive but still effective and concise.

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

Completeness4/5

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

For a simple retrieval tool with one parameter and comprehensive annotations, the description is sufficient. It tells the agent what the tool does, and the agent can infer typical return behavior.

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 coverage is 100% with a clear description for the 'id' parameter. The description does not add extra semantics beyond what is already in the schema.

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

Purpose5/5

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

The description 'Get an enrollment record' clearly states the action (get) and resource (enrollment record). It distinguishes itself from siblings like 'get_enrollments' (plural) and other enrollment-related tools.

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?

No guidance on when to use this tool vs alternatives such as 'get_enrollments', 'update_enrollment', or other related tools. The description does not provide context or exclusions.

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/martijnpieters/eduframe-mcp'

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