Skip to main content
Glama

get_material_groups

Read-onlyIdempotent

Fetch all material group records with pagination support using cursor and per_page parameters.

Instructions

Get all material group records

Input Schema

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

Implementation Reference

  • The handler function for the 'get_material_groups' tool. It calls apiList to fetch material groups, formats the result, and optionally appends a next-cursor message.
    async ({ cursor, per_page }) => {
      try {
        const result = await apiList<EduframeRecord>("/material_groups", { cursor, per_page });
        void logResponse("get_material_groups", { cursor, per_page }, result);
        const toolResult = formatList(result.records, "material groups");
        if (result.nextCursor) {
          toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
        }
        return toolResult;
      } catch (error) {
        return formatError(error);
      }
    },
  • Input schema for get_material_groups: optional cursor (string) and per_page (positive integer).
      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)"),
    },
  • The registerMaterialGroupTools function registers the 'get_material_groups' tool (and related material group tools) on the MCP server.
    export function registerMaterialGroupTools(server: McpServer): void {
      server.registerTool(
        "get_material_groups",
        {
          description: "Get all material group 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)"),
          },
        },
        async ({ cursor, per_page }) => {
          try {
            const result = await apiList<EduframeRecord>("/material_groups", { cursor, per_page });
            void logResponse("get_material_groups", { cursor, per_page }, result);
            const toolResult = formatList(result.records, "material groups");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_material_group",
        {
          description: "Get a material group record",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the material group to retrieve") },
        },
        async ({ id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/material_groups/${id}`);
            void logResponse("get_material_group", { id }, record);
            return formatShow(record, "material group");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "create_material_group",
        {
          description: "Create a material group.",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
          inputSchema: { name: z.string().describe("Name of the material group where the course is held.") },
        },
        async (body) => {
          try {
            const record = await apiPost<EduframeRecord>("/material_groups", body);
            void logResponse("create_material_group", body, record);
            return formatCreate(record, "material group");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_material_group",
        {
          description: "Update a material group.",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the material group to update"),
            name: z.string().optional().describe("Name of the material group where the course is held."),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(`/material_groups/${id}`, body);
            void logResponse("update_material_group", { id, ...body }, record);
            return formatUpdate(record, "material group");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "delete_material_group",
        {
          description: "Delete a material group.",
          annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the material group to delete") },
        },
        async ({ id }) => {
          try {
            const record = await apiDelete<EduframeRecord>(`/material_groups/${id}`);
            void logResponse("delete_material_group", { id }, record);
            return formatDelete(record, "material group");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • registerAllTools iterates over all tool registrations (including registerMaterialGroupTools) and calls each with the MCP server.
    export function registerAllTools(server: McpServer): void {
      for (const register of tools) {
        register(server);
      }
    }
  • Imports for helper utilities: apiList, formatters (formatList, formatError), response logger, and the EduframeRecord type.
    import {
      formatCreate,
      formatDelete,
      formatError,
      formatList,
      formatShow,
      formatUpdate,
      type EduframeRecord,
    } from "../formatters";
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. Description adds no contradictory information and correctly implies a read operation. Does not provide additional behavioral details (e.g., pagination behavior), but not needed given schema coverage.

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

Conciseness5/5

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

Single sentence, minimal and front-loaded with the core action. No wasted words.

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?

Description does not mention pagination, ordering, or that results may be partial despite 'all'. Annotations are present but no output schema. Adequate but leaves the agent to infer from schema; could be more 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 the schema itself fully documents both parameters (cursor, per_page). Description adds no further meaning beyond what schema provides, meeting the baseline 3.

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?

Description clearly states verb ('Get') and resource ('all material group records'), distinguishing it from sibling 'get_material_group' (singular). However, the phrase 'all' is slightly misleading given paginated parameters (cursor, per_page) in schema; more precise would be 'list' or 'paginated 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 guidance on when to use this tool versus alternatives like 'get_material_group' (single record) or 'get_materials'. The agent must infer context from tool names alone.

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