@yashwant.dharmdas/elementor-mcp 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,13 +182,20 @@ function createMcpServer(sites) {
|
|
|
182
182
|
return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true };
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
|
-
server.tool("get-data", "Get the
|
|
185
|
+
server.tool("get-data", "Get the Elementor JSON for a page. **ALWAYS pass compact=true and strip_responsive=true for any page that isn't tiny** — this strips style/typography/spacing/responsive bulk and keeps only structure + content (60-80% smaller). Without compact, large pages will exceed Claude's tool-response size limit and get auto-saved to a file (forcing slow Python parsing). For surgical lookups (find one widget by type or condition) use find-elements instead — it's even smaller and runs server-side.", {
|
|
186
186
|
page_id: z.string().describe("WordPress Page ID"),
|
|
187
|
+
compact: z.boolean().optional().describe("Strip style/typography/spacing/empty fields. Use true unless you specifically need style data."),
|
|
188
|
+
strip_responsive: z.boolean().optional().describe("Also drop _tablet, _mobile, _laptop, _widescreen variants. Use true with compact=true."),
|
|
187
189
|
site: siteParam,
|
|
188
|
-
}, async ({ page_id, site }) => {
|
|
190
|
+
}, async ({ page_id, compact, strip_responsive, site }) => {
|
|
189
191
|
try {
|
|
190
192
|
const { wpUrl, authHeader } = resolveSite(sites, site);
|
|
191
|
-
const
|
|
193
|
+
const params = {};
|
|
194
|
+
if (compact !== undefined)
|
|
195
|
+
params.compact = compact ? "1" : "0";
|
|
196
|
+
if (strip_responsive !== undefined)
|
|
197
|
+
params.strip_responsive = strip_responsive ? "1" : "0";
|
|
198
|
+
const r = await axios.get(`${wpUrl}/wp-json/erc/v1/pages/${page_id}/data`, { headers: { Authorization: authHeader }, params });
|
|
192
199
|
return { content: [{ type: "text", text: JSON.stringify(r.data, null, 2) }] };
|
|
193
200
|
}
|
|
194
201
|
catch (error) {
|
package/package.json
CHANGED