Skip to main content
Glama

get_courses

Read-onlyIdempotent

Retrieve course records with pagination and optional filtering by published status.

Instructions

Get all course records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoCursor for fetching the next page of results
per_pageNoNumber of results per page (default: 25)
publishedNoShow only published courses

Implementation Reference

  • The async handler function for the 'get_courses' tool. Calls apiList('/courses') to fetch paginated course records, logs the response, formats the result as a list using formatList, and appends a next page cursor if present.
      async ({ cursor, per_page, published }) => {
        try {
          const result = await apiList<EduframeRecord>("/courses", { cursor, per_page, published });
          void logResponse("get_courses", { cursor, per_page, published }, result);
          const toolResult = formatList(result.records, "courses");
          if (result.nextCursor) {
            toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
          }
          return toolResult;
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Input schema definition for the 'get_courses' tool: optional cursor (string), per_page (positive int), and published (enum with 'published').
    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)"),
      published: z.enum(["published"]).optional().describe("Show only published courses"),
    },
  • Registration of the 'get_courses' tool on the MCP server via server.registerTool() with description, annotations (readOnlyHint: true), inputSchema, and handler.
    server.registerTool(
      "get_courses",
      {
        description: "Get all course 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)"),
          published: z.enum(["published"]).optional().describe("Show only published courses"),
        },
      },
      async ({ cursor, per_page, published }) => {
        try {
          const result = await apiList<EduframeRecord>("/courses", { cursor, per_page, published });
          void logResponse("get_courses", { cursor, per_page, published }, result);
          const toolResult = formatList(result.records, "courses");
          if (result.nextCursor) {
            toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
          }
          return toolResult;
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Registration of the registerCourseTools function in the tools array, which is called by registerAllTools.
      registerCourseTools,
      registerCreditCategorieTools,
      registerCreditTools,
      registerCustomAssociationTools,
      registerCustomFieldOptionTools,
      registerCustomObjectTools,
      registerCustomRecordTools,
      registerDiscountCodeTools,
      registerEditionDescriptionSectionTools,
      registerEducatorTools,
      registerEmailTools,
      registerEnrollmentTools,
      registerGradeTools,
      registerInvoiceVatTools,
      registerInvoiceTools,
      registerLabelTools,
      registerLeadTools,
      registerMaterialGroupTools,
      registerMaterialTools,
      registerMeetingLocationTools,
      registerMeetingTools,
      registerOrderTools,
      registerOrganizationTools,
      registerPaymentMethodTools,
      registerPaymentOptionTools,
      registerPaymentTools,
      registerPlannedCourseTools,
      registerPlanningAttendeeTools,
      registerPlanningConflictTools,
      registerPlanningEventTools,
      registerPlanningLocationTools,
      registerPlanningMaterialTools,
      registerPlanningRequiredTeacherGroupAttendeeTools,
      registerPlanningTeacherTools,
      registerProgramEditionTools,
      registerProgramElementTools,
      registerProgramEnrollmentTools,
      registerProgramPersonalProgramElementTools,
      registerProgramProgramTools,
      registerReferralTools,
      registerSignupQuestionTools,
      registerTaskTools,
      registerTeacherEnrollmentTools,
      registerTeacherRoleTools,
      registerTeacherTools,
      registerTheseTools,
      registerUserTools,
      registerWebhookNotificationTools,
      registerWebhookTools,
    ];
    
    export function registerAllTools(server: McpServer): void {
      for (const register of tools) {
        register(server);
      }
    }
  • The apiList helper function that performs the actual GET request to a paginated list endpoint (e.g., /courses). Returns records and nextCursor parsed from the Link header.
    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 };
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, covering safety and idempotency. The description adds no behavioral context beyond what is implied by 'get'. Given the annotations, the description is adequate but does not elaborate on pagination or filtering behavior.

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 concise sentence without fluff. It is appropriately front-loaded and efficient, though it could be slightly more informative without losing conciseness.

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?

The tool has no output schema, so the description could explain the return format. It does not, but given the tool's simplicity (a list getter with pagination), the description plus schema covers the essentials. However, it is not fully complete.

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 all three parameters (cursor, per_page, published) have descriptions. The tool description adds no additional meaning beyond what is in the schema, so a baseline score of 3 is appropriate.

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 'Get all course records' clearly indicates the action (get) and resource (course records). However, it does not differentiate from the sibling tool 'get_course' (which likely retrieves a single course), and it overstates 'all' since the input schema includes pagination parameters, implying a pageable list.

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 usage guidelines are provided. The description does not indicate when to use this tool versus alternatives like 'get_course' for a single course or other list tools. There is no mention of context or prerequisites.

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