Skip to main content
Glama
webflow

Webflow

Official
by webflow

element_builder

Create elements on a Webflow page by specifying parent element, position, and element schema. Supports various element types and styling.

Instructions

Designer Tool - Element builder to create element on current active page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteIdYesThe ID of the site. DO NOT ASSUME site id. ALWAYS ask user for site id if not already provided or known. use sites_list tool to fetch all sites and then ask user to select one of them.
actionsYes

Implementation Reference

  • elementBuilderRPCCall: Validates element_schema for each action via Zod parsing, then delegates to the RPC callTool('element_builder', ...). This is the internal helper that performs pre-call schema validation and dispatches to the backend RPC.
    const elementBuilderRPCCall = async (
      siteId: string,
      actions: any,
    ) => {
      const actionsArray = actions || [];
      for (const action of actionsArray) {
        if (action.element_schema) {
          const result = ElementSchemaValidator.safeParse(
            action.element_schema,
          );
          if (!result.success) {
            throw new Error(
              `Invalid element_schema: ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`,
            );
          }
        }
      }
      return rpc.callTool("element_builder", {
        siteId,
        actions: actionsArray,
      });
    };
  • ElementSchemaValidator: A lazy recursive Zod schema that wraps DEElementSchema with optional children (self-referencing), used to validate element_schema before RPC calls.
    export const registerDEElementTools = (
      server: McpServer,
      rpc: RPCType,
    ) => {
      const ElementSchemaValidator: z.ZodType = z.lazy(() =>
        DEElementSchema.extend({
          children: z.array(ElementSchemaValidator).optional(),
        }),
      );
  • Registration and handler for the 'element_builder' tool. Registers the tool with McpServer including input schema (siteId + actions array with parent_element_id, creation_position, element_schema, etc.) and the async handler that calls elementBuilderRPCCall and formats the response.
    server.registerTool(
      "element_builder",
      {
        annotations: {
          openWorldHint: true,
          readOnlyHint: false,
        },
        description:
          "Designer Tool - Element builder to create element on current active page.",
        inputSchema: {
          ...SiteIdSchema,
          actions: z.array(
            z.object({
              build_label: z
                .string()
                .optional()
                .describe(
                  "A label to identify this build action in the results.",
                ),
              parent_element_id: z
                .object({
                  component: z
                    .string()
                    .describe(
                      "The component id of the element to perform action on.",
                    ),
                  element: z
                    .string()
                    .describe(
                      "The element id of the element to perform action on.",
                    ),
                })
                .describe(
                  "The id of the parent element to create element on, you can find it from id field on element. e.g id:{component:123,element:456}.",
                ),
              creation_position: z
                .enum(["append", "prepend", "before", "after"])
                .describe(
                  "The position to create element on. append/prepend insert as child of the parent element. before/after insert as sibling adjacent to the target element.",
                ),
              element_schema: DEElementSchema.extend({
                children: z
                  .array(z.any())
                  .optional()
                  .describe(
                    "Array of ElementSchema objects (same shape as element_schema with optional children)..",
                  ),
              }).describe(
                "ElementSchema - element schema of element to create. Children are recursive ElementSchema objects.",
              ),
              return_element_info: z
                .boolean()
                .optional()
                .describe(
                  "Whether to return full element info for the created element. Defaults to false.",
                ),
            }),
          ),
        },
      },
      async ({ actions, siteId }) => {
        try {
          return formatResponse(
            await elementBuilderRPCCall(siteId, actions),
          );
        } catch (error) {
          return formatErrorResponse(error);
        }
      },
    );
  • DEElementSchema: Zod validation schema for element definitions. Defines valid element types (Container, Section, DivBlock, Heading, etc.) and optional fields like set_style, set_text, set_link, set_heading_level, set_image_asset, set_dom_config, set_attributes.
    import { z } from "zod/v3";
    
    export const DEElementSchema = z.object({
      type: z
        .enum([
          "Container",
          "Section",
          "DivBlock",
          "Heading",
          "TextBlock",
          "Paragraph",
          "Button",
          "TextLink",
          "LinkBlock",
          "Image",
          "DOM",
        ])
        .describe(
          "The type of element to create. with DOM type you can create any element. make sure you pass dom_config if you are creating a DOM element."
        ),
      set_style: z
        .object({
          style_names: z
            .array(z.string())
            .describe("The style names to set on the element."),
        })
        .optional()
        .describe(
          "Set style on the element. it will remove all other styles on the element. and set only the styles passed in style_names."
        ),
      set_text: z
        .object({
          text: z.string().describe("The text to set on the element."),
        })
        .optional()
        .describe(
          "Set text on the element. only valid for text block, paragraph, heading, button, text link, link block."
        ),
      set_link: z
        .object({
          link_type: z
            .enum(["url", "file", "page", "element", "email", "phone"])
            .describe("The type of link to set on the element."),
          link: z.string().describe("The link to set on the element."),
        })
        .optional()
        .describe(
          "Set link on the element. only valid for button, text link, link block."
        ),
      set_heading_level: z
        .object({
          heading_level: z
            .number()
            .min(1)
            .max(6)
            .describe("The heading level to set on the element."),
        })
        .optional()
        .describe("Set heading level on the element. only valid for heading."),
      set_image_asset: z
        .object({
          image_asset_id: z
            .string()
            .describe("The image asset id to set on the element."),
          alt_text: z
            .string()
            .optional()
            .describe(
              "The alt text to set on the image. if not provided it will inherit from the image asset."
            ),
        })
        .optional()
        .describe("Set image asset on the element. only valid for image."),
      set_dom_config: z
        .object({
          dom_tag: z
            .string()
            .describe(
              "The tag of the DOM element to create. for example span, code, etc."
            ),
        })
        .optional()
        .describe("Set DOM config on the element. only valid for DOM element."),
      set_attributes: z
        .object({
          attributes: z
            .array(
              z.object({
                name: z.string().describe("The name of the attribute to set."),
                value: z.string().describe("The value of the attribute to set."),
              })
            )
            .describe("The attributes to set on the element."),
        })
        .optional()
        .describe("Set attributes on the element."),
    });
  • SiteIdSchema: Shared Zod schema for the required siteId string parameter, used as spread input in the element_builder tool registration.
    import { z } from "zod/v3";
    
    export const SiteIdSchema = {
      siteId: z
        .string()
        .describe(
          "The ID of the site. DO NOT ASSUME site id. ALWAYS ask user for site id if not already provided or known. use sites_list tool to fetch all sites and then ask user to select one of them."
        ),
    };
Behavior3/5

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

Annotations indicate readOnlyHint=false (write operation) and openWorldHint=true (potential side effects). The description states 'create element', which is consistent. However, it does not elaborate on side effects or what 'current active page' means in terms of context, leaving some ambiguity.

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

Conciseness4/5

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

The description is a single, front-loaded sentence. It is concise but could benefit from additional context without becoming verbose.

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

Completeness2/5

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

Given the tool's complexity (nested actions, multiple element types, positions), the description is too minimal. It does not explain the overall workflow, such as how multiple actions are processed or the meaning of fields like parent_element_id. The schema helps, but the description should provide a higher-level view.

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?

The input schema has detailed descriptions for most parameters, providing strong semantic meaning. The description adds no additional parameter insights, so it is adequate but not compensatory.

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?

The description clearly states it is a designer tool to create elements on the current active page. It distinguishes from sibling tools like element_tool (which likely manipulates existing elements) and component_builder (which builds components). However, it does not explicitly differentiate from all siblings.

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?

The description provides no guidance on when to use this tool versus alternatives. While the input schema includes instructions for siteId, the description itself lacks usage context.

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

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