Skip to main content
Glama
aguaitech

Elementor MCP Server

by aguaitech

download_page_to_file

Download a WordPress page by its ID, including Elementor meta fields, and save it to a specified file path. Optionally, save only the _elementor_data field for targeted use.

Instructions

Downloads a specific page from WordPress by its ID, including meta fields like _elementor_data, and saves it to a file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesThe path to save the file to, have to be the absolute path.
onlyElementorDataNoWhether to only save the _elementor_data field to the file, defaults to false.
pageIdYesThe ID of the page to download.

Implementation Reference

  • The handler function that executes the download_page_to_file tool logic: retrieves page data via getPage and saves to file using fs.writeFileSync, optionally only Elementor data.
    async (input) => {
      const pageData = await getPage(input.pageId);
      if (input.onlyElementorData) {
        fs.writeFileSync(
          input.filePath,
          JSON.stringify(pageData.meta._elementor_data, null, 0)
        );
      } else {
        fs.writeFileSync(input.filePath, JSON.stringify(pageData, null, 0));
      }
      return {
        content: [{ type: "text", text: "true" }],
      };
    }
  • Input schema for download_page_to_file tool, defining parameters pageId, filePath, and optional onlyElementorData using Zod.
    {
      pageId: z
        .number()
        .int()
        .positive()
        .describe("The ID of the page to download."),
      filePath: z
        .string()
        .describe(
          "The path to save the file to, have to be the absolute path."
        ),
      onlyElementorData: z
        .boolean()
        .optional()
        .default(false)
        .describe(
          "Whether to only save the _elementor_data field to the file, defaults to false."
        ),
    },
  • src/index.js:97-133 (registration)
    Registration of the download_page_to_file tool using McpServer's server.tool method.
    server.tool(
      "download_page_to_file",
      "Downloads a specific page from WordPress by its ID, including meta fields like _elementor_data, and saves it to a file.",
      {
        pageId: z
          .number()
          .int()
          .positive()
          .describe("The ID of the page to download."),
        filePath: z
          .string()
          .describe(
            "The path to save the file to, have to be the absolute path."
          ),
        onlyElementorData: z
          .boolean()
          .optional()
          .default(false)
          .describe(
            "Whether to only save the _elementor_data field to the file, defaults to false."
          ),
      },
      async (input) => {
        const pageData = await getPage(input.pageId);
        if (input.onlyElementorData) {
          fs.writeFileSync(
            input.filePath,
            JSON.stringify(pageData.meta._elementor_data, null, 0)
          );
        } else {
          fs.writeFileSync(input.filePath, JSON.stringify(pageData, null, 0));
        }
        return {
          content: [{ type: "text", text: "true" }],
        };
      }
    );
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