gearvn-pages-mcp-server 1.7.0 → 1.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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/deploy-page.d.ts.map +1 -1
- package/dist/tools/deploy-page.js +10 -1
- package/dist/tools/deploy-page.js.map +1 -1
- package/dist/tools/get-page.d.ts.map +1 -1
- package/dist/tools/get-page.js +44 -3
- package/dist/tools/get-page.js.map +1 -1
- package/dist/tools/list-pages.d.ts +1 -1
- package/dist/tools/list-pages.d.ts.map +1 -1
- package/dist/tools/list-pages.js +95 -5
- package/dist/tools/list-pages.js.map +1 -1
- package/dist/tools/update-page.d.ts.map +1 -1
- package/dist/tools/update-page.js +12 -4
- package/dist/tools/update-page.js.map +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/tools/deploy-page.ts +12 -1
- package/src/tools/get-page.ts +47 -4
- package/src/tools/list-pages.ts +99 -7
- package/src/tools/update-page.ts +13 -4
- package/src/types.ts +21 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
30
30
|
return await handleDeployPage(args);
|
|
31
31
|
}
|
|
32
32
|
else if (name === "list-pages") {
|
|
33
|
-
return await handleListPages();
|
|
33
|
+
return await handleListPages(args);
|
|
34
34
|
}
|
|
35
35
|
else if (name === "get-page") {
|
|
36
36
|
return await handleGetPage(args);
|
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,GACv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AC;AAClB,CAAC,CAAC,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,IAwC9B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO;;;;;GAoDnD"}
|
|
@@ -26,12 +26,16 @@ export const DEPLOY_PAGE_TOOL = {
|
|
|
26
26
|
},
|
|
27
27
|
description: "Optional array of tags to categorize the page (e.g., ['dashboard', 'finance']). Tags are case-insensitive for filtering.",
|
|
28
28
|
},
|
|
29
|
+
metadata: {
|
|
30
|
+
type: "object",
|
|
31
|
+
description: "Optional key-value metadata to store with the page. Can contain any JSON structure (strings, numbers, arrays, nested objects). Useful for storing additional information like author/owner, category/classification, related resources, or custom attributes for filtering. Example: { \"vendor\": \"Apple\", \"category\": \"product\", \"attendees\": [\"John\", \"Jane\"] }. This metadata is searchable via list-pages tool.",
|
|
32
|
+
},
|
|
29
33
|
},
|
|
30
34
|
required: ["title", "content", "slug"],
|
|
31
35
|
},
|
|
32
36
|
};
|
|
33
37
|
export async function handleDeployPage(args) {
|
|
34
|
-
const { title, content, slug, tags } = args;
|
|
38
|
+
const { title, content, slug, tags, metadata } = args;
|
|
35
39
|
// Validate inputs
|
|
36
40
|
if (!title || !content || !slug) {
|
|
37
41
|
throw new Error("Missing required parameters: title, content, and slug are required");
|
|
@@ -46,6 +50,10 @@ export async function handleDeployPage(args) {
|
|
|
46
50
|
if (tags && tags.length > 0) {
|
|
47
51
|
requestBody.tags = tags;
|
|
48
52
|
}
|
|
53
|
+
// Add metadata if provided
|
|
54
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
55
|
+
requestBody.metadata = metadata;
|
|
56
|
+
}
|
|
49
57
|
// Call the deploy API
|
|
50
58
|
const response = await callAPI("/v1/deploy", "POST", requestBody);
|
|
51
59
|
return {
|
|
@@ -57,6 +65,7 @@ export async function handleDeployPage(args) {
|
|
|
57
65
|
message: "Page deployed successfully",
|
|
58
66
|
url: response.url,
|
|
59
67
|
tags: tags || [],
|
|
68
|
+
metadata: metadata || {},
|
|
60
69
|
}, null, 2),
|
|
61
70
|
},
|
|
62
71
|
],
|
|
@@ -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,ypBAAypB;aAC5pB;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,iDAAiD;oBACjD,8EAA8E;oBAC9E,2IAA2I;aAC9I;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EACT,0HAA0H;aAC7H;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;KACvC;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAa;IAClD,MAAM,EA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,KAAK;QACL,OAAO;QACP,IAAI;KACL,CAAC;IAEF,uBAAuB;IACvB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,2BAA2B;IAC3B,IAAI,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjD,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAClC,CAAC;IAED,sBAAsB;IACtB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,YAAY,EACZ,MAAM,EACN,WAAW,CACZ,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,4BAA4B;oBACrC,GAAG,EAAE,QAAQ,CAAC,GAAG;oBACjB,IAAI,EAAE,IAAI,IAAI,EAAE;oBAChB,QAAQ,EAAE,QAAQ,IAAI,EAAE;iBACzB,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-page.d.ts","sourceRoot":"","sources":["../../src/tools/get-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"get-page.d.ts","sourceRoot":"","sources":["../../src/tools/get-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,aAAa,EAAE,IA+C3B,CAAC;AAEF,wBAAsB,aAAa,CAAC,IAAI,EAAE,OAAO;;;;;GAuChD"}
|
package/dist/tools/get-page.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { callAPI } from "../api.js";
|
|
2
2
|
export const GET_PAGE_TOOL = {
|
|
3
3
|
name: "get-page",
|
|
4
|
-
description:
|
|
4
|
+
description: `Get the full content of a page by its slug.
|
|
5
|
+
|
|
6
|
+
CONTENT FORMAT:
|
|
7
|
+
- By default, returns HTML content
|
|
8
|
+
- md=true: Returns content converted to Markdown (useful for AI processing)
|
|
9
|
+
|
|
10
|
+
METADATA CONTROL:
|
|
11
|
+
- By default, metadata only returns keys with empty values (to reduce payload)
|
|
12
|
+
- metafull=true: Returns full metadata with all values
|
|
13
|
+
- metafields=["key1","key2"]: Returns values only for specified keys
|
|
14
|
+
|
|
15
|
+
EXAMPLES:
|
|
16
|
+
1. Get page HTML: get-page with slug="my-page-123456"
|
|
17
|
+
2. Get page as Markdown: get-page with slug="my-page-123456", md=true
|
|
18
|
+
3. Get page with full metadata: get-page with slug="my-page-123456", metafull=true
|
|
19
|
+
4. Get page with specific metadata: get-page with slug="my-page-123456", metafields=["risks","actions"]
|
|
20
|
+
|
|
21
|
+
Returns: Page data with id, slug, title, content (HTML or Markdown), tags, and metadata.`,
|
|
5
22
|
inputSchema: {
|
|
6
23
|
type: "object",
|
|
7
24
|
properties: {
|
|
@@ -9,18 +26,42 @@ export const GET_PAGE_TOOL = {
|
|
|
9
26
|
type: "string",
|
|
10
27
|
description: "The exact slug of the page to retrieve (must match the slug from list-pages response, including timestamp suffix)",
|
|
11
28
|
},
|
|
29
|
+
md: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
description: "Set to true to return content as Markdown instead of HTML. Useful for AI processing.",
|
|
32
|
+
},
|
|
33
|
+
metafull: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
description: "Set to true to return full metadata with all values. By default, metadata only returns keys with empty values.",
|
|
36
|
+
},
|
|
37
|
+
metafields: {
|
|
38
|
+
type: "array",
|
|
39
|
+
items: { type: "string" },
|
|
40
|
+
description: "Array of metadata keys to return with full values. E.g., ['risks', 'actions'] returns only these keys with values.",
|
|
41
|
+
},
|
|
12
42
|
},
|
|
13
43
|
required: ["slug"],
|
|
14
44
|
},
|
|
15
45
|
};
|
|
16
46
|
export async function handleGetPage(args) {
|
|
17
|
-
const { slug } = args;
|
|
47
|
+
const { slug, md, metafull, metafields } = args;
|
|
18
48
|
// Validate inputs
|
|
19
49
|
if (!slug) {
|
|
20
50
|
throw new Error("Missing required parameter: slug is required");
|
|
21
51
|
}
|
|
52
|
+
// Build query parameters
|
|
53
|
+
const params = new URLSearchParams();
|
|
54
|
+
if (md)
|
|
55
|
+
params.append("md", "1");
|
|
56
|
+
if (metafull)
|
|
57
|
+
params.append("metafull", "1");
|
|
58
|
+
if (metafields && metafields.length > 0) {
|
|
59
|
+
params.append("metafields", `[${metafields.join(",")}]`);
|
|
60
|
+
}
|
|
61
|
+
const queryString = params.toString();
|
|
62
|
+
const endpoint = queryString ? `/v1/get-page?${queryString}` : "/v1/get-page";
|
|
22
63
|
// Call the get-page API
|
|
23
|
-
const response = await callAPI(
|
|
64
|
+
const response = await callAPI(endpoint, "POST", {
|
|
24
65
|
slug,
|
|
25
66
|
});
|
|
26
67
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-page.js","sourceRoot":"","sources":["../../src/tools/get-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,UAAU;IAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"get-page.js","sourceRoot":"","sources":["../../src/tools/get-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;;;;;;;;;;;;;;;;;yFAiB0E;IACvF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU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B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAkB,QAAQ,EAAE,MAAM,EAAE;QAChE,IAAI;KACL,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,QAAQ;iBACf,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
export declare const LIST_PAGES_TOOL: Tool;
|
|
3
|
-
export declare function handleListPages(): Promise<{
|
|
3
|
+
export declare function handleListPages(args?: unknown): Promise<{
|
|
4
4
|
content: {
|
|
5
5
|
type: "text";
|
|
6
6
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-pages.d.ts","sourceRoot":"","sources":["../../src/tools/list-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"list-pages.d.ts","sourceRoot":"","sources":["../../src/tools/list-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,eAAe,EAAE,IA+E7B,CAAC;AAEF,wBAAsB,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO;;;;;GAyCnD"}
|
package/dist/tools/list-pages.js
CHANGED
|
@@ -1,22 +1,112 @@
|
|
|
1
1
|
import { callAPI } from "../api.js";
|
|
2
2
|
export const LIST_PAGES_TOOL = {
|
|
3
3
|
name: "list-pages",
|
|
4
|
-
description:
|
|
4
|
+
description: `List all deployed pages with optional filtering, search, and pagination.
|
|
5
|
+
|
|
6
|
+
PAGINATION:
|
|
7
|
+
- page: Page number (default: 1)
|
|
8
|
+
- limit: Items per page (default: 50)
|
|
9
|
+
|
|
10
|
+
FILTERING OPTIONS:
|
|
11
|
+
- Filter by tag: Use 'tags' parameter to find pages with a specific tag
|
|
12
|
+
- Search across fields: Use 'search' parameter to find pages containing the search term
|
|
13
|
+
|
|
14
|
+
SEARCH BEHAVIOR:
|
|
15
|
+
- Without 'key': Searches across ALL fields (title, slug, tags, and metadata values)
|
|
16
|
+
- With 'key': Searches only in the specified field
|
|
17
|
+
- key="title": Search in page title only
|
|
18
|
+
- key="slug": Search in page slug only
|
|
19
|
+
- key="tags": Search in tags array only
|
|
20
|
+
- key="metadata": Search in metadata values (all nested levels)
|
|
21
|
+
- With 'key=metadata' + 'metadata_key': Search in a specific metadata field only
|
|
22
|
+
|
|
23
|
+
METADATA CONTROL:
|
|
24
|
+
- By default, metadata only returns keys with empty values (to reduce payload)
|
|
25
|
+
- metafull=true: Returns full metadata with all values
|
|
26
|
+
- metafields=["key1","key2"]: Returns values only for specified keys
|
|
27
|
+
|
|
28
|
+
EXAMPLES:
|
|
29
|
+
1. Find all pages: list-pages (no params)
|
|
30
|
+
2. Paginate: list-pages with page=2, limit=10
|
|
31
|
+
3. Find pages tagged "marketing": list-pages with tags="marketing"
|
|
32
|
+
4. Find pages with full metadata: list-pages with metafull=true
|
|
33
|
+
5. Find pages with specific metadata: list-pages with metafields=["risks","actions"]
|
|
34
|
+
|
|
35
|
+
Returns: Paginated response with total, page, limit, and array of page summaries.`,
|
|
5
36
|
inputSchema: {
|
|
6
37
|
type: "object",
|
|
7
|
-
properties: {
|
|
38
|
+
properties: {
|
|
39
|
+
page: {
|
|
40
|
+
type: "number",
|
|
41
|
+
description: "Page number for pagination (default: 1)",
|
|
42
|
+
},
|
|
43
|
+
limit: {
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Number of items per page (default: 50)",
|
|
46
|
+
},
|
|
47
|
+
tags: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Filter by exact tag match (case-insensitive). Returns pages that have this tag.",
|
|
50
|
+
},
|
|
51
|
+
search: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Search term to find pages. Case-insensitive partial match. Without 'key' param, searches across title, slug, tags, and all metadata values.",
|
|
54
|
+
},
|
|
55
|
+
key: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["title", "tags", "slug", "metadata"],
|
|
58
|
+
description: "Specify which field to search in. Only used with 'search' param. If omitted, searches all fields.",
|
|
59
|
+
},
|
|
60
|
+
metadata_key: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "When key='metadata', specify a specific metadata field to search in. E.g., 'vendor' to search only in metadata.vendor",
|
|
63
|
+
},
|
|
64
|
+
metafull: {
|
|
65
|
+
type: "boolean",
|
|
66
|
+
description: "Set to true to return full metadata with all values. By default, metadata only returns keys with empty values.",
|
|
67
|
+
},
|
|
68
|
+
metafields: {
|
|
69
|
+
type: "array",
|
|
70
|
+
items: { type: "string" },
|
|
71
|
+
description: "Array of metadata keys to return with full values. E.g., ['risks', 'actions'] returns only these keys with values.",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
8
74
|
},
|
|
9
75
|
};
|
|
10
|
-
export async function handleListPages() {
|
|
76
|
+
export async function handleListPages(args) {
|
|
77
|
+
const { tags, search, key, metadata_key, page, limit, metafull, metafields } = args || {};
|
|
78
|
+
// Build query parameters
|
|
79
|
+
const params = new URLSearchParams();
|
|
80
|
+
if (tags)
|
|
81
|
+
params.append("tags", tags);
|
|
82
|
+
if (search)
|
|
83
|
+
params.append("search", search);
|
|
84
|
+
if (key)
|
|
85
|
+
params.append("key", key);
|
|
86
|
+
if (metadata_key)
|
|
87
|
+
params.append("metadata_key", metadata_key);
|
|
88
|
+
if (page)
|
|
89
|
+
params.append("page", page.toString());
|
|
90
|
+
if (limit)
|
|
91
|
+
params.append("limit", limit.toString());
|
|
92
|
+
if (metafull)
|
|
93
|
+
params.append("metafull", "1");
|
|
94
|
+
if (metafields && metafields.length > 0) {
|
|
95
|
+
params.append("metafields", `[${metafields.join(",")}]`);
|
|
96
|
+
}
|
|
97
|
+
const queryString = params.toString();
|
|
98
|
+
const endpoint = queryString ? `/v1/pages?${queryString}` : "/v1/pages";
|
|
11
99
|
// Call the list pages API
|
|
12
|
-
const response = await callAPI(
|
|
100
|
+
const response = await callAPI(endpoint, "GET");
|
|
13
101
|
return {
|
|
14
102
|
content: [
|
|
15
103
|
{
|
|
16
104
|
type: "text",
|
|
17
105
|
text: JSON.stringify({
|
|
18
106
|
success: true,
|
|
19
|
-
|
|
107
|
+
total: response.total,
|
|
108
|
+
page: response.page,
|
|
109
|
+
limit: response.limit,
|
|
20
110
|
pages: response.pages,
|
|
21
111
|
}, null, 2),
|
|
22
112
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-pages.js","sourceRoot":"","sources":["../../src/tools/list-pages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,IAAI,EAAE,YAAY;IAClB,WAAW,
|
|
1
|
+
{"version":3,"file":"list-pages.js","sourceRoot":"","sources":["../../src/tools/list-pages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFA+BmE;IAChF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wCAAwC;aACtD;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,iFAAiF;aACpF;YACD,MAAM,EAA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,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpD,IAAI,QAAQ;QAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAC7C,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,aAAa,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;IAExE,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAoB,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEnE,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,KAAK,EAAE,QAAQ,CAAC,KAAK;iBACtB,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-page.d.ts","sourceRoot":"","sources":["../../src/tools/update-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"update-page.d.ts","sourceRoot":"","sources":["../../src/tools/update-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI1D,eAAO,MAAM,gBAAgB,EAAE,IAqC9B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO;;;;;GAyDnD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callAPI } from "../api.js";
|
|
2
2
|
export const UPDATE_PAGE_TOOL = {
|
|
3
3
|
name: "update-page",
|
|
4
|
-
description: "Update an existing page by slug. You can update title, content, or
|
|
4
|
+
description: "Update an existing page by slug. You can update title, content, tags, or metadata individually or in combination. IMPORTANT: You must use the EXACT slug from list-pages response, including the timestamp suffix (e.g., 'my-page-1730229600'). At least one field (title, content, tags, or metadata) must be provided for update.",
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: "object",
|
|
7
7
|
properties: {
|
|
@@ -24,19 +24,24 @@ export const UPDATE_PAGE_TOOL = {
|
|
|
24
24
|
},
|
|
25
25
|
description: "Optional new array of tags to categorize the page (e.g., ['dashboard', 'finance']). This will replace existing tags. Tags are case-insensitive for filtering.",
|
|
26
26
|
},
|
|
27
|
+
metadata: {
|
|
28
|
+
type: "object",
|
|
29
|
+
description: "New metadata object to replace existing metadata. Note: This REPLACES the entire metadata object, not merges. To add a field, include all existing fields plus the new one. To remove a field, include all fields except the one to remove. Pass empty object {} to clear all metadata.",
|
|
30
|
+
},
|
|
27
31
|
},
|
|
28
32
|
required: ["slug"],
|
|
29
33
|
},
|
|
30
34
|
};
|
|
31
35
|
export async function handleUpdatePage(args) {
|
|
32
|
-
const { slug, title, content, tags } = args;
|
|
36
|
+
const { slug, title, content, tags, metadata } = args;
|
|
33
37
|
// Validate inputs
|
|
34
38
|
if (!slug) {
|
|
35
39
|
throw new Error("Missing required parameter: slug is required");
|
|
36
40
|
}
|
|
37
41
|
// Check if at least one field is provided
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
const hasMetadata = metadata && Object.keys(metadata).length > 0;
|
|
43
|
+
if (!title && !content && (!tags || tags.length === 0) && !hasMetadata) {
|
|
44
|
+
throw new Error("At least one field (title, content, tags, or metadata) must be provided for update");
|
|
40
45
|
}
|
|
41
46
|
// Build request body
|
|
42
47
|
const requestBody = {
|
|
@@ -51,6 +56,9 @@ export async function handleUpdatePage(args) {
|
|
|
51
56
|
if (tags && tags.length > 0) {
|
|
52
57
|
requestBody.tags = tags;
|
|
53
58
|
}
|
|
59
|
+
if (hasMetadata) {
|
|
60
|
+
requestBody.metadata = metadata;
|
|
61
|
+
}
|
|
54
62
|
// Call the update API
|
|
55
63
|
const response = await callAPI("/v1/pages", "PUT", requestBody);
|
|
56
64
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-page.js","sourceRoot":"","sources":["../../src/tools/update-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,
|
|
1
|
+
{"version":3,"file":"update-page.js","sourceRoot":"","sources":["../../src/tools/update-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,qUAAqU;IACvU,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,iHAAiH;aACpH;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,6GAA6G;aAChH;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EACT,+JAA+J;aAClK;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAA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,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,QAAQ,CAAC,OAAO;oBACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;iBACpB,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface DeployPageArgs {
|
|
|
3
3
|
content: string;
|
|
4
4
|
slug: string;
|
|
5
5
|
tags?: string[];
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
6
7
|
}
|
|
7
8
|
export interface DeployPageResponse {
|
|
8
9
|
url: string;
|
|
@@ -13,11 +14,14 @@ export interface PageSummary {
|
|
|
13
14
|
title: string;
|
|
14
15
|
url: string;
|
|
15
16
|
tags?: string[];
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
16
18
|
created_at: string;
|
|
17
19
|
updated_at: string;
|
|
18
20
|
}
|
|
19
21
|
export interface ListPagesResponse {
|
|
20
|
-
|
|
22
|
+
total: number;
|
|
23
|
+
page: number;
|
|
24
|
+
limit: number;
|
|
21
25
|
pages: PageSummary[];
|
|
22
26
|
}
|
|
23
27
|
export interface UpdatePageArgs {
|
|
@@ -25,6 +29,7 @@ export interface UpdatePageArgs {
|
|
|
25
29
|
title?: string;
|
|
26
30
|
content?: string;
|
|
27
31
|
tags?: string[];
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
28
33
|
}
|
|
29
34
|
export interface UpdatePageResponse {
|
|
30
35
|
message: string;
|
|
@@ -38,6 +43,9 @@ export interface DeletePageResponse {
|
|
|
38
43
|
}
|
|
39
44
|
export interface GetPageArgs {
|
|
40
45
|
slug: string;
|
|
46
|
+
metafull?: boolean;
|
|
47
|
+
metafields?: string[];
|
|
48
|
+
md?: boolean;
|
|
41
49
|
}
|
|
42
50
|
export interface GetPageResponse {
|
|
43
51
|
id: number;
|
|
@@ -45,5 +53,16 @@ export interface GetPageResponse {
|
|
|
45
53
|
title: string;
|
|
46
54
|
content: string;
|
|
47
55
|
tags?: string[];
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export interface ListPagesArgs {
|
|
59
|
+
tags?: string;
|
|
60
|
+
search?: string;
|
|
61
|
+
key?: "title" | "tags" | "slug" | "metadata";
|
|
62
|
+
metadata_key?: string;
|
|
63
|
+
page?: number;
|
|
64
|
+
limit?: number;
|
|
65
|
+
metafull?: boolean;
|
|
66
|
+
metafields?: string[];
|
|
48
67
|
}
|
|
49
68
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
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;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;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,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,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AAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
40
40
|
if (name === "deploy-page") {
|
|
41
41
|
return await handleDeployPage(args);
|
|
42
42
|
} else if (name === "list-pages") {
|
|
43
|
-
return await handleListPages();
|
|
43
|
+
return await handleListPages(args);
|
|
44
44
|
} else if (name === "get-page") {
|
|
45
45
|
return await handleGetPage(args);
|
|
46
46
|
} else if (name === "update-page") {
|
package/src/tools/deploy-page.ts
CHANGED
|
@@ -34,13 +34,18 @@ export const DEPLOY_PAGE_TOOL: Tool = {
|
|
|
34
34
|
description:
|
|
35
35
|
"Optional array of tags to categorize the page (e.g., ['dashboard', 'finance']). Tags are case-insensitive for filtering.",
|
|
36
36
|
},
|
|
37
|
+
metadata: {
|
|
38
|
+
type: "object",
|
|
39
|
+
description:
|
|
40
|
+
"Optional key-value metadata to store with the page. Can contain any JSON structure (strings, numbers, arrays, nested objects). Useful for storing additional information like author/owner, category/classification, related resources, or custom attributes for filtering. Example: { \"vendor\": \"Apple\", \"category\": \"product\", \"attendees\": [\"John\", \"Jane\"] }. This metadata is searchable via list-pages tool.",
|
|
41
|
+
},
|
|
37
42
|
},
|
|
38
43
|
required: ["title", "content", "slug"],
|
|
39
44
|
},
|
|
40
45
|
};
|
|
41
46
|
|
|
42
47
|
export async function handleDeployPage(args: unknown) {
|
|
43
|
-
const { title, content, slug, tags } = args as DeployPageArgs;
|
|
48
|
+
const { title, content, slug, tags, metadata } = args as DeployPageArgs;
|
|
44
49
|
|
|
45
50
|
// Validate inputs
|
|
46
51
|
if (!title || !content || !slug) {
|
|
@@ -61,6 +66,11 @@ export async function handleDeployPage(args: unknown) {
|
|
|
61
66
|
requestBody.tags = tags;
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
// Add metadata if provided
|
|
70
|
+
if (metadata && Object.keys(metadata).length > 0) {
|
|
71
|
+
requestBody.metadata = metadata;
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
// Call the deploy API
|
|
65
75
|
const response = await callAPI<DeployPageResponse>(
|
|
66
76
|
"/v1/deploy",
|
|
@@ -78,6 +88,7 @@ export async function handleDeployPage(args: unknown) {
|
|
|
78
88
|
message: "Page deployed successfully",
|
|
79
89
|
url: response.url,
|
|
80
90
|
tags: tags || [],
|
|
91
|
+
metadata: metadata || {},
|
|
81
92
|
},
|
|
82
93
|
null,
|
|
83
94
|
2
|
package/src/tools/get-page.ts
CHANGED
|
@@ -4,8 +4,24 @@ import { GetPageArgs, GetPageResponse } from "../types.js";
|
|
|
4
4
|
|
|
5
5
|
export const GET_PAGE_TOOL: Tool = {
|
|
6
6
|
name: "get-page",
|
|
7
|
-
description:
|
|
8
|
-
|
|
7
|
+
description: `Get the full content of a page by its slug.
|
|
8
|
+
|
|
9
|
+
CONTENT FORMAT:
|
|
10
|
+
- By default, returns HTML content
|
|
11
|
+
- md=true: Returns content converted to Markdown (useful for AI processing)
|
|
12
|
+
|
|
13
|
+
METADATA CONTROL:
|
|
14
|
+
- By default, metadata only returns keys with empty values (to reduce payload)
|
|
15
|
+
- metafull=true: Returns full metadata with all values
|
|
16
|
+
- metafields=["key1","key2"]: Returns values only for specified keys
|
|
17
|
+
|
|
18
|
+
EXAMPLES:
|
|
19
|
+
1. Get page HTML: get-page with slug="my-page-123456"
|
|
20
|
+
2. Get page as Markdown: get-page with slug="my-page-123456", md=true
|
|
21
|
+
3. Get page with full metadata: get-page with slug="my-page-123456", metafull=true
|
|
22
|
+
4. Get page with specific metadata: get-page with slug="my-page-123456", metafields=["risks","actions"]
|
|
23
|
+
|
|
24
|
+
Returns: Page data with id, slug, title, content (HTML or Markdown), tags, and metadata.`,
|
|
9
25
|
inputSchema: {
|
|
10
26
|
type: "object",
|
|
11
27
|
properties: {
|
|
@@ -14,21 +30,48 @@ export const GET_PAGE_TOOL: Tool = {
|
|
|
14
30
|
description:
|
|
15
31
|
"The exact slug of the page to retrieve (must match the slug from list-pages response, including timestamp suffix)",
|
|
16
32
|
},
|
|
33
|
+
md: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
description:
|
|
36
|
+
"Set to true to return content as Markdown instead of HTML. Useful for AI processing.",
|
|
37
|
+
},
|
|
38
|
+
metafull: {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
description:
|
|
41
|
+
"Set to true to return full metadata with all values. By default, metadata only returns keys with empty values.",
|
|
42
|
+
},
|
|
43
|
+
metafields: {
|
|
44
|
+
type: "array",
|
|
45
|
+
items: { type: "string" },
|
|
46
|
+
description:
|
|
47
|
+
"Array of metadata keys to return with full values. E.g., ['risks', 'actions'] returns only these keys with values.",
|
|
48
|
+
},
|
|
17
49
|
},
|
|
18
50
|
required: ["slug"],
|
|
19
51
|
},
|
|
20
52
|
};
|
|
21
53
|
|
|
22
54
|
export async function handleGetPage(args: unknown) {
|
|
23
|
-
const { slug } = args as GetPageArgs;
|
|
55
|
+
const { slug, md, metafull, metafields } = args as GetPageArgs;
|
|
24
56
|
|
|
25
57
|
// Validate inputs
|
|
26
58
|
if (!slug) {
|
|
27
59
|
throw new Error("Missing required parameter: slug is required");
|
|
28
60
|
}
|
|
29
61
|
|
|
62
|
+
// Build query parameters
|
|
63
|
+
const params = new URLSearchParams();
|
|
64
|
+
if (md) params.append("md", "1");
|
|
65
|
+
if (metafull) params.append("metafull", "1");
|
|
66
|
+
if (metafields && metafields.length > 0) {
|
|
67
|
+
params.append("metafields", `[${metafields.join(",")}]`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const queryString = params.toString();
|
|
71
|
+
const endpoint = queryString ? `/v1/get-page?${queryString}` : "/v1/get-page";
|
|
72
|
+
|
|
30
73
|
// Call the get-page API
|
|
31
|
-
const response = await callAPI<GetPageResponse>(
|
|
74
|
+
const response = await callAPI<GetPageResponse>(endpoint, "POST", {
|
|
32
75
|
slug,
|
|
33
76
|
});
|
|
34
77
|
|
package/src/tools/list-pages.ts
CHANGED
|
@@ -1,20 +1,110 @@
|
|
|
1
1
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import { callAPI } from "../api.js";
|
|
3
|
-
import { ListPagesResponse } from "../types.js";
|
|
3
|
+
import { ListPagesArgs, ListPagesResponse } from "../types.js";
|
|
4
4
|
|
|
5
5
|
export const LIST_PAGES_TOOL: Tool = {
|
|
6
6
|
name: "list-pages",
|
|
7
|
-
description:
|
|
8
|
-
|
|
7
|
+
description: `List all deployed pages with optional filtering, search, and pagination.
|
|
8
|
+
|
|
9
|
+
PAGINATION:
|
|
10
|
+
- page: Page number (default: 1)
|
|
11
|
+
- limit: Items per page (default: 50)
|
|
12
|
+
|
|
13
|
+
FILTERING OPTIONS:
|
|
14
|
+
- Filter by tag: Use 'tags' parameter to find pages with a specific tag
|
|
15
|
+
- Search across fields: Use 'search' parameter to find pages containing the search term
|
|
16
|
+
|
|
17
|
+
SEARCH BEHAVIOR:
|
|
18
|
+
- Without 'key': Searches across ALL fields (title, slug, tags, and metadata values)
|
|
19
|
+
- With 'key': Searches only in the specified field
|
|
20
|
+
- key="title": Search in page title only
|
|
21
|
+
- key="slug": Search in page slug only
|
|
22
|
+
- key="tags": Search in tags array only
|
|
23
|
+
- key="metadata": Search in metadata values (all nested levels)
|
|
24
|
+
- With 'key=metadata' + 'metadata_key': Search in a specific metadata field only
|
|
25
|
+
|
|
26
|
+
METADATA CONTROL:
|
|
27
|
+
- By default, metadata only returns keys with empty values (to reduce payload)
|
|
28
|
+
- metafull=true: Returns full metadata with all values
|
|
29
|
+
- metafields=["key1","key2"]: Returns values only for specified keys
|
|
30
|
+
|
|
31
|
+
EXAMPLES:
|
|
32
|
+
1. Find all pages: list-pages (no params)
|
|
33
|
+
2. Paginate: list-pages with page=2, limit=10
|
|
34
|
+
3. Find pages tagged "marketing": list-pages with tags="marketing"
|
|
35
|
+
4. Find pages with full metadata: list-pages with metafull=true
|
|
36
|
+
5. Find pages with specific metadata: list-pages with metafields=["risks","actions"]
|
|
37
|
+
|
|
38
|
+
Returns: Paginated response with total, page, limit, and array of page summaries.`,
|
|
9
39
|
inputSchema: {
|
|
10
40
|
type: "object",
|
|
11
|
-
properties: {
|
|
41
|
+
properties: {
|
|
42
|
+
page: {
|
|
43
|
+
type: "number",
|
|
44
|
+
description: "Page number for pagination (default: 1)",
|
|
45
|
+
},
|
|
46
|
+
limit: {
|
|
47
|
+
type: "number",
|
|
48
|
+
description: "Number of items per page (default: 50)",
|
|
49
|
+
},
|
|
50
|
+
tags: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description:
|
|
53
|
+
"Filter by exact tag match (case-insensitive). Returns pages that have this tag.",
|
|
54
|
+
},
|
|
55
|
+
search: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description:
|
|
58
|
+
"Search term to find pages. Case-insensitive partial match. Without 'key' param, searches across title, slug, tags, and all metadata values.",
|
|
59
|
+
},
|
|
60
|
+
key: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: ["title", "tags", "slug", "metadata"],
|
|
63
|
+
description:
|
|
64
|
+
"Specify which field to search in. Only used with 'search' param. If omitted, searches all fields.",
|
|
65
|
+
},
|
|
66
|
+
metadata_key: {
|
|
67
|
+
type: "string",
|
|
68
|
+
description:
|
|
69
|
+
"When key='metadata', specify a specific metadata field to search in. E.g., 'vendor' to search only in metadata.vendor",
|
|
70
|
+
},
|
|
71
|
+
metafull: {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description:
|
|
74
|
+
"Set to true to return full metadata with all values. By default, metadata only returns keys with empty values.",
|
|
75
|
+
},
|
|
76
|
+
metafields: {
|
|
77
|
+
type: "array",
|
|
78
|
+
items: { type: "string" },
|
|
79
|
+
description:
|
|
80
|
+
"Array of metadata keys to return with full values. E.g., ['risks', 'actions'] returns only these keys with values.",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
12
83
|
},
|
|
13
84
|
};
|
|
14
85
|
|
|
15
|
-
export async function handleListPages() {
|
|
86
|
+
export async function handleListPages(args?: unknown) {
|
|
87
|
+
const { tags, search, key, metadata_key, page, limit, metafull, metafields } =
|
|
88
|
+
(args as ListPagesArgs) || {};
|
|
89
|
+
|
|
90
|
+
// Build query parameters
|
|
91
|
+
const params = new URLSearchParams();
|
|
92
|
+
if (tags) params.append("tags", tags);
|
|
93
|
+
if (search) params.append("search", search);
|
|
94
|
+
if (key) params.append("key", key);
|
|
95
|
+
if (metadata_key) params.append("metadata_key", metadata_key);
|
|
96
|
+
if (page) params.append("page", page.toString());
|
|
97
|
+
if (limit) params.append("limit", limit.toString());
|
|
98
|
+
if (metafull) params.append("metafull", "1");
|
|
99
|
+
if (metafields && metafields.length > 0) {
|
|
100
|
+
params.append("metafields", `[${metafields.join(",")}]`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const queryString = params.toString();
|
|
104
|
+
const endpoint = queryString ? `/v1/pages?${queryString}` : "/v1/pages";
|
|
105
|
+
|
|
16
106
|
// Call the list pages API
|
|
17
|
-
const response = await callAPI<ListPagesResponse>(
|
|
107
|
+
const response = await callAPI<ListPagesResponse>(endpoint, "GET");
|
|
18
108
|
|
|
19
109
|
return {
|
|
20
110
|
content: [
|
|
@@ -23,7 +113,9 @@ export async function handleListPages() {
|
|
|
23
113
|
text: JSON.stringify(
|
|
24
114
|
{
|
|
25
115
|
success: true,
|
|
26
|
-
|
|
116
|
+
total: response.total,
|
|
117
|
+
page: response.page,
|
|
118
|
+
limit: response.limit,
|
|
27
119
|
pages: response.pages,
|
|
28
120
|
},
|
|
29
121
|
null,
|
package/src/tools/update-page.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { UpdatePageArgs, UpdatePageResponse } from "../types.js";
|
|
|
5
5
|
export const UPDATE_PAGE_TOOL: Tool = {
|
|
6
6
|
name: "update-page",
|
|
7
7
|
description:
|
|
8
|
-
"Update an existing page by slug. You can update title, content, or
|
|
8
|
+
"Update an existing page by slug. You can update title, content, tags, or metadata individually or in combination. IMPORTANT: You must use the EXACT slug from list-pages response, including the timestamp suffix (e.g., 'my-page-1730229600'). At least one field (title, content, tags, or metadata) must be provided for update.",
|
|
9
9
|
inputSchema: {
|
|
10
10
|
type: "object",
|
|
11
11
|
properties: {
|
|
@@ -31,13 +31,18 @@ export const UPDATE_PAGE_TOOL: Tool = {
|
|
|
31
31
|
description:
|
|
32
32
|
"Optional new array of tags to categorize the page (e.g., ['dashboard', 'finance']). This will replace existing tags. Tags are case-insensitive for filtering.",
|
|
33
33
|
},
|
|
34
|
+
metadata: {
|
|
35
|
+
type: "object",
|
|
36
|
+
description:
|
|
37
|
+
"New metadata object to replace existing metadata. Note: This REPLACES the entire metadata object, not merges. To add a field, include all existing fields plus the new one. To remove a field, include all fields except the one to remove. Pass empty object {} to clear all metadata.",
|
|
38
|
+
},
|
|
34
39
|
},
|
|
35
40
|
required: ["slug"],
|
|
36
41
|
},
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
export async function handleUpdatePage(args: unknown) {
|
|
40
|
-
const { slug, title, content, tags } = args as UpdatePageArgs;
|
|
45
|
+
const { slug, title, content, tags, metadata } = args as UpdatePageArgs;
|
|
41
46
|
|
|
42
47
|
// Validate inputs
|
|
43
48
|
if (!slug) {
|
|
@@ -45,9 +50,10 @@ export async function handleUpdatePage(args: unknown) {
|
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
// Check if at least one field is provided
|
|
48
|
-
|
|
53
|
+
const hasMetadata = metadata && Object.keys(metadata).length > 0;
|
|
54
|
+
if (!title && !content && (!tags || tags.length === 0) && !hasMetadata) {
|
|
49
55
|
throw new Error(
|
|
50
|
-
"At least one field (title, content, or
|
|
56
|
+
"At least one field (title, content, tags, or metadata) must be provided for update"
|
|
51
57
|
);
|
|
52
58
|
}
|
|
53
59
|
|
|
@@ -65,6 +71,9 @@ export async function handleUpdatePage(args: unknown) {
|
|
|
65
71
|
if (tags && tags.length > 0) {
|
|
66
72
|
requestBody.tags = tags;
|
|
67
73
|
}
|
|
74
|
+
if (hasMetadata) {
|
|
75
|
+
requestBody.metadata = metadata;
|
|
76
|
+
}
|
|
68
77
|
|
|
69
78
|
// Call the update API
|
|
70
79
|
const response = await callAPI<UpdatePageResponse>(
|
package/src/types.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface DeployPageArgs {
|
|
|
3
3
|
content: string;
|
|
4
4
|
slug: string;
|
|
5
5
|
tags?: string[];
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export interface DeployPageResponse {
|
|
@@ -15,12 +16,15 @@ export interface PageSummary {
|
|
|
15
16
|
title: string;
|
|
16
17
|
url: string;
|
|
17
18
|
tags?: string[];
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
18
20
|
created_at: string;
|
|
19
21
|
updated_at: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface ListPagesResponse {
|
|
23
|
-
|
|
25
|
+
total: number;
|
|
26
|
+
page: number;
|
|
27
|
+
limit: number;
|
|
24
28
|
pages: PageSummary[];
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -29,6 +33,7 @@ export interface UpdatePageArgs {
|
|
|
29
33
|
title?: string;
|
|
30
34
|
content?: string;
|
|
31
35
|
tags?: string[];
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
export interface UpdatePageResponse {
|
|
@@ -46,6 +51,9 @@ export interface DeletePageResponse {
|
|
|
46
51
|
|
|
47
52
|
export interface GetPageArgs {
|
|
48
53
|
slug: string;
|
|
54
|
+
metafull?: boolean;
|
|
55
|
+
metafields?: string[];
|
|
56
|
+
md?: boolean;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
export interface GetPageResponse {
|
|
@@ -54,4 +62,16 @@ export interface GetPageResponse {
|
|
|
54
62
|
title: string;
|
|
55
63
|
content: string;
|
|
56
64
|
tags?: string[];
|
|
65
|
+
metadata?: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ListPagesArgs {
|
|
69
|
+
tags?: string;
|
|
70
|
+
search?: string;
|
|
71
|
+
key?: "title" | "tags" | "slug" | "metadata";
|
|
72
|
+
metadata_key?: string;
|
|
73
|
+
page?: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
metafull?: boolean;
|
|
76
|
+
metafields?: string[];
|
|
57
77
|
}
|