@cookiemunch/mcp 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/dist/bin.cjs +514 -146
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +2 -2
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-Y4NTLOVB.js → chunk-PLBLLTYO.js} +514 -146
- package/dist/chunk-PLBLLTYO.js.map +1 -0
- package/dist/index.cjs +513 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-Y4NTLOVB.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
28
28
|
var import_sdk = require("@cookiemunch/sdk");
|
|
29
29
|
|
|
30
30
|
// src/tools.ts
|
|
31
|
-
var
|
|
31
|
+
var import_zod4 = require("zod");
|
|
32
32
|
|
|
33
33
|
// src/tools-config.ts
|
|
34
34
|
var import_zod = require("zod");
|
|
@@ -568,9 +568,29 @@ function registerPlatformTools(tool, client) {
|
|
|
568
568
|
secretKey: import_zod2.z.string().describe("Its API key, with whatever scope that system needs to export and erase a user."),
|
|
569
569
|
webhookSecret: import_zod2.z.string().optional().describe("Signing secret of its webhook endpoint. Optional: polling closes tasks without it."),
|
|
570
570
|
auto: import_zod2.z.boolean().optional().describe("Open a sub-task automatically when a request reaches fulfilment. Default true."),
|
|
571
|
-
profile: import_zod2.z.record(import_zod2.z.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.")
|
|
571
|
+
profile: import_zod2.z.record(import_zod2.z.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."),
|
|
572
|
+
dryRun: import_zod2.z.boolean().optional().describe("Validate everything and answer the connection that would be created, storing nothing.")
|
|
573
|
+
},
|
|
574
|
+
(a) => {
|
|
575
|
+
const { dryRun, ...input } = a;
|
|
576
|
+
return dryRun === true ? client.fulfillment.dryRunConnectExecutor(input) : client.fulfillment.connectExecutor(input);
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
tool(
|
|
580
|
+
"test_dsar_executor_webhook",
|
|
581
|
+
"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.",
|
|
582
|
+
{
|
|
583
|
+
id: import_zod2.z.string().describe("The connection id."),
|
|
584
|
+
headers: import_zod2.z.record(import_zod2.z.string()).describe("The delivery headers, e.g. its id, timestamp and signature headers."),
|
|
585
|
+
body: import_zod2.z.string().describe("The raw body exactly as it was signed.")
|
|
572
586
|
},
|
|
573
|
-
(a) => client.fulfillment.
|
|
587
|
+
(a) => client.fulfillment.testExecutorWebhook(a.id, { headers: a.headers, body: a.body })
|
|
588
|
+
);
|
|
589
|
+
tool(
|
|
590
|
+
"list_dsar_executor_webhook_deliveries",
|
|
591
|
+
"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.",
|
|
592
|
+
{ id: import_zod2.z.string().describe("The connection id.") },
|
|
593
|
+
(a) => client.fulfillment.executorWebhookDeliveries(a.id)
|
|
574
594
|
);
|
|
575
595
|
tool(
|
|
576
596
|
"disconnect_dsar_executor",
|
|
@@ -683,10 +703,176 @@ function registerPlatformTools(tool, client) {
|
|
|
683
703
|
);
|
|
684
704
|
}
|
|
685
705
|
|
|
706
|
+
// src/tools-rights-page.ts
|
|
707
|
+
var import_zod3 = require("zod");
|
|
708
|
+
function registerRightsTools(tool, client) {
|
|
709
|
+
const cbid = { cbid: import_zod3.z.string().describe("Site identifier (cbid). Must belong to your org.") };
|
|
710
|
+
const base = {
|
|
711
|
+
baseUpdatedAt: import_zod3.z.union([import_zod3.z.number().int(), import_zod3.z.string(), import_zod3.z.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.")
|
|
712
|
+
};
|
|
713
|
+
const baseOpt = (a) => a.baseUpdatedAt !== void 0 ? { baseUpdatedAt: a.baseUpdatedAt } : {};
|
|
714
|
+
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));
|
|
715
|
+
tool(
|
|
716
|
+
"update_rights_page",
|
|
717
|
+
"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.",
|
|
718
|
+
{ ...cbid, page: import_zod3.z.record(import_zod3.z.unknown()).describe("The whole RightsPage document (v: 1)."), ...base },
|
|
719
|
+
(a) => client.rightsPage.put(a.cbid, a.page, baseOpt(a))
|
|
720
|
+
);
|
|
721
|
+
tool(
|
|
722
|
+
"patch_rights_page",
|
|
723
|
+
"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).",
|
|
724
|
+
{ ...cbid, patch: import_zod3.z.record(import_zod3.z.unknown()), ...base },
|
|
725
|
+
(a) => client.rightsPage.patch(a.cbid, a.patch, baseOpt(a))
|
|
726
|
+
);
|
|
727
|
+
tool(
|
|
728
|
+
"preview_rights_page",
|
|
729
|
+
'Validate a rights-page write WITHOUT saving: returns the document as it would be stored and any publish warnings. mode "patch" (default) or "put".',
|
|
730
|
+
{ ...cbid, page: import_zod3.z.record(import_zod3.z.unknown()), mode: import_zod3.z.enum(["patch", "put"]).optional() },
|
|
731
|
+
(a) => client.rightsPage.dryRun(a.cbid, a.page, { mode: a.mode ?? "patch" })
|
|
732
|
+
);
|
|
733
|
+
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));
|
|
734
|
+
tool(
|
|
735
|
+
"publish_rights_page",
|
|
736
|
+
"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.",
|
|
737
|
+
{ ...cbid, ...base },
|
|
738
|
+
(a) => client.rightsPage.publish(a.cbid, baseOpt(a))
|
|
739
|
+
);
|
|
740
|
+
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));
|
|
741
|
+
tool(
|
|
742
|
+
"rollback_rights_page",
|
|
743
|
+
"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.",
|
|
744
|
+
{ ...cbid, version: import_zod3.z.number().int().min(1), ...base },
|
|
745
|
+
(a) => client.rightsPage.rollback(a.cbid, a.version, baseOpt(a))
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
function registerRightsPageTools(tool, client) {
|
|
749
|
+
const site = import_zod3.z.object({ cbid: import_zod3.z.string().describe("Site identifier (cbid). Must belong to your org.") });
|
|
750
|
+
const host = site.extend({
|
|
751
|
+
hostname: import_zod3.z.string().describe("The custom hostname, e.g. privacy.example.com (unicode or punycode).")
|
|
752
|
+
});
|
|
753
|
+
tool(
|
|
754
|
+
"list_rights_page_domains",
|
|
755
|
+
"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.",
|
|
756
|
+
site.shape,
|
|
757
|
+
(a) => client.rightsPage.listDomains(site.parse(a).cbid)
|
|
758
|
+
);
|
|
759
|
+
tool(
|
|
760
|
+
"add_rights_page_domain",
|
|
761
|
+
"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.",
|
|
762
|
+
host.shape,
|
|
763
|
+
(a) => {
|
|
764
|
+
const { cbid, hostname } = host.parse(a);
|
|
765
|
+
return client.rightsPage.addDomain(cbid, hostname);
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
tool(
|
|
769
|
+
"verify_rights_page_domain",
|
|
770
|
+
"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.",
|
|
771
|
+
host.shape,
|
|
772
|
+
(a) => {
|
|
773
|
+
const { cbid, hostname } = host.parse(a);
|
|
774
|
+
return client.rightsPage.verifyDomain(cbid, hostname);
|
|
775
|
+
}
|
|
776
|
+
);
|
|
777
|
+
tool(
|
|
778
|
+
"remove_rights_page_domain",
|
|
779
|
+
"Remove a custom hostname from a site's rights page. It stops being served at once and its certificate is no longer renewed.",
|
|
780
|
+
host.shape,
|
|
781
|
+
async (a) => {
|
|
782
|
+
const { cbid, hostname } = host.parse(a);
|
|
783
|
+
await client.rightsPage.removeDomain(cbid, hostname);
|
|
784
|
+
return { removed: hostname };
|
|
785
|
+
}
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// src/design-warnings.ts
|
|
790
|
+
function whereText(f) {
|
|
791
|
+
const w = f.where ?? {};
|
|
792
|
+
const bits = [
|
|
793
|
+
f.layer === "banner" ? "first layer" : `${f.layer} layer`,
|
|
794
|
+
w.view ? `view "${w.view}"` : "",
|
|
795
|
+
w.variant && w.variant !== "base" ? `variant ${w.variant}` : "",
|
|
796
|
+
w.theme === "dark" ? "dark theme" : "",
|
|
797
|
+
w.breakpoint === "mobile" ? "mobile" : "",
|
|
798
|
+
w.language ? `language ${w.language}` : "",
|
|
799
|
+
w.url ? w.url : ""
|
|
800
|
+
].filter(Boolean);
|
|
801
|
+
return bits.join(", ");
|
|
802
|
+
}
|
|
803
|
+
function styleText(s) {
|
|
804
|
+
const parts = [
|
|
805
|
+
s.background ? `background ${s.background}` : "",
|
|
806
|
+
s.color ? `text ${s.color}` : "",
|
|
807
|
+
s.borderColor ? `border ${s.borderWidth ?? 1}px ${s.borderColor}` : "",
|
|
808
|
+
s.fontSize ? `font ${s.fontSize}px` : "",
|
|
809
|
+
s.fontWeight ? `weight ${s.fontWeight}` : "",
|
|
810
|
+
s.width && s.height ? `${Math.round(s.width)}\xD7${Math.round(s.height)}px` : ""
|
|
811
|
+
].filter(Boolean);
|
|
812
|
+
return parts.join(", ");
|
|
813
|
+
}
|
|
814
|
+
var CONTEXT_TEXT = {
|
|
815
|
+
saved: "The config was saved as sent; this is a warning, not an error.",
|
|
816
|
+
preview: "Nothing was saved: this is a preview of the write.",
|
|
817
|
+
lint: "Nothing was saved: this is a lint of a proposed config.",
|
|
818
|
+
read: "This describes the config as it is stored now; nothing was changed.",
|
|
819
|
+
scan: "This was measured on the live site by the last cookie scan; fix the banner, then scan again."
|
|
820
|
+
};
|
|
821
|
+
function designContext(tool, value) {
|
|
822
|
+
const v = value && typeof value === "object" ? value : {};
|
|
823
|
+
if (tool === "lint_banner_config") return "lint";
|
|
824
|
+
if (v.dryRun === true || tool.startsWith("preview_")) return "preview";
|
|
825
|
+
if (v.buttonParity && typeof v.buttonParity === "object") return "scan";
|
|
826
|
+
if (/^(update|patch|set|edit|create|assign|apply)_/.test(tool)) return "saved";
|
|
827
|
+
return "read";
|
|
828
|
+
}
|
|
829
|
+
function designWarningText(findings, suggested, context = "read") {
|
|
830
|
+
if (!Array.isArray(findings) || findings.length === 0) return "";
|
|
831
|
+
const warnings = findings.filter((f) => f.severity === "warning");
|
|
832
|
+
const notices = findings.filter((f) => f.severity !== "warning");
|
|
833
|
+
const lines = [];
|
|
834
|
+
if (warnings.length) {
|
|
835
|
+
lines.push(
|
|
836
|
+
`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]}`
|
|
837
|
+
);
|
|
838
|
+
for (const f of warnings) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
|
|
839
|
+
}
|
|
840
|
+
if (notices.length) {
|
|
841
|
+
lines.push(
|
|
842
|
+
`Design notice: ${notices.length} thing${notices.length === 1 ? "" : "s"} to check about how Reject compares with Accept.` + (warnings.length ? "" : ` ${CONTEXT_TEXT[context]}`)
|
|
843
|
+
);
|
|
844
|
+
for (const f of notices) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
|
|
845
|
+
}
|
|
846
|
+
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 }));
|
|
847
|
+
for (const s of fixes) {
|
|
848
|
+
const style = styleText(s);
|
|
849
|
+
if (style) {
|
|
850
|
+
lines.push(
|
|
851
|
+
`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.`
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return lines.join("\n");
|
|
856
|
+
}
|
|
857
|
+
function withDesignWarnings(value, body, tool = "") {
|
|
858
|
+
if (!value || typeof value !== "object") return body;
|
|
859
|
+
const nested = value.buttonParity;
|
|
860
|
+
const v = nested && typeof nested === "object" ? nested : value;
|
|
861
|
+
if (!Array.isArray(v.designWarnings) || v.designWarnings.length === 0) return body;
|
|
862
|
+
const head = designWarningText(
|
|
863
|
+
v.designWarnings,
|
|
864
|
+
Array.isArray(v.suggestedReject) ? v.suggestedReject : void 0,
|
|
865
|
+
designContext(tool, value)
|
|
866
|
+
);
|
|
867
|
+
return head ? `${head}
|
|
868
|
+
|
|
869
|
+
${body}` : body;
|
|
870
|
+
}
|
|
871
|
+
|
|
686
872
|
// src/tools.ts
|
|
687
|
-
function text(value) {
|
|
873
|
+
function text(value, tool = "") {
|
|
688
874
|
const body = typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
689
|
-
return { content: [{ type: "text", text: body }] };
|
|
875
|
+
return { content: [{ type: "text", text: withDesignWarnings(value, body, tool) }] };
|
|
690
876
|
}
|
|
691
877
|
function fail(err) {
|
|
692
878
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -696,16 +882,16 @@ function registerTools(server, client) {
|
|
|
696
882
|
const tool = (name, description, inputSchema, run) => {
|
|
697
883
|
server.registerTool(name, { description, inputSchema }, async (args) => {
|
|
698
884
|
try {
|
|
699
|
-
return text(await run(args));
|
|
885
|
+
return text(await run(args), name);
|
|
700
886
|
} catch (err) {
|
|
701
887
|
return fail(err);
|
|
702
888
|
}
|
|
703
889
|
});
|
|
704
890
|
};
|
|
705
|
-
const cbid = { cbid:
|
|
891
|
+
const cbid = { cbid: import_zod4.z.string().describe("Site identifier (cbid). Must belong to your org.") };
|
|
706
892
|
const range = {
|
|
707
|
-
from:
|
|
708
|
-
to:
|
|
893
|
+
from: import_zod4.z.number().optional().describe("Epoch-ms lower bound."),
|
|
894
|
+
to: import_zod4.z.number().optional().describe("Epoch-ms upper bound.")
|
|
709
895
|
};
|
|
710
896
|
tool(
|
|
711
897
|
"whoami",
|
|
@@ -723,19 +909,19 @@ function registerTools(server, client) {
|
|
|
723
909
|
tool(
|
|
724
910
|
"get_site",
|
|
725
911
|
"One site: its domain, cbid and verification status. Read-only.",
|
|
726
|
-
{ cbid:
|
|
912
|
+
{ cbid: import_zod4.z.string() },
|
|
727
913
|
(a) => client.sites.get(a.cbid)
|
|
728
914
|
);
|
|
729
915
|
tool(
|
|
730
916
|
"get_site_banner",
|
|
731
917
|
"Which banner design a site uses, or bannerId null when none is assigned. Read-only.",
|
|
732
|
-
{ cbid:
|
|
918
|
+
{ cbid: import_zod4.z.string() },
|
|
733
919
|
(a) => client.sites.banner(a.cbid)
|
|
734
920
|
);
|
|
735
921
|
tool(
|
|
736
922
|
"get_privacy_policy",
|
|
737
923
|
"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.",
|
|
738
|
-
{ cbid:
|
|
924
|
+
{ cbid: import_zod4.z.string(), contactEmail: import_zod4.z.string().optional(), effectiveDate: import_zod4.z.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: import_zod4.z.array(import_zod4.z.string()).optional() },
|
|
739
925
|
(a) => client.sites.policy(a.cbid, {
|
|
740
926
|
...a.contactEmail ? { contactEmail: a.contactEmail } : {},
|
|
741
927
|
...a.effectiveDate ? { effectiveDate: a.effectiveDate } : {},
|
|
@@ -745,7 +931,7 @@ function registerTools(server, client) {
|
|
|
745
931
|
tool(
|
|
746
932
|
"set_ad_personalization",
|
|
747
933
|
"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.",
|
|
748
|
-
{ cbid:
|
|
934
|
+
{ cbid: import_zod4.z.string(), enabled: import_zod4.z.boolean(), default: import_zod4.z.boolean().optional(), label: import_zod4.z.string().optional() },
|
|
749
935
|
(a) => client.sites.setAdPersonalization(a.cbid, {
|
|
750
936
|
enabled: a.enabled,
|
|
751
937
|
...a.default !== void 0 ? { default: a.default } : {},
|
|
@@ -756,11 +942,11 @@ function registerTools(server, client) {
|
|
|
756
942
|
"analyze_session",
|
|
757
943
|
"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.",
|
|
758
944
|
{
|
|
759
|
-
cbid:
|
|
760
|
-
har:
|
|
761
|
-
requests:
|
|
762
|
-
consent:
|
|
763
|
-
gpc:
|
|
945
|
+
cbid: import_zod4.z.string(),
|
|
946
|
+
har: import_zod4.z.unknown().optional().describe("A HAR export of the session."),
|
|
947
|
+
requests: import_zod4.z.array(import_zod4.z.unknown()).optional().describe("Or the requests directly."),
|
|
948
|
+
consent: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.boolean()).optional(),
|
|
949
|
+
gpc: import_zod4.z.boolean().optional()
|
|
764
950
|
},
|
|
765
951
|
(a) => client.sites.analyzeSession(a.cbid, {
|
|
766
952
|
...a.har !== void 0 ? { har: a.har } : {},
|
|
@@ -772,14 +958,14 @@ function registerTools(server, client) {
|
|
|
772
958
|
tool(
|
|
773
959
|
"create_site",
|
|
774
960
|
"Create a new site. The cbid is auto-generated if you omit it.",
|
|
775
|
-
{ domain:
|
|
961
|
+
{ domain: import_zod4.z.string().describe("The site domain, e.g. example.com."), cbid: import_zod4.z.string().optional().describe("Optional explicit cbid.") },
|
|
776
962
|
(a) => client.sites.create({ domain: a.domain, ...typeof a.cbid === "string" ? { cbid: a.cbid } : {} })
|
|
777
963
|
);
|
|
778
964
|
tool(
|
|
779
965
|
"create_sites_bulk",
|
|
780
966
|
"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.",
|
|
781
967
|
{
|
|
782
|
-
sites:
|
|
968
|
+
sites: import_zod4.z.array(import_zod4.z.object({ domain: import_zod4.z.string(), cbid: import_zod4.z.string().optional(), platform: import_zod4.z.string().optional() })).min(1).max(100)
|
|
783
969
|
},
|
|
784
970
|
(a) => client.sites.createBulk(a.sites)
|
|
785
971
|
);
|
|
@@ -789,15 +975,15 @@ function registerTools(server, client) {
|
|
|
789
975
|
"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.",
|
|
790
976
|
{
|
|
791
977
|
...cbid,
|
|
792
|
-
config:
|
|
793
|
-
keepUnspecified:
|
|
978
|
+
config: import_zod4.z.record(import_zod4.z.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
|
|
979
|
+
keepUnspecified: import_zod4.z.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
|
|
794
980
|
},
|
|
795
981
|
(a) => a.keepUnspecified === true ? client.sites.putConfig(a.cbid, a.config, { keep: "unspecified" }) : client.sites.putConfig(a.cbid, a.config)
|
|
796
982
|
);
|
|
797
983
|
tool(
|
|
798
984
|
"patch_site_config",
|
|
799
985
|
`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.`,
|
|
800
|
-
{ ...cbid, config:
|
|
986
|
+
{ ...cbid, config: import_zod4.z.record(import_zod4.z.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
|
|
801
987
|
(a) => client.sites.patchConfig(a.cbid, a.config)
|
|
802
988
|
);
|
|
803
989
|
tool(
|
|
@@ -805,15 +991,30 @@ function registerTools(server, client) {
|
|
|
805
991
|
'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.',
|
|
806
992
|
{
|
|
807
993
|
...cbid,
|
|
808
|
-
config:
|
|
809
|
-
mode:
|
|
810
|
-
keepUnspecified:
|
|
994
|
+
config: import_zod4.z.record(import_zod4.z.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
|
|
995
|
+
mode: import_zod4.z.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
|
|
996
|
+
keepUnspecified: import_zod4.z.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
|
|
811
997
|
},
|
|
812
998
|
(a) => client.sites.dryRunConfig(a.cbid, a.config, {
|
|
813
999
|
mode: a.mode ?? "patch",
|
|
814
1000
|
...a.keepUnspecified === true ? { keep: "unspecified" } : {}
|
|
815
1001
|
})
|
|
816
1002
|
);
|
|
1003
|
+
tool(
|
|
1004
|
+
"lint_banner_config",
|
|
1005
|
+
'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.',
|
|
1006
|
+
{
|
|
1007
|
+
...cbid,
|
|
1008
|
+
config: import_zod4.z.record(import_zod4.z.unknown()).describe("The proposed SiteConfig (or a partial one, or a v2 flow design)."),
|
|
1009
|
+
replace: import_zod4.z.boolean().optional().describe("Check what update_site_config (a full replace) would store, instead of what patch_site_config (a merge) would.")
|
|
1010
|
+
},
|
|
1011
|
+
async (a) => {
|
|
1012
|
+
const r = await client.sites.lintConfig(a.cbid, a.config, a.replace === true ? { replace: true } : {});
|
|
1013
|
+
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.
|
|
1014
|
+
|
|
1015
|
+
${JSON.stringify(r, null, 2)}` : r;
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
817
1018
|
tool(
|
|
818
1019
|
"verify_consent_log",
|
|
819
1020
|
"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.",
|
|
@@ -829,7 +1030,7 @@ function registerTools(server, client) {
|
|
|
829
1030
|
tool(
|
|
830
1031
|
"get_consent_log",
|
|
831
1032
|
"Get recent anonymised consent records for a site.",
|
|
832
|
-
{ ...cbid, ...range, limit:
|
|
1033
|
+
{ ...cbid, ...range, limit: import_zod4.z.number().optional().describe("Max records to return (default 200).") },
|
|
833
1034
|
(a) => client.consent.log(a.cbid, {
|
|
834
1035
|
from: a.from,
|
|
835
1036
|
to: a.to,
|
|
@@ -839,49 +1040,53 @@ function registerTools(server, client) {
|
|
|
839
1040
|
tool(
|
|
840
1041
|
"get_subject_consent",
|
|
841
1042
|
"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.",
|
|
842
|
-
{ subjectId:
|
|
1043
|
+
{ subjectId: import_zod4.z.string() },
|
|
843
1044
|
(a) => client.subjects.consent(a.subjectId)
|
|
844
1045
|
);
|
|
845
1046
|
tool("list_dsar", "List all Data Subject Access Requests for your organization.", {}, () => client.dsar.list());
|
|
846
1047
|
tool(
|
|
847
1048
|
"update_dsar_executor",
|
|
848
|
-
"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.",
|
|
849
|
-
{
|
|
850
|
-
|
|
1049
|
+
"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.",
|
|
1050
|
+
{
|
|
1051
|
+
id: import_zod4.z.string(),
|
|
1052
|
+
patch: import_zod4.z.record(import_zod4.z.unknown()),
|
|
1053
|
+
dryRun: import_zod4.z.boolean().optional().describe("Validate and diff without saving.")
|
|
1054
|
+
},
|
|
1055
|
+
(a) => a.dryRun === true ? client.fulfillment.dryRunUpdateExecutor(a.id, a.patch) : client.fulfillment.updateExecutor(a.id, a.patch)
|
|
851
1056
|
);
|
|
852
1057
|
tool(
|
|
853
1058
|
"get_dsar",
|
|
854
1059
|
"One rights request by id, including its status and the deadline it must be answered by.",
|
|
855
|
-
{ id:
|
|
1060
|
+
{ id: import_zod4.z.string() },
|
|
856
1061
|
(a) => client.dsar.get(a.id)
|
|
857
1062
|
);
|
|
858
1063
|
tool(
|
|
859
1064
|
"erase_dsar_subject",
|
|
860
1065
|
"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.",
|
|
861
|
-
{ id:
|
|
1066
|
+
{ id: import_zod4.z.string(), cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
|
|
862
1067
|
(a) => client.dsar.erase(a.id, a.cbid, a.stamp)
|
|
863
1068
|
);
|
|
864
1069
|
tool(
|
|
865
1070
|
"export_dsar_subject",
|
|
866
1071
|
"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.",
|
|
867
|
-
{ id:
|
|
1072
|
+
{ id: import_zod4.z.string(), cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
|
|
868
1073
|
(a) => client.dsar.export(a.id, a.cbid, a.stamp)
|
|
869
1074
|
);
|
|
870
1075
|
tool(
|
|
871
1076
|
"get_dsar_response_notice",
|
|
872
1077
|
"The subject-facing response notice for a request, as plain text \u2014 what to send the person. Read-only; nothing is sent.",
|
|
873
|
-
{ id:
|
|
1078
|
+
{ id: import_zod4.z.string() },
|
|
874
1079
|
(a) => client.dsar.response(a.id)
|
|
875
1080
|
);
|
|
876
1081
|
tool(
|
|
877
1082
|
"create_dsar",
|
|
878
1083
|
"Open a new Data Subject Access Request.",
|
|
879
1084
|
{
|
|
880
|
-
type:
|
|
881
|
-
subjectEmail:
|
|
882
|
-
regulation:
|
|
883
|
-
note:
|
|
884
|
-
test:
|
|
1085
|
+
type: import_zod4.z.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
|
|
1086
|
+
subjectEmail: import_zod4.z.string().describe("The data subject\u2019s email."),
|
|
1087
|
+
regulation: import_zod4.z.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
|
|
1088
|
+
note: import_zod4.z.string().optional().describe("Optional free-text note."),
|
|
1089
|
+
test: import_zod4.z.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
|
|
885
1090
|
},
|
|
886
1091
|
(a) => client.dsar.create({
|
|
887
1092
|
type: a.type,
|
|
@@ -891,10 +1096,26 @@ function registerTools(server, client) {
|
|
|
891
1096
|
...a.test === true ? { test: true } : {}
|
|
892
1097
|
})
|
|
893
1098
|
);
|
|
1099
|
+
tool(
|
|
1100
|
+
"create_rights_link",
|
|
1101
|
+
"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.",
|
|
1102
|
+
{
|
|
1103
|
+
cbid: import_zod4.z.string().describe("Site identifier (cbid). Must belong to your org."),
|
|
1104
|
+
email: import_zod4.z.string().describe("The signed-in person\u2019s verified email address."),
|
|
1105
|
+
userId: import_zod4.z.string().optional().describe("Your own account id for them; recorded on the request."),
|
|
1106
|
+
rights: import_zod4.z.array(import_zod4.z.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."),
|
|
1107
|
+
ttlSeconds: import_zod4.z.number().int().min(60).max(3600).optional().describe("How long the link works, in seconds (default 900).")
|
|
1108
|
+
},
|
|
1109
|
+
(a) => client.rightsLinks.create(a.cbid, {
|
|
1110
|
+
subject: { email: a.email, ...typeof a.userId === "string" ? { userId: a.userId } : {} },
|
|
1111
|
+
...Array.isArray(a.rights) ? { rights: a.rights } : {},
|
|
1112
|
+
...typeof a.ttlSeconds === "number" ? { ttlSeconds: a.ttlSeconds } : {}
|
|
1113
|
+
})
|
|
1114
|
+
);
|
|
894
1115
|
tool(
|
|
895
1116
|
"delete_test_dsar",
|
|
896
1117
|
"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.",
|
|
897
|
-
{ id:
|
|
1118
|
+
{ id: import_zod4.z.string().describe("The test request id.") },
|
|
898
1119
|
async (a) => {
|
|
899
1120
|
await client.dsar.delete(a.id);
|
|
900
1121
|
return { deleted: a.id };
|
|
@@ -903,15 +1124,15 @@ function registerTools(server, client) {
|
|
|
903
1124
|
tool(
|
|
904
1125
|
"mark_dsar_test",
|
|
905
1126
|
"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 }.",
|
|
906
|
-
{ id:
|
|
1127
|
+
{ id: import_zod4.z.string().describe("The closed request id.") },
|
|
907
1128
|
(a) => client.dsar.markTest(a.id)
|
|
908
1129
|
);
|
|
909
1130
|
tool(
|
|
910
1131
|
"advance_dsar",
|
|
911
1132
|
"Advance a DSAR to a new status (received \u2192 verifying \u2192 in_progress \u2192 completed, or rejected).",
|
|
912
1133
|
{
|
|
913
|
-
id:
|
|
914
|
-
toStatus:
|
|
1134
|
+
id: import_zod4.z.string().describe("The DSAR id."),
|
|
1135
|
+
toStatus: import_zod4.z.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
|
|
915
1136
|
},
|
|
916
1137
|
(a) => client.dsar.advance(a.id, a.toStatus)
|
|
917
1138
|
);
|
|
@@ -924,7 +1145,7 @@ function registerTools(server, client) {
|
|
|
924
1145
|
tool(
|
|
925
1146
|
"get_receipt",
|
|
926
1147
|
"Fetch the signed consent receipt for a single consent record (by stamp).",
|
|
927
|
-
{ ...cbid, stamp:
|
|
1148
|
+
{ ...cbid, stamp: import_zod4.z.string().describe("The consent record stamp/id.") },
|
|
928
1149
|
(a) => client.consent.receipt(a.cbid, a.stamp)
|
|
929
1150
|
);
|
|
930
1151
|
tool("delete_site", "Delete a site (cbid) and its configuration from your org.", { ...cbid }, async (a) => {
|
|
@@ -936,13 +1157,13 @@ function registerTools(server, client) {
|
|
|
936
1157
|
"create_vendor",
|
|
937
1158
|
"Register a vendor (processor) and compute its risk score.",
|
|
938
1159
|
{
|
|
939
|
-
name:
|
|
940
|
-
category:
|
|
941
|
-
dataShared:
|
|
942
|
-
dpaSigned:
|
|
943
|
-
subprocessors:
|
|
944
|
-
certifications:
|
|
945
|
-
region:
|
|
1160
|
+
name: import_zod4.z.string().describe("Vendor name."),
|
|
1161
|
+
category: import_zod4.z.string().describe("Vendor category, e.g. analytics."),
|
|
1162
|
+
dataShared: import_zod4.z.array(import_zod4.z.string()).describe("Categories of data shared with the vendor."),
|
|
1163
|
+
dpaSigned: import_zod4.z.boolean().describe("Whether a Data Processing Agreement is signed."),
|
|
1164
|
+
subprocessors: import_zod4.z.number().describe("Number of subprocessors."),
|
|
1165
|
+
certifications: import_zod4.z.array(import_zod4.z.string()).describe("Compliance certifications, e.g. ISO27001."),
|
|
1166
|
+
region: import_zod4.z.string().describe("Primary processing region, e.g. EU.")
|
|
946
1167
|
},
|
|
947
1168
|
(a) => client.vendors.create({
|
|
948
1169
|
name: a.name,
|
|
@@ -960,13 +1181,13 @@ function registerTools(server, client) {
|
|
|
960
1181
|
"create_ropa",
|
|
961
1182
|
"Create a Record of Processing Activity (RoPA) entry.",
|
|
962
1183
|
{
|
|
963
|
-
name:
|
|
964
|
-
purpose:
|
|
965
|
-
legalBasis:
|
|
966
|
-
dataCategories:
|
|
967
|
-
recipients:
|
|
968
|
-
retentionDays:
|
|
969
|
-
crossBorderTransfer:
|
|
1184
|
+
name: import_zod4.z.string().describe("Activity name."),
|
|
1185
|
+
purpose: import_zod4.z.string().describe("Purpose of processing."),
|
|
1186
|
+
legalBasis: import_zod4.z.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
|
|
1187
|
+
dataCategories: import_zod4.z.array(import_zod4.z.string()).describe("Categories of personal data."),
|
|
1188
|
+
recipients: import_zod4.z.array(import_zod4.z.string()).describe("Recipients of the data."),
|
|
1189
|
+
retentionDays: import_zod4.z.number().describe("Retention period in days."),
|
|
1190
|
+
crossBorderTransfer: import_zod4.z.boolean().describe("Whether data is transferred across borders.")
|
|
970
1191
|
},
|
|
971
1192
|
(a) => client.ropa.create({
|
|
972
1193
|
name: a.name,
|
|
@@ -1012,9 +1233,9 @@ function registerTools(server, client) {
|
|
|
1012
1233
|
"create_webhook",
|
|
1013
1234
|
"Create a webhook subscription. The response includes the signing secret (shown once).",
|
|
1014
1235
|
{
|
|
1015
|
-
url:
|
|
1016
|
-
events:
|
|
1017
|
-
cbid:
|
|
1236
|
+
url: import_zod4.z.string().describe("HTTPS endpoint to deliver events to."),
|
|
1237
|
+
events: import_zod4.z.array(import_zod4.z.string()).describe("Event names to subscribe to, e.g. consent.created."),
|
|
1238
|
+
cbid: import_zod4.z.string().optional().describe("Optional site cbid to scope the subscription to.")
|
|
1018
1239
|
},
|
|
1019
1240
|
(a) => client.webhooks.create({
|
|
1020
1241
|
url: a.url,
|
|
@@ -1025,13 +1246,13 @@ function registerTools(server, client) {
|
|
|
1025
1246
|
tool(
|
|
1026
1247
|
"roll_webhook_secret",
|
|
1027
1248
|
"Rotate a webhook subscription\u2019s signing secret. The new secret is returned once; the receiving endpoint must be updated to verify with it.",
|
|
1028
|
-
{ id:
|
|
1249
|
+
{ id: import_zod4.z.string() },
|
|
1029
1250
|
(a) => client.webhooks.rollSecret(a.id)
|
|
1030
1251
|
);
|
|
1031
1252
|
tool(
|
|
1032
1253
|
"test_webhook",
|
|
1033
1254
|
"Send a signed test event to a webhook subscription now, and report what the endpoint answered.",
|
|
1034
|
-
{ id:
|
|
1255
|
+
{ id: import_zod4.z.string() },
|
|
1035
1256
|
(a) => client.webhooks.test(a.id)
|
|
1036
1257
|
);
|
|
1037
1258
|
tool(
|
|
@@ -1043,18 +1264,18 @@ function registerTools(server, client) {
|
|
|
1043
1264
|
tool(
|
|
1044
1265
|
"replay_webhook_dead_letter",
|
|
1045
1266
|
"Deliver a dead-lettered webhook event again, to the subscription as it is now.",
|
|
1046
|
-
{ id:
|
|
1267
|
+
{ id: import_zod4.z.string() },
|
|
1047
1268
|
(a) => client.webhooks.replayDeadLetter(a.id)
|
|
1048
1269
|
);
|
|
1049
1270
|
tool(
|
|
1050
1271
|
"update_webhook",
|
|
1051
1272
|
"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.",
|
|
1052
1273
|
{
|
|
1053
|
-
id:
|
|
1054
|
-
url:
|
|
1055
|
-
events:
|
|
1056
|
-
cbid:
|
|
1057
|
-
active:
|
|
1274
|
+
id: import_zod4.z.string(),
|
|
1275
|
+
url: import_zod4.z.string().optional(),
|
|
1276
|
+
events: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1277
|
+
cbid: import_zod4.z.string().nullable().optional(),
|
|
1278
|
+
active: import_zod4.z.boolean().optional()
|
|
1058
1279
|
},
|
|
1059
1280
|
(a) => client.webhooks.update(a.id, {
|
|
1060
1281
|
...a.url !== void 0 ? { url: a.url } : {},
|
|
@@ -1063,20 +1284,20 @@ function registerTools(server, client) {
|
|
|
1063
1284
|
...a.active !== void 0 ? { active: a.active } : {}
|
|
1064
1285
|
})
|
|
1065
1286
|
);
|
|
1066
|
-
tool("delete_webhook", "Delete a webhook subscription by id.", { id:
|
|
1287
|
+
tool("delete_webhook", "Delete a webhook subscription by id.", { id: import_zod4.z.string().describe("The webhook subscription id.") }, async (a) => {
|
|
1067
1288
|
await client.webhooks.delete(a.id);
|
|
1068
1289
|
return { ok: true };
|
|
1069
1290
|
});
|
|
1070
1291
|
tool(
|
|
1071
1292
|
"verify_site",
|
|
1072
1293
|
"Verify that your organization controls a domain by one of three challenge methods (dns / meta / file). Required to unlock consent export and signed receipts.",
|
|
1073
|
-
{ ...cbid, method:
|
|
1294
|
+
{ ...cbid, method: import_zod4.z.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
|
|
1074
1295
|
(a) => client.sites.verify(a.cbid, a.method)
|
|
1075
1296
|
);
|
|
1076
1297
|
tool(
|
|
1077
1298
|
"get_verification_challenge",
|
|
1078
1299
|
"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.",
|
|
1079
|
-
{ cbid:
|
|
1300
|
+
{ cbid: import_zod4.z.string() },
|
|
1080
1301
|
(a) => client.sites.verifyChallenge(a.cbid)
|
|
1081
1302
|
);
|
|
1082
1303
|
tool(
|
|
@@ -1088,15 +1309,15 @@ function registerTools(server, client) {
|
|
|
1088
1309
|
tool(
|
|
1089
1310
|
"get_flow",
|
|
1090
1311
|
"Get the v2 banner flow config for a site, including current views, categories, and any lint issues.",
|
|
1091
|
-
{ cbid:
|
|
1312
|
+
{ cbid: import_zod4.z.string().describe("Site identifier (cbid).") },
|
|
1092
1313
|
(a) => client.sites.getFlow(a.cbid)
|
|
1093
1314
|
);
|
|
1094
1315
|
tool(
|
|
1095
1316
|
"edit_flow",
|
|
1096
1317
|
"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.",
|
|
1097
1318
|
{
|
|
1098
|
-
cbid:
|
|
1099
|
-
operations:
|
|
1319
|
+
cbid: import_zod4.z.string().describe("Site identifier (cbid)."),
|
|
1320
|
+
operations: import_zod4.z.array(import_zod4.z.record(import_zod4.z.unknown())).describe(
|
|
1100
1321
|
'Ordered list of ops. Each must have an "op" field: addView | removeView | addElement | setButtonTransition | addCustomCategory.'
|
|
1101
1322
|
)
|
|
1102
1323
|
},
|
|
@@ -1106,19 +1327,21 @@ function registerTools(server, client) {
|
|
|
1106
1327
|
"set_flow",
|
|
1107
1328
|
"Wholesale replace a site's v2 banner flow with a complete config (e.g. from a template). Validated server-side before it is saved.",
|
|
1108
1329
|
{
|
|
1109
|
-
cbid:
|
|
1110
|
-
config:
|
|
1330
|
+
cbid: import_zod4.z.string().describe("Site identifier (cbid)."),
|
|
1331
|
+
config: import_zod4.z.record(import_zod4.z.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
|
|
1111
1332
|
},
|
|
1112
1333
|
(a) => client.sites.setFlow(a.cbid, a.config)
|
|
1113
1334
|
);
|
|
1114
1335
|
registerConfigTools(tool, client);
|
|
1115
1336
|
registerPlatformTools(tool, client);
|
|
1337
|
+
registerRightsTools(tool, client);
|
|
1338
|
+
registerRightsPageTools(tool, client);
|
|
1116
1339
|
tool(
|
|
1117
1340
|
"invite_member",
|
|
1118
1341
|
"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.",
|
|
1119
1342
|
{
|
|
1120
|
-
email:
|
|
1121
|
-
role:
|
|
1343
|
+
email: import_zod4.z.string().describe("Email address of the person to invite."),
|
|
1344
|
+
role: import_zod4.z.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
|
|
1122
1345
|
},
|
|
1123
1346
|
(a) => client.members.invite(a.email, a.role)
|
|
1124
1347
|
);
|
|
@@ -1126,8 +1349,8 @@ function registerTools(server, client) {
|
|
|
1126
1349
|
"set_member_role",
|
|
1127
1350
|
"Change the role of a member in your organization. The org owner's role cannot be changed.",
|
|
1128
1351
|
{
|
|
1129
|
-
userId:
|
|
1130
|
-
role:
|
|
1352
|
+
userId: import_zod4.z.string().describe("The userId of the member whose role to change."),
|
|
1353
|
+
role: import_zod4.z.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
|
|
1131
1354
|
},
|
|
1132
1355
|
(a) => client.members.setRole(a.userId, a.role)
|
|
1133
1356
|
);
|
|
@@ -1135,7 +1358,7 @@ function registerTools(server, client) {
|
|
|
1135
1358
|
"remove_member",
|
|
1136
1359
|
"Remove a member from your organization. The org owner cannot be removed.",
|
|
1137
1360
|
{
|
|
1138
|
-
userId:
|
|
1361
|
+
userId: import_zod4.z.string().describe("The userId of the member to remove.")
|
|
1139
1362
|
},
|
|
1140
1363
|
async (a) => {
|
|
1141
1364
|
await client.members.remove(a.userId);
|
|
@@ -1146,11 +1369,11 @@ function registerTools(server, client) {
|
|
|
1146
1369
|
"create_brand_kit",
|
|
1147
1370
|
"Create a reusable brand kit (colors, logo, typography) for your organization's consent banners.",
|
|
1148
1371
|
{
|
|
1149
|
-
name:
|
|
1150
|
-
theme:
|
|
1151
|
-
content:
|
|
1152
|
-
logoUrl:
|
|
1153
|
-
customCss:
|
|
1372
|
+
name: import_zod4.z.string().describe("Display name for the brand kit."),
|
|
1373
|
+
theme: import_zod4.z.record(import_zod4.z.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
|
|
1374
|
+
content: import_zod4.z.record(import_zod4.z.unknown()).optional().describe("Optional banner copy overrides."),
|
|
1375
|
+
logoUrl: import_zod4.z.string().optional().describe("Optional URL for your org logo."),
|
|
1376
|
+
customCss: import_zod4.z.string().optional().describe("Optional custom CSS string to inject into the banner.")
|
|
1154
1377
|
},
|
|
1155
1378
|
(a) => client.brandKits.create({
|
|
1156
1379
|
name: a.name,
|
|
@@ -1164,7 +1387,7 @@ function registerTools(server, client) {
|
|
|
1164
1387
|
"delete_brand_kit",
|
|
1165
1388
|
"Delete a brand kit by id. The kit must belong to your organization (cross-org deletes are rejected).",
|
|
1166
1389
|
{
|
|
1167
|
-
id:
|
|
1390
|
+
id: import_zod4.z.string().describe("The brand kit id to delete.")
|
|
1168
1391
|
},
|
|
1169
1392
|
async (a) => {
|
|
1170
1393
|
await client.brandKits.delete(a.id);
|
|
@@ -1175,25 +1398,25 @@ function registerTools(server, client) {
|
|
|
1175
1398
|
"save_preference",
|
|
1176
1399
|
"Save or update the consent preferences for an end-user (by subjectId) within your organization. purposes is a map of purpose-name \u2192 boolean.",
|
|
1177
1400
|
{
|
|
1178
|
-
subjectId:
|
|
1179
|
-
purposes:
|
|
1401
|
+
subjectId: import_zod4.z.string().describe("The end-user identifier (e.g. email or internal user id)."),
|
|
1402
|
+
purposes: import_zod4.z.record(import_zod4.z.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
|
|
1180
1403
|
},
|
|
1181
1404
|
(a) => client.preferences.save(a.subjectId, a.purposes)
|
|
1182
1405
|
);
|
|
1183
1406
|
tool(
|
|
1184
1407
|
"get_preference",
|
|
1185
1408
|
"One end-user\u2019s saved preferences, by subjectId. Read-only.",
|
|
1186
|
-
{ subjectId:
|
|
1409
|
+
{ subjectId: import_zod4.z.string() },
|
|
1187
1410
|
(a) => client.preferences.get(a.subjectId)
|
|
1188
1411
|
);
|
|
1189
1412
|
tool(
|
|
1190
1413
|
"issue_api_key",
|
|
1191
1414
|
"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.",
|
|
1192
1415
|
{
|
|
1193
|
-
name:
|
|
1194
|
-
scopes:
|
|
1195
|
-
cbids:
|
|
1196
|
-
expiresInDays:
|
|
1416
|
+
name: import_zod4.z.string().optional(),
|
|
1417
|
+
scopes: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1418
|
+
cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional(),
|
|
1419
|
+
expiresInDays: import_zod4.z.number().int().min(1).max(3650).optional()
|
|
1197
1420
|
},
|
|
1198
1421
|
(a) => client.keys.issue({
|
|
1199
1422
|
...a.name ? { name: a.name } : {},
|
|
@@ -1202,50 +1425,56 @@ function registerTools(server, client) {
|
|
|
1202
1425
|
...a.expiresInDays !== void 0 ? { expiresInDays: a.expiresInDays } : {}
|
|
1203
1426
|
})
|
|
1204
1427
|
);
|
|
1205
|
-
tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix:
|
|
1428
|
+
tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: import_zod4.z.string() }, async (a) => {
|
|
1206
1429
|
await client.keys.revoke(a.prefix);
|
|
1207
1430
|
return { revoked: a.prefix };
|
|
1208
1431
|
});
|
|
1209
1432
|
tool(
|
|
1210
1433
|
"import_cookie_declaration",
|
|
1211
1434
|
"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.",
|
|
1212
|
-
{ cbid:
|
|
1435
|
+
{ cbid: import_zod4.z.string(), data: import_zod4.z.string().describe("The exported file, as text (CSV or JSON).") },
|
|
1213
1436
|
(a) => client.sites.importDeclaration(a.cbid, a.data)
|
|
1214
1437
|
);
|
|
1215
1438
|
tool(
|
|
1216
1439
|
"apply_cookie_import",
|
|
1217
1440
|
"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.",
|
|
1218
|
-
{ cbid:
|
|
1441
|
+
{ cbid: import_zod4.z.string(), data: import_zod4.z.string().describe("The exported file, as text (CSV or JSON)."), overwrite: import_zod4.z.boolean().optional() },
|
|
1219
1442
|
(a) => client.sites.applyImport(a.cbid, a.data, a.overwrite ? { overwrite: true } : void 0)
|
|
1220
1443
|
);
|
|
1221
1444
|
const declarationShape = {
|
|
1222
|
-
category:
|
|
1223
|
-
purpose:
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1445
|
+
category: import_zod4.z.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
|
|
1446
|
+
purpose: import_zod4.z.string().describe("What the cookie does, as visitors will read it \u2014 and the fallback for any language purposes lacks."),
|
|
1447
|
+
purposes: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.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.'),
|
|
1448
|
+
provider: import_zod4.z.string().optional(),
|
|
1449
|
+
expiry: import_zod4.z.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
|
|
1450
|
+
domain: import_zod4.z.string().optional(),
|
|
1451
|
+
pattern: import_zod4.z.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
|
|
1228
1452
|
};
|
|
1453
|
+
const dryRunArg = import_zod4.z.boolean().optional().describe("Store nothing: answer with the would-be declarations and a diff (added / removed / changed) to check first.");
|
|
1229
1454
|
tool(
|
|
1230
1455
|
"declare_cookie",
|
|
1231
1456
|
'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.',
|
|
1232
|
-
{ cbid:
|
|
1457
|
+
{ cbid: import_zod4.z.string(), name: import_zod4.z.string(), ...declarationShape, dryRun: dryRunArg },
|
|
1233
1458
|
(a) => {
|
|
1234
|
-
const { cbid: cbid2, name, ...rest } = a;
|
|
1235
|
-
return client.sites.declareCookie(cbid2, name, rest);
|
|
1459
|
+
const { cbid: cbid2, name, dryRun, ...rest } = a;
|
|
1460
|
+
return client.sites.declareCookie(cbid2, name, rest, dryRun ? { dryRun: true } : void 0);
|
|
1236
1461
|
}
|
|
1237
1462
|
);
|
|
1238
1463
|
tool(
|
|
1239
1464
|
"declare_cookies",
|
|
1240
1465
|
"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.",
|
|
1241
|
-
{ cbid:
|
|
1242
|
-
(a) =>
|
|
1466
|
+
{ cbid: import_zod4.z.string(), cookies: import_zod4.z.array(import_zod4.z.object({ name: import_zod4.z.string(), ...declarationShape })).max(500), replace: import_zod4.z.boolean().optional(), dryRun: dryRunArg },
|
|
1467
|
+
(a) => {
|
|
1468
|
+
const o = { ...a.replace ? { replace: true } : {}, ...a.dryRun ? { dryRun: true } : {} };
|
|
1469
|
+
return client.sites.declareCookies(a.cbid, a.cookies, Object.keys(o).length ? o : void 0);
|
|
1470
|
+
}
|
|
1243
1471
|
);
|
|
1244
1472
|
tool(
|
|
1245
1473
|
"undeclare_cookie",
|
|
1246
1474
|
"Remove a cookie declaration; the scanned/observed classification applies again.",
|
|
1247
|
-
{ cbid:
|
|
1475
|
+
{ cbid: import_zod4.z.string(), name: import_zod4.z.string(), dryRun: dryRunArg },
|
|
1248
1476
|
async (a) => {
|
|
1477
|
+
if (a.dryRun) return client.sites.undeclareCookie(a.cbid, a.name, { dryRun: true });
|
|
1249
1478
|
await client.sites.undeclareCookie(a.cbid, a.name);
|
|
1250
1479
|
return { undeclared: a.name };
|
|
1251
1480
|
}
|
|
@@ -1253,23 +1482,23 @@ function registerTools(server, client) {
|
|
|
1253
1482
|
tool(
|
|
1254
1483
|
"get_blocked_pages",
|
|
1255
1484
|
"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.",
|
|
1256
|
-
{ cbid:
|
|
1485
|
+
{ cbid: import_zod4.z.string() },
|
|
1257
1486
|
(a) => client.sites.blocked(a.cbid)
|
|
1258
1487
|
);
|
|
1259
1488
|
tool(
|
|
1260
1489
|
"roll_api_key",
|
|
1261
1490
|
"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.",
|
|
1262
|
-
{ prefix:
|
|
1491
|
+
{ prefix: import_zod4.z.string() },
|
|
1263
1492
|
(a) => client.keys.roll(a.prefix)
|
|
1264
1493
|
);
|
|
1265
1494
|
tool(
|
|
1266
1495
|
"update_api_key",
|
|
1267
1496
|
"Rename an API key, or replace its scopes or the properties it is locked to. Only the fields given change; the secret does not.",
|
|
1268
1497
|
{
|
|
1269
|
-
prefix:
|
|
1270
|
-
name:
|
|
1271
|
-
scopes:
|
|
1272
|
-
cbids:
|
|
1498
|
+
prefix: import_zod4.z.string(),
|
|
1499
|
+
name: import_zod4.z.string().optional(),
|
|
1500
|
+
scopes: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1501
|
+
cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional()
|
|
1273
1502
|
},
|
|
1274
1503
|
(a) => client.keys.update(a.prefix, {
|
|
1275
1504
|
...a.name !== void 0 ? { name: a.name } : {},
|
|
@@ -1281,31 +1510,170 @@ function registerTools(server, client) {
|
|
|
1281
1510
|
tool(
|
|
1282
1511
|
"update_org",
|
|
1283
1512
|
"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.",
|
|
1284
|
-
{ name:
|
|
1513
|
+
{ name: import_zod4.z.string().min(1).optional(), logoUrl: import_zod4.z.string().nullable().optional() },
|
|
1285
1514
|
(a) => client.org.update({
|
|
1286
1515
|
...a.name !== void 0 ? { name: a.name } : {},
|
|
1287
1516
|
...a.logoUrl !== void 0 ? { logoUrl: a.logoUrl } : {}
|
|
1288
1517
|
})
|
|
1289
1518
|
);
|
|
1519
|
+
tool(
|
|
1520
|
+
"get_mail_provider",
|
|
1521
|
+
"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.",
|
|
1522
|
+
{},
|
|
1523
|
+
() => client.org.mailProvider.get()
|
|
1524
|
+
);
|
|
1525
|
+
tool(
|
|
1526
|
+
"set_mail_provider",
|
|
1527
|
+
"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).",
|
|
1528
|
+
{
|
|
1529
|
+
provider: import_zod4.z.enum(["brevo", "sendgrid", "postmark", "resend", "ses", "smtp"]),
|
|
1530
|
+
fromEmail: import_zod4.z.string().describe("An address on a domain your provider has verified."),
|
|
1531
|
+
fromName: import_zod4.z.string().max(100).nullable().optional(),
|
|
1532
|
+
replyTo: import_zod4.z.string().nullable().optional(),
|
|
1533
|
+
secret: import_zod4.z.string().optional().describe("API key (Brevo, SendGrid, Resend), server token (Postmark), secret access key (SES) or SMTP password. Write-only."),
|
|
1534
|
+
ses: import_zod4.z.object({ region: import_zod4.z.string(), accessKeyId: import_zod4.z.string() }).optional().describe("Required for ses."),
|
|
1535
|
+
smtp: import_zod4.z.object({ host: import_zod4.z.string(), port: import_zod4.z.union([import_zod4.z.literal(25), import_zod4.z.literal(465), import_zod4.z.literal(587), import_zod4.z.literal(2525)]), security: import_zod4.z.enum(["tls", "starttls"]), username: import_zod4.z.string() }).optional().describe("Required for smtp. TLS is always required.")
|
|
1536
|
+
},
|
|
1537
|
+
(a) => client.org.mailProvider.set(a)
|
|
1538
|
+
);
|
|
1539
|
+
tool(
|
|
1540
|
+
"test_mail_provider",
|
|
1541
|
+
"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.",
|
|
1542
|
+
{ to: import_zod4.z.string().optional().describe("Recipient. Default: the reply-to, else the from address.") },
|
|
1543
|
+
(a) => client.org.mailProvider.test(a.to)
|
|
1544
|
+
);
|
|
1545
|
+
tool(
|
|
1546
|
+
"remove_mail_provider",
|
|
1547
|
+
"Remove your own mail provider. Rights mail goes back to Cookie Munch\u2019s shared sender, labelled as sending on your site\u2019s behalf.",
|
|
1548
|
+
{},
|
|
1549
|
+
async () => {
|
|
1550
|
+
await client.org.mailProvider.remove();
|
|
1551
|
+
return { removed: true };
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1554
|
+
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.";
|
|
1555
|
+
const captchaInput = {
|
|
1556
|
+
mode: import_zod4.z.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
|
|
1557
|
+
provider: import_zod4.z.enum(["turnstile", "hcaptcha", "recaptcha_v2", "recaptcha_v3"]).optional().describe("Required for own."),
|
|
1558
|
+
siteKey: import_zod4.z.string().optional().describe("Required for own: the public site key. List your rights-page hostnames on it at the provider."),
|
|
1559
|
+
secret: import_zod4.z.string().optional().describe("The provider secret key. Write-only; never returned. Omit to keep the stored one (same provider)."),
|
|
1560
|
+
minScore: import_zod4.z.number().min(0.1).max(0.9).optional().describe("reCAPTCHA v3 only. Default 0.5.")
|
|
1561
|
+
};
|
|
1562
|
+
const captchaBody = (a) => ({
|
|
1563
|
+
mode: a.mode,
|
|
1564
|
+
...a.provider !== void 0 ? { provider: a.provider } : {},
|
|
1565
|
+
...a.siteKey !== void 0 ? { siteKey: a.siteKey } : {},
|
|
1566
|
+
...a.secret !== void 0 ? { secret: a.secret } : {},
|
|
1567
|
+
...a.minScore !== void 0 ? { minScore: a.minScore } : {}
|
|
1568
|
+
});
|
|
1569
|
+
tool(
|
|
1570
|
+
"get_rights_captcha",
|
|
1571
|
+
"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.",
|
|
1572
|
+
{ cbid: import_zod4.z.string() },
|
|
1573
|
+
(a) => client.rightsCaptcha.get(a.cbid)
|
|
1574
|
+
);
|
|
1575
|
+
tool(
|
|
1576
|
+
"set_rights_captcha",
|
|
1577
|
+
`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.`,
|
|
1578
|
+
{ cbid: import_zod4.z.string(), ...captchaInput },
|
|
1579
|
+
(a) => client.rightsCaptcha.set(a.cbid, captchaBody(a))
|
|
1580
|
+
);
|
|
1581
|
+
tool(
|
|
1582
|
+
"remove_rights_captcha",
|
|
1583
|
+
"Remove a site\u2019s own captcha setting: it inherits the organisation default again (or off). Returns the setting now in force.",
|
|
1584
|
+
{ cbid: import_zod4.z.string() },
|
|
1585
|
+
(a) => client.rightsCaptcha.remove(a.cbid)
|
|
1586
|
+
);
|
|
1587
|
+
tool(
|
|
1588
|
+
"get_rights_captcha_default",
|
|
1589
|
+
"The organisation default captcha for its rights pages, used by every site without its own setting. Never returns the secret. Read-only.",
|
|
1590
|
+
{},
|
|
1591
|
+
() => client.org.rightsCaptcha.get()
|
|
1592
|
+
);
|
|
1593
|
+
tool(
|
|
1594
|
+
"set_rights_captcha_default",
|
|
1595
|
+
`Set the organisation default captcha for its rights pages: your own keys (recommended) or off. ${CAPTCHA_OFF}`,
|
|
1596
|
+
captchaInput,
|
|
1597
|
+
(a) => client.org.rightsCaptcha.set(captchaBody(a))
|
|
1598
|
+
);
|
|
1599
|
+
tool(
|
|
1600
|
+
"remove_rights_captcha_default",
|
|
1601
|
+
"Remove the organisation default: sites without their own setting then have no captcha. Returns the setting now in force.",
|
|
1602
|
+
{},
|
|
1603
|
+
() => client.org.rightsCaptcha.remove()
|
|
1604
|
+
);
|
|
1605
|
+
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.";
|
|
1606
|
+
const identityInput = {
|
|
1607
|
+
type: import_zod4.z.enum(["clerk", "atlas", "oidc_jwt"]).describe("clerk, atlas (Clerk-shaped), or oidc_jwt (any issuer that signs session JWTs with a published JWKS)."),
|
|
1608
|
+
issuer: import_zod4.z.string().describe("https URL exactly as in the token\u2019s iss (Clerk: your Frontend API URL)."),
|
|
1609
|
+
jwksUrl: import_zod4.z.string().optional().describe("Required for oidc_jwt; clerk/atlas default to <issuer>/.well-known/jwks.json."),
|
|
1610
|
+
audience: import_zod4.z.string().optional().describe("Expected aud. For oidc_jwt an audience or authorizedParties is required (a shared issuer mints tokens for every app)."),
|
|
1611
|
+
authorizedParties: import_zod4.z.array(import_zod4.z.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."),
|
|
1612
|
+
emailClaim: import_zod4.z.string().optional().describe("Default email."),
|
|
1613
|
+
emailVerifiedClaim: import_zod4.z.string().optional().describe("Default email_verified; must be exactly true."),
|
|
1614
|
+
sessionCookieName: import_zod4.z.string().optional().describe("Default __session: the cookie the hosted page on your custom domain reads."),
|
|
1615
|
+
trustEmailClaim: import_zod4.z.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.")
|
|
1616
|
+
};
|
|
1617
|
+
const identityBody = (a) => {
|
|
1618
|
+
const out = { type: a.type, issuer: a.issuer };
|
|
1619
|
+
for (const k of ["jwksUrl", "audience", "authorizedParties", "emailClaim", "emailVerifiedClaim", "sessionCookieName", "trustEmailClaim"]) if (a[k] !== void 0) out[k] = a[k];
|
|
1620
|
+
return out;
|
|
1621
|
+
};
|
|
1622
|
+
tool(
|
|
1623
|
+
"get_rights_identity",
|
|
1624
|
+
"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.",
|
|
1625
|
+
{ cbid: import_zod4.z.string() },
|
|
1626
|
+
(a) => client.rightsIdentity.get(a.cbid)
|
|
1627
|
+
);
|
|
1628
|
+
tool(
|
|
1629
|
+
"set_rights_identity",
|
|
1630
|
+
`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.`,
|
|
1631
|
+
{ cbid: import_zod4.z.string(), ...identityInput },
|
|
1632
|
+
(a) => client.rightsIdentity.set(a.cbid, identityBody(a))
|
|
1633
|
+
);
|
|
1634
|
+
tool(
|
|
1635
|
+
"remove_rights_identity",
|
|
1636
|
+
"Remove a site\u2019s own sign-in provider: it inherits the organisation default again (or none). Returns the setting now in force.",
|
|
1637
|
+
{ cbid: import_zod4.z.string() },
|
|
1638
|
+
(a) => client.rightsIdentity.remove(a.cbid)
|
|
1639
|
+
);
|
|
1640
|
+
tool(
|
|
1641
|
+
"get_rights_identity_default",
|
|
1642
|
+
"The organisation default sign-in provider for its rights requests, used by every site without its own. Read-only.",
|
|
1643
|
+
{},
|
|
1644
|
+
() => client.org.rightsIdentity.get()
|
|
1645
|
+
);
|
|
1646
|
+
tool(
|
|
1647
|
+
"set_rights_identity_default",
|
|
1648
|
+
`Set the organisation default sign-in provider for its rights requests. ${IDENTITY_NOTE}`,
|
|
1649
|
+
identityInput,
|
|
1650
|
+
(a) => client.org.rightsIdentity.set(identityBody(a))
|
|
1651
|
+
);
|
|
1652
|
+
tool(
|
|
1653
|
+
"remove_rights_identity_default",
|
|
1654
|
+
"Remove the organisation default sign-in provider. Returns the setting now in force.",
|
|
1655
|
+
{},
|
|
1656
|
+
() => client.org.rightsIdentity.remove()
|
|
1657
|
+
);
|
|
1290
1658
|
tool(
|
|
1291
1659
|
"get_audit_log",
|
|
1292
1660
|
"The organisation\u2019s audit log, newest first: administrative changes made in the dashboard or through the API, and who made them. Read-only.",
|
|
1293
|
-
{ limit:
|
|
1661
|
+
{ limit: import_zod4.z.number().int().min(1).max(500).optional() },
|
|
1294
1662
|
(a) => client.audit(a.limit)
|
|
1295
1663
|
);
|
|
1296
1664
|
tool(
|
|
1297
1665
|
"upload_asset",
|
|
1298
1666
|
"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.",
|
|
1299
1667
|
{
|
|
1300
|
-
data:
|
|
1301
|
-
contentType:
|
|
1668
|
+
data: import_zod4.z.string(),
|
|
1669
|
+
contentType: import_zod4.z.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
|
|
1302
1670
|
},
|
|
1303
1671
|
(a) => client.assets.upload({ data: a.data, contentType: a.contentType })
|
|
1304
1672
|
);
|
|
1305
1673
|
tool(
|
|
1306
1674
|
"delete_asset",
|
|
1307
1675
|
"Delete a stored image by its URL (or file name). Only your own organisation\u2019s images can be named.",
|
|
1308
|
-
{ url:
|
|
1676
|
+
{ url: import_zod4.z.string().describe("The URL upload_asset returned, or just its file name.") },
|
|
1309
1677
|
async (a) => {
|
|
1310
1678
|
await client.assets.delete(a.url);
|
|
1311
1679
|
return { deleted: a.url };
|
|
@@ -1320,18 +1688,18 @@ function registerTools(server, client) {
|
|
|
1320
1688
|
tool(
|
|
1321
1689
|
"get_customer",
|
|
1322
1690
|
"One child org: its controller details and usage. Read-only.",
|
|
1323
|
-
{ id:
|
|
1691
|
+
{ id: import_zod4.z.string() },
|
|
1324
1692
|
(a) => client.reseller.get(a.id)
|
|
1325
1693
|
);
|
|
1326
1694
|
tool(
|
|
1327
1695
|
"provision_customer",
|
|
1328
1696
|
"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.",
|
|
1329
1697
|
{
|
|
1330
|
-
name:
|
|
1331
|
-
ownerEmail:
|
|
1332
|
-
delegatedAccess:
|
|
1333
|
-
mintKey:
|
|
1334
|
-
keyScopes:
|
|
1698
|
+
name: import_zod4.z.string(),
|
|
1699
|
+
ownerEmail: import_zod4.z.string().optional(),
|
|
1700
|
+
delegatedAccess: import_zod4.z.boolean().optional().describe("Whether this reseller may act inside the child."),
|
|
1701
|
+
mintKey: import_zod4.z.boolean().optional(),
|
|
1702
|
+
keyScopes: import_zod4.z.array(import_zod4.z.string()).optional()
|
|
1335
1703
|
},
|
|
1336
1704
|
(a) => client.reseller.create({
|
|
1337
1705
|
name: a.name,
|
|
@@ -1345,10 +1713,10 @@ function registerTools(server, client) {
|
|
|
1345
1713
|
"update_customer",
|
|
1346
1714
|
"Change a child org\u2019s status, delegated access or DSAR routing. `dsarRouting: null` clears the override.",
|
|
1347
1715
|
{
|
|
1348
|
-
id:
|
|
1349
|
-
status:
|
|
1350
|
-
delegatedAccess:
|
|
1351
|
-
dsarRouting:
|
|
1716
|
+
id: import_zod4.z.string(),
|
|
1717
|
+
status: import_zod4.z.enum(["active", "suspended"]).optional(),
|
|
1718
|
+
delegatedAccess: import_zod4.z.boolean().optional(),
|
|
1719
|
+
dsarRouting: import_zod4.z.enum(["reseller", "child"]).nullable().optional()
|
|
1352
1720
|
},
|
|
1353
1721
|
(a) => client.reseller.update(a.id, {
|
|
1354
1722
|
...a.status ? { status: a.status } : {},
|
|
@@ -1359,7 +1727,7 @@ function registerTools(server, client) {
|
|
|
1359
1727
|
tool(
|
|
1360
1728
|
"suspend_customer",
|
|
1361
1729
|
"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.)",
|
|
1362
|
-
{ id:
|
|
1730
|
+
{ id: import_zod4.z.string() },
|
|
1363
1731
|
async (a) => {
|
|
1364
1732
|
await client.reseller.deprovision(a.id);
|
|
1365
1733
|
return { suspended: a.id };
|
|
@@ -1368,72 +1736,72 @@ function registerTools(server, client) {
|
|
|
1368
1736
|
tool(
|
|
1369
1737
|
"list_customer_keys",
|
|
1370
1738
|
"A child org's API key prefixes. Never the secrets. Read-only.",
|
|
1371
|
-
{ id:
|
|
1739
|
+
{ id: import_zod4.z.string() },
|
|
1372
1740
|
(a) => client.reseller.listKeys(a.id)
|
|
1373
1741
|
);
|
|
1374
1742
|
tool(
|
|
1375
1743
|
"issue_customer_key",
|
|
1376
1744
|
"Mint an API key for a child org. The secret is returned once. Prefer scopes and a property lock over a full-access key.",
|
|
1377
|
-
{ id:
|
|
1745
|
+
{ id: import_zod4.z.string(), name: import_zod4.z.string().optional(), scopes: import_zod4.z.array(import_zod4.z.string()).optional(), cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional() },
|
|
1378
1746
|
(a) => client.reseller.mintKey(a.id, {
|
|
1379
1747
|
...a.name ? { name: a.name } : {},
|
|
1380
1748
|
...a.scopes ? { scopes: a.scopes } : {},
|
|
1381
1749
|
...a.cbids ? { cbids: a.cbids } : {}
|
|
1382
1750
|
})
|
|
1383
1751
|
);
|
|
1384
|
-
tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id:
|
|
1752
|
+
tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: import_zod4.z.string(), prefix: import_zod4.z.string() }, async (a) => {
|
|
1385
1753
|
await client.reseller.revokeKey(a.id, a.prefix);
|
|
1386
1754
|
return { revoked: a.prefix };
|
|
1387
1755
|
});
|
|
1388
1756
|
tool(
|
|
1389
1757
|
"erase_subject_data",
|
|
1390
1758
|
"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.",
|
|
1391
|
-
{ cbid:
|
|
1759
|
+
{ cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
|
|
1392
1760
|
(a) => client.consent.eraseSubject(a.cbid, a.stamp)
|
|
1393
1761
|
);
|
|
1394
1762
|
tool(
|
|
1395
1763
|
"export_subject_data",
|
|
1396
1764
|
"Export a data subject's consent records (GDPR access/portability).",
|
|
1397
|
-
{ cbid:
|
|
1765
|
+
{ cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
|
|
1398
1766
|
(a) => client.consent.exportSubject(a.cbid, a.stamp)
|
|
1399
1767
|
);
|
|
1400
1768
|
tool("list_banners", "List reusable banner designs in your org.", {}, () => client.banners.list());
|
|
1401
1769
|
tool(
|
|
1402
1770
|
"create_banner",
|
|
1403
1771
|
"Create a reusable banner design.",
|
|
1404
|
-
{ name:
|
|
1772
|
+
{ name: import_zod4.z.string(), json: import_zod4.z.record(import_zod4.z.unknown()).describe("A v2 BannerConfig.") },
|
|
1405
1773
|
(a) => client.banners.create({ name: a.name, json: a.json })
|
|
1406
1774
|
);
|
|
1407
|
-
tool("get_banner", "Get a banner design by id.", { id:
|
|
1775
|
+
tool("get_banner", "Get a banner design by id.", { id: import_zod4.z.string() }, (a) => client.banners.get(a.id));
|
|
1408
1776
|
tool(
|
|
1409
1777
|
"update_banner",
|
|
1410
1778
|
"Update a banner design (name and/or config).",
|
|
1411
|
-
{ id:
|
|
1779
|
+
{ id: import_zod4.z.string(), name: import_zod4.z.string().optional(), json: import_zod4.z.record(import_zod4.z.unknown()).optional() },
|
|
1412
1780
|
(a) => client.banners.update(a.id, {
|
|
1413
1781
|
...a.name !== void 0 ? { name: a.name } : {},
|
|
1414
1782
|
...a.json !== void 0 ? { json: a.json } : {}
|
|
1415
1783
|
})
|
|
1416
1784
|
);
|
|
1417
|
-
tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id:
|
|
1785
|
+
tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: import_zod4.z.string() }, async (a) => {
|
|
1418
1786
|
await client.banners.delete(a.id);
|
|
1419
1787
|
return { ok: true };
|
|
1420
1788
|
});
|
|
1421
1789
|
tool(
|
|
1422
1790
|
"get_banner_assignments",
|
|
1423
1791
|
"The sites (cbids) a banner design is currently assigned to. Read-only.",
|
|
1424
|
-
{ id:
|
|
1792
|
+
{ id: import_zod4.z.string() },
|
|
1425
1793
|
(a) => client.banners.assignments(a.id)
|
|
1426
1794
|
);
|
|
1427
1795
|
tool(
|
|
1428
1796
|
"assign_banner",
|
|
1429
1797
|
"Set which sites (cbids) use a banner design.",
|
|
1430
|
-
{ id:
|
|
1798
|
+
{ id: import_zod4.z.string(), cbids: import_zod4.z.array(import_zod4.z.string()) },
|
|
1431
1799
|
(a) => client.banners.setAssignments(a.id, a.cbids)
|
|
1432
1800
|
);
|
|
1433
1801
|
tool(
|
|
1434
1802
|
"publish_banner",
|
|
1435
1803
|
"Publish a design live to all its assigned sites.",
|
|
1436
|
-
{ id:
|
|
1804
|
+
{ id: import_zod4.z.string() },
|
|
1437
1805
|
(a) => client.banners.publish(a.id)
|
|
1438
1806
|
);
|
|
1439
1807
|
}
|