Skip to main content
Glama

get_enrollments

Read-onlyIdempotent

Retrieve enrollment records with filters for student, course, status, and pagination via cursor and per_page.

Instructions

Get all enrollment records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoCursor for fetching the next page of results
per_pageNoNumber of results per page (default: 25)
student_idNoFilter results on student_id
planned_course_idNoFilter results on planned_course_id
statusNoFilter results on status
with_canceledNoFilter results based on whether they include a canceled status or not

Implementation Reference

  • Registers the 'get_enrollments' tool on the MCP server via server.registerTool('get_enrollments', ...)
    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);
          }
        },
      );
  • The async handler function that executes the 'get_enrollments' tool logic: calls apiList('/enrollments', ...) and formats results
    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);
      }
    },
  • Zod input schema for the 'get_enrollments' tool: cursor, per_page, student_id, planned_course_id, status, with_canceled
    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"),
    },
  • The apiList helper function used by the 'get_enrollments' handler to GET /enrollments with query params
    export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> {
      const { token } = getConfig();
      const url = buildUrl(path, query);
    
      const response = await fetch(url.toString(), {
        method: "GET",
        headers: buildHeaders(token),
      });
    
      await checkResponse(response);
    
      const records = (await response.json()) as T[];
      const nextCursor = parseNextCursor(response.headers.get("Link"));
    
      return { records, nextCursor };
    }
  • The formatList helper used to format the enrollment records into a CallToolResult response
    export function formatList(records: EduframeRecord[], resourceName: string): CallToolResult {
      if (records.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: `No ${resourceName} found.`,
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: `Found ${records.length} ${resourceName}:\n\n${formatJSON(records)}${RESPONSE_LOG_HINT}`,
          },
        ],
      };
    }
Behavior3/5

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

Annotations already provide readOnlyHint, destructiveHint, and idempotentHint. The description adds no behavioral details (e.g., pagination behavior, return format). With annotations covering safety, the description is neutral and not contradictory.

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

Conciseness3/5

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

The description is extremely concise (4 words), which is efficient. However, it omits essential context about parameters and behavior, making it under-specified rather than optimally concise.

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?

With no output schema and 6 parameters including pagination filters, the description lacks important context about what 'all enrollment records' entails, how pagination works, and what filters are available. The tool is more complex than the description suggests.

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 all 6 parameters. The description 'Get all enrollment records' adds no extra meaning beyond the schema's parameter descriptions. Baseline 3 is appropriate.

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

Purpose3/5

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

The description states 'Get all enrollment records', identifying a read operation on the enrollment resource. However, it does not distinguish from sibling tools like get_enrollment (singular) or get_program_enrollments, and 'all enrollment records' is vague regarding scope.

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. It does not mention pagination, filtering, or when not to use it. There are numerous related tools, but the description offers no decision support.

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