@clipform/mcp-server 5.17.0 → 5.19.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.
@@ -31,7 +31,7 @@ import {
31
31
  union,
32
32
  unknown,
33
33
  url
34
- } from "./chunk-44EKWJYD.js";
34
+ } from "./chunk-NWKND52B.js";
35
35
  import {
36
36
  GUIDE_TYPES,
37
37
  QUIZ_VARIANTS,
@@ -40,7 +40,7 @@ import {
40
40
  getGuideUri,
41
41
  guideFallbackText,
42
42
  registerResources
43
- } from "./chunk-LYWTKEW6.js";
43
+ } from "./chunk-UCGO7VI7.js";
44
44
  import {
45
45
  ANON_PREVIEW_LINK_LABEL,
46
46
  ANON_PREVIEW_NOTICE,
@@ -54,18 +54,22 @@ import {
54
54
  isPreviewViewerUrl,
55
55
  previewOnlyNotice,
56
56
  withAdoptedNotice
57
- } from "./chunk-GFSORADL.js";
57
+ } from "./chunk-SOYW4CQX.js";
58
58
  import {
59
59
  ACTIVE_NODE_TYPES,
60
60
  ANON_MCP_BLOCKED_NODE_TYPES,
61
61
  ANON_MCP_LIVE_TTL_DAYS,
62
62
  ANON_MCP_RESPONSE_CAP,
63
63
  CHOICE_MAX_OPTIONS,
64
+ COMPANY_CHECKLIST_KINDS,
64
65
  CONSENT_TYPES,
65
66
  CONTACT_FIELDS,
66
67
  FEATURE_FLAGS,
67
68
  FORM_TYPES_LIST,
68
69
  FORM_TYPE_ALIASES,
70
+ GUIDE_CONFIG_KEY,
71
+ GUIDE_LIMITS,
72
+ GUIDE_TOUR_ANCHORS,
69
73
  LINK_VARIABLE_PRESETS,
70
74
  LOGIC_TARGET_TYPES,
71
75
  MAX_CLIP_SECONDS,
@@ -114,7 +118,7 @@ import {
114
118
  textResult,
115
119
  validateVariableKey,
116
120
  viewerUrl
117
- } from "./chunk-WWFCE5WZ.js";
121
+ } from "./chunk-267KDJVO.js";
118
122
  import {
119
123
  getMcpAuth,
120
124
  runWithMcpAuth,
@@ -17211,11 +17215,15 @@ function allowedConfigKeys(nodeType) {
17211
17215
  return /* @__PURE__ */ new Set();
17212
17216
  }
17213
17217
  var HIDDEN_CONFIG_KEYS = /* @__PURE__ */ new Set(["workspace_integration_id"]);
17214
- function projectConfig(nodeType, config) {
17218
+ function projectConfig(nodeType, config, opts = {}) {
17215
17219
  if (!config) return void 0;
17216
17220
  const allowed = allowedConfigKeys(nodeType);
17217
17221
  const projected = {};
17218
17222
  for (const [key, value] of Object.entries(config)) {
17223
+ if (key === GUIDE_CONFIG_KEY && opts.guide === true) {
17224
+ projected[key] = value;
17225
+ continue;
17226
+ }
17219
17227
  if (!allowed.has(key) || HIDDEN_CONFIG_KEYS.has(key)) continue;
17220
17228
  if (typeof value === "string" && gatedEnumValues(nodeType, key).has(value)) continue;
17221
17229
  projected[key] = value;
@@ -17279,7 +17287,7 @@ function projectAnswerRoutes(node, logicByNode) {
17279
17287
  return to ? [{ option_id: o.id, option_content: o.content, target_id: to.value, target_type: to.type }] : [];
17280
17288
  });
17281
17289
  }
17282
- function projectFormState(data) {
17290
+ function projectFormState(data, opts = {}) {
17283
17291
  const { nodes, logicByNode } = orderNodesWithLogic(data);
17284
17292
  const urls = projectUrls(data);
17285
17293
  return {
@@ -17290,7 +17298,7 @@ function projectFormState(data) {
17290
17298
  ...urls ? { urls } : {},
17291
17299
  nodes: nodes.map((q) => {
17292
17300
  const options = q.node_options ?? q.options;
17293
- const config = projectConfig(q.type, q.config);
17301
+ const config = projectConfig(q.type, q.config, opts);
17294
17302
  const next = projectNext(q, logicByNode);
17295
17303
  return {
17296
17304
  id: q.id,
@@ -17304,7 +17312,7 @@ function projectFormState(data) {
17304
17312
  })
17305
17313
  };
17306
17314
  }
17307
- function formatFormState(data) {
17315
+ function formatFormState(data, opts = {}) {
17308
17316
  const { nodes, logicByNode } = orderNodesWithLogic(data);
17309
17317
  const lines = [
17310
17318
  `Form: ${data.title}`,
@@ -17339,7 +17347,7 @@ function formatFormState(data) {
17339
17347
  lines.push(` ${i + 1}. [${q.type}] ${q.prompt || "(no prompt)"}`);
17340
17348
  lines.push(` Node ID: ${q.id}`);
17341
17349
  if (q.required) lines.push(` Required: yes`);
17342
- const config = projectConfig(q.type, q.config);
17350
+ const config = projectConfig(q.type, q.config, opts);
17343
17351
  if (config && Object.keys(config).length > 0) {
17344
17352
  lines.push(` Config: ${JSON.stringify(config)}`);
17345
17353
  }
@@ -17444,8 +17452,9 @@ function registerGetFormTool(server, opts = {}) {
17444
17452
  if (!result.ok) {
17445
17453
  return apiErrorResult(result);
17446
17454
  }
17447
- const text = formatFormState(result.data) + (opts.variables ? linkVariablesText(result.data) : "");
17448
- return structuredResult(text, projectFormState(result.data));
17455
+ const state = { guide: opts.guide === true };
17456
+ const text = formatFormState(result.data, state) + (opts.variables ? linkVariablesText(result.data) : "");
17457
+ return structuredResult(text, projectFormState(result.data, state));
17449
17458
  }
17450
17459
  );
17451
17460
  }
@@ -19193,6 +19202,87 @@ function registerSetLinkVariablesTool(server) {
19193
19202
  );
19194
19203
  }
19195
19204
 
19205
+ // src/tools/set-node-guide.ts
19206
+ var NOT_AVAILABLE2 = "Walkthrough notes are not available on this workspace.";
19207
+ var TourSchema = external_exports.object({
19208
+ title: external_exports.string().min(1).max(GUIDE_LIMITS.titleMax).describe(`Short heading, up to ${GUIDE_LIMITS.titleMax} characters`),
19209
+ body: external_exports.string().min(1).max(GUIDE_LIMITS.bodyMax).describe(`The note, up to ${GUIDE_LIMITS.bodyMax} characters of plain text`),
19210
+ anchor: external_exports.enum(GUIDE_TOUR_ANCHORS).optional().describe('Where the note points: "node" (default) or "share" for the closing note on the Share button')
19211
+ });
19212
+ var ChecklistItemSchema = external_exports.object({
19213
+ kind: external_exports.enum(COMPANY_CHECKLIST_KINDS).describe(
19214
+ "What ticks the item: record_video (the owner records or uploads their own video on THIS step, so put it on a step that carries a video), preview (they answer a step in the preview), connect (they connect `integration`), go_live (they publish), claim_account (an anonymous visitor creates an account; hidden once signed in)"
19215
+ ),
19216
+ label: external_exports.string().min(1).max(GUIDE_LIMITS.checklistLabelMax).describe(`The item, up to ${GUIDE_LIMITS.checklistLabelMax} characters, e.g. "Record your intro"`),
19217
+ description: external_exports.string().max(GUIDE_LIMITS.checklistDescriptionMax).optional().describe(`A short sentence under it, up to ${GUIDE_LIMITS.checklistDescriptionMax} characters (the card is narrow: keep it to about two lines)`),
19218
+ integration: external_exports.string().optional().describe('connect only: the integration slug, e.g. "stripe" or "calendly" (live integrations only)')
19219
+ });
19220
+ var IntroSchema = external_exports.object({
19221
+ title: external_exports.string().min(1).max(GUIDE_LIMITS.titleMax).describe(`Who it was built for, up to ${GUIDE_LIMITS.titleMax} characters`),
19222
+ body: external_exports.string().min(1).max(GUIDE_LIMITS.bodyMax).describe("What the form does for them, in one or two plain sentences")
19223
+ });
19224
+ function registerSetNodeGuideTool(server) {
19225
+ server.registerTool(
19226
+ "clipform_set_node_guide",
19227
+ {
19228
+ title: "Set a walkthrough intro, note or checklist",
19229
+ description: `Set or remove the builder walkthrough intro, note and getting-started checklist on one node of an outbound template. When someone copies the template and opens it in the builder, an intro card says what was built for them (title: who it is for, body: what the form does, four short lines at most), then the walkthrough pans to each noted node in form order and shows its note, then the checklist opens with the items of every node (form order, then list order), replacing the generic list on that copy; each item ticks itself from what the owner really does. Write public facts about the company only, never a person's name. Put the intro on the first noted node; each note covers only its own node, and the closing note goes on the last step with anchor "share". Put a record_video item on the step whose video the owner should replace, and the workspace-wide items (connect, go_live, claim_account) on the End screen. At most ${GUIDE_LIMITS.maxTourSteps} notes and ${GUIDE_LIMITS.maxChecklistItems} checklist items show per form. Send any of tour, intro and checklist; null removes that one and leaves the others.`,
19230
+ inputSchema: external_exports.object({
19231
+ form_id: external_exports.string().uuid().describe("The form UUID (returned by clipform_create_form, not the short share_id from the URL)"),
19232
+ node_id: external_exports.string().uuid().describe("The node to put the note or items on (ids from clipform_get_form). Not the Start node."),
19233
+ tour: TourSchema.nullable().optional().describe("The note, or null to remove it. Omit to leave it as it is."),
19234
+ intro: IntroSchema.nullable().optional().describe("The intro card shown before the first note, or null to remove it. Omit to leave it as it is."),
19235
+ checklist: external_exports.array(ChecklistItemSchema).max(GUIDE_LIMITS.maxChecklistItems).nullable().optional().describe("This node's checklist items (replaces its list), or null to remove them. Omit to leave them as they are.")
19236
+ }),
19237
+ outputSchema: external_exports.object({
19238
+ form_id: external_exports.string(),
19239
+ node_id: external_exports.string(),
19240
+ tour: TourSchema.nullable().describe("The note now stored on the node (trimmed), or null when it has none"),
19241
+ intro: IntroSchema.nullable().describe("The intro now stored on the node (trimmed), or null when it has none"),
19242
+ checklist: external_exports.array(ChecklistItemSchema).nullable().describe("The checklist items now stored on the node (trimmed), or null when it has none")
19243
+ }),
19244
+ annotations: {
19245
+ readOnlyHint: false,
19246
+ // Replaces the node's note or items, and null removes them.
19247
+ destructiveHint: true,
19248
+ idempotentHint: true,
19249
+ openWorldHint: false
19250
+ }
19251
+ },
19252
+ async ({ form_id, node_id, tour, intro, checklist }) => {
19253
+ if (tour === void 0 && intro === void 0 && checklist === void 0) {
19254
+ return refusedResult("Send tour, intro or checklist (null removes one).");
19255
+ }
19256
+ const guide = {};
19257
+ if (tour !== void 0) guide.tour = tour;
19258
+ if (intro !== void 0) guide.intro = intro;
19259
+ if (checklist !== void 0) guide.checklist = checklist;
19260
+ const res = await callApi(`/forms/${form_id}/nodes/${node_id}`, { method: "PATCH", body: { config: { guide } } });
19261
+ if (!res.ok) return apiErrorResult(res);
19262
+ const data = res.data;
19263
+ const storedTour = data?.config?.guide?.tour ?? null;
19264
+ const storedIntro = data?.config?.guide?.intro ?? null;
19265
+ const storedChecklist = data?.config?.guide?.checklist ?? null;
19266
+ if (tour && !storedTour || intro && !storedIntro || checklist?.length && !storedChecklist) return refusedResult(NOT_AVAILABLE2);
19267
+ const parts = [];
19268
+ if (tour !== void 0) {
19269
+ parts.push(
19270
+ storedTour ? `Walkthrough note set on node ${node_id}: "${storedTour.title}" (${storedTour.anchor === "share" ? "points at Share" : "points at the node"}).` : `Walkthrough note removed from node ${node_id}.`
19271
+ );
19272
+ }
19273
+ if (intro !== void 0) {
19274
+ parts.push(storedIntro ? `Intro card set on node ${node_id}: "${storedIntro.title}".` : `Intro card removed from node ${node_id}.`);
19275
+ }
19276
+ if (checklist !== void 0) {
19277
+ parts.push(
19278
+ storedChecklist ? `Checklist on node ${node_id}: ${storedChecklist.map((i) => `"${i.label}" (${i.kind})`).join(", ")}.` : `Checklist removed from node ${node_id}.`
19279
+ );
19280
+ }
19281
+ return structuredResult(parts.join(" "), { form_id, node_id, tour: storedTour, intro: storedIntro, checklist: storedChecklist });
19282
+ }
19283
+ );
19284
+ }
19285
+
19196
19286
  // src/tools/log-generation.ts
19197
19287
  function registerLogGenerationTool(server) {
19198
19288
  server.registerTool(
@@ -20893,7 +20983,7 @@ function createServer(options) {
20893
20983
  registerImportFormTool(server);
20894
20984
  registerListFormsTool(server, caps);
20895
20985
  registerWhoamiTool(server);
20896
- registerGetFormTool(server, { variables: options?.variables === true });
20986
+ registerGetFormTool(server, { variables: options?.variables === true, guide: options?.guide === true });
20897
20987
  registerUpdateFormTool(server);
20898
20988
  registerDeleteFormTool(server);
20899
20989
  registerGetResultsTool(server);
@@ -20908,6 +20998,7 @@ function createServer(options) {
20908
20998
  registerDeleteNodeMediaTool(server);
20909
20999
  registerSetNodeLogicTool(server);
20910
21000
  if (options?.variables === true) registerSetLinkVariablesTool(server);
21001
+ if (options?.guide === true) registerSetNodeGuideTool(server);
20911
21002
  registerLogGenerationTool(server);
20912
21003
  registerSearchNewsTool(server);
20913
21004
  registerGenerateTtsTool(server);
@@ -20994,4 +21085,4 @@ export {
20994
21085
  * MIT Licensed
20995
21086
  *)
20996
21087
  */
20997
- //# sourceMappingURL=chunk-UNBHNTXB.js.map
21088
+ //# sourceMappingURL=chunk-KAZSNRNF.js.map