@clipform/mcp-server 5.4.0 → 5.4.1
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 +1 -1
- package/dist/api-client.js +1 -1
- package/dist/{chunk-MQTISSLP.js → chunk-3YKZSC7H.js} +110 -21
- package/dist/{chunk-MQTISSLP.js.map → chunk-3YKZSC7H.js.map} +1 -1
- package/dist/{chunk-M6AWVKPK.js → chunk-HOKPAJLX.js} +3 -3
- package/dist/{chunk-42DEGWIU.js → chunk-IWMRSNMO.js} +16 -1
- package/dist/chunk-IWMRSNMO.js.map +1 -0
- package/dist/{chunk-6HTNG4QA.js → chunk-NWOLQJ3Z.js} +2 -2
- package/dist/{chunk-C2NKMZ4Q.js → chunk-QZZFZGY6.js} +3 -3
- package/dist/index.js +5 -5
- package/dist/prompts.js +3 -3
- package/dist/resources.js +3 -3
- package/dist/server.js +5 -5
- package/package.json +1 -1
- package/server.json +2 -2
- package/dist/chunk-42DEGWIU.js.map +0 -1
- /package/dist/{chunk-M6AWVKPK.js.map → chunk-HOKPAJLX.js.map} +0 -0
- /package/dist/{chunk-6HTNG4QA.js.map → chunk-NWOLQJ3Z.js.map} +0 -0
- /package/dist/{chunk-C2NKMZ4Q.js.map → chunk-QZZFZGY6.js.map} +0 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Your MCP client lists these automatically on connect (via `tools/list`). Full re
|
|
|
76
76
|
| `clipform_attach_node_media` | Attach an existing workspace media asset (from clipform_upload_media_asset) to one or more nodes (max 10). |
|
|
77
77
|
| `clipform_get_node_media` | Get the media attached to a node, including processing status. |
|
|
78
78
|
| `clipform_delete_node_media` | Remove media from a node by unlinking it; the media asset and its files stay in the workspace library and keep working on any other node or live form that uses them. |
|
|
79
|
-
| `clipform_set_logic` | Set
|
|
79
|
+
| `clipform_set_logic` | Set where one or more nodes go next. |
|
|
80
80
|
| `clipform_log_generation` | Internal audit step run by a form-generation workflow. |
|
|
81
81
|
| `clipform_search_news` | Search recent news articles from NewsAPI and The Guardian and return them as structured results. |
|
|
82
82
|
| `clipform_generate_tts` | Generate narration audio from text with word-level captions for one question in a Clipform form (max 400 characters). |
|
package/dist/api-client.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
union,
|
|
32
32
|
unknown,
|
|
33
33
|
url
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-HOKPAJLX.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-
|
|
43
|
+
} from "./chunk-QZZFZGY6.js";
|
|
44
44
|
import {
|
|
45
45
|
ANON_PREVIEW_LINK_LABEL,
|
|
46
46
|
ANON_PREVIEW_NOTICE,
|
|
@@ -54,16 +54,18 @@ import {
|
|
|
54
54
|
isPreviewViewerUrl,
|
|
55
55
|
previewOnlyNotice,
|
|
56
56
|
withAdoptedNotice
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-NWOLQJ3Z.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
|
+
CHOICE_MAX_OPTIONS,
|
|
63
64
|
CONTACT_FIELDS,
|
|
64
65
|
FEATURE_FLAGS,
|
|
65
66
|
FORM_TYPES_LIST,
|
|
66
67
|
FORM_TYPE_ALIASES,
|
|
68
|
+
LOGIC_TARGET_TYPES,
|
|
67
69
|
MAX_CLIP_SECONDS,
|
|
68
70
|
MAX_NARRATION_CHARS,
|
|
69
71
|
MCP_TOOL_SECURITY,
|
|
@@ -82,6 +84,10 @@ import {
|
|
|
82
84
|
gatedEnumValues,
|
|
83
85
|
isAnonMcpLockedNode,
|
|
84
86
|
isAnonymousAccountRequired,
|
|
87
|
+
isInactiveOptionEdge,
|
|
88
|
+
isNodeLevelAction,
|
|
89
|
+
isOptionEdge,
|
|
90
|
+
isTerminalType,
|
|
85
91
|
lettersCapError,
|
|
86
92
|
normalizeContactFields,
|
|
87
93
|
recallDisplayText,
|
|
@@ -89,7 +95,7 @@ import {
|
|
|
89
95
|
stripGatedConfigKeys,
|
|
90
96
|
structuredResult,
|
|
91
97
|
textResult
|
|
92
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-IWMRSNMO.js";
|
|
93
99
|
import {
|
|
94
100
|
getMcpAuth,
|
|
95
101
|
runWithMcpAuth,
|
|
@@ -17123,6 +17129,19 @@ function projectNext(node, logicByNode) {
|
|
|
17123
17129
|
const target = defaultTarget(logicByNode.get(node.id));
|
|
17124
17130
|
return target ? { target_id: target.value, target_type: target.type } : void 0;
|
|
17125
17131
|
}
|
|
17132
|
+
function projectAnswerRoutes(node, logicByNode) {
|
|
17133
|
+
const options = node.node_options ?? node.options ?? [];
|
|
17134
|
+
const targetByOption = /* @__PURE__ */ new Map();
|
|
17135
|
+
for (const action of logicByNode.get(node.id) ?? []) {
|
|
17136
|
+
if (!isOptionEdge(action) || isInactiveOptionEdge(node, action) || !action.details?.to) continue;
|
|
17137
|
+
const optionId = action.option_id ?? action.condition.vars.find((v) => v.type === "option")?.value;
|
|
17138
|
+
if (optionId && !targetByOption.has(optionId)) targetByOption.set(optionId, action.details.to);
|
|
17139
|
+
}
|
|
17140
|
+
return options.flatMap((o) => {
|
|
17141
|
+
const to = targetByOption.get(o.id);
|
|
17142
|
+
return to ? [{ option_id: o.id, option_content: o.content, target_id: to.value, target_type: to.type }] : [];
|
|
17143
|
+
});
|
|
17144
|
+
}
|
|
17126
17145
|
function projectFormState(data) {
|
|
17127
17146
|
const { nodes, logicByNode } = orderNodesWithLogic(data);
|
|
17128
17147
|
const urls = projectUrls(data);
|
|
@@ -17193,21 +17212,32 @@ function formatFormState(data) {
|
|
|
17193
17212
|
` Options: ${options.map((o) => o.id ? `${o.content} (id: ${o.id})` : o.content).join(", ")}`
|
|
17194
17213
|
);
|
|
17195
17214
|
}
|
|
17215
|
+
const routes = projectAnswerRoutes(q, logicByNode);
|
|
17196
17216
|
const next = projectNext(q, logicByNode);
|
|
17197
|
-
if (
|
|
17198
|
-
lines.push(` -> next: ${next.target_id} (${next.target_type})`);
|
|
17217
|
+
if (routes.length === 0) {
|
|
17218
|
+
if (next) lines.push(` -> next: ${next.target_id} (${next.target_type})`);
|
|
17219
|
+
} else {
|
|
17220
|
+
const fallback = (logicByNode.get(q.id) ?? []).find((a) => isNodeLevelAction(a, q.id))?.details?.to;
|
|
17221
|
+
lines.push(` Routes by answer:`);
|
|
17222
|
+
for (const o of options ?? []) {
|
|
17223
|
+
const r = routes.find((route) => route.option_id === o.id);
|
|
17224
|
+
if (r) lines.push(` "${r.option_content}" -> ${r.target_id} (${r.target_type})`);
|
|
17225
|
+
else if (fallback) lines.push(` "${o.content}" -> ${fallback.value} (${fallback.type}, default route)`);
|
|
17226
|
+
else lines.push(` "${o.content}" -> NO ROUTE (add a rule for this answer or a default rule, or publishing fails)`);
|
|
17227
|
+
}
|
|
17199
17228
|
}
|
|
17200
17229
|
}
|
|
17201
17230
|
return lines.join("\n");
|
|
17202
17231
|
}
|
|
17203
17232
|
|
|
17204
17233
|
// src/tools/get-form.ts
|
|
17234
|
+
var TargetTypeSchema = external_exports.enum(LOGIC_TARGET_TYPES);
|
|
17205
17235
|
function registerGetFormTool(server) {
|
|
17206
17236
|
server.registerTool(
|
|
17207
17237
|
"clipform_get_form",
|
|
17208
17238
|
{
|
|
17209
17239
|
title: "Get Clipform",
|
|
17210
|
-
description: `Retrieve a form's details including all nodes in sequential order and their routing. Returns title, settings, and every node with its options, config, media status, and
|
|
17240
|
+
description: `Retrieve a form's details including all nodes in sequential order and their routing. Returns title, settings, and every node with its options, config, media status, next node, and - for a node that routes by answer - each answer's route (all set with clipform_set_logic).`,
|
|
17211
17241
|
inputSchema: external_exports.object({
|
|
17212
17242
|
form_id: external_exports.string().uuid().describe("The form UUID (returned by clipform_create_form, not the short share_id from the URL)")
|
|
17213
17243
|
}),
|
|
@@ -17236,8 +17266,20 @@ function registerGetFormTool(server) {
|
|
|
17236
17266
|
options: external_exports.array(external_exports.object({ id: external_exports.string(), content: external_exports.string() })).optional(),
|
|
17237
17267
|
next: external_exports.object({
|
|
17238
17268
|
target_id: external_exports.string().describe("The node/screen ID this node routes to"),
|
|
17239
|
-
target_type:
|
|
17240
|
-
}).optional().describe("This node's outgoing edge, set via clipform_set_logic. Omitted for a chain tail or terminal node.")
|
|
17269
|
+
target_type: TargetTypeSchema.describe("What kind of target target_id is")
|
|
17270
|
+
}).optional().describe("This node's outgoing edge, set via clipform_set_logic. Omitted for a chain tail or terminal node."),
|
|
17271
|
+
// Declared ahead of emission (#4839): the ChatGPT-approved schema is
|
|
17272
|
+
// additionalProperties:false, so routes stay text-only until a Rescan
|
|
17273
|
+
// approves this field (#4845, SUBMISSION.md). Then emit it from
|
|
17274
|
+
// projectFormState.
|
|
17275
|
+
routes: external_exports.array(
|
|
17276
|
+
external_exports.object({
|
|
17277
|
+
option_id: external_exports.string(),
|
|
17278
|
+
option_content: external_exports.string().describe("The answer's text"),
|
|
17279
|
+
target_id: external_exports.string().describe("The node/screen ID this answer routes to"),
|
|
17280
|
+
target_type: TargetTypeSchema
|
|
17281
|
+
})
|
|
17282
|
+
).optional().describe("Each answer's own route, for a node that routes by answer")
|
|
17241
17283
|
})
|
|
17242
17284
|
).describe("Nodes in sequential order - IDs for update_node / attach_node_media")
|
|
17243
17285
|
}),
|
|
@@ -17962,12 +18004,15 @@ function registerAddNodeTool(server) {
|
|
|
17962
18004
|
"clipform_add_node",
|
|
17963
18005
|
{
|
|
17964
18006
|
title: "Add Node",
|
|
17965
|
-
description: `Add a new node to an existing form. Inserted before the end screen by default; after_node_id controls insertion position. Inserting into a linear flow automatically re-links the chain (the node before the insertion point points to the new node, which points to what followed) - you do not need clipform_set_logic for a simple insert.
|
|
18007
|
+
description: `Add a new node to an existing form. Inserted before the end screen by default; after_node_id controls insertion position. Inserting into a linear flow automatically re-links the chain (the node before the insertion point points to the new node, which points to what followed) - you do not need clipform_set_logic for a simple insert. For a second ending that only some answers reach (an end screen or redirect), pass unlinked: true and then route to it with clipform_set_logic. Node types and config schemas match clipform_create_form.`,
|
|
17966
18008
|
inputSchema: external_exports.object({
|
|
17967
18009
|
form_id: external_exports.string().uuid().describe("The form UUID (returned by clipform_create_form, not the short share_id from the URL)"),
|
|
17968
18010
|
node: NodeSchema.describe("The node to add"),
|
|
17969
18011
|
after_node_id: external_exports.string().optional().describe(
|
|
17970
|
-
"Insert after this node ID. Omit to append before the end screen."
|
|
18012
|
+
"Insert after this node ID. Omit to append before the end screen. Not used with unlinked."
|
|
18013
|
+
),
|
|
18014
|
+
unlinked: external_exports.boolean().optional().describe(
|
|
18015
|
+
"Create an ending (end_screen or redirect) outside the flow, so nothing routes to it until you point an answer at it with clipform_set_logic. Only for ending types: a question added this way would sit outside the flow."
|
|
17971
18016
|
)
|
|
17972
18017
|
}),
|
|
17973
18018
|
outputSchema: external_exports.object({
|
|
@@ -17981,11 +18026,20 @@ function registerAddNodeTool(server) {
|
|
|
17981
18026
|
openWorldHint: false
|
|
17982
18027
|
}
|
|
17983
18028
|
},
|
|
17984
|
-
async ({ form_id, node, after_node_id }) => {
|
|
18029
|
+
async ({ form_id, node, after_node_id, unlinked }) => {
|
|
18030
|
+
if (unlinked && after_node_id) {
|
|
18031
|
+
return errorResult("Pass either after_node_id (insert into the flow) or unlinked: true (outside the flow), not both.");
|
|
18032
|
+
}
|
|
18033
|
+
if (unlinked && !isTerminalType(node.type)) {
|
|
18034
|
+
return errorResult(
|
|
18035
|
+
`unlinked is only for an ending (end_screen or redirect), not ${node.type}. To give one answer its own question, insert it into the flow with after_node_id, then route answers with clipform_set_logic.`
|
|
18036
|
+
);
|
|
18037
|
+
}
|
|
17985
18038
|
applyNodeDefaults(node);
|
|
17986
18039
|
const droppedKeys = stripGatedNodeConfig(node);
|
|
17987
18040
|
const body = { node };
|
|
17988
18041
|
if (after_node_id) body.after_node_id = after_node_id;
|
|
18042
|
+
if (unlinked) body.auto_arrange = false;
|
|
17989
18043
|
const result = await callApi(`/forms/${form_id}/nodes`, {
|
|
17990
18044
|
method: "POST",
|
|
17991
18045
|
body
|
|
@@ -17995,7 +18049,7 @@ function registerAddNodeTool(server) {
|
|
|
17995
18049
|
}
|
|
17996
18050
|
const nodeId = result.data.node_id;
|
|
17997
18051
|
const warnings = result.data.warnings ?? [];
|
|
17998
|
-
const relinkNote = warnings.length > 0 ? ` ${warnings.join(" ")}` : " The logic chain was automatically re-linked - no clipform_set_logic call is needed for this insert.";
|
|
18052
|
+
const relinkNote = unlinked ? " It is not linked into the flow: route an answer to it with clipform_set_logic (option_content)." : warnings.length > 0 ? ` ${warnings.join(" ")}` : " The logic chain was automatically re-linked - no clipform_set_logic call is needed for this insert.";
|
|
17999
18053
|
return structuredResult(
|
|
18000
18054
|
`Node added. ID: ${nodeId} | Type: ${node.type}.${relinkNote}${droppedKeys.length > 0 ? ` ${ignoredConfigNote(droppedKeys)}` : ""}`,
|
|
18001
18055
|
{ node_id: nodeId, type: node.type }
|
|
@@ -18647,25 +18701,51 @@ function registerDeleteNodeMediaTool(server) {
|
|
|
18647
18701
|
|
|
18648
18702
|
// src/tools/set-node-logic.ts
|
|
18649
18703
|
var LogicRuleSchema = external_exports.object({
|
|
18650
|
-
target_node_id: external_exports.string().describe("The node ID this node
|
|
18704
|
+
target_node_id: external_exports.string().describe("The node ID this route goes to: any other node, including an end screen"),
|
|
18705
|
+
option_content: external_exports.string().optional().describe(
|
|
18706
|
+
"Route only this answer: the option's text exactly as clipform_get_form lists it, without the (id: ...) suffix. Omit for the node's default route, which covers every current answer without a rule of its own."
|
|
18707
|
+
)
|
|
18651
18708
|
});
|
|
18652
18709
|
var NodeLogicSchema = external_exports.object({
|
|
18653
18710
|
node_id: external_exports.string().describe("The node ID to set routing on"),
|
|
18654
|
-
rules: external_exports.array(LogicRuleSchema).min(1).max(1).describe(
|
|
18711
|
+
rules: external_exports.array(LogicRuleSchema).min(1).max(CHOICE_MAX_OPTIONS + 1).describe(
|
|
18712
|
+
"One rule without option_content for a single next node, or one rule per answer (option_content) plus an optional default rule"
|
|
18713
|
+
)
|
|
18655
18714
|
});
|
|
18715
|
+
function ruleSetError(rules) {
|
|
18716
|
+
const defaults = rules.filter((r) => !r.option_content).length;
|
|
18717
|
+
if (defaults > 1) return "more than one rule without option_content - give one default route at most";
|
|
18718
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18719
|
+
for (const r of rules) {
|
|
18720
|
+
if (!r.option_content) continue;
|
|
18721
|
+
if (seen.has(r.option_content)) return `two rules for the answer "${r.option_content}" - give each answer one route`;
|
|
18722
|
+
seen.add(r.option_content);
|
|
18723
|
+
}
|
|
18724
|
+
return null;
|
|
18725
|
+
}
|
|
18656
18726
|
function registerSetNodeLogicTool(server) {
|
|
18657
18727
|
server.registerTool(
|
|
18658
18728
|
"clipform_set_logic",
|
|
18659
18729
|
{
|
|
18660
18730
|
title: "Set Node Logic",
|
|
18661
|
-
description: `Set
|
|
18731
|
+
description: `Set where one or more nodes go next. Pass multiple nodes in one call instead of separate tool calls.
|
|
18732
|
+
|
|
18733
|
+
- Linear: one rule with only target_node_id (A to B to C).
|
|
18734
|
+
- By answer: on a single-select choice node with branching on, give one rule per answer with option_content set to the option's text, plus an optional default rule without option_content. Every answer needs a route: one with no rule of its own and no default has nowhere to go, and publishing fails. Different answers can go to different nodes or end screens. A multi-select choice has one route out, so answer rules are refused there.
|
|
18662
18735
|
|
|
18663
|
-
|
|
18736
|
+
Turning branching on: set config.choice.enable_branching: true in clipform_create_form, or with clipform_update_node. update_node replaces the whole choice object, so send the node's full current choice config from clipform_get_form with enable_branching added - a choice object with only enable_branching drops quiz settings such as record_scores.
|
|
18737
|
+
|
|
18738
|
+
A second ending that only some answers reach is added with clipform_add_node and unlinked: true.
|
|
18739
|
+
|
|
18740
|
+
A call replaces that node's routing entirely - it does not merge with any prior target. A default rule covers the answers that exist now; an answer added later needs its own rule. clipform_get_form shows each answer's route afterwards, and flags any answer with no route.
|
|
18664
18741
|
|
|
18665
18742
|
Example:
|
|
18666
18743
|
nodes: [
|
|
18667
18744
|
{ node_id: "q1-id", rules: [{ target_node_id: "q2-id" }] },
|
|
18668
|
-
{ node_id: "
|
|
18745
|
+
{ node_id: "country-id", rules: [
|
|
18746
|
+
{ option_content: "United Kingdom", target_node_id: "video-id" },
|
|
18747
|
+
{ option_content: "Somewhere else", target_node_id: "sorry-end-id" }
|
|
18748
|
+
] }
|
|
18669
18749
|
]`,
|
|
18670
18750
|
inputSchema: external_exports.object({
|
|
18671
18751
|
form_id: external_exports.string().uuid().describe("The form UUID (returned by clipform_create_form, not the short share_id from the URL)"),
|
|
@@ -18694,6 +18774,12 @@ Example:
|
|
|
18694
18774
|
const allLines = [];
|
|
18695
18775
|
const results = [];
|
|
18696
18776
|
for (const { node_id, rules } of nodes) {
|
|
18777
|
+
const invalid = ruleSetError(rules);
|
|
18778
|
+
if (invalid) {
|
|
18779
|
+
allLines.push(`Node ${node_id}: FAILED - ${invalid}`);
|
|
18780
|
+
results.push({ node_id, ok: false, error: invalid });
|
|
18781
|
+
continue;
|
|
18782
|
+
}
|
|
18697
18783
|
const result = await callApi(
|
|
18698
18784
|
`/forms/${form_id}/nodes/${node_id}/logic/rules`,
|
|
18699
18785
|
{
|
|
@@ -18710,10 +18796,13 @@ Example:
|
|
|
18710
18796
|
allLines.push(`Node ${node_id}: logic set (${rulesCount} rules)`);
|
|
18711
18797
|
results.push({ node_id, ok: true, rules_count: rulesCount });
|
|
18712
18798
|
}
|
|
18713
|
-
|
|
18799
|
+
const routedByAnswer = nodes.some(
|
|
18800
|
+
(n, i) => results[i]?.ok && n.rules.some((r) => r.option_content)
|
|
18801
|
+
);
|
|
18802
|
+
if (routedByAnswer) {
|
|
18714
18803
|
allLines.push(
|
|
18715
18804
|
`
|
|
18716
|
-
|
|
18805
|
+
Routes by answer are set. Call clipform_get_form to check each answer's route; it also says whether a live form needs republishing.`
|
|
18717
18806
|
);
|
|
18718
18807
|
}
|
|
18719
18808
|
return structuredResult(allLines.join("\n"), { results });
|
|
@@ -20521,4 +20610,4 @@ export {
|
|
|
20521
20610
|
* MIT Licensed
|
|
20522
20611
|
*)
|
|
20523
20612
|
*/
|
|
20524
|
-
//# sourceMappingURL=chunk-
|
|
20613
|
+
//# sourceMappingURL=chunk-3YKZSC7H.js.map
|