@charisol/plexo-mcp 1.0.6 → 1.0.8
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/blogTools.js +690 -0
- package/dist/client/plexoClient.js +220 -0
- package/dist/index.js +235 -3
- package/package.json +1 -1
- package/src/blogTools.ts +695 -0
- package/src/client/plexoClient.ts +276 -0
- package/src/index.ts +242 -3
|
@@ -156,6 +156,152 @@ export class PlexoClient {
|
|
|
156
156
|
return data;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Creates a landing page template WITHOUT publishing it — a thin wrapper
|
|
161
|
+
* around the same /api/v1/publish endpoint publishLandingPage() uses,
|
|
162
|
+
* just never forwarding a domain/type even if the caller passed one, so
|
|
163
|
+
* this tool's contract ("never publishes") holds regardless of input.
|
|
164
|
+
*/
|
|
165
|
+
async createLandingPage(params: { name?: string; designJson: Record<string, any> }): Promise<any> {
|
|
166
|
+
return this.publishLandingPage({ name: params.name, designJson: params.designJson });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Links a subdomain or custom domain to an already-existing landing page
|
|
171
|
+
* template (unlike publishLandingPage, which always creates a new one).
|
|
172
|
+
* Used both for a plain create_landing_page template and for the home
|
|
173
|
+
* page of a multi-page site once its sub-pages are ready.
|
|
174
|
+
*/
|
|
175
|
+
async publishExistingLandingPage(params: {
|
|
176
|
+
templateId: string;
|
|
177
|
+
domain: string;
|
|
178
|
+
type?: "SUBDOMAIN" | "CUSTOM";
|
|
179
|
+
}): Promise<any> {
|
|
180
|
+
this.checkAuth();
|
|
181
|
+
const type = params.type || (params.domain.includes(".") ? "CUSTOM" : "SUBDOMAIN");
|
|
182
|
+
const res = await fetch(`${this.baseUrl}/api/v1/domains`, {
|
|
183
|
+
method: "POST",
|
|
184
|
+
headers: this.getHeaders(),
|
|
185
|
+
body: JSON.stringify({ templateId: params.templateId, domain: params.domain, type }),
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const data = (await res.json()) as any;
|
|
189
|
+
if (!res.ok) {
|
|
190
|
+
throw new Error(data?.error || `Publishing failed with status ${res.status}`);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return data;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Creates a new page nested under an existing landing page (its home page
|
|
198
|
+
* for a top-level page, or another sub-page's id to nest deeper) — how a
|
|
199
|
+
* single landing page becomes a multi-page site. Starts blank; use
|
|
200
|
+
* updateTemplate() with the returned templateId to add content.
|
|
201
|
+
*/
|
|
202
|
+
async createLandingPageSubpage(params: {
|
|
203
|
+
parentTemplateId: string;
|
|
204
|
+
name: string;
|
|
205
|
+
slug?: string;
|
|
206
|
+
}): Promise<any> {
|
|
207
|
+
this.checkAuth();
|
|
208
|
+
const res = await fetch(`${this.baseUrl}/api/templates`, {
|
|
209
|
+
method: "POST",
|
|
210
|
+
headers: this.getHeaders(),
|
|
211
|
+
body: JSON.stringify({ name: params.name, parentId: params.parentTemplateId, slug: params.slug }),
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const data = (await res.json()) as any;
|
|
215
|
+
if (!res.ok) {
|
|
216
|
+
throw new Error(data?.error || `Sub-page creation failed with status ${res.status}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return data;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Returns every page belonging to the same multi-page site as templateId
|
|
224
|
+
* — its home page plus all nested sub-pages. templateId can be the home
|
|
225
|
+
* page or any sub-page; either way the whole tree comes back.
|
|
226
|
+
*/
|
|
227
|
+
async getLandingPagePages(templateId: string): Promise<any> {
|
|
228
|
+
this.checkAuth();
|
|
229
|
+
const res = await fetch(`${this.baseUrl}/api/templates/${encodeURIComponent(templateId)}/pages`, {
|
|
230
|
+
method: "GET",
|
|
231
|
+
headers: this.getHeaders(),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
const data = (await res.json()) as any;
|
|
235
|
+
if (!res.ok) {
|
|
236
|
+
throw new Error(data?.error || `Failed to fetch page tree (Status ${res.status})`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return data;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Renames a page, changes its URL segment, moves it under a different
|
|
244
|
+
* parent, or reorders it among siblings. Does not touch page content —
|
|
245
|
+
* use updateTemplate() for that.
|
|
246
|
+
*/
|
|
247
|
+
async updateLandingPagePage(params: {
|
|
248
|
+
templateId: string;
|
|
249
|
+
name?: string;
|
|
250
|
+
slug?: string;
|
|
251
|
+
parentTemplateId?: string;
|
|
252
|
+
order?: number;
|
|
253
|
+
}): Promise<any> {
|
|
254
|
+
this.checkAuth();
|
|
255
|
+
const { templateId, parentTemplateId, ...rest } = params;
|
|
256
|
+
const body: Record<string, any> = { ...rest };
|
|
257
|
+
if (parentTemplateId !== undefined) body.parentId = parentTemplateId;
|
|
258
|
+
|
|
259
|
+
const res = await fetch(`${this.baseUrl}/api/templates/${encodeURIComponent(templateId)}`, {
|
|
260
|
+
method: "PATCH",
|
|
261
|
+
headers: this.getHeaders(),
|
|
262
|
+
body: JSON.stringify(body),
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const data = (await res.json()) as any;
|
|
266
|
+
if (!res.ok) {
|
|
267
|
+
throw new Error(data?.error || `Page update failed with status ${res.status}`);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return data;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** Deletes a page. Sub-pages nested under it are cascade-deleted too. */
|
|
274
|
+
async deleteLandingPagePage(templateId: string): Promise<any> {
|
|
275
|
+
this.checkAuth();
|
|
276
|
+
const res = await fetch(`${this.baseUrl}/api/templates/${encodeURIComponent(templateId)}`, {
|
|
277
|
+
method: "DELETE",
|
|
278
|
+
headers: this.getHeaders(),
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
const data = (await res.json()) as any;
|
|
282
|
+
if (!res.ok) {
|
|
283
|
+
throw new Error(data?.error || `Page deletion failed with status ${res.status}`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return data;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Clones a sub-page's content into a new sibling page under the same parent. */
|
|
290
|
+
async duplicateLandingPagePage(templateId: string): Promise<any> {
|
|
291
|
+
this.checkAuth();
|
|
292
|
+
const res = await fetch(`${this.baseUrl}/api/templates/${encodeURIComponent(templateId)}/duplicate`, {
|
|
293
|
+
method: "POST",
|
|
294
|
+
headers: this.getHeaders(),
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
const data = (await res.json()) as any;
|
|
298
|
+
if (!res.ok) {
|
|
299
|
+
throw new Error(data?.error || `Page duplication failed with status ${res.status}`);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return data;
|
|
303
|
+
}
|
|
304
|
+
|
|
159
305
|
async listTemplates(): Promise<any> {
|
|
160
306
|
this.checkAuth();
|
|
161
307
|
const res = await fetch(`${this.baseUrl}/api/templates`, {
|
|
@@ -209,4 +355,134 @@ export class PlexoClient {
|
|
|
209
355
|
|
|
210
356
|
return data;
|
|
211
357
|
}
|
|
358
|
+
|
|
359
|
+
/** Fetches a single template's full details, including designJson — used by the blog
|
|
360
|
+
* layout tools to read back a layout template's current content (there's no other
|
|
361
|
+
* templateId-scoped GET in the public API; list endpoints only return metadata). */
|
|
362
|
+
async getTemplate(templateId: string): Promise<any> {
|
|
363
|
+
this.checkAuth();
|
|
364
|
+
const res = await fetch(`${this.baseUrl}/api/v1/templates/${encodeURIComponent(templateId)}`, {
|
|
365
|
+
method: "GET",
|
|
366
|
+
headers: this.getHeaders(),
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
const data = (await res.json()) as any;
|
|
370
|
+
if (!res.ok) {
|
|
371
|
+
throw new Error(data?.error || `Failed to fetch template (Status ${res.status})`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return data;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Shared request helper for every /api/blog/{templateId}/... route below — these are
|
|
378
|
+
* the same admin endpoints the Plexo dashboard's own blog UI calls, and (like every
|
|
379
|
+
* other route in this client) accept the same Bearer/x-api-key auth as the rest of the
|
|
380
|
+
* public API (see resolveUser/resolveBlogAdminSite server-side). */
|
|
381
|
+
private async blogFetch(method: string, templateId: string, path: string, body?: unknown): Promise<any> {
|
|
382
|
+
this.checkAuth();
|
|
383
|
+
const res = await fetch(`${this.baseUrl}/api/blog/${encodeURIComponent(templateId)}${path}`, {
|
|
384
|
+
method,
|
|
385
|
+
headers: this.getHeaders(),
|
|
386
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
const data = (await res.json().catch(() => ({}))) as any;
|
|
390
|
+
if (!res.ok) {
|
|
391
|
+
throw new Error(data?.error || `Blog request failed (Status ${res.status})`);
|
|
392
|
+
}
|
|
393
|
+
return data;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Idempotent — returns the existing layout template id if one's already attached to
|
|
397
|
+
* this kind rather than creating a duplicate. Pair with updateTemplate() to set its
|
|
398
|
+
* designJson (see blogTools.ts's designBlogLayout). */
|
|
399
|
+
async ensureBlogLayout(templateId: string, kind: "post" | "listing"): Promise<any> {
|
|
400
|
+
return this.blogFetch("POST", templateId, `/layout/${kind}`);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** Detaches the layout (reverts to the default theme) without deleting the underlying Template row. */
|
|
404
|
+
async resetBlogLayout(templateId: string, kind: "post" | "listing"): Promise<any> {
|
|
405
|
+
return this.blogFetch("DELETE", templateId, `/layout/${kind}`);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async getBlogSite(templateId: string): Promise<any> {
|
|
409
|
+
return this.blogFetch("GET", templateId, "/site");
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async updateBlogSite(templateId: string, patch: Record<string, any>): Promise<any> {
|
|
413
|
+
return this.blogFetch("PATCH", templateId, "/site", patch);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
async listBlogPosts(templateId: string, params: { status?: string; search?: string; categoryId?: string } = {}): Promise<any> {
|
|
417
|
+
const query = new URLSearchParams();
|
|
418
|
+
if (params.status) query.set("status", params.status);
|
|
419
|
+
if (params.search) query.set("search", params.search);
|
|
420
|
+
if (params.categoryId) query.set("categoryId", params.categoryId);
|
|
421
|
+
const qs = query.toString();
|
|
422
|
+
return this.blogFetch("GET", templateId, `/posts${qs ? `?${qs}` : ""}`);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
async getBlogPost(templateId: string, postId: string): Promise<any> {
|
|
426
|
+
return this.blogFetch("GET", templateId, `/posts/${encodeURIComponent(postId)}`);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async createBlogPost(templateId: string, payload: Record<string, any>): Promise<any> {
|
|
430
|
+
return this.blogFetch("POST", templateId, "/posts", payload);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
async updateBlogPost(templateId: string, postId: string, payload: Record<string, any>): Promise<any> {
|
|
434
|
+
return this.blogFetch("PATCH", templateId, `/posts/${encodeURIComponent(postId)}`, payload);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
async deleteBlogPost(templateId: string, postId: string): Promise<any> {
|
|
438
|
+
return this.blogFetch("DELETE", templateId, `/posts/${encodeURIComponent(postId)}`);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
async listBlogCategories(templateId: string): Promise<any> {
|
|
442
|
+
return this.blogFetch("GET", templateId, "/categories");
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
async createBlogCategory(templateId: string, payload: { name: string; description?: string; parentId?: string | null }): Promise<any> {
|
|
446
|
+
return this.blogFetch("POST", templateId, "/categories", payload);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
async deleteBlogCategory(templateId: string, categoryId: string): Promise<any> {
|
|
450
|
+
return this.blogFetch("DELETE", templateId, `/categories/${encodeURIComponent(categoryId)}`);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
async listBlogTags(templateId: string): Promise<any> {
|
|
454
|
+
return this.blogFetch("GET", templateId, "/tags");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
async createBlogTag(templateId: string, name: string): Promise<any> {
|
|
458
|
+
return this.blogFetch("POST", templateId, "/tags", { name });
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
async deleteBlogTag(templateId: string, tagId: string): Promise<any> {
|
|
462
|
+
return this.blogFetch("DELETE", templateId, `/tags/${encodeURIComponent(tagId)}`);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
async listBlogAuthors(templateId: string): Promise<any> {
|
|
466
|
+
return this.blogFetch("GET", templateId, "/authors");
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
async createBlogAuthor(templateId: string, payload: { name: string; bio?: string; avatarUrl?: string }): Promise<any> {
|
|
470
|
+
return this.blogFetch("POST", templateId, "/authors", payload);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
async deleteBlogAuthor(templateId: string, authorId: string): Promise<any> {
|
|
474
|
+
return this.blogFetch("DELETE", templateId, `/authors/${encodeURIComponent(authorId)}`);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
async listBlogComments(templateId: string, status?: string): Promise<any> {
|
|
478
|
+
return this.blogFetch("GET", templateId, `/comments${status ? `?status=${encodeURIComponent(status)}` : ""}`);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
async moderateBlogComment(templateId: string, commentId: string, status: string): Promise<any> {
|
|
482
|
+
return this.blogFetch("PATCH", templateId, `/comments/${encodeURIComponent(commentId)}`, { status });
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
async deleteBlogComment(templateId: string, commentId: string): Promise<any> {
|
|
486
|
+
return this.blogFetch("DELETE", templateId, `/comments/${encodeURIComponent(commentId)}`);
|
|
487
|
+
}
|
|
212
488
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ListToolsRequestSchema,
|
|
8
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { PlexoClient } from "./client/plexoClient.js";
|
|
10
|
+
import { BLOG_TOOL_DEFS, BLOG_TOOL_NAMES, handleBlogToolCall } from "./blogTools.js";
|
|
10
11
|
|
|
11
12
|
const server = new Server(
|
|
12
13
|
{
|
|
@@ -136,7 +137,7 @@ EXAMPLE VALID designJson PAYLOAD (hero row, plus a 3-item product grid row):
|
|
|
136
137
|
properties: {
|
|
137
138
|
type: {
|
|
138
139
|
type: "string",
|
|
139
|
-
enum: ["heading", "paragraph", "text", "button", "card", "image", "menu", "social", "divider", "spacer", "form_container", "input", "textarea", "select", "carousel", "html", "icon", "table", "timer", "video"],
|
|
140
|
+
enum: ["heading", "paragraph", "text", "button", "card", "image", "menu", "social", "divider", "spacer", "form_container", "input", "textarea", "select", "carousel", "html", "icon", "table", "timer", "video", "accordion", "blog_title", "blog_content", "blog_featured_image", "blog_date", "blog_author", "blog_categories", "blog_comments", "blog_post_list"],
|
|
140
141
|
},
|
|
141
142
|
style: { type: "object" },
|
|
142
143
|
attributes: { type: "object", description: "Component attributes (text, href, src, title, description, links, fields). For type 'html', raw markup goes under 'htmlContent' — NOT 'text'." },
|
|
@@ -228,7 +229,7 @@ Uses the SAME fully-hydrated layout schema as publish_landing_page — designJso
|
|
|
228
229
|
properties: {
|
|
229
230
|
type: {
|
|
230
231
|
type: "string",
|
|
231
|
-
enum: ["heading", "paragraph", "text", "button", "card", "image", "menu", "social", "divider", "spacer", "form_container", "input", "textarea", "select", "carousel", "html", "icon", "table", "timer", "video"],
|
|
232
|
+
enum: ["heading", "paragraph", "text", "button", "card", "image", "menu", "social", "divider", "spacer", "form_container", "input", "textarea", "select", "carousel", "html", "icon", "table", "timer", "video", "accordion", "blog_title", "blog_content", "blog_featured_image", "blog_date", "blog_author", "blog_categories", "blog_comments", "blog_post_list"],
|
|
232
233
|
},
|
|
233
234
|
style: { type: "object" },
|
|
234
235
|
attributes: {
|
|
@@ -308,6 +309,147 @@ Uses the SAME fully-hydrated layout schema as publish_landing_page/create_email_
|
|
|
308
309
|
required: ["templateId", "designJson"],
|
|
309
310
|
},
|
|
310
311
|
},
|
|
312
|
+
{
|
|
313
|
+
name: "create_landing_page",
|
|
314
|
+
description: `Creates and saves a landing page template WITHOUT publishing it to a domain — use this when the user wants to build a page (or start a multi-page site) first and go live later. Call publish_existing_landing_page afterward with the returned templateId to link a subdomain or custom domain whenever they're ready. To create a page AND publish it in one step, use publish_landing_page instead.
|
|
315
|
+
|
|
316
|
+
Uses the SAME fully-hydrated layout schema as publish_landing_page — see its description for a full worked example.`,
|
|
317
|
+
inputSchema: {
|
|
318
|
+
type: "object",
|
|
319
|
+
properties: {
|
|
320
|
+
name: {
|
|
321
|
+
type: "string",
|
|
322
|
+
description: "Title of the landing page (e.g. 'Kicks Store').",
|
|
323
|
+
},
|
|
324
|
+
designJson: {
|
|
325
|
+
type: "object",
|
|
326
|
+
description: "Plexo layout schema object — same shape as publish_landing_page's designJson.",
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
required: ["designJson"],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "publish_existing_landing_page",
|
|
334
|
+
description: `Links a subdomain or custom domain to an already-existing landing page template — for a template created via create_landing_page, or the home page of a multi-page site (see create_landing_page_subpage) once its sub-pages are ready. Unlike publish_landing_page, this does NOT create a new template — it publishes the one you already have. Every sub-page nested under templateId automatically becomes reachable at this domain too (e.g. domain.com/about) — no separate publish call is needed per sub-page.`,
|
|
335
|
+
inputSchema: {
|
|
336
|
+
type: "object",
|
|
337
|
+
properties: {
|
|
338
|
+
templateId: {
|
|
339
|
+
type: "string",
|
|
340
|
+
description: "ID of an existing landing page template to publish — must be a home page (no parent), not a sub-page.",
|
|
341
|
+
},
|
|
342
|
+
domain: {
|
|
343
|
+
type: "string",
|
|
344
|
+
description: "Subdomain slug (e.g. 'kicks') or custom domain ('kicks.com').",
|
|
345
|
+
},
|
|
346
|
+
type: {
|
|
347
|
+
type: "string",
|
|
348
|
+
enum: ["SUBDOMAIN", "CUSTOM"],
|
|
349
|
+
description: "Domain routing type. Inferred from the domain string if omitted.",
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
required: ["templateId", "domain"],
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "create_landing_page_subpage",
|
|
357
|
+
description: `Adds a new page nested under an existing landing page, reachable at <site domain>/<slug> — or nested deeper (e.g. /blog/post-1) if parentTemplateId is itself a sub-page rather than the home page. This is how a single landing page becomes a multi-page site. No separate publish step is needed for sub-pages: they automatically become reachable once the site's home page has a domain linked (see publish_existing_landing_page). Requires an Ultra subscription plan — sub-pages are otherwise unlimited per site once enabled.
|
|
358
|
+
|
|
359
|
+
The new page starts blank — use update_template with the returned templateId to add content.`,
|
|
360
|
+
inputSchema: {
|
|
361
|
+
type: "object",
|
|
362
|
+
properties: {
|
|
363
|
+
parentTemplateId: {
|
|
364
|
+
type: "string",
|
|
365
|
+
description: "ID of the page this new page should be nested under — the site's home page for a top-level page (e.g. /about), or another sub-page's ID to nest deeper (e.g. a 'Blog' page's ID to create /blog/post-1).",
|
|
366
|
+
},
|
|
367
|
+
name: {
|
|
368
|
+
type: "string",
|
|
369
|
+
description: "Friendly name of the page (e.g. 'About Us').",
|
|
370
|
+
},
|
|
371
|
+
slug: {
|
|
372
|
+
type: "string",
|
|
373
|
+
description: "Optional URL segment (e.g. 'about-us'). Auto-generated from name if omitted; auto-suffixed (about-us-2, ...) if it collides with a sibling page under the same parent.",
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
required: ["parentTemplateId", "name"],
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "get_landing_page_pages",
|
|
381
|
+
description: "Returns every page belonging to the same multi-page site as the given template — its home page plus all nested sub-pages, each with its name, URL segment (slug), parent, and full resolved path (e.g. '/blog/post-1'). Pass the home page's ID or any sub-page's ID — either way you get the whole tree back. Use this before create_landing_page_subpage/update_landing_page_page when you need to know what pages already exist or what a page's current slug/parent is.",
|
|
382
|
+
inputSchema: {
|
|
383
|
+
type: "object",
|
|
384
|
+
properties: {
|
|
385
|
+
templateId: {
|
|
386
|
+
type: "string",
|
|
387
|
+
description: "ID of the site's home page, or any sub-page within it.",
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
required: ["templateId"],
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: "update_landing_page_page",
|
|
395
|
+
description: `Renames a page, changes its URL segment (slug), moves it under a different parent page, or reorders it among its siblings. The home page of a site (no parent) can be renamed but has no slug of its own and can't be re-parented — use publish_existing_landing_page to manage its domain instead.
|
|
396
|
+
|
|
397
|
+
To edit a page's CONTENT (designJson), use update_template with the same templateId instead — this tool only manages the page's place in the site's structure, not what's on it.`,
|
|
398
|
+
inputSchema: {
|
|
399
|
+
type: "object",
|
|
400
|
+
properties: {
|
|
401
|
+
templateId: {
|
|
402
|
+
type: "string",
|
|
403
|
+
description: "ID of the page to update.",
|
|
404
|
+
},
|
|
405
|
+
name: {
|
|
406
|
+
type: "string",
|
|
407
|
+
description: "Optional new name.",
|
|
408
|
+
},
|
|
409
|
+
slug: {
|
|
410
|
+
type: "string",
|
|
411
|
+
description: "Optional new URL segment. Not allowed for the home page.",
|
|
412
|
+
},
|
|
413
|
+
parentTemplateId: {
|
|
414
|
+
type: "string",
|
|
415
|
+
description: "Optional new parent page ID, to move this page elsewhere in the site's tree. Rejected if it would create a cycle (e.g. moving a page underneath its own sub-page).",
|
|
416
|
+
},
|
|
417
|
+
order: {
|
|
418
|
+
type: "number",
|
|
419
|
+
description: "Optional sort position among sibling pages under the same parent (lower = earlier).",
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
required: ["templateId"],
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "delete_landing_page_page",
|
|
427
|
+
description: "Deletes a page. If it has sub-pages nested under it, they're deleted too (cascade) — the response reports how many. Deleting a site's home page deletes the whole site, including every page nested under it and its published domain link — this can't be undone, confirm with the user first.",
|
|
428
|
+
inputSchema: {
|
|
429
|
+
type: "object",
|
|
430
|
+
properties: {
|
|
431
|
+
templateId: {
|
|
432
|
+
type: "string",
|
|
433
|
+
description: "ID of the page to delete.",
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
required: ["templateId"],
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "duplicate_landing_page_page",
|
|
441
|
+
description: "Clones a sub-page's content into a new sibling page under the same parent — handy for building several similar pages (e.g. multiple product pages) without starting blank. Not available for a site's home page. Requires an Ultra subscription plan.",
|
|
442
|
+
inputSchema: {
|
|
443
|
+
type: "object",
|
|
444
|
+
properties: {
|
|
445
|
+
templateId: {
|
|
446
|
+
type: "string",
|
|
447
|
+
description: "ID of the sub-page to duplicate — must not be a home page.",
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
required: ["templateId"],
|
|
451
|
+
},
|
|
452
|
+
},
|
|
311
453
|
{
|
|
312
454
|
name: "list_landing_pages",
|
|
313
455
|
description: "Lists all saved landing page templates and published domain URLs in the user's Plexo account.",
|
|
@@ -362,6 +504,7 @@ Uses the SAME fully-hydrated layout schema as publish_landing_page/create_email_
|
|
|
362
504
|
},
|
|
363
505
|
},
|
|
364
506
|
},
|
|
507
|
+
...BLOG_TOOL_DEFS,
|
|
365
508
|
],
|
|
366
509
|
};
|
|
367
510
|
});
|
|
@@ -421,6 +564,90 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
421
564
|
};
|
|
422
565
|
}
|
|
423
566
|
|
|
567
|
+
case "create_landing_page": {
|
|
568
|
+
const result = await client.createLandingPage(args as any);
|
|
569
|
+
return {
|
|
570
|
+
content: [
|
|
571
|
+
{
|
|
572
|
+
type: "text",
|
|
573
|
+
text: JSON.stringify(result, null, 2),
|
|
574
|
+
},
|
|
575
|
+
],
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
case "publish_existing_landing_page": {
|
|
580
|
+
const result = await client.publishExistingLandingPage(args as any);
|
|
581
|
+
return {
|
|
582
|
+
content: [
|
|
583
|
+
{
|
|
584
|
+
type: "text",
|
|
585
|
+
text: JSON.stringify(result, null, 2),
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
case "create_landing_page_subpage": {
|
|
592
|
+
const result = await client.createLandingPageSubpage(args as any);
|
|
593
|
+
return {
|
|
594
|
+
content: [
|
|
595
|
+
{
|
|
596
|
+
type: "text",
|
|
597
|
+
text: JSON.stringify(result, null, 2),
|
|
598
|
+
},
|
|
599
|
+
],
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
case "get_landing_page_pages": {
|
|
604
|
+
const result = await client.getLandingPagePages((args as any)?.templateId);
|
|
605
|
+
return {
|
|
606
|
+
content: [
|
|
607
|
+
{
|
|
608
|
+
type: "text",
|
|
609
|
+
text: JSON.stringify(result, null, 2),
|
|
610
|
+
},
|
|
611
|
+
],
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
case "update_landing_page_page": {
|
|
616
|
+
const result = await client.updateLandingPagePage(args as any);
|
|
617
|
+
return {
|
|
618
|
+
content: [
|
|
619
|
+
{
|
|
620
|
+
type: "text",
|
|
621
|
+
text: JSON.stringify(result, null, 2),
|
|
622
|
+
},
|
|
623
|
+
],
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
case "delete_landing_page_page": {
|
|
628
|
+
const result = await client.deleteLandingPagePage((args as any)?.templateId);
|
|
629
|
+
return {
|
|
630
|
+
content: [
|
|
631
|
+
{
|
|
632
|
+
type: "text",
|
|
633
|
+
text: JSON.stringify(result, null, 2),
|
|
634
|
+
},
|
|
635
|
+
],
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
case "duplicate_landing_page_page": {
|
|
640
|
+
const result = await client.duplicateLandingPagePage((args as any)?.templateId);
|
|
641
|
+
return {
|
|
642
|
+
content: [
|
|
643
|
+
{
|
|
644
|
+
type: "text",
|
|
645
|
+
text: JSON.stringify(result, null, 2),
|
|
646
|
+
},
|
|
647
|
+
],
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
424
651
|
case "list_landing_pages": {
|
|
425
652
|
const data = await client.listTemplates();
|
|
426
653
|
const landingPages = (data.templates || []).filter(
|
|
@@ -495,8 +722,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
495
722
|
};
|
|
496
723
|
}
|
|
497
724
|
|
|
498
|
-
default:
|
|
725
|
+
default: {
|
|
726
|
+
if (BLOG_TOOL_NAMES.has(name)) {
|
|
727
|
+
const result = await handleBlogToolCall(name, (args as any) || {}, client);
|
|
728
|
+
return {
|
|
729
|
+
content: [
|
|
730
|
+
{
|
|
731
|
+
type: "text",
|
|
732
|
+
text: JSON.stringify(result, null, 2),
|
|
733
|
+
},
|
|
734
|
+
],
|
|
735
|
+
};
|
|
736
|
+
}
|
|
499
737
|
throw new Error(`Unknown tool: ${name}`);
|
|
738
|
+
}
|
|
500
739
|
}
|
|
501
740
|
} catch (error) {
|
|
502
741
|
return {
|