Skip to main content
Glama
webflow

Webflow

Official
by webflow

collection_fields_create_option

Add a custom dropdown or selection field to a Webflow CMS collection with predefined choices, enabling structured content management through selectable options.

Instructions

Create a new option field in a CMS collection with predefined choices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYesUnique identifier for the Collection.
requestYes

Implementation Reference

  • Registration of the 'collection_fields_create_option' MCP tool, including title, description, input schema (referencing OptionFieldSchema), and inline handler function that calls the Webflow API to create an option field.
      "collection_fields_create_option",
      {
        title: "Create Option Field",
        description:
          "Create a new option field in a CMS collection with predefined choices.",
        inputSchema: z.object({
          collection_id: z
            .string()
            .describe("Unique identifier for the Collection."),
          request: OptionFieldSchema,
        }),
      },
      async ({ collection_id, request }) => {
        try {
          const response = await getClient().collections.fields.create(
            collection_id,
            request,
            requestOptions
          );
          return formatResponse(response);
        } catch (error) {
          return formatErrorResponse(error);
        }
      }
    );
  • The handler function for the tool, which invokes the Webflow collections.fields.create API with the provided collection_id and request body, formats the response or error.
    async ({ collection_id, request }) => {
      try {
        const response = await getClient().collections.fields.create(
          collection_id,
          request,
          requestOptions
        );
        return formatResponse(response);
      } catch (error) {
        return formatErrorResponse(error);
      }
    }
  • Zod schema definition for the input 'request' parameter used in creating an option field, defining properties like type='Option', displayName, options array, etc.
    export const OptionFieldSchema = z.object({
      id: z.string().optional().describe("Unique identifier for the Field."),
      isEditable: z
        .boolean()
        .optional()
        .describe("Indicates if the field is editable."),
      isRequired: z
        .boolean()
        .optional()
        .describe("Indicates if the field is required."),
      type: z
        .literal("Option")
        .describe('Type of the field. Set this to "Option".'),
      displayName: z.string().describe("Name of the field."),
      helpText: z.string().optional().describe("Help text for the field."),
      metadata: z.object({
        options: z.array(
          z
            .object({
              name: z.string().describe("Name of the option."),
              id: z
                .string()
                .optional()
                .describe("Unique identifier for the option."),
            })
            .describe("Array of options for the field.")
        ),
      }),
    });

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/webflow/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server