@cplace/mcp-server 1.7.10 → 1.8.5

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.
Files changed (67) hide show
  1. package/dist/plugins/core/app-catalog/cf.cplace.cboard.main/README.md +1 -1
  2. package/dist/plugins/core/widget-specifications/cf.cplace.cboard.main.board/_implementation.md +1 -1
  3. package/dist/plugins/core/widget-specifications/cf.cplace.platform.attributesGroup/layout.md +1 -1
  4. package/dist/plugins/core/widget-specifications/cf.cplace.platform.connectedAttributesGroup/cf.cplace.platform.attributesGroup.layout.md +1 -1
  5. package/dist/plugins/resource-management/widget-specifications/cf.cplace.resourceManagement.resourcePlannerDefinition/_implementation.md +1 -1
  6. package/dist/searchConversion.js +1 -1
  7. package/dist/searchConversion.js.map +1 -1
  8. package/dist/tools/board-widget.d.ts +50 -10
  9. package/dist/tools/board-widget.d.ts.map +1 -1
  10. package/dist/tools/common-schemas.d.ts +4 -5
  11. package/dist/tools/common-schemas.d.ts.map +1 -1
  12. package/dist/tools/common-schemas.js +39 -21
  13. package/dist/tools/common-schemas.js.map +1 -1
  14. package/dist/tools/csv-export.d.ts +472 -4
  15. package/dist/tools/csv-export.d.ts.map +1 -1
  16. package/dist/tools/csv-export.js +4 -8
  17. package/dist/tools/csv-export.js.map +1 -1
  18. package/dist/tools/jobs.d.ts +2 -2
  19. package/dist/tools/jobs.d.ts.map +1 -1
  20. package/dist/tools/jobs.js +3 -2
  21. package/dist/tools/jobs.js.map +1 -1
  22. package/dist/tools/layout-richstring-shared.d.ts +5 -0
  23. package/dist/tools/layout-richstring-shared.d.ts.map +1 -0
  24. package/dist/tools/layout-richstring-shared.js +35 -0
  25. package/dist/tools/layout-richstring-shared.js.map +1 -0
  26. package/dist/tools/layout-richstring-translator.d.ts +36 -0
  27. package/dist/tools/layout-richstring-translator.d.ts.map +1 -0
  28. package/dist/tools/layout-richstring-translator.js +695 -0
  29. package/dist/tools/layout-richstring-translator.js.map +1 -0
  30. package/dist/tools/layout-richstring-widgets.d.ts +6 -112
  31. package/dist/tools/layout-richstring-widgets.d.ts.map +1 -1
  32. package/dist/tools/layout-richstring-widgets.js +9 -204
  33. package/dist/tools/layout-richstring-widgets.js.map +1 -1
  34. package/dist/tools/layout.d.ts +69 -20
  35. package/dist/tools/layout.d.ts.map +1 -1
  36. package/dist/tools/layout.js +153 -113
  37. package/dist/tools/layout.js.map +1 -1
  38. package/dist/tools/pages.d.ts +2 -2
  39. package/dist/tools/pages.d.ts.map +1 -1
  40. package/dist/tools/pages.js +3 -12
  41. package/dist/tools/pages.js.map +1 -1
  42. package/dist/tools/resource-planner-widget.d.ts +54 -14
  43. package/dist/tools/resource-planner-widget.d.ts.map +1 -1
  44. package/dist/tools/resource-planner-widget.js +52 -13
  45. package/dist/tools/resource-planner-widget.js.map +1 -1
  46. package/dist/tools/search.d.ts +476 -8
  47. package/dist/tools/search.d.ts.map +1 -1
  48. package/dist/tools/search.js +8 -12
  49. package/dist/tools/search.js.map +1 -1
  50. package/dist/tools/system.d.ts.map +1 -1
  51. package/dist/tools/system.js +2 -1
  52. package/dist/tools/system.js.map +1 -1
  53. package/dist/tools/type-management.js +1 -1
  54. package/dist/tools/type-management.js.map +1 -1
  55. package/dist/tools/version-history.d.ts +4 -4
  56. package/dist/tools/version-history.d.ts.map +1 -1
  57. package/dist/tools/version-history.js +5 -4
  58. package/dist/tools/version-history.js.map +1 -1
  59. package/dist/tools/widgets.d.ts +2 -2
  60. package/dist/tools/widgets.d.ts.map +1 -1
  61. package/dist/tools/widgets.js +12 -2
  62. package/dist/tools/widgets.js.map +1 -1
  63. package/dist/tools/workspace-core.d.ts +2 -2
  64. package/dist/tools/workspace-core.d.ts.map +1 -1
  65. package/dist/tools/workspace-core.js +3 -2
  66. package/dist/tools/workspace-core.js.map +1 -1
  67. package/package.json +2 -2
@@ -3,7 +3,9 @@ import { debugLogWithTag } from "../logger.js";
3
3
  import { checkResponseSize } from "../utils.js";
4
4
  import { applyStrReplace } from '../str-replace-utils.js';
5
5
  import { determineApiEndpoint, buildRequestParams, findWidgetById } from './widget-tool-helpers.js';
