@cplace/test-mcp-server 0.1.14 → 1.0.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/README.md +275 -75
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/conditional-registration.d.ts.map +1 -1
- package/dist/conditional-registration.js +21 -3
- package/dist/conditional-registration.js.map +1 -1
- package/dist/index.js +82 -99
- package/dist/index.js.map +1 -1
- package/dist/preference-file.d.ts +16 -0
- package/dist/preference-file.d.ts.map +1 -0
- package/dist/preference-file.js +133 -0
- package/dist/preference-file.js.map +1 -0
- package/dist/profiles.d.ts +1 -3
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +60 -107
- package/dist/profiles.js.map +1 -1
- package/dist/searchConversion.d.ts.map +1 -1
- package/dist/searchConversion.js +18 -5
- package/dist/searchConversion.js.map +1 -1
- package/dist/searchSchema.d.ts +25 -25
- package/dist/searchSchema.d.ts.map +1 -1
- package/dist/searchSchema.js +5 -5
- package/dist/searchSchema.js.map +1 -1
- package/dist/token-hashing.d.ts +3 -0
- package/dist/token-hashing.d.ts.map +1 -0
- package/dist/token-hashing.js +18 -0
- package/dist/token-hashing.js.map +1 -0
- package/dist/tool-metadata.d.ts +2 -0
- package/dist/tool-metadata.d.ts.map +1 -0
- package/dist/tool-metadata.js +43 -0
- package/dist/tool-metadata.js.map +1 -0
- package/dist/tools/change-listeners.d.ts +30 -0
- package/dist/tools/change-listeners.d.ts.map +1 -1
- package/dist/tools/change-listeners.js +24 -18
- package/dist/tools/change-listeners.js.map +1 -1
- package/dist/tools/common-schemas.d.ts +2 -0
- package/dist/tools/common-schemas.d.ts.map +1 -1
- package/dist/tools/common-schemas.js +16 -0
- package/dist/tools/common-schemas.js.map +1 -1
- package/dist/tools/csv-export.d.ts +1849 -0
- package/dist/tools/csv-export.d.ts.map +1 -0
- package/dist/tools/csv-export.js +61 -0
- package/dist/tools/csv-export.js.map +1 -0
- package/dist/tools/generic-layouts.d.ts +332 -0
- package/dist/tools/generic-layouts.d.ts.map +1 -0
- package/dist/tools/generic-layouts.js +490 -0
- package/dist/tools/generic-layouts.js.map +1 -0
- package/dist/tools/get-operations.d.ts +16 -0
- package/dist/tools/get-operations.d.ts.map +1 -0
- package/dist/tools/get-operations.js +63 -0
- package/dist/tools/get-operations.js.map +1 -0
- package/dist/tools/pages.d.ts +55 -0
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +217 -209
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/ppt-export-schemas.d.ts +16 -16
- package/dist/tools/ppt-export.d.ts +1493 -0
- package/dist/tools/ppt-export.d.ts.map +1 -1
- package/dist/tools/ppt-export.js +23 -17
- package/dist/tools/ppt-export.js.map +1 -1
- package/dist/tools/profile-management.d.ts +20 -0
- package/dist/tools/profile-management.d.ts.map +1 -0
- package/dist/tools/profile-management.js +250 -0
- package/dist/tools/profile-management.js.map +1 -0
- package/dist/tools/references.d.ts +36 -0
- package/dist/tools/references.d.ts.map +1 -1
- package/dist/tools/references.js +48 -45
- package/dist/tools/references.js.map +1 -1
- package/dist/tools/richstring-widgets.d.ts +51 -0
- package/dist/tools/richstring-widgets.d.ts.map +1 -0
- package/dist/tools/richstring-widgets.js +173 -0
- package/dist/tools/richstring-widgets.js.map +1 -0
- package/dist/tools/schedule.d.ts +14 -0
- package/dist/tools/schedule.d.ts.map +1 -1
- package/dist/tools/schedule.js +7 -3
- package/dist/tools/schedule.js.map +1 -1
- package/dist/tools/script-logs.d.ts +29 -0
- package/dist/tools/script-logs.d.ts.map +1 -0
- package/dist/tools/script-logs.js +144 -0
- package/dist/tools/script-logs.js.map +1 -0
- package/dist/tools/search.d.ts +1870 -0
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +49 -75
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/system.d.ts +2 -1
- package/dist/tools/system.d.ts.map +1 -1
- package/dist/tools/system.js +68 -2
- package/dist/tools/system.js.map +1 -1
- package/dist/tools/type-layouts.d.ts +37 -0
- package/dist/tools/type-layouts.d.ts.map +1 -1
- package/dist/tools/type-layouts.js +57 -11
- package/dist/tools/type-layouts.js.map +1 -1
- package/dist/tools/type-management.d.ts +134 -0
- package/dist/tools/type-management.d.ts.map +1 -0
- package/dist/tools/{workspace.js → type-management.js} +67 -307
- package/dist/tools/type-management.js.map +1 -0
- package/dist/tools/users.d.ts +19 -0
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +14 -28
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/validators.d.ts +28 -0
- package/dist/tools/validators.d.ts.map +1 -1
- package/dist/tools/validators.js +21 -15
- package/dist/tools/validators.js.map +1 -1
- package/dist/tools/version-check.d.ts +4 -0
- package/dist/tools/version-check.d.ts.map +1 -0
- package/dist/tools/version-check.js +107 -0
- package/dist/tools/version-check.js.map +1 -0
- package/dist/tools/version-history.d.ts +48 -0
- package/dist/tools/version-history.d.ts.map +1 -1
- package/dist/tools/version-history.js +39 -29
- package/dist/tools/version-history.js.map +1 -1
- package/dist/tools/widgets.d.ts +182 -0
- package/dist/tools/widgets.d.ts.map +1 -1
- package/dist/tools/widgets.js +213 -590
- package/dist/tools/widgets.js.map +1 -1
- package/dist/tools/workflow-scripts.d.ts +40 -0
- package/dist/tools/workflow-scripts.d.ts.map +1 -0
- package/dist/tools/workflow-scripts.js +186 -0
- package/dist/tools/workflow-scripts.js.map +1 -0
- package/dist/tools/workflow.d.ts +70 -0
- package/dist/tools/workflow.d.ts.map +1 -0
- package/dist/tools/workflow.js +259 -0
- package/dist/tools/workflow.js.map +1 -0
- package/dist/tools/workspace-admin.d.ts +40 -0
- package/dist/tools/workspace-admin.d.ts.map +1 -0
- package/dist/tools/workspace-admin.js +125 -0
- package/dist/tools/workspace-admin.js.map +1 -0
- package/dist/tools/workspace-core.d.ts +45 -0
- package/dist/tools/workspace-core.d.ts.map +1 -0
- package/dist/tools/workspace-core.js +153 -0
- package/dist/tools/workspace-core.js.map +1 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/url-parsing.d.ts +6 -0
- package/dist/url-parsing.d.ts.map +1 -0
- package/dist/url-parsing.js +25 -0
- package/dist/url-parsing.js.map +1 -0
- package/dist/utils/dateValidation.d.ts +5 -0
- package/dist/utils/dateValidation.d.ts.map +1 -0
- package/dist/utils/dateValidation.js +57 -0
- package/dist/utils/dateValidation.js.map +1 -0
- package/dist/utils.js +7 -7
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/tools/workspace.d.ts +0 -4
- package/dist/tools/workspace.d.ts.map +0 -1
- package/dist/tools/workspace.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ppt-export.d.ts","sourceRoot":"","sources":["../../src/tools/ppt-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"ppt-export.d.ts","sourceRoot":"","sources":["../../src/tools/ppt-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAmB1C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC9B,CAAC;AAEX,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QAmMvF"}
|
package/dist/tools/ppt-export.js
CHANGED
|
@@ -2,8 +2,10 @@ import { z } from "zod";
|
|
|
2
2
|
import { applyPathUpdates } from '../utils.js';
|
|
3
3
|
import { debugLogWithTag } from '../logger.js';
|
|
4
4
|
import { AdvancedVisualizationSchema, BasicVisualizationSchema, LayoutSchema, LegendSchema, PageConfigSchema, ScalesSchema, TaskClassesSchema, TimelineSchema } from "./ppt-export-schemas.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const TOOL_CREATE_PPT_EXPORT_PROFILE = 'cplace_create_ppt_export_profile';
|
|
6
|
+
const TOOL_PARTIAL_UPDATE_PPT_EXPORT_PROFILE = 'cplace_partial_update_ppt_export_profile';
|
|
7
|
+
export const PPT_EXPORT_TOOL_DEFINITIONS = {
|
|
8
|
+
[TOOL_CREATE_PPT_EXPORT_PROFILE]: {
|
|
7
9
|
description: "Create PowerPoint Export Profiles with comprehensive configuration options for page layout, timeline settings, task classes, and visual formatting. Prerequisites: The 'Presentation Graphics' app (cf.cplace.pptexport) must be installed in the target workspace.",
|
|
8
10
|
inputSchema: {
|
|
9
11
|
workspaceId: z.string().describe("Required: The workspace ID where the profile should be created"),
|
|
@@ -20,7 +22,24 @@ export function registerPPTExportProfileTools(server, client) {
|
|
|
20
22
|
legend: LegendSchema
|
|
21
23
|
},
|
|
22
24
|
annotations: { title: "Create PPT Export Profile" }
|
|
23
|
-
},
|
|
25
|
+
},
|
|
26
|
+
[TOOL_PARTIAL_UPDATE_PPT_EXPORT_PROFILE]: {
|
|
27
|
+
description: "Update PowerPoint Export Profiles using path-based updates. Modify specific configuration values while preserving all other settings. This is the only way to update existing profiles. Supports dot notation paths and array indices.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
pageUID: z.string().describe("Required: The unique identifier of the profile page to update"),
|
|
30
|
+
name: z.string().optional().describe("Optional: New display name for the profile page"),
|
|
31
|
+
profileName: z.string().optional().describe("Optional: New internal name for the PowerPoint export configuration"),
|
|
32
|
+
builtIn: z.boolean().optional().describe("Optional: Whether this is a built-in profile"),
|
|
33
|
+
updates: z.array(z.object({
|
|
34
|
+
path: z.string().describe("Dot notation path to the configuration value (e.g., 'pageConfig.margins.left', 'taskClasses.definitions[0].fillColor')"),
|
|
35
|
+
value: z.any().describe("New value to set at the specified path")
|
|
36
|
+
})).optional().describe("Array of path-value pairs for configuration updates. Supports dot notation with array indices.")
|
|
37
|
+
},
|
|
38
|
+
annotations: { title: "Partial Update PPT Export Profile (Path-Based)" }
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export function registerPPTExportProfileTools(server, client) {
|
|
42
|
+
server.registerTool(TOOL_CREATE_PPT_EXPORT_PROFILE, PPT_EXPORT_TOOL_DEFINITIONS[TOOL_CREATE_PPT_EXPORT_PROFILE], async (params) => {
|
|
24
43
|
try {
|
|
25
44
|
if (!params.workspaceId || !params.name || !params.profileName) {
|
|
26
45
|
return {
|
|
@@ -71,20 +90,7 @@ export function registerPPTExportProfileTools(server, client) {
|
|
|
71
90
|
};
|
|
72
91
|
}
|
|
73
92
|
});
|
|
74
|
-
server.registerTool(
|
|
75
|
-
description: "Update PowerPoint Export Profiles using path-based updates. Modify specific configuration values while preserving all other settings. This is the only way to update existing profiles. Supports dot notation paths and array indices.",
|
|
76
|
-
inputSchema: {
|
|
77
|
-
pageUID: z.string().describe("Required: The unique identifier of the profile page to update"),
|
|
78
|
-
name: z.string().optional().describe("Optional: New display name for the profile page"),
|
|
79
|
-
profileName: z.string().optional().describe("Optional: New internal name for the PowerPoint export configuration"),
|
|
80
|
-
builtIn: z.boolean().optional().describe("Optional: Whether this is a built-in profile"),
|
|
81
|
-
updates: z.array(z.object({
|
|
82
|
-
path: z.string().describe("Dot notation path to the configuration value (e.g., 'pageConfig.margins.left', 'taskClasses.definitions[0].fillColor')"),
|
|
83
|
-
value: z.any().describe("New value to set at the specified path")
|
|
84
|
-
})).optional().describe("Array of path-value pairs for configuration updates. Supports dot notation with array indices.")
|
|
85
|
-
},
|
|
86
|
-
annotations: { title: "Partial Update PPT Export Profile (Path-Based)" }
|
|
87
|
-
}, async (params) => {
|
|
93
|
+
server.registerTool(TOOL_PARTIAL_UPDATE_PPT_EXPORT_PROFILE, PPT_EXPORT_TOOL_DEFINITIONS[TOOL_PARTIAL_UPDATE_PPT_EXPORT_PROFILE], async (params) => {
|
|
88
94
|
try {
|
|
89
95
|
debugLogWithTag('PPT_UPDATE', `Starting partial update for pageUID: ${params.pageUID}`);
|
|
90
96
|
debugLogWithTag('PPT_UPDATE', `Input params: ${JSON.stringify(params, null, 2)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ppt-export.js","sourceRoot":"","sources":["../../src/tools/ppt-export.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAC7C,OAAO,EACH,2BAA2B,EAC3B,wBAAwB,EACxB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACjB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ppt-export.js","sourceRoot":"","sources":["../../src/tools/ppt-export.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,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S: {
|
|
4
|
+
readonly cplace_manage_profiles: {
|
|
5
|
+
readonly description: "Manage cplace MCP profile configuration. Profiles control which MCP tools are available.\n\nPriority system (highest to lowest):\n1. Saved preferences (user+tenant+directory specific)\n2. CLI --profiles= argument (used as default when no saved preference exists)\n3. Code default: [\"core\"] only\n\nPreference storage:\n- All directory-specific preferences stored in single file\n- Preferences are specific to the directory where MCP server runs -> different directories can have different profile configurations (this only applies when using a local mcp server)\n\nOperations:\n- 'set': Activate profiles for current directory (e.g., ['layouts', 'types-write'], ['all'])\n- 'get': View current profile configuration and source\n- 'clear': Remove preferences for current directory, fall back to CLI or code default\n- 'details': Get info about profiles and their tools (optionally filter by profileName)\n\nAvailable profiles: core, workspace-admin, csv-export, layouts, types-write, low-code, ppt-export, history, schedule\n\nChanges take effect after reconnecting the MCP server.";
|
|
6
|
+
readonly inputSchema: {
|
|
7
|
+
readonly operation: z.ZodEnum<["set", "get", "clear", "details"]>;
|
|
8
|
+
readonly profiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
readonly profileName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
};
|
|
11
|
+
readonly annotations: {
|
|
12
|
+
readonly title: "Manage Profiles";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function registerProfileManagementTools(server: McpServer, getCredentials: () => {
|
|
17
|
+
apiToken: string;
|
|
18
|
+
cplaceUrl: string;
|
|
19
|
+
}): void;
|
|
20
|
+
//# sourceMappingURL=profile-management.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-management.d.ts","sourceRoot":"","sources":["../../src/tools/profile-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkBpE,eAAO,MAAM,mCAAmC;;;;;;;;;;;;CAkCtC,CAAC;AAqPX,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,SAAS,EACjB,cAAc,EAAE,MAAM;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,QAyD9D"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { debugLogWithTag } from "../logger.js";
|
|
3
|
+
import { TOOL_GROUPS, parseProfiles } from "../profiles.js";
|
|
4
|
+
import { setPreference, getPreference, clearPreference, readPreferences } from "../preference-file.js";
|
|
5
|
+
const TOOL_MANAGE_PROFILES = 'cplace_manage_profiles';
|
|
6
|
+
export const PROFILE_MANAGEMENT_TOOL_DEFINITIONS = {
|
|
7
|
+
[TOOL_MANAGE_PROFILES]: {
|
|
8
|
+
description: `Manage cplace MCP profile configuration. Profiles control which MCP tools are available.
|
|
9
|
+
|
|
10
|
+
Priority system (highest to lowest):
|
|
11
|
+
1. Saved preferences (user+tenant+directory specific)
|
|
12
|
+
2. CLI --profiles= argument (used as default when no saved preference exists)
|
|
13
|
+
3. Code default: ["core"] only
|
|
14
|
+
|
|
15
|
+
Preference storage:
|
|
16
|
+
- All directory-specific preferences stored in single file
|
|
17
|
+
- Preferences are specific to the directory where MCP server runs -> different directories can have different profile configurations (this only applies when using a local mcp server)
|
|
18
|
+
|
|
19
|
+
Operations:
|
|
20
|
+
- 'set': Activate profiles for current directory (e.g., ['layouts', 'types-write'], ['all'])
|
|
21
|
+
- 'get': View current profile configuration and source
|
|
22
|
+
- 'clear': Remove preferences for current directory, fall back to CLI or code default
|
|
23
|
+
- 'details': Get info about profiles and their tools (optionally filter by profileName)
|
|
24
|
+
|
|
25
|
+
Available profiles: core, workspace-admin, csv-export, layouts, types-write, low-code, ppt-export, history, schedule
|
|
26
|
+
|
|
27
|
+
Changes take effect after reconnecting the MCP server.`,
|
|
28
|
+
inputSchema: {
|
|
29
|
+
operation: z.enum(["set", "get", "clear", "details"])
|
|
30
|
+
.describe("Profile operation to perform: 'set' to activate profiles, 'get' to view current configuration, 'clear' to remove stored preferences, 'details' to get profile information"),
|
|
31
|
+
profiles: z.array(z.string()).optional()
|
|
32
|
+
.describe("Required for operation='set': Array of profile names to activate. Examples: ['layouts'], ['layouts', 'types-write'], ['all']. Available profiles: core, workspace-admin, csv-export, layouts, types-write, low-code, ppt-export, history, schedule"),
|
|
33
|
+
profileName: z.string().optional()
|
|
34
|
+
.describe("Optional for operation='details': Specific profile name to get details for (e.g., 'layouts', 'types-write'). If omitted, returns details for all available profiles.")
|
|
35
|
+
},
|
|
36
|
+
annotations: { title: "Manage Profiles" }
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
async function handleSetOperation(params, apiToken, cplaceUrl) {
|
|
40
|
+
if (!params.profiles || params.profiles.length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: `Error: profiles parameter is required when operation='set'. Specify which profiles to activate as an array. Examples: ['layouts'], ['layouts', 'types-write'], ['all']. Available profiles: ${Object.keys(TOOL_GROUPS).join(', ')}`
|
|
45
|
+
}],
|
|
46
|
+
isError: true
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
debugLogWithTag('PROFILES', `Setting profiles for ${cplaceUrl}: ${params.profiles.join(', ')}`);
|
|
50
|
+
const requestedGroups = params.profiles;
|
|
51
|
+
if (requestedGroups.length === 1 && requestedGroups[0] === 'all') {
|
|
52
|
+
const allGroups = Object.keys(TOOL_GROUPS);
|
|
53
|
+
setPreference(apiToken, cplaceUrl, allGroups);
|
|
54
|
+
return {
|
|
55
|
+
content: [{
|
|
56
|
+
type: "text",
|
|
57
|
+
text: formatSuccessResponse(allGroups, cplaceUrl, [])
|
|
58
|
+
}]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const validGroups = [];
|
|
62
|
+
const unknownGroups = [];
|
|
63
|
+
for (const group of requestedGroups) {
|
|
64
|
+
if (TOOL_GROUPS[group]) {
|
|
65
|
+
validGroups.push(group);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
unknownGroups.push(group);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!validGroups.includes('core')) {
|
|
72
|
+
validGroups.unshift('core');
|
|
73
|
+
}
|
|
74
|
+
if (validGroups.length === 0) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: `❌ No valid profiles specified. Available profiles:\n${Object.keys(TOOL_GROUPS).join(', ')}`
|
|
79
|
+
}],
|
|
80
|
+
isError: true
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
setPreference(apiToken, cplaceUrl, validGroups);
|
|
84
|
+
return {
|
|
85
|
+
content: [{
|
|
86
|
+
type: "text",
|
|
87
|
+
text: formatSuccessResponse(validGroups, cplaceUrl, unknownGroups)
|
|
88
|
+
}]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function handleGetOperation(apiToken, cplaceUrl) {
|
|
92
|
+
debugLogWithTag('PROFILES', `Getting active profiles for ${cplaceUrl}`);
|
|
93
|
+
const prefs = readPreferences();
|
|
94
|
+
const storedPreference = getPreference(apiToken, cplaceUrl);
|
|
95
|
+
const activeGroups = parseProfiles(process.argv, apiToken, cplaceUrl);
|
|
96
|
+
let source;
|
|
97
|
+
let message;
|
|
98
|
+
if (storedPreference) {
|
|
99
|
+
source = "path_preference";
|
|
100
|
+
message = "Using saved preference for current directory";
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const cliArg = process.argv.find(arg => arg.startsWith('--profiles='));
|
|
104
|
+
if (cliArg) {
|
|
105
|
+
source = "cli_argument";
|
|
106
|
+
message = "Using CLI argument (no saved preference for current directory)";
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
source = "code_default";
|
|
110
|
+
message = "Using code default (no saved preference or CLI argument)";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const display = {
|
|
114
|
+
active_profiles: Array.from(activeGroups).sort(),
|
|
115
|
+
source: source,
|
|
116
|
+
message: message
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
content: [{
|
|
120
|
+
type: "text",
|
|
121
|
+
text: JSON.stringify(display, null, 2)
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function handleClearOperation(apiToken, cplaceUrl) {
|
|
126
|
+
debugLogWithTag('PROFILES', `Clearing profiles for current directory`);
|
|
127
|
+
clearPreference(apiToken, cplaceUrl);
|
|
128
|
+
return {
|
|
129
|
+
content: [{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: `✅ Profile preferences cleared for current directory\n\nReconnect MCP server to apply default profiles.`
|
|
132
|
+
}]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function handleDetailsOperation(params, apiToken, cplaceUrl) {
|
|
136
|
+
debugLogWithTag('PROFILES', `Getting profile details${params.profileName ? ` for ${params.profileName}` : ''}`);
|
|
137
|
+
const activeGroups = parseProfiles(process.argv, apiToken || undefined, cplaceUrl || undefined);
|
|
138
|
+
if (params.profileName && !TOOL_GROUPS[params.profileName]) {
|
|
139
|
+
return {
|
|
140
|
+
content: [{
|
|
141
|
+
type: "text",
|
|
142
|
+
text: `Profile '${params.profileName}' not found. Available profiles: ${Object.keys(TOOL_GROUPS).join(', ')}`
|
|
143
|
+
}],
|
|
144
|
+
isError: true
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const { MODULE_TOOL_DEFINITIONS } = await import("../tool-metadata.js");
|
|
148
|
+
const profilesToShow = params.profileName
|
|
149
|
+
? [params.profileName]
|
|
150
|
+
: Object.keys(TOOL_GROUPS);
|
|
151
|
+
const profiles = profilesToShow.map((profileName) => {
|
|
152
|
+
const profile = TOOL_GROUPS[profileName];
|
|
153
|
+
const tools = [];
|
|
154
|
+
for (const moduleName of profile.modules) {
|
|
155
|
+
const moduleToolDefs = MODULE_TOOL_DEFINITIONS[moduleName];
|
|
156
|
+
if (moduleToolDefs) {
|
|
157
|
+
Object.entries(moduleToolDefs).forEach(([toolName, toolDef]) => {
|
|
158
|
+
tools.push({
|
|
159
|
+
name: toolName,
|
|
160
|
+
description: toolDef.description || ""
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
name: profileName,
|
|
167
|
+
description: profile.description,
|
|
168
|
+
active: activeGroups.has(profileName),
|
|
169
|
+
tool_count: tools.length,
|
|
170
|
+
tools: tools.sort((a, b) => a.name.localeCompare(b.name))
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
if (params.profileName) {
|
|
174
|
+
const response = {
|
|
175
|
+
profile: profiles[0]
|
|
176
|
+
};
|
|
177
|
+
return {
|
|
178
|
+
content: [{
|
|
179
|
+
type: "text",
|
|
180
|
+
text: JSON.stringify(response, null, 2)
|
|
181
|
+
}]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const response = {
|
|
185
|
+
profiles,
|
|
186
|
+
currently_active: Array.from(activeGroups).sort()
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
content: [{
|
|
190
|
+
type: "text",
|
|
191
|
+
text: JSON.stringify(response, null, 2)
|
|
192
|
+
}]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export function registerProfileManagementTools(server, getCredentials) {
|
|
196
|
+
server.registerTool(TOOL_MANAGE_PROFILES, PROFILE_MANAGEMENT_TOOL_DEFINITIONS[TOOL_MANAGE_PROFILES], async (params) => {
|
|
197
|
+
const { operation } = params;
|
|
198
|
+
try {
|
|
199
|
+
const { apiToken, cplaceUrl } = getCredentials();
|
|
200
|
+
if (!apiToken || !cplaceUrl) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{
|
|
203
|
+
type: "text",
|
|
204
|
+
text: "❌ Cannot manage profiles: No active connection credentials found"
|
|
205
|
+
}],
|
|
206
|
+
isError: true
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
switch (operation) {
|
|
210
|
+
case "set":
|
|
211
|
+
return await handleSetOperation(params, apiToken, cplaceUrl);
|
|
212
|
+
case "get":
|
|
213
|
+
return await handleGetOperation(apiToken, cplaceUrl);
|
|
214
|
+
case "clear":
|
|
215
|
+
return await handleClearOperation(apiToken, cplaceUrl);
|
|
216
|
+
case "details":
|
|
217
|
+
return await handleDetailsOperation(params, apiToken, cplaceUrl);
|
|
218
|
+
default:
|
|
219
|
+
return {
|
|
220
|
+
content: [{
|
|
221
|
+
type: "text",
|
|
222
|
+
text: `Unknown operation: ${operation}`
|
|
223
|
+
}],
|
|
224
|
+
isError: true
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
return {
|
|
230
|
+
content: [{
|
|
231
|
+
type: "text",
|
|
232
|
+
text: `Failed to ${operation} profiles: ${error instanceof Error ? error.message : String(error)}`
|
|
233
|
+
}],
|
|
234
|
+
isError: true
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function formatSuccessResponse(validGroups, tenantUrl, unknownGroups) {
|
|
240
|
+
let response = `✅ Profiles activated: ${validGroups.join(', ')}\n`;
|
|
241
|
+
response += `\nSuccessfully saved profiles for current directory\n`;
|
|
242
|
+
response += `Preferences will be used on next server reconnect.\n`;
|
|
243
|
+
if (unknownGroups.length > 0) {
|
|
244
|
+
response += `\n⚠️ Unknown profile(s) skipped: ${unknownGroups.join(', ')}\n`;
|
|
245
|
+
response += ` Valid profiles: ${Object.keys(TOOL_GROUPS).join(', ')}\n`;
|
|
246
|
+
}
|
|
247
|
+
response += `\nUse cplace_manage_profiles with operation='get' to view the configuration source.`;
|
|
248
|
+
return response;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=profile-management.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-management.js","sourceRoot":"","sources":["../../src/tools/profile-management.ts"],"names":[],"mappings":"AAAA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";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { CplaceApiClient } from '../api.js';
|
|
4
|
+
export declare const REFERENCE_TOOL_DEFINITIONS: {
|
|
5
|
+
readonly cplace_get_incoming_references: {
|
|
6
|
+
readonly description: "Get incoming references for a type definition or page. Identifies all attributes or pages that reference the target. For type definitions, returns all attributes from other types that can reference this type. For pages, returns all pages that reference this page through specific attributes.";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
readonly context: z.ZodUnion<[z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"type">;
|
|
10
|
+
workspaceId: z.ZodString;
|
|
11
|
+
internalName: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
type: "type";
|
|
14
|
+
workspaceId: string;
|
|
15
|
+
internalName: string;
|
|
16
|
+
}, {
|
|
17
|
+
type: "type";
|
|
18
|
+
workspaceId: string;
|
|
19
|
+
internalName: string;
|
|
20
|
+
}>, z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"page">;
|
|
22
|
+
pageUID: z.ZodString;
|
|
23
|
+
includeReferences: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: "page";
|
|
26
|
+
pageUID: string;
|
|
27
|
+
includeReferences: string;
|
|
28
|
+
}, {
|
|
29
|
+
type: "page";
|
|
30
|
+
pageUID: string;
|
|
31
|
+
includeReferences: string;
|
|
32
|
+
}>]>;
|
|
33
|
+
};
|
|
34
|
+
readonly annotations: {
|
|
35
|
+
readonly title: "Get Incoming References";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
3
39
|
export declare function registerReferenceTools(server: McpServer, client: CplaceApiClient): void;
|
|
4
40
|
//# sourceMappingURL=references.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmB7B,CAAC;AAEX,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QA8ChF"}
|
package/dist/tools/references.js
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { debugLogWithTag } from "../logger.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
workspaceId: z.string().describe("The ID of the workspace containing the target type definition"),
|
|
8
|
-
internalName: z.string().describe("The internal name of the target type definition")
|
|
9
|
-
},
|
|
10
|
-
annotations: { title: "Get Type Incoming References" }
|
|
11
|
-
}, async ({ workspaceId, internalName }) => {
|
|
12
|
-
debugLogWithTag('TYPE_REFS', `Starting incoming references request for type: ${internalName} in workspace: ${workspaceId}`);
|
|
13
|
-
try {
|
|
14
|
-
const result = await client.makeApiRequest('json/type/incoming-references', 'GET', {
|
|
15
|
-
workspaceId,
|
|
16
|
-
internalName
|
|
17
|
-
});
|
|
18
|
-
debugLogWithTag('TYPE_REFS', `Retrieved ${result.count || 0} incoming references for type: ${internalName}`);
|
|
19
|
-
return {
|
|
20
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
debugLogWithTag('TYPE_REFS', `Error retrieving incoming references: ${error instanceof Error ? error.message : String(error)}`);
|
|
25
|
-
return {
|
|
26
|
-
content: [{ type: "text", text: `Error retrieving type incoming references: ${error instanceof Error ? error.message : String(error)}` }],
|
|
27
|
-
isError: true
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
server.registerTool("cplace_get_page_incoming_references", {
|
|
32
|
-
description: "Get comprehensive information about all incoming references to a specific page. Identifies all pages that reference the target page through specific attributes, providing detailed information about the referencing pages and the attributes used for the references.",
|
|
3
|
+
const TOOL_GET_INCOMING_REFERENCES = 'cplace_get_incoming_references';
|
|
4
|
+
export const REFERENCE_TOOL_DEFINITIONS = {
|
|
5
|
+
[TOOL_GET_INCOMING_REFERENCES]: {
|
|
6
|
+
description: "Get incoming references for a type definition or page. Identifies all attributes or pages that reference the target. For type definitions, returns all attributes from other types that can reference this type. For pages, returns all pages that reference this page through specific attributes.",
|
|
33
7
|
inputSchema: {
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
context: z.union([
|
|
9
|
+
z.object({
|
|
10
|
+
type: z.literal("type"),
|
|
11
|
+
workspaceId: z.string().describe("The workspace ID containing the type definition (e.g., 'workspace123')"),
|
|
12
|
+
internalName: z.string().describe("The internal name of the type definition (e.g., 'cf.example.myType')")
|
|
13
|
+
}),
|
|
14
|
+
z.object({
|
|
15
|
+
type: z.literal("page"),
|
|
16
|
+
pageUID: z.string().describe("The unique identifier of the page (e.g., 'page/abc123def456')"),
|
|
17
|
+
includeReferences: z.string().describe("JSON string specifying which references to include. Must be a JSON array containing objects with 'sourceType' and 'attributeName' properties, e.g. '[{\"sourceType\":\"cf.example.Project\",\"attributeName\":\"relatedTask\"}]'")
|
|
18
|
+
})
|
|
19
|
+
]).describe("Target context - specify type definition or page. For type: provides workspace and type name. For page: provides page UID and reference filter.")
|
|
36
20
|
},
|
|
37
|
-
annotations: { title: "Get
|
|
38
|
-
}
|
|
39
|
-
|
|
21
|
+
annotations: { title: "Get Incoming References" }
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export function registerReferenceTools(server, client) {
|
|
25
|
+
server.registerTool(TOOL_GET_INCOMING_REFERENCES, REFERENCE_TOOL_DEFINITIONS[TOOL_GET_INCOMING_REFERENCES], async (params) => {
|
|
26
|
+
const { context } = params;
|
|
27
|
+
debugLogWithTag('REFERENCES', `Getting incoming references for ${context.type}`);
|
|
40
28
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
if (context.type === "type") {
|
|
30
|
+
const result = await client.makeApiRequest('json/type/incoming-references', 'GET', {
|
|
31
|
+
workspaceId: context.workspaceId,
|
|
32
|
+
internalName: context.internalName
|
|
33
|
+
});
|
|
34
|
+
debugLogWithTag('REFERENCES', `Retrieved ${result.count || 0} incoming references for type: ${context.internalName}`);
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const result = await client.makeApiRequest('json/page/incoming-references', 'GET', {
|
|
41
|
+
pageUID: context.pageUID,
|
|
42
|
+
includeReferences: context.includeReferences
|
|
43
|
+
});
|
|
44
|
+
debugLogWithTag('REFERENCES', `Retrieved ${result.totalCount || 0} incoming references for page: ${context.pageUID}`);
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
|
-
debugLogWithTag('
|
|
51
|
+
debugLogWithTag('REFERENCES', `Error retrieving incoming references: ${error instanceof Error ? error.message : String(error)}`);
|
|
52
52
|
return {
|
|
53
|
-
content: [{
|
|
53
|
+
content: [{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: `Error retrieving incoming references for ${context.type}: ${error instanceof Error ? error.message : String(error)}`
|
|
56
|
+
}],
|
|
54
57
|
isError: true
|
|
55
58
|
};
|
|
56
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,MAAM,4BAA4B,GAAG,gCAAgC,CAAC;AAGtE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,CAAC,4BAA4B,CAAC,EAAE;QAC9B,WAAW,EAAE,qSAAqS;QAClT,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC;gBACf,CAAC,CAAC,MAAM,CAAC;oBACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;oBACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC;oBAC1G,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;iBAC1G,CAAC;gBACF,CAAC,CAAC,MAAM,CAAC;oBACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;oBACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;oBAC7F,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kOAAkO,CAAC;iBAC3Q,CAAC;aACH,CAAC,CAAC,QAAQ,CAAC,iJAAiJ,CAAC;SAC/J;QACD,WAAW,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE;KAClD;CACO,CAAC;AAEX,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAuB;IAE/E,MAAM,C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YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAe,CAAC,YAAY,EAAE,yCAAyC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjI,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,4CAA4C,OAAO,CAAC,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC5H,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CplaceApiClient } from '../api.js';
|
|
4
|
+
export declare const RICHSTRING_WIDGET_TOOL_DEFINITIONS: {
|
|
5
|
+
readonly cplace_richstring_extract_widgets: {
|
|
6
|
+
readonly description: "Extract all embedded widgets from richstring HTML content. Parses the content and returns structured information about each widget including ID, type, properties, and position. Use this to discover widget IDs before updating or deleting them.";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
readonly content: z.ZodString;
|
|
9
|
+
};
|
|
10
|
+
readonly annotations: {
|
|
11
|
+
readonly title: "Extract Embedded Widgets from RichString";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly cplace_richstring_insert_widget: {
|
|
15
|
+
readonly description: "Insert a new embedded widget into richstring content at a specified position or at the end. Returns the modified content which must be saved back to the page. Supports position validation with expectedBefore/expectedAfter parameters for safe concurrent updates.";
|
|
16
|
+
readonly inputSchema: {
|
|
17
|
+
readonly widgetType: z.ZodString;
|
|
18
|
+
readonly content: z.ZodOptional<z.ZodString>;
|
|
19
|
+
readonly position: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
readonly expectedBefore: z.ZodOptional<z.ZodString>;
|
|
21
|
+
readonly expectedAfter: z.ZodOptional<z.ZodString>;
|
|
22
|
+
readonly properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
23
|
+
};
|
|
24
|
+
readonly annotations: {
|
|
25
|
+
readonly title: "Insert Embedded Widget into RichString";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly cplace_richstring_update_widget: {
|
|
29
|
+
readonly description: "Update an existing embedded widget's properties by its ID. Properties are completely replaced (not merged). Returns the modified content which must be saved back to the page. The widget's position and type remain unchanged.";
|
|
30
|
+
readonly inputSchema: {
|
|
31
|
+
readonly widgetId: z.ZodString;
|
|
32
|
+
readonly content: z.ZodString;
|
|
33
|
+
readonly properties: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
34
|
+
};
|
|
35
|
+
readonly annotations: {
|
|
36
|
+
readonly title: "Update Embedded Widget in RichString";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly cplace_richstring_delete_widget: {
|
|
40
|
+
readonly description: "Remove an embedded widget from richstring content by its ID. Returns the modified content which must be saved back to the page. The surrounding HTML structure is preserved. Consider extracting widget details before deletion if needed for backup.";
|
|
41
|
+
readonly inputSchema: {
|
|
42
|
+
readonly widgetId: z.ZodString;
|
|
43
|
+
readonly content: z.ZodString;
|
|
44
|
+
};
|
|
45
|
+
readonly annotations: {
|
|
46
|
+
readonly title: "Delete Embedded Widget from RichString";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare function registerRichStringWidgetTools(server: McpServer, client: CplaceApiClient): void;
|
|
51
|
+
//# sourceMappingURL=richstring-widgets.d.ts.map
|