Skip to main content
Glama

get_program_edition_of_elements_batch

Idempotent

Adds a batch of elements to a program edition, including courses and blocks with nested structures.

Instructions

Adds a set of elements to a program edition.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the program edition
elementsYes

Implementation Reference

  • The actual handler function that executes the tool logic - calls apiPost to POST to /program/editions/{id}/elements_batch endpoint.
      async ({ id, ...body }) => {
        try {
          const record = await apiPost<EduframeRecord>(`/program/editions/${id}/elements_batch`, body);
          void logResponse("get_program_edition_of_elements_batch", { id, ...body }, record);
          return formatShow(record, "program edition");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The full tool registration and input schema definition (Zod-based) for the tool.
    server.registerTool(
      "get_program_edition_of_elements_batch",
      {
        description: "Adds a set of elements to a program edition.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the program edition"),
          elements: z.array(
            z.union([
              z.object({
                type: z.enum(["CourseElement"]),
                course_id: z.number().int(),
                planned_course_id: z.number().int().optional(),
              }),
              z.object({
                type: z.enum(["BlockElement"]),
                name: z.string(),
                elements: z.array(
                  z.object({
                    type: z.enum(["CourseElement"]),
                    course_id: z.number().int(),
                    planned_course_id: z.number().int().optional(),
                  }),
                ),
              }),
            ]),
          ),
        },
      },
  • Tool is registered via server.registerTool() inside the registerProgramEditionTools function.
    server.registerTool(
      "get_program_edition_of_elements_batch",
      {
        description: "Adds a set of elements to a program edition.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the program edition"),
          elements: z.array(
            z.union([
              z.object({
                type: z.enum(["CourseElement"]),
                course_id: z.number().int(),
                planned_course_id: z.number().int().optional(),
              }),
              z.object({
                type: z.enum(["BlockElement"]),
                name: z.string(),
                elements: z.array(
                  z.object({
                    type: z.enum(["CourseElement"]),
                    course_id: z.number().int(),
                    planned_course_id: z.number().int().optional(),
                  }),
                ),
              }),
            ]),
          ),
        },
      },
      async ({ id, ...body }) => {
        try {
          const record = await apiPost<EduframeRecord>(`/program/editions/${id}/elements_batch`, body);
          void logResponse("get_program_edition_of_elements_batch", { id, ...body }, record);
          return formatShow(record, "program edition");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The registration function that contains the tool registration, exported from program_editions.ts and imported in src/tools/index.ts.
    export function registerProgramEditionTools(server: McpServer): void {
      server.registerTool(
        "get_elements_of_program_edition",
        {
          description: "Get the elements of a program edition",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the parent resource"),
            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)"),
          },
        },
        async ({ id, cursor, per_page }) => {
          try {
            const result = await apiList<EduframeRecord>(`/program/editions/${id}/elements`, { cursor, per_page });
            void logResponse("get_elements_of_program_edition", { id, cursor, per_page }, result);
            const toolResult = formatList(result.records, "program editions");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_program_edition",
        {
          description: "Get a program edition",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the program edition to retrieve") },
        },
        async ({ id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/program/editions/${id}`);
            void logResponse("get_program_edition", { id }, record);
            return formatShow(record, "program edition");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "create_program_edition",
        {
          description: "Create a program edition",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
          inputSchema: {
            program_id: z.number().int().describe("Unique identifier of associated program."),
            name: z.string().describe("Name of the program edition."),
            start_date: z.string().optional().describe("Nominal start date of the edition."),
            end_date: z.string().optional().describe("Nominal end date of the edition (inclusive)."),
            cost: z
              .number()
              .optional()
              .describe(
                "The price to be paid for this edition. Required if cost_scheme is student (default value) or order.",
              ),
            cost_scheme: programEditionCostSchemeEnum.optional().describe("How should the edition be paid by default."),
            min_participants: z
              .number()
              .int()
              .optional()
              .describe("A number representing the minimum number of participants."),
            max_participants: z
              .number()
              .int()
              .optional()
              .describe("A number representing the maximum number of participants."),
            is_published: z.boolean().optional().describe("Boolean representing the publishable status of the edition."),
            custom: z.record(z.unknown()).optional(),
            custom_associations: z.record(z.unknown()).optional(),
          },
        },
        async (body) => {
          try {
            const record = await apiPost<EduframeRecord>("/program/editions", body);
            void logResponse("create_program_edition", body, record);
            return formatCreate(record, "program edition");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_program_edition",
        {
          description: "Update a program edition",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the program edition to update"),
            name: z.string().optional().describe("Name of the program edition."),
            start_date: z.string().optional().describe("Nominal start date of the edition."),
            end_date: z.string().optional().describe("Nominal end date of the edition (inclusive)."),
            cost: z.string().optional().describe("The price to be paid for this edition."),
            cost_scheme: programEditionCostSchemeEnum.optional().describe("How should the edition be paid by default."),
            min_participants: z
              .number()
              .int()
              .optional()
              .describe("A number representing the minimum number of participants."),
            max_participants: z
              .number()
              .int()
              .optional()
              .describe("A number representing the maximum number of participants."),
            is_published: z.boolean().optional().describe("Boolean representing the publishable status of the edition."),
            custom: z.record(z.unknown()).optional(),
            custom_associations: z.record(z.unknown()).optional(),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(`/program/editions/${id}`, body);
            void logResponse("update_program_edition", { id, ...body }, record);
            return formatUpdate(record, "program edition");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "delete_program_edition",
        {
          description: "Delete a program edition",
          annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the program edition to delete") },
        },
        async ({ id }) => {
          try {
            const record = await apiDelete<EduframeRecord>(`/program/editions/${id}`);
            void logResponse("delete_program_edition", { id }, record);
            return formatDelete(record, "program edition");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_program_edition_of_elements_batch",
        {
          description: "Adds a set of elements to a program edition.",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the program edition"),
            elements: z.array(
              z.union([
                z.object({
                  type: z.enum(["CourseElement"]),
                  course_id: z.number().int(),
                  planned_course_id: z.number().int().optional(),
                }),
                z.object({
                  type: z.enum(["BlockElement"]),
                  name: z.string(),
                  elements: z.array(
                    z.object({
                      type: z.enum(["CourseElement"]),
                      course_id: z.number().int(),
                      planned_course_id: z.number().int().optional(),
                    }),
                  ),
                }),
              ]),
            ),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPost<EduframeRecord>(`/program/editions/${id}/elements_batch`, body);
            void logResponse("get_program_edition_of_elements_batch", { id, ...body }, record);
            return formatShow(record, "program edition");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
Behavior2/5

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

Description only says 'adds', adding little beyond annotations. It does not disclose behavior for duplicates, order of operations, or side effects like updating timestamps.

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

Conciseness2/5

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

Single sentence that is too vague. Not front-loaded with key info; fails to earn 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 complex nested schema and no output schema, the description is highly incomplete. It omits prerequisites, return value, error states.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 50%, but the description adds no meaning for the 'elements' parameter. It does not explain what constitutes an element in this context.

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

Purpose2/5

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

The description says 'Adds a set of elements' but the tool name starts with 'get_', misleading the agent. It does not differentiate from siblings like 'create_program_element' or 'get_elements_of_program_edition'.

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. There are related tools (create, delete, get elements) but description gives no context.

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