get_page
Retrieve a specific WordPress page and its Elementor metadata using the page ID for targeted content access and management.
Instructions
Retrieves a specific page from WordPress by its ID, including meta fields like _elementor_data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageId | Yes | The ID of the page to retrieve. |
Implementation Reference
- src/index.js:83-94 (handler)The handler function for the 'get_page' tool, which retrieves page data using the getPage helper and returns it as a JSON string in the MCP content format.async (input) => { // Handler const pageData = await getPage(input.pageId); return { content: [ { type: "text", text: JSON.stringify(pageData), }, ], }; }
- src/index.js:75-82 (schema)Input schema for the 'get_page' tool using Zod, validating pageId as a positive integer.{ // Input Schema pageId: z .number() .int() .positive() .describe("The ID of the page to retrieve."), },
- src/index.js:72-95 (registration)Full registration of the 'get_page' MCP tool using server.tool(), including name, description, input schema, and handler function.server.tool( "get_page", "Retrieves a specific page from WordPress by its ID, including meta fields like _elementor_data.", { // Input Schema pageId: z .number() .int() .positive() .describe("The ID of the page to retrieve."), }, async (input) => { // Handler const pageData = await getPage(input.pageId); return { content: [ { type: "text", text: JSON.stringify(pageData), }, ], }; } );
- src/wp-api.js:33-38 (helper)Helper function getPage that performs the actual WordPress REST API GET request for a page by ID in edit context to include meta fields like _elementor_data.async function getPage(pageId) { const client = getApiClient(); // Use context=edit to potentially get more fields like meta const response = await client.get(`/wp-json/wp/v2/pages/${pageId}?context=edit`); return response.data; }