@clipform/mcp-server 5.7.1 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client.d.ts +34 -1
- package/dist/api-client.js +8 -1
- package/dist/{chunk-7UIXBPTS.js → chunk-5AODH5TC.js} +3 -3
- package/dist/{chunk-D65NJDP5.js → chunk-7PJHCRSD.js} +58 -1
- package/dist/chunk-7PJHCRSD.js.map +1 -0
- package/dist/{chunk-7F36T6AQ.js → chunk-EQPYULVM.js} +79 -59
- package/dist/{chunk-7F36T6AQ.js.map → chunk-EQPYULVM.js.map} +1 -1
- package/dist/{chunk-7M2APEB6.js → chunk-HHRUYPFP.js} +2 -2
- package/dist/chunk-XO7XBMRY.js +15 -0
- package/dist/chunk-XO7XBMRY.js.map +1 -0
- package/dist/{chunk-S4S6H7GF.js → chunk-YFOTTAGR.js} +3 -3
- package/dist/{chunk-S4S6H7GF.js.map → chunk-YFOTTAGR.js.map} +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/instrument.js +9 -0
- package/dist/instrument.js.map +1 -1
- package/dist/prompts.js +4 -3
- package/dist/resources.js +4 -3
- package/dist/server.js +6 -5
- package/package.json +1 -1
- package/server.json +2 -2
- package/dist/chunk-D65NJDP5.js.map +0 -1
- /package/dist/{chunk-7UIXBPTS.js.map → chunk-5AODH5TC.js.map} +0 -0
- /package/dist/{chunk-7M2APEB6.js.map → chunk-HHRUYPFP.js.map} +0 -0
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
union,
|
|
32
32
|
unknown,
|
|
33
33
|
url
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-YFOTTAGR.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-5AODH5TC.js";
|
|
44
44
|
import {
|
|
45
45
|
ANON_PREVIEW_LINK_LABEL,
|
|
46
46
|
ANON_PREVIEW_NOTICE,
|
|
@@ -54,13 +54,14 @@ import {
|
|
|
54
54
|
isPreviewViewerUrl,
|
|
55
55
|
previewOnlyNotice,
|
|
56
56
|
withAdoptedNotice
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-HHRUYPFP.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
|
+
CONSENT_TYPES,
|
|
64
65
|
CONTACT_FIELDS,
|
|
65
66
|
FEATURE_FLAGS,
|
|
66
67
|
FORM_TYPES_LIST,
|
|
@@ -74,9 +75,11 @@ import {
|
|
|
74
75
|
NODE_TYPES,
|
|
75
76
|
NON_COUNTABLE_TYPES,
|
|
76
77
|
PII_NODE_TYPES,
|
|
78
|
+
apiErrorResult,
|
|
77
79
|
authChallengeMeta,
|
|
78
80
|
bfsOrder,
|
|
79
81
|
callApi,
|
|
82
|
+
consentItemNotes,
|
|
80
83
|
contactFieldNotes,
|
|
81
84
|
defaultTarget,
|
|
82
85
|
errorResult,
|
|
@@ -89,13 +92,15 @@ import {
|
|
|
89
92
|
isOptionEdge,
|
|
90
93
|
isTerminalType,
|
|
91
94
|
lettersCapError,
|
|
95
|
+
normalizeConsentItems,
|
|
92
96
|
normalizeContactFields,
|
|
93
97
|
recallDisplayText,
|
|
98
|
+
refusedResult,
|
|
94
99
|
resolveFormType,
|
|
95
100
|
stripGatedConfigKeys,
|
|
96
101
|
structuredResult,
|
|
97
102
|
textResult
|
|
98
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-7PJHCRSD.js";
|
|
99
104
|
import {
|
|
100
105
|
getMcpAuth,
|
|
101
106
|
runWithMcpAuth,
|
|
@@ -16184,7 +16189,7 @@ function generateConfigSummary(configSchema, typeKey) {
|
|
|
16184
16189
|
}
|
|
16185
16190
|
}
|
|
16186
16191
|
if (typeKey === "details") {
|
|
16187
|
-
parts.push(`Available field IDs: ${CONTACT_FIELD_IDS.join(", ")}. Standard fields keep their names (no label needed); for other wording or a non-English form, add a custom field ({ id, is_custom: true, label, type })`);
|
|
16192
|
+
parts.push(`Available field IDs: ${CONTACT_FIELD_IDS.join(", ")}. Standard fields keep their names (no label needed); for other wording or a non-English form, add a custom field ({ id, is_custom: true, label, type }). consent_items[].type is "${CONSENT_TYPES[0]}" (required agreement) or "${CONSENT_TYPES[1]}" (optional)`);
|
|
16188
16193
|
}
|
|
16189
16194
|
return parts.length > 0 ? `Config: ${parts.join(", ")}` : "";
|
|
16190
16195
|
}
|
|
@@ -16374,7 +16379,7 @@ async function runWithWorkspaceTarget(args, run) {
|
|
|
16374
16379
|
const ctx = getMcpAuth();
|
|
16375
16380
|
const resolve = ctx?.resolveWorkspace;
|
|
16376
16381
|
if (!resolve) {
|
|
16377
|
-
if (workspaceId) return
|
|
16382
|
+
if (workspaceId) return refusedResult(PINNED_WORKSPACE_ERROR);
|
|
16378
16383
|
return run();
|
|
16379
16384
|
}
|
|
16380
16385
|
if (workspaceId && !formId && workspaceId === ctx.default_workspace_id) {
|
|
@@ -16541,7 +16546,7 @@ Example: A form that asks a question, collects contact info, then finishes:
|
|
|
16541
16546
|
const contentCount = nodes.filter((q) => !NON_COUNTABLE_TYPES.includes(q.type)).length;
|
|
16542
16547
|
if (planContext.node_limit !== null && contentCount > planContext.node_limit) {
|
|
16543
16548
|
const message = planContext.is_authenticated ? `Your '${planContext.workspace_name}' workspace is on the ${planContext.plan_name} plan, capped at ${planContext.node_limit} nodes per form. You asked for ${contentCount}. Rerun with ${planContext.node_limit} nodes or fewer.` : `Anonymous sessions are capped at ${planContext.node_limit} nodes per form (${planContext.plan_name} plan). You asked for ${contentCount}. Either rerun with ${planContext.node_limit} nodes, or sign in to your Clipform account so forms land in your workspace with your real plan limits.`;
|
|
16544
|
-
return
|
|
16549
|
+
return refusedResult(message);
|
|
16545
16550
|
}
|
|
16546
16551
|
let limitFormList = null;
|
|
16547
16552
|
if (planContext.form_limit !== null) {
|
|
@@ -16557,7 +16562,7 @@ Example: A form that asks a question, collects contact info, then finishes:
|
|
|
16557
16562
|
} else {
|
|
16558
16563
|
const options = planContext.is_authenticated ? ` - Delete one of the forms below to free a slot.` : ` - Delete one of the forms below to free a slot.
|
|
16559
16564
|
- Or sign in to a Clipform account to keep these forms and get higher limits.`;
|
|
16560
|
-
return
|
|
16565
|
+
return refusedResult(
|
|
16561
16566
|
[
|
|
16562
16567
|
`LIMIT REACHED - the form was NOT created. The plan's form limit is full.`,
|
|
16563
16568
|
``,
|
|
@@ -16581,6 +16586,11 @@ Example: A form that asks a question, collects contact info, then finishes:
|
|
|
16581
16586
|
q.config = { ...q.config, fields: result.fields };
|
|
16582
16587
|
for (const note of contactFieldNotes(result)) ignoredNotes.push(`[details] ${note}`);
|
|
16583
16588
|
}
|
|
16589
|
+
if (q.type === "details" && Array.isArray(q.config?.consent_items)) {
|
|
16590
|
+
const result = normalizeConsentItems(q.config.consent_items);
|
|
16591
|
+
q.config = { ...q.config, consent_items: result.items };
|
|
16592
|
+
for (const note of consentItemNotes(result)) ignoredNotes.push(`[details] ${note}`);
|
|
16593
|
+
}
|
|
16584
16594
|
}
|
|
16585
16595
|
const settings = {};
|
|
16586
16596
|
if (show_step_counter !== void 0) settings.show_step_counter = show_step_counter;
|
|
@@ -16621,7 +16631,7 @@ Example: A form that asks a question, collects contact info, then finishes:
|
|
|
16621
16631
|
].join("\n");
|
|
16622
16632
|
}
|
|
16623
16633
|
}
|
|
16624
|
-
return isAnonymousAccountRequired(createResult) ?
|
|
16634
|
+
return isAnonymousAccountRequired(createResult) ? refusedResult(message, authChallengeMeta("insufficient_scope", createResult.apiMessage ?? message)) : apiErrorResult(createResult, message);
|
|
16625
16635
|
}
|
|
16626
16636
|
const { data } = createResult;
|
|
16627
16637
|
const formId = data.form_id;
|
|
@@ -16878,12 +16888,10 @@ function detectImportPlatform(url2) {
|
|
|
16878
16888
|
return provider && IMPORTABLE_PROVIDERS.includes(provider) ? provider : null;
|
|
16879
16889
|
}
|
|
16880
16890
|
var SUPPORTED_LIST = "clipform_import_form only supports Google Forms (docs.google.com or forms.gle), Typeform (form.typeform.com/to/...), and Tally (tally.so) links.";
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
}
|
|
16885
|
-
const base = `Unsupported URL (${label}). ${SUPPORTED_LIST}`;
|
|
16886
|
-
return label === "VideoAsk" ? `${base} VideoAsk import is not available yet.` : base;
|
|
16891
|
+
var TYPEFORM_SHARE_LINK_MESSAGE = `Unsupported URL (Typeform, not a public share link). Use the form's public form.typeform.com/to/... link. ${SUPPORTED_LIST}`;
|
|
16892
|
+
function cannotImportMessage(label) {
|
|
16893
|
+
const what = label === "other" ? "Clipform can't import this link: it is not a Google Form, Typeform or Tally form." : label === "VideoAsk" ? "Clipform can't import VideoAsk forms yet." : `Clipform can't import ${label.endsWith(" Forms") ? label : `${label} forms`}.`;
|
|
16894
|
+
return `${what} Nothing was created. ${SUPPORTED_LIST} To rebuild this form in Clipform, use clipform_create_form with its questions.`;
|
|
16887
16895
|
}
|
|
16888
16896
|
function pluralQuestions(n) {
|
|
16889
16897
|
return `${n} question${n === 1 ? "" : "s"}`;
|
|
@@ -16928,7 +16936,18 @@ function registerImportFormTool(server) {
|
|
|
16928
16936
|
async ({ url: url2, is_live }) => {
|
|
16929
16937
|
const platform = detectImportPlatform(url2);
|
|
16930
16938
|
if (!platform) {
|
|
16931
|
-
|
|
16939
|
+
const label = detectFormToolLabel(url2);
|
|
16940
|
+
if (label === "Typeform") return refusedResult(TYPEFORM_SHARE_LINK_MESSAGE);
|
|
16941
|
+
const message = cannotImportMessage(label);
|
|
16942
|
+
return structuredResult(message, {
|
|
16943
|
+
form_id: null,
|
|
16944
|
+
viewer_url: null,
|
|
16945
|
+
is_live: false,
|
|
16946
|
+
preview_url: null,
|
|
16947
|
+
builder_url: null,
|
|
16948
|
+
live_refused_reason: null,
|
|
16949
|
+
import_summary: { title: "", total_questions: 0, imported: 0, skipped: 0, skipped_details: [], warnings: [message] }
|
|
16950
|
+
});
|
|
16932
16951
|
}
|
|
16933
16952
|
const meResult = await callApi("/me", { method: "GET" });
|
|
16934
16953
|
if (!meResult.ok) {
|
|
@@ -16945,7 +16964,7 @@ function registerImportFormTool(server) {
|
|
|
16945
16964
|
const body = { url: url2, workspace_id: workspaceId, ...is_live !== void 0 ? { is_live } : {} };
|
|
16946
16965
|
const importResult = platform === "google" ? await callApi("/forms/import/google", { method: "POST", body }) : platform === "typeform" ? await callApi("/forms/import/typeform", { method: "POST", body }) : await callApi("/forms/import/tally", { method: "POST", body });
|
|
16947
16966
|
if (!importResult.ok) {
|
|
16948
|
-
return errorResult(importResult.error);
|
|
16967
|
+
return importResult.status === 400 ? errorResult(importResult.error) : apiErrorResult(importResult);
|
|
16949
16968
|
}
|
|
16950
16969
|
const data = importResult.data;
|
|
16951
16970
|
const summary = data.import_summary;
|
|
@@ -17068,7 +17087,7 @@ function registerListFormsTool(server, caps = FULL_CAPS) {
|
|
|
17068
17087
|
if (order) params.order = order;
|
|
17069
17088
|
const result = await callApi("/forms", { params });
|
|
17070
17089
|
if (!result.ok) {
|
|
17071
|
-
return
|
|
17090
|
+
return apiErrorResult(result);
|
|
17072
17091
|
}
|
|
17073
17092
|
const data = result.data;
|
|
17074
17093
|
const structured = {
|
|
@@ -17348,7 +17367,7 @@ function registerGetFormTool(server) {
|
|
|
17348
17367
|
async ({ form_id }) => {
|
|
17349
17368
|
const result = await callApi(`/forms/${form_id}?include=logic`);
|
|
17350
17369
|
if (!result.ok) {
|
|
17351
|
-
return
|
|
17370
|
+
return apiErrorResult(result);
|
|
17352
17371
|
}
|
|
17353
17372
|
return structuredResult(formatFormState(result.data), projectFormState(result.data));
|
|
17354
17373
|
}
|
|
@@ -17422,20 +17441,21 @@ function registerUpdateFormTool(server) {
|
|
|
17422
17441
|
});
|
|
17423
17442
|
if (!result.ok) {
|
|
17424
17443
|
if (isAnonymousAccountRequired(result)) {
|
|
17425
|
-
return
|
|
17444
|
+
return refusedResult(
|
|
17426
17445
|
result.error,
|
|
17427
17446
|
authChallengeMeta("insufficient_scope", result.apiMessage ?? result.error)
|
|
17428
17447
|
);
|
|
17429
17448
|
}
|
|
17430
17449
|
if (is_live === true && isConnectorGuest() && (result.status === 403 || result.status === 503)) {
|
|
17431
17450
|
const others = Object.keys(body).some((k) => k !== "is_live");
|
|
17432
|
-
return
|
|
17451
|
+
return apiErrorResult(
|
|
17452
|
+
result,
|
|
17433
17453
|
`${result.error}
|
|
17434
17454
|
|
|
17435
17455
|
${others ? "The other changes in this call were saved to the draft, but the form was not republished." : "The form was not republished."}`
|
|
17436
17456
|
);
|
|
17437
17457
|
}
|
|
17438
|
-
return
|
|
17458
|
+
return apiErrorResult(result);
|
|
17439
17459
|
}
|
|
17440
17460
|
const returned = result.data?.alias;
|
|
17441
17461
|
if (typeof returned === "string" && returned) storedAlias = returned;
|
|
@@ -17446,10 +17466,10 @@ ${others ? "The other changes in this call were saved to the draft, but the form
|
|
|
17446
17466
|
body: { tags }
|
|
17447
17467
|
});
|
|
17448
17468
|
if (!tagResult.ok) {
|
|
17449
|
-
return isAnonymousAccountRequired(tagResult) ?
|
|
17469
|
+
return isAnonymousAccountRequired(tagResult) ? refusedResult(
|
|
17450
17470
|
tagResult.error,
|
|
17451
17471
|
authChallengeMeta("insufficient_scope", tagResult.apiMessage ?? tagResult.error)
|
|
17452
|
-
) :
|
|
17472
|
+
) : apiErrorResult(tagResult);
|
|
17453
17473
|
}
|
|
17454
17474
|
}
|
|
17455
17475
|
const updates = [];
|
|
@@ -17618,7 +17638,7 @@ function registerDeleteFormTool(server) {
|
|
|
17618
17638
|
method: "DELETE"
|
|
17619
17639
|
});
|
|
17620
17640
|
if (!result.ok) {
|
|
17621
|
-
return
|
|
17641
|
+
return apiErrorResult(result);
|
|
17622
17642
|
}
|
|
17623
17643
|
return textResult(`Form ${form_id} has been moved to the trash.`);
|
|
17624
17644
|
}
|
|
@@ -17761,7 +17781,7 @@ function registerGetResultsTool(server) {
|
|
|
17761
17781
|
async ({ form_id }) => {
|
|
17762
17782
|
const result = await callApi(`/forms/${form_id}/results`);
|
|
17763
17783
|
if (!result.ok) {
|
|
17764
|
-
return
|
|
17784
|
+
return apiErrorResult(result);
|
|
17765
17785
|
}
|
|
17766
17786
|
const data = result.data;
|
|
17767
17787
|
const nodes = (data.nodes || []).map(projectNode);
|
|
@@ -17865,7 +17885,7 @@ function registerGetResponsesTool(server) {
|
|
|
17865
17885
|
callApi(`/forms/${form_id}`)
|
|
17866
17886
|
]);
|
|
17867
17887
|
if (!subsResult.ok) {
|
|
17868
|
-
return
|
|
17888
|
+
return apiErrorResult(subsResult, `Could not fetch responses: ${subsResult.error}`);
|
|
17869
17889
|
}
|
|
17870
17890
|
const nodeById = /* @__PURE__ */ new Map();
|
|
17871
17891
|
let nodeList = [];
|
|
@@ -17996,7 +18016,7 @@ function registerWhoamiTool(server) {
|
|
|
17996
18016
|
async () => {
|
|
17997
18017
|
const result = await callApi("/me", { method: "GET" });
|
|
17998
18018
|
if (!result.ok) {
|
|
17999
|
-
return
|
|
18019
|
+
return apiErrorResult(result);
|
|
18000
18020
|
}
|
|
18001
18021
|
const me = result.data;
|
|
18002
18022
|
const ctx = getMcpAuth();
|
|
@@ -18083,10 +18103,10 @@ function registerAddNodeTool(server) {
|
|
|
18083
18103
|
},
|
|
18084
18104
|
async ({ form_id, node, after_node_id, unlinked }) => {
|
|
18085
18105
|
if (unlinked && after_node_id) {
|
|
18086
|
-
return
|
|
18106
|
+
return refusedResult("Pass either after_node_id (insert into the flow) or unlinked: true (outside the flow), not both.");
|
|
18087
18107
|
}
|
|
18088
18108
|
if (unlinked && !isTerminalType(node.type)) {
|
|
18089
|
-
return
|
|
18109
|
+
return refusedResult(
|
|
18090
18110
|
`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.`
|
|
18091
18111
|
);
|
|
18092
18112
|
}
|
|
@@ -18100,7 +18120,7 @@ function registerAddNodeTool(server) {
|
|
|
18100
18120
|
body
|
|
18101
18121
|
});
|
|
18102
18122
|
if (!result.ok) {
|
|
18103
|
-
return
|
|
18123
|
+
return apiErrorResult(result);
|
|
18104
18124
|
}
|
|
18105
18125
|
const nodeId = result.data.node_id;
|
|
18106
18126
|
const warnings = result.data.warnings ?? [];
|
|
@@ -18255,7 +18275,7 @@ function registerDeleteNodeTool(server) {
|
|
|
18255
18275
|
{ method: "DELETE" }
|
|
18256
18276
|
);
|
|
18257
18277
|
if (!result.ok) {
|
|
18258
|
-
return
|
|
18278
|
+
return apiErrorResult(result);
|
|
18259
18279
|
}
|
|
18260
18280
|
return textResult(`Node ${node_id} deleted.`);
|
|
18261
18281
|
}
|
|
@@ -18380,11 +18400,11 @@ Provide media via \`items\` (explicit type + URL), \`files\` (files attached by
|
|
|
18380
18400
|
// resolves the (now-targeted) workspace.
|
|
18381
18401
|
async ({ items, files, form_id: _form_id }) => {
|
|
18382
18402
|
if ((!items || items.length === 0) && (!files || files.length === 0)) {
|
|
18383
|
-
return
|
|
18403
|
+
return refusedResult("Provide at least one media item via `items` or `files`.");
|
|
18384
18404
|
}
|
|
18385
18405
|
const totalEntryCount = (items?.length ?? 0) + (files?.length ?? 0);
|
|
18386
18406
|
if (totalEntryCount > 10) {
|
|
18387
|
-
return
|
|
18407
|
+
return refusedResult(`Provide at most 10 media items total across \`items\` and \`files\` (got ${totalEntryCount}).`);
|
|
18388
18408
|
}
|
|
18389
18409
|
const meResult = await callApi("/me", { method: "GET" });
|
|
18390
18410
|
if (!meResult.ok) {
|
|
@@ -18555,7 +18575,7 @@ function registerCompleteMediaUploadTool(server) {
|
|
|
18555
18575
|
body: { uploaded: true }
|
|
18556
18576
|
});
|
|
18557
18577
|
if (!result.ok) {
|
|
18558
|
-
return
|
|
18578
|
+
return apiErrorResult(result);
|
|
18559
18579
|
}
|
|
18560
18580
|
const status = result.data.status ?? "ready";
|
|
18561
18581
|
const noop = Boolean(result.data.noop);
|
|
@@ -18686,7 +18706,7 @@ function registerGetNodeMediaTool(server) {
|
|
|
18686
18706
|
`/forms/${form_id}/nodes/${node_id}/media`
|
|
18687
18707
|
);
|
|
18688
18708
|
if (!result.ok) {
|
|
18689
|
-
return
|
|
18709
|
+
return apiErrorResult(result);
|
|
18690
18710
|
}
|
|
18691
18711
|
const media = result.data.media;
|
|
18692
18712
|
if (!media) {
|
|
@@ -18747,7 +18767,7 @@ function registerDeleteNodeMediaTool(server) {
|
|
|
18747
18767
|
{ method: "DELETE" }
|
|
18748
18768
|
);
|
|
18749
18769
|
if (!result.ok) {
|
|
18750
|
-
return
|
|
18770
|
+
return apiErrorResult(result);
|
|
18751
18771
|
}
|
|
18752
18772
|
return textResult("Media removed from node.");
|
|
18753
18773
|
}
|
|
@@ -18894,7 +18914,7 @@ function registerLogGenerationTool(server) {
|
|
|
18894
18914
|
const result = await callApi("/internal/log-generation", {
|
|
18895
18915
|
body: { form_id, summary, details }
|
|
18896
18916
|
});
|
|
18897
|
-
if (!result.ok) return
|
|
18917
|
+
if (!result.ok) return apiErrorResult(result);
|
|
18898
18918
|
return textResult(`Audit log saved for form ${form_id}
|
|
18899
18919
|
Summary: ${summary}
|
|
18900
18920
|
This is an internal generation-audit step, not a user-requested action.`);
|
|
@@ -18939,7 +18959,7 @@ Returns: article title, source, author, date, URL, description, and image URL pe
|
|
|
18939
18959
|
const result = await callApi("/internal/search-news", {
|
|
18940
18960
|
body: { query, count }
|
|
18941
18961
|
});
|
|
18942
|
-
if (!result.ok) return
|
|
18962
|
+
if (!result.ok) return apiErrorResult(result);
|
|
18943
18963
|
const results = result.data.results;
|
|
18944
18964
|
if (!results.length) return structuredResult(`No news articles found for "${query}".`, { query, articles: [] });
|
|
18945
18965
|
const articles = results.map((article) => ({
|
|
@@ -19020,7 +19040,7 @@ Pass one item or many (max 10) - multiple items run in parallel. Returns audio_u
|
|
|
19020
19040
|
// checks the node belongs to the form in the caller's workspace.
|
|
19021
19041
|
async ({ items, form_id }) => {
|
|
19022
19042
|
if (FORM_CLIP_RULES && (!form_id || items.some((i) => !i.node_id))) {
|
|
19023
|
-
return
|
|
19043
|
+
return refusedResult("form_id and a node_id per item are required: a voiceover is for one question in a Clipform form.");
|
|
19024
19044
|
}
|
|
19025
19045
|
const workspace_id = getMcpAuth()?.workspace_id;
|
|
19026
19046
|
const results = await Promise.allSettled(
|
|
@@ -19559,25 +19579,25 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
|
|
|
19559
19579
|
},
|
|
19560
19580
|
async ({ compositionId, outputFormat, inputProps, wait, items, node_id, form_id, captions, caption_ref }) => {
|
|
19561
19581
|
if (FORM_CLIP_RULES) {
|
|
19562
|
-
if (!form_id) return
|
|
19582
|
+
if (!form_id) return refusedResult("form_id is required: a render is for one question in a Clipform form.");
|
|
19563
19583
|
const missing = items?.length ? items.some((i) => !i.node_id) : !node_id;
|
|
19564
|
-
if (missing) return
|
|
19584
|
+
if (missing) return refusedResult("node_id is required: a render is for one question in a Clipform form, so every render needs the node it attaches to.");
|
|
19565
19585
|
}
|
|
19566
19586
|
if (items?.length && compositionId) {
|
|
19567
|
-
return
|
|
19587
|
+
return refusedResult("Pass EITHER items (batch) OR compositionId (single render), not both.");
|
|
19568
19588
|
}
|
|
19569
19589
|
if (!items?.length && !compositionId) {
|
|
19570
|
-
return
|
|
19590
|
+
return refusedResult("Pass compositionId for a single render, or items for a batch.");
|
|
19571
19591
|
}
|
|
19572
19592
|
if (node_id && !form_id) {
|
|
19573
|
-
return
|
|
19593
|
+
return refusedResult("form_id is required when node_id is set.");
|
|
19574
19594
|
}
|
|
19575
19595
|
if (items?.some((i) => i.node_id) && !form_id) {
|
|
19576
|
-
return
|
|
19596
|
+
return refusedResult("form_id is required when any item sets node_id.");
|
|
19577
19597
|
}
|
|
19578
19598
|
const unknown2 = (items ?? [{ compositionId, outputFormat, inputProps }]).map((i) => i.compositionId).filter((id) => !EXPOSED_COMPOSITIONS.includes(id));
|
|
19579
19599
|
if (unknown2.length) {
|
|
19580
|
-
return
|
|
19600
|
+
return refusedResult(`Composition${unknown2.length > 1 ? "s" : ""} ${unknown2.map((id) => `"${id}"`).join(", ")} not available. Call clipform_list_compositions to see available options.`);
|
|
19581
19601
|
}
|
|
19582
19602
|
if (items?.length) {
|
|
19583
19603
|
const jobs2 = items.map((item) => ({ item, job: fireRender(item, form_id) }));
|
|
@@ -19628,7 +19648,7 @@ ${RENDER_ATTACH_RULE} In batch mode, set node_id per item (see items) and form_i
|
|
|
19628
19648
|
if (!result.ok) {
|
|
19629
19649
|
const placeholder = await placeholderPromise;
|
|
19630
19650
|
if (placeholder) await failPlaceholder(placeholder, result.error);
|
|
19631
|
-
return
|
|
19651
|
+
return apiErrorResult(result);
|
|
19632
19652
|
}
|
|
19633
19653
|
const data = result.data;
|
|
19634
19654
|
let attach;
|
|
@@ -19707,7 +19727,7 @@ function registerSearchMusicTool(server) {
|
|
|
19707
19727
|
const result = await callApi("/internal/search-music", {
|
|
19708
19728
|
body: { query, count, instrumentalOnly, minDuration, maxDuration, tags }
|
|
19709
19729
|
});
|
|
19710
|
-
if (!result.ok) return
|
|
19730
|
+
if (!result.ok) return apiErrorResult(result);
|
|
19711
19731
|
const results = result.data.results;
|
|
19712
19732
|
if (!results.length) return structuredResult(`No music found for "${query}".`, { query, tracks: [] });
|
|
19713
19733
|
const tracks = results.map((item) => ({
|
|
@@ -19792,7 +19812,7 @@ function registerListCompositionsTool(server) {
|
|
|
19792
19812
|
if (result.status === 0 || result.status === 404) {
|
|
19793
19813
|
return errorResult("Video compositions are not available (API server may not be running). Start the API with 'npm run dev --workspace=apps/api'.");
|
|
19794
19814
|
}
|
|
19795
|
-
return
|
|
19815
|
+
return apiErrorResult(result);
|
|
19796
19816
|
}
|
|
19797
19817
|
const all = result.data.compositions;
|
|
19798
19818
|
const compositions = all.filter((c) => EXPOSED_COMPOSITIONS.includes(c.id));
|
|
@@ -19850,7 +19870,7 @@ function registerListVideoTemplatesTool(server) {
|
|
|
19850
19870
|
if (result.status === 0 || result.status === 404) {
|
|
19851
19871
|
return errorResult("Video templates are not available (API server may not be running). Start the API with 'npm run dev --workspace=apps/api'.");
|
|
19852
19872
|
}
|
|
19853
|
-
return
|
|
19873
|
+
return apiErrorResult(result);
|
|
19854
19874
|
}
|
|
19855
19875
|
const templates = result.data.templates ?? [];
|
|
19856
19876
|
if (!templates.length) {
|
|
@@ -19922,10 +19942,10 @@ ${RENDER_ATTACH_RULE}`,
|
|
|
19922
19942
|
},
|
|
19923
19943
|
async ({ template, controls, outputFormat, wait, node_id, form_id, captions, caption_ref }) => {
|
|
19924
19944
|
if (FORM_CLIP_RULES && (!form_id || !node_id)) {
|
|
19925
|
-
return
|
|
19945
|
+
return refusedResult("form_id and node_id are required: a render is for one question in a Clipform form, so it needs the node it attaches to.");
|
|
19926
19946
|
}
|
|
19927
19947
|
if (node_id && !form_id) {
|
|
19928
|
-
return
|
|
19948
|
+
return refusedResult("form_id is required when node_id is set.");
|
|
19929
19949
|
}
|
|
19930
19950
|
const captionRef = resolveCaptionRef(caption_ref, controls?.audio_url);
|
|
19931
19951
|
const narrated = renderHasNarration({ captions, captionRef, controls });
|
|
@@ -19986,7 +20006,7 @@ ${RENDER_ATTACH_RULE}`,
|
|
|
19986
20006
|
if (!result.ok) {
|
|
19987
20007
|
const placeholder = await placeholderPromise;
|
|
19988
20008
|
if (placeholder) await failPlaceholder(placeholder, result.error);
|
|
19989
|
-
return
|
|
20009
|
+
return apiErrorResult(result);
|
|
19990
20010
|
}
|
|
19991
20011
|
const data = result.data;
|
|
19992
20012
|
let attach;
|
|
@@ -20045,7 +20065,7 @@ function registerListAssetsTool(server) {
|
|
|
20045
20065
|
method: "GET",
|
|
20046
20066
|
params: { type: type ?? "all" }
|
|
20047
20067
|
});
|
|
20048
|
-
if (!result.ok) return
|
|
20068
|
+
if (!result.ok) return apiErrorResult(result);
|
|
20049
20069
|
data = result.data;
|
|
20050
20070
|
}
|
|
20051
20071
|
const lines = [];
|
|
@@ -20159,12 +20179,12 @@ Pass job_ids to check a whole batch in ONE call - one line of status per job. Pa
|
|
|
20159
20179
|
async ({ job_id, job_ids }) => {
|
|
20160
20180
|
const ids = job_ids?.length ? job_ids : job_id ? [job_id] : [];
|
|
20161
20181
|
if (!ids.length) {
|
|
20162
|
-
return
|
|
20182
|
+
return refusedResult("Pass job_id (single) or job_ids (batch).");
|
|
20163
20183
|
}
|
|
20164
20184
|
if (ids.length === 1) {
|
|
20165
20185
|
const job = getJob(ids[0]);
|
|
20166
20186
|
if (!job) {
|
|
20167
|
-
return
|
|
20187
|
+
return refusedResult(`No render job found with ID ${ids[0]}. ${LOST_JOB_RECOVERY}`);
|
|
20168
20188
|
}
|
|
20169
20189
|
if (job.status === "rendering") {
|
|
20170
20190
|
const elapsed = Math.round((Date.now() - job.createdAt) / 1e3);
|
|
@@ -20285,7 +20305,7 @@ mainlandOnly excludes small islands and overseas territories (e.g. Corsica for F
|
|
|
20285
20305
|
}
|
|
20286
20306
|
const data = await response.json();
|
|
20287
20307
|
if (!data.features?.length) {
|
|
20288
|
-
return
|
|
20308
|
+
return refusedResult(`No boundary found for "${query}" (type: ${type}). Try a different name or type.`);
|
|
20289
20309
|
}
|
|
20290
20310
|
const feature = data.features[0];
|
|
20291
20311
|
let geometry = feature.geometry;
|
|
@@ -20665,4 +20685,4 @@ export {
|
|
|
20665
20685
|
* MIT Licensed
|
|
20666
20686
|
*)
|
|
20667
20687
|
*/
|
|
20668
|
-
//# sourceMappingURL=chunk-
|
|
20688
|
+
//# sourceMappingURL=chunk-EQPYULVM.js.map
|