@clipform/mcp-server 4.8.0 → 4.8.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.
@@ -29,7 +29,7 @@ import {
29
29
  union,
30
30
  unknown,
31
31
  url
32
- } from "./chunk-7KKHHANA.js";
32
+ } from "./chunk-CANFXI4D.js";
33
33
  import {
34
34
  GUIDE_TYPES,
35
35
  QUIZ_VARIANTS,
@@ -38,7 +38,7 @@ import {
38
38
  getGuideUri,
39
39
  guideFallbackText,
40
40
  registerResources
41
- } from "./chunk-MSJJEURL.js";
41
+ } from "./chunk-BZPLNFYU.js";
42
42
  import {
43
43
  ANON_PREVIEW_LINK_LABEL,
44
44
  ANON_PREVIEW_NOTICE,
@@ -52,7 +52,7 @@ import {
52
52
  isPreviewViewerUrl,
53
53
  previewOnlyNotice,
54
54
  withAdoptedNotice
55
- } from "./chunk-R6E7I4GW.js";
55
+ } from "./chunk-Z43YF3UB.js";
56
56
  import {
57
57
  ACTIVE_NODE_TYPES,
58
58
  ANON_MCP_BLOCKED_NODE_TYPES,
@@ -80,7 +80,7 @@ import {
80
80
  stripGatedConfigKeys,
81
81
  structuredResult,
82
82
  textResult
83
- } from "./chunk-URQXLZEB.js";
83
+ } from "./chunk-6DSCZEF7.js";
84
84
  import {
85
85
  getMcpAuth,
86
86
  runWithMcpAuth,
@@ -16397,6 +16397,14 @@ function joinKinds(kinds) {
16397
16397
  }
16398
16398
 
16399
16399
  // src/tools/create-form.ts
16400
+ function currentFormsBlock(formList, formLimit) {
16401
+ return [
16402
+ `Current forms:`,
16403
+ formList,
16404
+ ``,
16405
+ `Share this list with the user, explain they've hit the ${formLimit}-form limit, and let them pick a form to delete. clipform_delete_form asks the user to confirm before removing anything.`
16406
+ ];
16407
+ }
16400
16408
  function registerCreateFormTool(server) {
16401
16409
  server.registerTool(
16402
16410
  "clipform_create_form",
@@ -16490,27 +16498,31 @@ Example: A form that asks a question, collects contact info, then finishes:
16490
16498
  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.`;
16491
16499
  return errorResult(message);
16492
16500
  }
16501
+ let limitFormList = null;
16493
16502
  if (planContext.form_limit !== null) {
16494
16503
  const formsResult = await callApi("/forms", { method: "GET" });
16495
16504
  if (formsResult.ok) {
16496
16505
  const forms = formsResult.data.forms ?? [];
16497
16506
  if (forms.length >= planContext.form_limit) {
16498
16507
  const formList = forms.map((f, i) => ` ${i + 1}. "${f.title || "Untitled"}" (id: ${f.id})`).join("\n");
16499
- 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.
16508
+ const auth = getMcpAuth();
16509
+ const claimable = !planContext.is_authenticated && !!(auth?.mcp_mint_proof || auth?.mcp_session_proof);
16510
+ if (claimable) {
16511
+ limitFormList = formList;
16512
+ } else {
16513
+ 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.
16500
16514
  - Or sign in to a Clipform account to keep these forms and get higher limits.`;
16501
- return errorResult(
16502
- [
16503
- `LIMIT REACHED - the form was NOT created. The plan's form limit is full.`,
16504
- ``,
16505
- `This ${planContext.is_authenticated ? `workspace ('${planContext.workspace_name}')` : "anonymous session"} is on the ${planContext.plan_name} plan, which allows ${planContext.form_limit} forms, and it's already full. To make a new one:`,
16506
- options,
16507
- ``,
16508
- `Current forms:`,
16509
- formList,
16510
- ``,
16511
- `Share this list with the user, explain they've hit the ${planContext.form_limit}-form limit, and let them pick a form to delete. clipform_delete_form asks the user to confirm before removing anything.`
16512
- ].join("\n")
16513
- );
16515
+ return errorResult(
16516
+ [
16517
+ `LIMIT REACHED - the form was NOT created. The plan's form limit is full.`,
16518
+ ``,
16519
+ `This ${planContext.is_authenticated ? `workspace ('${planContext.workspace_name}')` : "anonymous session"} is on the ${planContext.plan_name} plan, which allows ${planContext.form_limit} forms, and it's already full. To make a new one:`,
16520
+ options,
16521
+ ``,
16522
+ ...currentFormsBlock(formList, planContext.form_limit)
16523
+ ].join("\n")
16524
+ );
16525
+ }
16514
16526
  }
16515
16527
  }
16516
16528
  }
@@ -16541,7 +16553,24 @@ Example: A form that asks a question, collects contact info, then finishes:
16541
16553
  timeoutMs: 12e4
16542
16554
  });
16543
16555
  if (!createResult.ok) {
16544
- const message = `Form NOT created (nothing was saved): ${createResult.error}`;
16556
+ let message = `Form NOT created (nothing was saved): ${createResult.error}`;
16557
+ if (limitFormList !== null && planContext.form_limit !== null) {
16558
+ if (createResult.code === "PLAN_LIMIT") {
16559
+ message = [
16560
+ message,
16561
+ ``,
16562
+ `The user can also delete one of the forms below to free a slot:`,
16563
+ ``,
16564
+ ...currentFormsBlock(limitFormList, planContext.form_limit)
16565
+ ].join("\n");
16566
+ } else {
16567
+ message = [
16568
+ message,
16569
+ ``,
16570
+ `The form limit is full, so the user can also sign in to a Clipform account to keep these forms and get higher limits.`
16571
+ ].join("\n");
16572
+ }
16573
+ }
16545
16574
  return isAnonymousAccountRequired(createResult) ? errorResult(message, authChallengeMeta("insufficient_scope", createResult.apiMessage ?? message)) : errorResult(message);
16546
16575
  }
16547
16576
  const { data } = createResult;
@@ -20352,4 +20381,4 @@ export {
20352
20381
  * MIT Licensed
20353
20382
  *)
20354
20383
  */
20355
- //# sourceMappingURL=chunk-LJZVIYLO.js.map
20384
+ //# sourceMappingURL=chunk-RXXA4TT3.js.map