Skip to main content
Glama

get_program_element

Read-onlyIdempotent

Retrieve a specific program element by providing its unique ID. Use this tool to access detailed information about a program element within Eduframe.

Instructions

Get an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the program element to retrieve

Implementation Reference

  • The registerProgramElementTools function registers all program element tools (get/list/create/update/delete) on the MCP server. The 'get_program_element' tool is registered at line 42.
    export function registerProgramElementTools(server: McpServer): void {
      server.registerTool(
        "get_program_elements",
        {
          description: "Get all elements",
          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)"),
            edition_id: z.number().int().optional().describe("Filter results on edition_id"),
          },
        },
        async ({ cursor, per_page, edition_id }) => {
          try {
            const result = await apiList<EduframeRecord>("/program/elements", { cursor, per_page, edition_id });
            void logResponse("get_program_elements", { cursor, per_page, edition_id }, result);
            const toolResult = formatList(result.records, "program elements");
            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_element",
        {
          description: "Get an element",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the program element to retrieve") },
        },
        async ({ id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/program/elements/${id}`);
            void logResponse("get_program_element", { id }, record);
            return formatShow(record, "program element");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "create_program_element",
        {
          description: "Create a program element",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
          inputSchema: {
            course_id: z.number().int().describe("The identifier of the associated course."),
            edition_id: z.number().int().describe("The identifier of the associated course."),
            planned_course_id: z.number().int().optional().describe("The identifier of the associated course."),
          },
        },
        async (body) => {
          try {
            const record = await apiPost<EduframeRecord>("/program/elements", body);
            void logResponse("create_program_element", body, record);
            return formatCreate(record, "program element");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_program_element",
        {
          description: "Update an element",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the program element to update"),
            edition_id: z.number().int().optional().describe("The identifier of the associated course."),
            planned_course_id: z.number().int().optional().describe("The identifier of the associated course."),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(`/program/elements/${id}`, body);
            void logResponse("update_program_element", { id, ...body }, record);
            return formatUpdate(record, "program element");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "delete_program_element",
        {
          description: "Delete a element",
          annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the program element to delete") },
        },
        async ({ id }) => {
          try {
            const record = await apiDelete<EduframeRecord>(`/program/elements/${id}`);
            void logResponse("delete_program_element", { id }, record);
            return formatDelete(record, "program element");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • The handler for 'get_program_element' tool. It takes an 'id' parameter (positive integer), calls the Eduframe API via apiGet at /program/elements/{id}, logs the response, and formats the result using formatShow.
    server.registerTool(
      "get_program_element",
      {
        description: "Get an element",
        annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
        inputSchema: { id: z.number().int().positive().describe("ID of the program element to retrieve") },
      },
      async ({ id }) => {
        try {
          const record = await apiGet<EduframeRecord>(`/program/elements/${id}`);
          void logResponse("get_program_element", { id }, record);
          return formatShow(record, "program element");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The input schema for 'get_program_element' defines one required parameter: 'id' (positive integer) describing the ID of the program element to retrieve.
    {
      description: "Get an element",
      annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
      inputSchema: { id: z.number().int().positive().describe("ID of the program element to retrieve") },
  • The apiGet helper function used by the handler to make a GET request to retrieve a single resource by path.
    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);
    }
  • The formatShow helper function used by the handler to format the retrieved record as a human-readable text response.
    export function formatShow(record: EduframeRecord, resourceName: string): CallToolResult {
      return {
        content: [
          {
            type: "text",
            text: `${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`,
          },
        ],
      };
    }
Behavior2/5

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

The description adds no behavioral information beyond what is already provided by annotations (readOnlyHint, destructiveHint, idempotentHint). It does not describe any side effects, permissions, or response details.

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?

The description is extremely brief ('Get an element') but this under-specification is not effective conciseness. It lacks structure and does not provide enough information to be useful.

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

Completeness1/5

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

Given the large number of sibling tools and no output schema, the description is grossly incomplete. It fails to specify what type of element is retrieved, what the response contains, or any distinguishing features.

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 the 'id' parameter having a clear description. The tool description does not add additional meaning beyond the schema, but baseline 3 is appropriate as schema covers the parameter well.

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 'Get an element' essentially restates the tool name 'get_program_element'. The resource is vague as 'element' does not specify what kind of element, and it does not differentiate from many sibling get tools that also retrieve elements of various types.

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 is provided on when to use this tool versus alternatives like get_program_elements or other get tools. The description lacks context for appropriate usage.

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