Skip to main content
Glama

add_option_to_custom_field

Idempotent

Add a new option to a custom field by providing the field identifier, option value, and an enabled status.

Instructions

Add an option to a custom field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYesID of the custom field option
field_slugYesID of the custom field option
valueYes
enabledYesWhether the option can be chosen or not

Implementation Reference

  • The handler function for the 'add_option_to_custom_field' tool. It accepts object_type, field_slug, value, and enabled parameters, makes a POST request to /custom/{object_type}/fields/{field_slug}/options, and returns the created record.
    server.registerTool(
      "add_option_to_custom_field",
      {
        description: "Add an option to a custom field",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          object_type: z.number().int().positive().describe("ID of the custom field option"),
          field_slug: z.number().int().positive().describe("ID of the custom field option"),
          value: z.string(),
          enabled: z.boolean().describe("Whether the option can be chosen or not"),
        },
      },
      async ({ object_type, field_slug, ...body }) => {
        try {
          const record = await apiPost<EduframeRecord>(`/custom/${object_type}/fields/${field_slug}/options`, body);
          void logResponse("add_option_to_custom_field", { object_type, field_slug, ...body }, record);
          return formatShow(record, "custom field option");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Input schema for the 'add_option_to_custom_field' tool, using Zod for validation. Defines object_type (number), field_slug (number), value (string), and enabled (boolean).
      inputSchema: {
        object_type: z.number().int().positive().describe("ID of the custom field option"),
        field_slug: z.number().int().positive().describe("ID of the custom field option"),
        value: z.string(),
        enabled: z.boolean().describe("Whether the option can be chosen or not"),
      },
    },
  • The registration function 'registerCustomFieldOptionTools' that registers all custom field option tools (including 'add_option_to_custom_field') on the MCP server via server.registerTool().
    export function registerCustomFieldOptionTools(server: McpServer): void {
      server.registerTool(
        "get_options_of_custom_field",
        {
          description: "Get all options of a custom field",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            object_type: z.number().int().positive().describe("ID of the parent resource"),
            field_slug: 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 ({ object_type, field_slug, cursor, per_page }) => {
          try {
            const result = await apiList<EduframeRecord>(`/custom/${object_type}/fields/${field_slug}/options`, {
              cursor,
              per_page,
            });
            void logResponse("get_options_of_custom_field", { object_type, field_slug, cursor, per_page }, result);
            const toolResult = formatList(result.records, "custom field options");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_option_of_custom_field",
        {
          description: "Get an option of a custom field",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            object_type: z.number().int().positive().describe("ID of the parent resource"),
            field_slug: z.number().int().positive().describe("ID of the parent resource"),
            id: z.number().int().positive().describe("ID of the custom field option to retrieve"),
          },
        },
        async ({ object_type, field_slug, id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/custom/${object_type}/fields/${field_slug}/options/${option_id}`);
            void logResponse("get_option_of_custom_field", { object_type, field_slug, id }, record);
            return formatShow(record, "custom field option");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_option_of_custom_field",
        {
          description: "Update an option of a custom field",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            object_type: z.number().int().positive().describe("ID of the parent resource"),
            field_slug: z.number().int().positive().describe("ID of the parent resource"),
            id: z.number().int().positive().describe("ID of the custom field option to update"),
            value: z.string().optional(),
            enabled: z.boolean().optional().describe("Whether the option can be chosen or not"),
          },
        },
        async ({ object_type, field_slug, id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(
              `/custom/${object_type}/fields/${field_slug}/options/${option_id}`,
              body,
            );
            void logResponse("update_option_of_custom_field", { object_type, field_slug, id, ...body }, record);
            return formatUpdate(record, "custom field option");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "delete_option_of_custom_field",
        {
          description: "Delete an option from custom field",
          annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
          inputSchema: {
            object_type: z.number().int().positive().describe("ID of the parent resource"),
            field_slug: z.number().int().positive().describe("ID of the parent resource"),
            id: z.number().int().positive().describe("ID of the custom field option to delete"),
          },
        },
        async ({ object_type, field_slug, id }) => {
          try {
            const record = await apiDelete<EduframeRecord>(
              `/custom/${object_type}/fields/${field_slug}/options/${option_id}`,
            );
            void logResponse("delete_option_of_custom_field", { object_type, field_slug, id }, record);
            return formatDelete(record, "custom field option");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "add_option_to_custom_field",
        {
          description: "Add an option to a custom field",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            object_type: z.number().int().positive().describe("ID of the custom field option"),
            field_slug: z.number().int().positive().describe("ID of the custom field option"),
            value: z.string(),
            enabled: z.boolean().describe("Whether the option can be chosen or not"),
          },
        },
        async ({ object_type, field_slug, ...body }) => {
          try {
            const record = await apiPost<EduframeRecord>(`/custom/${object_type}/fields/${field_slug}/options`, body);
            void logResponse("add_option_to_custom_field", { object_type, field_slug, ...body }, record);
            return formatShow(record, "custom field option");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • The 'registerAllTools' function that iterates over all tool registration functions, including 'registerCustomFieldOptionTools', to register them on the MCP server.
    export function registerAllTools(server: McpServer): void {
      for (const register of tools) {
        register(server);
      }
  • Import and array entry that pulls in 'registerCustomFieldOptionTools' from 'custom_field_options.ts' and adds it to the tools registration list.
    import { registerCustomFieldOptionTools } from "./custom_field_options";
    import { registerCustomObjectTools } from "./custom_objects";
    import { registerCustomRecordTools } from "./custom_records";
    import { registerDiscountCodeTools } from "./discount_codes";
    import { registerEditionDescriptionSectionTools } from "./edition_description_sections";
    import { registerEducatorTools } from "./educators";
    import { registerEmailTools } from "./emails";
    import { registerEnrollmentTools } from "./enrollments";
    import { registerGradeTools } from "./grades";
    import { registerInvoiceVatTools } from "./invoice_vats";
    import { registerInvoiceTools } from "./invoices";
    import { registerLabelTools } from "./labels";
    import { registerLeadTools } from "./leads";
    import { registerMaterialGroupTools } from "./material_groups";
    import { registerMaterialTools } from "./materials";
    import { registerMeetingLocationTools } from "./meeting_locations";
    import { registerMeetingTools } from "./meetings";
    import { registerOrderTools } from "./orders";
    import { registerOrganizationTools } from "./organizations";
    import { registerPaymentMethodTools } from "./payment_methods";
    import { registerPaymentOptionTools } from "./payment_options";
    import { registerPaymentTools } from "./payments";
    import { registerPlannedCourseTools } from "./planned_courses";
    import { registerPlanningAttendeeTools } from "./planning_attendees";
    import { registerPlanningConflictTools } from "./planning_conflicts";
    import { registerPlanningEventTools } from "./planning_events";
    import { registerPlanningLocationTools } from "./planning_locations";
    import { registerPlanningMaterialTools } from "./planning_materials";
    import { registerPlanningRequiredTeacherGroupAttendeeTools } from "./planning_required_teacher_group_attendees";
    import { registerPlanningTeacherTools } from "./planning_teachers";
    import { registerProgramEditionTools } from "./program_editions";
    import { registerProgramElementTools } from "./program_elements";
    import { registerProgramEnrollmentTools } from "./program_enrollments";
    import { registerProgramPersonalProgramElementTools } from "./program_personal_program_elements";
    import { registerProgramProgramTools } from "./program_programs";
    import { registerReferralTools } from "./referrals";
    import { registerSignupQuestionTools } from "./signup_questions";
    import { registerTaskTools } from "./tasks";
    import { registerTeacherEnrollmentTools } from "./teacher_enrollments";
    import { registerTeacherRoleTools } from "./teacher_roles";
    import { registerTeacherTools } from "./teachers";
    import { registerTheseTools } from "./theses";
    import { registerUserTools } from "./users";
    import { registerWebhookNotificationTools } from "./webhook_notifications";
    import { registerWebhookTools } from "./webhooks";
    
    const tools: Array<(server: McpServer) => void> = [
      registerAccountTools,
      registerAffiliationTools,
      registerAttendanceTools,
      registerAuthenticationTools,
      registerCatalogProductTools,
      registerCatalogVariantTools,
      registerCategorieTools,
      registerCertificateTools,
      registerCommentTools,
      registerCourseLocationTools,
      registerCourseTabTools,
      registerCourseVariantTools,
      registerCourseTools,
      registerCreditCategorieTools,
      registerCreditTools,
      registerCustomAssociationTools,
      registerCustomFieldOptionTools,
Behavior2/5

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

Annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=true) indicate mutation is safe to retry, but the description adds no additional behavioral context such as permissions or side effects.

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?

A single sentence of 6 words, perfectly concise with no wasted information for this simple tool.

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?

With no output schema, the description does not indicate what is returned. It also omits necessary context like field existence prerequisites. However, annotations cover safety, making it minimally adequate.

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 75%, but the description adds no extra meaning. The schema descriptions for object_type and field_slug are arguably misleading ('ID of the custom field option'), and the description does not clarify.

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

Purpose5/5

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

The description 'Add an option to a custom field' clearly states the verb (add) and resource (option to custom field), distinguishing it from siblings like update and delete.

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 (e.g., update_option_of_custom_field). No prerequisites or context for use are provided.

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