@prysmid/mcp 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +778 -222
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -277,8 +277,8 @@ function clearToken(env = process.env) {
|
|
|
277
277
|
function defineTool(t) {
|
|
278
278
|
return t;
|
|
279
279
|
}
|
|
280
|
-
function registerAll(server, ctx,
|
|
281
|
-
for (const tool of
|
|
280
|
+
function registerAll(server, ctx, tools15) {
|
|
281
|
+
for (const tool of tools15) {
|
|
282
282
|
server.registerTool(
|
|
283
283
|
tool.name,
|
|
284
284
|
{
|
|
@@ -316,6 +316,21 @@ ${err.body}` : "";
|
|
|
316
316
|
|
|
317
317
|
// src/tools/apps.ts
|
|
318
318
|
import { z } from "zod";
|
|
319
|
+
var APP_TYPE = z.enum(["web", "spa", "native"]);
|
|
320
|
+
var AUTH_METHOD = z.enum([
|
|
321
|
+
"client_secret_basic",
|
|
322
|
+
"client_secret_post",
|
|
323
|
+
"none",
|
|
324
|
+
"private_key_jwt"
|
|
325
|
+
]);
|
|
326
|
+
var GRANT_TYPE = z.enum([
|
|
327
|
+
"authorization_code",
|
|
328
|
+
"refresh_token",
|
|
329
|
+
"implicit",
|
|
330
|
+
"device_code",
|
|
331
|
+
"token_exchange"
|
|
332
|
+
]);
|
|
333
|
+
var ACCESS_TOKEN_TYPE = z.enum(["bearer", "jwt"]);
|
|
319
334
|
var listApps = defineTool({
|
|
320
335
|
name: "list_apps",
|
|
321
336
|
description: "List all OIDC apps in a workspace.",
|
|
@@ -326,13 +341,19 @@ var listApps = defineTool({
|
|
|
326
341
|
});
|
|
327
342
|
var createOidcApp = defineTool({
|
|
328
343
|
name: "create_oidc_app",
|
|
329
|
-
description: "Create an OIDC application in a workspace. Returns client_id (and client_secret only when app_type=web). app_type=web is a confidential server-rendered app; spa and native are public clients that use PKCE and have no secret.",
|
|
344
|
+
description: "Create an OIDC application in a workspace. Returns client_id (and client_secret only when app_type=web). app_type=web is a confidential server-rendered app; spa and native are public clients that use PKCE and have no secret. Pass grant_types to enable e.g. device_code for a CLI/headless client in one call (default is authorization_code + refresh_token). access_token_type defaults to jwt (validatable offline via JWKS); use bearer only if the resource server validates by introspection.",
|
|
330
345
|
inputShape: {
|
|
331
346
|
workspace: z.string().min(1),
|
|
332
347
|
name: z.string().min(1).max(255),
|
|
333
348
|
redirect_uris: z.array(z.string().url()).min(1),
|
|
334
349
|
post_logout_redirect_uris: z.array(z.string().url()).optional(),
|
|
335
|
-
app_type:
|
|
350
|
+
app_type: APP_TYPE.default("web"),
|
|
351
|
+
grant_types: z.array(GRANT_TYPE).optional().describe(
|
|
352
|
+
"OAuth grant types to enable. Omit for [authorization_code, refresh_token]. Include device_code for a CLI/device-flow client."
|
|
353
|
+
),
|
|
354
|
+
access_token_type: ACCESS_TOKEN_TYPE.optional().describe(
|
|
355
|
+
"jwt (default) for offline JWKS validation; bearer for opaque tokens requiring introspection."
|
|
356
|
+
),
|
|
336
357
|
dev_mode: z.boolean().default(false).describe(
|
|
337
358
|
"Skip redirect URI HTTPS check \u2014 only for local dev, NEVER prod."
|
|
338
359
|
)
|
|
@@ -354,20 +375,6 @@ var deleteOidcApp = defineTool({
|
|
|
354
375
|
{ method: "DELETE" }
|
|
355
376
|
)
|
|
356
377
|
});
|
|
357
|
-
var APP_TYPE = z.enum(["web", "spa", "native"]);
|
|
358
|
-
var AUTH_METHOD = z.enum([
|
|
359
|
-
"client_secret_basic",
|
|
360
|
-
"client_secret_post",
|
|
361
|
-
"none",
|
|
362
|
-
"private_key_jwt"
|
|
363
|
-
]);
|
|
364
|
-
var GRANT_TYPE = z.enum([
|
|
365
|
-
"authorization_code",
|
|
366
|
-
"refresh_token",
|
|
367
|
-
"implicit",
|
|
368
|
-
"device_code",
|
|
369
|
-
"token_exchange"
|
|
370
|
-
]);
|
|
371
378
|
var getApp = defineTool({
|
|
372
379
|
name: "get_app",
|
|
373
380
|
description: "Fetch full detail for one OIDC app: redirect URIs, grant types, auth method, dev_mode, timestamps. Never returns the client_secret \u2014 use regenerate_app_secret to mint a new one.",
|
|
@@ -381,7 +388,7 @@ var getApp = defineTool({
|
|
|
381
388
|
});
|
|
382
389
|
var updateApp = defineTool({
|
|
383
390
|
name: "update_app",
|
|
384
|
-
description: "Patch mutable fields on an OIDC app: redirect URIs, post-logout URIs, grant types, auth method, dev_mode. All fields optional \u2014 only provided keys change. client_secret is NEVER accepted here; use regenerate_app_secret to rotate it.",
|
|
391
|
+
description: "Patch mutable fields on an OIDC app: redirect URIs, post-logout URIs, grant types, auth method, access_token_type, dev_mode. All fields optional \u2014 only provided keys change. client_secret is NEVER accepted here; use regenerate_app_secret to rotate it.",
|
|
385
392
|
inputShape: {
|
|
386
393
|
workspace: z.string().min(1),
|
|
387
394
|
app_id: z.string().min(1),
|
|
@@ -389,6 +396,9 @@ var updateApp = defineTool({
|
|
|
389
396
|
post_logout_redirect_uris: z.array(z.string().url()).optional(),
|
|
390
397
|
grant_types: z.array(GRANT_TYPE).optional(),
|
|
391
398
|
auth_method: AUTH_METHOD.optional(),
|
|
399
|
+
access_token_type: ACCESS_TOKEN_TYPE.optional().describe(
|
|
400
|
+
"jwt for offline JWKS validation; bearer for opaque tokens requiring introspection."
|
|
401
|
+
),
|
|
392
402
|
dev_mode: z.boolean().optional().describe(
|
|
393
403
|
"Skip redirect URI HTTPS check \u2014 only for local dev, NEVER prod."
|
|
394
404
|
)
|
|
@@ -429,13 +439,38 @@ var tools = [
|
|
|
429
439
|
regenerateAppSecret
|
|
430
440
|
];
|
|
431
441
|
|
|
432
|
-
// src/tools/
|
|
442
|
+
// src/tools/audit.ts
|
|
433
443
|
import { z as z2 } from "zod";
|
|
444
|
+
var exportAuditLog = defineTool({
|
|
445
|
+
name: "export_audit_log",
|
|
446
|
+
description: "Export a workspace's audit trail as NDJSON (default) or CSV. Filter by `org_id` (a specific business org, matches meta.org_id), `action` (exact, e.g. `idp.create`), and a created_at window (`start`/`end`, ISO-8601). `limit` caps rows (default 10000, max 50000). Returns the raw export text \u2014 narrow the window to page through large trails.",
|
|
447
|
+
inputShape: {
|
|
448
|
+
workspace: z2.string().min(1),
|
|
449
|
+
format: z2.enum(["ndjson", "csv"]).default("ndjson").describe(
|
|
450
|
+
"ndjson (default) = one JSON object per line, best for SIEM. csv = flat columns with meta JSON-encoded in one cell."
|
|
451
|
+
),
|
|
452
|
+
org_id: z2.string().min(1).optional().describe(
|
|
453
|
+
"Scope to one business org (matches meta.org_id). Omit for the whole workspace."
|
|
454
|
+
),
|
|
455
|
+
action: z2.string().min(1).optional().describe("Exact audit action to filter, e.g. `idp.create`."),
|
|
456
|
+
start: z2.string().optional().describe("ISO-8601 timestamp; only rows created at/after this."),
|
|
457
|
+
end: z2.string().optional().describe("ISO-8601 timestamp; only rows created before this."),
|
|
458
|
+
limit: z2.number().int().min(1).max(5e4).optional()
|
|
459
|
+
},
|
|
460
|
+
handler: async ({ workspace, ...query }, { client }) => client.request(
|
|
461
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/audit-log/export`,
|
|
462
|
+
{ query }
|
|
463
|
+
)
|
|
464
|
+
});
|
|
465
|
+
var tools2 = [exportAuditLog];
|
|
466
|
+
|
|
467
|
+
// src/tools/billing.ts
|
|
468
|
+
import { z as z3 } from "zod";
|
|
434
469
|
var getBilling = defineTool({
|
|
435
470
|
name: "get_billing",
|
|
436
471
|
description: "Get current billing state: plan, subscription status, current period, spending_cap_cents, signups_blocked.",
|
|
437
472
|
inputShape: {
|
|
438
|
-
workspace:
|
|
473
|
+
workspace: z3.string().min(1)
|
|
439
474
|
},
|
|
440
475
|
handler: async ({ workspace }, { client }) => client.request(
|
|
441
476
|
`/v1/workspaces/${encodeURIComponent(workspace)}/billing`
|
|
@@ -445,8 +480,8 @@ var setSpendingCap = defineTool({
|
|
|
445
480
|
name: "set_spending_cap",
|
|
446
481
|
description: "Cap monthly Pro overage spend (cents). Pass null to remove cap (unlimited). When projected overage exceeds cap, signups_blocked flips on.",
|
|
447
482
|
inputShape: {
|
|
448
|
-
workspace:
|
|
449
|
-
spending_cap_cents:
|
|
483
|
+
workspace: z3.string().min(1),
|
|
484
|
+
spending_cap_cents: z3.number().int().min(0).max(1e7).nullable().describe("Max overage cents per period; null = unlimited")
|
|
450
485
|
},
|
|
451
486
|
handler: async ({ workspace, spending_cap_cents }, { client }) => client.request(
|
|
452
487
|
`/v1/workspaces/${encodeURIComponent(workspace)}/billing/spending-cap`,
|
|
@@ -457,8 +492,8 @@ var startCheckout = defineTool({
|
|
|
457
492
|
name: "start_billing_checkout",
|
|
458
493
|
description: "Create a Stripe Checkout session for upgrading. Returns the URL the user must visit. Plan must be `pro` (Free has no checkout; Enterprise is sales-only).",
|
|
459
494
|
inputShape: {
|
|
460
|
-
workspace:
|
|
461
|
-
plan:
|
|
495
|
+
workspace: z3.string().min(1),
|
|
496
|
+
plan: z3.enum(["pro"])
|
|
462
497
|
},
|
|
463
498
|
handler: async ({ workspace, plan }, { client }) => client.request(
|
|
464
499
|
`/v1/workspaces/${encodeURIComponent(workspace)}/billing/checkout`,
|
|
@@ -469,14 +504,14 @@ var startBillingPortal = defineTool({
|
|
|
469
504
|
name: "start_billing_portal",
|
|
470
505
|
description: "Create a Stripe customer-portal session URL where the user manages payment methods, downloads invoices, cancels subscription.",
|
|
471
506
|
inputShape: {
|
|
472
|
-
workspace:
|
|
507
|
+
workspace: z3.string().min(1)
|
|
473
508
|
},
|
|
474
509
|
handler: async ({ workspace }, { client }) => client.request(
|
|
475
510
|
`/v1/workspaces/${encodeURIComponent(workspace)}/billing/portal`,
|
|
476
511
|
{ method: "POST" }
|
|
477
512
|
)
|
|
478
513
|
});
|
|
479
|
-
var
|
|
514
|
+
var tools3 = [
|
|
480
515
|
getBilling,
|
|
481
516
|
setSpendingCap,
|
|
482
517
|
startCheckout,
|
|
@@ -484,12 +519,12 @@ var tools2 = [
|
|
|
484
519
|
];
|
|
485
520
|
|
|
486
521
|
// src/tools/branding.ts
|
|
487
|
-
import { z as
|
|
522
|
+
import { z as z4 } from "zod";
|
|
488
523
|
var getBranding = defineTool({
|
|
489
524
|
name: "get_branding",
|
|
490
525
|
description: "Return the workspace's active branding policy (colors, fonts, hide-prysmid-watermark flag, logo URLs).",
|
|
491
526
|
inputShape: {
|
|
492
|
-
workspace:
|
|
527
|
+
workspace: z4.string().min(1)
|
|
493
528
|
},
|
|
494
529
|
handler: async ({ workspace }, { client }) => client.request(
|
|
495
530
|
`/v1/workspaces/${encodeURIComponent(workspace)}/branding`
|
|
@@ -499,12 +534,12 @@ var updateBranding = defineTool({
|
|
|
499
534
|
name: "update_branding",
|
|
500
535
|
description: "Update branding colors and watermark. Hex colors as `#RRGGBB`. Activates the policy after update \u2014 change shows on next login screen render.",
|
|
501
536
|
inputShape: {
|
|
502
|
-
workspace:
|
|
503
|
-
primary_color:
|
|
504
|
-
background_color:
|
|
505
|
-
warn_color:
|
|
506
|
-
font_color:
|
|
507
|
-
disable_watermark:
|
|
537
|
+
workspace: z4.string().min(1),
|
|
538
|
+
primary_color: z4.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
539
|
+
background_color: z4.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
540
|
+
warn_color: z4.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
541
|
+
font_color: z4.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
542
|
+
disable_watermark: z4.boolean().optional().describe(
|
|
508
543
|
"Hide 'Powered by Prysmid' on the login screen (Pro+ only \u2014 Free silently ignored)."
|
|
509
544
|
)
|
|
510
545
|
},
|
|
@@ -513,23 +548,23 @@ var updateBranding = defineTool({
|
|
|
513
548
|
{ method: "PATCH", body }
|
|
514
549
|
)
|
|
515
550
|
});
|
|
516
|
-
var
|
|
551
|
+
var tools4 = [getBranding, updateBranding];
|
|
517
552
|
|
|
518
553
|
// src/tools/curated.ts
|
|
519
|
-
import { z as
|
|
520
|
-
var SetupWorkspaceOutput =
|
|
521
|
-
workspace_id:
|
|
522
|
-
slug:
|
|
523
|
-
auth_domain:
|
|
524
|
-
state:
|
|
554
|
+
import { z as z5 } from "zod";
|
|
555
|
+
var SetupWorkspaceOutput = z5.object({
|
|
556
|
+
workspace_id: z5.string(),
|
|
557
|
+
slug: z5.string(),
|
|
558
|
+
auth_domain: z5.string(),
|
|
559
|
+
state: z5.string()
|
|
525
560
|
});
|
|
526
561
|
var setupPrysmidWorkspace = defineTool({
|
|
527
562
|
name: "setup_prysmid_workspace",
|
|
528
563
|
description: "Create a new workspace and wait until it's fully provisioned (Zitadel instance, SMTP, DNS). Returns the live auth_domain ready to integrate.",
|
|
529
564
|
inputShape: {
|
|
530
|
-
slug:
|
|
531
|
-
display_name:
|
|
532
|
-
timeout_seconds:
|
|
565
|
+
slug: z5.string().min(2).max(63).regex(/^[a-z0-9-]+$/),
|
|
566
|
+
display_name: z5.string().min(1),
|
|
567
|
+
timeout_seconds: z5.number().int().min(10).max(300).default(120).describe("Max time to wait for provisioning before returning.")
|
|
533
568
|
},
|
|
534
569
|
handler: async ({ slug, display_name, timeout_seconds }, { client, log }) => {
|
|
535
570
|
const created = await client.request("/v1/workspaces", {
|
|
@@ -569,10 +604,10 @@ var enableGoogleLogin = defineTool({
|
|
|
569
604
|
name: "enable_google_login",
|
|
570
605
|
description: "Add Google as an identity provider on a workspace and enable external IdPs in the login policy. Hands you a checklist if external IdPs were already disabled \u2014 agent should confirm before flipping that flag.",
|
|
571
606
|
inputShape: {
|
|
572
|
-
workspace:
|
|
573
|
-
google_client_id:
|
|
574
|
-
google_client_secret:
|
|
575
|
-
name:
|
|
607
|
+
workspace: z5.string().min(1),
|
|
608
|
+
google_client_id: z5.string().min(1),
|
|
609
|
+
google_client_secret: z5.string().min(1),
|
|
610
|
+
name: z5.string().default("Google")
|
|
576
611
|
},
|
|
577
612
|
handler: async ({ workspace, google_client_id, google_client_secret, name }, { client }) => {
|
|
578
613
|
const idp = await client.request(
|
|
@@ -609,8 +644,8 @@ var prysmidSetupCheck = defineTool({
|
|
|
609
644
|
name: "prysmid_setup_check",
|
|
610
645
|
description: "Run a readiness checklist on a workspace: state=active, \u22651 OIDC app, \u22651 IdP OR password+register enabled, branding has a primary_color set, login_policy reasonable, AND (by default) every external IdP probes successfully against its upstream provider. Returns pass/fail per item plus a summary verdict. Set `probe_idps=false` to skip the live probe (faster, but won't catch redirect_uri_mismatch or invalid client_secret until a real end-user hits the broken IdP).",
|
|
611
646
|
inputShape: {
|
|
612
|
-
workspace:
|
|
613
|
-
probe_idps:
|
|
647
|
+
workspace: z5.string().min(1),
|
|
648
|
+
probe_idps: z5.boolean().optional().describe(
|
|
614
649
|
"Run a live probe against each external IdP's upstream authorize endpoint. Default true. Set false to skip if the latency matters more than the safety (will not catch redirect_uri_mismatch or invalid_client until a real end-user signs in)."
|
|
615
650
|
)
|
|
616
651
|
},
|
|
@@ -700,142 +735,560 @@ var prysmidSetupCheck = defineTool({
|
|
|
700
735
|
return { verdict, checks };
|
|
701
736
|
}
|
|
702
737
|
});
|
|
703
|
-
var
|
|
738
|
+
var tools5 = [
|
|
704
739
|
setupPrysmidWorkspace,
|
|
705
740
|
enableGoogleLogin,
|
|
706
741
|
prysmidSetupCheck
|
|
707
742
|
];
|
|
708
743
|
|
|
744
|
+
// src/tools/grants.ts
|
|
745
|
+
import { z as z6 } from "zod";
|
|
746
|
+
var grantUserToOrganization = defineTool({
|
|
747
|
+
name: "grant_user_to_organization",
|
|
748
|
+
description: "Grant a user access to an organization's project with a set of role keys. The user does NOT need to be a member of the org \u2014 that's the point. Idempotent at the (user, org, project) tuple: duplicates return 502 from Zitadel.",
|
|
749
|
+
inputShape: {
|
|
750
|
+
workspace: z6.string().min(1),
|
|
751
|
+
org_id: z6.string().min(1).describe("Zitadel org id of the org GRANTING access."),
|
|
752
|
+
user_id: z6.string().min(1).describe(
|
|
753
|
+
"Zitadel user id. The user's home org is irrelevant \u2014 grants are cross-org."
|
|
754
|
+
),
|
|
755
|
+
project_id: z6.string().min(1).describe(
|
|
756
|
+
"Zitadel project id this grant is for. Look it up via list_apps \u2014 every OIDC app belongs to a project."
|
|
757
|
+
),
|
|
758
|
+
role_keys: z6.array(z6.string()).default([]).describe(
|
|
759
|
+
"Role keys defined on the target project. Empty list = bare membership (still gates access)."
|
|
760
|
+
)
|
|
761
|
+
},
|
|
762
|
+
handler: async ({ workspace, org_id, ...body }, { client }) => client.request(
|
|
763
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants`,
|
|
764
|
+
{ method: "POST", body }
|
|
765
|
+
)
|
|
766
|
+
});
|
|
767
|
+
var listGrantsInOrganization = defineTool({
|
|
768
|
+
name: "list_grants_in_organization",
|
|
769
|
+
description: "List all grants owned by an organization. Returns each grant with the granted user_id, project_id, role_keys, and the org's tenant_id (the value users will see as `tenant_id` claim when this grant is active).",
|
|
770
|
+
inputShape: {
|
|
771
|
+
workspace: z6.string().min(1),
|
|
772
|
+
org_id: z6.string().min(1)
|
|
773
|
+
},
|
|
774
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
775
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants`
|
|
776
|
+
)
|
|
777
|
+
});
|
|
778
|
+
var listGrantsForUser = defineTool({
|
|
779
|
+
name: "list_grants_for_user",
|
|
780
|
+
description: "List all grants held by a user across orgs in this workspace. Useful for 'what does this user have access to?' and offboarding/audit reviews.",
|
|
781
|
+
inputShape: {
|
|
782
|
+
workspace: z6.string().min(1),
|
|
783
|
+
user_id: z6.string().min(1)
|
|
784
|
+
},
|
|
785
|
+
handler: async ({ workspace, user_id }, { client }) => client.request(
|
|
786
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/users/${encodeURIComponent(user_id)}/grants`
|
|
787
|
+
)
|
|
788
|
+
});
|
|
789
|
+
var updateGrantRoles = defineTool({
|
|
790
|
+
name: "update_grant_roles",
|
|
791
|
+
description: "Replace the role_keys on an existing grant. The set is replaced wholesale \u2014 pass the full desired list, not a delta.",
|
|
792
|
+
inputShape: {
|
|
793
|
+
workspace: z6.string().min(1),
|
|
794
|
+
org_id: z6.string().min(1),
|
|
795
|
+
grant_id: z6.string().min(1),
|
|
796
|
+
role_keys: z6.array(z6.string())
|
|
797
|
+
},
|
|
798
|
+
handler: async ({ workspace, org_id, grant_id, role_keys }, { client }) => client.request(
|
|
799
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants/${encodeURIComponent(grant_id)}`,
|
|
800
|
+
{ method: "PATCH", body: { role_keys } }
|
|
801
|
+
)
|
|
802
|
+
});
|
|
803
|
+
var deactivateGrant = defineTool({
|
|
804
|
+
name: "deactivate_grant",
|
|
805
|
+
description: "Temporarily suspend a grant without revoking it. Idempotent. Re-enable later with reactivate_grant.",
|
|
806
|
+
inputShape: {
|
|
807
|
+
workspace: z6.string().min(1),
|
|
808
|
+
org_id: z6.string().min(1),
|
|
809
|
+
grant_id: z6.string().min(1)
|
|
810
|
+
},
|
|
811
|
+
handler: async ({ workspace, org_id, grant_id }, { client }) => client.request(
|
|
812
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants/${encodeURIComponent(grant_id)}/_deactivate`,
|
|
813
|
+
{ method: "POST" }
|
|
814
|
+
)
|
|
815
|
+
});
|
|
816
|
+
var reactivateGrant = defineTool({
|
|
817
|
+
name: "reactivate_grant",
|
|
818
|
+
description: "Re-enable a previously deactivated grant. Idempotent.",
|
|
819
|
+
inputShape: {
|
|
820
|
+
workspace: z6.string().min(1),
|
|
821
|
+
org_id: z6.string().min(1),
|
|
822
|
+
grant_id: z6.string().min(1)
|
|
823
|
+
},
|
|
824
|
+
handler: async ({ workspace, org_id, grant_id }, { client }) => client.request(
|
|
825
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants/${encodeURIComponent(grant_id)}/_reactivate`,
|
|
826
|
+
{ method: "POST" }
|
|
827
|
+
)
|
|
828
|
+
});
|
|
829
|
+
var revokeGrant = defineTool({
|
|
830
|
+
name: "revoke_grant",
|
|
831
|
+
description: "Permanently revoke a grant. Idempotent \u2014 204 even if the Zitadel-side grant is already gone. Emits a `grant.revoked` audit event (will fire a webhook in slice X5).",
|
|
832
|
+
inputShape: {
|
|
833
|
+
workspace: z6.string().min(1),
|
|
834
|
+
org_id: z6.string().min(1),
|
|
835
|
+
grant_id: z6.string().min(1)
|
|
836
|
+
},
|
|
837
|
+
handler: async ({ workspace, org_id, grant_id }, { client }) => client.request(
|
|
838
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/grants/${encodeURIComponent(grant_id)}`,
|
|
839
|
+
{ method: "DELETE" }
|
|
840
|
+
)
|
|
841
|
+
});
|
|
842
|
+
var tools6 = [
|
|
843
|
+
grantUserToOrganization,
|
|
844
|
+
listGrantsInOrganization,
|
|
845
|
+
listGrantsForUser,
|
|
846
|
+
updateGrantRoles,
|
|
847
|
+
deactivateGrant,
|
|
848
|
+
reactivateGrant,
|
|
849
|
+
revokeGrant
|
|
850
|
+
];
|
|
851
|
+
|
|
709
852
|
// src/tools/idps.ts
|
|
710
|
-
import { z as
|
|
853
|
+
import { z as z7 } from "zod";
|
|
854
|
+
var orgIdArg = z7.string().min(1).optional().describe(
|
|
855
|
+
"Optional Zitadel org id to scope this operation to a specific business org inside the workspace. Omit for the workspace's home org (backwards-compat)."
|
|
856
|
+
);
|
|
857
|
+
var providerOptionsSchema = z7.object({
|
|
858
|
+
is_creation_allowed: z7.boolean().optional(),
|
|
859
|
+
is_auto_creation: z7.boolean().optional().describe(
|
|
860
|
+
"JIT provisioning: True auto-creates a Prysm:ID user on first external login. The most common X6 flag \u2014 set False for tightly-controlled enterprise tenants where seats are granted manually."
|
|
861
|
+
),
|
|
862
|
+
is_auto_update: z7.boolean().optional(),
|
|
863
|
+
is_linking_allowed: z7.boolean().optional(),
|
|
864
|
+
auto_linking: z7.enum(["unspecified", "username", "email"]).optional().describe(
|
|
865
|
+
"How to merge an external first-login into an existing Prysm:ID user. `username` matches user_name, `email` matches verified email, `unspecified` disables auto-linking."
|
|
866
|
+
)
|
|
867
|
+
}).optional().describe(
|
|
868
|
+
"X6: JIT + linking behaviour. Omitted fields fall back to defaults on create (auto-create + auto-update + link-by-username) or preserve current state on patch."
|
|
869
|
+
);
|
|
711
870
|
var listIdps = defineTool({
|
|
712
871
|
name: "list_idps",
|
|
713
|
-
description: "List identity providers (Google/GitHub/Microsoft/OIDC) configured on a workspace.",
|
|
872
|
+
description: "List identity providers (Google/GitHub/Microsoft/OIDC) configured on a workspace. Pass `org_id` to list IdPs of a specific business org.",
|
|
714
873
|
inputShape: {
|
|
715
|
-
workspace:
|
|
874
|
+
workspace: z7.string().min(1),
|
|
875
|
+
org_id: orgIdArg
|
|
716
876
|
},
|
|
717
|
-
handler: async ({ workspace }, { client }) => client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/idps
|
|
877
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/idps`, {
|
|
878
|
+
query: { org_id }
|
|
879
|
+
})
|
|
718
880
|
});
|
|
719
881
|
var addIdp = defineTool({
|
|
720
882
|
name: "add_idp",
|
|
721
|
-
description: "Add an identity provider to the workspace and attach it to the login policy in one atomic call.",
|
|
883
|
+
description: "Add an identity provider to the workspace and attach it to the login policy in one atomic call. Pass `org_id` to attach the IdP to a specific business org (multi-tenant setup) instead of the workspace's home org. Pass `provider_options` to control JIT provisioning + account-linking behaviour (X6).",
|
|
722
884
|
inputShape: {
|
|
723
|
-
workspace:
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
885
|
+
workspace: z7.string().min(1),
|
|
886
|
+
org_id: orgIdArg,
|
|
887
|
+
type: z7.enum(["google", "github", "microsoft", "oidc"]).describe("Identity provider kind. `microsoft` covers Azure AD / Entra."),
|
|
888
|
+
name: z7.string().min(1).describe("Display name shown on login screen"),
|
|
889
|
+
client_id: z7.string().min(1),
|
|
890
|
+
client_secret: z7.string().min(1),
|
|
891
|
+
scopes: z7.array(z7.string()).optional(),
|
|
892
|
+
issuer: z7.string().url().optional().describe("Required for `oidc`; ignored otherwise"),
|
|
893
|
+
tenant_id: z7.string().optional().describe(
|
|
731
894
|
"Optional for `microsoft` \u2014 lock to a specific Entra tenant GUID. Default accepts any account."
|
|
732
|
-
)
|
|
895
|
+
),
|
|
896
|
+
provider_options: providerOptionsSchema
|
|
733
897
|
},
|
|
734
|
-
handler: async ({ workspace, ...body }, { client }) => client.request(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
898
|
+
handler: async ({ workspace, org_id, ...body }, { client }) => client.request(`/v1/workspaces/${encodeURIComponent(workspace)}/idps`, {
|
|
899
|
+
method: "POST",
|
|
900
|
+
body,
|
|
901
|
+
query: { org_id }
|
|
902
|
+
})
|
|
738
903
|
});
|
|
739
904
|
var deleteIdp = defineTool({
|
|
740
905
|
name: "delete_idp",
|
|
741
|
-
description: "Remove an identity provider. Strips it from the login policy then deletes the config. Idempotent.",
|
|
906
|
+
description: "Remove an identity provider. Strips it from the login policy then deletes the config. Idempotent. Pass `org_id` to target a specific business org's IdP.",
|
|
742
907
|
inputShape: {
|
|
743
|
-
workspace:
|
|
744
|
-
|
|
908
|
+
workspace: z7.string().min(1),
|
|
909
|
+
org_id: orgIdArg,
|
|
910
|
+
idp_id: z7.string().min(1)
|
|
745
911
|
},
|
|
746
|
-
handler: async ({ workspace, idp_id }, { client }) => client.request(
|
|
912
|
+
handler: async ({ workspace, org_id, idp_id }, { client }) => client.request(
|
|
747
913
|
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,
|
|
748
|
-
{ method: "DELETE" }
|
|
914
|
+
{ method: "DELETE", query: { org_id } }
|
|
749
915
|
)
|
|
750
916
|
});
|
|
751
917
|
var getIdp = defineTool({
|
|
752
918
|
name: "get_idp",
|
|
753
|
-
description: "Fetch full detail for one identity provider: type, state, client_id, issuer/tenant (when applicable), scopes, secret_updated_at, created_at. Never returns the client_secret.",
|
|
919
|
+
description: "Fetch full detail for one identity provider: type, state, client_id, issuer/tenant (when applicable), scopes, secret_updated_at, created_at. Never returns the client_secret. Pass `org_id` to scope to a business org.",
|
|
754
920
|
inputShape: {
|
|
755
|
-
workspace:
|
|
756
|
-
|
|
921
|
+
workspace: z7.string().min(1),
|
|
922
|
+
org_id: orgIdArg,
|
|
923
|
+
idp_id: z7.string().min(1)
|
|
757
924
|
},
|
|
758
|
-
handler: async ({ workspace, idp_id }, { client }) => client.request(
|
|
759
|
-
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}
|
|
925
|
+
handler: async ({ workspace, org_id, idp_id }, { client }) => client.request(
|
|
926
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,
|
|
927
|
+
{ query: { org_id } }
|
|
760
928
|
)
|
|
761
929
|
});
|
|
762
930
|
var updateIdp = defineTool({
|
|
763
931
|
name: "update_idp",
|
|
764
|
-
description: "Patch mutable fields on an identity provider. All fields optional. Passing client_secret rotates the upstream-issued value (Google/GitHub/Microsoft/OIDC client secret stored in Prysmid). Passing client_id retargets to a different upstream client. issuer/tenant_id apply only when relevant to the IdP type.",
|
|
932
|
+
description: "Patch mutable fields on an identity provider. All fields optional. Passing client_secret rotates the upstream-issued value (Google/GitHub/Microsoft/OIDC client secret stored in Prysmid). Passing client_id retargets to a different upstream client. issuer/tenant_id apply only when relevant to the IdP type. Pass `org_id` to scope to a business org. Pass `provider_options` to flip JIT or linking flags \u2014 only the keys you set change, others are preserved (X6).",
|
|
765
933
|
inputShape: {
|
|
766
|
-
workspace:
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
934
|
+
workspace: z7.string().min(1),
|
|
935
|
+
org_id: orgIdArg,
|
|
936
|
+
idp_id: z7.string().min(1),
|
|
937
|
+
name: z7.string().min(1).optional(),
|
|
938
|
+
client_id: z7.string().min(1).optional(),
|
|
939
|
+
client_secret: z7.string().min(1).optional().describe(
|
|
771
940
|
"Rotate the upstream-issued client secret. Not the Prysmid app secret \u2014 that one is rotated via regenerate_app_secret."
|
|
772
941
|
),
|
|
773
|
-
scopes:
|
|
774
|
-
issuer:
|
|
775
|
-
tenant_id:
|
|
942
|
+
scopes: z7.array(z7.string()).optional(),
|
|
943
|
+
issuer: z7.string().url().optional().describe("Only meaningful for type=oidc."),
|
|
944
|
+
tenant_id: z7.string().optional().describe("Only meaningful for type=microsoft (Entra tenant GUID)."),
|
|
945
|
+
provider_options: providerOptionsSchema
|
|
776
946
|
},
|
|
777
|
-
handler: async ({ workspace, idp_id, ...patch }, { client }) => client.request(
|
|
947
|
+
handler: async ({ workspace, org_id, idp_id, ...patch }, { client }) => client.request(
|
|
778
948
|
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}`,
|
|
779
|
-
{ method: "PATCH", body: patch }
|
|
949
|
+
{ method: "PATCH", body: patch, query: { org_id } }
|
|
780
950
|
)
|
|
781
951
|
});
|
|
782
952
|
var probeIdp = defineTool({
|
|
783
953
|
name: "probe_idp",
|
|
784
|
-
description: "Probe an external identity provider end-to-end against its upstream authorize endpoint. Catches redirect_uri_mismatch (URI not registered at Google Cloud / GitHub / etc.), invalid_client (client_id rotated or deleted upstream), and provider_unreachable failures BEFORE a real end-user hits them. Use after enable_google_login / add_idp, and any time you suspect the IdP is misconfigured. Today: Google + GitHub get full classification; Microsoft + OIDC generic return `skipped` for the deterministic dimensions (only reachability is verified).",
|
|
954
|
+
description: "Probe an external identity provider end-to-end against its upstream authorize endpoint. Catches redirect_uri_mismatch (URI not registered at Google Cloud / GitHub / etc.), invalid_client (client_id rotated or deleted upstream), and provider_unreachable failures BEFORE a real end-user hits them. Use after enable_google_login / add_idp, and any time you suspect the IdP is misconfigured. Today: Google + GitHub get full classification; Microsoft + OIDC generic return `skipped` for the deterministic dimensions (only reachability is verified). Pass `org_id` to scope to a business org.",
|
|
785
955
|
inputShape: {
|
|
786
|
-
workspace:
|
|
787
|
-
|
|
956
|
+
workspace: z7.string().min(1),
|
|
957
|
+
org_id: orgIdArg,
|
|
958
|
+
idp_id: z7.string().min(1)
|
|
788
959
|
},
|
|
789
|
-
handler: async ({ workspace, idp_id }, { client }) => client.request(
|
|
960
|
+
handler: async ({ workspace, org_id, idp_id }, { client }) => client.request(
|
|
790
961
|
`/v1/workspaces/${encodeURIComponent(workspace)}/idps/${encodeURIComponent(idp_id)}/probe`,
|
|
791
|
-
{ method: "POST" }
|
|
962
|
+
{ method: "POST", query: { org_id } }
|
|
792
963
|
)
|
|
793
964
|
});
|
|
794
|
-
var
|
|
965
|
+
var tools7 = [listIdps, addIdp, deleteIdp, getIdp, updateIdp, probeIdp];
|
|
795
966
|
|
|
796
967
|
// src/tools/login_policy.ts
|
|
797
|
-
import { z as
|
|
968
|
+
import { z as z8 } from "zod";
|
|
969
|
+
var orgIdArg2 = z8.string().min(1).optional().describe(
|
|
970
|
+
"Optional Zitadel org id to scope this operation to a specific business org. Omit for the workspace's home org (backwards-compat)."
|
|
971
|
+
);
|
|
972
|
+
var SECOND_FACTORS = ["otp", "u2f", "otp_email", "otp_sms"];
|
|
973
|
+
var MULTI_FACTORS = ["u2f_verified"];
|
|
798
974
|
var getLoginPolicy = defineTool({
|
|
799
975
|
name: "get_login_policy",
|
|
800
|
-
description: "Return the workspace's current login policy (
|
|
976
|
+
description: "Return the workspace's current login policy (auth methods, MFA factors, passwordless, domain discovery, hide-password-reset, etc.). Pass `org_id` to read a specific business org's policy.",
|
|
801
977
|
inputShape: {
|
|
802
|
-
workspace:
|
|
978
|
+
workspace: z8.string().min(1),
|
|
979
|
+
org_id: orgIdArg2
|
|
803
980
|
},
|
|
804
|
-
handler: async ({ workspace }, { client }) => client.request(
|
|
805
|
-
`/v1/workspaces/${encodeURIComponent(workspace)}/login-policy
|
|
981
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
982
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,
|
|
983
|
+
{ query: { org_id } }
|
|
806
984
|
)
|
|
807
985
|
});
|
|
808
986
|
var updateLoginPolicy = defineTool({
|
|
809
987
|
name: "update_login_policy",
|
|
810
|
-
description: "Update the login policy. PATCH semantics \u2014 only fields you pass are changed; other policy fields stay as they were.",
|
|
988
|
+
description: "Update the login policy. PATCH semantics \u2014 only fields you pass are changed; other policy fields stay as they were. Pass `org_id` to scope to a specific business org (P3a-3). Set `allow_domain_discovery=true` together with a verified org domain (see `verify_organization_domain`) to route email-based logins to that org automatically.",
|
|
811
989
|
inputShape: {
|
|
812
|
-
workspace:
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
"
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
990
|
+
workspace: z8.string().min(1),
|
|
991
|
+
org_id: orgIdArg2,
|
|
992
|
+
allow_username_password: z8.boolean().optional(),
|
|
993
|
+
allow_register: z8.boolean().optional(),
|
|
994
|
+
allow_external_idp: z8.boolean().optional(),
|
|
995
|
+
force_mfa: z8.boolean().optional().describe("Require any second factor at login."),
|
|
996
|
+
force_mfa_local_only: z8.boolean().optional().describe(
|
|
997
|
+
"X2: require MFA only for username/password logins, exempting external-IdP logins (which may already enforce MFA upstream). Only meaningful when force_mfa is also true."
|
|
998
|
+
),
|
|
999
|
+
passwordless_allowed: z8.boolean().optional().describe("Allow passkey-first sign-in flows."),
|
|
1000
|
+
second_factors: z8.array(z8.enum(SECOND_FACTORS)).optional().describe(
|
|
1001
|
+
"Replaces the full list of allowed second-factor methods. Pass `[]` to disable all 2FA."
|
|
1002
|
+
),
|
|
1003
|
+
multi_factors: z8.array(z8.enum(MULTI_FACTORS)).optional().describe(
|
|
1004
|
+
"Replaces the full list of allowed multi-factor (passwordless+verification) methods."
|
|
1005
|
+
),
|
|
1006
|
+
hide_password_reset: z8.boolean().optional(),
|
|
1007
|
+
ignore_unknown_usernames: z8.boolean().optional(),
|
|
1008
|
+
allow_domain_discovery: z8.boolean().optional().describe(
|
|
1009
|
+
"P3a-3: route logins to the org that owns the typed email's verified domain, skipping the IdP picker. Requires at least one verified domain on the org (see verify_organization_domain)."
|
|
1010
|
+
)
|
|
823
1011
|
},
|
|
824
|
-
handler: async ({ workspace, ...body }, { client }) => client.request(
|
|
1012
|
+
handler: async ({ workspace, org_id, ...body }, { client }) => client.request(
|
|
825
1013
|
`/v1/workspaces/${encodeURIComponent(workspace)}/login-policy`,
|
|
1014
|
+
{ method: "PATCH", body, query: { org_id } }
|
|
1015
|
+
)
|
|
1016
|
+
});
|
|
1017
|
+
var tools8 = [getLoginPolicy, updateLoginPolicy];
|
|
1018
|
+
|
|
1019
|
+
// src/tools/org_domains.ts
|
|
1020
|
+
import { z as z9 } from "zod";
|
|
1021
|
+
var workspaceArg = z9.string().min(1);
|
|
1022
|
+
var orgIdArg3 = z9.string().min(1).describe(
|
|
1023
|
+
"Zitadel org id (the `id` returned by create/list_organizations). Per-org scoping."
|
|
1024
|
+
);
|
|
1025
|
+
var domainArg = z9.string().min(3).max(253).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/).describe(
|
|
1026
|
+
"Fully-qualified domain to manage. Lower-case only \u2014 `Acme.com` and `acme.com` are different to Zitadel."
|
|
1027
|
+
);
|
|
1028
|
+
var listOrganizationDomains = defineTool({
|
|
1029
|
+
name: "list_organization_domains",
|
|
1030
|
+
description: "List every domain attached to an organization with its verification state. Use after add/verify to confirm the domain shows `is_verified=true`.",
|
|
1031
|
+
inputShape: {
|
|
1032
|
+
workspace: workspaceArg,
|
|
1033
|
+
org_id: orgIdArg3
|
|
1034
|
+
},
|
|
1035
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1036
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/domains`
|
|
1037
|
+
)
|
|
1038
|
+
});
|
|
1039
|
+
var addOrganizationDomain = defineTool({
|
|
1040
|
+
name: "add_organization_domain",
|
|
1041
|
+
description: "Attach a domain to an organization. State starts UNVERIFIED \u2014 chain `generate_organization_domain_verification` and `verify_organization_domain` to complete setup. 409 if already attached.",
|
|
1042
|
+
inputShape: {
|
|
1043
|
+
workspace: workspaceArg,
|
|
1044
|
+
org_id: orgIdArg3,
|
|
1045
|
+
domain: domainArg
|
|
1046
|
+
},
|
|
1047
|
+
handler: async ({ workspace, org_id, domain }, { client }) => client.request(
|
|
1048
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/domains`,
|
|
1049
|
+
{ method: "POST", body: { domain } }
|
|
1050
|
+
)
|
|
1051
|
+
});
|
|
1052
|
+
var generateOrganizationDomainVerification = defineTool({
|
|
1053
|
+
name: "generate_organization_domain_verification",
|
|
1054
|
+
description: "Generate (or rotate) the verification token + record location for an attached domain. Returns `{token, url, method}`. The operator must publish the token at `url` (DNS TXT for method=dns; HTTP file for method=http) before calling `verify_organization_domain`. DNS is the default \u2014 works on apex domains, does not require HTTP control.",
|
|
1055
|
+
inputShape: {
|
|
1056
|
+
workspace: workspaceArg,
|
|
1057
|
+
org_id: orgIdArg3,
|
|
1058
|
+
domain: domainArg,
|
|
1059
|
+
method: z9.enum(["dns", "http"]).default("dns").describe(
|
|
1060
|
+
"Verification method. `dns` (default) \u2192 publish a TXT record. `http` \u2192 serve a file at `.well-known/zitadel-challenge/<token>` on the domain."
|
|
1061
|
+
)
|
|
1062
|
+
},
|
|
1063
|
+
handler: async ({ workspace, org_id, domain, method }, { client }) => client.request(
|
|
1064
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/domains/${encodeURIComponent(domain)}/_generate_verification`,
|
|
1065
|
+
{ method: "POST", body: { method } }
|
|
1066
|
+
)
|
|
1067
|
+
});
|
|
1068
|
+
var verifyOrganizationDomain = defineTool({
|
|
1069
|
+
name: "verify_organization_domain",
|
|
1070
|
+
description: "Trigger Zitadel to look up the published verification token and mark the domain verified. Returns the updated domain projection with `is_verified=true` on success. 400 if the token is not found (DNS not propagated yet, wrong record, etc.) \u2014 retry after publishing.",
|
|
1071
|
+
inputShape: {
|
|
1072
|
+
workspace: workspaceArg,
|
|
1073
|
+
org_id: orgIdArg3,
|
|
1074
|
+
domain: domainArg
|
|
1075
|
+
},
|
|
1076
|
+
handler: async ({ workspace, org_id, domain }, { client }) => client.request(
|
|
1077
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/domains/${encodeURIComponent(domain)}/_verify`,
|
|
1078
|
+
{ method: "POST" }
|
|
1079
|
+
)
|
|
1080
|
+
});
|
|
1081
|
+
var deleteOrganizationDomain = defineTool({
|
|
1082
|
+
name: "delete_organization_domain",
|
|
1083
|
+
description: "Detach a domain from an organization. Idempotent (204 even if already gone). Verified domains can be removed too \u2014 domain discovery will no longer route logins of that email domain to this org.",
|
|
1084
|
+
inputShape: {
|
|
1085
|
+
workspace: workspaceArg,
|
|
1086
|
+
org_id: orgIdArg3,
|
|
1087
|
+
domain: domainArg
|
|
1088
|
+
},
|
|
1089
|
+
handler: async ({ workspace, org_id, domain }, { client }) => client.request(
|
|
1090
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/domains/${encodeURIComponent(domain)}`,
|
|
1091
|
+
{ method: "DELETE" }
|
|
1092
|
+
)
|
|
1093
|
+
});
|
|
1094
|
+
var tools9 = [
|
|
1095
|
+
listOrganizationDomains,
|
|
1096
|
+
addOrganizationDomain,
|
|
1097
|
+
generateOrganizationDomainVerification,
|
|
1098
|
+
verifyOrganizationDomain,
|
|
1099
|
+
deleteOrganizationDomain
|
|
1100
|
+
];
|
|
1101
|
+
|
|
1102
|
+
// src/tools/organizations.ts
|
|
1103
|
+
import { z as z10 } from "zod";
|
|
1104
|
+
var createOrganization = defineTool({
|
|
1105
|
+
name: "create_organization",
|
|
1106
|
+
description: "Create a new organization inside a workspace. Returns the org with a stable `tenant_id` UUID \u2014 that's the value users will see as the `tenant_id` claim on their JWT when an active grant resolves to this org. Idempotent on slug: re-creating a duplicate slug returns 409.",
|
|
1107
|
+
inputShape: {
|
|
1108
|
+
workspace: z10.string().min(1),
|
|
1109
|
+
name: z10.string().min(1).max(255).describe("Display name (mutable)."),
|
|
1110
|
+
slug: z10.string().min(3).max(63).regex(/^[a-z][a-z0-9-]*[a-z0-9]$/).describe(
|
|
1111
|
+
"URL-safe slug, unique per workspace. Immutable. Cannot be `__consumer__` (reserved)."
|
|
1112
|
+
),
|
|
1113
|
+
allow_register: z10.boolean().default(false).describe(
|
|
1114
|
+
"Whether self-registration is allowed for this org. Default false (invite-only)."
|
|
1115
|
+
)
|
|
1116
|
+
},
|
|
1117
|
+
handler: async ({ workspace, ...body }, { client }) => client.request(
|
|
1118
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations`,
|
|
1119
|
+
{ method: "POST", body }
|
|
1120
|
+
)
|
|
1121
|
+
});
|
|
1122
|
+
var listOrganizations = defineTool({
|
|
1123
|
+
name: "list_organizations",
|
|
1124
|
+
description: "List all organizations in a workspace, oldest first. Each item includes the stable `tenant_id` UUID and the consumer flag.",
|
|
1125
|
+
inputShape: {
|
|
1126
|
+
workspace: z10.string().min(1)
|
|
1127
|
+
},
|
|
1128
|
+
handler: async ({ workspace }, { client }) => client.request(
|
|
1129
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations`
|
|
1130
|
+
)
|
|
1131
|
+
});
|
|
1132
|
+
var getOrganization = defineTool({
|
|
1133
|
+
name: "get_organization",
|
|
1134
|
+
description: "Read one organization by its Zitadel org id (the `id` returned by create/list, not the internal Prysm:ID UUID).",
|
|
1135
|
+
inputShape: {
|
|
1136
|
+
workspace: z10.string().min(1),
|
|
1137
|
+
org_id: z10.string().min(1)
|
|
1138
|
+
},
|
|
1139
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1140
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}`
|
|
1141
|
+
)
|
|
1142
|
+
});
|
|
1143
|
+
var updateOrganization = defineTool({
|
|
1144
|
+
name: "update_organization",
|
|
1145
|
+
description: "Rename an organization and/or toggle `allow_register` / `domain_auto_claim`. Sparse \u2014 omit fields to leave them untouched. Rename propagates to Zitadel synchronously.",
|
|
1146
|
+
inputShape: {
|
|
1147
|
+
workspace: z10.string().min(1),
|
|
1148
|
+
org_id: z10.string().min(1),
|
|
1149
|
+
name: z10.string().min(1).max(255).optional(),
|
|
1150
|
+
allow_register: z10.boolean().optional(),
|
|
1151
|
+
domain_auto_claim: z10.boolean().optional().describe(
|
|
1152
|
+
"P2e opt-in: when True, verifying a domain on this org (or calling reconcile_organization_domain_claims) auto-grants the org access over consumer-org users with a matching verified email domain. Public domains are always excluded; the user's home org is never moved (the claim is an additional, revocable grant)."
|
|
1153
|
+
)
|
|
1154
|
+
},
|
|
1155
|
+
handler: async ({ workspace, org_id, ...body }, { client }) => client.request(
|
|
1156
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}`,
|
|
826
1157
|
{ method: "PATCH", body }
|
|
827
1158
|
)
|
|
828
1159
|
});
|
|
829
|
-
var
|
|
1160
|
+
var reconcileOrganizationDomainClaims = defineTool({
|
|
1161
|
+
name: "reconcile_organization_domain_claims",
|
|
1162
|
+
description: "P2e: grant this org access over consumer-org users whose verified email domain matches one of the org's verified domains. Idempotent and re-runnable \u2014 catches users who self-registered after a domain was verified. Requires domain_auto_claim=true on the org (returns skipped with a reason otherwise). Public email domains are always excluded; the user's home org is never moved. Returns counts: granted / already_present / candidates + the domains matched.",
|
|
1163
|
+
inputShape: {
|
|
1164
|
+
workspace: z10.string().min(1),
|
|
1165
|
+
org_id: z10.string().min(1)
|
|
1166
|
+
},
|
|
1167
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1168
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/_reconcile-domain-claims`,
|
|
1169
|
+
{ method: "POST" }
|
|
1170
|
+
)
|
|
1171
|
+
});
|
|
1172
|
+
var deactivateOrganization = defineTool({
|
|
1173
|
+
name: "deactivate_organization",
|
|
1174
|
+
description: "Block all logins to an organization. Idempotent. Consumer org cannot be deactivated \u2014 toggle `allow_consumer_org=false` on the workspace instead.",
|
|
1175
|
+
inputShape: {
|
|
1176
|
+
workspace: z10.string().min(1),
|
|
1177
|
+
org_id: z10.string().min(1)
|
|
1178
|
+
},
|
|
1179
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1180
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/_deactivate`,
|
|
1181
|
+
{ method: "POST" }
|
|
1182
|
+
)
|
|
1183
|
+
});
|
|
1184
|
+
var reactivateOrganization = defineTool({
|
|
1185
|
+
name: "reactivate_organization",
|
|
1186
|
+
description: "Re-enable logins for a previously deactivated organization. Idempotent.",
|
|
1187
|
+
inputShape: {
|
|
1188
|
+
workspace: z10.string().min(1),
|
|
1189
|
+
org_id: z10.string().min(1)
|
|
1190
|
+
},
|
|
1191
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1192
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}/_reactivate`,
|
|
1193
|
+
{ method: "POST" }
|
|
1194
|
+
)
|
|
1195
|
+
});
|
|
1196
|
+
var deleteOrganization = defineTool({
|
|
1197
|
+
name: "delete_organization",
|
|
1198
|
+
description: "Hard-delete an organization. Cascades users/projects/grants on the Zitadel side. Idempotent against out-of-band Zitadel removal. Consumer org is protected \u2014 toggle `allow_consumer_org=false` on the workspace to remove it.",
|
|
1199
|
+
inputShape: {
|
|
1200
|
+
workspace: z10.string().min(1),
|
|
1201
|
+
org_id: z10.string().min(1)
|
|
1202
|
+
},
|
|
1203
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1204
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/${encodeURIComponent(org_id)}`,
|
|
1205
|
+
{ method: "DELETE" }
|
|
1206
|
+
)
|
|
1207
|
+
});
|
|
1208
|
+
var ensureConsumerOrganization = defineTool({
|
|
1209
|
+
name: "ensure_consumer_organization",
|
|
1210
|
+
description: "Idempotently provision the workspace's consumer organization for self-registered users. Requires `workspace.allow_consumer_org=true` (toggle it via update_workspace first). Returns the org row whether newly created or already present. Slug `__consumer__`, `allow_register=true`, `is_consumer=true`.",
|
|
1211
|
+
inputShape: {
|
|
1212
|
+
workspace: z10.string().min(1)
|
|
1213
|
+
},
|
|
1214
|
+
handler: async ({ workspace }, { client }) => client.request(
|
|
1215
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/organizations/_ensure-consumer`,
|
|
1216
|
+
{ method: "POST" }
|
|
1217
|
+
)
|
|
1218
|
+
});
|
|
1219
|
+
var tools10 = [
|
|
1220
|
+
createOrganization,
|
|
1221
|
+
listOrganizations,
|
|
1222
|
+
getOrganization,
|
|
1223
|
+
updateOrganization,
|
|
1224
|
+
reconcileOrganizationDomainClaims,
|
|
1225
|
+
deactivateOrganization,
|
|
1226
|
+
reactivateOrganization,
|
|
1227
|
+
deleteOrganization,
|
|
1228
|
+
ensureConsumerOrganization
|
|
1229
|
+
];
|
|
1230
|
+
|
|
1231
|
+
// src/tools/service_accounts.ts
|
|
1232
|
+
import { z as z11 } from "zod";
|
|
1233
|
+
var orgIdArg4 = z11.string().min(1).optional().describe(
|
|
1234
|
+
"Optional Zitadel org id to scope the service account to a specific business org. Omit for the workspace's home org (backwards-compat)."
|
|
1235
|
+
);
|
|
1236
|
+
var listServiceAccounts = defineTool({
|
|
1237
|
+
name: "list_service_accounts",
|
|
1238
|
+
description: "List the workspace's service accounts (machine users). The platform-internal provisioner SA is filtered out. Pass `org_id` to list a specific business org's machine users.",
|
|
1239
|
+
inputShape: {
|
|
1240
|
+
workspace: z11.string().min(1),
|
|
1241
|
+
org_id: orgIdArg4
|
|
1242
|
+
},
|
|
1243
|
+
handler: async ({ workspace, org_id }, { client }) => client.request(
|
|
1244
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/service-accounts`,
|
|
1245
|
+
{ query: { org_id } }
|
|
1246
|
+
)
|
|
1247
|
+
});
|
|
1248
|
+
var createServiceAccount = defineTool({
|
|
1249
|
+
name: "create_service_account",
|
|
1250
|
+
description: "Create a service account (machine user) and mint its JSON key. The `key` is returned ONCE in the response and never stored by Prysmid \u2014 surface it to the operator and instruct them to save it in a secret manager. Pass `org_id` to create the SA inside a specific business org.",
|
|
1251
|
+
inputShape: {
|
|
1252
|
+
workspace: z11.string().min(1),
|
|
1253
|
+
org_id: orgIdArg4,
|
|
1254
|
+
user_name: z11.string().regex(/^[a-zA-Z][a-zA-Z0-9._-]{1,49}$/).describe(
|
|
1255
|
+
"Machine username (Zitadel handle). Cannot be the reserved `prysmid-provisioner`."
|
|
1256
|
+
),
|
|
1257
|
+
name: z11.string().min(1).max(200).describe("Human-readable display name."),
|
|
1258
|
+
description: z11.string().max(500).optional()
|
|
1259
|
+
},
|
|
1260
|
+
handler: async ({ workspace, org_id, ...body }, { client }) => client.request(
|
|
1261
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/service-accounts`,
|
|
1262
|
+
{ method: "POST", body, query: { org_id } }
|
|
1263
|
+
)
|
|
1264
|
+
});
|
|
1265
|
+
var deleteServiceAccount = defineTool({
|
|
1266
|
+
name: "delete_service_account",
|
|
1267
|
+
description: "Revoke a service account. Idempotent (204 even if already gone). Refuses to delete the platform provisioner SA. Pass `org_id` to target a specific business org's machine user.",
|
|
1268
|
+
inputShape: {
|
|
1269
|
+
workspace: z11.string().min(1),
|
|
1270
|
+
org_id: orgIdArg4,
|
|
1271
|
+
service_account_id: z11.string().min(1)
|
|
1272
|
+
},
|
|
1273
|
+
handler: async ({ workspace, org_id, service_account_id }, { client }) => client.request(
|
|
1274
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/service-accounts/${encodeURIComponent(service_account_id)}`,
|
|
1275
|
+
{ method: "DELETE", query: { org_id } }
|
|
1276
|
+
)
|
|
1277
|
+
});
|
|
1278
|
+
var tools11 = [
|
|
1279
|
+
listServiceAccounts,
|
|
1280
|
+
createServiceAccount,
|
|
1281
|
+
deleteServiceAccount
|
|
1282
|
+
];
|
|
830
1283
|
|
|
831
1284
|
// src/tools/users.ts
|
|
832
|
-
import { z as
|
|
1285
|
+
import { z as z12 } from "zod";
|
|
833
1286
|
var listUsers = defineTool({
|
|
834
1287
|
name: "list_users",
|
|
835
1288
|
description: "List human users in a workspace.",
|
|
836
1289
|
inputShape: {
|
|
837
|
-
workspace:
|
|
838
|
-
limit:
|
|
1290
|
+
workspace: z12.string().min(1),
|
|
1291
|
+
limit: z12.number().int().min(1).max(500).default(100)
|
|
839
1292
|
},
|
|
840
1293
|
handler: async ({ workspace, limit }, { client }) => client.request(
|
|
841
1294
|
`/v1/workspaces/${encodeURIComponent(workspace)}/users`,
|
|
@@ -846,11 +1299,11 @@ var inviteUser = defineTool({
|
|
|
846
1299
|
name: "invite_user",
|
|
847
1300
|
description: "Invite a user by email. Idempotent by email \u2014 re-inviting an existing user is a no-op. Triggers a Zitadel init email with a 'set your password' link.",
|
|
848
1301
|
inputShape: {
|
|
849
|
-
workspace:
|
|
850
|
-
email:
|
|
851
|
-
first_name:
|
|
852
|
-
last_name:
|
|
853
|
-
preferred_language:
|
|
1302
|
+
workspace: z12.string().min(1),
|
|
1303
|
+
email: z12.string().regex(/^[^\s@]+@[^\s@]+\.[^\s@]+$/, "must be a valid email"),
|
|
1304
|
+
first_name: z12.string().min(1),
|
|
1305
|
+
last_name: z12.string().min(1),
|
|
1306
|
+
preferred_language: z12.string().length(2).default("en").describe("ISO 639-1, e.g. en/es/pt")
|
|
854
1307
|
},
|
|
855
1308
|
handler: async ({ workspace, ...body }, { client }) => client.request(
|
|
856
1309
|
`/v1/workspaces/${encodeURIComponent(workspace)}/users/invite`,
|
|
@@ -861,18 +1314,115 @@ var deleteUser = defineTool({
|
|
|
861
1314
|
name: "delete_user",
|
|
862
1315
|
description: "Delete a user by id. Idempotent.",
|
|
863
1316
|
inputShape: {
|
|
864
|
-
workspace:
|
|
865
|
-
user_id:
|
|
1317
|
+
workspace: z12.string().min(1),
|
|
1318
|
+
user_id: z12.string().min(1)
|
|
866
1319
|
},
|
|
867
1320
|
handler: async ({ workspace, user_id }, { client }) => client.request(
|
|
868
1321
|
`/v1/workspaces/${encodeURIComponent(workspace)}/users/${encodeURIComponent(user_id)}`,
|
|
869
1322
|
{ method: "DELETE" }
|
|
870
1323
|
)
|
|
871
1324
|
});
|
|
872
|
-
var
|
|
1325
|
+
var tools12 = [listUsers, inviteUser, deleteUser];
|
|
1326
|
+
|
|
1327
|
+
// src/tools/webhooks.ts
|
|
1328
|
+
import { z as z13 } from "zod";
|
|
1329
|
+
var KNOWN_EVENTS = [
|
|
1330
|
+
"user.created",
|
|
1331
|
+
"user.deleted",
|
|
1332
|
+
"user.deactivated",
|
|
1333
|
+
"user.reactivated",
|
|
1334
|
+
"session.created",
|
|
1335
|
+
"org.created",
|
|
1336
|
+
"org.updated",
|
|
1337
|
+
"org.deactivated",
|
|
1338
|
+
"org.reactivated",
|
|
1339
|
+
"org.deleted",
|
|
1340
|
+
"grant.granted",
|
|
1341
|
+
"grant.updated",
|
|
1342
|
+
"grant.deactivated",
|
|
1343
|
+
"grant.reactivated",
|
|
1344
|
+
"grant.revoked"
|
|
1345
|
+
];
|
|
1346
|
+
var eventName = z13.enum(KNOWN_EVENTS);
|
|
1347
|
+
var createWebhookEndpoint = defineTool({
|
|
1348
|
+
name: "create_webhook_endpoint",
|
|
1349
|
+
description: "Register a new outbound webhook endpoint for a workspace. Returns the freshly-generated `signing_secret` EXACTLY ONCE \u2014 store it immediately to verify deliveries; it is NOT retrievable later. HTTPS required in prod. Empty `enabled_events` = catch-all (subscribe to everything).",
|
|
1350
|
+
inputShape: {
|
|
1351
|
+
workspace: z13.string().min(1),
|
|
1352
|
+
url: z13.string().url().describe(
|
|
1353
|
+
"Destination URL. Must be https:// in production; http:// is permitted only on dev/staging environments."
|
|
1354
|
+
),
|
|
1355
|
+
description: z13.string().max(255).optional().describe("Human label so you can tell endpoints apart in the dashboard."),
|
|
1356
|
+
enabled_events: z13.array(eventName).default([]).describe(
|
|
1357
|
+
"Event types this endpoint subscribes to. Empty = catch-all. Unknown event types return 422."
|
|
1358
|
+
)
|
|
1359
|
+
},
|
|
1360
|
+
handler: async ({ workspace, ...body }, { client }) => client.request(
|
|
1361
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/webhook-endpoints`,
|
|
1362
|
+
{ method: "POST", body }
|
|
1363
|
+
)
|
|
1364
|
+
});
|
|
1365
|
+
var listWebhookEndpoints = defineTool({
|
|
1366
|
+
name: "list_webhook_endpoints",
|
|
1367
|
+
description: "List all outbound webhook endpoints registered for a workspace. Does NOT return signing secrets \u2014 that's only on create.",
|
|
1368
|
+
inputShape: {
|
|
1369
|
+
workspace: z13.string().min(1)
|
|
1370
|
+
},
|
|
1371
|
+
handler: async ({ workspace }, { client }) => client.request(
|
|
1372
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/webhook-endpoints`
|
|
1373
|
+
)
|
|
1374
|
+
});
|
|
1375
|
+
var getWebhookEndpoint = defineTool({
|
|
1376
|
+
name: "get_webhook_endpoint",
|
|
1377
|
+
description: "Read one webhook endpoint by id. Omits the signing secret \u2014 recreate the endpoint if it was lost.",
|
|
1378
|
+
inputShape: {
|
|
1379
|
+
workspace: z13.string().min(1),
|
|
1380
|
+
endpoint_id: z13.string().min(1)
|
|
1381
|
+
},
|
|
1382
|
+
handler: async ({ workspace, endpoint_id }, { client }) => client.request(
|
|
1383
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/webhook-endpoints/${encodeURIComponent(endpoint_id)}`
|
|
1384
|
+
)
|
|
1385
|
+
});
|
|
1386
|
+
var updateWebhookEndpoint = defineTool({
|
|
1387
|
+
name: "update_webhook_endpoint",
|
|
1388
|
+
description: "Sparse update of an endpoint's url / description / enabled_events / enabled flag. Omit fields to leave them untouched. signing_secret is NOT mutable \u2014 to rotate, delete and recreate.",
|
|
1389
|
+
inputShape: {
|
|
1390
|
+
workspace: z13.string().min(1),
|
|
1391
|
+
endpoint_id: z13.string().min(1),
|
|
1392
|
+
url: z13.string().url().optional(),
|
|
1393
|
+
description: z13.string().max(255).optional(),
|
|
1394
|
+
enabled_events: z13.array(eventName).optional(),
|
|
1395
|
+
enabled: z13.boolean().optional().describe(
|
|
1396
|
+
"Toggle deliveries without losing config. Useful when the destination is temporarily down."
|
|
1397
|
+
)
|
|
1398
|
+
},
|
|
1399
|
+
handler: async ({ workspace, endpoint_id, ...body }, { client }) => client.request(
|
|
1400
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/webhook-endpoints/${encodeURIComponent(endpoint_id)}`,
|
|
1401
|
+
{ method: "PATCH", body }
|
|
1402
|
+
)
|
|
1403
|
+
});
|
|
1404
|
+
var deleteWebhookEndpoint = defineTool({
|
|
1405
|
+
name: "delete_webhook_endpoint",
|
|
1406
|
+
description: "Permanently remove a webhook endpoint. Pending deliveries to it are NOT removed (operator can inspect them) but no new deliveries will be queued.",
|
|
1407
|
+
inputShape: {
|
|
1408
|
+
workspace: z13.string().min(1),
|
|
1409
|
+
endpoint_id: z13.string().min(1)
|
|
1410
|
+
},
|
|
1411
|
+
handler: async ({ workspace, endpoint_id }, { client }) => client.request(
|
|
1412
|
+
`/v1/workspaces/${encodeURIComponent(workspace)}/webhook-endpoints/${encodeURIComponent(endpoint_id)}`,
|
|
1413
|
+
{ method: "DELETE" }
|
|
1414
|
+
)
|
|
1415
|
+
});
|
|
1416
|
+
var tools13 = [
|
|
1417
|
+
createWebhookEndpoint,
|
|
1418
|
+
listWebhookEndpoints,
|
|
1419
|
+
getWebhookEndpoint,
|
|
1420
|
+
updateWebhookEndpoint,
|
|
1421
|
+
deleteWebhookEndpoint
|
|
1422
|
+
];
|
|
873
1423
|
|
|
874
1424
|
// src/tools/workspaces.ts
|
|
875
|
-
import { z as
|
|
1425
|
+
import { z as z14 } from "zod";
|
|
876
1426
|
var listWorkspaces = defineTool({
|
|
877
1427
|
name: "list_workspaces",
|
|
878
1428
|
description: "List Prysmid workspaces accessible to the current API token. Returns an array of {id, slug, display_name, plan, state}.",
|
|
@@ -883,7 +1433,7 @@ var getWorkspace = defineTool({
|
|
|
883
1433
|
name: "get_workspace",
|
|
884
1434
|
description: "Get a single workspace by slug or id.",
|
|
885
1435
|
inputShape: {
|
|
886
|
-
workspace:
|
|
1436
|
+
workspace: z14.string().min(1).describe("Workspace slug or UUID")
|
|
887
1437
|
},
|
|
888
1438
|
handler: async ({ workspace }, { client }) => client.request(`/v1/workspaces/${encodeURIComponent(workspace)}`)
|
|
889
1439
|
});
|
|
@@ -891,25 +1441,25 @@ var createWorkspace = defineTool({
|
|
|
891
1441
|
name: "create_workspace",
|
|
892
1442
|
description: "Create a new Prysmid workspace. Provisioning runs in the background; the response returns immediately with state=provisioning. Poll `get_workspace` until state=active (~30s).",
|
|
893
1443
|
inputShape: {
|
|
894
|
-
slug:
|
|
895
|
-
display_name:
|
|
1444
|
+
slug: z14.string().min(2).max(63).regex(/^[a-z0-9-]+$/, "lowercase alphanumeric and hyphens only").describe("Subdomain-safe slug \u2014 becomes auth.<slug>.prysmid.com"),
|
|
1445
|
+
display_name: z14.string().min(1).max(255)
|
|
896
1446
|
},
|
|
897
1447
|
handler: async (input, { client }) => client.request("/v1/workspaces", { method: "POST", body: input })
|
|
898
1448
|
});
|
|
899
|
-
var
|
|
1449
|
+
var tools14 = [listWorkspaces, getWorkspace, createWorkspace];
|
|
900
1450
|
|
|
901
1451
|
// src/tools/generated/apps.ts
|
|
902
|
-
import { z as
|
|
1452
|
+
import { z as z15 } from "zod";
|
|
903
1453
|
var createApp = defineTool({
|
|
904
1454
|
name: "create_app",
|
|
905
1455
|
description: "Create App",
|
|
906
1456
|
inputShape: {
|
|
907
|
-
workspace_id:
|
|
908
|
-
name:
|
|
909
|
-
redirect_uris:
|
|
910
|
-
post_logout_redirect_uris:
|
|
911
|
-
app_type:
|
|
912
|
-
dev_mode:
|
|
1457
|
+
workspace_id: z15.string().uuid(),
|
|
1458
|
+
name: z15.string().min(1).max(200),
|
|
1459
|
+
redirect_uris: z15.array(z15.string().url().min(1).max(2083)).describe("Where the IdP sends the user back after auth. At least one required."),
|
|
1460
|
+
post_logout_redirect_uris: z15.array(z15.string().url().min(1).max(2083)).describe("Where the IdP sends the user after logout.").optional(),
|
|
1461
|
+
app_type: z15.enum(["web", "spa", "native"]).describe("App kind, drives OIDC grant + auth_method defaults.\n\n- `web`: server-rendered confidential client. Gets a `client_secret`.\n- `spa`: single-page app (user-agent). Public, PKCE required, no secret.\n- `native`: desktop/mobile. Public, PKCE required, no secret.").optional(),
|
|
1462
|
+
dev_mode: z15.boolean().describe("Relax HTTPS requirement on redirect_uris (allows http://localhost). Use only for local development; never in production.").default(false)
|
|
913
1463
|
},
|
|
914
1464
|
handler: async (input, { client }) => {
|
|
915
1465
|
const { workspace_id, ...__body } = input;
|
|
@@ -920,8 +1470,8 @@ var deleteApp = defineTool({
|
|
|
920
1470
|
name: "delete_app",
|
|
921
1471
|
description: "Delete App",
|
|
922
1472
|
inputShape: {
|
|
923
|
-
workspace_id:
|
|
924
|
-
app_id:
|
|
1473
|
+
workspace_id: z15.string().uuid(),
|
|
1474
|
+
app_id: z15.string()
|
|
925
1475
|
},
|
|
926
1476
|
handler: async (input, { client }) => {
|
|
927
1477
|
const { workspace_id, app_id } = input;
|
|
@@ -932,7 +1482,7 @@ var listApps2 = defineTool({
|
|
|
932
1482
|
name: "list_apps",
|
|
933
1483
|
description: "List Apps",
|
|
934
1484
|
inputShape: {
|
|
935
|
-
workspace_id:
|
|
1485
|
+
workspace_id: z15.string().uuid()
|
|
936
1486
|
},
|
|
937
1487
|
handler: async (input, { client }) => {
|
|
938
1488
|
const { workspace_id } = input;
|
|
@@ -946,13 +1496,13 @@ var generatedAppsTools = [
|
|
|
946
1496
|
];
|
|
947
1497
|
|
|
948
1498
|
// src/tools/generated/billing.ts
|
|
949
|
-
import { z as
|
|
1499
|
+
import { z as z16 } from "zod";
|
|
950
1500
|
var billingCheckout = defineTool({
|
|
951
1501
|
name: "billing_checkout",
|
|
952
1502
|
description: "Checkout",
|
|
953
1503
|
inputShape: {
|
|
954
|
-
workspace_id:
|
|
955
|
-
plan:
|
|
1504
|
+
workspace_id: z16.string().uuid(),
|
|
1505
|
+
plan: z16.enum(["free", "pro", "enterprise"])
|
|
956
1506
|
},
|
|
957
1507
|
handler: async (input, { client }) => {
|
|
958
1508
|
const { workspace_id, ...__body } = input;
|
|
@@ -963,7 +1513,7 @@ var billingGetState = defineTool({
|
|
|
963
1513
|
name: "billing_get_state",
|
|
964
1514
|
description: "Get State",
|
|
965
1515
|
inputShape: {
|
|
966
|
-
workspace_id:
|
|
1516
|
+
workspace_id: z16.string().uuid()
|
|
967
1517
|
},
|
|
968
1518
|
handler: async (input, { client }) => {
|
|
969
1519
|
const { workspace_id } = input;
|
|
@@ -974,7 +1524,7 @@ var billingPortal = defineTool({
|
|
|
974
1524
|
name: "billing_portal",
|
|
975
1525
|
description: "Portal",
|
|
976
1526
|
inputShape: {
|
|
977
|
-
workspace_id:
|
|
1527
|
+
workspace_id: z16.string().uuid()
|
|
978
1528
|
},
|
|
979
1529
|
handler: async (input, { client }) => {
|
|
980
1530
|
const { workspace_id } = input;
|
|
@@ -985,8 +1535,8 @@ var updateSpendingCap = defineTool({
|
|
|
985
1535
|
name: "update_spending_cap",
|
|
986
1536
|
description: "Update Spending Cap",
|
|
987
1537
|
inputShape: {
|
|
988
|
-
workspace_id:
|
|
989
|
-
cents:
|
|
1538
|
+
workspace_id: z16.string().uuid(),
|
|
1539
|
+
cents: z16.number().int().min(0).nullable().optional()
|
|
990
1540
|
},
|
|
991
1541
|
handler: async (input, { client }) => {
|
|
992
1542
|
const { workspace_id, ...__body } = input;
|
|
@@ -1001,12 +1551,12 @@ var generatedBillingTools = [
|
|
|
1001
1551
|
];
|
|
1002
1552
|
|
|
1003
1553
|
// src/tools/generated/branding.ts
|
|
1004
|
-
import { z as
|
|
1554
|
+
import { z as z17 } from "zod";
|
|
1005
1555
|
var deleteLogo = defineTool({
|
|
1006
1556
|
name: "delete_logo",
|
|
1007
1557
|
description: "Delete Logo",
|
|
1008
1558
|
inputShape: {
|
|
1009
|
-
workspace_id:
|
|
1559
|
+
workspace_id: z17.string().uuid()
|
|
1010
1560
|
},
|
|
1011
1561
|
handler: async (input, { client }) => {
|
|
1012
1562
|
const { workspace_id } = input;
|
|
@@ -1017,7 +1567,7 @@ var getBranding2 = defineTool({
|
|
|
1017
1567
|
name: "get_branding",
|
|
1018
1568
|
description: "Get Branding",
|
|
1019
1569
|
inputShape: {
|
|
1020
|
-
workspace_id:
|
|
1570
|
+
workspace_id: z17.string().uuid()
|
|
1021
1571
|
},
|
|
1022
1572
|
handler: async (input, { client }) => {
|
|
1023
1573
|
const { workspace_id } = input;
|
|
@@ -1028,17 +1578,17 @@ var updateBranding2 = defineTool({
|
|
|
1028
1578
|
name: "update_branding",
|
|
1029
1579
|
description: "Update Branding",
|
|
1030
1580
|
inputShape: {
|
|
1031
|
-
workspace_id:
|
|
1032
|
-
primary_color:
|
|
1033
|
-
background_color:
|
|
1034
|
-
warn_color:
|
|
1035
|
-
font_color:
|
|
1036
|
-
primary_color_dark:
|
|
1037
|
-
background_color_dark:
|
|
1038
|
-
warn_color_dark:
|
|
1039
|
-
font_color_dark:
|
|
1040
|
-
hide_login_name_suffix:
|
|
1041
|
-
disable_watermark:
|
|
1581
|
+
workspace_id: z17.string().uuid(),
|
|
1582
|
+
primary_color: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1583
|
+
background_color: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1584
|
+
warn_color: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1585
|
+
font_color: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1586
|
+
primary_color_dark: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1587
|
+
background_color_dark: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1588
|
+
warn_color_dark: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1589
|
+
font_color_dark: z17.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).nullable().optional(),
|
|
1590
|
+
hide_login_name_suffix: z17.boolean().nullable().optional(),
|
|
1591
|
+
disable_watermark: z17.boolean().nullable().optional()
|
|
1042
1592
|
},
|
|
1043
1593
|
handler: async (input, { client }) => {
|
|
1044
1594
|
const { workspace_id, ...__body } = input;
|
|
@@ -1052,19 +1602,19 @@ var generatedBrandingTools = [
|
|
|
1052
1602
|
];
|
|
1053
1603
|
|
|
1054
1604
|
// src/tools/generated/idps.ts
|
|
1055
|
-
import { z as
|
|
1605
|
+
import { z as z18 } from "zod";
|
|
1056
1606
|
var createIdp = defineTool({
|
|
1057
1607
|
name: "create_idp",
|
|
1058
1608
|
description: "Create Idp",
|
|
1059
1609
|
inputShape: {
|
|
1060
|
-
workspace_id:
|
|
1061
|
-
type:
|
|
1062
|
-
name:
|
|
1063
|
-
client_id:
|
|
1064
|
-
client_secret:
|
|
1065
|
-
issuer:
|
|
1066
|
-
tenant_id:
|
|
1067
|
-
scopes:
|
|
1610
|
+
workspace_id: z18.string().uuid(),
|
|
1611
|
+
type: z18.enum(["google", "github", "microsoft", "oidc"]),
|
|
1612
|
+
name: z18.string().min(1).max(200),
|
|
1613
|
+
client_id: z18.string().min(1),
|
|
1614
|
+
client_secret: z18.string().min(1),
|
|
1615
|
+
issuer: z18.string().url().min(1).max(2083).nullable().optional(),
|
|
1616
|
+
tenant_id: z18.string().nullable().optional(),
|
|
1617
|
+
scopes: z18.array(z18.string()).nullable().optional()
|
|
1068
1618
|
},
|
|
1069
1619
|
handler: async (input, { client }) => {
|
|
1070
1620
|
const { workspace_id, ...__body } = input;
|
|
@@ -1075,8 +1625,8 @@ var deleteIdp2 = defineTool({
|
|
|
1075
1625
|
name: "delete_idp",
|
|
1076
1626
|
description: "Delete Idp",
|
|
1077
1627
|
inputShape: {
|
|
1078
|
-
workspace_id:
|
|
1079
|
-
idp_id:
|
|
1628
|
+
workspace_id: z18.string().uuid(),
|
|
1629
|
+
idp_id: z18.string()
|
|
1080
1630
|
},
|
|
1081
1631
|
handler: async (input, { client }) => {
|
|
1082
1632
|
const { workspace_id, idp_id } = input;
|
|
@@ -1087,7 +1637,7 @@ var listIdps2 = defineTool({
|
|
|
1087
1637
|
name: "list_idps",
|
|
1088
1638
|
description: "List Idps",
|
|
1089
1639
|
inputShape: {
|
|
1090
|
-
workspace_id:
|
|
1640
|
+
workspace_id: z18.string().uuid()
|
|
1091
1641
|
},
|
|
1092
1642
|
handler: async (input, { client }) => {
|
|
1093
1643
|
const { workspace_id } = input;
|
|
@@ -1101,12 +1651,12 @@ var generatedIdpsTools = [
|
|
|
1101
1651
|
];
|
|
1102
1652
|
|
|
1103
1653
|
// src/tools/generated/login-policy.ts
|
|
1104
|
-
import { z as
|
|
1654
|
+
import { z as z19 } from "zod";
|
|
1105
1655
|
var getLoginPolicy2 = defineTool({
|
|
1106
1656
|
name: "get_login_policy",
|
|
1107
1657
|
description: "Get Login Policy",
|
|
1108
1658
|
inputShape: {
|
|
1109
|
-
workspace_id:
|
|
1659
|
+
workspace_id: z19.string().uuid()
|
|
1110
1660
|
},
|
|
1111
1661
|
handler: async (input, { client }) => {
|
|
1112
1662
|
const { workspace_id } = input;
|
|
@@ -1117,16 +1667,16 @@ var updateLoginPolicy2 = defineTool({
|
|
|
1117
1667
|
name: "update_login_policy",
|
|
1118
1668
|
description: "Update Login Policy",
|
|
1119
1669
|
inputShape: {
|
|
1120
|
-
workspace_id:
|
|
1121
|
-
allow_username_password:
|
|
1122
|
-
allow_register:
|
|
1123
|
-
allow_external_idp:
|
|
1124
|
-
force_mfa:
|
|
1125
|
-
passwordless_allowed:
|
|
1126
|
-
second_factors:
|
|
1127
|
-
multi_factors:
|
|
1128
|
-
hide_password_reset:
|
|
1129
|
-
ignore_unknown_usernames:
|
|
1670
|
+
workspace_id: z19.string().uuid(),
|
|
1671
|
+
allow_username_password: z19.boolean().nullable().optional(),
|
|
1672
|
+
allow_register: z19.boolean().nullable().optional(),
|
|
1673
|
+
allow_external_idp: z19.boolean().nullable().optional(),
|
|
1674
|
+
force_mfa: z19.boolean().nullable().optional(),
|
|
1675
|
+
passwordless_allowed: z19.boolean().nullable().optional(),
|
|
1676
|
+
second_factors: z19.array(z19.enum(["otp", "u2f", "otp_email", "otp_sms"])).nullable().optional(),
|
|
1677
|
+
multi_factors: z19.array(z19.enum(["u2f_verified"])).nullable().optional(),
|
|
1678
|
+
hide_password_reset: z19.boolean().nullable().optional(),
|
|
1679
|
+
ignore_unknown_usernames: z19.boolean().nullable().optional()
|
|
1130
1680
|
},
|
|
1131
1681
|
handler: async (input, { client }) => {
|
|
1132
1682
|
const { workspace_id, ...__body } = input;
|
|
@@ -1139,12 +1689,12 @@ var generatedLoginPolicyTools = [
|
|
|
1139
1689
|
];
|
|
1140
1690
|
|
|
1141
1691
|
// src/tools/generated/smtp.ts
|
|
1142
|
-
import { z as
|
|
1692
|
+
import { z as z20 } from "zod";
|
|
1143
1693
|
var getSmtp = defineTool({
|
|
1144
1694
|
name: "get_smtp",
|
|
1145
1695
|
description: "Get Smtp",
|
|
1146
1696
|
inputShape: {
|
|
1147
|
-
workspace_id:
|
|
1697
|
+
workspace_id: z20.string().uuid()
|
|
1148
1698
|
},
|
|
1149
1699
|
handler: async (input, { client }) => {
|
|
1150
1700
|
const { workspace_id } = input;
|
|
@@ -1155,7 +1705,7 @@ var revertToPlatformDefault = defineTool({
|
|
|
1155
1705
|
name: "revert_to_platform_default",
|
|
1156
1706
|
description: "Revert To Platform Default",
|
|
1157
1707
|
inputShape: {
|
|
1158
|
-
workspace_id:
|
|
1708
|
+
workspace_id: z20.string().uuid()
|
|
1159
1709
|
},
|
|
1160
1710
|
handler: async (input, { client }) => {
|
|
1161
1711
|
const { workspace_id } = input;
|
|
@@ -1166,15 +1716,15 @@ var setCustomSmtp = defineTool({
|
|
|
1166
1716
|
name: "set_custom_smtp",
|
|
1167
1717
|
description: "Set Custom Smtp",
|
|
1168
1718
|
inputShape: {
|
|
1169
|
-
workspace_id:
|
|
1170
|
-
host:
|
|
1171
|
-
port:
|
|
1172
|
-
tls:
|
|
1173
|
-
sender_address:
|
|
1174
|
-
sender_name:
|
|
1175
|
-
user:
|
|
1176
|
-
password:
|
|
1177
|
-
reply_to_address:
|
|
1719
|
+
workspace_id: z20.string().uuid(),
|
|
1720
|
+
host: z20.string().min(1),
|
|
1721
|
+
port: z20.number().int().min(1).max(65535),
|
|
1722
|
+
tls: z20.boolean().default(true),
|
|
1723
|
+
sender_address: z20.string().min(3).describe("Address that appears in the From header."),
|
|
1724
|
+
sender_name: z20.string().min(1).max(200),
|
|
1725
|
+
user: z20.string().min(1).describe("SMTP auth username."),
|
|
1726
|
+
password: z20.string().min(1).describe("SMTP auth password / API key."),
|
|
1727
|
+
reply_to_address: z20.string().describe("Optional Reply-To header.").default("")
|
|
1178
1728
|
},
|
|
1179
1729
|
handler: async (input, { client }) => {
|
|
1180
1730
|
const { workspace_id, ...__body } = input;
|
|
@@ -1188,13 +1738,13 @@ var generatedSmtpTools = [
|
|
|
1188
1738
|
];
|
|
1189
1739
|
|
|
1190
1740
|
// src/tools/generated/users.ts
|
|
1191
|
-
import { z as
|
|
1741
|
+
import { z as z21 } from "zod";
|
|
1192
1742
|
var deleteUser2 = defineTool({
|
|
1193
1743
|
name: "delete_user",
|
|
1194
1744
|
description: "Delete User",
|
|
1195
1745
|
inputShape: {
|
|
1196
|
-
workspace_id:
|
|
1197
|
-
user_id:
|
|
1746
|
+
workspace_id: z21.string().uuid(),
|
|
1747
|
+
user_id: z21.string()
|
|
1198
1748
|
},
|
|
1199
1749
|
handler: async (input, { client }) => {
|
|
1200
1750
|
const { workspace_id, user_id } = input;
|
|
@@ -1205,11 +1755,11 @@ var inviteUser2 = defineTool({
|
|
|
1205
1755
|
name: "invite_user",
|
|
1206
1756
|
description: "Invite User",
|
|
1207
1757
|
inputShape: {
|
|
1208
|
-
workspace_id:
|
|
1209
|
-
email:
|
|
1210
|
-
first_name:
|
|
1211
|
-
last_name:
|
|
1212
|
-
user_name:
|
|
1758
|
+
workspace_id: z21.string().uuid(),
|
|
1759
|
+
email: z21.string().max(320).regex(/^[^\s@]+@[^\s@]+\.[^\s@]+$/),
|
|
1760
|
+
first_name: z21.string().min(1).max(100),
|
|
1761
|
+
last_name: z21.string().min(1).max(100),
|
|
1762
|
+
user_name: z21.string().nullable().optional()
|
|
1213
1763
|
},
|
|
1214
1764
|
handler: async (input, { client }) => {
|
|
1215
1765
|
const { workspace_id, ...__body } = input;
|
|
@@ -1220,7 +1770,7 @@ var listUsers2 = defineTool({
|
|
|
1220
1770
|
name: "list_users",
|
|
1221
1771
|
description: "List Users",
|
|
1222
1772
|
inputShape: {
|
|
1223
|
-
workspace_id:
|
|
1773
|
+
workspace_id: z21.string().uuid()
|
|
1224
1774
|
},
|
|
1225
1775
|
handler: async (input, { client }) => {
|
|
1226
1776
|
const { workspace_id } = input;
|
|
@@ -1234,14 +1784,14 @@ var generatedUsersTools = [
|
|
|
1234
1784
|
];
|
|
1235
1785
|
|
|
1236
1786
|
// src/tools/generated/workspaces.ts
|
|
1237
|
-
import { z as
|
|
1787
|
+
import { z as z22 } from "zod";
|
|
1238
1788
|
var createWorkspace2 = defineTool({
|
|
1239
1789
|
name: "create_workspace",
|
|
1240
1790
|
description: "Create Workspace",
|
|
1241
1791
|
inputShape: {
|
|
1242
|
-
slug:
|
|
1243
|
-
display_name:
|
|
1244
|
-
plan:
|
|
1792
|
+
slug: z22.string().min(3).max(63).regex(/^[a-z][a-z0-9-]*[a-z0-9]$/).describe("URL-safe lowercase slug. Becomes part of auth.<slug>.prysmid.com."),
|
|
1793
|
+
display_name: z22.string().min(1).max(255),
|
|
1794
|
+
plan: z22.enum(["free", "pro", "enterprise"]).optional()
|
|
1245
1795
|
},
|
|
1246
1796
|
handler: async (input, { client }) => {
|
|
1247
1797
|
return client.request(`/v1/workspaces`, { method: "POST", body: input });
|
|
@@ -1251,7 +1801,7 @@ var deleteWorkspace = defineTool({
|
|
|
1251
1801
|
name: "delete_workspace",
|
|
1252
1802
|
description: "Delete Workspace",
|
|
1253
1803
|
inputShape: {
|
|
1254
|
-
workspace_id:
|
|
1804
|
+
workspace_id: z22.string().uuid()
|
|
1255
1805
|
},
|
|
1256
1806
|
handler: async (input, { client }) => {
|
|
1257
1807
|
const { workspace_id } = input;
|
|
@@ -1262,7 +1812,7 @@ var getWorkspace2 = defineTool({
|
|
|
1262
1812
|
name: "get_workspace",
|
|
1263
1813
|
description: "Get Workspace",
|
|
1264
1814
|
inputShape: {
|
|
1265
|
-
workspace_id:
|
|
1815
|
+
workspace_id: z22.string().uuid()
|
|
1266
1816
|
},
|
|
1267
1817
|
handler: async (input, { client }) => {
|
|
1268
1818
|
const { workspace_id } = input;
|
|
@@ -1281,7 +1831,7 @@ var retryProvisioning = defineTool({
|
|
|
1281
1831
|
name: "retry_provisioning",
|
|
1282
1832
|
description: "Retry Provisioning",
|
|
1283
1833
|
inputShape: {
|
|
1284
|
-
workspace_id:
|
|
1834
|
+
workspace_id: z22.string().uuid()
|
|
1285
1835
|
},
|
|
1286
1836
|
handler: async (input, { client }) => {
|
|
1287
1837
|
const { workspace_id } = input;
|
|
@@ -1292,8 +1842,8 @@ var updateWorkspace = defineTool({
|
|
|
1292
1842
|
name: "update_workspace",
|
|
1293
1843
|
description: "Update Workspace",
|
|
1294
1844
|
inputShape: {
|
|
1295
|
-
workspace_id:
|
|
1296
|
-
display_name:
|
|
1845
|
+
workspace_id: z22.string().uuid(),
|
|
1846
|
+
display_name: z22.string().min(1).max(255).nullable().optional()
|
|
1297
1847
|
},
|
|
1298
1848
|
handler: async (input, { client }) => {
|
|
1299
1849
|
const { workspace_id, ...__body } = input;
|
|
@@ -1349,14 +1899,20 @@ var GENERATED_ALIASES = {
|
|
|
1349
1899
|
};
|
|
1350
1900
|
function composeToolset() {
|
|
1351
1901
|
const handwrittenAndCurated = [
|
|
1352
|
-
...
|
|
1353
|
-
...
|
|
1354
|
-
...
|
|
1902
|
+
...tools14,
|
|
1903
|
+
...tools10,
|
|
1904
|
+
...tools9,
|
|
1355
1905
|
...tools6,
|
|
1906
|
+
...tools,
|
|
1356
1907
|
...tools7,
|
|
1357
|
-
...
|
|
1908
|
+
...tools8,
|
|
1909
|
+
...tools11,
|
|
1358
1910
|
...tools2,
|
|
1359
|
-
...
|
|
1911
|
+
...tools12,
|
|
1912
|
+
...tools4,
|
|
1913
|
+
...tools3,
|
|
1914
|
+
...tools13,
|
|
1915
|
+
...tools5
|
|
1360
1916
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1361
1917
|
];
|
|
1362
1918
|
const handwrittenNames = new Set(handwrittenAndCurated.map((t) => t.name));
|