gearvn-pages-mcp-server 1.2.0 → 1.4.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 +5 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/delete-page.d.ts +9 -0
- package/dist/tools/delete-page.d.ts.map +1 -0
- package/dist/tools/delete-page.js +39 -0
- package/dist/tools/delete-page.js.map +1 -0
- package/dist/tools/deploy-page.d.ts.map +1 -1
- package/dist/tools/deploy-page.js +3 -4
- package/dist/tools/deploy-page.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/index.ts +4 -1
- package/src/tools/delete-page.ts +55 -0
- package/src/tools/deploy-page.ts +3 -4
- package/src/types.ts +8 -0
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { DEPLOY_PAGE_TOOL, handleDeployPage } from "./tools/deploy-page.js";
|
|
6
6
|
import { LIST_PAGES_TOOL, handleListPages } from "./tools/list-pages.js";
|
|
7
|
+
import { DELETE_PAGE_TOOL, handleDeletePage } from "./tools/delete-page.js";
|
|
7
8
|
// Create MCP server
|
|
8
9
|
const server = new Server({
|
|
9
10
|
name: "gearvn-pages-mcp-server",
|
|
@@ -16,7 +17,7 @@ const server = new Server({
|
|
|
16
17
|
// Handler for listing available tools
|
|
17
18
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
18
19
|
return {
|
|
19
|
-
tools: [DEPLOY_PAGE_TOOL, LIST_PAGES_TOOL],
|
|
20
|
+
tools: [DEPLOY_PAGE_TOOL, LIST_PAGES_TOOL, DELETE_PAGE_TOOL],
|
|
20
21
|
};
|
|
21
22
|
});
|
|
22
23
|
// Handler for tool calls
|
|
@@ -29,6 +30,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
29
30
|
else if (name === "list-pages") {
|
|
30
31
|
return await handleListPages();
|
|
31
32
|
}
|
|
33
|
+
else if (name === "delete-page") {
|
|
34
|
+
return await handleDeletePage(args);
|
|
35
|
+
}
|
|
32
36
|
else {
|
|
33
37
|
throw new Error(`Unknown tool: ${name}`);
|
|
34
38
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,oBAAoB;AACpB,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EA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AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
export declare const DELETE_PAGE_TOOL: Tool;
|
|
3
|
+
export declare function handleDeletePage(args: unknown): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=delete-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-page.d.ts","sourceRoot":"","sources":["../../src/tools/delete-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,IAe9B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO;;;;;GAiCnD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { callAPI } from "../api.js";
|
|
2
|
+
export const DELETE_PAGE_TOOL = {
|
|
3
|
+
name: "delete-page",
|
|
4
|
+
description: "Delete a page by its slug. IMPORTANT: You must use the EXACT slug from list-pages response, including the timestamp suffix (e.g., 'my-page-1730229600'). Only pages owned by your API key can be deleted. Returns success message on successful deletion.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
slug: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "The exact slug of the page to delete. Must match the slug from list-pages response, including timestamp suffix.",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
required: ["slug"],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export async function handleDeletePage(args) {
|
|
17
|
+
const { slug } = args;
|
|
18
|
+
// Validate inputs
|
|
19
|
+
if (!slug) {
|
|
20
|
+
throw new Error("Missing required parameter: slug is required");
|
|
21
|
+
}
|
|
22
|
+
// Call the delete API
|
|
23
|
+
const response = await callAPI("/v1/pages", "DELETE", {
|
|
24
|
+
slug,
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: JSON.stringify({
|
|
31
|
+
success: true,
|
|
32
|
+
message: response.message,
|
|
33
|
+
slug: slug,
|
|
34
|
+
}, null, 2),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=delete-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-page.js","sourceRoot":"","sources":["../../src/tools/delete-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,2PAA2P;IAC7P,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,iHAAiH;aACpH;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAa;IAClD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAsB,CAAC;IAExC,kBAAkB;IAClB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,sBAAsB;IACtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,WAAW,EACX,QAAQ,EACR;QACE,IAAI;KACL,CACF,CAAC;IAEF,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,IAAI,EAAE,IAAI;iBACX,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-page.d.ts","sourceRoot":"","sources":["../../src/tools/deploy-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy-page.d.ts","sourceRoot":"","sources":["../../src/tools/deploy-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,IA2B9B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO;;;;;GAiCnD"}
|
|
@@ -11,14 +11,13 @@ export const DEPLOY_PAGE_TOOL = {
|
|
|
11
11
|
},
|
|
12
12
|
content: {
|
|
13
13
|
type: "string",
|
|
14
|
-
description:
|
|
14
|
+
description: 'The complete HTML content of the page. Must include <!DOCTYPE html>, <html>, <head> with TailwindCSS CDN link (https://cdn.tailwindcss.com), and <body> tags. Use TailwindCSS utility classes for all styling. JavaScript libraries are allowed but must be imported via CDN links in <script> tags (e.g., Alpine.js from CDN, Chart.js from CDN). Vanilla JavaScript is also acceptable. NO build tools, npm packages, or SPA frameworks (React/Vue/Angular). IMPORTANT: Properly escape all special characters in HTML for JSON (" for double quotes, \\\\ for backslashes, \\n for newlines, etc.). Example: <div class="container"> should be passed as <div class=\\"container\\">',
|
|
15
15
|
},
|
|
16
16
|
slug: {
|
|
17
17
|
type: "string",
|
|
18
18
|
description: "The URL slug for the page. IMPORTANT BEHAVIOR: " +
|
|
19
|
-
"
|
|
20
|
-
"FOR UPDATING EXISTING PAGES: Use the EXACT full slug including timestamp (e.g., 'quan-ly-thu-chi-1730229600') from the
|
|
21
|
-
"If the exact slug exists for this API key, the page will be updated. Otherwise, a new page with a new timestamp will be created.",
|
|
19
|
+
"Generate a simple kebab-case slug (e.g., 'quan-ly-thu-chi', 'landing-page')." +
|
|
20
|
+
"FOR UPDATING EXISTING PAGES: Use the EXACT full slug including timestamp (e.g., 'quan-ly-thu-chi-1730229600') from the backend response. ",
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
23
|
required: ["title", "content", "slug"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-page.js","sourceRoot":"","sources":["../../src/tools/deploy-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,6sBAA6sB;IAC/sB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,6FAA6F;aAChG;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"deploy-page.js","sourceRoot":"","sources":["../../src/tools/deploy-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,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file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gearvn-pages-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "MCP Server for GearVN Pages deployment and management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"gearvn-pages-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"watch": "tsc --watch",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
10
16
|
"keywords": [
|
|
11
17
|
"mcp",
|
|
12
18
|
"model-context-protocol",
|
|
@@ -20,10 +26,5 @@
|
|
|
20
26
|
"devDependencies": {
|
|
21
27
|
"@types/node": "^22.10.2",
|
|
22
28
|
"typescript": "^5.7.2"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsc",
|
|
26
|
-
"watch": "tsc --watch",
|
|
27
|
-
"start": "node dist/index.js"
|
|
28
29
|
}
|
|
29
|
-
}
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { DEPLOY_PAGE_TOOL, handleDeployPage } from "./tools/deploy-page.js";
|
|
10
10
|
import { LIST_PAGES_TOOL, handleListPages } from "./tools/list-pages.js";
|
|
11
|
+
import { DELETE_PAGE_TOOL, handleDeletePage } from "./tools/delete-page.js";
|
|
11
12
|
|
|
12
13
|
// Create MCP server
|
|
13
14
|
const server = new Server(
|
|
@@ -25,7 +26,7 @@ const server = new Server(
|
|
|
25
26
|
// Handler for listing available tools
|
|
26
27
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
27
28
|
return {
|
|
28
|
-
tools: [DEPLOY_PAGE_TOOL, LIST_PAGES_TOOL],
|
|
29
|
+
tools: [DEPLOY_PAGE_TOOL, LIST_PAGES_TOOL, DELETE_PAGE_TOOL],
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
32
|
|
|
@@ -38,6 +39,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
38
39
|
return await handleDeployPage(args);
|
|
39
40
|
} else if (name === "list-pages") {
|
|
40
41
|
return await handleListPages();
|
|
42
|
+
} else if (name === "delete-page") {
|
|
43
|
+
return await handleDeletePage(args);
|
|
41
44
|
} else {
|
|
42
45
|
throw new Error(`Unknown tool: ${name}`);
|
|
43
46
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { callAPI } from "../api.js";
|
|
3
|
+
import { DeletePageArgs, DeletePageResponse } from "../types.js";
|
|
4
|
+
|
|
5
|
+
export const DELETE_PAGE_TOOL: Tool = {
|
|
6
|
+
name: "delete-page",
|
|
7
|
+
description:
|
|
8
|
+
"Delete a page by its slug. IMPORTANT: You must use the EXACT slug from list-pages response, including the timestamp suffix (e.g., 'my-page-1730229600'). Only pages owned by your API key can be deleted. Returns success message on successful deletion.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
slug: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description:
|
|
15
|
+
"The exact slug of the page to delete. Must match the slug from list-pages response, including timestamp suffix.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ["slug"],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export async function handleDeletePage(args: unknown) {
|
|
23
|
+
const { slug } = args as DeletePageArgs;
|
|
24
|
+
|
|
25
|
+
// Validate inputs
|
|
26
|
+
if (!slug) {
|
|
27
|
+
throw new Error("Missing required parameter: slug is required");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Call the delete API
|
|
31
|
+
const response = await callAPI<DeletePageResponse>(
|
|
32
|
+
"/v1/pages",
|
|
33
|
+
"DELETE",
|
|
34
|
+
{
|
|
35
|
+
slug,
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: "text" as const,
|
|
43
|
+
text: JSON.stringify(
|
|
44
|
+
{
|
|
45
|
+
success: true,
|
|
46
|
+
message: response.message,
|
|
47
|
+
slug: slug,
|
|
48
|
+
},
|
|
49
|
+
null,
|
|
50
|
+
2
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
package/src/tools/deploy-page.ts
CHANGED
|
@@ -17,15 +17,14 @@ export const DEPLOY_PAGE_TOOL: Tool = {
|
|
|
17
17
|
content: {
|
|
18
18
|
type: "string",
|
|
19
19
|
description:
|
|
20
|
-
|
|
20
|
+
'The complete HTML content of the page. Must include <!DOCTYPE html>, <html>, <head> with TailwindCSS CDN link (https://cdn.tailwindcss.com), and <body> tags. Use TailwindCSS utility classes for all styling. JavaScript libraries are allowed but must be imported via CDN links in <script> tags (e.g., Alpine.js from CDN, Chart.js from CDN). Vanilla JavaScript is also acceptable. NO build tools, npm packages, or SPA frameworks (React/Vue/Angular). IMPORTANT: Properly escape all special characters in HTML for JSON (" for double quotes, \\\\ for backslashes, \\n for newlines, etc.). Example: <div class="container"> should be passed as <div class=\\"container\\">',
|
|
21
21
|
},
|
|
22
22
|
slug: {
|
|
23
23
|
type: "string",
|
|
24
24
|
description:
|
|
25
25
|
"The URL slug for the page. IMPORTANT BEHAVIOR: " +
|
|
26
|
-
"
|
|
27
|
-
"FOR UPDATING EXISTING PAGES: Use the EXACT full slug including timestamp (e.g., 'quan-ly-thu-chi-1730229600') from the
|
|
28
|
-
"If the exact slug exists for this API key, the page will be updated. Otherwise, a new page with a new timestamp will be created.",
|
|
26
|
+
"Generate a simple kebab-case slug (e.g., 'quan-ly-thu-chi', 'landing-page')." +
|
|
27
|
+
"FOR UPDATING EXISTING PAGES: Use the EXACT full slug including timestamp (e.g., 'quan-ly-thu-chi-1730229600') from the backend response. ",
|
|
29
28
|
},
|
|
30
29
|
},
|
|
31
30
|
required: ["title", "content", "slug"],
|