@cookiemunch/mcp 0.1.1 → 0.3.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.
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { createCookieMunch } from "@cookiemunch/sdk";
4
4
 
5
5
  // src/tools.ts
6
- import { z as z3 } from "zod";
6
+ import { z as z4 } from "zod";
7
7
 
8
8
  // src/tools-config.ts
9
9
  import { z } from "zod";
@@ -191,7 +191,7 @@ function registerConfigTools(tool, client) {
191
191
  preset: z.enum(["bar", "box", "full"]).optional().describe("Named shape that sets type/secondLayer (and layout for box): bar = slim one-row bar + categories in a modal; box = centred card + modal; full = every category in the first layer."),
192
192
  secondLayer: z.enum(["expand", "popup", "modal"]).optional().describe("Where the categories open from an inline banner."),
193
193
  density: z.enum(["comfortable", "compact"]).optional().describe("compact = one-row bar from 760px wide."),
194
- theme: z.record(z.unknown()).optional().describe("Partial ThemeTokens \u2014 deep-merged onto the existing banner theme."),
194
+ theme: z.record(z.unknown()).optional().describe("Partial ThemeTokens \u2014 deep-merged onto the existing banner theme. Includes `scrollbar`: { style: themed|thin|native|hidden, thumb?, thumbHover?, track?, width? 4\u201316, radius? 0\u2013999 }."),
195
195
  content: z.record(z.unknown()).optional().describe("Partial BannerContent \u2014 banner copy overrides (title, body, button labels, policyUrl, etc.).")
196
196
  });
197
197
  tool(
@@ -543,9 +543,29 @@ function registerPlatformTools(tool, client) {
543
543
  secretKey: z2.string().describe("Its API key, with whatever scope that system needs to export and erase a user."),
544
544
  webhookSecret: z2.string().optional().describe("Signing secret of its webhook endpoint. Optional: polling closes tasks without it."),
545
545
  auto: z2.boolean().optional().describe("Open a sub-task automatically when a request reaches fulfilment. Default true."),
546
- profile: z2.record(z2.unknown()).describe("How to drive that system: { open, poll, statuses } required, plus optional subjectLookup, auth, idempotencyHeader and webhook. See the connected-systems docs for the shape.")
546
+ profile: z2.record(z2.unknown()).describe("How to drive that system: { open, poll, statuses } required, plus optional subjectLookup, auth, idempotencyHeader and webhook. See the connected-systems docs for the shape."),
547
+ dryRun: z2.boolean().optional().describe("Validate everything and answer the connection that would be created, storing nothing.")
547
548
  },
548
- (a) => client.fulfillment.connectExecutor(a)
549
+ (a) => {
550
+ const { dryRun, ...input } = a;
551
+ return dryRun === true ? client.fulfillment.dryRunConnectExecutor(input) : client.fulfillment.connectExecutor(input);
552
+ }
553
+ );
554
+ tool(
555
+ "test_dsar_executor_webhook",
556
+ "Would this webhook delivery from a connected system verify? Runs the receiver's exact check (headers, timestamp tolerance, prefix, HMAC) on headers and a raw body you supply, acts on nothing, and returns { verified, stage, reason } naming the stage that failed. `body` must be the raw request body string, byte for byte. Read-only.",
557
+ {
558
+ id: z2.string().describe("The connection id."),
559
+ headers: z2.record(z2.string()).describe("The delivery headers, e.g. its id, timestamp and signature headers."),
560
+ body: z2.string().describe("The raw body exactly as it was signed.")
561
+ },
562
+ (a) => client.fulfillment.testExecutorWebhook(a.id, { headers: a.headers, body: a.body })
563
+ );
564
+ tool(
565
+ "list_dsar_executor_webhook_deliveries",
566
+ "The last 50 deliveries to a connected system's webhook, newest first, each with whether it verified and, if not, the stage and reason. Never includes the secret, the signature or the body (only a short hash and size). Read-only.",
567
+ { id: z2.string().describe("The connection id.") },
568
+ (a) => client.fulfillment.executorWebhookDeliveries(a.id)
549
569
  );
550
570
  tool(
551
571
  "disconnect_dsar_executor",
@@ -658,10 +678,176 @@ function registerPlatformTools(tool, client) {
658
678
  );
659
679
  }
660
680
 
681
+ // src/tools-rights-page.ts
682
+ import { z as z3 } from "zod";
683
+ function registerRightsTools(tool, client) {
684
+ const cbid = { cbid: z3.string().describe("Site identifier (cbid). Must belong to your org.") };
685
+ const base = {
686
+ baseUpdatedAt: z3.union([z3.number().int(), z3.string(), z3.null()]).optional().describe("The draft\u2019s updatedAt from your last read (null if it had none). If someone saved since, the write is refused with 409 draft_conflict and the current draft; omit to overwrite regardless.")
687
+ };
688
+ const baseOpt = (a) => a.baseUpdatedAt !== void 0 ? { baseUpdatedAt: a.baseUpdatedAt } : {};
689
+ tool("get_rights_page", "Read the site\u2019s rights page DRAFT (the default page until first saved), with warnings that would block publishing.", cbid, (a) => client.rightsPage.get(a.cbid));
690
+ tool(
691
+ "update_rights_page",
692
+ "Replace the rights page draft with a full document (theme, sections, form, i18n, seo, customCss). Nothing goes live until publish_rights_page. Prefer patch_rights_page for small changes and preview_rights_page when unsure. Pass baseUpdatedAt (from get_rights_page) to avoid overwriting someone else\u2019s save: a mismatch is 409 draft_conflict with the current draft.",
693
+ { ...cbid, page: z3.record(z3.unknown()).describe("The whole RightsPage document (v: 1)."), ...base },
694
+ (a) => client.rightsPage.put(a.cbid, a.page, baseOpt(a))
695
+ );
696
+ tool(
697
+ "patch_rights_page",
698
+ "Change part of the rights page draft: objects merge, arrays (sections, request types, fields) replace whole, null removes a field. baseUpdatedAt works as on update_rights_page (409 draft_conflict).",
699
+ { ...cbid, patch: z3.record(z3.unknown()), ...base },
700
+ (a) => client.rightsPage.patch(a.cbid, a.patch, baseOpt(a))
701
+ );
702
+ tool(
703
+ "preview_rights_page",
704
+ 'Validate a rights-page write WITHOUT saving: returns the document as it would be stored and any publish warnings. mode "patch" (default) or "put".',
705
+ { ...cbid, page: z3.record(z3.unknown()), mode: z3.enum(["patch", "put"]).optional() },
706
+ (a) => client.rightsPage.dryRun(a.cbid, a.page, { mode: a.mode ?? "patch" })
707
+ );
708
+ tool("get_published_rights_page", "Read the LIVE rights page document (404 not_published while the site shows the default page).", cbid, (a) => client.rightsPage.getPublished(a.cbid));
709
+ tool(
710
+ "publish_rights_page",
711
+ "Publish the draft as the next version: it goes live at once, to every visitor. Refused unless the page has exactly one form section and an enabled request type. Pass baseUpdatedAt (from get_rights_page) so only the draft you read goes live; without it, whatever the draft holds now is published, including someone else\u2019s later edits. A mismatch is 409 draft_conflict with the current draft.",
712
+ { ...cbid, ...base },
713
+ (a) => client.rightsPage.publish(a.cbid, baseOpt(a))
714
+ );
715
+ tool("list_rights_page_versions", "Published versions of the rights page, newest first, each with publishedBy, publishedByEmail (null for an API key) and publishedVia.", cbid, (a) => client.rightsPage.versions(a.cbid));
716
+ tool(
717
+ "rollback_rights_page",
718
+ "Publish an earlier version of the rights page again (as a new version): it goes live at once and REPLACES the current draft, so unpublished edits are lost and cannot be recovered (versions hold only published documents). Pass baseUpdatedAt (from get_rights_page) to refuse with 409 draft_conflict if anyone saved the draft since you read it.",
719
+ { ...cbid, version: z3.number().int().min(1), ...base },
720
+ (a) => client.rightsPage.rollback(a.cbid, a.version, baseOpt(a))
721
+ );
722
+ }
723
+ function registerRightsPageTools(tool, client) {
724
+ const site = z3.object({ cbid: z3.string().describe("Site identifier (cbid). Must belong to your org.") });
725
+ const host = site.extend({
726
+ hostname: z3.string().describe("The custom hostname, e.g. privacy.example.com (unicode or punycode).")
727
+ });
728
+ tool(
729
+ "list_rights_page_domains",
730
+ "List the custom hostnames serving a site's rights page, each with its status (pending_dns, verifying, issuing, active, error), the exact DNS records to create, and the plan's allowance.",
731
+ site.shape,
732
+ (a) => client.rightsPage.listDomains(site.parse(a).cbid)
733
+ );
734
+ tool(
735
+ "add_rights_page_domain",
736
+ "Add a custom hostname for a site's rights page (e.g. privacy.example.com). Returns the DNS records the owner must create: a CNAME to this domain's own <token>.cname.cookiemunch.net (a CNAME to anything else never verifies it), or for an apex / flattened / proxied record the _cookiemunch TXT. Then call verify_rights_page_domain. Plans include Free 0, Starter 1, Pro 5, Scale unlimited.",
737
+ host.shape,
738
+ (a) => {
739
+ const { cbid, hostname } = host.parse(a);
740
+ return client.rightsPage.addDomain(cbid, hostname);
741
+ }
742
+ );
743
+ tool(
744
+ "verify_rights_page_domain",
745
+ "Check a custom hostname now: DNS while it is pending or in error, the HTTPS answer once it is routed. Returns the domain as it now stands; lastError and dnsSeen say what is missing.",
746
+ host.shape,
747
+ (a) => {
748
+ const { cbid, hostname } = host.parse(a);
749
+ return client.rightsPage.verifyDomain(cbid, hostname);
750
+ }
751
+ );
752
+ tool(
753
+ "remove_rights_page_domain",
754
+ "Remove a custom hostname from a site's rights page. It stops being served at once and its certificate is no longer renewed.",
755
+ host.shape,
756
+ async (a) => {
757
+ const { cbid, hostname } = host.parse(a);
758
+ await client.rightsPage.removeDomain(cbid, hostname);
759
+ return { removed: hostname };
760
+ }
761
+ );
762
+ }
763
+
764
+ // src/design-warnings.ts
765
+ function whereText(f) {
766
+ const w = f.where ?? {};
767
+ const bits = [
768
+ f.layer === "banner" ? "first layer" : `${f.layer} layer`,
769
+ w.view ? `view "${w.view}"` : "",
770
+ w.variant && w.variant !== "base" ? `variant ${w.variant}` : "",
771
+ w.theme === "dark" ? "dark theme" : "",
772
+ w.breakpoint === "mobile" ? "mobile" : "",
773
+ w.language ? `language ${w.language}` : "",
774
+ w.url ? w.url : ""
775
+ ].filter(Boolean);
776
+ return bits.join(", ");
777
+ }
778
+ function styleText(s) {
779
+ const parts = [
780
+ s.background ? `background ${s.background}` : "",
781
+ s.color ? `text ${s.color}` : "",
782
+ s.borderColor ? `border ${s.borderWidth ?? 1}px ${s.borderColor}` : "",
783
+ s.fontSize ? `font ${s.fontSize}px` : "",
784
+ s.fontWeight ? `weight ${s.fontWeight}` : "",
785
+ s.width && s.height ? `${Math.round(s.width)}\xD7${Math.round(s.height)}px` : ""
786
+ ].filter(Boolean);
787
+ return parts.join(", ");
788
+ }
789
+ var CONTEXT_TEXT = {
790
+ saved: "The config was saved as sent; this is a warning, not an error.",
791
+ preview: "Nothing was saved: this is a preview of the write.",
792
+ lint: "Nothing was saved: this is a lint of a proposed config.",
793
+ read: "This describes the config as it is stored now; nothing was changed.",
794
+ scan: "This was measured on the live site by the last cookie scan; fix the banner, then scan again."
795
+ };
796
+ function designContext(tool, value) {
797
+ const v = value && typeof value === "object" ? value : {};
798
+ if (tool === "lint_banner_config") return "lint";
799
+ if (v.dryRun === true || tool.startsWith("preview_")) return "preview";
800
+ if (v.buttonParity && typeof v.buttonParity === "object") return "scan";
801
+ if (/^(update|patch|set|edit|create|assign|apply)_/.test(tool)) return "saved";
802
+ return "read";
803
+ }
804
+ function designWarningText(findings, suggested, context = "read") {
805
+ if (!Array.isArray(findings) || findings.length === 0) return "";
806
+ const warnings = findings.filter((f) => f.severity === "warning");
807
+ const notices = findings.filter((f) => f.severity !== "warning");
808
+ const lines = [];
809
+ if (warnings.length) {
810
+ lines.push(
811
+ `Design warning: the Accept button is more prominent than Reject (${warnings.length} issue${warnings.length === 1 ? "" : "s"}). Regulators treat this as a dark pattern (EDPB Guidelines 03/2022, the EDPB cookie banner taskforce, CNIL). Make both buttons the same style. ${CONTEXT_TEXT[context]}`
812
+ );
813
+ for (const f of warnings) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
814
+ }
815
+ if (notices.length) {
816
+ lines.push(
817
+ `Design notice: ${notices.length} thing${notices.length === 1 ? "" : "s"} to check about how Reject compares with Accept.` + (warnings.length ? "" : ` ${CONTEXT_TEXT[context]}`)
818
+ );
819
+ for (const f of notices) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
820
+ }
821
+ const fixes = suggested && suggested.length ? suggested : findings.filter((f) => f.accept && f.reject).slice(0, 1).map((f) => ({ ...f.accept, layer: f.layer, view: f.where?.view }));
822
+ for (const s of fixes) {
823
+ const style = styleText(s);
824
+ if (style) {
825
+ lines.push(
826
+ `Suggested fix: style Reject all${s.view ? ` in view "${s.view}"` : ""} with ${style} \u2014 the same as Accept all. In a flow design, give the Reject button the same \`variant\` and size as the Accept button.`
827
+ );
828
+ }
829
+ }
830
+ return lines.join("\n");
831
+ }
832
+ function withDesignWarnings(value, body, tool = "") {
833
+ if (!value || typeof value !== "object") return body;
834
+ const nested = value.buttonParity;
835
+ const v = nested && typeof nested === "object" ? nested : value;
836
+ if (!Array.isArray(v.designWarnings) || v.designWarnings.length === 0) return body;
837
+ const head = designWarningText(
838
+ v.designWarnings,
839
+ Array.isArray(v.suggestedReject) ? v.suggestedReject : void 0,
840
+ designContext(tool, value)
841
+ );
842
+ return head ? `${head}
843
+
844
+ ${body}` : body;
845
+ }
846
+
661
847
  // src/tools.ts
