Skip to main content
Glama
webflow

Webflow

Official
by webflow

collection_fields_create_reference

Add reference fields to link items between CMS collections in Webflow. Create connections to organize and relate content across different collections.

Instructions

Create a new reference field in a CMS collection that links to items in another collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYesUnique identifier for the Collection.
requestYes

Implementation Reference

  • The asynchronous handler function that executes the tool logic: calls WebflowClient.collections.fields.create with collection_id and request, 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 defining the structure for the 'request' parameter used in creating a reference field (ReferenceFieldSchema).
    export const ReferenceFieldSchema = 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
        .union([z.literal("MultiReference"), z.literal("Reference")])
        .describe("Type of the field. Choose of these appropriate field types."),
      displayName: z.string().describe("Name of the field."),
      helpText: z.string().optional().describe("Help text for the field."),
      metadata: z
        .object({
          collectionId: z.string(),
        })
        .describe(
          "ID of the referenced collection. Use this only for Reference and MultiReference fields."
        ),
    });
  • Registers the 'collection_fields_create_reference' tool with the MCP server inside registerCmsTools, including title, description, input schema, and handler.
    server.registerTool(
      "collection_fields_create_reference",
      {
        title: "Create Reference Field",
        description:
          "Create a new reference field in a CMS collection that links to items in another collection.",
        inputSchema: z.object({
          collection_id: z
            .string()
            .describe("Unique identifier for the Collection."),
          request: ReferenceFieldSchema,
        }),
      },
      async ({ collection_id, request }) => {
        try {
          const response = await getClient().collections.fields.create(
            collection_id,
            request,
            requestOptions
          );
          return formatResponse(response);
        } catch (error) {
          return formatErrorResponse(error);
        }
      }
    );

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