6
- export const LayoutContextSchema = z.union([
6
+ import { jsonStringToObject } from './common-schemas.js';
7
+ import { decodeRichStringsInLayout, decodeRichStringsInScript, encodeRichStringsInScript, containsRawBase64Tag, DecodedWidgetParseError } from './layout-richstring-translator.js';
8
+ export const LayoutContextSchema = jsonStringToObject(z.union([
7
9
  z.object({
8
10
  type: z.literal("page"),
9
11
  pageUID: z.string().describe("Page UID (e.g., 'page/abc123')")
@@ -14,26 +16,46 @@ export const LayoutContextSchema = z.union([
14
16
  typeInternalName: z.string().describe("Type internal name (e.g., 'cf.example.myType')"),
15
17
  alternativeLayoutName: z.string().optional().describe("Alternative layout name (optional)")
16
18
  })
17
- ]).describe("Layout target - specify whether operating on page or type layout (pass as a JSON object, NOT a JSON string)");
18
- const TOOL_DEFINE_LAYOUT = 'cplace_define_layout';
19
+ ]).describe("Layout target - specify whether operating on page or type layout"));
20
+ const TOOL_EXECUTE_LAYOUT_SCRIPT = 'cplace_execute_layout_script';
19
21
  const TOOL_GET_LAYOUT_OVERVIEW = 'cplace_get_layout_overview';
20
22
  const TOOL_GET_LAYOUT_WIDGET_DETAILS = 'cplace_get_layout_widget_details';
21
- const TOOL_GET_LAYOUT_DEFINITION = 'cplace_get_layout_definition';
23
+ const TOOL_GET_LAYOUT_SCRIPT = 'cplace_get_layout_script';
22
24
  const TOOL_EDIT_LAYOUT = 'cplace_edit_layout';
23
25
  export const LAYOUT_TOOL_DEFINITIONS = {
24
- [TOOL_DEFINE_LAYOUT]: {
25
- description: `Define a complete page or type layout atomically using a layout.define() low-code script.
26
+ [TOOL_EXECUTE_LAYOUT_SCRIPT]: {
27
+ description: `Execute a layout script either a full layout.define() replacement or per-widget edit verbs.
26
28
 
27
- WHEN TO USE:
28
- - Use this tool when you know the full layout structure upfront
29
- - Replaces the entire layout in a single atomic operation (no partial updates)
30
- - More efficient than sequential add-row/add-widget calls for complete layouts
29
+ TWO MODES (determined by script content):
31
30
 
32
- KEY BEHAVIORS:
31
+ MODE 1 — FULL REPLACE (layout.define):
32
+ - Script calls layout.define() exactly once to declare the complete layout structure
33
+ - Replaces the entire layout atomically
34
+ - Same behavior as before
35
+
36
+ MODE 2 — EDIT VERBS (per-widget):
37
+ - Script calls one or more edit methods: layout.updateWidget(), layout.addWidget(), layout.removeWidget(), layout.moveWidget(), layout.addRow(), layout.compact()
38
+ - Each call collects an operation; all operations commit atomically or fail together
39
+ - Cannot mix layout.define() with edit verbs in the same script
40
+
41
+ EDIT VERBS:
42
+ layout.updateWidget("widgetId", { "cf.cplace.x": newValue }) — partial config merge (only specified keys change)
43
+ layout.addWidget({ widgetType: "cf.platform.wiki", position: { rowIndex: 0, columnIndex: 0, widgetIndex: 0 }, configuration: { ... } })
44
+ layout.removeWidget("widgetId")
45
+ layout.moveWidget("widgetId", { rowIndex: 1, columnIndex: 0, widgetIndex: 0 })
46
+ layout.addRow(rowIndex, [6, 6]) — column proportions must sum to 12
47
+ layout.compact() — remove empty rows
48
+
49
+ WORKFLOW for per-widget edit:
50
+ 1. Read: cplace_get_layout_script with widgetIds to get layout.updateWidget() fragments
51
+ 2. Edit: modify the config values in the fragment
52
+ 3. Execute: post the modified script via this tool
53
+
54
+ KEY BEHAVIORS (for layout.define mode):
33
55
  - The script must call layout.define() exactly once
34
56
  - The entire layout is atomically replaced — previous layout is fully overwritten
35
57
  - Script timeout: 30 seconds
36
- - Widget IDs: auto-generated if omitted; if provided without '_' prefix, '_' is prepended automatically
58
+ - Widget IDs: MUST be omitted from layout.define. Ids are assigned by the server and returned in the response. Use the returned id in subsequent layout.updateWidget() calls.
37
59
 
38
60
  RESPONSE OUTCOMES:
39
61
  - VALID_COMPLETE: Layout saved, all widgets fully configured
@@ -57,12 +79,35 @@ cf.platform.connectedMatrix, cf.platform.connectedTableFilter,
57
79
  cf.platform.incomingReferences, cf.platform.comments, cf.platform.files,
58
80
  cf.cplace.visualizations.scriptingHighcharts
59
81
 
60
- For app-dependent widgets not in this list, call cplace_list_widget_definitions with embeddingContext "AS_WIDGET".`,
82
+ For app-dependent widgets not in this list, call cplace_list_widget_definitions with embeddingContext "AS_WIDGET".
83
+
84
+ RICHSTRING WIDGETS AND EMBEDDED WIDGETS (decoded form):
85
+ RichString widgets (cf.platform.richString, cf.cplace.demoWidgets.demoRichString)
86
+ hold HTML in their 'content' config. Embedded widgets inside that HTML are
87
+ expressed in decoded form:
88
+ <embeddedwidget id="id_w1" type="cf.platform.singleAttribute">{"properties":{"attribute":"name"}}</embeddedwidget>
89
+
90
+ Semantics when submitting a script:
91
+ • Tag with an existing id + same type → update (properties replace current)
92
+ • Tag without id → insert new embedded widget (backend assigns id)
93
+ • Existing id omitted from new content → delete
94
+ • Unknown id, duplicate id, or type change for same id → error
95
+
96
+ Raw base64 <embeddedwidget>BASE64</embeddedwidget> tags are REJECTED on writes.
97
+ Fetch current decoded form via cplace_get_layout_script.
98
+
99
+ IMPORTANT: Decoded <embeddedwidget> tags must appear directly inline in a content: value.
100
+ Do NOT build the tag in a variable and pass it — the parser rejects tags outside content: literals.
101
+ ✅ layout.updateWidget("id", { content: '<embeddedwidget type="...">...</embeddedwidget>' });
102
+ ❌ var tag = '<embeddedwidget ...>...</embeddedwidget>'; layout.updateWidget("id", { content: tag });
103
+
104
+ For atomic single-embedded-widget edits without rewriting the full script,
105
+ see cplace_layout_richstring_* tools.`,
61
106
  inputSchema: {
62
107
  context: LayoutContextSchema,
63
- script: z.string().describe(`JavaScript code that calls layout.define() exactly once to declare the complete layout structure.
108
+ script: z.string().describe(`JavaScript code that calls layout.define() exactly once OR one or more edit verbs.
64
109
 
65
- LAYOUT SPECIFICATION FORMAT:
110
+ FULL REPLACE — layout.define() FORMAT:
66
111
  layout.define({
67
112
  rows: [
68
113
  {
@@ -71,7 +116,6 @@ layout.define({
71
116
  proportion: 6, // Column width: integer 3-12, all columns in a row must sum to 12
72
117
  widgets: [
73
118
  {
74
- id: "myWidget", // Optional: explicit widget ID (auto-prefixed with '_' if missing prefix)
75
119
  type: "cf.platform.embeddedSearchAsTable", // Required: widget type identifier
76
120
  config: { // Optional: widget configuration key-value pairs (use {en: "...", de: "..."} for localized strings)
77
121
  title: { en: "My Table", de: "Meine Tabelle" },
@@ -90,13 +134,21 @@ layout.define({
90
134
  ]
91
135
  });
92
136
 
137
+ EDIT VERBS — per-widget operations:
138
+ layout.updateWidget("widgetId", { "configKey": newValue });
139
+ layout.addWidget({ widgetType: "cf.platform.wiki", position: { rowIndex: 0, columnIndex: 0, widgetIndex: 0 } });
140
+ layout.removeWidget("widgetId");
141
+ layout.moveWidget("widgetId", { rowIndex: 1, columnIndex: 0, widgetIndex: 0 });
142
+ layout.addRow(0, [6, 6]);
143
+ layout.compact();
144
+
93
145
  COLUMN PROPORTION RULES:
94
146
  - Each column proportion must be between 3 and 12
95
147
  - All column proportions in a row must sum to exactly 12
96
148
  - Common patterns: [12] (full width), [6,6] (two equal), [4,4,4] (three equal), [8,4] (main + sidebar), [3,9] (sidebar + main)
97
149
 
98
- WIDGET FIELDS:
99
- - id (optional): Explicit widget ID. Auto-prefixed with '_' if it doesn't start with '_'. Auto-generated if omitted.
150
+ WIDGET FIELDS (for layout.define):
151
+ - id: Do NOT provide. Ids are assigned by the server and returned in the response.
100
152
  - type (required): Widget type identifier (e.g., 'cf.platform.wiki', 'cf.platform.embeddedSearchAsTable', 'cf.platform.comments', 'cf.platform.files')
101
153
  - config (optional): Key-value object of widget configuration. Keys are config attribute names from cplace_get_widget_definition. IMPORTANT: Attribute names vary per widget type — some use short names (e.g., 'search', 'height'), others use fully-qualified names (e.g., 'cf.cplace.platform.attributesGroup.localizedTitle'). Do NOT guess attribute names — call cplace_get_widget_definition with includeDetails: true first. Omit 'cf.platform.entity' entirely (it defaults to the current page; passing empty causes errors). Values are strings, numbers, booleans, or objects. For localizedString attributes, use locale keys: { en: "English", de: "German" }.
102
154
  - embeddedLayouts (optional): Object mapping layout attribute names to nested layout specs. Used for container widgets (tab groups, attributes groups).
@@ -140,62 +192,15 @@ layout.define({
140
192
  ]
141
193
  });
142
194
 
143
- Multi-row layout with explicit widget IDs and localized title:
144
- layout.define({
145
- rows: [
146
- { columns: [{ proportion: 12, widgets: [{ id: "header", type: "cf.platform.wiki" }] }] },
147
- {
148
- columns: [
149
- { proportion: 6, widgets: [{ id: "tasks", type: "cf.platform.embeddedSearchAsTable", config: { title: { en: "Tasks", de: "Aufgaben" }, height: 400, search: '{"filters":[{"typeNames":["cf.project.Task"]}]}' } }] },
150
- { proportion: 6, widgets: [{ id: "milestones", type: "cf.platform.embeddedSearchAsTable", config: { title: { en: "Milestones", de: "Meilensteine" }, height: 400, search: '{"filters":[{"typeNames":["cf.project.Milestone"]}]}' } }] }
151
- ]
152
- },
153
- { columns: [{ proportion: 12, widgets: [{ id: "comments", type: "cf.platform.comments" }] }] }
154
- ]
155
- });
156
-
157
- Widget with embedded layout (container widget):
158
- layout.define({
159
- rows: [
160
- {
161
- columns: [
162
- {
163
- proportion: 12,
164
- widgets: [
165
- {
166
- type: "cf.cplace.platform.attributesGroup",
167
- config: { "cf.cplace.platform.attributesGroup.localizedTitle": { en: "Details Section", de: "Detailbereich" } },
168
- embeddedLayouts: {
169
- "widgetsLayout": {
170
- rows: [
171
- {
172
- columns: [
173
- { proportion: 6, widgets: [{ type: "cf.platform.wiki" }] },
174
- { proportion: 6, widgets: [{ type: "cf.platform.files" }] }
175
- ]
176
- }
177
- ]
178
- }
179
- }
180
- }
181
- ]
182
- }
183
- ]
184
- }
185
- ]
186
- });
195
+ Per-widget edit example:
196
+ layout.updateWidget("myTable", { "height": 800 });
187
197
 
188
- Dynamic layout using search APIs:
189
- var search = new Search();
190
- search.add(Filters.type("cf.project.Dashboard"));
191
- var count = search.getResultCount();
192
- var widgets = [{ type: "cf.platform.wiki" }];
193
- if (count > 0) {
194
- widgets.push({ type: "cf.platform.embeddedSearchAsTable", config: { height: 400, search: '{"filters":[{"typeNames":["cf.project.Dashboard"]}]}' } });
195
- }
196
- layout.define({ rows: [{ columns: [{ proportion: 12, widgets: widgets }] }] });`)
198
+ EMBEDDED WIDGET CONSTRAINT:
199
+ <embeddedwidget> tags must appear directly inline in content: string literals — not in variables.
200
+ ✅ layout.updateWidget("id", { content: '<embeddedwidget ...>...</embeddedwidget>' });
201
+ var tag = '<embeddedwidget ...>'; layout.updateWidget("id", { content: tag });`)
197
202
  },
198
- annotations: { title: "Define Layout" }
203
+ annotations: { title: "Execute Layout Script" }
199
204
  },
200
205
  [TOOL_GET_LAYOUT_OVERVIEW]: {
201
206
  description: "Get layout structure for page or type. Provides an overview of the layout grid including rows, columns, and widget summaries for both page and type layouts.",
@@ -205,36 +210,39 @@ layout.define({ rows: [{ columns: [{ proportion: 12, widgets: widgets }] }] });`
205
210
  annotations: { title: "Get Layout Overview" }
206
211
  },
207
212
  [TOOL_GET_LAYOUT_WIDGET_DETAILS]: {
208
- description: "Get detailed widget configuration from page or type layout. Extracts specific widget information from the layout structure.",
213
+ description: "Get detailed widget configuration from page or type layout. Extracts specific widget information from the layout structure.\n\nRichString widget content appears in decoded form: `<embeddedwidget id=\"…\" type=\"…\">{\"properties\":{…}}</embeddedwidget>` — no base64.",
209
214
  inputSchema: {
210
215
  context: LayoutContextSchema,
211
216
  widgetId: z.string().describe("The unique widget identifier to get details for")
212
217
  },
213
218
  annotations: { title: "Get Layout Widget Details" }
214
219
  },
215
- [TOOL_GET_LAYOUT_DEFINITION]: {
216
- description: `Get the current layout as a layout.define() JavaScript definition for a page or type layout.
220
+ [TOOL_GET_LAYOUT_SCRIPT]: {
221
+ description: `Get the current layout as an executable script for a page or type layout.
217
222
 
218
- WHEN TO USE:
219
- - To read the current layout before modifying it (read-edit-write workflow)
220
- - To inspect the full layout definition including widget configurations and embedded layouts
221
- - To copy a layout from one page/type to another
223
+ TWO MODES (determined by widgetIds parameter):
222
224
 
223
- RETURNS:
224
- - The layout as a layout.define({...}) definition string, ready to be modified and posted back via cplace_define_layout
225
- - Widget config values are in the INPUT format accepted by cplace_define_layout (references as UID strings, rich strings as markup strings, localized strings as {locale: value} maps)
225
+ WITHOUT widgetIds: Returns the full layout as a layout.define({...}) script (same as before).
226
+
227
+ WITH widgetIds: Returns layout.updateWidget("id", {config}) fragments for just the specified widgets.
228
+ The output is directly executable — post it back via cplace_execute_layout_script.
226
229
 
227
230
  ROUND-TRIP WORKFLOW:
228
- 1. GET: Use this tool to retrieve the current layout definition
229
- 2. EDIT: Modify the definition as needed
230
- 3. APPLY: Use cplace_define_layout to apply the modified definition`,
231
+ 1. GET: Use this tool (with widgetIds for selective read, without for full layout)
232
+ 2. EDIT: Modify the script as needed
233
+ 3. APPLY: Use cplace_execute_layout_script to apply
234
+
235
+ RichString widget content is returned in decoded form:
236
+ <embeddedwidget id="…" type="…">{"properties":{…}}</embeddedwidget>
237
+ The output is directly executable — base64 tags are never emitted.`,
231
238
  inputSchema: {
232
- context: LayoutContextSchema
239
+ context: LayoutContextSchema,
240
+ widgetIds: z.array(z.string()).optional().describe("Optional list of widget IDs to read. When provided, returns layout.updateWidget() fragments for just those widgets instead of the full layout.define() script. Widget IDs can be found via cplace_get_layout_overview.")
233
241
  },
234
- annotations: { title: "Get Layout Definition" }
242
+ annotations: { title: "Get Layout Script" }
235
243
  },
236
244
  [TOOL_EDIT_LAYOUT]: {
237
- description: "Edit a layout using str_replace — find an exact text match and replace it. Reads the current layout.define() definition, applies the replacement, and writes back. Use this instead of cplace_define_layout when making small changes to large layouts to avoid reproducing the entire definition.",
245
+ description: "Edit a layout using str_replace — find an exact text match and replace it. Reads the current layout.define() definition, applies the replacement, and writes back. Use this instead of cplace_execute_layout_script when making small changes to large layouts to avoid reproducing the entire definition.\n\nRichString widget content is in decoded form. `old_str` must match the decoded form exactly as returned by cplace_get_layout_script. Raw base64 <embeddedwidget> tags are rejected in both `old_str` and `new_str`.",
238
246
  inputSchema: {
239
247
  context: LayoutContextSchema,
240
248
  old_str: z.string().describe("The exact text to find in the layout definition (must match exactly, including whitespace and line breaks)"),
@@ -251,17 +259,18 @@ async function getLayoutOverview(client, context) {
251
259
  return await client.makeApiRequest(endpoint, 'GET', requestParams);
252
260
  }
253
261
  export function registerLayoutTools(server, client) {
254
- server.registerTool(TOOL_DEFINE_LAYOUT, LAYOUT_TOOL_DEFINITIONS[TOOL_DEFINE_LAYOUT], async ({ context, script }) => {
255
- debugLogWithTag('DEFINE_LAYOUT', `Defining ${context.type} layout (${script.length} chars)`);
262
+ server.registerTool(TOOL_EXECUTE_LAYOUT_SCRIPT, LAYOUT_TOOL_DEFINITIONS[TOOL_EXECUTE_LAYOUT_SCRIPT], async ({ context, script }) => {
263
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Executing ${context.type} layout script (${script.length} chars)`);
256
264
  try {
257
265
  const endpoint = context.type === "page"
258
266
  ? "json/page/layoutScript"
259
267
  : "json/type/layoutScript";
268
+ const encodedScript = await encodeRichStringsInScript(client, context, script);
260
269
  let requestBody;
261
270
  if (context.type === "page") {
262
271
  requestBody = {
263
272
  pageUID: context.pageUID,
264
- script
273
+ script: encodedScript
265
274
  };
266
275
  }
267
276
  else {
@@ -269,15 +278,18 @@ export function registerLayoutTools(server, client) {
269
278
  workspaceId: context.workspaceId,
270
279
  typeInternalName: context.typeInternalName,
271
280
  ...(context.alternativeLayoutName && { alternativeLayoutName: context.alternativeLayoutName }),
272
- script
281
+ script: encodedScript
273
282
  };
274
283
  }
275
284
  const rawResponse = await client.makeRawApiRequest(endpoint, 'POST', undefined, requestBody);
276
- debugLogWithTag('DEFINE_LAYOUT', `Raw response success: ${rawResponse.success}, status: ${rawResponse.status || 'N/A'}`);
285
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Raw response success: ${rawResponse.success}, status: ${rawResponse.status || 'N/A'}`);
277
286
  let response;
278
287
  if (rawResponse.success === true) {
288
+ if (rawResponse.result) {
289
+ await decodeRichStringsInLayout(client, rawResponse.result);
290
+ }
279
291
  response = {
280
- operation: "DEFINE_LAYOUT",
292
+ operation: "EXECUTE_LAYOUT_SCRIPT",
281
293
  success: true,
282
294
  status: rawResponse.status,
283
295
  context,
@@ -287,7 +299,7 @@ export function registerLayoutTools(server, client) {
287
299
  }
288
300
  else if (rawResponse.errors) {
289
301
  response = {
290
- operation: "DEFINE_LAYOUT",
302
+ operation: "EXECUTE_LAYOUT_SCRIPT",
291
303
  success: false,
292
304
  status: "VALIDATION_ERROR",
293
305
  context,
@@ -297,7 +309,7 @@ export function registerLayoutTools(server, client) {
297
309
  }
298
310
  else {
299
311
  response = {
300
- operation: "DEFINE_LAYOUT",
312
+ operation: "EXECUTE_LAYOUT_SCRIPT",
301
313
  success: false,
302
314
  status: "ERROR",
303
315
  context,
@@ -311,7 +323,7 @@ export function registerLayoutTools(server, client) {
311
323
  response.resultNote = "Layout was persisted successfully. Result omitted due to size. Use cplace_get_layout_overview to inspect.";
312
324
  const sizeCheck2 = checkResponseSize(response);
313
325
  if (sizeCheck2.tooLarge) {
314
- debugLogWithTag('DEFINE_LAYOUT', `Response still too large after stripping result: ${sizeCheck2.actualSize} chars`);
326
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Response still too large after stripping result: ${sizeCheck2.actualSize} chars`);
315
327
  return {
316
328
  content: [{
317
329
  type: "text",
@@ -322,7 +334,7 @@ export function registerLayoutTools(server, client) {
322
334
  }
323
335
  }
324
336
  else {
325
- debugLogWithTag('DEFINE_LAYOUT', `Error response too large: ${sizeCheck.actualSize} chars`);
337
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Error response too large: ${sizeCheck.actualSize} chars`);
326
338
  return {
327
339
  content: [{
328
340
  type: "text",
@@ -332,18 +344,24 @@ export function registerLayoutTools(server, client) {
332
344
  };
333
345
  }
334
346
  }
335
- debugLogWithTag('DEFINE_LAYOUT', `Returning response with success=${response.success}, status=${response.status}`);
347
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Returning response with success=${response.success}, status=${response.status}`);
336
348
  return {
337
349
  content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
338
350
  ...(!response.success ? { isError: true } : {})
339
351
  };
340
352
  }
341
353
  catch (error) {
342
- debugLogWithTag('DEFINE_LAYOUT', `Error: ${error instanceof Error ? error.message : String(error)}`);
354
+ debugLogWithTag('EXECUTE_LAYOUT_SCRIPT', `Error: ${error instanceof Error ? error.message : String(error)}`);
355
+ if (error instanceof DecodedWidgetParseError) {
356
+ return {
357
+ content: [{ type: "text", text: error.message }],
358
+ isError: true
359
+ };
360
+ }
343
361
  return {
344
362
  content: [{
345
363
  type: "text",
346
- text: `Error defining layout: ${error instanceof Error ? error.message : String(error)}`
364
+ text: `Error executing layout script: ${error instanceof Error ? error.message : String(error)}`
347
365
  }],
348
366
  isError: true
349
367
  };
@@ -389,6 +407,7 @@ export function registerLayoutTools(server, client) {
389
407
  debugLogWithTag('LAYOUT', `Getting widget details for ${widgetId} from ${context.type} layout`);
390
408
  try {
391
409
  const layoutResult = await getLayoutOverview(client, context);
410
+ await decodeRichStringsInLayout(client, layoutResult);
392
411
  const foundWidget = findWidgetById(layoutResult.rows, widgetId);
393
412
  if (!foundWidget) {
394
413
  return {
@@ -417,33 +436,38 @@ export function registerLayoutTools(server, client) {
417
436
  };
418
437
  }
419
438
  });
420
- server.registerTool(TOOL_GET_LAYOUT_DEFINITION, LAYOUT_TOOL_DEFINITIONS[TOOL_GET_LAYOUT_DEFINITION], async ({ context }) => {
421
- debugLogWithTag('LAYOUT', `Getting layout definition for ${context.type} layout`);
439
+ server.registerTool(TOOL_GET_LAYOUT_SCRIPT, LAYOUT_TOOL_DEFINITIONS[TOOL_GET_LAYOUT_SCRIPT], async ({ context, widgetIds }) => {
440
+ debugLogWithTag('GET_LAYOUT_SCRIPT', `Getting layout script for ${context.type} layout${widgetIds ? ` (widgets: ${widgetIds.join(', ')})` : ''}`);
422
441
  try {
423
442
  const endpoint = context.type === "page"
424
443
  ? "json/page/layoutScript"
425
444
  : "json/type/layoutScript";
426
- const params = buildRequestParams(context);
445
+ const params = {
446
+ ...buildRequestParams(context),
447
+ ...(widgetIds && widgetIds.length > 0 && { widgetIds })
448
+ };
427
449
  const rawResponse = await client.makeRawApiRequest(endpoint, 'GET', params);
428
450
  if (rawResponse.success !== true) {
429
451
  return {
430
452
  content: [{
431
453
  type: "text",
432
- text: `Error getting ${context.type} layout definition: ${rawResponse.errorMessage || "Unknown error"}`
454
+ text: `Error getting ${context.type} layout script: ${rawResponse.errorMessage || "Unknown error"}`
433
455
  }],
434
456
  isError: true
435
457
  };
436
458
  }
459
+ const decodedScript = await decodeRichStringsInScript(client, rawResponse.script);
437
460
  const response = {
438
461
  context,
439
- script: rawResponse.script
462
+ ...(widgetIds && { widgetIds }),
463
+ script: decodedScript
440
464
  };
441
465
  const sizeCheck = checkResponseSize(response);
442
466
  if (sizeCheck.tooLarge) {
443
467
  return {
444
468
  content: [{
445
469
  type: "text",
446
- text: `Layout definition response too large (${sizeCheck.actualSize} characters). Use cplace_get_layout_overview to inspect the layout structure instead.`
470
+ text: `Layout script response too large (${sizeCheck.actualSize} characters). ${widgetIds ? 'Try requesting fewer widgets.' : 'Use cplace_get_layout_overview to inspect the layout structure instead, or use widgetIds to request specific widgets.'}`
447
471
  }],
448
472
  isError: true
449
473
  };
@@ -453,11 +477,11 @@ export function registerLayoutTools(server, client) {
453
477
  };
454
478
  }
455
479
  catch (error) {
456
- debugLogWithTag('LAYOUT', `Error getting layout definition: ${error instanceof Error ? error.message : String(error)}`);
480
+ debugLogWithTag('GET_LAYOUT_SCRIPT', `Error: ${error instanceof Error ? error.message : String(error)}`);
457
481
  return {
458
482
  content: [{
459
483
  type: "text",
460
- text: `Error getting ${context.type} layout definition: ${error instanceof Error ? error.message : String(error)}`
484
+ text: `Error getting ${context.type} layout script: ${error instanceof Error ? error.message : String(error)}`
461
485
  }],
462
486
  isError: true
463
487
  };
@@ -466,6 +490,15 @@ export function registerLayoutTools(server, client) {
466
490
  server.registerTool(TOOL_EDIT_LAYOUT, LAYOUT_TOOL_DEFINITIONS[TOOL_EDIT_LAYOUT], async ({ context, old_str, new_str, replace_all = false }) => {
467
491
  debugLogWithTag('EDIT_LAYOUT', `Editing ${context.type} layout`);
468
492
  try {
493
+ if (containsRawBase64Tag(old_str) || containsRawBase64Tag(new_str)) {
494
+ return {
495
+ content: [{
496
+ type: "text",
497
+ text: 'Raw base64 <embeddedwidget> tags are not accepted in str_replace. Use the decoded form:\n <embeddedwidget id="…" type="…">{"properties":{…}}</embeddedwidget>\nFetch the current decoded form via cplace_get_layout_script.'
498
+ }],
499
+ isError: true
500
+ };
501
+ }
469
502
  const readEndpoint = context.type === "page"
470
503
  ? "json/page/layoutScript"
471
504
  : "json/type/layoutScript";
@@ -477,10 +510,10 @@ export function registerLayoutTools(server, client) {
477
510
  isError: true
478
511
  };
479
512
  }
480
- const currentScript = rawResponse.script;
513
+ const currentScript = await decodeRichStringsInScript(client, rawResponse.script);
481
514
  if (currentScript === undefined || currentScript === null || currentScript === '') {
482
515
  return {
483
- content: [{ type: "text", text: `Error: No layout definition found for this ${context.type}. Use cplace_define_layout to create a new layout.` }],
516
+ content: [{ type: "text", text: `Error: No layout definition found for this ${context.type}. Use cplace_execute_layout_script to create a new layout.` }],
484
517
  isError: true
485
518
  };
486
519
  }
@@ -491,16 +524,17 @@ export function registerLayoutTools(server, client) {
491
524
  isError: true
492
525
  };
493
526
  }
527
+ const encodedNewScript = await encodeRichStringsInScript(client, context, result.newContent);
494
528
  let writeBody;
495
529
  if (context.type === "page") {
496
- writeBody = { pageUID: context.pageUID, script: result.newContent };
530
+ writeBody = { pageUID: context.pageUID, script: encodedNewScript };
497
531
  }
498
532
  else {
499
533
  writeBody = {
500
534
  workspaceId: context.workspaceId,
501
535
  typeInternalName: context.typeInternalName,
502
536
  ...(context.alternativeLayoutName && { alternativeLayoutName: context.alternativeLayoutName }),
503
- script: result.newContent
537
+ script: encodedNewScript
504
538
  };
505
539
  }
506
540
  const writeResponse = await client.makeRawApiRequest(readEndpoint, 'POST', undefined, writeBody);
@@ -523,6 +557,12 @@ export function registerLayoutTools(server, client) {
523
557
  }
524
558
  catch (error) {
525
559
  debugLogWithTag('EDIT_LAYOUT', `Error: ${error instanceof Error ? error.message : String(error)}`);
560
+ if (error instanceof DecodedWidgetParseError) {
561
+ return {
562
+ content: [{ type: "text", text: error.message }],
563
+ isError: true
564
+ };
565
+ }
526
566
  return {
527
567
  content: [{ type: "text", text: `Error editing layout: ${error instanceof Error ? error.message : String(error)}` }],
528
568
  isError: true
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/tools/layout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IACzC,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;KAC/D,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;QACvE,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QACvF,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;KAC5F,C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O,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;gBACpH,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -60,8 +60,8 @@ export declare const PAGE_TOOL_DEFINITIONS: {
60
60
  readonly name: z.ZodOptional<z.ZodString>;
61
61
  readonly parentUID: z.ZodOptional<z.ZodString>;
62
62
  readonly content: z.ZodOptional<z.ZodString>;
63
- readonly attributes: z.ZodOptional<z.ZodAny>;
64
- readonly builtinAttributes: z.ZodOptional<z.ZodAny>;
63
+ readonly attributes: z.ZodEffects<z.ZodOptional<z.ZodAny>, any, unknown>;
64
+ readonly builtinAttributes: z.ZodEffects<z.ZodOptional<z.ZodAny>, any, unknown>;
65
65
  };
66
66
  readonly annotations: {
67
67
  readonly title: "Manage Page";
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/tools/pages.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;AAc5C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFxB,CAAC;AAEX,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QAuY3E"}
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/tools/pages.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;AAc5C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFxB,CAAC;AAEX,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QA4X3E"}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { debugLogWithTag } from "../logger.js";
3
3
  import { checkResponseSize } from '../utils.js';
4
- import { DATE_TIME_FORMAT_DESCRIPTION, validateNotJsonString } from "./common-schemas.js";
4
+ import { DATE_TIME_FORMAT_DESCRIPTION, jsonStringToObject } from "./common-schemas.js";
5
5
  import { applyStrReplace } from '../str-replace-utils.js';
6
6
  const TOOL_DELETE_PAGE = 'cplace_delete_page';
7
7
  const TOOL_DELETE_PAGE_WITH_CHILDREN = 'cplace_delete_page_with_children';
@@ -59,7 +59,7 @@ export const PAGE_TOOL_DEFINITIONS = {
59
59
  name: z.string().optional().describe("Page name. For create operations: optional if type has name generation pattern (auto-generates from pattern), otherwise required. For update operations: optional. Name generation pattern syntax: <attributeName> for attribute values, {###} for sequential counter, {0000} for zero-padded counter. Example: '<title>-{0000}' generates 'ProjectAlpha-0001'. Provide explicit name to override pattern. Use cplace_get_type_datamodel to check if type supports name generation."),
60
60
  parentUID: z.string().optional().describe("Parent page UID for hierarchy. For create: sets initial parent. For update: moves page (use empty string to remove parent)."),
61
61
  content: z.string().optional().describe("HTML content for the page. Use HTML markup, not markdown - e.g. '<strong>bold</strong>' not '**bold**'. For update: use empty string to remove content."),
62
- attributes: z.any().optional().describe(`Pass as a JSON object (NOT \`customAttributes\`, NOT a JSON string). Custom attribute values as key-value pairs. 🔍 IMPORTANT: Use 'cplace_get_type_datamodel' tool first to understand attribute requirements and constraints. Supports:
62
+ attributes: jsonStringToObject(z.any().optional()).describe(`Pass as a JSON object (NOT \`customAttributes\`, NOT a JSON string). Custom attribute values as key-value pairs. 🔍 IMPORTANT: Use 'cplace_get_type_datamodel' tool first to understand attribute requirements and constraints. Supports:
63
63
  - String values: "text"
64
64
  - Numeric values: 42 or 3.14
65
65
  - Boolean values: true/false
@@ -76,7 +76,7 @@ The system automatically detects attribute types from the page type definition a
76
76
  - Proper multiplicity validation (single vs multi-valued)
77
77
  - Automatic type conversion and validation
78
78
  - Enhanced error messages with attribute-specific details`),
79
- builtinAttributes: z.any().optional().describe(`Builtin/mixin-provided attributes (optional for schedules). Supports:
79
+ builtinAttributes: jsonStringToObject(z.any().optional()).describe(`Builtin/mixin-provided attributes (optional for schedules). Supports:
80
80
  - owner: Person UID as string (e.g., "person/123abc456") - Sets/updates the page owner for schedules
81
81
  - For update only: Use null to remove builtin attribute values
82
82
 
@@ -104,15 +104,6 @@ export function registerPageTools(server, client) {
104
104
  server.registerTool(TOOL_MANAGE_PAGE, PAGE_TOOL_DEFINITIONS[TOOL_MANAGE_PAGE], async (params) => {
105
105
  const { operation } = params;
106
106
  debugLogWithTag('MANAGE_PAGE', `${operation} page operation`);
107
- for (const [paramName, value] of [
108
- ['attributes', params.attributes],
109
- ['builtinAttributes', params.builtinAttributes],
110
- ]) {
111
- const jsonStringError = validateNotJsonString(value, paramName, 'object');
112
- if (jsonStringError) {
113
- return { content: [{ type: "text", text: jsonStringError.message }], isError: true };
114
- }
115
- }
116
107
  try {
117
108
  if (operation === "create") {
118
109
  if (!params.workspaceId || !params.typeInternalName) {