Skip to main content
Glama
aguaitech

Elementor MCP Server

by aguaitech

update_page_from_file

Update a WordPress page with Elementor data from specified files, returning a boolean to confirm success. Requires page ID and Elementor file path for operation.

Instructions

Updates an existing page in WordPress with Elementor data from a file, it will return a boolean value to indicate if the update was successful.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentFilePathNoThe absolute path to the file to update the WordPress content from, optional.
elementorFilePathYesThe absolute path to the file to update the Elementor data from.
pageIdYesThe ID of the page to update.
statusNoThe status for the page (e.g., 'publish', 'draft').
titleNoThe title for the page.

Implementation Reference

  • Handler function for the 'update_page_from_file' tool. Reads Elementor data from the specified file path, optionally reads content from another file path, constructs the update payload, calls the updatePage helper, and returns a success response.
    async (input) => {
      const pageData = JSON.parse(
        fs.readFileSync(input.elementorFilePath, "utf8")
      );
      let contentData = null;
      if (input.contentFilePath) {
        contentData = fs.readFileSync(input.contentFilePath, "utf8");
      }
      await updatePage(input.pageId, {
        title: input.title,
        status: input.status,
        content: contentData,
        elementor_data: JSON.stringify(pageData, null, 0),
      });
      return {
        content: [{ type: "text", text: "true" }],
      };
    }
  • Input schema for the 'update_page_from_file' tool defining parameters like pageId, title, status, contentFilePath, and elementorFilePath using Zod validation.
    {
      pageId: z
        .number()
        .int()
        .positive()
        .describe("The ID of the page to update."),
      title: z.string().optional().describe("The title for the page."),
      status: z
        .enum(["publish", "future", "draft", "pending", "private"])
        .optional()
        .describe("The status for the page (e.g., 'publish', 'draft')."),
      contentFilePath: z
        .string()
        .optional()
        .describe(
          "The absolute path to the file to update the WordPress content from, optional."
        ),
      elementorFilePath: z
        .string()
        .describe("The absolute path to the file to update the Elementor data from."),
    },
  • src/index.js:182-224 (registration)
    Registration of the 'update_page_from_file' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "update_page_from_file",
      "Updates an existing page in WordPress with Elementor data from a file, it will return a boolean value to indicate if the update was successful.",
      {
        pageId: z
          .number()
          .int()
          .positive()
          .describe("The ID of the page to update."),
        title: z.string().optional().describe("The title for the page."),
        status: z
          .enum(["publish", "future", "draft", "pending", "private"])
          .optional()
          .describe("The status for the page (e.g., 'publish', 'draft')."),
        contentFilePath: z
          .string()
          .optional()
          .describe(
            "The absolute path to the file to update the WordPress content from, optional."
          ),
        elementorFilePath: z
          .string()
          .describe("The absolute path to the file to update the Elementor data from."),
      },
      async (input) => {
        const pageData = JSON.parse(
          fs.readFileSync(input.elementorFilePath, "utf8")
        );
        let contentData = null;
        if (input.contentFilePath) {
          contentData = fs.readFileSync(input.contentFilePath, "utf8");
        }
        await updatePage(input.pageId, {
          title: input.title,
          status: input.status,
          content: contentData,
          elementor_data: JSON.stringify(pageData, null, 0),
        });
        return {
          content: [{ type: "text", text: "true" }],
        };
      }
    );
  • Helper function 'updatePage' called by the tool handler to perform the actual WordPress REST API update for the page, handling payload construction and validation.
    async function updatePage(pageId, pageData) {
        const client = getApiClient();
    
        const payload = {};
        if (pageData.title) payload.title = pageData.title;
        if (pageData.status) payload.status = pageData.status;
        if (pageData.content) payload.content = pageData.content; // Use !== undefined to allow setting empty content
    
        if (pageData.elementor_data) {
            if (typeof pageData.elementor_data !== 'string') {
                 throw new Error('elementor_data must be provided as a JSON string.');
            }
             try {
                JSON.parse(pageData.elementor_data); // Basic validation
            } catch (e) {
                throw new Error('elementor_data is not valid JSON string.');
            }
            payload.meta = { _elementor_data: pageData.elementor_data };
        }
    
        if (Object.keys(payload).length === 0) {
            throw new Error("No update data provided.");
        }
    
        // WP uses POST for updates via ID route
        const response = await client.post(`/wp-json/wp/v2/pages/${pageId}`, payload);
        return response.data;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool returns a boolean for success, which is useful, but lacks critical details: it doesn't specify permissions required, whether the update overwrites or merges content, error handling, or rate limits. For a mutation tool with zero annotation coverage, this is insufficient.

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 concise and front-loaded, stating the core purpose in the first clause. The second clause adds useful return value information. Both sentences earn their place, though it could be slightly more structured by separating purpose from behavior.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., side effects, error cases), usage context relative to siblings, and comprehensive parameter guidance. The boolean return is noted, but overall coverage is inadequate for the tool's complexity.

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 already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain interactions between 'contentFilePath' and 'elementorFilePath'). Baseline 3 is appropriate when the schema does the heavy lifting.

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 the tool's purpose: 'Updates an existing page in WordPress with Elementor data from a file.' It specifies the verb ('Updates'), resource ('existing page in WordPress'), and mechanism ('with Elementor data from a file'). However, it doesn't explicitly distinguish this from sibling tools like 'update_page', which likely updates a page without file-based Elementor data.

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. It doesn't mention sibling tools like 'update_page' or 'create_page', nor does it specify prerequisites such as needing existing page IDs or file paths. Usage context is implied but not explicitly stated.

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

Related 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/aguaitech/Elementor-MCP'

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