662
- function text(value) {
848
+ function text(value, tool = "") {
663
849
  const body = typeof value === "string" ? value : JSON.stringify(value, null, 2);
664
- return { content: [{ type: "text", text: body }] };
850
+ return { content: [{ type: "text", text: withDesignWarnings(value, body, tool) }] };
665
851
  }
666
852
  function fail(err) {
667
853
  const message = err instanceof Error ? err.message : String(err);
@@ -671,16 +857,16 @@ function registerTools(server, client) {
671
857
  const tool = (name, description, inputSchema, run) => {
672
858
  server.registerTool(name, { description, inputSchema }, async (args) => {
673
859
  try {
674
- return text(await run(args));
860
+ return text(await run(args), name);
675
861
  } catch (err) {
676
862
  return fail(err);
677
863
  }
678
864
  });
679
865
  };
680
- const cbid = { cbid: z3.string().describe("Site identifier (cbid). Must belong to your org.") };
866
+ const cbid = { cbid: z4.string().describe("Site identifier (cbid). Must belong to your org.") };
681
867
  const range = {
682
- from: z3.number().optional().describe("Epoch-ms lower bound."),
683
- to: z3.number().optional().describe("Epoch-ms upper bound.")
868
+ from: z4.number().optional().describe("Epoch-ms lower bound."),
869
+ to: z4.number().optional().describe("Epoch-ms upper bound.")
684
870
  };
685
871
  tool(
686
872
  "whoami",
@@ -698,19 +884,19 @@ function registerTools(server, client) {
698
884
  tool(
699
885
  "get_site",
700
886
  "One site: its domain, cbid and verification status. Read-only.",
701
- { cbid: z3.string() },
887
+ { cbid: z4.string() },
702
888
  (a) => client.sites.get(a.cbid)
703
889
  );
704
890
  tool(
705
891
  "get_site_banner",
706
892
  "Which banner design a site uses, or bannerId null when none is assigned. Read-only.",
707
- { cbid: z3.string() },
893
+ { cbid: z4.string() },
708
894
  (a) => client.sites.banner(a.cbid)
709
895
  );
710
896
  tool(
711
897
  "get_privacy_policy",
712
898
  "Generate the site's privacy and cookie policy as Markdown, naming the org's data controller. Needs a contact email: the one given, else the org controller's, else the owner's. Read-only \u2014 nothing is published.",
713
- { cbid: z3.string(), contactEmail: z3.string().optional(), effectiveDate: z3.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: z3.array(z3.string()).optional() },
899
+ { cbid: z4.string(), contactEmail: z4.string().optional(), effectiveDate: z4.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: z4.array(z4.string()).optional() },
714
900
  (a) => client.sites.policy(a.cbid, {
715
901
  ...a.contactEmail ? { contactEmail: a.contactEmail } : {},
716
902
  ...a.effectiveDate ? { effectiveDate: a.effectiveDate } : {},
@@ -720,7 +906,7 @@ function registerTools(server, client) {
720
906
  tool(
721
907
  "set_ad_personalization",
722
908
  "Add or remove the separate 'personalised ads' choice on the site's live banner. With it on, accepting marketing no longer implies personalised ads unless `default` is true.",
723
- { cbid: z3.string(), enabled: z3.boolean(), default: z3.boolean().optional(), label: z3.string().optional() },
909
+ { cbid: z4.string(), enabled: z4.boolean(), default: z4.boolean().optional(), label: z4.string().optional() },
724
910
  (a) => client.sites.setAdPersonalization(a.cbid, {
725
911
  enabled: a.enabled,
726
912
  ...a.default !== void 0 ? { default: a.default } : {},
@@ -731,11 +917,11 @@ function registerTools(server, client) {
731
917
  "analyze_session",
732
918
  "Analyse a captured browsing session against the consent it ran under: which trackers fired after the visitor opted out, and what personal data left the page. Read-only.",
733
919
  {
734
- cbid: z3.string(),
735
- har: z3.unknown().optional().describe("A HAR export of the session."),
736
- requests: z3.array(z3.unknown()).optional().describe("Or the requests directly."),
737
- consent: z3.record(z3.string(), z3.boolean()).optional(),
738
- gpc: z3.boolean().optional()
920
+ cbid: z4.string(),
921
+ har: z4.unknown().optional().describe("A HAR export of the session."),
922
+ requests: z4.array(z4.unknown()).optional().describe("Or the requests directly."),
923
+ consent: z4.record(z4.string(), z4.boolean()).optional(),
924
+ gpc: z4.boolean().optional()
739
925
  },
740
926
  (a) => client.sites.analyzeSession(a.cbid, {
741
927
  ...a.har !== void 0 ? { har: a.har } : {},
@@ -747,14 +933,14 @@ function registerTools(server, client) {
747
933
  tool(
748
934
  "create_site",
749
935
  "Create a new site. The cbid is auto-generated if you omit it.",
750
- { domain: z3.string().describe("The site domain, e.g. example.com."), cbid: z3.string().optional().describe("Optional explicit cbid.") },
936
+ { domain: z4.string().describe("The site domain, e.g. example.com."), cbid: z4.string().optional().describe("Optional explicit cbid.") },
751
937
  (a) => client.sites.create({ domain: a.domain, ...typeof a.cbid === "string" ? { cbid: a.cbid } : {} })
752
938
  );
753
939
  tool(
754
940
  "create_sites_bulk",
755
941
  "Create up to 100 sites in one call. Partial success: each item reports ok or its own error, and a bad or duplicate item fails only itself.",
756
942
  {
757
- sites: z3.array(z3.object({ domain: z3.string(), cbid: z3.string().optional(), platform: z3.string().optional() })).min(1).max(100)
943
+ sites: z4.array(z4.object({ domain: z4.string(), cbid: z4.string().optional(), platform: z4.string().optional() })).min(1).max(100)
758
944
  },
759
945
  (a) => client.sites.createBulk(a.sites)
760
946
  );
@@ -764,15 +950,15 @@ function registerTools(server, client) {
764
950
  "Replace (overwrite) the banner/consent configuration for a site via PUT. This is destructive, not a merge: any top-level SiteConfig field you omit from `config` reverts to its default rather than keeping its current value \u2014 unless keepUnspecified is true, in which case omitted top-level fields keep their stored value and only the fields you send are replaced (each whole). A top-level field sent as null reverts to its default. To change one setting, use patch_site_config instead \u2014 it merges server-side. Prefer the narrower set_* tools (set_blocking, set_banner_basics, etc.) when they cover your change.",
765
951
  {
766
952
  ...cbid,
767
- config: z3.record(z3.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
768
- keepUnspecified: z3.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
953
+ config: z4.record(z4.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
954
+ keepUnspecified: z4.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
769
955
  },
770
956
  (a) => a.keepUnspecified === true ? client.sites.putConfig(a.cbid, a.config, { keep: "unspecified" }) : client.sites.putConfig(a.cbid, a.config)
771
957
  );
772
958
  tool(
773
959
  "patch_site_config",
774
960
  `Change part of a site's banner/consent configuration. The patch is a JSON Merge Patch (RFC 7386) over the stored config server-side: any field you omit keeps its current value, and a field set to null is REMOVED (it falls back to its default) \u2014 e.g. { "banner": { "i18n": { "es": null } } } drops the Spanish override. This is the safe way to flip one setting, and it needs no read-modify-write. Use update_site_config only when you genuinely mean to replace the whole document.`,
775
- { ...cbid, config: z3.record(z3.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
961
+ { ...cbid, config: z4.record(z4.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
776
962
  (a) => client.sites.patchConfig(a.cbid, a.config)
777
963
  );
778
964
  tool(
@@ -780,15 +966,30 @@ function registerTools(server, client) {
780
966
  'Preview a config change WITHOUT saving it: returns the config as it would be saved, a diff of every field that would change, and any warnings (plan-gated or unrecognised fields). mode "patch" (default) previews patch_site_config; mode "put" previews update_site_config, and its diff lists everything a replace would revert to its default (unless keepUnspecified is true). Use it before any write you are not sure of.',
781
967
  {
782
968
  ...cbid,
783
- config: z3.record(z3.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
784
- mode: z3.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
785
- keepUnspecified: z3.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
969
+ config: z4.record(z4.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
970
+ mode: z4.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
971
+ keepUnspecified: z4.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
786
972
  },
787
973
  (a) => client.sites.dryRunConfig(a.cbid, a.config, {
788
974
  mode: a.mode ?? "patch",
789
975
  ...a.keepUnspecified === true ? { keep: "unspecified" } : {}
790
976
  })
791
977
  );
978
+ tool(
979
+ "lint_banner_config",
980
+ 'Check a banner config for consent-button parity WITHOUT saving it: is "Accept all" more prominent than "Reject all" anywhere \u2014 a brighter or more saturated colour, a bigger or bolder button, Reject styled as a link, hidden, below the fold, set apart, missing from the first layer, or worded to guilt-trip? Regulators (EDPB, CNIL) treat that as a dark pattern. Returns findings, a 0\u2013100 score and the reject style that would match Accept. It checks exactly what the write would store: merged over the stored config as patch_site_config would, or with replace: true replaced as update_site_config would. Run it before writing any banner design.',
981
+ {
982
+ ...cbid,
983
+ config: z4.record(z4.unknown()).describe("The proposed SiteConfig (or a partial one, or a v2 flow design)."),
984
+ replace: z4.boolean().optional().describe("Check what update_site_config (a full replace) would store, instead of what patch_site_config (a merge) would.")
985
+ },
986
+ async (a) => {
987
+ const r = await client.sites.lintConfig(a.cbid, a.config, a.replace === true ? { replace: true } : {});
988
+ return r.designWarnings.length === 0 ? `No design warnings: Accept all and Reject all have equal weight on every surface checked (score ${r.score}). Nothing was saved.
989
+
990
+ ${JSON.stringify(r, null, 2)}` : r;
991
+ }
992
+ );
792
993
  tool(
793
994
  "verify_consent_log",
794
995
  "Verify a site's consent log has not been tampered with. Each record carries the hash of the one before it, so an edited, reordered or deleted record breaks the chain and this returns valid: false. This is the evidence behind a consent log \u2014 what you check when someone asks whether the record can be trusted, not just what it says.",
@@ -804,7 +1005,7 @@ function registerTools(server, client) {
804
1005
  tool(
805
1006
  "get_consent_log",
806
1007
  "Get recent anonymised consent records for a site.",
807
- { ...cbid, ...range, limit: z3.number().optional().describe("Max records to return (default 200).") },
1008
+ { ...cbid, ...range, limit: z4.number().optional().describe("Max records to return (default 200).") },
808
1009
  (a) => client.consent.log(a.cbid, {
809
1010
  from: a.from,
810
1011
  to: a.to,
@@ -814,49 +1015,53 @@ function registerTools(server, client) {
814
1015
  tool(
815
1016
  "get_subject_consent",
816
1017
  "One person's consent records across every site in the org \u2014 web, mobile and desktop \u2014 by the subjectId your apps attach. Consent data: needs the consent:read scope. Read-only.",
817
- { subjectId: z3.string() },
1018
+ { subjectId: z4.string() },
818
1019
  (a) => client.subjects.consent(a.subjectId)
819
1020
  );
820
1021
  tool("list_dsar", "List all Data Subject Access Requests for your organization.", {}, () => client.dsar.list());
821
1022
  tool(
822
1023
  "update_dsar_executor",
823
- "Change a connected system in place \u2014 its profile, address, credential or auto flag. Only what you pass changes; the stored credential is kept unless you give a new one.",
824
- { id: z3.string(), patch: z3.record(z3.unknown()) },
825
- (a) => client.fulfillment.updateExecutor(a.id, a.patch)
1024
+ "Change a connected system in place \u2014 its profile, address, credential or auto flag. Only what you pass changes; the stored credential is kept unless you give a new one. With dryRun, answers the connection as it would be and a diff, and changes nothing.",
1025
+ {
1026
+ id: z4.string(),
1027
+ patch: z4.record(z4.unknown()),
1028
+ dryRun: z4.boolean().optional().describe("Validate and diff without saving.")
1029
+ },
1030
+ (a) => a.dryRun === true ? client.fulfillment.dryRunUpdateExecutor(a.id, a.patch) : client.fulfillment.updateExecutor(a.id, a.patch)
826
1031
  );
827
1032
  tool(
828
1033
  "get_dsar",
829
1034
  "One rights request by id, including its status and the deadline it must be answered by.",
830
- { id: z3.string() },
1035
+ { id: z4.string() },
831
1036
  (a) => client.dsar.get(a.id)
832
1037
  );
833
1038
  tool(
834
1039
  "erase_dsar_subject",
835
1040
  "For a deletion request that is past identity verification: erase the person\u2019s consent records on one site, identified by their consent stamp. Irreversible. The erasure is noted on the request. If the response carries a warning, nothing was cryptographically erased \u2014 tell the user.",
836
- { id: z3.string(), cbid: z3.string(), stamp: z3.string() },
1041
+ { id: z4.string(), cbid: z4.string(), stamp: z4.string() },
837
1042
  (a) => client.dsar.erase(a.id, a.cbid, a.stamp)
838
1043
  );
839
1044
  tool(
840
1045
  "export_dsar_subject",
841
1046
  "For an access or portability request that is past identity verification: the person\u2019s consent records on one site, identified by their consent stamp. The export is noted on the request.",
842
- { id: z3.string(), cbid: z3.string(), stamp: z3.string() },
1047
+ { id: z4.string(), cbid: z4.string(), stamp: z4.string() },
843
1048
  (a) => client.dsar.export(a.id, a.cbid, a.stamp)
844
1049
  );
845
1050
  tool(
846
1051
  "get_dsar_response_notice",
847
1052
  "The subject-facing response notice for a request, as plain text \u2014 what to send the person. Read-only; nothing is sent.",
848
- { id: z3.string() },
1053
+ { id: z4.string() },
849
1054
  (a) => client.dsar.response(a.id)
850
1055
  );
851
1056
  tool(
852
1057
  "create_dsar",
853
1058
  "Open a new Data Subject Access Request.",
854
1059
  {
855
- type: z3.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
856
- subjectEmail: z3.string().describe("The data subject\u2019s email."),
857
- regulation: z3.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
858
- note: z3.string().optional().describe("Optional free-text note."),
859
- test: z3.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
1060
+ type: z4.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
1061
+ subjectEmail: z4.string().describe("The data subject\u2019s email."),
1062
+ regulation: z4.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
1063
+ note: z4.string().optional().describe("Optional free-text note."),
1064
+ test: z4.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
860
1065
  },
861
1066
  (a) => client.dsar.create({
862
1067
  type: a.type,
@@ -866,10 +1071,26 @@ function registerTools(server, client) {
866
1071
  ...a.test === true ? { test: true } : {}
867
1072
  })
868
1073
  );
1074
+ tool(
1075
+ "create_rights_link",
1076
+ "Mint a signed, single-use link to a site\u2019s hosted rights page for a person you know is signed in to that site. On the page their email is filled in and locked and the email-code step is skipped; the filed request is recorded as verified by their account. Give the link only to that person. Expires in 15 minutes by default (max 1 hour). Needs dsar:write.",
1077
+ {
1078
+ cbid: z4.string().describe("Site identifier (cbid). Must belong to your org."),
1079
+ email: z4.string().describe("The signed-in person\u2019s verified email address."),
1080
+ userId: z4.string().optional().describe("Your own account id for them; recorded on the request."),
1081
+ rights: z4.array(z4.enum(["access", "erasure", "rectification", "portability", "restriction", "objection", "opt_out_sale", "opt_out_targeted", "limit_sensitive"])).min(1).optional().describe("Limit the link to these rights. Default: every right the page offers."),
1082
+ ttlSeconds: z4.number().int().min(60).max(3600).optional().describe("How long the link works, in seconds (default 900).")
1083
+ },
1084
+ (a) => client.rightsLinks.create(a.cbid, {
1085
+ subject: { email: a.email, ...typeof a.userId === "string" ? { userId: a.userId } : {} },
1086
+ ...Array.isArray(a.rights) ? { rights: a.rights } : {},
1087
+ ...typeof a.ttlSeconds === "number" ? { ttlSeconds: a.ttlSeconds } : {}
1088
+ })
1089
+ );
869
1090
  tool(
870
1091
  "delete_test_dsar",
871
1092
  "Delete a TEST rights request (one created with test: true), with its tasks and their upstream log. Real requests cannot be deleted and are refused. The deletion is recorded in the audit log.",
872
- { id: z3.string().describe("The test request id.") },
1093
+ { id: z4.string().describe("The test request id.") },
873
1094
  async (a) => {
874
1095
  await client.dsar.delete(a.id);
875
1096
  return { deleted: a.id };
@@ -878,15 +1099,15 @@ function registerTools(server, client) {
878
1099
  tool(
879
1100
  "mark_dsar_test",
880
1101
  "Mark a CLOSED rights request (completed or rejected) as a test request, after the fact \u2014 for trial requests filed before test: true existed. An open request is refused (request_not_closed), so a live obligation can never be relabelled. Recorded in the audit log; afterwards delete_test_dsar can remove it. Returns { request, changed }.",
881
- { id: z3.string().describe("The closed request id.") },
1102
+ { id: z4.string().describe("The closed request id.") },
882
1103
  (a) => client.dsar.markTest(a.id)
883
1104
  );
884
1105
  tool(
885
1106
  "advance_dsar",
886
1107
  "Advance a DSAR to a new status (received \u2192 verifying \u2192 in_progress \u2192 completed, or rejected).",
887
1108
  {
888
- id: z3.string().describe("The DSAR id."),
889
- toStatus: z3.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
1109
+ id: z4.string().describe("The DSAR id."),
1110
+ toStatus: z4.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
890
1111
  },
891
1112
  (a) => client.dsar.advance(a.id, a.toStatus)
892
1113
  );
@@ -899,7 +1120,7 @@ function registerTools(server, client) {
899
1120
  tool(
900
1121
  "get_receipt",
901
1122
  "Fetch the signed consent receipt for a single consent record (by stamp).",
902
- { ...cbid, stamp: z3.string().describe("The consent record stamp/id.") },
1123
+ { ...cbid, stamp: z4.string().describe("The consent record stamp/id.") },
903
1124
  (a) => client.consent.receipt(a.cbid, a.stamp)
904
1125
  );
905
1126
  tool("delete_site", "Delete a site (cbid) and its configuration from your org.", { ...cbid }, async (a) => {
@@ -911,13 +1132,13 @@ function registerTools(server, client) {
911
1132
  "create_vendor",
912
1133
  "Register a vendor (processor) and compute its risk score.",
913
1134
  {
914
- name: z3.string().describe("Vendor name."),
915
- category: z3.string().describe("Vendor category, e.g. analytics."),
916
- dataShared: z3.array(z3.string()).describe("Categories of data shared with the vendor."),
917
- dpaSigned: z3.boolean().describe("Whether a Data Processing Agreement is signed."),
918
- subprocessors: z3.number().describe("Number of subprocessors."),
919
- certifications: z3.array(z3.string()).describe("Compliance certifications, e.g. ISO27001."),
920
- region: z3.string().describe("Primary processing region, e.g. EU.")
1135
+ name: z4.string().describe("Vendor name."),
1136
+ category: z4.string().describe("Vendor category, e.g. analytics."),
1137
+ dataShared: z4.array(z4.string()).describe("Categories of data shared with the vendor."),
1138
+ dpaSigned: z4.boolean().describe("Whether a Data Processing Agreement is signed."),
1139
+ subprocessors: z4.number().describe("Number of subprocessors."),
1140
+ certifications: z4.array(z4.string()).describe("Compliance certifications, e.g. ISO27001."),
1141
+ region: z4.string().describe("Primary processing region, e.g. EU.")
921
1142
  },
922
1143
  (a) => client.vendors.create({
923
1144
  name: a.name,
@@ -935,13 +1156,13 @@ function registerTools(server, client) {
935
1156
  "create_ropa",
936
1157
  "Create a Record of Processing Activity (RoPA) entry.",
937
1158
  {
938
- name: z3.string().describe("Activity name."),
939
- purpose: z3.string().describe("Purpose of processing."),
940
- legalBasis: z3.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
941
- dataCategories: z3.array(z3.string()).describe("Categories of personal data."),
942
- recipients: z3.array(z3.string()).describe("Recipients of the data."),
943
- retentionDays: z3.number().describe("Retention period in days."),
944
- crossBorderTransfer: z3.boolean().describe("Whether data is transferred across borders.")
1159
+ name: z4.string().describe("Activity name."),
1160
+ purpose: z4.string().describe("Purpose of processing."),
1161
+ legalBasis: z4.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
1162
+ dataCategories: z4.array(z4.string()).describe("Categories of personal data."),
1163
+ recipients: z4.array(z4.string()).describe("Recipients of the data."),
1164
+ retentionDays: z4.number().describe("Retention period in days."),
1165
+ crossBorderTransfer: z4.boolean().describe("Whether data is transferred across borders.")
945
1166
  },
946
1167
  (a) => client.ropa.create({
947
1168
  name: a.name,
@@ -961,15 +1182,23 @@ function registerTools(server, client) {
961
1182
  );
962
1183
  tool(
963
1184
  "scan_site",
964
- "Trigger a cookie scan for a site. Returns the scan job state.",
965
- { ...cbid },
966
- (a) => client.sites.scan(a.cbid)
1185
+ "Trigger a cookie crawl of a site (at most 90 s). Returns its scanId and state (queued). With wait: true, returns once it is done or failed \u2014 state, cookieCount, pagesVisited, durationMs, error. The stored list keeps cookies earlier crawls and real visits found; retire one the site no longer sets.",
1186
+ { ...cbid, wait: z4.boolean().optional().describe("Wait for the scan to finish (up to 100 s) and return its outcome.") },
1187
+ async (a) => {
1188
+ let started;
1189
+ try {
1190
+ started = await client.sites.scan(a.cbid);
1191
+ } catch (err) {
1192
+ if (!a.wait || err.status !== 409) throw err;
1193
+ }
1194
+ return a.wait ? client.sites.waitForScan(a.cbid, { timeoutMs: 1e5 }) : started;
1195
+ }
967
1196
  );
968
1197
  tool(
969
1198
  "get_scan_status",
970
- "Get the status/result of a site\u2019s most recent cookie scan.",
971
- { ...cbid },
972
- (a) => client.sites.scanStatus(a.cbid)
1199
+ "Get a site\u2019s last cookie scan: state (queued, scanning, done, failed), scanId, durationMs, cookieCount, pagesVisited and error when it failed.",
1200
+ { ...cbid, wait: z4.number().min(0).max(60).optional().describe("Seconds (\u226460) to wait for a running scan to settle before answering.") },
1201
+ (a) => a.wait !== void 0 ? client.sites.scanStatus(a.cbid, { wait: a.wait }) : client.sites.scanStatus(a.cbid)
973
1202
  );
974
1203
  tool(
975
1204
  "get_ab_results",
@@ -987,9 +1216,9 @@ function registerTools(server, client) {
987
1216
  "create_webhook",
988
1217
  "Create a webhook subscription. The response includes the signing secret (shown once).",
989
1218
  {
990
- url: z3.string().describe("HTTPS endpoint to deliver events to."),
991
- events: z3.array(z3.string()).describe("Event names to subscribe to, e.g. consent.created."),
992
- cbid: z3.string().optional().describe("Optional site cbid to scope the subscription to.")
1219
+ url: z4.string().describe("HTTPS endpoint to deliver events to."),
1220
+ events: z4.array(z4.string()).describe("Event names to subscribe to, e.g. consent.created."),
1221
+ cbid: z4.string().optional().describe("Optional site cbid to scope the subscription to.")
993
1222
  },
994
1223
  (a) => client.webhooks.create({
995
1224
  url: a.url,
@@ -1000,13 +1229,13 @@ function registerTools(server, client) {
1000
1229
  tool(
1001
1230
  "roll_webhook_secret",
1002
1231
  "Rotate a webhook subscription\u2019s signing secret. The new secret is returned once; the receiving endpoint must be updated to verify with it.",
1003
- { id: z3.string() },
1232
+ { id: z4.string() },
1004
1233
  (a) => client.webhooks.rollSecret(a.id)
1005
1234
  );
1006
1235
  tool(
1007
1236
  "test_webhook",
1008
1237
  "Send a signed test event to a webhook subscription now, and report what the endpoint answered.",
1009
- { id: z3.string() },
1238
+ { id: z4.string() },
1010
1239
  (a) => client.webhooks.test(a.id)
1011
1240
  );
1012
1241
  tool(
@@ -1018,18 +1247,18 @@ function registerTools(server, client) {
1018
1247
  tool(
1019
1248
  "replay_webhook_dead_letter",
1020
1249
  "Deliver a dead-lettered webhook event again, to the subscription as it is now.",
1021
- { id: z3.string() },
1250
+ { id: z4.string() },
1022
1251
  (a) => client.webhooks.replayDeadLetter(a.id)
1023
1252
  );
1024
1253
  tool(
1025
1254
  "update_webhook",
1026
1255
  "Change a webhook subscription, or pause it with active:false (delivery stops; the subscription is kept). Only the fields given change. cbid: null widens it to every property in the org.",
1027
1256
  {
1028
- id: z3.string(),
1029
- url: z3.string().optional(),
1030
- events: z3.array(z3.string()).optional(),
1031
- cbid: z3.string().nullable().optional(),
1032
- active: z3.boolean().optional()
1257
+ id: z4.string(),
1258
+ url: z4.string().optional(),
1259
+ events: z4.array(z4.string()).optional(),
1260
+ cbid: z4.string().nullable().optional(),
1261
+ active: z4.boolean().optional()
1033
1262
  },
1034
1263
  (a) => client.webhooks.update(a.id, {
1035
1264
  ...a.url !== void 0 ? { url: a.url } : {},
@@ -1038,20 +1267,20 @@ function registerTools(server, client) {
1038
1267
  ...a.active !== void 0 ? { active: a.active } : {}
1039
1268
  })
1040
1269
  );
1041
- tool("delete_webhook", "Delete a webhook subscription by id.", { id: z3.string().describe("The webhook subscription id.") }, async (a) => {
1270
+ tool("delete_webhook", "Delete a webhook subscription by id.", { id: z4.string().describe("The webhook subscription id.") }, async (a) => {
1042
1271
  await client.webhooks.delete(a.id);
1043
1272
  return { ok: true };
1044
1273
  });
1045
1274
  tool(
1046
1275
  "verify_site",
1047
1276
  "Verify that your organization controls a domain by one of three challenge methods (dns / meta / file). Required to unlock consent export and signed receipts.",
1048
- { ...cbid, method: z3.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1277
+ { ...cbid, method: z4.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1049
1278
  (a) => client.sites.verify(a.cbid, a.method)
1050
1279
  );
1051
1280
  tool(
1052
1281
  "get_verification_challenge",
1053
1282
  "Exactly what to publish to prove control of a site\u2019s domain: the DNS TXT record, the meta tag, the file, or installing the embed. Read-only \u2014 publish one, then call verify_site.",
1054
- { cbid: z3.string() },
1283
+ { cbid: z4.string() },
1055
1284
  (a) => client.sites.verifyChallenge(a.cbid)
1056
1285
  );
1057
1286
  tool(
@@ -1063,15 +1292,15 @@ function registerTools(server, client) {
1063
1292
  tool(
1064
1293
  "get_flow",
1065
1294
  "Get the v2 banner flow config for a site, including current views, categories, and any lint issues.",
1066
- { cbid: z3.string().describe("Site identifier (cbid).") },
1295
+ { cbid: z4.string().describe("Site identifier (cbid).") },
1067
1296
  (a) => client.sites.getFlow(a.cbid)
1068
1297
  );
1069
1298
  tool(
1070
1299
  "edit_flow",
1071
1300
  "Apply a batch of structured edit operations to a site's v2 banner flow. All ops are validated server-side and the final config must be lint-clean before it is saved.",
1072
1301
  {
1073
- cbid: z3.string().describe("Site identifier (cbid)."),
1074
- operations: z3.array(z3.record(z3.unknown())).describe(
1302
+ cbid: z4.string().describe("Site identifier (cbid)."),
1303
+ operations: z4.array(z4.record(z4.unknown())).describe(
1075
1304
  'Ordered list of ops. Each must have an "op" field: addView | removeView | addElement | setButtonTransition | addCustomCategory.'
1076
1305
  )
1077
1306
  },
@@ -1081,19 +1310,21 @@ function registerTools(server, client) {
1081
1310
  "set_flow",
1082
1311
  "Wholesale replace a site's v2 banner flow with a complete config (e.g. from a template). Validated server-side before it is saved.",
1083
1312
  {
1084
- cbid: z3.string().describe("Site identifier (cbid)."),
1085
- config: z3.record(z3.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1313
+ cbid: z4.string().describe("Site identifier (cbid)."),
1314
+ config: z4.record(z4.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1086
1315
  },
1087
1316
  (a) => client.sites.setFlow(a.cbid, a.config)
1088
1317
  );
1089
1318
  registerConfigTools(tool, client);
1090
1319
  registerPlatformTools(tool, client);
1320
+ registerRightsTools(tool, client);
1321
+ registerRightsPageTools(tool, client);
1091
1322
  tool(
1092
1323
  "invite_member",
1093
1324
  "Invite a person to your organization by email. role must be admin, member, or viewer. The org is derived from the API key \u2014 you cannot invite into a different org.",
1094
1325
  {
1095
- email: z3.string().describe("Email address of the person to invite."),
1096
- role: z3.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
1326
+ email: z4.string().describe("Email address of the person to invite."),
1327
+ role: z4.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
1097
1328
  },
1098
1329
  (a) => client.members.invite(a.email, a.role)
1099
1330
  );
@@ -1101,8 +1332,8 @@ function registerTools(server, client) {
1101
1332
  "set_member_role",
1102
1333
  "Change the role of a member in your organization. The org owner's role cannot be changed.",
1103
1334
  {
1104
- userId: z3.string().describe("The userId of the member whose role to change."),
1105
- role: z3.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
1335
+ userId: z4.string().describe("The userId of the member whose role to change."),
1336
+ role: z4.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
1106
1337
  },
1107
1338
  (a) => client.members.setRole(a.userId, a.role)
1108
1339
  );
@@ -1110,7 +1341,7 @@ function registerTools(server, client) {
1110
1341
  "remove_member",
1111
1342
  "Remove a member from your organization. The org owner cannot be removed.",
1112
1343
  {
1113
- userId: z3.string().describe("The userId of the member to remove.")
1344
+ userId: z4.string().describe("The userId of the member to remove.")
1114
1345
  },
1115
1346
  async (a) => {
1116
1347
  await client.members.remove(a.userId);
@@ -1121,11 +1352,11 @@ function registerTools(server, client) {
1121
1352
  "create_brand_kit",
1122
1353
  "Create a reusable brand kit (colors, logo, typography) for your organization's consent banners.",
1123
1354
  {
1124
- name: z3.string().describe("Display name for the brand kit."),
1125
- theme: z3.record(z3.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
1126
- content: z3.record(z3.unknown()).optional().describe("Optional banner copy overrides."),
1127
- logoUrl: z3.string().optional().describe("Optional URL for your org logo."),
1128
- customCss: z3.string().optional().describe("Optional custom CSS string to inject into the banner.")
1355
+ name: z4.string().describe("Display name for the brand kit."),
1356
+ theme: z4.record(z4.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
1357
+ content: z4.record(z4.unknown()).optional().describe("Optional banner copy overrides."),
1358
+ logoUrl: z4.string().optional().describe("Optional URL for your org logo."),
1359
+ customCss: z4.string().optional().describe("Optional custom CSS string to inject into the banner.")
1129
1360
  },
1130
1361
  (a) => client.brandKits.create({
1131
1362
  name: a.name,
@@ -1139,7 +1370,7 @@ function registerTools(server, client) {
1139
1370
  "delete_brand_kit",
1140
1371
  "Delete a brand kit by id. The kit must belong to your organization (cross-org deletes are rejected).",
1141
1372
  {
1142
- id: z3.string().describe("The brand kit id to delete.")
1373
+ id: z4.string().describe("The brand kit id to delete.")
1143
1374
  },
1144
1375
  async (a) => {
1145
1376
  await client.brandKits.delete(a.id);
@@ -1150,25 +1381,25 @@ function registerTools(server, client) {
1150
1381
  "save_preference",
1151
1382
  "Save or update the consent preferences for an end-user (by subjectId) within your organization. purposes is a map of purpose-name \u2192 boolean.",
1152
1383
  {
1153
- subjectId: z3.string().describe("The end-user identifier (e.g. email or internal user id)."),
1154
- purposes: z3.record(z3.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
1384
+ subjectId: z4.string().describe("The end-user identifier (e.g. email or internal user id)."),
1385
+ purposes: z4.record(z4.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
1155
1386
  },
1156
1387
  (a) => client.preferences.save(a.subjectId, a.purposes)
1157
1388
  );
1158
1389
  tool(
1159
1390
  "get_preference",
1160
1391
  "One end-user\u2019s saved preferences, by subjectId. Read-only.",
1161
- { subjectId: z3.string() },
1392
+ { subjectId: z4.string() },
1162
1393
  (a) => client.preferences.get(a.subjectId)
1163
1394
  );
1164
1395
  tool(
1165
1396
  "issue_api_key",
1166
1397
  "Issue a new API key. The secret is returned once and never again. Prefer the least privilege the job needs: `scopes` limits what it can do, `cbids` locks it to specific sites (it then cannot reach anything org-wide), `expiresInDays` retires it. Omitting all three mints a full-access, org-wide, non-expiring key.",
1167
1398
  {
1168
- name: z3.string().optional(),
1169
- scopes: z3.array(z3.string()).optional(),
1170
- cbids: z3.array(z3.string()).min(1).optional(),
1171
- expiresInDays: z3.number().int().min(1).max(3650).optional()
1399
+ name: z4.string().optional(),
1400
+ scopes: z4.array(z4.string()).optional(),
1401
+ cbids: z4.array(z4.string()).min(1).optional(),
1402
+ expiresInDays: z4.number().int().min(1).max(3650).optional()
1172
1403
  },
1173
1404
  (a) => client.keys.issue({
1174
1405
  ...a.name ? { name: a.name } : {},
@@ -1177,74 +1408,105 @@ function registerTools(server, client) {
1177
1408
  ...a.expiresInDays !== void 0 ? { expiresInDays: a.expiresInDays } : {}
1178
1409
  })
1179
1410
  );
1180
- tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: z3.string() }, async (a) => {
1411
+ tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: z4.string() }, async (a) => {
1181
1412
  await client.keys.revoke(a.prefix);
1182
1413
  return { revoked: a.prefix };
1183
1414
  });
1184
1415
  tool(
1185
1416
  "import_cookie_declaration",
1186
1417
  "Read a cookie declaration exported from another CMP (OneTrust, Cookiebot, CookieYes, or any CSV/JSON with the same columns) and translate its categories into ours. Nothing is applied \u2014 it comes back for review, with the rows whose category could not be placed listed separately.",
1187
- { cbid: z3.string(), data: z3.string().describe("The exported file, as text (CSV or JSON).") },
1418
+ { cbid: z4.string(), data: z4.string().describe("The exported file, as text (CSV or JSON).") },
1188
1419
  (a) => client.sites.importDeclaration(a.cbid, a.data)
1189
1420
  );
1190
1421
  tool(
1191
1422
  "apply_cookie_import",
1192
1423
  "Import a cookie declaration exported from another CMP AND declare it: every row whose category mapped to ours and that has a purpose becomes a site declaration; the rest come back in `skipped` with the reason. Cookies the site already declared are kept unless overwrite is true. Prefer import_cookie_declaration first to review.",
1193
- { cbid: z3.string(), data: z3.string().describe("The exported file, as text (CSV or JSON)."), overwrite: z3.boolean().optional() },
1424
+ { cbid: z4.string(), data: z4.string().describe("The exported file, as text (CSV or JSON)."), overwrite: z4.boolean().optional() },
1194
1425
  (a) => client.sites.applyImport(a.cbid, a.data, a.overwrite ? { overwrite: true } : void 0)
1195
1426
  );
1196
1427
  const declarationShape = {
1197
- category: z3.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
1198
- purpose: z3.string().describe("What the cookie does, as visitors will read it."),
1199
- provider: z3.string().optional(),
1200
- expiry: z3.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
1201
- domain: z3.string().optional(),
1202
- pattern: z3.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
1428
+ category: z4.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
1429
+ purpose: z4.string().describe("What the cookie does, as visitors will read it \u2014 and the fallback for any language purposes lacks."),
1430
+ purposes: z4.record(z4.string(), z4.string().max(1e3)).nullable().optional().describe('The purpose in other languages, keyed by BCP-47 tag: {"es": "\u2026", "pt-BR": "\u2026"}. The banner, data-cc="declaration" and cookie-declaration.js draw the visitor\u2019s language. null clears.'),
1431
+ provider: z4.string().optional(),
1432
+ expiry: z4.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
1433
+ domain: z4.string().optional(),
1434
+ pattern: z4.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
1203
1435
  };
1436
+ const dryRunArg = z4.boolean().optional().describe("Store nothing: answer with the would-be declarations and a diff (added / removed / changed) to check first.");
1204
1437
  tool(
1205
1438
  "declare_cookie",
1206
1439
  'Declare what one of the site\u2019s cookies is. Overrides the scanner, observed visits and the cookie database everywhere the declaration is shown (API, preference modal, data-cc="declaration"). Use for the site\u2019s own cookies the database cannot know. A name ending in * covers every cookie with that prefix.',
1207
- { cbid: z3.string(), name: z3.string(), ...declarationShape },
1440
+ { cbid: z4.string(), name: z4.string(), ...declarationShape, dryRun: dryRunArg },
1208
1441
  (a) => {
1209
- const { cbid: cbid2, name, ...rest } = a;
1210
- return client.sites.declareCookie(cbid2, name, rest);
1442
+ const { cbid: cbid2, name, dryRun, ...rest } = a;
1443
+ return client.sites.declareCookie(cbid2, name, rest, dryRun ? { dryRun: true } : void 0);
1211
1444
  }
1212
1445
  );
1213
1446
  tool(
1214
1447
  "declare_cookies",
1215
1448
  "Declare many cookies at once. All-or-nothing: one invalid item refuses the whole request and nothing is saved. replace: true also removes every declaration the list does not name.",
1216
- { cbid: z3.string(), cookies: z3.array(z3.object({ name: z3.string(), ...declarationShape })).max(500), replace: z3.boolean().optional() },
1217
- (a) => client.sites.declareCookies(a.cbid, a.cookies, a.replace ? { replace: true } : void 0)
1449
+ { cbid: z4.string(), cookies: z4.array(z4.object({ name: z4.string(), ...declarationShape })).max(500), replace: z4.boolean().optional(), dryRun: dryRunArg },
1450
+ (a) => {
1451
+ const o = { ...a.replace ? { replace: true } : {}, ...a.dryRun ? { dryRun: true } : {} };
1452
+ return client.sites.declareCookies(a.cbid, a.cookies, Object.keys(o).length ? o : void 0);
1453
+ }
1218
1454
  );
1219
1455
  tool(
1220
1456
  "undeclare_cookie",
1221
1457
  "Remove a cookie declaration; the scanned/observed classification applies again.",
1222
- { cbid: z3.string(), name: z3.string() },
1458
+ { cbid: z4.string(), name: z4.string(), dryRun: dryRunArg },
1223
1459
  async (a) => {
1460
+ if (a.dryRun) return client.sites.undeclareCookie(a.cbid, a.name, { dryRun: true });
1224
1461
  await client.sites.undeclareCookie(a.cbid, a.name);
1225
1462
  return { undeclared: a.name };
1226
1463
  }
1227
1464
  );
1465
+ tool(
1466
+ "retire_cookie",
1467
+ 'Retire a cookie the site renamed or stopped setting: it leaves the banner\u2019s cookie list, data-cc="declaration" and the public feed, and stays listed for the owner with retired. A name ending in * retires every cookie with that prefix; the name must match a scanned, observed or declared cookie. If a crawl or a real visit sees it again afterwards, it is listed again with review: retired_but_seen.',
1468
+ {
1469
+ cbid: z4.string(),
1470
+ name: z4.string(),
1471
+ renamedTo: z4.string().max(256).optional().describe("The cookie\u2019s new name, if it was renamed."),
1472
+ note: z4.string().max(1e3).optional(),
1473
+ dryRun: z4.boolean().optional().describe("Store nothing: answer with the would-be retirement and list to check first.")
1474
+ },
1475
+ (a) => {
1476
+ const input = { ...a.renamedTo ? { renamedTo: a.renamedTo } : {}, ...a.note ? { note: a.note } : {} };
1477
+ return client.sites.retireCookie(a.cbid, a.name, input, a.dryRun ? { dryRun: true } : void 0);
1478
+ }
1479
+ );
1480
+ tool(
1481
+ "unretire_cookie",
1482
+ "Un-retire a cookie: it is listed again everywhere.",
1483
+ { cbid: z4.string(), name: z4.string(), dryRun: z4.boolean().optional().describe("Store nothing: answer with what the list would be.") },
1484
+ async (a) => {
1485
+ if (a.dryRun) return client.sites.unretireCookie(a.cbid, a.name, { dryRun: true });
1486
+ await client.sites.unretireCookie(a.cbid, a.name);
1487
+ return { unretired: a.name };
1488
+ }
1489
+ );
1228
1490
  tool(
1229
1491
  "get_blocked_pages",
1230
1492
  "Pages where the embed could not load its banner renderer \u2014 the page\u2019s Content Security Policy or Trusted Types policy refused it, so nobody there can be asked for consent. An empty list is healthy. Read-only.",
1231
- { cbid: z3.string() },
1493
+ { cbid: z4.string() },
1232
1494
  (a) => client.sites.blocked(a.cbid)
1233
1495
  );
1234
1496
  tool(
1235
1497
  "roll_api_key",
1236
1498
  "Rotate an API key: returns a new secret once, with the same name, scopes, property lock and expiry. The old secret stops working immediately \u2014 if it is the key this server runs with, this server stops working too until it is reconfigured.",
1237
- { prefix: z3.string() },
1499
+ { prefix: z4.string() },
1238
1500
  (a) => client.keys.roll(a.prefix)
1239
1501
  );
1240
1502
  tool(
1241
1503
  "update_api_key",
1242
1504
  "Rename an API key, or replace its scopes or the properties it is locked to. Only the fields given change; the secret does not.",
1243
1505
  {
1244
- prefix: z3.string(),
1245
- name: z3.string().optional(),
1246
- scopes: z3.array(z3.string()).optional(),
1247
- cbids: z3.array(z3.string()).min(1).optional()
1506
+ prefix: z4.string(),
1507
+ name: z4.string().optional(),
1508
+ scopes: z4.array(z4.string()).optional(),
1509
+ cbids: z4.array(z4.string()).min(1).optional()
1248
1510
  },
1249
1511
  (a) => client.keys.update(a.prefix, {
1250
1512
  ...a.name !== void 0 ? { name: a.name } : {},
@@ -1256,31 +1518,170 @@ function registerTools(server, client) {
1256
1518
  tool(
1257
1519
  "update_org",
1258
1520
  "Rename your organisation or set its logo. logoUrl: null removes the logo; upload an image with upload_asset to get a URL. Deleting the organisation is not possible here.",
1259
- { name: z3.string().min(1).optional(), logoUrl: z3.string().nullable().optional() },
1521
+ { name: z4.string().min(1).optional(), logoUrl: z4.string().nullable().optional() },
1260
1522
  (a) => client.org.update({
1261
1523
  ...a.name !== void 0 ? { name: a.name } : {},
1262
1524
  ...a.logoUrl !== void 0 ? { logoUrl: a.logoUrl } : {}
1263
1525
  })
1264
1526
  );
1527
+ tool(
1528
+ "get_mail_provider",
1529
+ "Your own mail provider for rights-request mail (verification codes and other privacy-request mail), if any. Never returns the credential, only its last four characters. `sender` says whether verification codes are mailed through it now (own) or not at all (none) \u2014 there is no shared sender. Read-only.",
1530
+ {},
1531
+ () => client.org.mailProvider.get()
1532
+ );
1533
+ tool(
1534
+ "set_mail_provider",
1535
+ "Connect your own mail provider for rights-request mail \u2014 recommended, so codes come from your own domain. Replaces the stored one. It carries mail only after test_mail_provider succeeds; every save clears that. Omit secret to keep the stored one (same provider only).",
1536
+ {
1537
+ provider: z4.enum(["brevo", "sendgrid", "postmark", "resend", "ses", "smtp"]),
1538
+ fromEmail: z4.string().describe("An address on a domain your provider has verified."),
1539
+ fromName: z4.string().max(100).nullable().optional(),
1540
+ replyTo: z4.string().nullable().optional(),
1541
+ secret: z4.string().optional().describe("API key (Brevo, SendGrid, Resend), server token (Postmark), secret access key (SES) or SMTP password. Write-only."),
1542
+ ses: z4.object({ region: z4.string(), accessKeyId: z4.string() }).optional().describe("Required for ses."),
1543
+ smtp: z4.object({ host: z4.string(), port: z4.union([z4.literal(25), z4.literal(465), z4.literal(587), z4.literal(2525)]), security: z4.enum(["tls", "starttls"]), username: z4.string() }).optional().describe("Required for smtp. TLS is always required.")
1544
+ },
1545
+ (a) => client.org.mailProvider.set(a)
1546
+ );
1547
+ tool(
1548
+ "test_mail_provider",
1549
+ "Send a test message through your own mail provider (never Cookie Munch\u2019s) and report what it answered. Success marks the configuration verified, after which it carries all rights mail.",
1550
+ { to: z4.string().optional().describe("Recipient. Default: the reply-to, else the from address.") },
1551
+ (a) => client.org.mailProvider.test(a.to)
1552
+ );
1553
+ tool(
1554
+ "remove_mail_provider",
1555
+ "Remove your own mail provider. Rights mail goes back to Cookie Munch\u2019s shared sender, labelled as sending on your site\u2019s behalf.",
1556
+ {},
1557
+ async () => {
1558
+ await client.org.mailProvider.remove();
1559
+ return { removed: true };
1560
+ }
1561
+ );
1562
+ const CAPTCHA_OFF = "Off removes spam protection beyond the hidden spam-trap field, the rate limits and the email code: expect more spam requests. Own keys are recommended.";
1563
+ const captchaInput = {
1564
+ mode: z4.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
1565
+ provider: z4.enum(["turnstile", "hcaptcha", "recaptcha_v2", "recaptcha_v3"]).optional().describe("Required for own."),
1566
+ siteKey: z4.string().optional().describe("Required for own: the public site key. List your rights-page hostnames on it at the provider."),
1567
+ secret: z4.string().optional().describe("The provider secret key. Write-only; never returned. Omit to keep the stored one (same provider)."),
1568
+ minScore: z4.number().min(0.1).max(0.9).optional().describe("reCAPTCHA v3 only. Default 0.5.")
1569
+ };
1570
+ const captchaBody = (a) => ({
1571
+ mode: a.mode,
1572
+ ...a.provider !== void 0 ? { provider: a.provider } : {},
1573
+ ...a.siteKey !== void 0 ? { siteKey: a.siteKey } : {},
1574
+ ...a.secret !== void 0 ? { secret: a.secret } : {},
1575
+ ...a.minScore !== void 0 ? { minScore: a.minScore } : {}
1576
+ });
1577
+ tool(
1578
+ "get_rights_captcha",
1579
+ "The captcha on a site\u2019s hosted rights page: its own setting, else the organisation default, else off (`source` says which). Never returns the secret. Read-only.",
1580
+ { cbid: z4.string() },
1581
+ (a) => client.rightsCaptcha.get(a.cbid)
1582
+ );
1583
+ tool(
1584
+ "set_rights_captcha",
1585
+ `Set a site\u2019s rights-page captcha: your own Turnstile, hCaptcha or reCAPTCHA keys (recommended; the provider must accept the secret before it is saved), or off. ${CAPTCHA_OFF} Audited with the old and new mode.`,
1586
+ { cbid: z4.string(), ...captchaInput },
1587
+ (a) => client.rightsCaptcha.set(a.cbid, captchaBody(a))
1588
+ );
1589
+ tool(
1590
+ "remove_rights_captcha",
1591
+ "Remove a site\u2019s own captcha setting: it inherits the organisation default again (or off). Returns the setting now in force.",
1592
+ { cbid: z4.string() },
1593
+ (a) => client.rightsCaptcha.remove(a.cbid)
1594
+ );
1595
+ tool(
1596
+ "get_rights_captcha_default",
1597
+ "The organisation default captcha for its rights pages, used by every site without its own setting. Never returns the secret. Read-only.",
1598
+ {},
1599
+ () => client.org.rightsCaptcha.get()
1600
+ );
1601
+ tool(
1602
+ "set_rights_captcha_default",
1603
+ `Set the organisation default captcha for its rights pages: your own keys (recommended) or off. ${CAPTCHA_OFF}`,
1604
+ captchaInput,
1605
+ (a) => client.org.rightsCaptcha.set(captchaBody(a))
1606
+ );
1607
+ tool(
1608
+ "remove_rights_captcha_default",
1609
+ "Remove the organisation default: sites without their own setting then have no captcha. Returns the setting now in force.",
1610
+ {},
1611
+ () => client.org.rightsCaptcha.remove()
1612
+ );
1613
+ const IDENTITY_NOTE = "The JWKS is fetched and checked before anything is saved. The session token must carry the email and a verified-email claim (default email_verified) set to true (Clerk: add email: {{user.primary_email_address}} to the session token; Clerk documents no claim for whether that address is verified, so either add your own or set trustEmailClaim). oidc_jwt needs an audience or authorizedParties.";
1614
+ const identityInput = {
1615
+ type: z4.enum(["clerk", "atlas", "oidc_jwt"]).describe("clerk, atlas (Clerk-shaped), or oidc_jwt (any issuer that signs session JWTs with a published JWKS)."),
1616
+ issuer: z4.string().describe("https URL exactly as in the token\u2019s iss (Clerk: your Frontend API URL)."),
1617
+ jwksUrl: z4.string().optional().describe("Required for oidc_jwt; clerk/atlas default to <issuer>/.well-known/jwks.json."),
1618
+ audience: z4.string().optional().describe("Expected aud. For oidc_jwt an audience or authorizedParties is required (a shared issuer mints tokens for every app)."),
1619
+ authorizedParties: z4.array(z4.string()).optional().describe("Your own origins (https://www.example.com) the token\u2019s azp must be one of. Required for clerk and atlas; for oidc_jwt when there is no audience."),
1620
+ emailClaim: z4.string().optional().describe("Default email."),
1621
+ emailVerifiedClaim: z4.string().optional().describe("Default email_verified; must be exactly true."),
1622
+ sessionCookieName: z4.string().optional().describe("Default __session: the cookie the hosted page on your custom domain reads."),
1623
+ trustEmailClaim: z4.boolean().optional().describe("clerk/atlas only, default false. True: a token without the verified claim is accepted, its email claim taken as verified. Set only if every address your provider puts in that claim is verified.")
1624
+ };
1625
+ const identityBody = (a) => {
1626
+ const out = { type: a.type, issuer: a.issuer };
1627
+ for (const k of ["jwksUrl", "audience", "authorizedParties", "emailClaim", "emailVerifiedClaim", "sessionCookieName", "trustEmailClaim"]) if (a[k] !== void 0) out[k] = a[k];
1628
+ return out;
1629
+ };
1630
+ tool(
1631
+ "get_rights_identity",
1632
+ "The sign-in provider a site\u2019s rights requests are verified with: its own setting, else the organisation default, else none (`source` says which). Read-only.",
1633
+ { cbid: z4.string() },
1634
+ (a) => client.rightsIdentity.get(a.cbid)
1635
+ );
1636
+ tool(
1637
+ "set_rights_identity",
1638
+ `Connect a site\u2019s sign-in provider so a visitor signed in to the site is verified by their session, with no code mail. ${IDENTITY_NOTE} Audited.`,
1639
+ { cbid: z4.string(), ...identityInput },
1640
+ (a) => client.rightsIdentity.set(a.cbid, identityBody(a))
1641
+ );
1642
+ tool(
1643
+ "remove_rights_identity",
1644
+ "Remove a site\u2019s own sign-in provider: it inherits the organisation default again (or none). Returns the setting now in force.",
1645
+ { cbid: z4.string() },
1646
+ (a) => client.rightsIdentity.remove(a.cbid)
1647
+ );
1648
+ tool(
1649
+ "get_rights_identity_default",
1650
+ "The organisation default sign-in provider for its rights requests, used by every site without its own. Read-only.",
1651
+ {},
1652
+ () => client.org.rightsIdentity.get()
1653
+ );
1654
+ tool(
1655
+ "set_rights_identity_default",
1656
+ `Set the organisation default sign-in provider for its rights requests. ${IDENTITY_NOTE}`,
1657
+ identityInput,
1658
+ (a) => client.org.rightsIdentity.set(identityBody(a))
1659
+ );
1660
+ tool(
1661
+ "remove_rights_identity_default",
1662
+ "Remove the organisation default sign-in provider. Returns the setting now in force.",
1663
+ {},
1664
+ () => client.org.rightsIdentity.remove()
1665
+ );
1265
1666
  tool(
1266
1667
  "get_audit_log",
1267
1668
  "The organisation\u2019s audit log, newest first: administrative changes made in the dashboard or through the API, and who made them. Read-only.",
1268
- { limit: z3.number().int().min(1).max(500).optional() },
1669
+ { limit: z4.number().int().min(1).max(500).optional() },
1269
1670
  (a) => client.audit(a.limit)
1270
1671
  );
1271
1672
  tool(
1272
1673
  "upload_asset",
1273
1674
  "Upload an image \u2014 a banner logo \u2014 and get its public URL. data is base64 (a data: URL also works); PNG, JPEG, WebP, GIF or SVG, up to 1,000,000 bytes.",
1274
1675
  {
1275
- data: z3.string(),
1276
- contentType: z3.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1676
+ data: z4.string(),
1677
+ contentType: z4.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1277
1678
  },
1278
1679
  (a) => client.assets.upload({ data: a.data, contentType: a.contentType })
1279
1680
  );
1280
1681
  tool(
1281
1682
  "delete_asset",
1282
1683
  "Delete a stored image by its URL (or file name). Only your own organisation\u2019s images can be named.",
1283
- { url: z3.string().describe("The URL upload_asset returned, or just its file name.") },
1684
+ { url: z4.string().describe("The URL upload_asset returned, or just its file name.") },
1284
1685
  async (a) => {
1285
1686
  await client.assets.delete(a.url);
1286
1687
  return { deleted: a.url };
@@ -1295,18 +1696,18 @@ function registerTools(server, client) {
1295
1696
  tool(
1296
1697
  "get_customer",
1297
1698
  "One child org: its controller details and usage. Read-only.",
1298
- { id: z3.string() },
1699
+ { id: z4.string() },
1299
1700
  (a) => client.reseller.get(a.id)
1300
1701
  );
1301
1702
  tool(
1302
1703
  "provision_customer",
1303
1704
  "Create a new child org under this reseller. With `mintKey`, its first API key is returned once. Counts toward the reseller plan\u2019s pooled limits.",
1304
1705
  {
1305
- name: z3.string(),
1306
- ownerEmail: z3.string().optional(),
1307
- delegatedAccess: z3.boolean().optional().describe("Whether this reseller may act inside the child."),
1308
- mintKey: z3.boolean().optional(),
1309
- keyScopes: z3.array(z3.string()).optional()
1706
+ name: z4.string(),
1707
+ ownerEmail: z4.string().optional(),
1708
+ delegatedAccess: z4.boolean().optional().describe("Whether this reseller may act inside the child."),
1709
+ mintKey: z4.boolean().optional(),
1710
+ keyScopes: z4.array(z4.string()).optional()
1310
1711
  },
1311
1712
  (a) => client.reseller.create({
1312
1713
  name: a.name,
@@ -1320,10 +1721,10 @@ function registerTools(server, client) {
1320
1721
  "update_customer",
1321
1722
  "Change a child org\u2019s status, delegated access or DSAR routing. `dsarRouting: null` clears the override.",
1322
1723
  {
1323
- id: z3.string(),
1324
- status: z3.enum(["active", "suspended"]).optional(),
1325
- delegatedAccess: z3.boolean().optional(),
1326
- dsarRouting: z3.enum(["reseller", "child"]).nullable().optional()
1724
+ id: z4.string(),
1725
+ status: z4.enum(["active", "suspended"]).optional(),
1726
+ delegatedAccess: z4.boolean().optional(),
1727
+ dsarRouting: z4.enum(["reseller", "child"]).nullable().optional()
1327
1728
  },
1328
1729
  (a) => client.reseller.update(a.id, {
1329
1730
  ...a.status ? { status: a.status } : {},
@@ -1334,7 +1735,7 @@ function registerTools(server, client) {
1334
1735
  tool(
1335
1736
  "suspend_customer",
1336
1737
  "Suspend a child org: it stops ingesting consent and its keys stop working, and it can be reactivated with update_customer. Its data is kept. (Permanent deletion is deliberately not available here.)",
1337
- { id: z3.string() },
1738
+ { id: z4.string() },
1338
1739
  async (a) => {
1339
1740
  await client.reseller.deprovision(a.id);
1340
1741
  return { suspended: a.id };
@@ -1343,72 +1744,72 @@ function registerTools(server, client) {
1343
1744
  tool(
1344
1745
  "list_customer_keys",
1345
1746
  "A child org's API key prefixes. Never the secrets. Read-only.",
1346
- { id: z3.string() },
1747
+ { id: z4.string() },
1347
1748
  (a) => client.reseller.listKeys(a.id)
1348
1749
  );
1349
1750
  tool(
1350
1751
  "issue_customer_key",
1351
1752
  "Mint an API key for a child org. The secret is returned once. Prefer scopes and a property lock over a full-access key.",
1352
- { id: z3.string(), name: z3.string().optional(), scopes: z3.array(z3.string()).optional(), cbids: z3.array(z3.string()).min(1).optional() },
1753
+ { id: z4.string(), name: z4.string().optional(), scopes: z4.array(z4.string()).optional(), cbids: z4.array(z4.string()).min(1).optional() },
1353
1754
  (a) => client.reseller.mintKey(a.id, {
1354
1755
  ...a.name ? { name: a.name } : {},
1355
1756
  ...a.scopes ? { scopes: a.scopes } : {},
1356
1757
  ...a.cbids ? { cbids: a.cbids } : {}
1357
1758
  })
1358
1759
  );
1359
- tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: z3.string(), prefix: z3.string() }, async (a) => {
1760
+ tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: z4.string(), prefix: z4.string() }, async (a) => {
1360
1761
  await client.reseller.revokeKey(a.id, a.prefix);
1361
1762
  return { revoked: a.prefix };
1362
1763
  });
1363
1764
  tool(
1364
1765
  "erase_subject_data",
1365
1766
  "IRREVERSIBLY crypto-erase a data subject's consent records by their consent-receipt stamp (GDPR/CCPA deletion). Destroys the encryption key; the tamper-evident chain stays intact.",
1366
- { cbid: z3.string(), stamp: z3.string() },
1767
+ { cbid: z4.string(), stamp: z4.string() },
1367
1768
  (a) => client.consent.eraseSubject(a.cbid, a.stamp)
1368
1769
  );
1369
1770
  tool(
1370
1771
  "export_subject_data",
1371
1772
  "Export a data subject's consent records (GDPR access/portability).",
1372
- { cbid: z3.string(), stamp: z3.string() },
1773
+ { cbid: z4.string(), stamp: z4.string() },
1373
1774
  (a) => client.consent.exportSubject(a.cbid, a.stamp)
1374
1775
  );
1375
1776
  tool("list_banners", "List reusable banner designs in your org.", {}, () => client.banners.list());
1376
1777
  tool(
1377
1778
  "create_banner",
1378
1779
  "Create a reusable banner design.",
1379
- { name: z3.string(), json: z3.record(z3.unknown()).describe("A v2 BannerConfig.") },
1780
+ { name: z4.string(), json: z4.record(z4.unknown()).describe("A v2 BannerConfig.") },
1380
1781
  (a) => client.banners.create({ name: a.name, json: a.json })
1381
1782
  );
1382
- tool("get_banner", "Get a banner design by id.", { id: z3.string() }, (a) => client.banners.get(a.id));
1783
+ tool("get_banner", "Get a banner design by id.", { id: z4.string() }, (a) => client.banners.get(a.id));
1383
1784
  tool(
1384
1785
  "update_banner",
1385
1786
  "Update a banner design (name and/or config).",
1386
- { id: z3.string(), name: z3.string().optional(), json: z3.record(z3.unknown()).optional() },
1787
+ { id: z4.string(), name: z4.string().optional(), json: z4.record(z4.unknown()).optional() },
1387
1788
  (a) => client.banners.update(a.id, {
1388
1789
  ...a.name !== void 0 ? { name: a.name } : {},
1389
1790
  ...a.json !== void 0 ? { json: a.json } : {}
1390
1791
  })
1391
1792
  );
1392
- tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: z3.string() }, async (a) => {
1793
+ tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: z4.string() }, async (a) => {
1393
1794
  await client.banners.delete(a.id);
1394
1795
  return { ok: true };
1395
1796
  });
1396
1797
  tool(
1397
1798
  "get_banner_assignments",
1398
1799
  "The sites (cbids) a banner design is currently assigned to. Read-only.",
1399
- { id: z3.string() },
1800
+ { id: z4.string() },
1400
1801
  (a) => client.banners.assignments(a.id)
1401
1802
  );
1402
1803
  tool(
1403
1804
  "assign_banner",
1404
1805
  "Set which sites (cbids) use a banner design.",
1405
- { id: z3.string(), cbids: z3.array(z3.string()) },
1806
+ { id: z4.string(), cbids: z4.array(z4.string()) },
1406
1807
  (a) => client.banners.setAssignments(a.id, a.cbids)
1407
1808
  );
1408
1809
  tool(
1409
1810
  "publish_banner",
1410
1811
  "Publish a design live to all its assigned sites.",
1411
- { id: z3.string() },
1812
+ { id: z4.string() },
1412
1813
  (a) => client.banners.publish(a.id)
1413
1814
  );
1414
1815
  }
@@ -1425,4 +1826,4 @@ export {
1425
1826
  registerTools,
1426
1827
  createCookieMunchMcp
1427
1828
  };
1428
- //# sourceMappingURL=chunk-Y4NTLOVB.js.map
1829
+ //# sourceMappingURL=chunk-VP3KZHLC.js.map