@cookiemunch/mcp 0.3.0 → 0.4.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 z4 } from "zod";
6
+ import { z as z5 } from "zod";
7
7
 
8
8
  // src/tools-config.ts
9
9
  import { z } from "zod";
@@ -90,7 +90,7 @@ function registerConfigTools(tool, client) {
90
90
  const setLanguagesSchema = z.object({
91
91
  cbid: z.string().describe("Site identifier (cbid)."),
92
92
  defaultCulture: z.string().optional().describe('Default locale/culture code, e.g. "en", "fr". Stored in i18n.defaultCulture.'),
93
- autoDetect: z.boolean().optional().describe("Auto-detect visitor language from browser locale. Stored in i18n.autoDetect."),
93
+ autoDetect: z.union([z.boolean(), z.literal("page")]).optional().describe(`true: follow the visitor's browser language; false: defaultCulture for everyone; "page": follow the page's <html lang>, then the browser. Stored in i18n.autoDetect.`),
94
94
  translations: z.record(z.record(z.unknown())).optional().describe("Per-locale banner copy overrides. Merged onto banner.i18n (locale keys preserved)."),
95
95
  overrides: z.record(z.object({ banner: z.record(z.string()).optional(), categories: z.record(z.object({ label: z.string().optional(), description: z.string().optional() })).optional() })).optional().describe("The site's own copy per language, keyed by tag (de, pt-BR): { banner: { title, body, \u2026 }, categories: { <id>: { label, description } } }. Each language given replaces its entry in i18n.overrides; other languages are kept. Strings the site wrote are shown as written in any language without an override \u2014 stock translations never replace them.")
96
96
  });
@@ -538,12 +538,16 @@ function registerPlatformTools(tool, client) {
538
538
  "connect_dsar_executor",
539
539
  "Connect a system that runs part of a rights request \u2014 an identity platform, a CRM, anything with a rights API. Cookie Munch is not specific to any platform: the `profile` describes that system's API (paths, the words it uses for export/erase, its status vocabulary, how it signs webhooks), so connecting a new one needs no code. The secret key is stored encrypted and never returned; the response carries the webhook URL to configure in that system. Sub-tasks open automatically once a request reaches fulfilment (after identity verification), and completions are picked up by webhook or by polling.",
540
540
  {
541
- system: z2.string().describe("The name this connection answers to in a plan, e.g. identity or crm."),
542
- baseUrl: z2.string().describe("The system's public https origin."),
541
+ preset: z2.string().optional().describe("Build profile (and, unless the preset takes baseUrl as a param, baseUrl) from a versioned preset instead of sending profile. list_dsar_executor_presets names them, what each needs, and which wait on another platform."),
542
+ presetVersion: z2.number().int().optional().describe("With preset: the version to build. Default the latest."),
543
+ orgId: z2.string().optional().describe("A preset param, when the preset's params list it."),
544
+ atlasIdAppId: z2.string().optional().describe("A preset param, when the preset's params list it: the identity platform's app id, so an erasure also revokes the app's grant."),
545
+ system: z2.string().optional().describe("The name this connection answers to in a plan, e.g. identity or crm. Required unless the preset has a default."),
546
+ baseUrl: z2.string().optional().describe("The system's public https origin. Required unless the preset sets it."),
543
547
  secretKey: z2.string().describe("Its API key, with whatever scope that system needs to export and erase a user."),
544
548
  webhookSecret: z2.string().optional().describe("Signing secret of its webhook endpoint. Optional: polling closes tasks without it."),
545
549
  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."),
550
+ profile: z2.record(z2.unknown()).optional().describe("How to drive that system: { open, poll, statuses } required, plus optional subjectLookup, auth, idempotencyHeader, grantRevoke and webhook. Omit it when using preset."),
547
551
  dryRun: z2.boolean().optional().describe("Validate everything and answer the connection that would be created, storing nothing.")
548
552
  },
549
553
  (a) => {
@@ -551,6 +555,28 @@ function registerPlatformTools(tool, client) {
551
555
  return dryRun === true ? client.fulfillment.dryRunConnectExecutor(input) : client.fulfillment.connectExecutor(input);
552
556
  }
553
557
  );
558
+ tool(
559
+ "list_dsar_executor_presets",
560
+ "The versioned executor presets: each one's name, params, latest version, and whether it is usable now or waits on another platform's API (waitingOn names the platform and its spec items). Also this org's canary address for connection tests. Read-only.",
561
+ {},
562
+ () => client.fulfillment.executorPresets()
563
+ );
564
+ tool(
565
+ "upgrade_dsar_executor_preset",
566
+ "Rebuild a connection's profile and address from its preset's latest version (or presetVersion), keeping its id, credentials, system and scope \u2014 or adopt a preset on a hand-written connection by naming it. Answers with a diff. Use dryRun first: the answer shows exactly what would change and nothing is stored.",
567
+ {
568
+ id: z2.string().describe("The connection id."),
569
+ preset: z2.string().optional().describe("Only to adopt a preset on a connection that has none."),
570
+ presetVersion: z2.number().int().optional(),
571
+ orgId: z2.string().optional(),
572
+ atlasIdAppId: z2.string().optional(),
573
+ dryRun: z2.boolean().optional().describe("Answer the diff and change nothing.")
574
+ },
575
+ (a) => {
576
+ const { id, dryRun, ...input } = a;
577
+ return dryRun === true ? client.fulfillment.dryRunUpgradeExecutorPreset(id, input) : client.fulfillment.upgradeExecutorPreset(id, input);
578
+ }
579
+ );
554
580
  tool(
555
581
  "test_dsar_executor_webhook",
556
582
  "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.",
@@ -584,15 +610,17 @@ function registerPlatformTools(tool, client) {
584
610
  );
585
611
  tool(
586
612
  "test_dsar_executor",
587
- "Try a connected system against one email WITHOUT filing a rights request. Runs its subject lookup and returns the raw upstream answers (credentials removed) and a one-line verdict. The open step is rendered but not sent, unless open is true on an export, which opens and polls a real export once. An erasure is never sent by a test.",
613
+ "Try a connected system against one email (or the org canary, canary: true) WITHOUT filing a rights request. Runs its subject lookup and returns the raw upstream answers (credentials removed) and a one-line verdict; code base_url_redirects means its baseUrl redirects and the verdict names where. The open step is rendered but not sent, unless open is true on an export, which opens and polls a real export once. An erasure is never sent by a test.",
588
614
  {
589
615
  id: z2.string().describe("The connection id."),
590
- email: z2.string().describe("The address to look up."),
616
+ email: z2.string().optional().describe("The address to look up. Omit it with canary."),
617
+ canary: z2.boolean().optional().describe("Use this org's canary address \u2014 no real person involved. A canary locate also updates the connection's health."),
591
618
  operation: z2.enum(["locate", "export", "erase"]).optional().describe("Default locate."),
592
619
  open: z2.boolean().optional().describe("For export only: open a real export and poll it once.")
593
620
  },
594
621
  (a) => client.fulfillment.testExecutor(a.id, {
595
- email: a.email,
622
+ ...typeof a.email === "string" ? { email: a.email } : {},
623
+ ...a.canary === true ? { canary: true } : {},
596
624
  ...a.operation ? { operation: a.operation } : {},
597
625
  ...typeof a.open === "boolean" ? { open: a.open } : {}
598
626
  })
@@ -678,31 +706,107 @@ function registerPlatformTools(tool, client) {
678
706
  );
679
707
  }
680
708
 
681
- // src/tools-rights-page.ts
709
+ // src/tools-integrations.ts
682
710
  import { z as z3 } from "zod";
711
+ function registerIntegrationTools(tool, client) {
712
+ const updateSiteSchema = z3.object({
713
+ cbid: z3.string().describe("Site identifier (cbid)."),
714
+ domain: z3.string().optional().describe("New domain, a bare hostname. A move clears verification: verify the new domain afterwards."),
715
+ name: z3.string().nullable().optional().describe("Display name data subjects see on the rights page and in notices; null clears it."),
716
+ aliases: z3.array(z3.string()).optional().describe("Other hosts serving the site (replaces the list; [] clears it). Accepted consent origins, never verified claims."),
717
+ dryRun: z3.boolean().optional().describe("Answer with the diff and its effects, storing nothing.")
718
+ });
719
+ tool(
720
+ "update_site",
721
+ "Rename or move a site: its domain, display name and aliases. The cbid and the consent ledger stay. Moving the domain clears verification; the scanner and preview links follow the new domain. Use dryRun first to see the diff and every effect.",
722
+ updateSiteSchema.shape,
723
+ (a) => {
724
+ const { cbid, dryRun, ...patch } = updateSiteSchema.parse(a);
725
+ return client.sites.update(cbid, patch, { dryRun });
726
+ }
727
+ );
728
+ tool(
729
+ "integration_health",
730
+ "Check every link a site\u2019s privacy wiring depends on: the domain, the snippet and CSP on the live page, connected systems (base URL redirects, a test lookup), webhooks, partner links, Atlas cookie_consent, cookies needing review, the rights page, the mail provider and the request SLA. Each row has ok (null = could not check) and a fix hint. Read-only.",
731
+ { cbid: z3.string().optional().describe("Site identifier; optional when the org has one site.") },
732
+ (a) => client.integrationHealth(a.cbid)
733
+ );
734
+ const provisionSchema = z3.object({
735
+ product: z3.string().describe("A slug naming the product."),
736
+ domain: z3.string().describe("The product\u2019s domain (bare hostname)."),
737
+ name: z3.string().optional(),
738
+ aliases: z3.array(z3.string()).optional(),
739
+ cbid: z3.string().optional().describe("Update this site instead of matching by domain."),
740
+ atlas: z3.object({ secretKey: z3.string(), cookieConsent: z3.boolean().optional(), dsrWebhook: z3.boolean().optional(), frontendApiHost: z3.string().optional().describe("Your Atlas frontend API host (auth.example.com): declares the Atlas sign-in cookies on the site.") }).optional().describe("Atlas secret key (sk_\u2026) \u2014 used for this call only, never stored or returned."),
741
+ forumulate: z3.object({ token: z3.string(), orgId: z3.string(), consent: z3.boolean().optional(), executorKey: z3.boolean().optional(), label: z3.string().optional() }).optional().describe("Forumulate org token \u2014 used for this call only, never stored or returned."),
742
+ rightsApi: z3.object({ baseUrl: z3.string(), secretKey: z3.string(), profilePreset: z3.string().optional() }).optional(),
743
+ dryRun: z3.boolean().optional().describe("Report what each step would do; write nothing on any platform. Run this first.")
744
+ });
745
+ tool(
746
+ "provision_product",
747
+ "Wire a product\u2019s privacy in one call: create or update the site, connected systems, the Atlas request-completion webhook and hosted-page consent banner, and Forumulate consent and executor key. Writes across three platforms; run with dryRun first. Idempotent: a re-run answers every step unchanged. No secret appears in the result.",
748
+ provisionSchema.shape,
749
+ (a) => {
750
+ const { dryRun, ...input } = provisionSchema.parse(a);
751
+ return client.provision(input, { dryRun });
752
+ }
753
+ );
754
+ tool(
755
+ "list_site_partners",
756
+ "Which partner platforms (Forumulate, Atlas) receive this site\u2019s consent events, each with its status, and which partners are on offer. Read-only.",
757
+ { cbid: z3.string() },
758
+ (a) => client.sites.listPartners(a.cbid)
759
+ );
760
+ const linkSchema = z3.object({
761
+ cbid: z3.string(),
762
+ partner: z3.enum(["forumulate", "atlas"]),
763
+ externalId: z3.string().describe("The partner\u2019s id for the receiving account, e.g. a Forumulate organisation id."),
764
+ label: z3.string().optional().describe('Shown with the partner name, e.g. "docs".'),
765
+ events: z3.array(z3.enum(["consent.recorded", "consent.withdrawn"])).optional(),
766
+ dryRun: z3.boolean().optional()
767
+ });
768
+ tool(
769
+ "link_site_partner",
770
+ "Grant a partner platform this site\u2019s consent events (they start flowing out to it). No secret is created: deliveries are signed with Cookie Munch\u2019s own key. Idempotent.",
771
+ linkSchema.shape,
772
+ (a) => {
773
+ const { cbid, dryRun, ...input } = linkSchema.parse(a);
774
+ return client.sites.linkPartner(cbid, input, { dryRun });
775
+ }
776
+ );
777
+ tool(
778
+ "unlink_site_partner",
779
+ "Revoke a partner link: no further consent events go to that partner.",
780
+ { cbid: z3.string(), linkId: z3.string() },
781
+ (a) => client.sites.unlinkPartner(a.cbid, a.linkId)
782
+ );
783
+ }
784
+
785
+ // src/tools-rights-page.ts
786
+ import { z as z4 } from "zod";
683
787
  function registerRightsTools(tool, client) {
684
- const cbid = { cbid: z3.string().describe("Site identifier (cbid). Must belong to your org.") };
788
+ const cbid = { cbid: z4.string().describe("Site identifier (cbid). Must belong to your org.") };
685
789
  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.")
790
+ baseUpdatedAt: z4.union([z4.number().int(), z4.string(), z4.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
791
  };
688
792
  const baseOpt = (a) => a.baseUpdatedAt !== void 0 ? { baseUpdatedAt: a.baseUpdatedAt } : {};
689
793
  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
794
  tool(
691
795
  "update_rights_page",
692
796
  "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 },
797
+ { ...cbid, page: z4.record(z4.unknown()).describe("The whole RightsPage document (v: 1)."), ...base },
694
798
  (a) => client.rightsPage.put(a.cbid, a.page, baseOpt(a))
695
799
  );
696
800
  tool(
697
801
  "patch_rights_page",
698
802
  "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 },
803
+ { ...cbid, patch: z4.record(z4.unknown()), ...base },
700
804
  (a) => client.rightsPage.patch(a.cbid, a.patch, baseOpt(a))
701
805
  );
702
806
  tool(
703
807
  "preview_rights_page",
704
808
  '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() },
809
+ { ...cbid, page: z4.record(z4.unknown()), mode: z4.enum(["patch", "put"]).optional() },
706
810
  (a) => client.rightsPage.dryRun(a.cbid, a.page, { mode: a.mode ?? "patch" })
707
811
  );
708
812
  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));
@@ -716,14 +820,14 @@ function registerRightsTools(tool, client) {
716
820
  tool(
717
821
  "rollback_rights_page",
718
822
  "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 },
823
+ { ...cbid, version: z4.number().int().min(1), ...base },
720
824
  (a) => client.rightsPage.rollback(a.cbid, a.version, baseOpt(a))
721
825
  );
722
826
  }
723
827
  function registerRightsPageTools(tool, client) {
724
- const site = z3.object({ cbid: z3.string().describe("Site identifier (cbid). Must belong to your org.") });
828
+ const site = z4.object({ cbid: z4.string().describe("Site identifier (cbid). Must belong to your org.") });
725
829
  const host = site.extend({
726
- hostname: z3.string().describe("The custom hostname, e.g. privacy.example.com (unicode or punycode).")
830
+ hostname: z4.string().describe("The custom hostname, e.g. privacy.example.com (unicode or punycode).")
727
831
  });
728
832
  tool(
729
833
  "list_rights_page_domains",
@@ -863,10 +967,10 @@ function registerTools(server, client) {
863
967
  }
864
968
  });
865
969
  };
866
- const cbid = { cbid: z4.string().describe("Site identifier (cbid). Must belong to your org.") };
970
+ const cbid = { cbid: z5.string().describe("Site identifier (cbid). Must belong to your org.") };
867
971
  const range = {
868
- from: z4.number().optional().describe("Epoch-ms lower bound."),
869
- to: z4.number().optional().describe("Epoch-ms upper bound.")
972
+ from: z5.number().optional().describe("Epoch-ms lower bound."),
973
+ to: z5.number().optional().describe("Epoch-ms upper bound.")
870
974
  };
871
975
  tool(
872
976
  "whoami",
@@ -884,19 +988,19 @@ function registerTools(server, client) {
884
988
  tool(
885
989
  "get_site",
886
990
  "One site: its domain, cbid and verification status. Read-only.",
887
- { cbid: z4.string() },
991
+ { cbid: z5.string() },
888
992
  (a) => client.sites.get(a.cbid)
889
993
  );
890
994
  tool(
891
995
  "get_site_banner",
892
996
  "Which banner design a site uses, or bannerId null when none is assigned. Read-only.",
893
- { cbid: z4.string() },
997
+ { cbid: z5.string() },
894
998
  (a) => client.sites.banner(a.cbid)
895
999
  );
896
1000
  tool(
897
1001
  "get_privacy_policy",
898
1002
  "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.",
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() },
1003
+ { cbid: z5.string(), contactEmail: z5.string().optional(), effectiveDate: z5.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: z5.array(z5.string()).optional() },
900
1004
  (a) => client.sites.policy(a.cbid, {
901
1005
  ...a.contactEmail ? { contactEmail: a.contactEmail } : {},
902
1006
  ...a.effectiveDate ? { effectiveDate: a.effectiveDate } : {},
@@ -906,7 +1010,7 @@ function registerTools(server, client) {
906
1010
  tool(
907
1011
  "set_ad_personalization",
908
1012
  "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.",
909
- { cbid: z4.string(), enabled: z4.boolean(), default: z4.boolean().optional(), label: z4.string().optional() },
1013
+ { cbid: z5.string(), enabled: z5.boolean(), default: z5.boolean().optional(), label: z5.string().optional() },
910
1014
  (a) => client.sites.setAdPersonalization(a.cbid, {
911
1015
  enabled: a.enabled,
912
1016
  ...a.default !== void 0 ? { default: a.default } : {},
@@ -917,11 +1021,11 @@ function registerTools(server, client) {
917
1021
  "analyze_session",
918
1022
  "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.",
919
1023
  {
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()
1024
+ cbid: z5.string(),
1025
+ har: z5.unknown().optional().describe("A HAR export of the session."),
1026
+ requests: z5.array(z5.unknown()).optional().describe("Or the requests directly."),
1027
+ consent: z5.record(z5.string(), z5.boolean()).optional(),
1028
+ gpc: z5.boolean().optional()
925
1029
  },
926
1030
  (a) => client.sites.analyzeSession(a.cbid, {
927
1031
  ...a.har !== void 0 ? { har: a.har } : {},
@@ -933,14 +1037,14 @@ function registerTools(server, client) {
933
1037
  tool(
934
1038
  "create_site",
935
1039
  "Create a new site. The cbid is auto-generated if you omit it.",
936
- { domain: z4.string().describe("The site domain, e.g. example.com."), cbid: z4.string().optional().describe("Optional explicit cbid.") },
1040
+ { domain: z5.string().describe("The site domain, e.g. example.com."), cbid: z5.string().optional().describe("Optional explicit cbid.") },
937
1041
  (a) => client.sites.create({ domain: a.domain, ...typeof a.cbid === "string" ? { cbid: a.cbid } : {} })
938
1042
  );
939
1043
  tool(
940
1044
  "create_sites_bulk",
941
1045
  "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.",
942
1046
  {
943
- sites: z4.array(z4.object({ domain: z4.string(), cbid: z4.string().optional(), platform: z4.string().optional() })).min(1).max(100)
1047
+ sites: z5.array(z5.object({ domain: z5.string(), cbid: z5.string().optional(), platform: z5.string().optional() })).min(1).max(100)
944
1048
  },
945
1049
  (a) => client.sites.createBulk(a.sites)
946
1050
  );
@@ -950,15 +1054,15 @@ function registerTools(server, client) {
950
1054
  "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.",
951
1055
  {
952
1056
  ...cbid,
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.")
1057
+ config: z5.record(z5.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
1058
+ keepUnspecified: z5.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
955
1059
  },
956
1060
  (a) => a.keepUnspecified === true ? client.sites.putConfig(a.cbid, a.config, { keep: "unspecified" }) : client.sites.putConfig(a.cbid, a.config)
957
1061
  );
958
1062
  tool(
959
1063
  "patch_site_config",
960
1064
  `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.`,
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.') },
1065
+ { ...cbid, config: z5.record(z5.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
962
1066
  (a) => client.sites.patchConfig(a.cbid, a.config)
963
1067
  );
964
1068
  tool(
@@ -966,9 +1070,9 @@ function registerTools(server, client) {
966
1070
  '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.',
967
1071
  {
968
1072
  ...cbid,
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).')
1073
+ config: z5.record(z5.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
1074
+ mode: z5.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
1075
+ keepUnspecified: z5.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
972
1076
  },
973
1077
  (a) => client.sites.dryRunConfig(a.cbid, a.config, {
974
1078
  mode: a.mode ?? "patch",
@@ -980,8 +1084,8 @@ function registerTools(server, client) {
980
1084
  '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
1085
  {
982
1086
  ...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.")
1087
+ config: z5.record(z5.unknown()).describe("The proposed SiteConfig (or a partial one, or a v2 flow design)."),
1088
+ replace: z5.boolean().optional().describe("Check what update_site_config (a full replace) would store, instead of what patch_site_config (a merge) would.")
985
1089
  },
986
1090
  async (a) => {
987
1091
  const r = await client.sites.lintConfig(a.cbid, a.config, a.replace === true ? { replace: true } : {});
@@ -1005,7 +1109,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1005
1109
  tool(
1006
1110
  "get_consent_log",
1007
1111
  "Get recent anonymised consent records for a site.",
1008
- { ...cbid, ...range, limit: z4.number().optional().describe("Max records to return (default 200).") },
1112
+ { ...cbid, ...range, limit: z5.number().optional().describe("Max records to return (default 200).") },
1009
1113
  (a) => client.consent.log(a.cbid, {
1010
1114
  from: a.from,
1011
1115
  to: a.to,
@@ -1015,7 +1119,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1015
1119
  tool(
1016
1120
  "get_subject_consent",
1017
1121
  "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.",
1018
- { subjectId: z4.string() },
1122
+ { subjectId: z5.string() },
1019
1123
  (a) => client.subjects.consent(a.subjectId)
1020
1124
  );
1021
1125
  tool("list_dsar", "List all Data Subject Access Requests for your organization.", {}, () => client.dsar.list());
@@ -1023,51 +1127,53 @@ ${JSON.stringify(r, null, 2)}` : r;
1023
1127
  "update_dsar_executor",
1024
1128
  "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
1129
  {
1026
- id: z4.string(),
1027
- patch: z4.record(z4.unknown()),
1028
- dryRun: z4.boolean().optional().describe("Validate and diff without saving.")
1130
+ id: z5.string(),
1131
+ patch: z5.record(z5.unknown()),
1132
+ dryRun: z5.boolean().optional().describe("Validate and diff without saving.")
1029
1133
  },
1030
1134
  (a) => a.dryRun === true ? client.fulfillment.dryRunUpdateExecutor(a.id, a.patch) : client.fulfillment.updateExecutor(a.id, a.patch)
1031
1135
  );
1032
1136
  tool(
1033
1137
  "get_dsar",
1034
1138
  "One rights request by id, including its status and the deadline it must be answered by.",
1035
- { id: z4.string() },
1139
+ { id: z5.string() },
1036
1140
  (a) => client.dsar.get(a.id)
1037
1141
  );
1038
1142
  tool(
1039
1143
  "erase_dsar_subject",
1040
1144
  "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.",
1041
- { id: z4.string(), cbid: z4.string(), stamp: z4.string() },
1145
+ { id: z5.string(), cbid: z5.string(), stamp: z5.string() },
1042
1146
  (a) => client.dsar.erase(a.id, a.cbid, a.stamp)
1043
1147
  );
1044
1148
  tool(
1045
1149
  "export_dsar_subject",
1046
1150
  "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.",
1047
- { id: z4.string(), cbid: z4.string(), stamp: z4.string() },
1151
+ { id: z5.string(), cbid: z5.string(), stamp: z5.string() },
1048
1152
  (a) => client.dsar.export(a.id, a.cbid, a.stamp)
1049
1153
  );
1050
1154
  tool(
1051
1155
  "get_dsar_response_notice",
1052
1156
  "The subject-facing response notice for a request, as plain text \u2014 what to send the person. Read-only; nothing is sent.",
1053
- { id: z4.string() },
1157
+ { id: z5.string() },
1054
1158
  (a) => client.dsar.response(a.id)
1055
1159
  );
1056
1160
  tool(
1057
1161
  "create_dsar",
1058
1162
  "Open a new Data Subject Access Request.",
1059
1163
  {
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.")
1164
+ type: z5.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
1165
+ subjectEmail: z5.string().describe("The data subject\u2019s email."),
1166
+ regulation: z5.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
1167
+ note: z5.string().optional().describe("Optional INTERNAL note; never shown to the data subject."),
1168
+ messageToSubject: z5.string().max(2e3).optional().describe("The line the data subject reads in the response notice. Never an API key."),
1169
+ test: z5.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
1065
1170
  },
1066
1171
  (a) => client.dsar.create({
1067
1172
  type: a.type,
1068
1173
  subjectEmail: a.subjectEmail,
1069
1174
  regulation: a.regulation,
1070
1175
  ...typeof a.note === "string" ? { note: a.note } : {},
1176
+ ...typeof a.messageToSubject === "string" ? { messageToSubject: a.messageToSubject } : {},
1071
1177
  ...a.test === true ? { test: true } : {}
1072
1178
  })
1073
1179
  );
@@ -1075,11 +1181,11 @@ ${JSON.stringify(r, null, 2)}` : r;
1075
1181
  "create_rights_link",
1076
1182
  "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
1183
  {
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).")
1184
+ cbid: z5.string().describe("Site identifier (cbid). Must belong to your org."),
1185
+ email: z5.string().describe("The signed-in person\u2019s verified email address."),
1186
+ userId: z5.string().optional().describe("Your own account id for them; recorded on the request."),
1187
+ rights: z5.array(z5.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."),
1188
+ ttlSeconds: z5.number().int().min(60).max(3600).optional().describe("How long the link works, in seconds (default 900).")
1083
1189
  },
1084
1190
  (a) => client.rightsLinks.create(a.cbid, {
1085
1191
  subject: { email: a.email, ...typeof a.userId === "string" ? { userId: a.userId } : {} },
@@ -1090,7 +1196,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1090
1196
  tool(
1091
1197
  "delete_test_dsar",
1092
1198
  "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.",
1093
- { id: z4.string().describe("The test request id.") },
1199
+ { id: z5.string().describe("The test request id.") },
1094
1200
  async (a) => {
1095
1201
  await client.dsar.delete(a.id);
1096
1202
  return { deleted: a.id };
@@ -1099,17 +1205,18 @@ ${JSON.stringify(r, null, 2)}` : r;
1099
1205
  tool(
1100
1206
  "mark_dsar_test",
1101
1207
  "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 }.",
1102
- { id: z4.string().describe("The closed request id.") },
1208
+ { id: z5.string().describe("The closed request id.") },
1103
1209
  (a) => client.dsar.markTest(a.id)
1104
1210
  );
1105
1211
  tool(
1106
1212
  "advance_dsar",
1107
1213
  "Advance a DSAR to a new status (received \u2192 verifying \u2192 in_progress \u2192 completed, or rejected).",
1108
1214
  {
1109
- id: z4.string().describe("The DSAR id."),
1110
- toStatus: z4.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
1215
+ id: z5.string().describe("The DSAR id."),
1216
+ toStatus: z5.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status."),
1217
+ messageToSubject: z5.string().max(2e3).optional().describe("Replaces the line the data subject reads in the notice \u2014 for a rejection, why.")
1111
1218
  },
1112
- (a) => client.dsar.advance(a.id, a.toStatus)
1219
+ (a) => typeof a.messageToSubject === "string" ? client.dsar.advance(a.id, a.toStatus, { messageToSubject: a.messageToSubject }) : client.dsar.advance(a.id, a.toStatus)
1113
1220
  );
1114
1221
  tool(
1115
1222
  "export_consent",
@@ -1120,7 +1227,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1120
1227
  tool(
1121
1228
  "get_receipt",
1122
1229
  "Fetch the signed consent receipt for a single consent record (by stamp).",
1123
- { ...cbid, stamp: z4.string().describe("The consent record stamp/id.") },
1230
+ { ...cbid, stamp: z5.string().describe("The consent record stamp/id.") },
1124
1231
  (a) => client.consent.receipt(a.cbid, a.stamp)
1125
1232
  );
1126
1233
  tool("delete_site", "Delete a site (cbid) and its configuration from your org.", { ...cbid }, async (a) => {
@@ -1132,13 +1239,13 @@ ${JSON.stringify(r, null, 2)}` : r;
1132
1239
  "create_vendor",
1133
1240
  "Register a vendor (processor) and compute its risk score.",
1134
1241
  {
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.")
1242
+ name: z5.string().describe("Vendor name."),
1243
+ category: z5.string().describe("Vendor category, e.g. analytics."),
1244
+ dataShared: z5.array(z5.string()).describe("Categories of data shared with the vendor."),
1245
+ dpaSigned: z5.boolean().describe("Whether a Data Processing Agreement is signed."),
1246
+ subprocessors: z5.number().describe("Number of subprocessors."),
1247
+ certifications: z5.array(z5.string()).describe("Compliance certifications, e.g. ISO27001."),
1248
+ region: z5.string().describe("Primary processing region, e.g. EU.")
1142
1249
  },
1143
1250
  (a) => client.vendors.create({
1144
1251
  name: a.name,
@@ -1156,13 +1263,13 @@ ${JSON.stringify(r, null, 2)}` : r;
1156
1263
  "create_ropa",
1157
1264
  "Create a Record of Processing Activity (RoPA) entry.",
1158
1265
  {
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.")
1266
+ name: z5.string().describe("Activity name."),
1267
+ purpose: z5.string().describe("Purpose of processing."),
1268
+ legalBasis: z5.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
1269
+ dataCategories: z5.array(z5.string()).describe("Categories of personal data."),
1270
+ recipients: z5.array(z5.string()).describe("Recipients of the data."),
1271
+ retentionDays: z5.number().describe("Retention period in days."),
1272
+ crossBorderTransfer: z5.boolean().describe("Whether data is transferred across borders.")
1166
1273
  },
1167
1274
  (a) => client.ropa.create({
1168
1275
  name: a.name,
@@ -1183,7 +1290,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1183
1290
  tool(
1184
1291
  "scan_site",
1185
1292
  "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.") },
1293
+ { ...cbid, wait: z5.boolean().optional().describe("Wait for the scan to finish (up to 100 s) and return its outcome.") },
1187
1294
  async (a) => {
1188
1295
  let started;
1189
1296
  try {
@@ -1197,7 +1304,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1197
1304
  tool(
1198
1305
  "get_scan_status",
1199
1306
  "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.") },
1307
+ { ...cbid, wait: z5.number().min(0).max(60).optional().describe("Seconds (\u226460) to wait for a running scan to settle before answering.") },
1201
1308
  (a) => a.wait !== void 0 ? client.sites.scanStatus(a.cbid, { wait: a.wait }) : client.sites.scanStatus(a.cbid)
1202
1309
  );
1203
1310
  tool(
@@ -1209,16 +1316,25 @@ ${JSON.stringify(r, null, 2)}` : r;
1209
1316
  tool("list_brand_kits", "List reusable brand kits (colors/logo/typography) for your org.", {}, () => client.brandKits.list());
1210
1317
  tool("list_preferences", "List configurable consent preferences/purposes for your org.", {}, () => client.preferences.list());
1211
1318
  tool("list_members", "List the members of your organization.", {}, () => client.members.list());
1212
- tool("list_api_keys", "List the API keys for your organization (secrets are not returned).", {}, () => client.keys.list());
1319
+ tool("list_api_keys", "List the API keys for your organization (secrets are not returned), with each key\u2019s scopes, expiry and when it was last used.", {}, () => client.keys.list());
1320
+ tool(
1321
+ "api_key_report",
1322
+ "Key hygiene: keys not used for a while, keys with broad (full or wide write) access, and keys expiring soon, each with the reason. Read-only.",
1323
+ {
1324
+ unusedDays: z5.number().int().min(1).max(3650).optional().describe("Unused for at least this many days (default 90)."),
1325
+ expiringDays: z5.number().int().min(1).max(3650).optional().describe("Expiring within this many days (default 14).")
1326
+ },
1327
+ (a) => client.keys.report({ ...a.unusedDays !== void 0 ? { unusedDays: a.unusedDays } : {}, ...a.expiringDays !== void 0 ? { expiringDays: a.expiringDays } : {} })
1328
+ );
1213
1329
  tool("get_usage", "Get the current usage/quota summary for your organization.", {}, () => client.usage());
1214
1330
  tool("list_webhooks", "List webhook subscriptions for your organization.", {}, () => client.webhooks.list());
1215
1331
  tool(
1216
1332
  "create_webhook",
1217
1333
  "Create a webhook subscription. The response includes the signing secret (shown once).",
1218
1334
  {
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.")
1335
+ url: z5.string().describe("HTTPS endpoint to deliver events to."),
1336
+ events: z5.array(z5.string()).describe("Event names to subscribe to, e.g. consent.created."),
1337
+ cbid: z5.string().optional().describe("Optional site cbid to scope the subscription to.")
1222
1338
  },
1223
1339
  (a) => client.webhooks.create({
1224
1340
  url: a.url,
@@ -1229,13 +1345,13 @@ ${JSON.stringify(r, null, 2)}` : r;
1229
1345
  tool(
1230
1346
  "roll_webhook_secret",
1231
1347
  "Rotate a webhook subscription\u2019s signing secret. The new secret is returned once; the receiving endpoint must be updated to verify with it.",
1232
- { id: z4.string() },
1348
+ { id: z5.string() },
1233
1349
  (a) => client.webhooks.rollSecret(a.id)
1234
1350
  );
1235
1351
  tool(
1236
1352
  "test_webhook",
1237
1353
  "Send a signed test event to a webhook subscription now, and report what the endpoint answered.",
1238
- { id: z4.string() },
1354
+ { id: z5.string() },
1239
1355
  (a) => client.webhooks.test(a.id)
1240
1356
  );
1241
1357
  tool(
@@ -1247,18 +1363,18 @@ ${JSON.stringify(r, null, 2)}` : r;
1247
1363
  tool(
1248
1364
  "replay_webhook_dead_letter",
1249
1365
  "Deliver a dead-lettered webhook event again, to the subscription as it is now.",
1250
- { id: z4.string() },
1366
+ { id: z5.string() },
1251
1367
  (a) => client.webhooks.replayDeadLetter(a.id)
1252
1368
  );
1253
1369
  tool(
1254
1370
  "update_webhook",
1255
1371
  "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.",
1256
1372
  {
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()
1373
+ id: z5.string(),
1374
+ url: z5.string().optional(),
1375
+ events: z5.array(z5.string()).optional(),
1376
+ cbid: z5.string().nullable().optional(),
1377
+ active: z5.boolean().optional()
1262
1378
  },
1263
1379
  (a) => client.webhooks.update(a.id, {
1264
1380
  ...a.url !== void 0 ? { url: a.url } : {},
@@ -1267,20 +1383,20 @@ ${JSON.stringify(r, null, 2)}` : r;
1267
1383
  ...a.active !== void 0 ? { active: a.active } : {}
1268
1384
  })
1269
1385
  );
1270
- tool("delete_webhook", "Delete a webhook subscription by id.", { id: z4.string().describe("The webhook subscription id.") }, async (a) => {
1386
+ tool("delete_webhook", "Delete a webhook subscription by id.", { id: z5.string().describe("The webhook subscription id.") }, async (a) => {
1271
1387
  await client.webhooks.delete(a.id);
1272
1388
  return { ok: true };
1273
1389
  });
1274
1390
  tool(
1275
1391
  "verify_site",
1276
1392
  "Verify that your organization controls a domain by one of three challenge methods (dns / meta / file). Required to unlock consent export and signed receipts.",
1277
- { ...cbid, method: z4.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1393
+ { ...cbid, method: z5.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1278
1394
  (a) => client.sites.verify(a.cbid, a.method)
1279
1395
  );
1280
1396
  tool(
1281
1397
  "get_verification_challenge",
1282
1398
  "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.",
1283
- { cbid: z4.string() },
1399
+ { cbid: z5.string() },
1284
1400
  (a) => client.sites.verifyChallenge(a.cbid)
1285
1401
  );
1286
1402
  tool(
@@ -1292,15 +1408,15 @@ ${JSON.stringify(r, null, 2)}` : r;
1292
1408
  tool(
1293
1409
  "get_flow",
1294
1410
  "Get the v2 banner flow config for a site, including current views, categories, and any lint issues.",
1295
- { cbid: z4.string().describe("Site identifier (cbid).") },
1411
+ { cbid: z5.string().describe("Site identifier (cbid).") },
1296
1412
  (a) => client.sites.getFlow(a.cbid)
1297
1413
  );
1298
1414
  tool(
1299
1415
  "edit_flow",
1300
1416
  "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.",
1301
1417
  {
1302
- cbid: z4.string().describe("Site identifier (cbid)."),
1303
- operations: z4.array(z4.record(z4.unknown())).describe(
1418
+ cbid: z5.string().describe("Site identifier (cbid)."),
1419
+ operations: z5.array(z5.record(z5.unknown())).describe(
1304
1420
  'Ordered list of ops. Each must have an "op" field: addView | removeView | addElement | setButtonTransition | addCustomCategory.'
1305
1421
  )
1306
1422
  },
@@ -1310,21 +1426,22 @@ ${JSON.stringify(r, null, 2)}` : r;
1310
1426
  "set_flow",
1311
1427
  "Wholesale replace a site's v2 banner flow with a complete config (e.g. from a template). Validated server-side before it is saved.",
1312
1428
  {
1313
- cbid: z4.string().describe("Site identifier (cbid)."),
1314
- config: z4.record(z4.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1429
+ cbid: z5.string().describe("Site identifier (cbid)."),
1430
+ config: z5.record(z5.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1315
1431
  },
1316
1432
  (a) => client.sites.setFlow(a.cbid, a.config)
1317
1433
  );
1318
1434
  registerConfigTools(tool, client);
1319
1435
  registerPlatformTools(tool, client);
1436
+ registerIntegrationTools(tool, client);
1320
1437
  registerRightsTools(tool, client);
1321
1438
  registerRightsPageTools(tool, client);
1322
1439
  tool(
1323
1440
  "invite_member",
1324
1441
  "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.",
1325
1442
  {
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.")
1443
+ email: z5.string().describe("Email address of the person to invite."),
1444
+ role: z5.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
1328
1445
  },
1329
1446
  (a) => client.members.invite(a.email, a.role)
1330
1447
  );
@@ -1332,8 +1449,8 @@ ${JSON.stringify(r, null, 2)}` : r;
1332
1449
  "set_member_role",
1333
1450
  "Change the role of a member in your organization. The org owner's role cannot be changed.",
1334
1451
  {
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.")
1452
+ userId: z5.string().describe("The userId of the member whose role to change."),
1453
+ role: z5.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
1337
1454
  },
1338
1455
  (a) => client.members.setRole(a.userId, a.role)
1339
1456
  );
@@ -1341,7 +1458,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1341
1458
  "remove_member",
1342
1459
  "Remove a member from your organization. The org owner cannot be removed.",
1343
1460
  {
1344
- userId: z4.string().describe("The userId of the member to remove.")
1461
+ userId: z5.string().describe("The userId of the member to remove.")
1345
1462
  },
1346
1463
  async (a) => {
1347
1464
  await client.members.remove(a.userId);
@@ -1352,11 +1469,11 @@ ${JSON.stringify(r, null, 2)}` : r;
1352
1469
  "create_brand_kit",
1353
1470
  "Create a reusable brand kit (colors, logo, typography) for your organization's consent banners.",
1354
1471
  {
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.")
1472
+ name: z5.string().describe("Display name for the brand kit."),
1473
+ theme: z5.record(z5.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
1474
+ content: z5.record(z5.unknown()).optional().describe("Optional banner copy overrides."),
1475
+ logoUrl: z5.string().optional().describe("Optional URL for your org logo."),
1476
+ customCss: z5.string().optional().describe("Optional custom CSS string to inject into the banner.")
1360
1477
  },
1361
1478
  (a) => client.brandKits.create({
1362
1479
  name: a.name,
@@ -1370,7 +1487,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1370
1487
  "delete_brand_kit",
1371
1488
  "Delete a brand kit by id. The kit must belong to your organization (cross-org deletes are rejected).",
1372
1489
  {
1373
- id: z4.string().describe("The brand kit id to delete.")
1490
+ id: z5.string().describe("The brand kit id to delete.")
1374
1491
  },
1375
1492
  async (a) => {
1376
1493
  await client.brandKits.delete(a.id);
@@ -1381,63 +1498,65 @@ ${JSON.stringify(r, null, 2)}` : r;
1381
1498
  "save_preference",
1382
1499
  "Save or update the consent preferences for an end-user (by subjectId) within your organization. purposes is a map of purpose-name \u2192 boolean.",
1383
1500
  {
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 }.')
1501
+ subjectId: z5.string().describe("The end-user identifier (e.g. email or internal user id)."),
1502
+ purposes: z5.record(z5.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
1386
1503
  },
1387
1504
  (a) => client.preferences.save(a.subjectId, a.purposes)
1388
1505
  );
1389
1506
  tool(
1390
1507
  "get_preference",
1391
1508
  "One end-user\u2019s saved preferences, by subjectId. Read-only.",
1392
- { subjectId: z4.string() },
1509
+ { subjectId: z5.string() },
1393
1510
  (a) => client.preferences.get(a.subjectId)
1394
1511
  );
1395
1512
  tool(
1396
1513
  "issue_api_key",
1397
1514
  "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.",
1398
1515
  {
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()
1516
+ name: z5.string().optional(),
1517
+ scopes: z5.array(z5.string()).optional(),
1518
+ cbids: z5.array(z5.string()).min(1).optional(),
1519
+ expiresInDays: z5.number().int().min(1).max(3650).optional(),
1520
+ expiresAt: z5.string().optional().describe("Or the exact expiry, an ISO date-time (not with expiresInDays).")
1403
1521
  },
1404
1522
  (a) => client.keys.issue({
1523
+ ...a.expiresAt ? { expiresAt: a.expiresAt } : {},
1405
1524
  ...a.name ? { name: a.name } : {},
1406
1525
  ...a.scopes ? { scopes: a.scopes } : {},
1407
1526
  ...a.cbids ? { cbids: a.cbids } : {},
1408
1527
  ...a.expiresInDays !== void 0 ? { expiresInDays: a.expiresInDays } : {}
1409
1528
  })
1410
1529
  );
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) => {
1530
+ tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: z5.string() }, async (a) => {
1412
1531
  await client.keys.revoke(a.prefix);
1413
1532
  return { revoked: a.prefix };
1414
1533
  });
1415
1534
  tool(
1416
1535
  "import_cookie_declaration",
1417
1536
  "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.",
1418
- { cbid: z4.string(), data: z4.string().describe("The exported file, as text (CSV or JSON).") },
1537
+ { cbid: z5.string(), data: z5.string().describe("The exported file, as text (CSV or JSON).") },
1419
1538
  (a) => client.sites.importDeclaration(a.cbid, a.data)
1420
1539
  );
1421
1540
  tool(
1422
1541
  "apply_cookie_import",
1423
1542
  "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.",
1424
- { cbid: z4.string(), data: z4.string().describe("The exported file, as text (CSV or JSON)."), overwrite: z4.boolean().optional() },
1543
+ { cbid: z5.string(), data: z5.string().describe("The exported file, as text (CSV or JSON)."), overwrite: z5.boolean().optional() },
1425
1544
  (a) => client.sites.applyImport(a.cbid, a.data, a.overwrite ? { overwrite: true } : void 0)
1426
1545
  );
1427
1546
  const declarationShape = {
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).")
1547
+ category: z5.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
1548
+ purpose: z5.string().describe("What the cookie does, as visitors will read it \u2014 and the fallback for any language purposes lacks."),
1549
+ purposes: z5.record(z5.string(), z5.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.'),
1550
+ provider: z5.string().optional(),
1551
+ expiry: z5.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
1552
+ domain: z5.string().optional(),
1553
+ pattern: z5.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
1435
1554
  };
1436
- const dryRunArg = z4.boolean().optional().describe("Store nothing: answer with the would-be declarations and a diff (added / removed / changed) to check first.");
1555
+ const dryRunArg = z5.boolean().optional().describe("Store nothing: answer with the would-be declarations and a diff (added / removed / changed) to check first.");
1437
1556
  tool(
1438
1557
  "declare_cookie",
1439
1558
  '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.',
1440
- { cbid: z4.string(), name: z4.string(), ...declarationShape, dryRun: dryRunArg },
1559
+ { cbid: z5.string(), name: z5.string(), ...declarationShape, dryRun: dryRunArg },
1441
1560
  (a) => {
1442
1561
  const { cbid: cbid2, name, dryRun, ...rest } = a;
1443
1562
  return client.sites.declareCookie(cbid2, name, rest, dryRun ? { dryRun: true } : void 0);
@@ -1446,7 +1565,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1446
1565
  tool(
1447
1566
  "declare_cookies",
1448
1567
  "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.",
1449
- { cbid: z4.string(), cookies: z4.array(z4.object({ name: z4.string(), ...declarationShape })).max(500), replace: z4.boolean().optional(), dryRun: dryRunArg },
1568
+ { cbid: z5.string(), cookies: z5.array(z5.object({ name: z5.string(), ...declarationShape })).max(500), replace: z5.boolean().optional(), dryRun: dryRunArg },
1450
1569
  (a) => {
1451
1570
  const o = { ...a.replace ? { replace: true } : {}, ...a.dryRun ? { dryRun: true } : {} };
1452
1571
  return client.sites.declareCookies(a.cbid, a.cookies, Object.keys(o).length ? o : void 0);
@@ -1455,7 +1574,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1455
1574
  tool(
1456
1575
  "undeclare_cookie",
1457
1576
  "Remove a cookie declaration; the scanned/observed classification applies again.",
1458
- { cbid: z4.string(), name: z4.string(), dryRun: dryRunArg },
1577
+ { cbid: z5.string(), name: z5.string(), dryRun: dryRunArg },
1459
1578
  async (a) => {
1460
1579
  if (a.dryRun) return client.sites.undeclareCookie(a.cbid, a.name, { dryRun: true });
1461
1580
  await client.sites.undeclareCookie(a.cbid, a.name);
@@ -1466,11 +1585,11 @@ ${JSON.stringify(r, null, 2)}` : r;
1466
1585
  "retire_cookie",
1467
1586
  '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
1587
  {
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.")
1588
+ cbid: z5.string(),
1589
+ name: z5.string(),
1590
+ renamedTo: z5.string().max(256).optional().describe("The cookie\u2019s new name, if it was renamed."),
1591
+ note: z5.string().max(1e3).optional(),
1592
+ dryRun: z5.boolean().optional().describe("Store nothing: answer with the would-be retirement and list to check first.")
1474
1593
  },
1475
1594
  (a) => {
1476
1595
  const input = { ...a.renamedTo ? { renamedTo: a.renamedTo } : {}, ...a.note ? { note: a.note } : {} };
@@ -1480,35 +1599,93 @@ ${JSON.stringify(r, null, 2)}` : r;
1480
1599
  tool(
1481
1600
  "unretire_cookie",
1482
1601
  "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.") },
1602
+ { cbid: z5.string(), name: z5.string(), dryRun: z5.boolean().optional().describe("Store nothing: answer with what the list would be.") },
1484
1603
  async (a) => {
1485
1604
  if (a.dryRun) return client.sites.unretireCookie(a.cbid, a.name, { dryRun: true });
1486
1605
  await client.sites.unretireCookie(a.cbid, a.name);
1487
1606
  return { unretired: a.name };
1488
1607
  }
1489
1608
  );
1609
+ tool(
1610
+ "list_cookie_presets",
1611
+ "Declaration presets for the platforms a site is built on (atlas, forumulate, chatly, cookiemunch): each one\u2019s parameters, what it has declared on this site, and whether the vendor\u2019s live manifest can be imported yet. Read-only.",
1612
+ { cbid: z5.string() },
1613
+ (a) => client.sites.cookiePresets(a.cbid)
1614
+ );
1615
+ tool(
1616
+ "apply_cookie_preset",
1617
+ "Apply (or re-sync) a vendor preset: declares exactly what that platform writes \u2014 cookies and browser storage, with domain and lifetime \u2014 marked as declared by that vendor. Re-applying removes keys the vendor no longer writes. Names the owner declared are kept (skipped). Atlas needs frontendApiHost (and crossSubdomainCookies, default true); Chatly needs publicId.",
1618
+ {
1619
+ cbid: z5.string(),
1620
+ vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch"]),
1621
+ frontendApiHost: z5.string().optional().describe("Atlas: your frontend API host, e.g. auth.example.com."),
1622
+ crossSubdomainCookies: z5.boolean().optional().describe("Atlas: default true \u2014 the cookies live on the parent domain."),
1623
+ publicId: z5.string().optional().describe("Chatly: the channel public id (ch_web_\u2026)."),
1624
+ dragging: z5.boolean().optional().describe("Chatly: the launcher can be dragged (adds the drag-position key)."),
1625
+ category: z5.string().optional().describe("Chatly: the category for its keys. Default necessary."),
1626
+ dryRun: dryRunArg
1627
+ },
1628
+ (a) => {
1629
+ const params = {};
1630
+ for (const k of ["frontendApiHost", "crossSubdomainCookies", "publicId", "dragging", "category"]) if (a[k] !== void 0) params[k] = a[k];
1631
+ return client.sites.applyCookiePreset(a.cbid, a.vendor, params, a.dryRun ? { dryRun: true } : void 0);
1632
+ }
1633
+ );
1634
+ tool(
1635
+ "remove_cookie_preset",
1636
+ "Remove every declaration a vendor preset made on this site.",
1637
+ { cbid: z5.string(), vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch"]), dryRun: dryRunArg },
1638
+ (a) => client.sites.removeCookiePreset(a.cbid, a.vendor, a.dryRun ? { dryRun: true } : void 0)
1639
+ );
1640
+ tool(
1641
+ "delete_observed_cookie",
1642
+ "Remove every stored row of this name that crawls or real visits put in the site\u2019s cookie list (e.g. a name someone reported that the site never sets). A declaration of it stays. If real visits keep reporting it, it comes back quarantined.",
1643
+ { cbid: z5.string(), name: z5.string(), dryRun: dryRunArg },
1644
+ async (a) => {
1645
+ if (a.dryRun) return client.sites.deleteObservedCookie(a.cbid, a.name, { dryRun: true });
1646
+ await client.sites.deleteObservedCookie(a.cbid, a.name);
1647
+ return { deleted: a.name };
1648
+ }
1649
+ );
1650
+ tool(
1651
+ "purge_observed_cookies",
1652
+ "Purge observed since T: remove every row a real visit first reported at or after `since` (and before `until`). Crawled rows and declarations stay. Rows from before provenance was recorded use their last-seen time, so run with dryRun first.",
1653
+ {
1654
+ cbid: z5.string(),
1655
+ since: z5.union([z5.string(), z5.number()]).describe("ISO-8601 time or epoch milliseconds."),
1656
+ until: z5.union([z5.string(), z5.number()]).optional().describe("Optional end of the window (exclusive)."),
1657
+ dryRun: dryRunArg
1658
+ },
1659
+ (a) => client.sites.purgeObservedCookies(
1660
+ a.cbid,
1661
+ { since: a.since, ...a.until !== void 0 ? { until: a.until } : {} },
1662
+ a.dryRun ? { dryRun: true } : void 0
1663
+ )
1664
+ );
1490
1665
  tool(
1491
1666
  "get_blocked_pages",
1492
1667
  "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.",
1493
- { cbid: z4.string() },
1668
+ { cbid: z5.string() },
1494
1669
  (a) => client.sites.blocked(a.cbid)
1495
1670
  );
1496
1671
  tool(
1497
1672
  "roll_api_key",
1498
1673
  "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.",
1499
- { prefix: z4.string() },
1674
+ { prefix: z5.string() },
1500
1675
  (a) => client.keys.roll(a.prefix)
1501
1676
  );
1502
1677
  tool(
1503
1678
  "update_api_key",
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.",
1679
+ "Rename an API key, replace its scopes or the properties it is locked to, or set or remove its expiry. Only the fields given change; the secret does not.",
1505
1680
  {
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()
1681
+ prefix: z5.string(),
1682
+ name: z5.string().optional(),
1683
+ scopes: z5.array(z5.string()).optional(),
1684
+ cbids: z5.array(z5.string()).min(1).optional(),
1685
+ expiresAt: z5.string().nullable().optional().describe("A new expiry (ISO date-time), or null to remove it.")
1510
1686
  },
1511
1687
  (a) => client.keys.update(a.prefix, {
1688
+ ...a.expiresAt !== void 0 ? { expiresAt: a.expiresAt } : {},
1512
1689
  ...a.name !== void 0 ? { name: a.name } : {},
1513
1690
  ...a.scopes ? { scopes: a.scopes } : {},
1514
1691
  ...a.cbids ? { cbids: a.cbids } : {}
@@ -1518,7 +1695,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1518
1695
  tool(
1519
1696
  "update_org",
1520
1697
  "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.",
1521
- { name: z4.string().min(1).optional(), logoUrl: z4.string().nullable().optional() },
1698
+ { name: z5.string().min(1).optional(), logoUrl: z5.string().nullable().optional() },
1522
1699
  (a) => client.org.update({
1523
1700
  ...a.name !== void 0 ? { name: a.name } : {},
1524
1701
  ...a.logoUrl !== void 0 ? { logoUrl: a.logoUrl } : {}
@@ -1534,20 +1711,20 @@ ${JSON.stringify(r, null, 2)}` : r;
1534
1711
  "set_mail_provider",
1535
1712
  "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
1713
  {
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.")
1714
+ provider: z5.enum(["brevo", "sendgrid", "postmark", "resend", "ses", "smtp"]),
1715
+ fromEmail: z5.string().describe("An address on a domain your provider has verified."),
1716
+ fromName: z5.string().max(100).nullable().optional(),
1717
+ replyTo: z5.string().nullable().optional(),
1718
+ secret: z5.string().optional().describe("API key (Brevo, SendGrid, Resend), server token (Postmark), secret access key (SES) or SMTP password. Write-only."),
1719
+ ses: z5.object({ region: z5.string(), accessKeyId: z5.string() }).optional().describe("Required for ses."),
1720
+ smtp: z5.object({ host: z5.string(), port: z5.union([z5.literal(25), z5.literal(465), z5.literal(587), z5.literal(2525)]), security: z5.enum(["tls", "starttls"]), username: z5.string() }).optional().describe("Required for smtp. TLS is always required.")
1544
1721
  },
1545
1722
  (a) => client.org.mailProvider.set(a)
1546
1723
  );
1547
1724
  tool(
1548
1725
  "test_mail_provider",
1549
1726
  "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.") },
1727
+ { to: z5.string().optional().describe("Recipient. Default: the reply-to, else the from address.") },
1551
1728
  (a) => client.org.mailProvider.test(a.to)
1552
1729
  );
1553
1730
  tool(
@@ -1561,11 +1738,11 @@ ${JSON.stringify(r, null, 2)}` : r;
1561
1738
  );
1562
1739
  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
1740
  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.")
1741
+ mode: z5.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
1742
+ provider: z5.enum(["turnstile", "hcaptcha", "recaptcha_v2", "recaptcha_v3"]).optional().describe("Required for own."),
1743
+ siteKey: z5.string().optional().describe("Required for own: the public site key. List your rights-page hostnames on it at the provider."),
1744
+ secret: z5.string().optional().describe("The provider secret key. Write-only; never returned. Omit to keep the stored one (same provider)."),
1745
+ minScore: z5.number().min(0.1).max(0.9).optional().describe("reCAPTCHA v3 only. Default 0.5.")
1569
1746
  };
1570
1747
  const captchaBody = (a) => ({
1571
1748
  mode: a.mode,
@@ -1577,19 +1754,19 @@ ${JSON.stringify(r, null, 2)}` : r;
1577
1754
  tool(
1578
1755
  "get_rights_captcha",
1579
1756
  "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() },
1757
+ { cbid: z5.string() },
1581
1758
  (a) => client.rightsCaptcha.get(a.cbid)
1582
1759
  );
1583
1760
  tool(
1584
1761
  "set_rights_captcha",
1585
1762
  `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 },
1763
+ { cbid: z5.string(), ...captchaInput },
1587
1764
  (a) => client.rightsCaptcha.set(a.cbid, captchaBody(a))
1588
1765
  );
1589
1766
  tool(
1590
1767
  "remove_rights_captcha",
1591
1768
  "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() },
1769
+ { cbid: z5.string() },
1593
1770
  (a) => client.rightsCaptcha.remove(a.cbid)
1594
1771
  );
1595
1772
  tool(
@@ -1612,15 +1789,15 @@ ${JSON.stringify(r, null, 2)}` : r;
1612
1789
  );
1613
1790
  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
1791
  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.")
1792
+ type: z5.enum(["clerk", "atlas", "oidc_jwt"]).describe("clerk, atlas (Clerk-shaped), or oidc_jwt (any issuer that signs session JWTs with a published JWKS)."),
1793
+ issuer: z5.string().describe("https URL exactly as in the token\u2019s iss (Clerk: your Frontend API URL)."),
1794
+ jwksUrl: z5.string().optional().describe("Required for oidc_jwt; clerk/atlas default to <issuer>/.well-known/jwks.json."),
1795
+ audience: z5.string().optional().describe("Expected aud. For oidc_jwt an audience or authorizedParties is required (a shared issuer mints tokens for every app)."),
1796
+ authorizedParties: z5.array(z5.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."),
1797
+ emailClaim: z5.string().optional().describe("Default email."),
1798
+ emailVerifiedClaim: z5.string().optional().describe("Default email_verified; must be exactly true."),
1799
+ sessionCookieName: z5.string().optional().describe("Default __session: the cookie the hosted page on your custom domain reads."),
1800
+ trustEmailClaim: z5.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
1801
  };
1625
1802
  const identityBody = (a) => {
1626
1803
  const out = { type: a.type, issuer: a.issuer };
@@ -1630,19 +1807,19 @@ ${JSON.stringify(r, null, 2)}` : r;
1630
1807
  tool(
1631
1808
  "get_rights_identity",
1632
1809
  "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() },
1810
+ { cbid: z5.string() },
1634
1811
  (a) => client.rightsIdentity.get(a.cbid)
1635
1812
  );
1636
1813
  tool(
1637
1814
  "set_rights_identity",
1638
1815
  `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 },
1816
+ { cbid: z5.string(), ...identityInput },
1640
1817
  (a) => client.rightsIdentity.set(a.cbid, identityBody(a))
1641
1818
  );
1642
1819
  tool(
1643
1820
  "remove_rights_identity",
1644
1821
  "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() },
1822
+ { cbid: z5.string() },
1646
1823
  (a) => client.rightsIdentity.remove(a.cbid)
1647
1824
  );
1648
1825
  tool(
@@ -1666,22 +1843,22 @@ ${JSON.stringify(r, null, 2)}` : r;
1666
1843
  tool(
1667
1844
  "get_audit_log",
1668
1845
  "The organisation\u2019s audit log, newest first: administrative changes made in the dashboard or through the API, and who made them. Read-only.",
1669
- { limit: z4.number().int().min(1).max(500).optional() },
1846
+ { limit: z5.number().int().min(1).max(500).optional() },
1670
1847
  (a) => client.audit(a.limit)
1671
1848
  );
1672
1849
  tool(
1673
1850
  "upload_asset",
1674
1851
  "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.",
1675
1852
  {
1676
- data: z4.string(),
1677
- contentType: z4.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1853
+ data: z5.string(),
1854
+ contentType: z5.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1678
1855
  },
1679
1856
  (a) => client.assets.upload({ data: a.data, contentType: a.contentType })
1680
1857
  );
1681
1858
  tool(
1682
1859
  "delete_asset",
1683
1860
  "Delete a stored image by its URL (or file name). Only your own organisation\u2019s images can be named.",
1684
- { url: z4.string().describe("The URL upload_asset returned, or just its file name.") },
1861
+ { url: z5.string().describe("The URL upload_asset returned, or just its file name.") },
1685
1862
  async (a) => {
1686
1863
  await client.assets.delete(a.url);
1687
1864
  return { deleted: a.url };
@@ -1696,18 +1873,18 @@ ${JSON.stringify(r, null, 2)}` : r;
1696
1873
  tool(
1697
1874
  "get_customer",
1698
1875
  "One child org: its controller details and usage. Read-only.",
1699
- { id: z4.string() },
1876
+ { id: z5.string() },
1700
1877
  (a) => client.reseller.get(a.id)
1701
1878
  );
1702
1879
  tool(
1703
1880
  "provision_customer",
1704
1881
  "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.",
1705
1882
  {
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()
1883
+ name: z5.string(),
1884
+ ownerEmail: z5.string().optional(),
1885
+ delegatedAccess: z5.boolean().optional().describe("Whether this reseller may act inside the child."),
1886
+ mintKey: z5.boolean().optional(),
1887
+ keyScopes: z5.array(z5.string()).optional()
1711
1888
  },
1712
1889
  (a) => client.reseller.create({
1713
1890
  name: a.name,
@@ -1721,10 +1898,10 @@ ${JSON.stringify(r, null, 2)}` : r;
1721
1898
  "update_customer",
1722
1899
  "Change a child org\u2019s status, delegated access or DSAR routing. `dsarRouting: null` clears the override.",
1723
1900
  {
1724
- id: z4.string(),
1725
- status: z4.enum(["active", "suspended"]).optional(),
1726
- delegatedAccess: z4.boolean().optional(),
1727
- dsarRouting: z4.enum(["reseller", "child"]).nullable().optional()
1901
+ id: z5.string(),
1902
+ status: z5.enum(["active", "suspended"]).optional(),
1903
+ delegatedAccess: z5.boolean().optional(),
1904
+ dsarRouting: z5.enum(["reseller", "child"]).nullable().optional()
1728
1905
  },
1729
1906
  (a) => client.reseller.update(a.id, {
1730
1907
  ...a.status ? { status: a.status } : {},
@@ -1735,7 +1912,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1735
1912
  tool(
1736
1913
  "suspend_customer",
1737
1914
  "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.)",
1738
- { id: z4.string() },
1915
+ { id: z5.string() },
1739
1916
  async (a) => {
1740
1917
  await client.reseller.deprovision(a.id);
1741
1918
  return { suspended: a.id };
@@ -1744,72 +1921,72 @@ ${JSON.stringify(r, null, 2)}` : r;
1744
1921
  tool(
1745
1922
  "list_customer_keys",
1746
1923
  "A child org's API key prefixes. Never the secrets. Read-only.",
1747
- { id: z4.string() },
1924
+ { id: z5.string() },
1748
1925
  (a) => client.reseller.listKeys(a.id)
1749
1926
  );
1750
1927
  tool(
1751
1928
  "issue_customer_key",
1752
1929
  "Mint an API key for a child org. The secret is returned once. Prefer scopes and a property lock over a full-access key.",
1753
- { id: z4.string(), name: z4.string().optional(), scopes: z4.array(z4.string()).optional(), cbids: z4.array(z4.string()).min(1).optional() },
1930
+ { id: z5.string(), name: z5.string().optional(), scopes: z5.array(z5.string()).optional(), cbids: z5.array(z5.string()).min(1).optional() },
1754
1931
  (a) => client.reseller.mintKey(a.id, {
1755
1932
  ...a.name ? { name: a.name } : {},
1756
1933
  ...a.scopes ? { scopes: a.scopes } : {},
1757
1934
  ...a.cbids ? { cbids: a.cbids } : {}
1758
1935
  })
1759
1936
  );
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) => {
1937
+ tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: z5.string(), prefix: z5.string() }, async (a) => {
1761
1938
  await client.reseller.revokeKey(a.id, a.prefix);
1762
1939
  return { revoked: a.prefix };
1763
1940
  });
1764
1941
  tool(
1765
1942
  "erase_subject_data",
1766
1943
  "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.",
1767
- { cbid: z4.string(), stamp: z4.string() },
1944
+ { cbid: z5.string(), stamp: z5.string() },
1768
1945
  (a) => client.consent.eraseSubject(a.cbid, a.stamp)
1769
1946
  );
1770
1947
  tool(
1771
1948
  "export_subject_data",
1772
1949
  "Export a data subject's consent records (GDPR access/portability).",
1773
- { cbid: z4.string(), stamp: z4.string() },
1950
+ { cbid: z5.string(), stamp: z5.string() },
1774
1951
  (a) => client.consent.exportSubject(a.cbid, a.stamp)
1775
1952
  );
1776
1953
  tool("list_banners", "List reusable banner designs in your org.", {}, () => client.banners.list());
1777
1954
  tool(
1778
1955
  "create_banner",
1779
1956
  "Create a reusable banner design.",
1780
- { name: z4.string(), json: z4.record(z4.unknown()).describe("A v2 BannerConfig.") },
1957
+ { name: z5.string(), json: z5.record(z5.unknown()).describe("A v2 BannerConfig.") },
1781
1958
  (a) => client.banners.create({ name: a.name, json: a.json })
1782
1959
  );
1783
- tool("get_banner", "Get a banner design by id.", { id: z4.string() }, (a) => client.banners.get(a.id));
1960
+ tool("get_banner", "Get a banner design by id.", { id: z5.string() }, (a) => client.banners.get(a.id));
1784
1961
  tool(
1785
1962
  "update_banner",
1786
1963
  "Update a banner design (name and/or config).",
1787
- { id: z4.string(), name: z4.string().optional(), json: z4.record(z4.unknown()).optional() },
1964
+ { id: z5.string(), name: z5.string().optional(), json: z5.record(z5.unknown()).optional() },
1788
1965
  (a) => client.banners.update(a.id, {
1789
1966
  ...a.name !== void 0 ? { name: a.name } : {},
1790
1967
  ...a.json !== void 0 ? { json: a.json } : {}
1791
1968
  })
1792
1969
  );
1793
- tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: z4.string() }, async (a) => {
1970
+ tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: z5.string() }, async (a) => {
1794
1971
  await client.banners.delete(a.id);
1795
1972
  return { ok: true };
1796
1973
  });
1797
1974
  tool(
1798
1975
  "get_banner_assignments",
1799
1976
  "The sites (cbids) a banner design is currently assigned to. Read-only.",
1800
- { id: z4.string() },
1977
+ { id: z5.string() },
1801
1978
  (a) => client.banners.assignments(a.id)
1802
1979
  );
1803
1980
  tool(
1804
1981
  "assign_banner",
1805
1982
  "Set which sites (cbids) use a banner design.",
1806
- { id: z4.string(), cbids: z4.array(z4.string()) },
1983
+ { id: z5.string(), cbids: z5.array(z5.string()) },
1807
1984
  (a) => client.banners.setAssignments(a.id, a.cbids)
1808
1985
  );
1809
1986
  tool(
1810
1987
  "publish_banner",
1811
1988
  "Publish a design live to all its assigned sites.",
1812
- { id: z4.string() },
1989
+ { id: z5.string() },
1813
1990
  (a) => client.banners.publish(a.id)
1814
1991
  );
1815
1992
  }
@@ -1826,4 +2003,4 @@ export {
1826
2003
  registerTools,
1827
2004
  createCookieMunchMcp
1828
2005
  };
1829
- //# sourceMappingURL=chunk-VP3KZHLC.js.map
2006
+ //# sourceMappingURL=chunk-SKCEQX3L.js.map