@clipform/mcp-server 5.10.0 → 5.11.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.
@@ -9,7 +9,7 @@ import {
9
9
  refusedResult,
10
10
  structuredResult,
11
11
  textResult
12
- } from "./chunk-FRBVAMP6.js";
12
+ } from "./chunk-7NLXUGGN.js";
13
13
  import "./chunk-ENVV65JX.js";
14
14
  import "./chunk-PBQ5BQWD.js";
15
15
  import "./chunk-XO7XBMRY.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  FULL_CAPS,
3
3
  getSessionContext
4
- } from "./chunk-ZGILTJBO.js";
4
+ } from "./chunk-P27RWNSP.js";
5
5
  import {
6
6
  ALL_VARIANTS,
7
7
  FORM_TYPES,
8
8
  FORM_TYPE_KEYS,
9
9
  callApi
10
- } from "./chunk-FRBVAMP6.js";
10
+ } from "./chunk-7NLXUGGN.js";
11
11
  import {
12
12
  getMcpAuth
13
13
  } from "./chunk-ENVV65JX.js";
@@ -146,4 +146,4 @@ export {
146
146
  getGuideUri,
147
147
  registerResources
148
148
  };
149
- //# sourceMappingURL=chunk-RXCPM5QH.js.map
149
+ //# sourceMappingURL=chunk-4RTWGIA7.js.map
@@ -31,7 +31,7 @@ import {
31
31
  union,
32
32
  unknown,
33
33
  url
34
- } from "./chunk-TYQ4FUCC.js";
34
+ } from "./chunk-V76FKPAT.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-RXCPM5QH.js";
43
+ } from "./chunk-4RTWGIA7.js";
44
44
  import {
45
45
  ANON_PREVIEW_LINK_LABEL,
46
46
  ANON_PREVIEW_NOTICE,
@@ -54,7 +54,7 @@ import {
54
54
  isPreviewViewerUrl,
55
55
  previewOnlyNotice,
56
56
  withAdoptedNotice
57
- } from "./chunk-ZGILTJBO.js";
57
+ } from "./chunk-P27RWNSP.js";
58
58
  import {
59
59
  ACTIVE_NODE_TYPES,
60
60
  ANON_MCP_BLOCKED_NODE_TYPES,
@@ -75,14 +75,21 @@ import {
75
75
  NODE_TYPES,
76
76
  NON_COUNTABLE_TYPES,
77
77
  PII_NODE_TYPES,
78
+ VARIABLE_LABEL_MAX_LENGTH,
79
+ VARIABLE_MAX_CUSTOM_PER_FORM,
80
+ VARIABLE_MAX_LINK_PER_FORM,
81
+ VARIABLE_TYPES,
78
82
  apiErrorResult,
79
83
  authChallengeMeta,
80
84
  bfsOrder,
85
+ buildVariableLink,
81
86
  callApi,
87
+ coerceVariableValue,
82
88
  consentItemNotes,
83
89
  contactFieldNotes,
84
90
  defaultTarget,
85
91
  errorResult,
92
+ findScoreVariable,
86
93
  gatedConfigKeys,
87
94
  gatedEnumValues,
88
95
  isAnonMcpLockedNode,
@@ -90,8 +97,12 @@ import {
90
97
  isInactiveOptionEdge,
91
98
  isNodeLevelAction,
92
99
  isOptionEdge,
100
+ isPersonalLinkKey,
101
+ isRefusedStatus,
102
+ isReservedVariableKey,
93
103
  isTerminalType,
94
104
  lettersCapError,
105
+ linkVariablePreset,
95
106
  normalizeConsentItems,
96
107
  normalizeContactFields,
97
108
  recallDisplayText,
@@ -99,8 +110,10 @@ import {
99
110
  resolveFormType,
100
111
  stripGatedConfigKeys,
101
112
  structuredResult,
102
- textResult
103
- } from "./chunk-FRBVAMP6.js";
113
+ textResult,
114
+ validateVariableKey,
115
+ viewerUrl
116
+ } from "./chunk-7NLXUGGN.js";
104
117
  import {
105
118
  getMcpAuth,
106
119
  runWithMcpAuth,
@@ -16969,7 +16982,7 @@ function registerImportFormTool(server) {
16969
16982
  const data = importResult.data;
16970
16983
  const summary = data.import_summary;
16971
16984
  const formId = data.form_id;
16972
- const viewerUrl = data.url;
16985
+ const viewerUrl2 = data.url;
16973
16986
  const isLive = data.is_live ?? null;
16974
16987
  const previewUrl = data.preview_url ?? null;
16975
16988
  const builderUrl = data.builder_url ?? null;
@@ -16997,11 +17010,11 @@ function registerImportFormTool(server) {
16997
17010
  if (formId) {
16998
17011
  lines.push(``, `Form ID: ${formId}`);
16999
17012
  if (isLive === true) {
17000
- lines.push(`Live at: ${viewerUrl}`);
17013
+ lines.push(`Live at: ${viewerUrl2}`);
17001
17014
  } else {
17002
17015
  if (previewUrl) lines.push(`Preview the draft now: ${previewUrl}`);
17003
17016
  lines.push(
17004
- `FUTURE LIVE URL (not viewable yet - the form is a draft; opening this now shows a maintenance screen): ${viewerUrl}`,
17017
+ `FUTURE LIVE URL (not viewable yet - the form is a draft; opening this now shows a maintenance screen): ${viewerUrl2}`,
17005
17018
  `This form is a DRAFT. Review it, then publish with clipform_update_form (is_live: true) - only then does the URL above start serving the form to respondents.`
17006
17019
  );
17007
17020
  if (liveRefusedReason) lines.push(`Not live because: ${liveRefusedReason}`);
@@ -17013,7 +17026,7 @@ function registerImportFormTool(server) {
17013
17026
  return structuredResult(lines.join("\n"), {
17014
17027
  ...workspaceName ? { workspace_name: workspaceName } : {},
17015
17028
  form_id: formId,
17016
- viewer_url: viewerUrl,
17029
+ viewer_url: viewerUrl2,
17017
17030
  is_live: isLive,
17018
17031
  preview_url: previewUrl,
17019
17032
  builder_url: builderUrl,
@@ -17306,7 +17319,19 @@ function formatFormState(data) {
17306
17319
 
17307
17320
  // src/tools/get-form.ts
17308
17321
  var TargetTypeSchema = external_exports.enum(LOGIC_TARGET_TYPES);
17309
- function registerGetFormTool(server) {
17322
+ function linkFieldsText(data) {
17323
+ const rows = Array.isArray(data.variables) ? data.variables : [];
17324
+ const links = rows.filter((v) => v && v.kind === "custom" && v.url_settable === true && typeof v.key === "string" && !isReservedVariableKey(v.key));
17325
+ if (links.length === 0) return "";
17326
+ const lines = ["", "Link fields (values the link fills in; change with clipform_set_link_fields):"];
17327
+ for (const v of links) {
17328
+ lines.push(` ${v.key} (${v.type ?? "text"}, after ${isPersonalLinkKey(v.key) ? "#" : "?"} in the link)`);
17329
+ }
17330
+ const viewer = data.urls?.viewer;
17331
+ if (viewer) lines.push(` Your link: ${buildVariableLink(viewer, links, (v) => v.example)}`);
17332
+ return lines.join("\n");
17333
+ }
17334
+ function registerGetFormTool(server, opts = {}) {
17310
17335
  server.registerTool(
17311
17336
  "clipform_get_form",
17312
17337
  {
@@ -17369,7 +17394,8 @@ function registerGetFormTool(server) {
17369
17394
  if (!result.ok) {
17370
17395
  return apiErrorResult(result);
17371
17396
  }
17372
- return structuredResult(formatFormState(result.data), projectFormState(result.data));
17397
+ const text = formatFormState(result.data) + (opts.variables ? linkFieldsText(result.data) : "");
17398
+ return structuredResult(text, projectFormState(result.data));
17373
17399
  }
17374
17400
  );
17375
17401
  }
@@ -17542,12 +17568,12 @@ ${others ? "The other changes in this call were saved to the draft, but the form
17542
17568
  if (is_live === true) {
17543
17569
  const meta = await callApi(`/forms/${form_id}`, { timeoutMs: 5e3 });
17544
17570
  const urls = meta.ok ? meta.data.urls : void 0;
17545
- const viewerUrl = urls?.viewer;
17571
+ const viewerUrl2 = urls?.viewer;
17546
17572
  const responsesUrl = urls?.responses;
17547
- if (viewerUrl) {
17573
+ if (viewerUrl2) {
17548
17574
  resultText += `
17549
17575
 
17550
- Your form is live at: ${mdLink(LINK_LABELS.share, viewerUrl)}
17576
+ Your form is live at: ${mdLink(LINK_LABELS.share, viewerUrl2)}
17551
17577
  Share this URL with respondents. View responses any time with clipform_get_results (form_id: ${form_id})${responsesUrl ? `, or in the dashboard: ${mdLink(LINK_LABELS.responses, responsesUrl)}` : ""}`;
17552
17578
  }
17553
17579
  }
@@ -17840,7 +17866,7 @@ function paymentSummary(value) {
17840
17866
  if (amount === null || !currency) return null;
17841
17867
  return `${(amount / 100).toFixed(2)} ${currency.toUpperCase()} - ${status}`;
17842
17868
  }
17843
- function registerGetResponsesTool(server) {
17869
+ function registerGetResponsesTool(server, opts = {}) {
17844
17870
  server.registerTool(
17845
17871
  "clipform_get_responses",
17846
17872
  {
@@ -17881,7 +17907,7 @@ function registerGetResponsesTool(server) {
17881
17907
  },
17882
17908
  async ({ form_id, since, until, query, sort, limit }) => {
17883
17909
  const [subsResult, formResult] = await Promise.all([
17884
- callApi(`/forms/${form_id}/submissions`),
17910
+ opts.variables ? callApi(`/forms/${form_id}/submissions`, { params: { include: "variables" } }) : callApi(`/forms/${form_id}/submissions`),
17885
17911
  callApi(`/forms/${form_id}`)
17886
17912
  ]);
17887
17913
  if (!subsResult.ok) {
@@ -17895,7 +17921,10 @@ function registerGetResponsesTool(server) {
17895
17921
  nodeList = nodes;
17896
17922
  for (const n of nodes) nodeById.set(n.id, n);
17897
17923
  }
17898
- const rows = subsResult.data ?? [];
17924
+ const rawData = subsResult.data;
17925
+ const envelope = !Array.isArray(rawData) && rawData && typeof rawData === "object" ? rawData : void 0;
17926
+ const rows = (envelope ? envelope.rows : rawData) ?? [];
17927
+ const linkVars = (envelope?.variables ?? []).filter((v) => v.url_settable === true);
17899
17928
  const sinceMs = since ? Date.parse(since) : null;
17900
17929
  const untilMs = until ? Date.parse(until) : null;
17901
17930
  const needle = query?.toLowerCase() ?? null;
@@ -17942,18 +17971,30 @@ function registerGetResponsesTool(server) {
17942
17971
  const haystack = answers.map((a) => a.answer.toLowerCase()).join("\n");
17943
17972
  if (!haystack.includes(needle)) continue;
17944
17973
  }
17974
+ let linkValues = [];
17975
+ if (linkVars.length > 0 && row.variable_values) {
17976
+ const lv = [];
17977
+ for (const v of linkVars) {
17978
+ const val = row.variable_values[v.id];
17979
+ if (val === null || val === void 0 || val === "") continue;
17980
+ lv.push(`${v.key}=${isPersonalLinkKey(v.key) ? "[from the link]" : truncate(String(val), 100)}`);
17981
+ }
17982
+ linkValues = lv;
17983
+ }
17945
17984
  projected.push({
17946
17985
  submitted_at: submittedAt,
17947
17986
  submitted_ms: ms,
17948
17987
  status: row.status ?? "unknown",
17949
- answers
17988
+ answers,
17989
+ links: linkValues
17950
17990
  });
17951
17991
  }
17952
17992
  projected.sort(
17953
17993
  (a, b) => sort === "oldest" ? a.submitted_ms - b.submitted_ms : b.submitted_ms - a.submitted_ms
17954
17994
  );
17955
17995
  const totalMatching = projected.length;
17956
- const capped = projected.slice(0, limit ?? DEFAULT_LIMIT).map(({ submitted_ms: _ms, ...rest }) => rest);
17996
+ const cappedFull = projected.slice(0, limit ?? DEFAULT_LIMIT);
17997
+ const capped = cappedFull.map(({ submitted_ms: _ms, links: _links, ...rest }) => rest);
17957
17998
  const filterBits = [
17958
17999
  since ? `since ${since}` : null,
17959
18000
  until ? `until ${until}` : null,
@@ -17962,9 +18003,10 @@ function registerGetResponsesTool(server) {
17962
18003
  const lines = [
17963
18004
  `${totalMatching} response(s)${filterBits.length ? ` ${filterBits.join(", ")}` : ""}${lockedCount > 0 ? ` (+${lockedCount} over the plan's response limit - not shown; upgrade or view counts in clipform_get_results)` : ""}. Showing ${capped.length}, ${sort === "oldest" ? "oldest" : "newest"} first.`,
17964
18005
  ``,
17965
- ...capped.flatMap((r) => [
18006
+ ...cappedFull.flatMap((r) => [
17966
18007
  `\u2014 ${r.submitted_at} [${r.status}]`,
17967
- ...r.answers.map((a) => ` ${a.question}: ${a.answer}`)
18008
+ ...r.answers.map((a) => ` ${a.question}: ${a.answer}`),
18009
+ ...r.links.length > 0 ? [` From the link: ${r.links.join(", ")}`] : []
17968
18010
  ]),
17969
18011
  ``,
17970
18012
  REDACTION_FOOTER
@@ -18885,6 +18927,213 @@ Routes by answer are set. Call clipform_get_form to check each answer's route; i
18885
18927
  );
18886
18928
  }
18887
18929
 
18930
+ // src/tools/set-link-fields.ts
18931
+ var NOT_AVAILABLE = "Link fields are not available on this workspace.";
18932
+ var PasteSchema = external_exports.object({
18933
+ tool: external_exports.string().describe("The email/chat tool this key is the merge tag for"),
18934
+ snippet: external_exports.string().nullable().describe("Text to paste after the form link in that tool, or null when the tool adds it itself"),
18935
+ note: external_exports.string()
18936
+ });
18937
+ function pasteFor(key) {
18938
+ const preset = linkVariablePreset(key);
18939
+ return preset ? { tool: preset.tool, snippet: preset.snippet, note: preset.note } : void 0;
18940
+ }
18941
+ function normExample(type, raw) {
18942
+ if (raw === "" || raw === null) return null;
18943
+ return coerceVariableValue(type, raw);
18944
+ }
18945
+ function registerSetLinkFieldsTool(server) {
18946
+ server.registerTool(
18947
+ "clipform_set_link_fields",
18948
+ {
18949
+ title: "Set link fields",
18950
+ description: `Declare which link fields (hidden fields) a form takes from its link, and get back the form's "Your link" to paste into an email or chat tool. A link field is a value like a subscriber id that the link carries into the response, so you can tell who replied. Send the full list: fields you leave out are switched off (never deleted, so earlier answers keep working), and an unchanged list makes no changes. Use an opaque id as the value (e.g. the tool's subscriber id), not an email. Keys are lowercase letters, digits and underscores (e.g. mailchimp_id); a key that looks personal (email, phone, name) goes after # in the link so it never reaches a server log. Known keys come with the exact merge tag to paste: mc_id (ManyChat), mailchimp_id (Mailchimp), ck_subscriber_id (Kit). At most ${VARIABLE_MAX_LINK_PER_FORM} fields per form. Read the values back with clipform_get_responses.`,
18951
+ inputSchema: external_exports.object({
18952
+ form_id: external_exports.string().uuid().describe("The form UUID (returned by clipform_create_form, not the short share_id from the URL)"),
18953
+ fields: external_exports.array(
18954
+ external_exports.object({
18955
+ key: external_exports.string().describe("Lowercase key the link carries, e.g. mailchimp_id"),
18956
+ label: external_exports.string().optional().describe("Name shown in the dashboard (defaults to the key)"),
18957
+ type: external_exports.enum(VARIABLE_TYPES).optional().describe("text (default) or number. Cannot change once the field exists."),
18958
+ example: external_exports.union([external_exports.string(), external_exports.number()]).optional().describe("Sample value shown in the link")
18959
+ })
18960
+ ).max(VARIABLE_MAX_LINK_PER_FORM).describe("The complete list of link fields for this form")
18961
+ }),
18962
+ outputSchema: external_exports.object({
18963
+ form_id: external_exports.string(),
18964
+ link: external_exports.string().optional().describe("Your link: the form link with every link field on it. Not viewable until the form is published (see live)."),
18965
+ live: external_exports.boolean().optional().describe("Whether the form is published, i.e. the link works for respondents now"),
18966
+ fields: external_exports.array(
18967
+ external_exports.object({
18968
+ key: external_exports.string(),
18969
+ type: external_exports.string(),
18970
+ in: external_exports.enum(["query", "hash"]).describe("hash for a personal key (after #), else query (after ?)"),
18971
+ paste: PasteSchema.optional().describe("Present when the key is a known tool's merge tag")
18972
+ })
18973
+ ),
18974
+ switched_off: external_exports.array(external_exports.string()).describe("Link fields that were on and are now off (kept, not deleted)"),
18975
+ changed: external_exports.boolean().describe("False when the list already matched and nothing was written")
18976
+ }),
18977
+ annotations: {
18978
+ readOnlyHint: false,
18979
+ destructiveHint: false,
18980
+ idempotentHint: true,
18981
+ openWorldHint: false
18982
+ }
18983
+ },
18984
+ async ({ form_id, fields }) => {
18985
+ const input = fields;
18986
+ const seen = /* @__PURE__ */ new Set();
18987
+ for (const f of input) {
18988
+ const keyError = validateVariableKey(f.key);
18989
+ if (keyError) return refusedResult(`${f.key}: ${keyError}`);
18990
+ if (seen.has(f.key)) return refusedResult(`${f.key} is listed twice.`);
18991
+ seen.add(f.key);
18992
+ if (f.label !== void 0 && (f.label.trim().length === 0 || f.label.length > VARIABLE_LABEL_MAX_LENGTH)) {
18993
+ return refusedResult(`${f.key}: label must be 1 to ${VARIABLE_LABEL_MAX_LENGTH} characters.`);
18994
+ }
18995
+ }
18996
+ if (input.length > VARIABLE_MAX_LINK_PER_FORM) {
18997
+ return refusedResult(`A form can fill ${VARIABLE_MAX_LINK_PER_FORM} link fields at most (got ${input.length}).`);
18998
+ }
18999
+ const listed = await callApi(`/forms/${form_id}/variables`);
19000
+ if (!listed.ok) return apiErrorResult(listed);
19001
+ const existing = listed.data?.variables ?? [];
19002
+ const byKey = new Map(existing.map((v) => [v.key, v]));
19003
+ const score = findScoreVariable(existing);
19004
+ const plans = [];
19005
+ let newCustom = 0;
19006
+ for (const f of input) {
19007
+ const row = byKey.get(f.key);
19008
+ if (!row) {
19009
+ const type = f.type ?? "text";
19010
+ if (f.example !== void 0 && normExample(type, f.example) === void 0) {
19011
+ return refusedResult(`${f.key}: example must be ${type === "number" ? "a number" : "text of 500 characters or fewer"}.`);
19012
+ }
19013
+ newCustom++;
19014
+ plans.push({ op: "create", field: f, type });
19015
+ continue;
19016
+ }
19017
+ if (row.kind !== "custom" || score && row.id === score.id) {
19018
+ return refusedResult(`${f.key} is a built-in or Score variable, not a link field. Pick another key.`);
19019
+ }
19020
+ if (f.type !== void 0 && f.type !== row.type) {
19021
+ return refusedResult(`${f.key} already exists as ${row.type} and a field's type cannot change. Use another key, or delete it in the dashboard first.`);
19022
+ }
19023
+ const wantExample = f.example === void 0 ? void 0 : normExample(row.type, f.example);
19024
+ if (f.example !== void 0 && wantExample === void 0) {
19025
+ return refusedResult(`${f.key}: example must be ${row.type === "number" ? "a number" : "text of 500 characters or fewer"}.`);
19026
+ }
19027
+ const body = {};
19028
+ if (row.url_settable !== true) body.url_settable = true;
19029
+ if (f.label !== void 0 && f.label.trim() !== row.label) body.label = f.label.trim();
19030
+ if (wantExample !== void 0 && wantExample !== (normExample(row.type, row.example) ?? null)) body.example = wantExample;
19031
+ if (Object.keys(body).length > 0) plans.push({ op: "patch", field: f, row, body });
19032
+ }
19033
+ const customCount = existing.filter((v) => v.kind === "custom").length;
19034
+ if (customCount + newCustom > VARIABLE_MAX_CUSTOM_PER_FORM) {
19035
+ return refusedResult(`A form can have ${VARIABLE_MAX_CUSTOM_PER_FORM} custom variables at most; this would make ${customCount + newCustom}.`);
19036
+ }
19037
+ const switchOff = existing.filter(
19038
+ (v) => v.kind === "custom" && v.url_settable === true && !seen.has(v.key) && !(score && v.id === score.id)
19039
+ );
19040
+ const applied = [];
19041
+ const failed = [];
19042
+ const failedStatuses = [];
19043
+ const switchedOff = [];
19044
+ const finalRows = new Map(existing.map((v) => [v.key, { ...v }]));
19045
+ const unavailable = () => applied.length === 0 && failed.length === 0 ? refusedResult(NOT_AVAILABLE) : null;
19046
+ for (const row of switchOff) {
19047
+ const res = await callApi(`/forms/${form_id}/variables/${row.id}`, { method: "PATCH", body: { url_settable: false } });
19048
+ if (res.ok) {
19049
+ switchedOff.push(row.key);
19050
+ applied.push(`switched off ${row.key}`);
19051
+ finalRows.get(row.key).url_settable = false;
19052
+ } else if (res.status === 404 && unavailable()) {
19053
+ return refusedResult(NOT_AVAILABLE);
19054
+ } else {
19055
+ failed.push(`switch off ${row.key}: ${res.error}`);
19056
+ failedStatuses.push(res);
19057
+ }
19058
+ }
19059
+ for (const plan of plans) {
19060
+ const key = plan.field.key;
19061
+ const res = plan.op === "create" ? await callApi(`/forms/${form_id}/variables`, {
19062
+ method: "POST",
19063
+ body: {
19064
+ key,
19065
+ label: plan.field.label?.trim() ?? key,
19066
+ type: plan.type,
19067
+ url_settable: true,
19068
+ ...plan.field.example !== void 0 && normExample(plan.type, plan.field.example) !== null ? { example: normExample(plan.type, plan.field.example) } : {}
19069
+ }
19070
+ }) : await callApi(`/forms/${form_id}/variables/${plan.row.id}`, { method: "PATCH", body: plan.body });
19071
+ if (res.ok) {
19072
+ applied.push(`${plan.op === "create" ? "added" : "updated"} ${key}`);
19073
+ const returned = res.data?.variable;
19074
+ finalRows.set(key, returned ?? { ...finalRows.get(key) ?? { id: "", key, type: plan.op === "create" ? plan.type : plan.row.type, kind: "custom" }, url_settable: true });
19075
+ } else if (res.status === 404 && unavailable()) {
19076
+ return refusedResult(NOT_AVAILABLE);
19077
+ } else {
19078
+ failed.push(`${key}: ${res.error}`);
19079
+ failedStatuses.push(res);
19080
+ }
19081
+ }
19082
+ if (failed.length > 0) {
19083
+ const allRefused = failedStatuses.every((f) => isRefusedStatus(f.status, f.code));
19084
+ return (allRefused ? refusedResult : errorResult)(
19085
+ `Some link fields were not saved. Done: ${applied.length ? applied.join(", ") : "nothing"}. Failed: ${failed.join("; ")}. Call clipform_set_link_fields again with the same list to finish - it only retries what is missing.`
19086
+ );
19087
+ }
19088
+ const live = input.map((f) => finalRows.get(f.key)).filter((v) => !!v);
19089
+ const formResult = await callApi(`/forms/${form_id}`, { params: { include: "logic" } });
19090
+ const formData = formResult.ok ? formResult.data : void 0;
19091
+ const shareUrl = formData?.urls?.viewer ?? (formData?.share_id ? viewerUrl(formData.share_id) : void 0);
19092
+ const isLive = formData?.is_live === true;
19093
+ const link = shareUrl ? buildVariableLink(shareUrl, live, (v) => v.example) : void 0;
19094
+ const outFields = live.map((v) => {
19095
+ const paste = pasteFor(v.key);
19096
+ return {
19097
+ key: v.key,
19098
+ type: v.type,
19099
+ in: isPersonalLinkKey(v.key) ? "hash" : "query",
19100
+ ...paste ? { paste } : {}
19101
+ };
19102
+ });
19103
+ const changed = applied.length > 0;
19104
+ const lines = [
19105
+ changed ? `Link fields saved on form ${form_id}.` : `Link fields already match - nothing changed on form ${form_id}.`
19106
+ ];
19107
+ if (outFields.length === 0) lines.push("No link fields are on. The form link carries no values.");
19108
+ for (const f of outFields) {
19109
+ lines.push(`- ${f.key} (${f.type}, after ${f.in === "hash" ? "#" : "?"} in the link)${f.paste ? ` - ${f.paste.tool}: ${f.paste.snippet ?? f.paste.note}` : ""}`);
19110
+ }
19111
+ if (switchedOff.length > 0) lines.push(`Switched off (kept, not deleted): ${switchedOff.join(", ")}.`);
19112
+ if (link && outFields.length > 0) {
19113
+ lines.push(
19114
+ "",
19115
+ isLive ? `Your link: ${link}` : `Your link (FUTURE LIVE URL - not viewable yet, the form is a draft; it starts working once you publish with clipform_update_form is_live: true): ${link}`
19116
+ );
19117
+ lines.push("Replace each empty or sample value with the tool's own merge tag for the subscriber id.");
19118
+ } else if (outFields.length > 0) {
19119
+ lines.push("", "The form link could not be read just now. Call clipform_get_form to get the form's link, then add each field after ? (or # for a personal key).");
19120
+ }
19121
+ if (outFields.some((f) => f.in === "hash")) {
19122
+ lines.push("A personal key (email, phone, name) goes after # so it stays out of server logs. Prefer an opaque id over an email where the tool offers one.");
19123
+ } else if (outFields.length > 0) {
19124
+ lines.push("Use an opaque id (the tool's subscriber id), not an email address.");
19125
+ }
19126
+ return structuredResult(lines.join("\n"), {
19127
+ form_id,
19128
+ ...link && outFields.length > 0 ? { link, live: isLive } : {},
19129
+ fields: outFields,
19130
+ switched_off: switchedOff,
19131
+ changed
19132
+ });
19133
+ }
19134
+ );
19135
+ }
19136
+
18888
19137
  // src/tools/log-generation.ts
18889
19138
  function registerLogGenerationTool(server) {
18890
19139
  server.registerTool(
@@ -20585,11 +20834,11 @@ function createServer(options) {
20585
20834
  registerImportFormTool(server);
20586
20835
  registerListFormsTool(server, caps);
20587
20836
  registerWhoamiTool(server);
20588
- registerGetFormTool(server);
20837
+ registerGetFormTool(server, { variables: options?.variables === true });
20589
20838
  registerUpdateFormTool(server);
20590
20839
  registerDeleteFormTool(server);
20591
20840
  registerGetResultsTool(server);
20592
- registerGetResponsesTool(server);
20841
+ registerGetResponsesTool(server, { variables: options?.variables === true });
20593
20842
  registerAddNodeTool(server);
20594
20843
  registerUpdateNodeTool(server);
20595
20844
  registerDeleteNodeTool(server);
@@ -20599,6 +20848,7 @@ function createServer(options) {
20599
20848
  registerGetNodeMediaTool(server);
20600
20849
  registerDeleteNodeMediaTool(server);
20601
20850
  registerSetNodeLogicTool(server);
20851
+ if (options?.variables === true) registerSetLinkFieldsTool(server);
20602
20852
  registerLogGenerationTool(server);
20603
20853
  registerSearchNewsTool(server);
20604
20854
  registerGenerateTtsTool(server);
@@ -20685,4 +20935,4 @@ export {
20685
20935
  * MIT Licensed
20686
20936
  *)
20687
20937
  */
20688
- //# sourceMappingURL=chunk-DADRGNH7.js.map
20938
+ //# sourceMappingURL=chunk-73UYEWQP.js.map