portkey-admin-mcp 0.12.2 → 0.14.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/build/server.js CHANGED
@@ -25,6 +25,128 @@ import cors from "cors";
25
25
  import express from "express";
26
26
  import helmet from "helmet";
27
27
 
28
+ // src/schemas/contracts/access-policies.contract.ts
29
+ import { z } from "zod";
30
+ var AccessPolicySubjectSchema = z.object({
31
+ type: z.enum(["user", "group", "agent"]).describe("Subject kind; users and agents are matched independently"),
32
+ id: z.string().min(1).describe(
33
+ "Subject ID; ANY matches all users or all agents, but cannot identify a group"
34
+ )
35
+ }).refine((subject) => subject.type !== "group" || subject.id !== "ANY", {
36
+ message: "ANY is supported only for users and agents"
37
+ });
38
+ var selectionSchema = z.union([
39
+ z.literal("ALL"),
40
+ z.array(z.string().min(1)).min(1)
41
+ ]);
42
+ var AccessPolicyTargetSchema = z.discriminatedUnion("type", [
43
+ z.object({
44
+ type: z.literal("mcp_server").describe("Target an MCP server"),
45
+ server_id: z.string().min(1).describe(
46
+ "MCP server UUID or slug in the workspace; responses return the UUID"
47
+ ),
48
+ tools: selectionSchema.describe(
49
+ "ALL tools on the server, or a nonempty list of tool names"
50
+ )
51
+ }),
52
+ z.object({
53
+ type: z.literal("provider").describe("Target a provider"),
54
+ provider_id: z.string().min(1).describe(
55
+ "Provider UUID or slug in the workspace; responses return the UUID"
56
+ ),
57
+ models: selectionSchema.optional().describe(
58
+ "ALL models or a nonempty list of model slugs; omitted defaults to ALL in Portkey"
59
+ )
60
+ })
61
+ ]);
62
+ var policyFields = {
63
+ name: z.string().min(1).max(64).describe("Policy name, unique within the workspace (1-64 characters)"),
64
+ description: z.string().max(256).nullable().optional().describe("Policy description; null clears it"),
65
+ effect: z.enum(["allow", "deny"]).optional().describe(
66
+ "Allow or deny access; omitted create effect is inferred, while omitted update effect keeps its stored value"
67
+ ),
68
+ subjects: z.array(AccessPolicySubjectSchema).min(1).describe(
69
+ "Complete subject list; updates replace the existing subjects. A side without entries matches requests without that principal"
70
+ ),
71
+ targets: z.array(AccessPolicyTargetSchema).min(1).describe("Complete target list; updates replace the existing targets"),
72
+ enabled: z.boolean().optional().describe(
73
+ "Whether the policy is enabled; creates default to true, updates preserve the stored value when omitted"
74
+ )
75
+ };
76
+ function hasSpecificAllowSubject(policy) {
77
+ return policy.effect !== "allow" || policy.subjects.some((subject) => subject.id !== "ANY");
78
+ }
79
+ var CreateAccessPolicyRequestSchema = z.object({
80
+ workspace_id: z.string().optional().describe(
81
+ "Workspace UUID or slug; required with an organisation-level API key"
82
+ ),
83
+ ...policyFields
84
+ }).refine(
85
+ (policy) => {
86
+ const effect = policy.effect ?? (policy.subjects.some(
87
+ (subject) => subject.type === "user" && subject.id === "ANY"
88
+ ) && policy.subjects.some(
89
+ (subject) => subject.type === "agent" && subject.id === "ANY"
90
+ ) ? "deny" : "allow");
91
+ return hasSpecificAllowSubject({ ...policy, effect });
92
+ },
93
+ {
94
+ message: "An allow policy must name at least one specific user, group, or agent"
95
+ }
96
+ );
97
+ var UpdateAccessPolicyRequestSchema = z.object({
98
+ ...policyFields,
99
+ name: policyFields.name.optional(),
100
+ version: z.number().int().min(1).describe(
101
+ "Current version from get_access_policy; a stale version returns HTTP 409"
102
+ )
103
+ }).refine(hasSpecificAllowSubject, {
104
+ message: "An allow policy must name at least one specific user, group, or agent"
105
+ });
106
+ var responseFields = {
107
+ id: z.string().uuid().optional(),
108
+ name: z.string().optional(),
109
+ description: z.string().nullable().optional(),
110
+ enabled: z.boolean().optional(),
111
+ effect: z.enum(["allow", "deny"]).optional(),
112
+ version: z.number().int().optional(),
113
+ status: z.literal("active").optional(),
114
+ workspace_id: z.string().uuid().optional(),
115
+ organisation_id: z.string().uuid().optional(),
116
+ created_by: z.string().nullable().optional(),
117
+ created_at: z.iso.datetime().optional(),
118
+ last_updated_at: z.iso.datetime().optional(),
119
+ object: z.literal("access").optional()
120
+ };
121
+ var AccessPolicyListItemSchema = z.object({
122
+ ...responseFields,
123
+ allow_all_users: z.boolean().optional(),
124
+ allow_all_agents: z.boolean().optional(),
125
+ target_server_count: z.number().int().optional(),
126
+ target_provider_count: z.number().int().optional()
127
+ });
128
+ var AccessPolicySchema = z.object({
129
+ ...responseFields,
130
+ subjects: z.array(
131
+ z.object({
132
+ type: z.enum(["user", "group", "agent"]).optional(),
133
+ id: z.string().optional(),
134
+ name: z.string().nullable().optional(),
135
+ email: z.string().nullable().optional()
136
+ })
137
+ ).optional(),
138
+ targets: z.array(AccessPolicyTargetSchema).optional()
139
+ });
140
+ var ListAccessPoliciesResponseSchema = z.object({
141
+ object: z.literal("list").optional(),
142
+ total: z.number().int().optional(),
143
+ data: z.array(AccessPolicyListItemSchema).optional()
144
+ });
145
+ var CreateAccessPolicyResponseSchema = z.object({
146
+ id: z.string().uuid().optional(),
147
+ object: z.literal("access").optional()
148
+ });
149
+
28
150
  // src/services/base.service.ts
29
151
  import crypto from "node:crypto";
30
152
 
@@ -441,6 +563,48 @@ var BaseService = class {
441
563
  }
442
564
  };
443
565
 
566
+ // src/services/access-policies.service.ts
567
+ function normalizePolicy(value) {
568
+ const policy = { ...value };
569
+ for (const field of ["enabled", "allow_all_users", "allow_all_agents"]) {
570
+ if (policy[field] === 0 || policy[field] === 1)
571
+ policy[field] = policy[field] === 1;
572
+ }
573
+ if (policy.object === "acces") policy.object = "access";
574
+ return policy;
575
+ }
576
+ var AccessPoliciesService = class extends BaseService {
577
+ async createAccessPolicy(data) {
578
+ return CreateAccessPolicyResponseSchema.parse(
579
+ normalizePolicy(await this.post("/policies/access", data))
580
+ );
581
+ }
582
+ async listAccessPolicies(params) {
583
+ const response = await this.get(
584
+ "/policies/access",
585
+ params
586
+ );
587
+ return ListAccessPoliciesResponseSchema.parse({
588
+ ...response,
589
+ ...Array.isArray(response.data) ? { data: response.data.map(normalizePolicy) } : {}
590
+ });
591
+ }
592
+ async getAccessPolicy(id) {
593
+ return AccessPolicySchema.parse(
594
+ normalizePolicy(
595
+ await this.get(`/policies/access/${this.encodePathSegment(id)}`)
596
+ )
597
+ );
598
+ }
599
+ async updateAccessPolicy(id, data) {
600
+ return this.put(`/policies/access/${this.encodePathSegment(id)}`, data);
601
+ }
602
+ async deleteAccessPolicy(id) {
603
+ await this.delete(`/policies/access/${this.encodePathSegment(id)}`);
604
+ return {};
605
+ }
606
+ };
607
+
444
608
  // src/services/analytics.service.ts
445
609
  var AnalyticsService = class extends BaseService {
446
610
  /**
@@ -467,6 +631,7 @@ var AnalyticsService = class extends BaseService {
467
631
  api_key_ids: params.api_key_ids,
468
632
  metadata: params.metadata,
469
633
  ai_org_model: params.ai_org_model,
634
+ deployment_id: params.deployment_id,
470
635
  trace_id: params.trace_id,
471
636
  span_id: params.span_id,
472
637
  prompt_slug: params.prompt_slug
@@ -635,6 +800,24 @@ var AnalyticsService = class extends BaseService {
635
800
  this.buildAnalyticsParams(params)
636
801
  );
637
802
  }
803
+ async getAnalyticsGroupMcp(params) {
804
+ return this.get(
805
+ "/analytics/groups/mcp",
806
+ this.buildAnalyticsParams(params)
807
+ );
808
+ }
809
+ async getAnalyticsGroupA2a(params) {
810
+ return this.get(
811
+ "/analytics/groups/a2a",
812
+ this.buildAnalyticsParams(params)
813
+ );
814
+ }
815
+ async getAnalyticsGroupWorkspaces(params) {
816
+ return this.get(
817
+ "/analytics/groups/workspaces",
818
+ this.buildAnalyticsParams(params)
819
+ );
820
+ }
638
821
  };
639
822
 
640
823
  // src/services/audit.service.ts
@@ -761,6 +944,85 @@ var DeploymentsService = class extends BaseService {
761
944
  }
762
945
  };
763
946
 
947
+ // src/schemas/contracts/egress-allowlist.contract.ts
948
+ import { isIP } from "node:net";
949
+ import { z as z2 } from "zod";
950
+ var EgressAllowlistDomainSchema = z2.string().min(1).max(255).refine(
951
+ (value) => {
952
+ const host = value.trim();
953
+ if (isIP(host) || host.startsWith("[") && host.endsWith("]") && isIP(host.slice(1, -1)) === 6)
954
+ return true;
955
+ const hostname = host.replace(/^\*\./, "").replace(/\.$/, "");
956
+ return hostname.split(".").every(
957
+ (label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label)
958
+ );
959
+ },
960
+ {
961
+ message: "Use a hostname, IP literal, or *. wildcard without scheme, path, credentials, or port"
962
+ }
963
+ ).describe(
964
+ "Exact hostname, IPv4/IPv6 literal (optionally bracketed), or *. wildcard. No scheme, path, credentials, or port. Portkey trims/lowercases it and rejects cloud-metadata destinations"
965
+ );
966
+ var descriptionSchema = z2.string().max(500).nullable().optional().describe("Optional description (up to 500 characters); null clears it");
967
+ var CreateEgressAllowlistRequestSchema = z2.object({
968
+ domain: EgressAllowlistDomainSchema,
969
+ description: descriptionSchema
970
+ });
971
+ var UpdateEgressAllowlistRequestSchema = z2.object({
972
+ domain: EgressAllowlistDomainSchema.optional(),
973
+ description: descriptionSchema
974
+ }).refine(
975
+ (value) => value.domain !== void 0 || value.description !== void 0,
976
+ { message: "Provide domain or description to update" }
977
+ );
978
+ var EgressAllowlistEntrySchema = z2.object({
979
+ id: z2.string().uuid().optional(),
980
+ organisation_id: z2.string().uuid().optional(),
981
+ domain: z2.string().optional(),
982
+ description: z2.string().nullable().optional(),
983
+ status: z2.literal("active").optional(),
984
+ created_by: z2.string().uuid().nullable().optional(),
985
+ created_at: z2.iso.datetime().optional(),
986
+ last_updated_at: z2.iso.datetime().optional(),
987
+ object: z2.literal("egress-allowlist").optional()
988
+ });
989
+ var ListEgressAllowlistResponseSchema = z2.object({
990
+ object: z2.literal("list").optional(),
991
+ total: z2.number().int().optional(),
992
+ data: z2.array(EgressAllowlistEntrySchema).optional()
993
+ });
994
+ var CreateEgressAllowlistResponseSchema = z2.object({
995
+ id: z2.string().uuid().optional(),
996
+ domain: z2.string().optional(),
997
+ object: z2.literal("egress-allowlist").optional()
998
+ });
999
+
1000
+ // src/services/egress-allowlist.service.ts
1001
+ var EgressAllowlistService = class extends BaseService {
1002
+ async createEgressAllowlistEntry(data) {
1003
+ return CreateEgressAllowlistResponseSchema.parse(
1004
+ await this.postV2("/egress-allowlist", data)
1005
+ );
1006
+ }
1007
+ async listEgressAllowlist(params) {
1008
+ return ListEgressAllowlistResponseSchema.parse(
1009
+ await this.getV2("/egress-allowlist", params)
1010
+ );
1011
+ }
1012
+ async getEgressAllowlistEntry(id) {
1013
+ return EgressAllowlistEntrySchema.parse(
1014
+ await this.getV2(`/egress-allowlist/${this.encodePathSegment(id)}`)
1015
+ );
1016
+ }
1017
+ async updateEgressAllowlistEntry(id, data) {
1018
+ return this.putV2(`/egress-allowlist/${this.encodePathSegment(id)}`, data);
1019
+ }
1020
+ async deleteEgressAllowlistEntry(id) {
1021
+ await this.deleteV2(`/egress-allowlist/${this.encodePathSegment(id)}`);
1022
+ return {};
1023
+ }
1024
+ };
1025
+
764
1026
  // src/services/guardrails.service.ts
765
1027
  var GuardrailsService = class extends BaseService {
766
1028
  /** Get the organisation-wide input and output guardrail defaults. */
@@ -937,7 +1199,8 @@ var IntegrationsService = class extends BaseService {
937
1199
  current_page: params?.current_page,
938
1200
  page_size: params?.page_size,
939
1201
  workspace_id: params?.workspace_id,
940
- type: params?.type
1202
+ type: params?.type,
1203
+ tags: params?.tags === void 0 ? void 0 : JSON.stringify(params.tags)
941
1204
  });
942
1205
  }
943
1206
  // Create a new integration
@@ -966,7 +1229,12 @@ var IntegrationsService = class extends BaseService {
966
1229
  current_page: params?.current_page,
967
1230
  page_size: params?.page_size
968
1231
  });
969
- const data = response.data ?? response.models ?? [];
1232
+ const data = (response.data ?? response.models ?? []).map(
1233
+ ({ is_custom, ...model }) => is_custom === void 0 ? model : {
1234
+ ...model,
1235
+ is_custom: typeof is_custom === "number" ? is_custom === 1 : is_custom
1236
+ }
1237
+ );
970
1238
  return {
971
1239
  object: response.object ?? "list",
972
1240
  total: response.total ?? data.length,
@@ -2059,6 +2327,8 @@ function getSharedServiceCacheKey(apiKey) {
2059
2327
  }
2060
2328
  var sharedPortkeyServices = /* @__PURE__ */ new Map();
2061
2329
  var PortkeyService = class {
2330
+ accessPolicies;
2331
+ egressAllowlist;
2062
2332
  users;
2063
2333
  workspaces;
2064
2334
  configs;
@@ -2084,6 +2354,14 @@ var PortkeyService = class {
2084
2354
  const resolvedApiKey = resolvePortkeyApiKey(apiKey);
2085
2355
  const resolvedBaseUrl = process.env.PORTKEY_BASE_URL ?? "https://api.portkey.ai/v1";
2086
2356
  validateUrl(resolvedBaseUrl);
2357
+ this.accessPolicies = new AccessPoliciesService(
2358
+ resolvedApiKey,
2359
+ resolvedBaseUrl
2360
+ );
2361
+ this.egressAllowlist = new EgressAllowlistService(
2362
+ resolvedApiKey,
2363
+ resolvedBaseUrl
2364
+ );
2087
2365
  this.users = new UsersService(resolvedApiKey, resolvedBaseUrl);
2088
2366
  this.workspaces = new WorkspacesService(resolvedApiKey, resolvedBaseUrl);
2089
2367
  this.configs = new ConfigsService(resolvedApiKey, resolvedBaseUrl);
@@ -2129,7 +2407,7 @@ function getSharedPortkeyService(apiKey) {
2129
2407
  }
2130
2408
 
2131
2409
  // src/tools/index.ts
2132
- import { z as z24 } from "zod";
2410
+ import { z as z29 } from "zod";
2133
2411
 
2134
2412
  // src/lib/type-guards.ts
2135
2413
  function isRecord(value) {
@@ -2137,97 +2415,97 @@ function isRecord(value) {
2137
2415
  }
2138
2416
 
2139
2417
  // src/schemas/contracts/secret-references.contract.ts
2140
- import { z } from "zod";
2141
- var SecretManagerTypeSchema = z.enum([
2418
+ import { z as z3 } from "zod";
2419
+ var SecretManagerTypeSchema = z3.enum([
2142
2420
  "aws_sm",
2143
2421
  "azure_kv",
2144
2422
  "hashicorp_vault"
2145
2423
  ]);
2146
- var SecretReferenceListItemSchema = z.object({
2147
- id: z.string().uuid(),
2148
- name: z.string(),
2149
- slug: z.string(),
2424
+ var SecretReferenceListItemSchema = z3.object({
2425
+ id: z3.string().uuid(),
2426
+ name: z3.string(),
2427
+ slug: z3.string(),
2150
2428
  manager_type: SecretManagerTypeSchema,
2151
- status: z.literal("ACTIVE"),
2152
- created_at: z.iso.datetime(),
2153
- last_updated_at: z.iso.datetime(),
2154
- object: z.literal("secret-reference")
2429
+ status: z3.literal("ACTIVE"),
2430
+ created_at: z3.iso.datetime(),
2431
+ last_updated_at: z3.iso.datetime(),
2432
+ object: z3.literal("secret-reference")
2155
2433
  });
2156
- var ListSecretReferencesResponseSchema = z.object({
2157
- object: z.literal("list"),
2158
- total: z.number().int().nonnegative(),
2159
- data: z.array(SecretReferenceListItemSchema)
2434
+ var ListSecretReferencesResponseSchema = z3.object({
2435
+ object: z3.literal("list"),
2436
+ total: z3.number().int().nonnegative(),
2437
+ data: z3.array(SecretReferenceListItemSchema)
2160
2438
  });
2161
2439
  var SecretReferenceDetailSchema = SecretReferenceListItemSchema.extend(
2162
2440
  {
2163
- organisation_id: z.string().uuid(),
2164
- description: z.string().nullable(),
2165
- secret_path: z.string(),
2166
- secret_key: z.string().nullable(),
2167
- allow_all_workspaces: z.boolean(),
2168
- tags: z.record(z.string(), z.string()).nullable(),
2169
- created_by: z.string(),
2170
- auth_config: z.record(z.string(), z.unknown())
2441
+ organisation_id: z3.string().uuid(),
2442
+ description: z3.string().nullable(),
2443
+ secret_path: z3.string(),
2444
+ secret_key: z3.string().nullable(),
2445
+ allow_all_workspaces: z3.boolean(),
2446
+ tags: z3.record(z3.string(), z3.string()).nullable(),
2447
+ created_by: z3.string(),
2448
+ auth_config: z3.record(z3.string(), z3.unknown())
2171
2449
  }
2172
2450
  );
2173
- var CreateSecretReferenceResponseSchema = z.object({
2174
- id: z.string().uuid(),
2175
- slug: z.string(),
2176
- object: z.literal("secret-reference")
2451
+ var CreateSecretReferenceResponseSchema = z3.object({
2452
+ id: z3.string().uuid(),
2453
+ slug: z3.string(),
2454
+ object: z3.literal("secret-reference")
2177
2455
  });
2178
2456
 
2179
- // src/tools/analytics.tools.ts
2180
- import { z as z3 } from "zod";
2457
+ // src/tools/access-policies.tools.ts
2458
+ import { z as z5 } from "zod";
2181
2459
 
2182
2460
  // src/lib/schemas.ts
2183
- import { z as z2 } from "zod";
2184
- var PromptFunctionSchema = z2.object({
2185
- name: z2.string().describe("Function name"),
2186
- description: z2.string().optional().describe("Function description"),
2187
- parameters: z2.record(z2.string(), z2.unknown()).optional().describe("Function parameters schema")
2461
+ import { z as z4 } from "zod";
2462
+ var PromptFunctionSchema = z4.object({
2463
+ name: z4.string().describe("Function name"),
2464
+ description: z4.string().optional().describe("Function description"),
2465
+ parameters: z4.record(z4.string(), z4.unknown()).optional().describe("Function parameters schema")
2188
2466
  });
2189
- var PromptToolSchema = z2.object({
2190
- type: z2.literal("function").describe("Tool type"),
2467
+ var PromptToolSchema = z4.object({
2468
+ type: z4.literal("function").describe("Tool type"),
2191
2469
  function: PromptFunctionSchema.describe("Function definition")
2192
2470
  });
2193
- var HyperparametersSchema = z2.object({
2194
- max_tokens: z2.coerce.number().positive().optional().describe("Maximum tokens to generate"),
2195
- temperature: z2.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
2196
- top_p: z2.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
2197
- top_k: z2.coerce.number().positive().optional().describe("Top-k sampling"),
2198
- presence_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
2199
- frequency_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
2200
- stop: z2.array(z2.string()).optional().describe("Stop sequences")
2471
+ var HyperparametersSchema = z4.object({
2472
+ max_tokens: z4.coerce.number().positive().optional().describe("Maximum tokens to generate"),
2473
+ temperature: z4.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
2474
+ top_p: z4.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
2475
+ top_k: z4.coerce.number().positive().optional().describe("Top-k sampling"),
2476
+ presence_penalty: z4.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
2477
+ frequency_penalty: z4.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
2478
+ stop: z4.array(z4.string()).optional().describe("Stop sequences")
2201
2479
  });
2202
- var PromptAppIdentifierSchema = z2.string().min(1).describe(
2480
+ var PromptAppIdentifierSchema = z4.string().min(1).describe(
2203
2481
  "App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
2204
2482
  );
2205
- var PromptEnvironmentIdentifierSchema = z2.string().min(1).describe(
2483
+ var PromptEnvironmentIdentifierSchema = z4.string().min(1).describe(
2206
2484
  "Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
2207
2485
  );
2208
- var BillingMetadataSchema = z2.object({
2209
- client_id: z2.string().describe("Client ID for billing attribution (REQUIRED)"),
2486
+ var BillingMetadataSchema = z4.object({
2487
+ client_id: z4.string().describe("Client ID for billing attribution (REQUIRED)"),
2210
2488
  app: PromptAppIdentifierSchema,
2211
2489
  env: PromptEnvironmentIdentifierSchema,
2212
- project_id: z2.string().optional().describe("Project ID for granular billing"),
2213
- feature: z2.string().optional().describe("Feature name for tracking")
2490
+ project_id: z4.string().optional().describe("Project ID for granular billing"),
2491
+ feature: z4.string().optional().describe("Feature name for tracking")
2214
2492
  });
2215
- var ToolChoiceSchema = z2.object({
2216
- mode: z2.enum(["auto", "none", "function"]).describe(
2493
+ var ToolChoiceSchema = z4.object({
2494
+ mode: z4.enum(["auto", "none", "function"]).describe(
2217
2495
  "Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
2218
2496
  ),
2219
- function_name: z2.string().optional().describe("Required when mode is 'function'; ignored otherwise")
2497
+ function_name: z4.string().optional().describe("Required when mode is 'function'; ignored otherwise")
2220
2498
  }).superRefine((value, ctx) => {
2221
2499
  if (value.mode === "function" && !value.function_name) {
2222
2500
  ctx.addIssue({
2223
- code: z2.ZodIssueCode.custom,
2501
+ code: z4.ZodIssueCode.custom,
2224
2502
  path: ["function_name"],
2225
2503
  message: "function_name is required when mode is 'function'"
2226
2504
  });
2227
2505
  }
2228
2506
  if (value.mode !== "function" && value.function_name !== void 0) {
2229
2507
  ctx.addIssue({
2230
- code: z2.ZodIssueCode.custom,
2508
+ code: z4.ZodIssueCode.custom,
2231
2509
  path: ["function_name"],
2232
2510
  message: "function_name is only allowed when mode is 'function'"
2233
2511
  });
@@ -2247,9 +2525,9 @@ function toPromptToolChoice(toolChoice) {
2247
2525
  }
2248
2526
  return toolChoice.mode;
2249
2527
  }
2250
- var CurrentPageSchema = z2.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
2528
+ var CurrentPageSchema = z4.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
2251
2529
  function pageSizeSchema(max = 100) {
2252
- return z2.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
2530
+ return z4.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
2253
2531
  }
2254
2532
  var PageSizeSchema = pageSizeSchema();
2255
2533
 
@@ -2265,44 +2543,111 @@ function jsonResult(data) {
2265
2543
  };
2266
2544
  }
2267
2545
 
2546
+ // src/tools/access-policies.tools.ts
2547
+ var idSchema = z5.string().uuid().describe(
2548
+ "Access policy UUID from list_access_policies or create_access_policy"
2549
+ );
2550
+ var listSchema = {
2551
+ workspace_id: z5.string().optional().describe("Workspace UUID or slug"),
2552
+ effect: z5.enum(["allow", "deny"]).optional().describe("Filter by allow or deny effect"),
2553
+ enabled: z5.boolean().optional().describe("Filter enabled or disabled policies; false is preserved"),
2554
+ user_id: z5.string().max(36).optional().describe("Policies naming this user or matching all users"),
2555
+ agent_id: z5.string().max(36).optional().describe("Policies naming this agent or matching all agents"),
2556
+ server_id: z5.string().max(100).optional().describe("Policies targeting this MCP server ID"),
2557
+ search: z5.string().max(64).optional().describe("Search policy names"),
2558
+ created_by: z5.string().max(255).optional().describe("Filter by creator user ID"),
2559
+ start_time: z5.iso.datetime().optional().describe("Policies created at or after this ISO 8601 timestamp"),
2560
+ end_time: z5.iso.datetime().optional().describe("Policies created at or before this ISO 8601 timestamp"),
2561
+ current_page: CurrentPageSchema,
2562
+ page_size: z5.coerce.number().int().nonnegative().optional().describe("Items per page; the published API permits zero")
2563
+ };
2564
+ var lookupSchema = { id: idSchema };
2565
+ var updateSchema = UpdateAccessPolicyRequestSchema.safeExtend({
2566
+ id: idSchema
2567
+ });
2568
+ function registerAccessPoliciesTools(server, service) {
2569
+ server.registerTool(
2570
+ "create_access_policy",
2571
+ {
2572
+ description: "Create a workspace access policy for users, groups, and agents targeting MCP tools or provider models. Changes who may access those targets. An omitted effect becomes deny only when both user ANY and agent ANY are present; otherwise allow, which requires a specific subject. Returns the policy UUID; use get_access_policy before later updates.",
2573
+ inputSchema: CreateAccessPolicyRequestSchema
2574
+ },
2575
+ async (params) => jsonResult(await service.accessPolicies.createAccessPolicy(params))
2576
+ );
2577
+ server.registerTool(
2578
+ "list_access_policies",
2579
+ {
2580
+ description: "Inspect active workspace access policies, newest first, without changing permissions. Filter by subject, MCP server, effect, enabled state, or creation time. Returns total and the current page of policy summaries with versions; use get_access_policy for complete subjects and targets.",
2581
+ inputSchema: listSchema
2582
+ },
2583
+ async (params) => jsonResult(await service.accessPolicies.listAccessPolicies(params))
2584
+ );
2585
+ server.registerTool(
2586
+ "get_access_policy",
2587
+ {
2588
+ description: "Read one access policy's complete subjects, targets, effect, and current version. Use this before update_access_policy so replacement lists and optimistic concurrency use the latest state. Returns policy details; a missing policy returns HTTP 404.",
2589
+ inputSchema: lookupSchema
2590
+ },
2591
+ async ({ id }) => jsonResult(await service.accessPolicies.getAccessPolicy(id))
2592
+ );
2593
+ server.registerTool(
2594
+ "update_access_policy",
2595
+ {
2596
+ description: "Replace an access policy's complete subjects and targets, changing access permissions. Requires the current version from get_access_policy; a stale version returns HTTP 409 without retrying. Omitted name, description, effect, and enabled retain their stored values. Returns Portkey's acknowledgement; reread before retrying a conflict.",
2597
+ inputSchema: updateSchema,
2598
+ annotations: { destructiveHint: true }
2599
+ },
2600
+ async ({ id, ...params }) => jsonResult(await service.accessPolicies.updateAccessPolicy(id, params))
2601
+ );
2602
+ server.registerTool(
2603
+ "delete_access_policy",
2604
+ {
2605
+ description: "Delete an access policy by UUID, removing its allow or deny rule and changing access permissions. This cannot be undone by this tool. Inspect get_access_policy first; returns Portkey's acknowledgement, or HTTP 404 when the policy is missing.",
2606
+ inputSchema: lookupSchema
2607
+ },
2608
+ async ({ id }) => jsonResult(await service.accessPolicies.deleteAccessPolicy(id))
2609
+ );
2610
+ }
2611
+
2268
2612
  // src/tools/analytics.tools.ts
2613
+ import { z as z6 } from "zod";
2269
2614
  var baseAnalyticsSchema = {
2270
- time_of_generation_min: z3.string().describe(
2615
+ time_of_generation_min: z6.string().describe(
2271
2616
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
2272
2617
  ),
2273
- time_of_generation_max: z3.string().describe(
2618
+ time_of_generation_max: z6.string().describe(
2274
2619
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
2275
2620
  ),
2276
- total_units_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
2277
- total_units_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
2278
- cost_min: z3.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
2279
- cost_max: z3.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
2280
- prompt_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
2281
- prompt_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
2282
- completion_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
2283
- completion_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
2284
- status_code: z3.string().optional().describe(
2621
+ total_units_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
2622
+ total_units_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
2623
+ cost_min: z6.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
2624
+ cost_max: z6.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
2625
+ prompt_token_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
2626
+ prompt_token_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
2627
+ completion_token_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
2628
+ completion_token_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
2629
+ status_code: z6.string().optional().describe(
2285
2630
  "Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
2286
2631
  ),
2287
- weighted_feedback_min: z3.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
2288
- weighted_feedback_max: z3.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
2289
- virtual_keys: z3.string().optional().describe(
2632
+ weighted_feedback_min: z6.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
2633
+ weighted_feedback_max: z6.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
2634
+ virtual_keys: z6.string().optional().describe(
2290
2635
  "Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
2291
2636
  ),
2292
- configs: z3.string().optional().describe(
2637
+ configs: z6.string().optional().describe(
2293
2638
  "Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
2294
2639
  ),
2295
- status_codes: z3.array(z3.string()).optional().describe(
2640
+ status_codes: z6.array(z6.string()).optional().describe(
2296
2641
  "Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
2297
2642
  ),
2298
- virtual_key_slugs: z3.array(z3.string()).optional().describe(
2643
+ virtual_key_slugs: z6.array(z6.string()).optional().describe(
2299
2644
  "Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
2300
2645
  ),
2301
- config_slugs: z3.array(z3.string()).optional().describe(
2646
+ config_slugs: z6.array(z6.string()).optional().describe(
2302
2647
  "Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
2303
2648
  ),
2304
- workspace_slug: z3.string().optional().describe("Filter by specific workspace"),
2305
- api_key_ids: z3.preprocess((value) => {
2649
+ workspace_slug: z6.string().optional().describe("Filter by specific workspace"),
2650
+ api_key_ids: z6.preprocess((value) => {
2306
2651
  if (value == null) {
2307
2652
  return value;
2308
2653
  }
@@ -2310,34 +2655,40 @@ var baseAnalyticsSchema = {
2310
2655
  return value.map((item) => String(item)).join(",");
2311
2656
  }
2312
2657
  return value;
2313
- }, z3.string().optional()).describe(
2658
+ }, z6.string().optional()).describe(
2314
2659
  "Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
2315
2660
  ),
2316
- metadata: z3.string().optional().describe(
2661
+ metadata: z6.string().optional().describe(
2317
2662
  `Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
2318
2663
  ),
2319
- ai_org_model: z3.string().optional().describe(
2664
+ ai_org_model: z6.string().optional().describe(
2320
2665
  "Legacy Portkey query param for provider/model pairs. Format: 'provider__model' with double underscore, e.g. 'openai__gpt-4' or 'anthropic__claude-3-opus'. Comma-separated string; prefer provider_models for structured inputs."
2321
2666
  ),
2322
- provider_models: z3.array(z3.string()).optional().describe(
2667
+ provider_models: z6.array(z6.string()).optional().describe(
2323
2668
  "Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
2324
2669
  ),
2325
- trace_id: z3.string().optional().describe(
2670
+ deployment_id: z6.string().optional().describe(
2671
+ "Comma-separated list of deployment IDs (UUIDs) to filter by. Prefer deployment_ids for structured inputs."
2672
+ ),
2673
+ deployment_ids: z6.array(z6.string()).optional().describe(
2674
+ "Structured alias for deployment_id. Use an array of deployment UUIDs; normalized to the comma-separated Portkey query param."
2675
+ ),
2676
+ trace_id: z6.string().optional().describe(
2326
2677
  "Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
2327
2678
  ),
2328
- trace_ids: z3.array(z3.string()).optional().describe(
2679
+ trace_ids: z6.array(z6.string()).optional().describe(
2329
2680
  "Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
2330
2681
  ),
2331
- span_id: z3.string().optional().describe(
2682
+ span_id: z6.string().optional().describe(
2332
2683
  "Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
2333
2684
  ),
2334
- span_ids: z3.array(z3.string()).optional().describe(
2685
+ span_ids: z6.array(z6.string()).optional().describe(
2335
2686
  "Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
2336
2687
  ),
2337
- metadata_filter: z3.record(z3.string(), z3.unknown()).optional().describe(
2688
+ metadata_filter: z6.record(z6.string(), z6.unknown()).optional().describe(
2338
2689
  "Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
2339
2690
  ),
2340
- prompt_slug: z3.string().optional().describe("Filter by prompt slug")
2691
+ prompt_slug: z6.string().optional().describe("Filter by prompt slug")
2341
2692
  };
2342
2693
  var paginatedAnalyticsSchema = {
2343
2694
  ...baseAnalyticsSchema,
@@ -2346,9 +2697,9 @@ var paginatedAnalyticsSchema = {
2346
2697
  };
2347
2698
  var cacheSummarySchema = {
2348
2699
  ...baseAnalyticsSchema,
2349
- workspace_slug: z3.string().min(1).describe("Workspace slug to analyze")
2700
+ workspace_slug: z6.string().min(1).describe("Workspace slug to analyze")
2350
2701
  };
2351
- var providerMetricSchema = z3.enum([
2702
+ var providerMetricSchema = z6.enum([
2352
2703
  "requests",
2353
2704
  "cost",
2354
2705
  "total_tokens",
@@ -2368,14 +2719,14 @@ var providerGroupAnalyticsSchema = {
2368
2719
  ...cacheSummarySchema,
2369
2720
  current_page: CurrentPageSchema.describe("Zero-based result page"),
2370
2721
  page_size: PageSizeSchema.describe("Number of provider groups per page"),
2371
- order_by: z3.string().optional().describe("Metric or field used to order groups"),
2372
- order_by_type: z3.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
2373
- columns: z3.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
2374
- include_total: z3.boolean().optional().describe("Request the total provider-group count")
2722
+ order_by: z6.string().optional().describe("Metric or field used to order groups"),
2723
+ order_by_type: z6.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
2724
+ columns: z6.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
2725
+ include_total: z6.boolean().optional().describe("Request the total provider-group count")
2375
2726
  };
2376
2727
  var analyticsGroupMetadataSchema = {
2377
2728
  ...paginatedAnalyticsSchema,
2378
- metadata_key: z3.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
2729
+ metadata_key: z6.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
2379
2730
  };
2380
2731
  function formatGraphAnalytics(summary, dataPoints) {
2381
2732
  return {
@@ -2469,6 +2820,7 @@ function normalizeAnalyticsParams(params) {
2469
2820
  trace_ids,
2470
2821
  span_ids,
2471
2822
  provider_models,
2823
+ deployment_ids,
2472
2824
  metadata_filter,
2473
2825
  ...legacyParams
2474
2826
  } = params;
@@ -2499,6 +2851,10 @@ function normalizeAnalyticsParams(params) {
2499
2851
  if (providerModels !== void 0) {
2500
2852
  normalizedParams.ai_org_model = providerModels;
2501
2853
  }
2854
+ const deploymentId = normalizeCommaSeparatedParam(deployment_ids) ?? normalizeCommaSeparatedParam(legacyParams.deployment_id);
2855
+ if (deploymentId !== void 0) {
2856
+ normalizedParams.deployment_id = deploymentId;
2857
+ }
2502
2858
  const traceId = normalizeCommaSeparatedParam(trace_ids) ?? normalizeCommaSeparatedParam(legacyParams.trace_id);
2503
2859
  if (traceId !== void 0) {
2504
2860
  normalizedParams.trace_id = traceId;
@@ -2808,32 +3164,68 @@ function registerAnalyticsTools(server, service) {
2808
3164
  return jsonResult(formatGroupedAnalytics(analytics, "metadata_groups"));
2809
3165
  }
2810
3166
  );
3167
+ server.tool(
3168
+ "get_analytics_group_mcp",
3169
+ "Get a paginated per-MCP-server breakdown with total_groups, group_count, and an mcp_servers array containing each server name and its request count. Use this to see which MCP servers receive the most traffic; use get_analytics_group_a2a for A2A agents or get_analytics_group_users and get_analytics_group_models for other breakdowns.",
3170
+ paginatedAnalyticsSchema,
3171
+ async (params) => {
3172
+ const analytics = await service.analytics.getAnalyticsGroupMcp(
3173
+ normalizeAnalyticsParams(params)
3174
+ );
3175
+ return jsonResult(formatGroupedAnalytics(analytics, "mcp_servers"));
3176
+ }
3177
+ );
3178
+ server.tool(
3179
+ "get_analytics_group_a2a",
3180
+ "Get a paginated per-agent breakdown with total_groups, group_count, and an agents array containing each A2A (agent-to-agent) agent name and its request count. Use this to see which agents receive the most traffic; use get_analytics_group_mcp for MCP servers instead.",
3181
+ paginatedAnalyticsSchema,
3182
+ async (params) => {
3183
+ const analytics = await service.analytics.getAnalyticsGroupA2a(
3184
+ normalizeAnalyticsParams(params)
3185
+ );
3186
+ return jsonResult(formatGroupedAnalytics(analytics, "agents"));
3187
+ }
3188
+ );
3189
+ server.tool(
3190
+ "get_analytics_group_workspaces",
3191
+ "Get a paginated per-workspace breakdown with total_groups, group_count, is_quota_exceeded when reported, and a workspaces array containing each workspace_slug with request count and cost. Use this for org-wide chargeback or comparing workspaces; pass workspace_slug to other analytics tools to drill into one workspace.",
3192
+ paginatedAnalyticsSchema,
3193
+ async (params) => {
3194
+ const analytics = await service.analytics.getAnalyticsGroupWorkspaces(
3195
+ normalizeAnalyticsParams(params)
3196
+ );
3197
+ return jsonResult({
3198
+ ...formatGroupedAnalytics(analytics, "workspaces"),
3199
+ is_quota_exceeded: analytics.is_quota_exceeded
3200
+ });
3201
+ }
3202
+ );
2811
3203
  }
2812
3204
 
2813
3205
  // src/tools/audit.tools.ts
2814
- import { z as z4 } from "zod";
3206
+ import { z as z7 } from "zod";
2815
3207
  var AUDIT_TOOL_SCHEMAS = {
2816
3208
  listAuditLogs: {
2817
- start_time: z4.string().describe(
3209
+ start_time: z7.string().describe(
2818
3210
  "Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
2819
3211
  ),
2820
- end_time: z4.string().describe(
3212
+ end_time: z7.string().describe(
2821
3213
  "End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
2822
3214
  ),
2823
- organisation_id: z4.string().describe("Organisation ID whose audit logs to list"),
2824
- workspace_id: z4.string().optional().describe("Filter audit logs by workspace ID"),
2825
- user_id: z4.string().optional().describe(
3215
+ organisation_id: z7.string().describe("Organisation ID whose audit logs to list"),
3216
+ workspace_id: z7.string().optional().describe("Filter audit logs by workspace ID"),
3217
+ user_id: z7.string().optional().describe(
2826
3218
  "Filter by the ID of the user or API key that made the request"
2827
3219
  ),
2828
- user_type: z4.enum(["user", "api_key"]).optional().describe("Filter by whether the request came from a user or an API key"),
2829
- request_id: z4.string().optional().describe("Filter by request ID"),
2830
- method: z4.enum(["POST", "PUT", "DELETE"]).optional().describe("Filter by HTTP method of the audited request"),
2831
- uri: z4.string().optional().describe("Filter by request URI path"),
2832
- client_ip: z4.string().optional().describe("Filter by client IP address"),
2833
- country: z4.string().optional().describe("Filter by country derived from the client IP"),
2834
- response_status_code: z4.coerce.number().int().optional().describe("Filter by HTTP response status code (e.g., 200, 403)"),
2835
- action: z4.string().optional().describe("Filter by action type (e.g., 'create', 'update', 'delete')"),
2836
- resource_type: z4.string().optional().describe(
3220
+ user_type: z7.enum(["user", "api_key"]).optional().describe("Filter by whether the request came from a user or an API key"),
3221
+ request_id: z7.string().optional().describe("Filter by request ID"),
3222
+ method: z7.enum(["POST", "PUT", "DELETE"]).optional().describe("Filter by HTTP method of the audited request"),
3223
+ uri: z7.string().optional().describe("Filter by request URI path"),
3224
+ client_ip: z7.string().optional().describe("Filter by client IP address"),
3225
+ country: z7.string().optional().describe("Filter by country derived from the client IP"),
3226
+ response_status_code: z7.coerce.number().int().optional().describe("Filter by HTTP response status code (e.g., 200, 403)"),
3227
+ action: z7.string().optional().describe("Filter by action type (e.g., 'create', 'update', 'delete')"),
3228
+ resource_type: z7.string().optional().describe(
2837
3229
  "Filter by resource type (e.g., 'workspace', 'config', 'virtual_key')"
2838
3230
  ),
2839
3231
  current_page: CurrentPageSchema,
@@ -2890,36 +3282,39 @@ function registerAuditTools(server, service) {
2890
3282
  }
2891
3283
 
2892
3284
  // src/tools/collections.tools.ts
2893
- import { z as z5 } from "zod";
3285
+ import { z as z8 } from "zod";
2894
3286
  var COLLECTIONS_TOOL_SCHEMAS = {
2895
3287
  listCollections: {
2896
- workspace_id: z5.string().optional().describe("Filter by workspace ID"),
2897
- search: z5.string().optional().describe("Search collections by name"),
3288
+ workspace_id: z8.string().optional().describe("Filter by workspace ID"),
3289
+ search: z8.string().optional().describe("Search collections by name"),
2898
3290
  current_page: CurrentPageSchema,
2899
3291
  page_size: PageSizeSchema
2900
3292
  },
2901
3293
  createCollection: {
2902
- name: z5.string().describe(
3294
+ name: z8.string().describe(
2903
3295
  "Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
2904
3296
  ),
2905
- workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
3297
+ workspace_id: z8.string().optional().describe("Workspace ID to create collection in"),
3298
+ parent_collection_id: z8.string().optional().describe(
3299
+ "ID or slug of the parent collection to nest under; omit for a top-level collection"
3300
+ )
2906
3301
  },
2907
3302
  getCollection: {
2908
- collection_id: z5.string().describe("Collection ID or slug to retrieve")
3303
+ collection_id: z8.string().describe("Collection ID or slug to retrieve")
2909
3304
  },
2910
3305
  updateCollection: {
2911
- collection_id: z5.string().describe("Collection ID to update"),
2912
- name: z5.string().optional().describe("New name for the collection"),
2913
- description: z5.string().optional().describe("New description for the collection")
3306
+ collection_id: z8.string().describe("Collection ID to update"),
3307
+ name: z8.string().optional().describe("New name for the collection"),
3308
+ description: z8.string().optional().describe("New description for the collection")
2914
3309
  },
2915
3310
  deleteCollection: {
2916
- collection_id: z5.string().describe("Collection ID to delete")
3311
+ collection_id: z8.string().describe("Collection ID to delete")
2917
3312
  }
2918
3313
  };
2919
3314
  function registerCollectionsTools(server, service) {
2920
3315
  server.tool(
2921
3316
  "list_collections",
2922
- "List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
3317
+ "List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, parent collection ids, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
2923
3318
  COLLECTIONS_TOOL_SCHEMAS.listCollections,
2924
3319
  async (params) => {
2925
3320
  const collections = await service.collections.listCollections(params);
@@ -2930,6 +3325,7 @@ function registerCollectionsTools(server, service) {
2930
3325
  name: collection.name,
2931
3326
  slug: collection.slug,
2932
3327
  workspace_id: collection.workspace_id,
3328
+ parent_collection_id: collection.parent_collection_id,
2933
3329
  created_at: collection.created_at,
2934
3330
  last_updated_at: collection.last_updated_at
2935
3331
  }))
@@ -2938,7 +3334,7 @@ function registerCollectionsTools(server, service) {
2938
3334
  );
2939
3335
  server.tool(
2940
3336
  "create_collection",
2941
- "Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; returns the collection id and slug, and does not move any prompts.",
3337
+ "Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; set parent_collection_id to nest it under an existing collection. Returns the collection id and slug, and does not move any prompts.",
2942
3338
  COLLECTIONS_TOOL_SCHEMAS.createCollection,
2943
3339
  async (params) => {
2944
3340
  const result = await service.collections.createCollection(params);
@@ -2951,7 +3347,7 @@ function registerCollectionsTools(server, service) {
2951
3347
  );
2952
3348
  server.tool(
2953
3349
  "get_collection",
2954
- "Fetch one collection by id or slug and return its name, slug, workspace, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
3350
+ "Fetch one collection by id or slug and return its name, slug, workspace, parent collection id, child collections with prompt counts, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
2955
3351
  COLLECTIONS_TOOL_SCHEMAS.getCollection,
2956
3352
  async (params) => {
2957
3353
  const collection = await service.collections.getCollection(
@@ -2962,6 +3358,8 @@ function registerCollectionsTools(server, service) {
2962
3358
  name: collection.name,
2963
3359
  slug: collection.slug,
2964
3360
  workspace_id: collection.workspace_id,
3361
+ parent_collection_id: collection.parent_collection_id,
3362
+ child_collections: collection.child_collections,
2965
3363
  created_at: collection.created_at,
2966
3364
  last_updated_at: collection.last_updated_at
2967
3365
  });
@@ -2999,10 +3397,10 @@ function registerCollectionsTools(server, service) {
2999
3397
  }
3000
3398
 
3001
3399
  // src/tools/configs.tools.ts
3002
- import { z as z6 } from "zod";
3003
- var configTargetSchema = z6.object({
3004
- provider: z6.string().optional().describe("Provider slug to route requests to"),
3005
- virtual_key: z6.string().optional().describe("Virtual key slug to use for this routing target")
3400
+ import { z as z9 } from "zod";
3401
+ var configTargetSchema = z9.object({
3402
+ provider: z9.string().optional().describe("Provider slug to route requests to"),
3403
+ virtual_key: z9.string().optional().describe("Virtual key slug to use for this routing target")
3006
3404
  }).refine((target) => target.provider || target.virtual_key, {
3007
3405
  message: "Each target must have at least provider or virtual_key"
3008
3406
  });
@@ -3012,45 +3410,45 @@ var CONFIGS_TOOL_SCHEMAS = {
3012
3410
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
3013
3411
  },
3014
3412
  getConfig: {
3015
- slug: z6.string().describe(
3413
+ slug: z9.string().describe(
3016
3414
  "The unique identifier (slug) of the configuration to retrieve. This can be found in the configuration's URL or from the list_configs tool response"
3017
3415
  )
3018
3416
  },
3019
3417
  createConfig: {
3020
- name: z6.string().describe("Name for the new configuration"),
3021
- workspace_id: z6.string().optional().describe("Workspace ID to create config in"),
3022
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3023
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3024
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3025
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
3026
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
3027
- targets: z6.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
3418
+ name: z9.string().describe("Name for the new configuration"),
3419
+ workspace_id: z9.string().optional().describe("Workspace ID to create config in"),
3420
+ cache_mode: z9.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3421
+ cache_max_age: z9.coerce.number().positive().optional().describe("Cache max age in seconds"),
3422
+ retry_attempts: z9.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3423
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
3424
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
3425
+ targets: z9.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
3028
3426
  },
3029
3427
  updateConfig: {
3030
- slug: z6.string().describe("Configuration slug to update"),
3031
- name: z6.string().optional().describe("New name for the configuration"),
3032
- status: z6.enum(["active", "inactive"]).optional().describe("Configuration status"),
3033
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3034
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3035
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3036
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on"),
3037
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
3038
- targets: z6.array(configTargetSchema).optional().describe("Array of target providers")
3428
+ slug: z9.string().describe("Configuration slug to update"),
3429
+ name: z9.string().optional().describe("New name for the configuration"),
3430
+ status: z9.enum(["active", "inactive"]).optional().describe("Configuration status"),
3431
+ cache_mode: z9.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3432
+ cache_max_age: z9.coerce.number().positive().optional().describe("Cache max age in seconds"),
3433
+ retry_attempts: z9.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3434
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional().describe("HTTP status codes to retry on"),
3435
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
3436
+ targets: z9.array(configTargetSchema).optional().describe("Array of target providers")
3039
3437
  },
3040
3438
  deleteConfig: {
3041
- slug: z6.string().describe("Configuration slug to delete")
3439
+ slug: z9.string().describe("Configuration slug to delete")
3042
3440
  },
3043
3441
  listConfigVersions: {
3044
- slug: z6.string().describe("Configuration slug to list versions for")
3442
+ slug: z9.string().describe("Configuration slug to list versions for")
3045
3443
  }
3046
3444
  };
3047
- var configPayloadSchema = z6.object({
3048
- cache_mode: z6.enum(["simple", "semantic"]).optional(),
3049
- cache_max_age: z6.coerce.number().positive().optional(),
3050
- retry_attempts: z6.coerce.number().positive().max(5).optional(),
3051
- retry_on_status_codes: z6.array(z6.coerce.number()).optional(),
3052
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional(),
3053
- targets: z6.array(configTargetSchema).optional()
3445
+ var configPayloadSchema = z9.object({
3446
+ cache_mode: z9.enum(["simple", "semantic"]).optional(),
3447
+ cache_max_age: z9.coerce.number().positive().optional(),
3448
+ retry_attempts: z9.coerce.number().positive().max(5).optional(),
3449
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional(),
3450
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional(),
3451
+ targets: z9.array(configTargetSchema).optional()
3054
3452
  });
3055
3453
  function buildConfigPayload(params) {
3056
3454
  const cache = params.cache_mode !== void 0 || params.cache_max_age !== void 0 ? {
@@ -3071,10 +3469,10 @@ function buildConfigPayload(params) {
3071
3469
  function hasConfigSettings(config) {
3072
3470
  return config.cache !== void 0 || config.retry !== void 0 || config.strategy !== void 0 || config.targets !== void 0;
3073
3471
  }
3074
- var createConfigSchema = z6.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3472
+ var createConfigSchema = z9.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3075
3473
  if (!hasConfigSettings(buildConfigPayload(value))) {
3076
3474
  ctx.addIssue({
3077
- code: z6.ZodIssueCode.custom,
3475
+ code: z9.ZodIssueCode.custom,
3078
3476
  message: "At least one config setting (cache_mode, retry_attempts, strategy_mode, or targets) must be provided"
3079
3477
  });
3080
3478
  }
@@ -3219,66 +3617,73 @@ function registerConfigsTools(server, service) {
3219
3617
  }
3220
3618
 
3221
3619
  // src/tools/deployments.tools.ts
3222
- import { z as z7 } from "zod";
3223
- var binaryFlagSchema = z7.union([z7.literal(0), z7.literal(1)]);
3224
- var deploymentTypeSchema = z7.enum(["production", "non_production"]);
3225
- var deploymentStatusSchema = z7.enum(["active", "archived"]);
3226
- var deploymentTagsSchema = z7.record(
3227
- z7.string().regex(
3620
+ import { z as z11 } from "zod";
3621
+
3622
+ // src/tools/tags.schemas.ts
3623
+ import { z as z10 } from "zod";
3624
+ var resourceTagsSchema = z10.record(
3625
+ z10.string().regex(
3228
3626
  /^[a-zA-Z0-9_-]+$/,
3229
3627
  "Tag keys may contain only letters, numbers, underscores, and hyphens"
3230
3628
  ),
3231
- z7.string()
3629
+ z10.string()
3232
3630
  );
3631
+ var integrationTagsSchema = z10.record(z10.string(), z10.string());
3632
+
3633
+ // src/tools/deployments.tools.ts
3634
+ var binaryFlagSchema = z11.union([z11.literal(0), z11.literal(1)]);
3635
+ var deploymentTypeSchema = z11.enum(["production", "non_production"]);
3636
+ var deploymentStatusSchema = z11.enum(["active", "archived"]);
3637
+ var deploymentTagsSchema = resourceTagsSchema;
3233
3638
  var authSettingsSchema = {
3234
- gateway_base_url: z7.url().optional().describe("Self-hosted Gateway base URL"),
3235
- mcp_gateway_base_url: z7.url().optional().describe("MCP Gateway base URL"),
3639
+ gateway_base_url: z11.url().optional().describe("Self-hosted Gateway base URL"),
3640
+ mcp_gateway_base_url: z11.url().optional().describe("MCP Gateway base URL"),
3236
3641
  is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
3237
3642
  is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
3238
- workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
3239
- jwt_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values allowed to use the deployment"),
3240
- jwt_sub_workspace_mapping: z7.record(z7.string(), z7.string()).optional().describe("JWT subject to workspace-slug mapping")
3643
+ workspaces_allowed: z11.array(z11.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
3644
+ jwt_subs_allowed: z11.array(z11.string()).optional().describe("JWT subject values allowed to use the deployment"),
3645
+ jwt_sub_workspace_mapping: z11.record(z11.string(), z11.string()).optional().describe("JWT subject to workspace-slug mapping")
3241
3646
  };
3242
3647
  var DEPLOYMENTS_TOOL_SCHEMAS = {
3243
3648
  listDeployments: {
3244
- organisation_id: z7.string().optional().describe("Filter by organisation UUID"),
3649
+ organisation_id: z11.string().optional().describe("Filter by organisation UUID"),
3245
3650
  status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
3246
3651
  type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
3247
- workspace_slug: z7.array(z7.string()).optional().describe("Filter by one or more workspace slugs"),
3248
- search: z7.string().optional().describe("Search deployment names"),
3652
+ workspace_slug: z11.array(z11.string()).optional().describe("Filter by one or more workspace slugs"),
3653
+ search: z11.string().optional().describe("Search deployment names"),
3249
3654
  tags: deploymentTagsSchema.optional().describe("Match deployments with all supplied tags")
3250
3655
  },
3251
3656
  registerDeployment: {
3252
- name: z7.string().min(1).describe("Deployment display name"),
3253
- organisation_id: z7.string().optional().describe("Owning organisation UUID"),
3254
- slug: z7.string().min(1).max(50).optional().describe("Optional deployment slug"),
3657
+ name: z11.string().min(1).describe("Deployment display name"),
3658
+ organisation_id: z11.string().optional().describe("Owning organisation UUID"),
3659
+ slug: z11.string().min(1).max(50).optional().describe("Optional deployment slug"),
3255
3660
  type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
3256
- deployment_config: z7.record(z7.string(), z7.unknown()).optional().describe("Gateway deployment configuration"),
3257
- is_default: z7.boolean().optional().describe("Make this the default deployment"),
3661
+ deployment_config: z11.record(z11.string(), z11.unknown()).optional().describe("Gateway deployment configuration"),
3662
+ is_default: z11.boolean().optional().describe("Make this the default deployment"),
3258
3663
  tags: deploymentTagsSchema.nullable().optional().describe("Deployment tags, or null to create without tags"),
3259
3664
  ...authSettingsSchema
3260
3665
  },
3261
3666
  getDeployment: {
3262
- id: z7.string().min(1).describe("Deployment UUID or self"),
3263
- organisation_id: z7.string().optional().describe("Organisation UUID scope")
3667
+ id: z11.string().min(1).describe("Deployment UUID or self"),
3668
+ organisation_id: z11.string().optional().describe("Organisation UUID scope")
3264
3669
  },
3265
3670
  updateDeployment: {
3266
- id: z7.string().min(1).describe("Deployment UUID"),
3267
- name: z7.string().optional().describe("Replacement display name"),
3671
+ id: z11.string().min(1).describe("Deployment UUID"),
3672
+ name: z11.string().optional().describe("Replacement display name"),
3268
3673
  type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
3269
3674
  status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
3270
- deployment_config: z7.record(z7.string(), z7.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
3271
- is_default: z7.boolean().optional().describe("Whether this is the default deployment"),
3272
- rotate_auth: z7.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
3273
- override_existing: z7.boolean().optional().describe("Allow replacement of existing deployment settings"),
3675
+ deployment_config: z11.record(z11.string(), z11.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
3676
+ is_default: z11.boolean().optional().describe("Whether this is the default deployment"),
3677
+ rotate_auth: z11.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
3678
+ override_existing: z11.boolean().optional().describe("Allow replacement of existing deployment settings"),
3274
3679
  tags: deploymentTagsSchema.nullable().optional().describe("Replacement deployment tags, or null to clear all tags"),
3275
3680
  ...authSettingsSchema,
3276
- allow_all_workspaces: z7.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
3277
- remove_workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs to remove from the allowlist"),
3278
- remove_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values to remove from the allowlist")
3681
+ allow_all_workspaces: z11.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
3682
+ remove_workspaces_allowed: z11.array(z11.string()).optional().describe("Workspace slugs to remove from the allowlist"),
3683
+ remove_subs_allowed: z11.array(z11.string()).optional().describe("JWT subject values to remove from the allowlist")
3279
3684
  },
3280
3685
  archiveDeployment: {
3281
- id: z7.string().min(1).describe("Deployment UUID to archive")
3686
+ id: z11.string().min(1).describe("Deployment UUID to archive")
3282
3687
  }
3283
3688
  };
3284
3689
  function compact(value) {
@@ -3387,101 +3792,165 @@ function registerDeploymentsTools(server, service) {
3387
3792
  );
3388
3793
  }
3389
3794
 
3795
+ // src/tools/egress-allowlist.tools.ts
3796
+ import { z as z12 } from "zod";
3797
+ var idSchema2 = z12.string().uuid().describe(
3798
+ "Egress allowlist entry UUID from list_egress_allowlist or create_egress_allowlist_entry"
3799
+ );
3800
+ var listSchema2 = {
3801
+ search: z12.string().min(1).max(255).optional().describe("Search allowlisted domains"),
3802
+ current_page: CurrentPageSchema,
3803
+ page_size: PageSizeSchema.describe(
3804
+ "Items per page, 1-100; Portkey defaults to 20"
3805
+ )
3806
+ };
3807
+ var lookupSchema2 = { id: idSchema2 };
3808
+ var updateSchema2 = UpdateEgressAllowlistRequestSchema.safeExtend({
3809
+ id: idSchema2
3810
+ });
3811
+ function registerEgressAllowlistTools(server, service) {
3812
+ server.registerTool(
3813
+ "list_egress_allowlist",
3814
+ {
3815
+ description: "Inspect the organisation's trusted custom-host egress allowlist without changing destinations. Returns total and the current page of entries; filter by domain before creating duplicates, and use get_egress_allowlist_entry to inspect one entry. Requires organisation permission.",
3816
+ inputSchema: listSchema2
3817
+ },
3818
+ async (params) => jsonResult(await service.egressAllowlist.listEgressAllowlist(params))
3819
+ );
3820
+ server.registerTool(
3821
+ "create_egress_allowlist_entry",
3822
+ {
3823
+ description: "Trust a custom hostname, IP literal, or wildcard for organisation egress, widening permitted outbound destinations. Use list_egress_allowlist to inspect existing trust first. Portkey rejects metadata destinations and duplicates. Returns the new UUID and normalized domain; requires organisation permission.",
3824
+ inputSchema: CreateEgressAllowlistRequestSchema
3825
+ },
3826
+ async (params) => jsonResult(
3827
+ await service.egressAllowlist.createEgressAllowlistEntry(params)
3828
+ )
3829
+ );
3830
+ server.registerTool(
3831
+ "get_egress_allowlist_entry",
3832
+ {
3833
+ description: "Read one organisation egress allowlist entry's trusted domain, description, and audit fields. Use this before changing or deleting a destination. Returns entry details, or HTTP 404 if it is missing; requires organisation permission.",
3834
+ inputSchema: lookupSchema2
3835
+ },
3836
+ async ({ id }) => jsonResult(await service.egressAllowlist.getEgressAllowlistEntry(id))
3837
+ );
3838
+ server.registerTool(
3839
+ "update_egress_allowlist_entry",
3840
+ {
3841
+ description: "Change an organisation egress allowlist domain or description, potentially changing trusted outbound destinations. Inspect get_egress_allowlist_entry first. Omitted fields stay unchanged; description null clears it. At least one changed field is required. Returns Portkey's acknowledgement; requires organisation permission.",
3842
+ inputSchema: updateSchema2,
3843
+ annotations: { destructiveHint: true }
3844
+ },
3845
+ async ({ id, ...params }) => jsonResult(
3846
+ await service.egressAllowlist.updateEgressAllowlistEntry(id, params)
3847
+ )
3848
+ );
3849
+ server.registerTool(
3850
+ "delete_egress_allowlist_entry",
3851
+ {
3852
+ description: "Remove an organisation egress allowlist entry, revoking trust in its outbound destination and potentially breaking integrations that use it. Inspect get_egress_allowlist_entry first. Deletion cannot be undone by this tool. Returns Portkey's acknowledgement or HTTP 404; requires organisation permission.",
3853
+ inputSchema: lookupSchema2
3854
+ },
3855
+ async ({ id }) => jsonResult(await service.egressAllowlist.deleteEgressAllowlistEntry(id))
3856
+ );
3857
+ }
3858
+
3390
3859
  // src/tools/guardrails.tools.ts
3391
- import { z as z8 } from "zod";
3392
- var guardrailCheckSchema = z8.object({
3393
- id: z8.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
3394
- name: z8.string().optional().describe("Display name for the check"),
3395
- is_enabled: z8.boolean().optional().describe("Whether the check is enabled"),
3396
- parameters: z8.record(z8.string(), z8.unknown()).optional().describe(
3860
+ import { z as z13 } from "zod";
3861
+ var guardrailCheckSchema = z13.object({
3862
+ id: z13.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
3863
+ name: z13.string().optional().describe("Display name for the check"),
3864
+ is_enabled: z13.boolean().optional().describe("Whether the check is enabled"),
3865
+ parameters: z13.record(z13.string(), z13.unknown()).optional().describe(
3397
3866
  "Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
3398
3867
  )
3399
3868
  });
3400
- var guardrailFeedbackSchema = z8.object({
3401
- value: z8.coerce.number().optional().describe("Feedback value"),
3402
- weight: z8.coerce.number().optional().describe("Feedback weight"),
3403
- metadata: z8.record(z8.string(), z8.unknown()).optional().describe("Additional metadata")
3869
+ var guardrailFeedbackSchema = z13.object({
3870
+ value: z13.coerce.number().optional().describe("Feedback value"),
3871
+ weight: z13.coerce.number().optional().describe("Feedback weight"),
3872
+ metadata: z13.record(z13.string(), z13.unknown()).optional().describe("Additional metadata")
3404
3873
  });
3405
- var guardrailActionSchema = z8.object({
3406
- deny: z8.boolean().optional().describe("Whether to deny the request on check failure"),
3407
- async: z8.boolean().optional().describe("Whether to run checks asynchronously"),
3874
+ var guardrailActionSchema = z13.object({
3875
+ deny: z13.boolean().optional().describe("Whether to deny the request on check failure"),
3876
+ async: z13.boolean().optional().describe("Whether to run checks asynchronously"),
3408
3877
  on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
3409
3878
  on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
3410
- on_fail_action: z8.string().optional().describe("Simple action on failure (e.g., 'block')"),
3411
- message: z8.string().optional().describe("Message to return when guardrail triggers")
3879
+ on_fail_action: z13.string().optional().describe("Simple action on failure (e.g., 'block')"),
3880
+ message: z13.string().optional().describe("Message to return when guardrail triggers")
3412
3881
  });
3413
- var workspaceGuardrailExclusionSchema = z8.object({
3414
- workspace_id: z8.string().describe("Workspace ID whose exclusion state changes"),
3415
- excluded: z8.boolean().describe("True to exclude this workspace; false to restore enforcement")
3882
+ var workspaceGuardrailExclusionSchema = z13.object({
3883
+ workspace_id: z13.string().describe("Workspace ID whose exclusion state changes"),
3884
+ excluded: z13.boolean().describe("True to exclude this workspace; false to restore enforcement")
3416
3885
  });
3417
- var guardrailTargetSchema = z8.enum(["llm", "mcp_tools"]);
3886
+ var guardrailTargetSchema = z13.enum(["llm", "mcp_tools"]);
3418
3887
  var guardrailMcpServerMappingConfigShape = {
3419
- run_on: z8.array(z8.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
3420
- mcp_integration_capability_ids: z8.array(z8.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
3888
+ run_on: z13.array(z13.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
3889
+ mcp_integration_capability_ids: z13.array(z13.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
3421
3890
  };
3422
- var guardrailMcpServerMappingConfigSchema = z8.object(
3891
+ var guardrailMcpServerMappingConfigSchema = z13.object(
3423
3892
  guardrailMcpServerMappingConfigShape
3424
3893
  );
3425
3894
  var GUARDRAILS_TOOL_SCHEMAS = {
3426
3895
  getOrganisationDefaults: {},
3427
3896
  listGuardrails: {
3428
- workspace_id: z8.string().optional().describe("Filter guardrails by workspace ID"),
3429
- organisation_id: z8.string().optional().describe("Filter guardrails by organization ID"),
3897
+ workspace_id: z13.string().optional().describe("Filter guardrails by workspace ID"),
3898
+ organisation_id: z13.string().optional().describe("Filter guardrails by organization ID"),
3430
3899
  page_size: PageSizeSchema.describe(
3431
3900
  "Number of items per page (1-100, default: 100)"
3432
3901
  ),
3433
3902
  current_page: CurrentPageSchema
3434
3903
  },
3435
3904
  getGuardrail: {
3436
- guardrail_id: z8.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
3905
+ guardrail_id: z13.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
3437
3906
  },
3438
3907
  createGuardrail: {
3439
- name: z8.string().describe("Name of the guardrail"),
3908
+ name: z13.string().describe("Name of the guardrail"),
3440
3909
  target: guardrailTargetSchema.optional().describe("LLM traffic by default, or MCP tool calls"),
3441
- checks: z8.array(guardrailCheckSchema).min(1).optional().describe(
3910
+ checks: z13.array(guardrailCheckSchema).min(1).optional().describe(
3442
3911
  "Checks to apply; at least one entry. Required when target is llm."
3443
3912
  ),
3444
3913
  actions: guardrailActionSchema.optional().describe("Actions to take when guardrail checks pass or fail"),
3445
- workspace_id: z8.string().optional().describe("Workspace ID to create the guardrail in"),
3446
- organisation_id: z8.string().optional().describe("Organisation ID (required if workspace_id not provided)")
3914
+ workspace_id: z13.string().optional().describe("Workspace ID to create the guardrail in"),
3915
+ organisation_id: z13.string().optional().describe("Organisation ID (required if workspace_id not provided)")
3447
3916
  },
3448
3917
  updateGuardrail: {
3449
- guardrail_id: z8.string().describe("The guardrail UUID or slug to update"),
3450
- name: z8.string().optional().describe("New name for the guardrail"),
3451
- checks: z8.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
3918
+ guardrail_id: z13.string().describe("The guardrail UUID or slug to update"),
3919
+ name: z13.string().optional().describe("New name for the guardrail"),
3920
+ checks: z13.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
3452
3921
  actions: guardrailActionSchema.optional().describe("Updated actions configuration")
3453
3922
  },
3454
3923
  deleteGuardrail: {
3455
- guardrail_id: z8.string().describe("The guardrail UUID or slug to delete")
3924
+ guardrail_id: z13.string().describe("The guardrail UUID or slug to delete")
3456
3925
  },
3457
3926
  updateOrganisationDefaults: {
3458
- input_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
3459
- output_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
3927
+ input_guardrails: z13.array(z13.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
3928
+ output_guardrails: z13.array(z13.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
3460
3929
  },
3461
3930
  listWorkspaceExclusions: {
3462
- organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be listed")
3931
+ organisation_id: z13.string().describe("Organisation ID whose workspace exclusions should be listed")
3463
3932
  },
3464
3933
  updateWorkspaceExclusions: {
3465
- organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be updated"),
3466
- workspaces: z8.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
3467
- override_existing: z8.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
3934
+ organisation_id: z13.string().describe("Organisation ID whose workspace exclusions should be updated"),
3935
+ workspaces: z13.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
3936
+ override_existing: z13.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
3468
3937
  },
3469
3938
  listGuardrailMcpServerMappings: {
3470
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug")
3939
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug")
3471
3940
  },
3472
3941
  replaceGuardrailMcpServerMappings: {
3473
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug"),
3474
- mcp_servers: z8.record(z8.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
3942
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug"),
3943
+ mcp_servers: z13.record(z13.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
3475
3944
  "Complete MCP-server mapping set keyed by server UUID; an empty object clears every mapping"
3476
3945
  )
3477
3946
  },
3478
3947
  upsertGuardrailMcpServerMapping: {
3479
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug"),
3480
- mcp_server_id: z8.string().uuid().describe("MCP server UUID"),
3948
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug"),
3949
+ mcp_server_id: z13.string().uuid().describe("MCP server UUID"),
3481
3950
  ...guardrailMcpServerMappingConfigShape
3482
3951
  }
3483
3952
  };
3484
- var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3953
+ var createGuardrailSchema = z13.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3485
3954
  if ((value.target ?? "llm") === "llm" && (!value.checks || !value.actions)) {
3486
3955
  context.addIssue({
3487
3956
  code: "custom",
@@ -3490,10 +3959,10 @@ var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).s
3490
3959
  });
3491
3960
  }
3492
3961
  });
3493
- var replaceGuardrailMcpServerMappingsSchema = z8.object(
3962
+ var replaceGuardrailMcpServerMappingsSchema = z13.object(
3494
3963
  GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings
3495
3964
  );
3496
- var upsertGuardrailMcpServerMappingSchema = z8.object(
3965
+ var upsertGuardrailMcpServerMappingSchema = z13.object(
3497
3966
  GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping
3498
3967
  );
3499
3968
  var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
@@ -3658,7 +4127,7 @@ function registerGuardrailsTools(server, service) {
3658
4127
  );
3659
4128
  server.tool(
3660
4129
  "list_guardrail_mcp_servers",
3661
- "List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
4130
+ "List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Requires a guardrail with target mcp_tools. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
3662
4131
  GUARDRAILS_TOOL_SCHEMAS.listGuardrailMcpServerMappings,
3663
4132
  {
3664
4133
  title: "List Guardrail MCP Servers",
@@ -3673,7 +4142,7 @@ function registerGuardrailsTools(server, service) {
3673
4142
  );
3674
4143
  server.tool(
3675
4144
  "replace_guardrail_mcp_servers",
3676
- "Replace the complete MCP-server mapping set for one guardrail. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
4145
+ "Replace the complete MCP-server mapping set for one guardrail. Requires a guardrail with target mcp_tools. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
3677
4146
  GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings,
3678
4147
  {
3679
4148
  title: "Replace Guardrail MCP Servers",
@@ -3694,7 +4163,7 @@ function registerGuardrailsTools(server, service) {
3694
4163
  );
3695
4164
  server.tool(
3696
4165
  "upsert_guardrail_mcp_server",
3697
- "Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
4166
+ "Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. Requires a guardrail with target mcp_tools. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
3698
4167
  GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping,
3699
4168
  {
3700
4169
  title: "Upsert Guardrail MCP Server",
@@ -3758,7 +4227,7 @@ function registerGuardrailsTools(server, service) {
3758
4227
  }
3759
4228
 
3760
4229
  // src/tools/integrations.tools.ts
3761
- import { z as z10 } from "zod";
4230
+ import { z as z15 } from "zod";
3762
4231
 
3763
4232
  // src/lib/limits.ts
3764
4233
  var PERIODIC_RESET_DEFAULT = "monthly";
@@ -3801,25 +4270,25 @@ function buildRateLimits(params) {
3801
4270
  }
3802
4271
 
3803
4272
  // src/tools/secret-mapping.schemas.ts
3804
- import { z as z9 } from "zod";
4273
+ import { z as z14 } from "zod";
3805
4274
  function createSecretMappingSchema({
3806
4275
  allowKeyTarget,
3807
4276
  targetFieldDescription,
3808
4277
  secretReferenceDescription,
3809
4278
  valueFormatDescription
3810
4279
  }) {
3811
- return z9.object({
3812
- target_field: z9.string().refine(
4280
+ return z14.object({
4281
+ target_field: z14.string().refine(
3813
4282
  (value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
3814
4283
  allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
3815
4284
  ).describe(targetFieldDescription),
3816
- secret_reference_id: z9.string().describe(secretReferenceDescription),
3817
- secret_key: z9.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
3818
- value_format: z9.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
4285
+ secret_reference_id: z14.string().describe(secretReferenceDescription),
4286
+ secret_key: z14.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
4287
+ value_format: z14.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
3819
4288
  });
3820
4289
  }
3821
4290
  function uniqueSecretMappingsSchema(itemSchema) {
3822
- return z9.array(itemSchema).superRefine((mappings, context) => {
4291
+ return z14.array(itemSchema).superRefine((mappings, context) => {
3823
4292
  const firstIndexByTarget = /* @__PURE__ */ new Map();
3824
4293
  for (const [index, mapping] of mappings.entries()) {
3825
4294
  const firstIndex = firstIndexByTarget.get(mapping.target_field);
@@ -3846,8 +4315,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
3846
4315
  var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
3847
4316
  integrationSecretMappingSchema
3848
4317
  );
3849
- var nullableMultiplier = (description) => z10.coerce.number().nonnegative().nullable().optional().describe(description);
3850
- var pricingMultiplierSchema = z10.object({
4318
+ var nullableMultiplier = (description) => z15.coerce.number().nonnegative().nullable().optional().describe(description);
4319
+ var pricingMultiplierSchema = z15.object({
3851
4320
  default: nullableMultiplier(
3852
4321
  "Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
3853
4322
  ),
@@ -3891,175 +4360,178 @@ var pricingMultiplierSchema = z10.object({
3891
4360
  cache_write_image_input_token: nullableMultiplier(
3892
4361
  "Cache-write image input token price multiplier"
3893
4362
  ),
3894
- image: z10.object({
4363
+ image: z15.object({
3895
4364
  default: nullableMultiplier("Default image-generation price multiplier")
3896
4365
  }).nullable().optional().describe("Image-generation pricing multipliers"),
3897
- additional_units: z10.record(z10.string(), z10.coerce.number().nonnegative().nullable()).nullable().optional().describe(
4366
+ additional_units: z15.record(z15.string(), z15.coerce.number().nonnegative().nullable()).nullable().optional().describe(
3898
4367
  "Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
3899
4368
  )
3900
4369
  });
3901
- var pricingAdjustmentsSchema = z10.object({
4370
+ var pricingAdjustmentsSchema = z15.object({
3902
4371
  multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
3903
4372
  }).nullable();
3904
- var modelConfigurationsSchema = z10.object({
3905
- custom_host: z10.string().url().optional().describe("Custom upstream URL used only for this model"),
3906
- custom_headers: z10.record(z10.string(), z10.string()).optional().describe("Headers sent only for this model; values may contain secrets")
4373
+ var modelConfigurationsSchema = z15.object({
4374
+ custom_host: z15.string().url().optional().describe("Custom upstream URL used only for this model"),
4375
+ custom_headers: z15.record(z15.string(), z15.string()).optional().describe("Headers sent only for this model; values may contain secrets")
3907
4376
  });
3908
- var tokenPricingSchema = z10.object({
3909
- price: z10.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
4377
+ var tokenPricingSchema = z15.object({
4378
+ price: z15.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
3910
4379
  });
3911
- var integrationModelPricingSchema = z10.object({
3912
- type: z10.literal("static").describe("Static per-token pricing configuration"),
3913
- pay_as_you_go: z10.object({
4380
+ var integrationModelPricingSchema = z15.object({
4381
+ type: z15.literal("static").describe("Static per-token pricing configuration"),
4382
+ pay_as_you_go: z15.object({
3914
4383
  request_token: tokenPricingSchema.optional().describe("Input token pricing"),
3915
4384
  response_token: tokenPricingSchema.optional().describe("Output token pricing")
3916
4385
  }).optional().describe("Pay-as-you-go rates for this integration model")
3917
4386
  });
3918
4387
  var INTEGRATIONS_TOOL_SCHEMAS = {
3919
4388
  getModelPricing: {
3920
- provider: z10.string().describe(
4389
+ provider: z15.string().describe(
3921
4390
  "Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
3922
4391
  ),
3923
- model: z10.string().describe("Exact provider model identifier, such as gpt-4o")
4392
+ model: z15.string().describe("Exact provider model identifier, such as gpt-4o")
3924
4393
  },
3925
4394
  listIntegrations: {
3926
4395
  current_page: CurrentPageSchema,
3927
4396
  page_size: PageSizeSchema.describe(
3928
4397
  "Number of results per page (default 100, max 100)"
3929
4398
  ),
3930
- workspace_id: z10.string().optional().describe("Filter integrations accessible by a specific workspace"),
3931
- type: z10.enum(["workspace", "organisation", "all"]).optional().describe(
4399
+ workspace_id: z15.string().optional().describe("Filter integrations accessible by a specific workspace"),
4400
+ type: z15.enum(["workspace", "organisation", "all"]).optional().describe(
3932
4401
  "Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
3933
- )
4402
+ ),
4403
+ tags: integrationTagsSchema.optional().describe("Match integrations that carry all supplied tags")
3934
4404
  },
3935
4405
  createIntegration: {
3936
- name: z10.string().describe("Human-readable name for the integration"),
3937
- ai_provider_id: z10.string().describe(
4406
+ name: z15.string().describe("Human-readable name for the integration"),
4407
+ ai_provider_id: z15.string().describe(
3938
4408
  "ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
3939
4409
  ),
3940
- slug: z10.string().optional().describe(
4410
+ slug: z15.string().optional().describe(
3941
4411
  "URL-friendly identifier (auto-generated from name if not provided)"
3942
4412
  ),
3943
- key: z10.string().optional().describe("API key for the provider (if required)"),
3944
- description: z10.string().optional().describe("Optional description of the integration"),
3945
- workspace_id: z10.string().optional().describe("Workspace ID for workspace-scoped integrations"),
3946
- api_version: z10.string().optional().describe("API version (for Azure OpenAI)"),
3947
- resource_name: z10.string().optional().describe("Resource name (for Azure OpenAI)"),
3948
- deployment_name: z10.string().optional().describe("Deployment name (for Azure OpenAI)"),
3949
- aws_region: z10.string().optional().describe("AWS region (for AWS Bedrock)"),
3950
- aws_access_key_id: z10.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
3951
- aws_secret_access_key: z10.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
3952
- vertex_project_id: z10.string().optional().describe("GCP project ID (for Vertex AI)"),
3953
- vertex_region: z10.string().optional().describe("GCP region (for Vertex AI)"),
3954
- custom_host: z10.string().optional().describe("Custom base URL for the provider"),
3955
- create_default_provider: z10.boolean().optional().describe(
4413
+ key: z15.string().optional().describe("API key for the provider (if required)"),
4414
+ description: z15.string().optional().describe("Optional description of the integration"),
4415
+ workspace_id: z15.string().optional().describe("Workspace ID for workspace-scoped integrations"),
4416
+ api_version: z15.string().optional().describe("API version (for Azure OpenAI)"),
4417
+ resource_name: z15.string().optional().describe("Resource name (for Azure OpenAI)"),
4418
+ deployment_name: z15.string().optional().describe("Deployment name (for Azure OpenAI)"),
4419
+ aws_region: z15.string().optional().describe("AWS region (for AWS Bedrock)"),
4420
+ aws_access_key_id: z15.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
4421
+ aws_secret_access_key: z15.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
4422
+ vertex_project_id: z15.string().optional().describe("GCP project ID (for Vertex AI)"),
4423
+ vertex_region: z15.string().optional().describe("GCP region (for Vertex AI)"),
4424
+ custom_host: z15.string().optional().describe("Custom base URL for the provider"),
4425
+ create_default_provider: z15.boolean().optional().describe(
3956
4426
  "Create a provider automatically for a workspace-scoped integration; defaults to true"
3957
4427
  ),
3958
- default_provider_slug: z10.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
4428
+ default_provider_slug: z15.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
3959
4429
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
3960
4430
  "Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
3961
4431
  ),
3962
4432
  pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
3963
4433
  "Negotiated discount or markup multipliers for cost accounting"
3964
- )
4434
+ ),
4435
+ tags: integrationTagsSchema.nullable().optional().describe("Integration tags, or null to create without tags")
3965
4436
  },
3966
4437
  getIntegration: {
3967
- slug: z10.string().describe("The unique slug identifier of the integration to retrieve")
4438
+ slug: z15.string().describe("The unique slug identifier of the integration to retrieve")
3968
4439
  },
3969
4440
  updateIntegration: {
3970
- slug: z10.string().describe("The slug of the integration to update"),
3971
- name: z10.string().optional().describe("New human-readable name for the integration"),
3972
- key: z10.string().optional().describe("New API key for the provider"),
3973
- description: z10.string().optional().describe("New description for the integration"),
3974
- api_version: z10.string().optional().describe("New API version (for Azure OpenAI)"),
3975
- resource_name: z10.string().optional().describe("New resource name (for Azure OpenAI)"),
3976
- deployment_name: z10.string().optional().describe("New deployment name (for Azure OpenAI)"),
3977
- aws_region: z10.string().optional().describe("New AWS region (for AWS Bedrock)"),
3978
- aws_access_key_id: z10.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
3979
- aws_secret_access_key: z10.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
3980
- vertex_project_id: z10.string().optional().describe("New GCP project ID (for Vertex AI)"),
3981
- vertex_region: z10.string().optional().describe("New GCP region (for Vertex AI)"),
3982
- custom_host: z10.string().optional().describe("New custom base URL for the provider"),
4441
+ slug: z15.string().describe("The slug of the integration to update"),
4442
+ name: z15.string().optional().describe("New human-readable name for the integration"),
4443
+ key: z15.string().optional().describe("New API key for the provider"),
4444
+ description: z15.string().optional().describe("New description for the integration"),
4445
+ api_version: z15.string().optional().describe("New API version (for Azure OpenAI)"),
4446
+ resource_name: z15.string().optional().describe("New resource name (for Azure OpenAI)"),
4447
+ deployment_name: z15.string().optional().describe("New deployment name (for Azure OpenAI)"),
4448
+ aws_region: z15.string().optional().describe("New AWS region (for AWS Bedrock)"),
4449
+ aws_access_key_id: z15.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
4450
+ aws_secret_access_key: z15.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
4451
+ vertex_project_id: z15.string().optional().describe("New GCP project ID (for Vertex AI)"),
4452
+ vertex_region: z15.string().optional().describe("New GCP region (for Vertex AI)"),
4453
+ custom_host: z15.string().optional().describe("New custom base URL for the provider"),
3983
4454
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
3984
4455
  "Replacement runtime Secret Reference mappings; each target_field must be unique"
3985
4456
  ),
3986
4457
  pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
3987
4458
  "Replacement cost multiplier configuration, or null to clear adjustments"
3988
- )
4459
+ ),
4460
+ tags: integrationTagsSchema.nullable().optional().describe("Replacement integration tags, or null to clear all tags")
3989
4461
  },
3990
4462
  deleteIntegration: {
3991
- slug: z10.string().describe("The slug of the integration to delete")
4463
+ slug: z15.string().describe("The slug of the integration to delete")
3992
4464
  },
3993
4465
  listIntegrationModels: {
3994
- slug: z10.string().describe("The slug of the integration"),
4466
+ slug: z15.string().describe("The slug of the integration"),
3995
4467
  current_page: CurrentPageSchema,
3996
4468
  page_size: PageSizeSchema.describe("Number of results per page")
3997
4469
  },
3998
4470
  updateIntegrationModels: {
3999
- slug: z10.string().describe("The slug of the integration"),
4000
- allow_all_models: z10.boolean().optional().describe(
4471
+ slug: z15.string().describe("The slug of the integration"),
4472
+ allow_all_models: z15.boolean().optional().describe(
4001
4473
  "Whether newly available provider models are enabled by default"
4002
4474
  ),
4003
- models: z10.array(
4004
- z10.object({
4005
- slug: z10.string().describe("The model slug identifier"),
4006
- model_name: z10.string().optional().describe(
4475
+ models: z15.array(
4476
+ z15.object({
4477
+ slug: z15.string().describe("The model slug identifier"),
4478
+ model_name: z15.string().optional().describe(
4007
4479
  "Display name for the model (required for custom models)"
4008
4480
  ),
4009
- enabled: z10.boolean().describe("Whether the model is enabled"),
4010
- is_custom: z10.boolean().optional().describe("Whether this is a custom model (default: false)"),
4011
- is_finetune: z10.boolean().optional().describe("Whether this entry is a fine-tuned model"),
4012
- base_model_slug: z10.string().optional().describe("Base model slug for a fine-tuned model"),
4481
+ enabled: z15.boolean().describe("Whether the model is enabled"),
4482
+ is_custom: z15.boolean().optional().describe("Whether this is a custom model (default: false)"),
4483
+ is_finetune: z15.boolean().optional().describe("Whether this entry is a fine-tuned model"),
4484
+ base_model_slug: z15.string().optional().describe("Base model slug for a fine-tuned model"),
4013
4485
  configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
4014
4486
  pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
4015
4487
  })
4016
4488
  ).describe("Array of model configurations to update")
4017
4489
  },
4018
4490
  deleteIntegrationModel: {
4019
- slug: z10.string().describe("The slug of the integration"),
4020
- model_slug: z10.string().describe("The slug of the model to delete")
4491
+ slug: z15.string().describe("The slug of the integration"),
4492
+ model_slug: z15.string().describe("The slug of the model to delete")
4021
4493
  },
4022
4494
  listIntegrationWorkspaces: {
4023
- slug: z10.string().describe("The slug of the integration"),
4495
+ slug: z15.string().describe("The slug of the integration"),
4024
4496
  current_page: CurrentPageSchema,
4025
4497
  page_size: PageSizeSchema.describe("Number of results per page")
4026
4498
  },
4027
4499
  updateIntegrationWorkspaces: {
4028
- slug: z10.string().describe("The slug of the integration"),
4029
- workspaces: z10.array(
4030
- z10.object({
4031
- id: z10.string().describe("The workspace ID"),
4032
- enabled: z10.boolean().describe("Whether the workspace has access to this integration"),
4033
- credit_limit: z10.coerce.number().positive().optional().describe("Credit limit for this workspace"),
4034
- alert_threshold: z10.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4035
- rate_limit_rpm: z10.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4036
- reset_usage: z10.boolean().optional().describe("Reset exhausted usage status to active"),
4037
- create_default_provider: z10.boolean().optional().describe(
4500
+ slug: z15.string().describe("The slug of the integration"),
4501
+ workspaces: z15.array(
4502
+ z15.object({
4503
+ id: z15.string().describe("The workspace ID"),
4504
+ enabled: z15.boolean().describe("Whether the workspace has access to this integration"),
4505
+ credit_limit: z15.coerce.number().positive().optional().describe("Credit limit for this workspace"),
4506
+ alert_threshold: z15.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4507
+ rate_limit_rpm: z15.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4508
+ reset_usage: z15.boolean().optional().describe("Reset exhausted usage status to active"),
4509
+ create_default_provider: z15.boolean().optional().describe(
4038
4510
  "Override whether a provider is auto-created for this workspace"
4039
4511
  ),
4040
- default_provider_slug: z10.string().optional().describe(
4512
+ default_provider_slug: z15.string().optional().describe(
4041
4513
  "Override the auto-created provider slug for this workspace"
4042
4514
  )
4043
4515
  })
4044
4516
  ).describe("Array of workspace configurations to update"),
4045
- global_workspace_access_enabled: z10.boolean().optional().describe(
4517
+ global_workspace_access_enabled: z15.boolean().optional().describe(
4046
4518
  "Enable or disable access for all current and future workspaces"
4047
4519
  ),
4048
- global_credit_limit: z10.coerce.number().positive().optional().describe(
4520
+ global_credit_limit: z15.coerce.number().positive().optional().describe(
4049
4521
  "Global cost credit limit applied with global workspace access"
4050
4522
  ),
4051
- global_alert_threshold: z10.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
4052
- global_rate_limit_rpm: z10.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
4053
- override_existing_workspace_access: z10.boolean().optional().describe("Apply global settings over existing per-workspace access"),
4054
- create_default_provider: z10.boolean().optional().describe("Auto-create providers when granting workspace access"),
4055
- default_provider_slug: z10.string().optional().describe("Default slug for providers auto-created in workspaces")
4523
+ global_alert_threshold: z15.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
4524
+ global_rate_limit_rpm: z15.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
4525
+ override_existing_workspace_access: z15.boolean().optional().describe("Apply global settings over existing per-workspace access"),
4526
+ create_default_provider: z15.boolean().optional().describe("Auto-create providers when granting workspace access"),
4527
+ default_provider_slug: z15.string().optional().describe("Default slug for providers auto-created in workspaces")
4056
4528
  }
4057
4529
  };
4058
- var updateIntegrationWorkspacesSchema = z10.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4530
+ var updateIntegrationWorkspacesSchema = z15.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4059
4531
  const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
4060
4532
  if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
4061
4533
  ctx.addIssue({
4062
- code: z10.ZodIssueCode.custom,
4534
+ code: z15.ZodIssueCode.custom,
4063
4535
  path: ["global_workspace_access_enabled"],
4064
4536
  message: "global_workspace_access_enabled is required when setting global limits."
4065
4537
  });
@@ -4108,14 +4580,15 @@ function registerIntegrationsTools(server, service) {
4108
4580
  );
4109
4581
  server.tool(
4110
4582
  "list_integrations",
4111
- "List org-level AI provider connections with optional workspace or type filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
4583
+ "List org-level AI provider connections with optional workspace, type, or tag filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
4112
4584
  INTEGRATIONS_TOOL_SCHEMAS.listIntegrations,
4113
4585
  async (params) => {
4114
4586
  const integrations = await service.integrations.listIntegrations({
4115
4587
  current_page: params.current_page,
4116
4588
  page_size: params.page_size,
4117
4589
  workspace_id: params.workspace_id,
4118
- type: params.type
4590
+ type: params.type,
4591
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4119
4592
  });
4120
4593
  return jsonResult({
4121
4594
  total: integrations.total,
@@ -4135,7 +4608,7 @@ function registerIntegrationsTools(server, service) {
4135
4608
  );
4136
4609
  server.tool(
4137
4610
  "create_integration",
4138
- "Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
4611
+ "Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting; tags attach key-value labels that list_integrations can filter on. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
4139
4612
  INTEGRATIONS_TOOL_SCHEMAS.createIntegration,
4140
4613
  {
4141
4614
  title: "Create AI Provider Integration",
@@ -4156,7 +4629,8 @@ function registerIntegrationsTools(server, service) {
4156
4629
  ...params.create_default_provider !== void 0 ? { create_default_provider: params.create_default_provider } : {},
4157
4630
  ...params.default_provider_slug !== void 0 ? { default_provider_slug: params.default_provider_slug } : {},
4158
4631
  ...params.secret_mappings !== void 0 ? { secret_mappings: params.secret_mappings } : {},
4159
- ...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {}
4632
+ ...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {},
4633
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4160
4634
  });
4161
4635
  return jsonResult({
4162
4636
  message: `Successfully created integration "${params.name}"`,
@@ -4195,7 +4669,7 @@ function registerIntegrationsTools(server, service) {
4195
4669
  );
4196
4670
  server.tool(
4197
4671
  "update_integration",
4198
- "Update an integration's name, description, API key, provider config, Secret Reference mappings, or pricing adjustments by slug. Only provided fields change; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
4672
+ "Update an integration's name, description, API key, provider config, Secret Reference mappings, pricing adjustments, or tags by slug. Only provided fields change; tags replaces the whole map and null clears it; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
4199
4673
  INTEGRATIONS_TOOL_SCHEMAS.updateIntegration,
4200
4674
  {
4201
4675
  title: "Update AI Provider Integration",
@@ -4211,7 +4685,8 @@ function registerIntegrationsTools(server, service) {
4211
4685
  description: params.description,
4212
4686
  configurations: buildIntegrationConfigurations(params),
4213
4687
  secret_mappings: params.secret_mappings,
4214
- pricing_adjustments: params.pricing_adjustments
4688
+ pricing_adjustments: params.pricing_adjustments,
4689
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4215
4690
  });
4216
4691
  return jsonResult({
4217
4692
  message: `Successfully updated integration "${params.slug}"`,
@@ -4251,7 +4726,7 @@ function registerIntegrationsTools(server, service) {
4251
4726
  slug: model.slug ?? model.model_id,
4252
4727
  name: model.name ?? model.model_name,
4253
4728
  enabled: model.enabled,
4254
- is_custom: model.is_custom ?? model.custom,
4729
+ is_custom: model.is_custom !== void 0 ? model.is_custom : model.custom,
4255
4730
  is_finetune: model.is_finetune,
4256
4731
  base_model_slug: model.base_model_slug,
4257
4732
  configurations: model.configurations,
@@ -4391,31 +4866,31 @@ function registerIntegrationsTools(server, service) {
4391
4866
  }
4392
4867
 
4393
4868
  // src/tools/keys.tools.ts
4394
- import { z as z11 } from "zod";
4395
- var virtualKeySecretMappingSchema = z11.object({
4396
- target_field: z11.string().refine(
4869
+ import { z as z16 } from "zod";
4870
+ var virtualKeySecretMappingSchema = z16.object({
4871
+ target_field: z16.string().refine(
4397
4872
  (value) => value === "key" || value.startsWith("model_config."),
4398
4873
  "target_field must be 'key' or start with 'model_config.'"
4399
4874
  ).describe("Virtual Key field populated from the Secret Reference"),
4400
- secret_reference_id: z11.string().describe("Secret Reference ID that owns the external secret"),
4401
- secret_key: z11.string().nullable().optional().describe("Optional key selected from a structured external secret"),
4402
- value_format: z11.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
4875
+ secret_reference_id: z16.string().describe("Secret Reference ID that owns the external secret"),
4876
+ secret_key: z16.string().nullable().optional().describe("Optional key selected from a structured external secret"),
4877
+ value_format: z16.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
4403
4878
  });
4404
- var virtualKeyDeploymentSchema = z11.object({
4405
- api_version: z11.string().min(1).describe("Azure OpenAI API version"),
4406
- deployment_name: z11.string().min(1).describe("Azure deployment name"),
4407
- alias: z11.string().optional().describe("Optional model alias for the deployment"),
4408
- is_default: z11.boolean().optional().describe("Whether this is the default Azure deployment")
4879
+ var virtualKeyDeploymentSchema = z16.object({
4880
+ api_version: z16.string().min(1).describe("Azure OpenAI API version"),
4881
+ deployment_name: z16.string().min(1).describe("Azure deployment name"),
4882
+ alias: z16.string().optional().describe("Optional model alias for the deployment"),
4883
+ is_default: z16.boolean().optional().describe("Whether this is the default Azure deployment")
4409
4884
  });
4410
- var apiKeyRateLimitSchema = z11.object({
4411
- type: z11.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
4412
- unit: z11.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
4413
- value: z11.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
4885
+ var apiKeyRateLimitSchema = z16.object({
4886
+ type: z16.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
4887
+ unit: z16.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
4888
+ value: z16.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
4414
4889
  });
4415
- var rotationPolicySchema = z11.object({
4416
- rotation_period: z11.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
4417
- next_rotation_at: z11.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
4418
- key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
4890
+ var rotationPolicySchema = z16.object({
4891
+ rotation_period: z16.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
4892
+ next_rotation_at: z16.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
4893
+ key_transition_period_ms: z16.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
4419
4894
  }).superRefine((value, context) => {
4420
4895
  if (value.rotation_period && value.next_rotation_at) {
4421
4896
  context.addIssue({
@@ -4431,108 +4906,108 @@ var KEYS_TOOL_SCHEMAS = {
4431
4906
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
4432
4907
  },
4433
4908
  createVirtualKey: {
4434
- name: z11.string().describe("Display name for the virtual key"),
4435
- provider: z11.string().describe(
4909
+ name: z16.string().describe("Display name for the virtual key"),
4910
+ provider: z16.string().describe(
4436
4911
  "Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
4437
4912
  ),
4438
- key: z11.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
4439
- note: z11.string().optional().describe("Optional note or description for this key"),
4440
- workspace_id: z11.string().optional().describe("Workspace ID to create the key in"),
4441
- api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
4442
- resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
4443
- deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
4444
- deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe(
4913
+ key: z16.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
4914
+ note: z16.string().optional().describe("Optional note or description for this key"),
4915
+ workspace_id: z16.string().optional().describe("Workspace ID to create the key in"),
4916
+ api_version: z16.string().optional().describe("API version (for Azure OpenAI)"),
4917
+ resource_name: z16.string().optional().describe("Resource name (for Azure OpenAI)"),
4918
+ deployment_name: z16.string().optional().describe("Deployment name (for Azure OpenAI)"),
4919
+ deployment_configurations: z16.array(virtualKeyDeploymentSchema).optional().describe(
4445
4920
  "Azure deployment configurations with API versions and aliases"
4446
4921
  ),
4447
- expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
4448
- secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
4449
- credit_limit: z11.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
4450
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe(
4922
+ expires_at: z16.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
4923
+ secret_mappings: z16.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
4924
+ credit_limit: z16.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
4925
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe(
4451
4926
  "Percentage of credit_limit at which to send alert emails (0-100)"
4452
4927
  ),
4453
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("Requests per minute limit")
4928
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("Requests per minute limit")
4454
4929
  },
4455
4930
  getVirtualKey: {
4456
- slug: z11.string().describe("The unique slug identifier of the virtual key to retrieve")
4931
+ slug: z16.string().describe("The unique slug identifier of the virtual key to retrieve")
4457
4932
  },
4458
4933
  updateVirtualKey: {
4459
- slug: z11.string().describe("The slug of the virtual key to update"),
4460
- name: z11.string().optional().describe("New display name for the key"),
4461
- key: z11.string().optional().describe("New provider API key value"),
4462
- note: z11.string().optional().describe("New note or description"),
4463
- credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
4464
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4465
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4466
- deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
4467
- secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
4934
+ slug: z16.string().describe("The slug of the virtual key to update"),
4935
+ name: z16.string().optional().describe("New display name for the key"),
4936
+ key: z16.string().optional().describe("New provider API key value"),
4937
+ note: z16.string().optional().describe("New note or description"),
4938
+ credit_limit: z16.coerce.number().positive().optional().describe("New credit limit for usage"),
4939
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4940
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4941
+ deployment_configurations: z16.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
4942
+ secret_mappings: z16.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
4468
4943
  },
4469
4944
  deleteVirtualKey: {
4470
- slug: z11.string().describe("The slug of the virtual key to delete")
4945
+ slug: z16.string().describe("The slug of the virtual key to delete")
4471
4946
  },
4472
4947
  createApiKey: {
4473
- type: z11.enum(["organisation", "workspace"]).describe(
4948
+ type: z16.enum(["organisation", "workspace"]).describe(
4474
4949
  "Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
4475
4950
  ),
4476
- sub_type: z11.enum(["user", "service"]).describe(
4951
+ sub_type: z16.enum(["user", "service"]).describe(
4477
4952
  "Sub-type: 'user' for user-associated keys or 'service' for service accounts"
4478
4953
  ),
4479
- name: z11.string().describe("Display name for the API key"),
4480
- description: z11.string().optional().describe("Optional description for the key"),
4481
- organisation_id: z11.string().optional().describe("Organisation UUID"),
4482
- workspace_id: z11.string().optional().describe("Workspace ID (required for workspace-type keys)"),
4483
- user_id: z11.string().optional().describe("User ID (required for user sub-type keys)"),
4484
- scopes: z11.array(z11.string()).describe(
4954
+ name: z16.string().describe("Display name for the API key"),
4955
+ description: z16.string().optional().describe("Optional description for the key"),
4956
+ organisation_id: z16.string().optional().describe("Organisation UUID"),
4957
+ workspace_id: z16.string().optional().describe("Workspace ID (required for workspace-type keys)"),
4958
+ user_id: z16.string().optional().describe("User ID (required for user sub-type keys)"),
4959
+ scopes: z16.array(z16.string()).describe(
4485
4960
  "Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
4486
4961
  ),
4487
- credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for usage"),
4488
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4489
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4490
- rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
4491
- default_config_id: z11.string().optional().describe("Default configuration ID to use with this key"),
4492
- default_metadata: z11.record(z11.string(), z11.string()).optional().describe("Default metadata key-value pairs"),
4493
- default_allow_config_override: z11.boolean().optional().describe("Allow callers to override the default config"),
4494
- alert_emails: z11.array(z11.string()).optional().describe("Email addresses for alerts"),
4495
- expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
4962
+ credit_limit: z16.coerce.number().positive().optional().describe("Credit limit for usage"),
4963
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4964
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4965
+ rate_limits: z16.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
4966
+ default_config_id: z16.string().optional().describe("Default configuration ID to use with this key"),
4967
+ default_metadata: z16.record(z16.string(), z16.string()).optional().describe("Default metadata key-value pairs"),
4968
+ default_allow_config_override: z16.boolean().optional().describe("Allow callers to override the default config"),
4969
+ alert_emails: z16.array(z16.string()).optional().describe("Email addresses for alerts"),
4970
+ expires_at: z16.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
4496
4971
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
4497
4972
  },
4498
4973
  listApiKeys: {
4499
4974
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
4500
4975
  current_page: CurrentPageSchema,
4501
- workspace_id: z11.string().optional().describe("Filter by workspace ID")
4976
+ workspace_id: z16.string().optional().describe("Filter by workspace ID")
4502
4977
  },
4503
4978
  getApiKey: {
4504
- id: z11.string().uuid().describe("The UUID of the API key to retrieve")
4979
+ id: z16.string().uuid().describe("The UUID of the API key to retrieve")
4505
4980
  },
4506
4981
  updateApiKey: {
4507
- id: z11.string().uuid().describe("The UUID of the API key to update"),
4508
- name: z11.string().optional().describe("New display name for the key"),
4509
- description: z11.string().optional().describe("New description for the key"),
4510
- scopes: z11.array(z11.string()).optional().describe("New permission scopes for the key"),
4511
- credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
4512
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4513
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4514
- rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
4515
- reset_usage: z11.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
4516
- default_config_id: z11.string().optional().describe("New default configuration ID"),
4517
- default_metadata: z11.record(z11.string(), z11.string()).optional().describe("New default metadata key-value pairs"),
4518
- default_allow_config_override: z11.boolean().optional().describe("Whether callers may override the key's default config"),
4519
- alert_emails: z11.array(z11.string()).optional().describe("New email addresses for alerts"),
4520
- expires_at: z11.iso.datetime({ offset: true }).nullable().optional().describe(
4982
+ id: z16.string().uuid().describe("The UUID of the API key to update"),
4983
+ name: z16.string().optional().describe("New display name for the key"),
4984
+ description: z16.string().optional().describe("New description for the key"),
4985
+ scopes: z16.array(z16.string()).optional().describe("New permission scopes for the key"),
4986
+ credit_limit: z16.coerce.number().positive().optional().describe("New credit limit for usage"),
4987
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4988
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4989
+ rate_limits: z16.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
4990
+ reset_usage: z16.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
4991
+ default_config_id: z16.string().optional().describe("New default configuration ID"),
4992
+ default_metadata: z16.record(z16.string(), z16.string()).optional().describe("New default metadata key-value pairs"),
4993
+ default_allow_config_override: z16.boolean().optional().describe("Whether callers may override the key's default config"),
4994
+ alert_emails: z16.array(z16.string()).optional().describe("New email addresses for alerts"),
4995
+ expires_at: z16.iso.datetime({ offset: true }).nullable().optional().describe(
4521
4996
  "New expiration date in ISO 8601 format, or null to remove expiration"
4522
4997
  ),
4523
4998
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
4524
4999
  },
4525
5000
  rotateApiKey: {
4526
- id: z11.string().uuid().describe("API key UUID obtained from list_api_keys"),
4527
- key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe(
5001
+ id: z16.string().uuid().describe("API key UUID obtained from list_api_keys"),
5002
+ key_transition_period_ms: z16.coerce.number().int().min(18e5).optional().describe(
4528
5003
  "Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
4529
5004
  )
4530
5005
  },
4531
5006
  deleteApiKey: {
4532
- id: z11.string().uuid().describe("The UUID of the API key to delete")
5007
+ id: z16.string().uuid().describe("The UUID of the API key to delete")
4533
5008
  }
4534
5009
  };
4535
- var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
5010
+ var createVirtualKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
4536
5011
  if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
4537
5012
  context.addIssue({
4538
5013
  code: "custom",
@@ -4541,17 +5016,17 @@ var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
4541
5016
  });
4542
5017
  }
4543
5018
  });
4544
- var createApiKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
5019
+ var createApiKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
4545
5020
  if (value.type === "workspace" && !value.workspace_id) {
4546
5021
  ctx.addIssue({
4547
- code: z11.ZodIssueCode.custom,
5022
+ code: z16.ZodIssueCode.custom,
4548
5023
  path: ["workspace_id"],
4549
5024
  message: "workspace_id is required when type is 'workspace'"
4550
5025
  });
4551
5026
  }
4552
5027
  if (value.sub_type === "user" && !value.user_id) {
4553
5028
  ctx.addIssue({
4554
- code: z11.ZodIssueCode.custom,
5029
+ code: z16.ZodIssueCode.custom,
4555
5030
  path: ["user_id"],
4556
5031
  message: "user_id is required when sub_type is 'user'"
4557
5032
  });
@@ -4874,43 +5349,43 @@ function registerKeysTools(server, service) {
4874
5349
  }
4875
5350
 
4876
5351
  // src/tools/labels.tools.ts
4877
- import { z as z12 } from "zod";
5352
+ import { z as z17 } from "zod";
4878
5353
  var LABELS_TOOL_SCHEMAS = {
4879
5354
  createPromptLabel: {
4880
- name: z12.string().describe("Name of the label"),
4881
- organisation_id: z12.string().optional().describe("Organisation ID to create the label in"),
4882
- workspace_id: z12.string().optional().describe("Workspace ID to create the label in"),
4883
- description: z12.string().optional().describe("Description of the label"),
4884
- color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
5355
+ name: z17.string().describe("Name of the label"),
5356
+ organisation_id: z17.string().optional().describe("Organisation ID to create the label in"),
5357
+ workspace_id: z17.string().optional().describe("Workspace ID to create the label in"),
5358
+ description: z17.string().optional().describe("Description of the label"),
5359
+ color_code: z17.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
4885
5360
  "Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
4886
5361
  )
4887
5362
  },
4888
5363
  listPromptLabels: {
4889
- organisation_id: z12.string().optional().describe("Filter by organisation ID"),
4890
- workspace_id: z12.string().optional().describe("Filter by workspace ID"),
4891
- search: z12.string().optional().describe("Search labels by name"),
5364
+ organisation_id: z17.string().optional().describe("Filter by organisation ID"),
5365
+ workspace_id: z17.string().optional().describe("Filter by workspace ID"),
5366
+ search: z17.string().optional().describe("Search labels by name"),
4892
5367
  current_page: CurrentPageSchema,
4893
5368
  page_size: PageSizeSchema
4894
5369
  },
4895
5370
  getPromptLabel: {
4896
- label_id: z12.string().describe("Label ID to retrieve"),
4897
- organisation_id: z12.string().optional().describe("Organisation ID for filtering"),
4898
- workspace_id: z12.string().optional().describe("Workspace ID for filtering")
5371
+ label_id: z17.string().describe("Label ID to retrieve"),
5372
+ organisation_id: z17.string().optional().describe("Organisation ID for filtering"),
5373
+ workspace_id: z17.string().optional().describe("Workspace ID for filtering")
4899
5374
  },
4900
5375
  updatePromptLabel: {
4901
- label_id: z12.string().describe("Label ID to update"),
4902
- name: z12.string().optional().describe("New name for the label"),
4903
- description: z12.string().optional().describe("New description"),
4904
- color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
5376
+ label_id: z17.string().describe("Label ID to update"),
5377
+ name: z17.string().optional().describe("New name for the label"),
5378
+ description: z17.string().optional().describe("New description"),
5379
+ color_code: z17.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
4905
5380
  },
4906
5381
  deletePromptLabel: {
4907
- label_id: z12.string().describe("Label ID to delete")
5382
+ label_id: z17.string().describe("Label ID to delete")
4908
5383
  }
4909
5384
  };
4910
- var createPromptLabelSchema = z12.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
5385
+ var createPromptLabelSchema = z17.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
4911
5386
  if (!value.organisation_id && !value.workspace_id) {
4912
5387
  ctx.addIssue({
4913
- code: z12.ZodIssueCode.custom,
5388
+ code: z17.ZodIssueCode.custom,
4914
5389
  message: "Either organisation_id or workspace_id is required"
4915
5390
  });
4916
5391
  }
@@ -5007,13 +5482,13 @@ function registerLabelsTools(server, service) {
5007
5482
  }
5008
5483
 
5009
5484
  // src/tools/limits.tools.ts
5010
- import { z as z13 } from "zod";
5011
- var statusSchema = z13.enum(["active", "archived"]);
5012
- var rateUnitSchema = z13.enum(["rpm", "rph", "rpd", "rpw"]);
5013
- var rateTargetSchema = z13.enum(["llm", "mcp_tools"]);
5014
- var conditionValueSchema = z13.union([z13.string(), z13.array(z13.string()).min(1)]);
5015
- var conditionSchema = z13.object({
5016
- key: z13.string().min(1).describe(
5485
+ import { z as z18 } from "zod";
5486
+ var statusSchema = z18.enum(["active", "archived"]);
5487
+ var rateUnitSchema = z18.enum(["rpm", "rph", "rpd", "rpw"]);
5488
+ var rateTargetSchema = z18.enum(["llm", "mcp_tools"]);
5489
+ var conditionValueSchema = z18.union([z18.string(), z18.array(z18.string()).min(1)]);
5490
+ var conditionSchema = z18.object({
5491
+ key: z18.string().min(1).describe(
5017
5492
  "Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
5018
5493
  ),
5019
5494
  value: conditionValueSchema.describe(
@@ -5021,8 +5496,8 @@ var conditionSchema = z13.object({
5021
5496
  ),
5022
5497
  excludes: conditionValueSchema.optional().describe("Values to exclude")
5023
5498
  });
5024
- var groupBySchema = z13.object({
5025
- key: z13.string().min(1).describe(
5499
+ var groupBySchema = z18.object({
5500
+ key: z18.string().min(1).describe(
5026
5501
  "Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
5027
5502
  )
5028
5503
  });
@@ -5032,88 +5507,88 @@ var paginationSchema = {
5032
5507
  };
5033
5508
  var LIMITS_TOOL_SCHEMAS = {
5034
5509
  listRateLimits: {
5035
- workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
5510
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5036
5511
  status: statusSchema.optional().describe("Filter by active or archived status"),
5037
- type: z13.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5512
+ type: z18.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5038
5513
  unit: rateUnitSchema.optional().describe("Filter by reset interval"),
5039
5514
  target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
5040
5515
  ...paginationSchema
5041
5516
  },
5042
5517
  getRateLimit: {
5043
- id: z13.string().min(1).describe("Rate-limit policy UUID"),
5518
+ id: z18.string().min(1).describe("Rate-limit policy UUID"),
5044
5519
  status: statusSchema.optional().describe("Include an archived policy by status")
5045
5520
  },
5046
5521
  createRateLimit: {
5047
- conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
5048
- group_by: z13.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
5049
- type: z13.enum(["requests", "tokens"]).describe("Counter type"),
5522
+ conditions: z18.array(conditionSchema).min(1).describe("Policy match conditions"),
5523
+ group_by: z18.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
5524
+ type: z18.enum(["requests", "tokens"]).describe("Counter type"),
5050
5525
  unit: rateUnitSchema.describe("Counter reset interval"),
5051
- value: z13.coerce.number().nonnegative().describe("Maximum requests or tokens"),
5052
- name: z13.string().optional().describe("Optional policy display name"),
5526
+ value: z18.coerce.number().nonnegative().describe("Maximum requests or tokens"),
5527
+ name: z18.string().optional().describe("Optional policy display name"),
5053
5528
  target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
5054
- workspace_id: z13.string().optional().describe("Workspace UUID scope"),
5055
- organisation_id: z13.string().optional().describe("Organisation UUID scope")
5529
+ workspace_id: z18.string().optional().describe("Workspace UUID scope"),
5530
+ organisation_id: z18.string().optional().describe("Organisation UUID scope")
5056
5531
  },
5057
5532
  updateRateLimit: {
5058
- id: z13.string().min(1).describe("Rate-limit policy UUID"),
5059
- name: z13.string().optional().describe("Replacement display name"),
5533
+ id: z18.string().min(1).describe("Rate-limit policy UUID"),
5534
+ name: z18.string().optional().describe("Replacement display name"),
5060
5535
  unit: rateUnitSchema.optional().describe("Replacement reset interval"),
5061
- value: z13.coerce.number().nonnegative().optional().describe("Replacement maximum"),
5062
- conditions: z13.array(conditionSchema).min(1).optional().describe("Replacement conditions")
5536
+ value: z18.coerce.number().nonnegative().optional().describe("Replacement maximum"),
5537
+ conditions: z18.array(conditionSchema).min(1).optional().describe("Replacement conditions")
5063
5538
  },
5064
5539
  deleteRateLimit: {
5065
- id: z13.string().min(1).describe("Rate-limit policy UUID to delete")
5540
+ id: z18.string().min(1).describe("Rate-limit policy UUID to delete")
5066
5541
  },
5067
5542
  listUsageLimits: {
5068
- workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
5543
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5069
5544
  status: statusSchema.optional().describe("Filter by active or archived status"),
5070
- type: z13.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5545
+ type: z18.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5071
5546
  ...paginationSchema
5072
5547
  },
5073
5548
  getUsageLimit: {
5074
- id: z13.string().min(1).describe("Usage-limit policy UUID"),
5549
+ id: z18.string().min(1).describe("Usage-limit policy UUID"),
5075
5550
  status: statusSchema.optional().describe("Include an archived policy by status"),
5076
- include_usage: z13.boolean().optional().describe("Include per-value usage counters")
5551
+ include_usage: z18.boolean().optional().describe("Include per-value usage counters")
5077
5552
  },
5078
5553
  createUsageLimit: {
5079
- conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
5080
- group_by: z13.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
5081
- type: z13.enum(["cost", "tokens"]).describe("Budget type"),
5082
- credit_limit: z13.coerce.number().nonnegative().describe("Maximum cumulative usage"),
5083
- name: z13.string().optional().describe("Optional policy display name"),
5084
- alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
5085
- periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
5086
- workspace_id: z13.string().optional().describe("Workspace UUID scope"),
5087
- organisation_id: z13.string().optional().describe("Organisation UUID scope")
5554
+ conditions: z18.array(conditionSchema).min(1).describe("Policy match conditions"),
5555
+ group_by: z18.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
5556
+ type: z18.enum(["cost", "tokens"]).describe("Budget type"),
5557
+ credit_limit: z18.coerce.number().nonnegative().describe("Maximum cumulative usage"),
5558
+ name: z18.string().optional().describe("Optional policy display name"),
5559
+ alert_threshold: z18.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
5560
+ periodic_reset: z18.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
5561
+ workspace_id: z18.string().optional().describe("Workspace UUID scope"),
5562
+ organisation_id: z18.string().optional().describe("Organisation UUID scope")
5088
5563
  },
5089
5564
  updateUsageLimit: {
5090
- id: z13.string().min(1).describe("Usage-limit policy UUID"),
5091
- name: z13.string().max(255).optional().describe("Replacement display name"),
5092
- description: z13.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
5093
- conditions: z13.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
5094
- credit_limit: z13.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
5095
- alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
5096
- periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
5097
- periodic_reset_days: z13.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
5098
- next_usage_reset_at: z13.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
5099
- reset_usage_for_value: z13.string().optional().describe("Grouped value whose usage should reset")
5565
+ id: z18.string().min(1).describe("Usage-limit policy UUID"),
5566
+ name: z18.string().max(255).optional().describe("Replacement display name"),
5567
+ description: z18.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
5568
+ conditions: z18.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
5569
+ credit_limit: z18.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
5570
+ alert_threshold: z18.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
5571
+ periodic_reset: z18.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
5572
+ periodic_reset_days: z18.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
5573
+ next_usage_reset_at: z18.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
5574
+ reset_usage_for_value: z18.string().optional().describe("Grouped value whose usage should reset")
5100
5575
  },
5101
5576
  deleteUsageLimit: {
5102
- id: z13.string().min(1).describe("Usage-limit policy UUID to archive")
5577
+ id: z18.string().min(1).describe("Usage-limit policy UUID to archive")
5103
5578
  },
5104
5579
  listUsageLimitEntities: {
5105
- limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
5106
- status: z13.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
5107
- search: z13.string().optional().describe("Search tracked values"),
5580
+ limit_id: z18.string().min(1).describe("Usage-limit policy UUID"),
5581
+ status: z18.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
5582
+ search: z18.string().optional().describe("Search tracked values"),
5108
5583
  page_size: PageSizeSchema.describe("Number of entities per page"),
5109
5584
  current_page: CurrentPageSchema.describe("Zero-based page number")
5110
5585
  },
5111
5586
  resetUsageLimitEntity: {
5112
- limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
5113
- entity_id: z13.string().min(1).describe("Tracked entity UUID to reset")
5587
+ limit_id: z18.string().min(1).describe("Usage-limit policy UUID"),
5588
+ entity_id: z18.string().min(1).describe("Tracked entity UUID to reset")
5114
5589
  }
5115
5590
  };
5116
- var updateUsageLimitSchema = z13.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5591
+ var updateUsageLimitSchema = z18.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5117
5592
  if (value.periodic_reset != null && value.periodic_reset_days != null) {
5118
5593
  context.addIssue({
5119
5594
  code: "custom",
@@ -5253,8 +5728,8 @@ function registerLimitsTools(server, service) {
5253
5728
  }
5254
5729
 
5255
5730
  // src/tools/logging.tools.ts
5256
- import { z as z14 } from "zod";
5257
- var logExportFieldSchema = z14.enum([
5731
+ import { z as z19 } from "zod";
5732
+ var logExportFieldSchema = z19.enum([
5258
5733
  "id",
5259
5734
  "trace_id",
5260
5735
  "created_at",
@@ -5277,12 +5752,12 @@ var logExportFieldSchema = z14.enum([
5277
5752
  "metadata"
5278
5753
  ]);
5279
5754
  var getLogShape = {
5280
- log_id: z14.string().describe("Gateway log ID to retrieve"),
5281
- path_format: z14.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
5282
- created_at: z14.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
5283
- type: z14.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
5755
+ log_id: z19.string().describe("Gateway log ID to retrieve"),
5756
+ path_format: z19.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
5757
+ created_at: z19.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
5758
+ type: z19.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
5284
5759
  };
5285
- var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
5760
+ var getLogSchema = z19.object(getLogShape).superRefine((input, context) => {
5286
5761
  if (input.path_format === "v2" && input.created_at === void 0) {
5287
5762
  context.addIssue({
5288
5763
  code: "custom",
@@ -5293,67 +5768,67 @@ var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
5293
5768
  });
5294
5769
  var LOGGING_TOOL_SCHEMAS = {
5295
5770
  getLogExportFieldRestrictions: {
5296
- workspace_id: z14.string().describe("Workspace ID whose export field restrictions should be read")
5771
+ workspace_id: z19.string().describe("Workspace ID whose export field restrictions should be read")
5297
5772
  },
5298
5773
  insertLog: {
5299
- request_url: z14.string().optional().describe("The endpoint URL being called"),
5300
- request_provider: z14.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
5301
- request_method: z14.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
5302
- request_headers: z14.record(z14.string(), z14.string()).optional().describe("Request headers as key-value pairs"),
5303
- request_body: z14.record(z14.string(), z14.unknown()).optional().describe("Request payload/body"),
5304
- response_status: z14.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
5305
- response_headers: z14.record(z14.string(), z14.string()).optional().describe("Response headers as key-value pairs"),
5306
- response_body: z14.record(z14.string(), z14.unknown()).optional().describe("Response payload/body"),
5307
- response_time: z14.coerce.number().optional().describe("Response latency in milliseconds"),
5308
- streaming_mode: z14.boolean().optional().default(false).describe("Whether the response was streamed"),
5309
- metadata_organization: z14.string().optional().describe("Organization identifier for the log"),
5310
- metadata_user: z14.string().optional().describe("User identifier for the log"),
5311
- metadata_trace_id: z14.string().optional().describe("Trace ID for distributed tracing"),
5312
- metadata_span_id: z14.string().optional().describe("Span ID for tracing"),
5313
- metadata_span_name: z14.string().optional().describe("Span name for tracing"),
5314
- metadata_parent_span_id: z14.string().optional().describe("Parent span ID for tracing"),
5315
- metadata_custom: z14.record(z14.string(), z14.unknown()).optional().describe("Additional custom metadata key-value pairs")
5774
+ request_url: z19.string().optional().describe("The endpoint URL being called"),
5775
+ request_provider: z19.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
5776
+ request_method: z19.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
5777
+ request_headers: z19.record(z19.string(), z19.string()).optional().describe("Request headers as key-value pairs"),
5778
+ request_body: z19.record(z19.string(), z19.unknown()).optional().describe("Request payload/body"),
5779
+ response_status: z19.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
5780
+ response_headers: z19.record(z19.string(), z19.string()).optional().describe("Response headers as key-value pairs"),
5781
+ response_body: z19.record(z19.string(), z19.unknown()).optional().describe("Response payload/body"),
5782
+ response_time: z19.coerce.number().optional().describe("Response latency in milliseconds"),
5783
+ streaming_mode: z19.boolean().optional().default(false).describe("Whether the response was streamed"),
5784
+ metadata_organization: z19.string().optional().describe("Organization identifier for the log"),
5785
+ metadata_user: z19.string().optional().describe("User identifier for the log"),
5786
+ metadata_trace_id: z19.string().optional().describe("Trace ID for distributed tracing"),
5787
+ metadata_span_id: z19.string().optional().describe("Span ID for tracing"),
5788
+ metadata_span_name: z19.string().optional().describe("Span name for tracing"),
5789
+ metadata_parent_span_id: z19.string().optional().describe("Parent span ID for tracing"),
5790
+ metadata_custom: z19.record(z19.string(), z19.unknown()).optional().describe("Additional custom metadata key-value pairs")
5316
5791
  },
5317
5792
  createLogExport: {
5318
- workspace_id: z14.string().optional().describe("Workspace ID for the export"),
5319
- description: z14.string().optional().describe("Human-readable description for the export job"),
5320
- time_min: z14.string().describe(
5793
+ workspace_id: z19.string().optional().describe("Workspace ID for the export"),
5794
+ description: z19.string().optional().describe("Human-readable description for the export job"),
5795
+ time_min: z19.string().describe(
5321
5796
  "Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
5322
5797
  ),
5323
- time_max: z14.string().describe(
5798
+ time_max: z19.string().describe(
5324
5799
  "Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
5325
5800
  ),
5326
- cost_min: z14.coerce.number().optional().describe("Minimum cost filter"),
5327
- cost_max: z14.coerce.number().optional().describe("Maximum cost filter"),
5328
- total_units_min: z14.coerce.number().optional().describe("Minimum total units (tokens) filter"),
5329
- total_units_max: z14.coerce.number().optional().describe("Maximum total units (tokens) filter"),
5330
- ai_model: z14.array(z14.string()).optional().describe("Filter by specific AI model names"),
5331
- requested_fields: z14.array(logExportFieldSchema).describe(
5801
+ cost_min: z19.coerce.number().optional().describe("Minimum cost filter"),
5802
+ cost_max: z19.coerce.number().optional().describe("Maximum cost filter"),
5803
+ total_units_min: z19.coerce.number().optional().describe("Minimum total units (tokens) filter"),
5804
+ total_units_max: z19.coerce.number().optional().describe("Maximum total units (tokens) filter"),
5805
+ ai_model: z19.array(z19.string()).optional().describe("Filter by specific AI model names"),
5806
+ requested_fields: z19.array(logExportFieldSchema).describe(
5332
5807
  "Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
5333
5808
  )
5334
5809
  },
5335
5810
  listLogExports: {
5336
- workspace_id: z14.string().describe("Workspace ID to list exports for (required)")
5811
+ workspace_id: z19.string().describe("Workspace ID to list exports for (required)")
5337
5812
  },
5338
5813
  getLogExport: {
5339
- export_id: z14.string().describe("The unique ID of the log export")
5814
+ export_id: z19.string().describe("The unique ID of the log export")
5340
5815
  },
5341
5816
  startLogExport: {
5342
- export_id: z14.string().describe("The unique ID of the log export to start")
5817
+ export_id: z19.string().describe("The unique ID of the log export to start")
5343
5818
  },
5344
5819
  cancelLogExport: {
5345
- export_id: z14.string().describe("The unique ID of the log export to cancel")
5820
+ export_id: z19.string().describe("The unique ID of the log export to cancel")
5346
5821
  },
5347
5822
  downloadLogExport: {
5348
- export_id: z14.string().describe("The unique ID of the log export to download")
5823
+ export_id: z19.string().describe("The unique ID of the log export to download")
5349
5824
  },
5350
5825
  updateLogExport: {
5351
- export_id: z14.string().describe("The unique ID of the log export to update"),
5352
- workspace_id: z14.string().optional().describe("Workspace ID for the export"),
5353
- time_of_generation_max: z14.string().optional().describe(
5826
+ export_id: z19.string().describe("The unique ID of the log export to update"),
5827
+ workspace_id: z19.string().optional().describe("Workspace ID for the export"),
5828
+ time_of_generation_max: z19.string().optional().describe(
5354
5829
  "Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
5355
5830
  ),
5356
- requested_fields: z14.array(logExportFieldSchema).optional().describe(
5831
+ requested_fields: z19.array(logExportFieldSchema).optional().describe(
5357
5832
  "Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
5358
5833
  )
5359
5834
  }
@@ -5579,7 +6054,7 @@ function registerLoggingTools(server, service) {
5579
6054
  }
5580
6055
 
5581
6056
  // src/tools/mcp-integrations.tools.ts
5582
- import { z as z15 } from "zod";
6057
+ import { z as z20 } from "zod";
5583
6058
  var mcpSecretMappingSchema = createSecretMappingSchema({
5584
6059
  allowKeyTarget: false,
5585
6060
  targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
@@ -5589,10 +6064,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
5589
6064
  var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
5590
6065
  mcpSecretMappingSchema
5591
6066
  );
5592
- var mcpConfigurationsSchema = z15.record(z15.string(), z15.unknown()).superRefine((value, ctx) => {
6067
+ var mcpConfigurationsSchema = z20.record(z20.string(), z20.unknown()).superRefine((value, ctx) => {
5593
6068
  if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
5594
6069
  ctx.addIssue({
5595
- code: z15.ZodIssueCode.custom,
6070
+ code: z20.ZodIssueCode.custom,
5596
6071
  path: ["custom_headers"],
5597
6072
  message: "configurations.custom_headers must be a string-to-string record"
5598
6073
  });
@@ -5604,31 +6079,31 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5604
6079
  page_size: pageSizeSchema(1e3).describe(
5605
6080
  "Number of results per page (max 1000)"
5606
6081
  ),
5607
- workspace_id: z15.string().optional().describe("Filter by workspace ID"),
5608
- organisation_id: z15.string().optional().describe("Filter by organisation UUID"),
5609
- type: z15.enum(["workspace", "organisation", "all"]).optional().describe(
6082
+ workspace_id: z20.string().optional().describe("Filter by workspace ID"),
6083
+ organisation_id: z20.string().optional().describe("Filter by organisation UUID"),
6084
+ type: z20.enum(["workspace", "organisation", "all"]).optional().describe(
5610
6085
  "Filter by workspace, organisation, or all integration ownership"
5611
6086
  ),
5612
- search: z15.string().optional().describe("Search integrations by name")
6087
+ search: z20.string().optional().describe("Search integrations by name")
5613
6088
  },
5614
6089
  createMcpIntegration: {
5615
- name: z15.string().describe("Display name for the MCP integration"),
5616
- url: z15.string().describe("URL endpoint of the MCP server to integrate"),
5617
- auth_type: z15.string().min(1).describe(
6090
+ name: z20.string().describe("Display name for the MCP integration"),
6091
+ url: z20.string().describe("URL endpoint of the MCP server to integrate"),
6092
+ auth_type: z20.string().min(1).describe(
5618
6093
  "Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5619
6094
  ),
5620
- transport: z15.enum(["http", "sse"]).describe(
6095
+ transport: z20.enum(["http", "sse"]).describe(
5621
6096
  "MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
5622
6097
  ),
5623
- slug: z15.string().optional().describe("Custom slug. Auto-generated if omitted"),
5624
- description: z15.string().optional().describe("Description of the MCP integration"),
5625
- custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
6098
+ slug: z20.string().optional().describe("Custom slug. Auto-generated if omitted"),
6099
+ description: z20.string().optional().describe("Description of the MCP integration"),
6100
+ custom_headers: z20.record(z20.string(), z20.string()).optional().describe(
5626
6101
  'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
5627
6102
  ),
5628
6103
  configurations: mcpConfigurationsSchema.optional().describe(
5629
6104
  "Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
5630
6105
  ),
5631
- workspace_id: z15.string().optional().describe(
6106
+ workspace_id: z20.string().optional().describe(
5632
6107
  "Workspace ID \u2014 required when using organization admin API keys"
5633
6108
  ),
5634
6109
  secret_mappings: mcpSecretMappingsSchema.optional().describe(
@@ -5636,18 +6111,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5636
6111
  )
5637
6112
  },
5638
6113
  getMcpIntegration: {
5639
- id: z15.string().describe("The MCP integration ID or slug to retrieve")
6114
+ id: z20.string().describe("The MCP integration ID or slug to retrieve")
5640
6115
  },
5641
6116
  updateMcpIntegration: {
5642
- id: z15.string().describe("The MCP integration ID or slug to update"),
5643
- name: z15.string().optional().describe("New display name"),
5644
- description: z15.string().optional().describe("New description"),
5645
- url: z15.string().optional().describe("New URL endpoint"),
5646
- auth_type: z15.string().min(1).optional().describe(
6117
+ id: z20.string().describe("The MCP integration ID or slug to update"),
6118
+ name: z20.string().optional().describe("New display name"),
6119
+ description: z20.string().optional().describe("New description"),
6120
+ url: z20.string().optional().describe("New URL endpoint"),
6121
+ auth_type: z20.string().min(1).optional().describe(
5647
6122
  "New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5648
6123
  ),
5649
- transport: z15.enum(["http", "sse"]).optional().describe("New transport protocol"),
5650
- custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
6124
+ transport: z20.enum(["http", "sse"]).optional().describe("New transport protocol"),
6125
+ custom_headers: z20.record(z20.string(), z20.string()).optional().describe(
5651
6126
  "New custom headers for authentication. Sent via configurations.custom_headers"
5652
6127
  ),
5653
6128
  configurations: mcpConfigurationsSchema.optional().describe(
@@ -5658,50 +6133,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5658
6133
  )
5659
6134
  },
5660
6135
  deleteMcpIntegration: {
5661
- id: z15.string().describe("The MCP integration ID or slug to delete")
6136
+ id: z20.string().describe("The MCP integration ID or slug to delete")
5662
6137
  },
5663
6138
  getMcpIntegrationMetadata: {
5664
- id: z15.string().describe("The MCP integration ID or slug")
6139
+ id: z20.string().describe("The MCP integration ID or slug")
5665
6140
  },
5666
6141
  listMcpIntegrationCapabilities: {
5667
- id: z15.string().describe("The MCP integration ID or slug")
6142
+ id: z20.string().describe("The MCP integration ID or slug")
5668
6143
  },
5669
6144
  updateMcpIntegrationCapabilities: {
5670
- id: z15.string().describe("The MCP integration ID or slug"),
5671
- capabilities: z15.array(
5672
- z15.object({
5673
- name: z15.string().describe("Capability name"),
5674
- type: z15.enum(["tool", "prompt", "resource"]).describe("Capability type"),
5675
- enabled: z15.boolean().describe("Whether to enable the capability")
6145
+ id: z20.string().describe("The MCP integration ID or slug"),
6146
+ capabilities: z20.array(
6147
+ z20.object({
6148
+ name: z20.string().describe("Capability name"),
6149
+ type: z20.enum(["tool", "prompt", "resource"]).describe("Capability type"),
6150
+ enabled: z20.boolean().describe("Whether to enable the capability")
5676
6151
  })
5677
6152
  ).min(1).describe("Array of capability updates")
5678
6153
  },
5679
6154
  listMcpIntegrationWorkspaces: {
5680
- id: z15.string().describe("The MCP integration ID or slug")
6155
+ id: z20.string().describe("The MCP integration ID or slug")
5681
6156
  },
5682
6157
  updateMcpIntegrationWorkspaces: {
5683
- id: z15.string().describe("The MCP integration ID or slug"),
5684
- workspaces: z15.array(
5685
- z15.object({
5686
- id: z15.string().describe("Workspace ID"),
5687
- enabled: z15.boolean().describe("Whether workspace has access")
6158
+ id: z20.string().describe("The MCP integration ID or slug"),
6159
+ workspaces: z20.array(
6160
+ z20.object({
6161
+ id: z20.string().describe("Workspace ID"),
6162
+ enabled: z20.boolean().describe("Whether workspace has access")
5688
6163
  })
5689
6164
  ).min(1).describe("Array of workspace access updates")
5690
6165
  }
5691
6166
  };
5692
- var createMcpIntegrationSchema = z15.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
6167
+ var createMcpIntegrationSchema = z20.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
5693
6168
  const configuredHeaders = value.configurations?.custom_headers;
5694
6169
  if (value.auth_type === "headers" && (!value.custom_headers || Object.keys(value.custom_headers).length === 0) && (!isStringRecord(configuredHeaders) || Object.keys(configuredHeaders).length === 0) && !value.secret_mappings?.some(
5695
6170
  (mapping) => mapping.target_field === "configurations.custom_headers"
5696
6171
  )) {
5697
6172
  ctx.addIssue({
5698
- code: z15.ZodIssueCode.custom,
6173
+ code: z20.ZodIssueCode.custom,
5699
6174
  path: [],
5700
6175
  message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
5701
6176
  });
5702
6177
  }
5703
6178
  });
5704
- var updateMcpIntegrationSchema = z15.object(
6179
+ var updateMcpIntegrationSchema = z20.object(
5705
6180
  MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
5706
6181
  );
5707
6182
  function isRecord2(value) {
@@ -5942,68 +6417,68 @@ function registerMcpIntegrationsTools(server, service) {
5942
6417
  }
5943
6418
 
5944
6419
  // src/tools/mcp-servers.tools.ts
5945
- import { z as z16 } from "zod";
6420
+ import { z as z21 } from "zod";
5946
6421
  var MCP_SERVERS_TOOL_SCHEMAS = {
5947
6422
  listMcpServers: {
5948
6423
  current_page: CurrentPageSchema,
5949
6424
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
5950
- workspace_id: z16.string().optional().describe("Filter by workspace ID")
6425
+ workspace_id: z21.string().optional().describe("Filter by workspace ID")
5951
6426
  },
5952
6427
  createMcpServer: {
5953
- name: z16.string().describe("Display name for the MCP server"),
5954
- mcp_integration_id: z16.string().describe("ID or slug of the MCP integration this server belongs to"),
5955
- slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
5956
- description: z16.string().optional().describe("Description of the MCP server")
6428
+ name: z21.string().describe("Display name for the MCP server"),
6429
+ mcp_integration_id: z21.string().describe("ID or slug of the MCP integration this server belongs to"),
6430
+ slug: z21.string().optional().describe("Custom slug. Auto-generated if omitted"),
6431
+ description: z21.string().optional().describe("Description of the MCP server")
5957
6432
  },
5958
6433
  getMcpServer: {
5959
- id: z16.string().describe("The MCP server ID or slug to retrieve")
6434
+ id: z21.string().describe("The MCP server ID or slug to retrieve")
5960
6435
  },
5961
6436
  updateMcpServer: {
5962
- id: z16.string().describe("The MCP server ID or slug to update"),
5963
- name: z16.string().optional().describe("New display name"),
5964
- description: z16.string().optional().describe("New description")
6437
+ id: z21.string().describe("The MCP server ID or slug to update"),
6438
+ name: z21.string().optional().describe("New display name"),
6439
+ description: z21.string().optional().describe("New description")
5965
6440
  },
5966
6441
  deleteMcpServer: {
5967
- id: z16.string().describe("The MCP server ID or slug to delete")
6442
+ id: z21.string().describe("The MCP server ID or slug to delete")
5968
6443
  },
5969
6444
  testMcpServer: {
5970
- id: z16.string().describe("The MCP server ID or slug to test")
6445
+ id: z21.string().describe("The MCP server ID or slug to test")
5971
6446
  },
5972
6447
  listMcpServerCapabilities: {
5973
- id: z16.string().describe("The MCP server ID or slug"),
6448
+ id: z21.string().describe("The MCP server ID or slug"),
5974
6449
  current_page: CurrentPageSchema,
5975
6450
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
5976
6451
  },
5977
6452
  updateMcpServerCapabilities: {
5978
- id: z16.string().describe("The MCP server ID or slug"),
5979
- capabilities: z16.array(
5980
- z16.object({
5981
- name: z16.string().describe("Capability name"),
5982
- type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
5983
- enabled: z16.boolean().describe("Whether to enable the capability")
6453
+ id: z21.string().describe("The MCP server ID or slug"),
6454
+ capabilities: z21.array(
6455
+ z21.object({
6456
+ name: z21.string().describe("Capability name"),
6457
+ type: z21.enum(["tool", "prompt", "resource"]).describe("Capability type"),
6458
+ enabled: z21.boolean().describe("Whether to enable the capability")
5984
6459
  })
5985
6460
  ).min(1).describe("Array of capability updates")
5986
6461
  },
5987
6462
  listMcpServerUserAccess: {
5988
- id: z16.string().describe("The MCP server ID or slug"),
6463
+ id: z21.string().describe("The MCP server ID or slug"),
5989
6464
  current_page: CurrentPageSchema,
5990
6465
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
5991
6466
  },
5992
6467
  updateMcpServerUserAccess: {
5993
- id: z16.string().describe("The MCP server ID or slug"),
5994
- users: z16.array(
5995
- z16.object({
5996
- user_id: z16.string().describe("User ID"),
5997
- enabled: z16.boolean().describe("Whether user has access")
6468
+ id: z21.string().describe("The MCP server ID or slug"),
6469
+ users: z21.array(
6470
+ z21.object({
6471
+ user_id: z21.string().describe("User ID"),
6472
+ enabled: z21.boolean().describe("Whether user has access")
5998
6473
  })
5999
6474
  ).min(1).describe("Array of user access updates")
6000
6475
  },
6001
6476
  listMcpServerConnections: {
6002
- id: z16.string().describe("MCP server ID or slug whose connections to list"),
6003
- user_id: z16.string().uuid().optional().describe(
6477
+ id: z21.string().describe("MCP server ID or slug whose connections to list"),
6478
+ user_id: z21.string().uuid().optional().describe(
6004
6479
  "User UUID to filter; user-scoped keys default to their own user when omitted"
6005
6480
  ),
6006
- workspace_id: z16.string().optional().describe(
6481
+ workspace_id: z21.string().optional().describe(
6007
6482
  "Workspace ID or slug; required with an organisation admin API key"
6008
6483
  ),
6009
6484
  current_page: CurrentPageSchema.describe(
@@ -6014,11 +6489,11 @@ var MCP_SERVERS_TOOL_SCHEMAS = {
6014
6489
  )
6015
6490
  },
6016
6491
  disconnectMcpServerConnection: {
6017
- id: z16.string().describe("MCP server ID or slug containing the active connection"),
6018
- user_id: z16.string().uuid().optional().describe(
6492
+ id: z21.string().describe("MCP server ID or slug containing the active connection"),
6493
+ user_id: z21.string().uuid().optional().describe(
6019
6494
  "User UUID to disconnect; required with service keys and derived from user keys when omitted"
6020
6495
  ),
6021
- workspace_id: z16.string().optional().describe(
6496
+ workspace_id: z21.string().optional().describe(
6022
6497
  "Workspace ID or slug; required with an organisation admin API key"
6023
6498
  )
6024
6499
  }
@@ -6245,40 +6720,40 @@ function registerMcpServersTools(server, service) {
6245
6720
  }
6246
6721
 
6247
6722
  // src/tools/partials.tools.ts
6248
- import { z as z17 } from "zod";
6723
+ import { z as z22 } from "zod";
6249
6724
  var PARTIALS_TOOL_SCHEMAS = {
6250
6725
  createPromptPartial: {
6251
- name: z17.string().describe("Display name for the partial"),
6252
- string: z17.string().describe("The partial content/template string"),
6253
- workspace_id: z17.string().optional().describe(
6726
+ name: z22.string().describe("Display name for the partial"),
6727
+ string: z22.string().describe("The partial content/template string"),
6728
+ workspace_id: z22.string().optional().describe(
6254
6729
  "Workspace ID to create partial in (required for org-level API keys)"
6255
6730
  ),
6256
- version_description: z17.string().optional().describe("Description for this version")
6731
+ version_description: z22.string().optional().describe("Description for this version")
6257
6732
  },
6258
6733
  listPromptPartials: {
6259
- collection_id: z17.string().optional().describe(
6734
+ collection_id: z22.string().optional().describe(
6260
6735
  "Filter by collection ID. Optional \u2014 omit to list all partials across collections"
6261
6736
  )
6262
6737
  },
6263
6738
  getPromptPartial: {
6264
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to retrieve")
6739
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to retrieve")
6265
6740
  },
6266
6741
  updatePromptPartial: {
6267
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to update"),
6268
- name: z17.string().optional().describe("New display name for the partial"),
6269
- string: z17.string().optional().describe("New content for the partial"),
6270
- description: z17.string().optional().describe("Description for this version"),
6271
- status: z17.enum(["active", "archived"]).optional().describe("New status for the partial")
6742
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to update"),
6743
+ name: z22.string().optional().describe("New display name for the partial"),
6744
+ string: z22.string().optional().describe("New content for the partial"),
6745
+ description: z22.string().optional().describe("Description for this version"),
6746
+ status: z22.enum(["active", "archived"]).optional().describe("New status for the partial")
6272
6747
  },
6273
6748
  deletePromptPartial: {
6274
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to delete")
6749
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to delete")
6275
6750
  },
6276
6751
  listPartialVersions: {
6277
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to list versions for")
6752
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to list versions for")
6278
6753
  },
6279
6754
  publishPartial: {
6280
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug"),
6281
- version: z17.coerce.number().positive().describe("Version number to publish as default")
6755
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug"),
6756
+ version: z22.coerce.number().positive().describe("Version number to publish as default")
6282
6757
  }
6283
6758
  };
6284
6759
  function registerPartialsTools(server, service) {
@@ -6415,101 +6890,101 @@ function registerPartialsTools(server, service) {
6415
6890
  }
6416
6891
 
6417
6892
  // src/tools/prompts.tools.ts
6418
- import { z as z18 } from "zod";
6419
- var PROMPT_VARIABLES_SCHEMA = z18.record(z18.string(), z18.union([z18.string(), z18.number(), z18.boolean()])).describe("Variable values to substitute into the template");
6420
- var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z18.object({
6421
- type: z18.string().describe("Content block type"),
6422
- text: z18.string().optional().describe("Text content for text-based blocks")
6893
+ import { z as z23 } from "zod";
6894
+ var PROMPT_VARIABLES_SCHEMA = z23.record(z23.string(), z23.union([z23.string(), z23.number(), z23.boolean()])).describe("Variable values to substitute into the template");
6895
+ var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z23.object({
6896
+ type: z23.string().describe("Content block type"),
6897
+ text: z23.string().optional().describe("Text content for text-based blocks")
6423
6898
  }).passthrough().describe("Content block within a structured chat message");
6424
- var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z18.object({
6425
- role: z18.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
6426
- content: z18.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
6899
+ var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z23.object({
6900
+ role: z23.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
6901
+ content: z23.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
6427
6902
  }).passthrough().describe("Structured chat message in a prompt template");
6428
6903
  var PROMPTS_TOOL_SCHEMAS = {
6429
6904
  createPrompt: {
6430
- name: z18.string().describe("Display name for the prompt"),
6431
- collection_id: z18.string().describe(
6905
+ name: z23.string().describe("Display name for the prompt"),
6906
+ collection_id: z23.string().describe(
6432
6907
  "Collection ID to organize the prompt in (use list_collections to find)"
6433
6908
  ),
6434
- string: z18.string().optional().describe(
6909
+ string: z23.string().optional().describe(
6435
6910
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6436
6911
  ),
6437
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6912
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6438
6913
  "Structured chat template alias. Serialized to the legacy string format before creation."
6439
6914
  ),
6440
- parameters: z18.record(z18.string(), z18.unknown()).describe("Default values for template variables"),
6441
- virtual_key: z18.string().describe("Virtual key slug for model access"),
6442
- model: z18.string().optional().describe(
6915
+ parameters: z23.record(z23.string(), z23.unknown()).describe("Default values for template variables"),
6916
+ virtual_key: z23.string().describe("Virtual key slug for model access"),
6917
+ model: z23.string().optional().describe(
6443
6918
  "Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
6444
6919
  ),
6445
- ai_model_id: z18.string().optional().describe(
6920
+ ai_model_id: z23.string().optional().describe(
6446
6921
  "AI model ID (alternative to model). Required unless model or finetune_id is provided"
6447
6922
  ),
6448
- finetune_id: z18.string().optional().describe(
6923
+ finetune_id: z23.string().optional().describe(
6449
6924
  "Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
6450
6925
  ),
6451
- version_description: z18.string().optional().describe("Description for this prompt version"),
6452
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
6453
- functions: z18.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
6454
- tools: z18.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
6926
+ version_description: z23.string().optional().describe("Description for this prompt version"),
6927
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
6928
+ functions: z23.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
6929
+ tools: z23.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
6455
6930
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6456
- is_raw_template: z18.boolean().optional().describe("Render the stored template as a raw structural template"),
6457
- dry_run: z18.boolean().optional().describe("When true, validate without creating")
6931
+ is_raw_template: z23.boolean().optional().describe("Render the stored template as a raw structural template"),
6932
+ dry_run: z23.boolean().optional().describe("When true, validate without creating")
6458
6933
  },
6459
6934
  listPrompts: {
6460
- collection_id: z18.string().optional().describe(
6935
+ collection_id: z23.string().optional().describe(
6461
6936
  "Filter by collection ID (recommended for app-specific prompts)"
6462
6937
  ),
6463
- workspace_id: z18.string().optional().describe("Filter by workspace ID"),
6464
- search: z18.string().optional().describe("Search prompts by name"),
6938
+ workspace_id: z23.string().optional().describe("Filter by workspace ID"),
6939
+ search: z23.string().optional().describe("Search prompts by name"),
6465
6940
  current_page: CurrentPageSchema,
6466
6941
  page_size: PageSizeSchema
6467
6942
  },
6468
6943
  getPrompt: {
6469
- prompt_id: z18.string().describe("Prompt ID or slug to retrieve")
6944
+ prompt_id: z23.string().describe("Prompt ID or slug to retrieve")
6470
6945
  },
6471
6946
  updatePrompt: {
6472
- prompt_id: z18.string().describe("Prompt ID or slug to update"),
6473
- name: z18.string().optional().describe("New display name for the prompt"),
6474
- collection_id: z18.string().optional().describe("Move to a different collection"),
6475
- string: z18.string().optional().describe(
6947
+ prompt_id: z23.string().describe("Prompt ID or slug to update"),
6948
+ name: z23.string().optional().describe("New display name for the prompt"),
6949
+ collection_id: z23.string().optional().describe("Move to a different collection"),
6950
+ string: z23.string().optional().describe(
6476
6951
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6477
6952
  ),
6478
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6953
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6479
6954
  "Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
6480
6955
  ),
6481
- parameters: z18.record(z18.string(), z18.unknown()).optional().describe("New default values for template variables"),
6482
- model: z18.string().optional().describe("New model identifier"),
6483
- virtual_key: z18.string().optional().describe("New virtual key slug"),
6484
- version_description: z18.string().optional().describe("Description for this version"),
6485
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("New metadata"),
6486
- functions: z18.array(PromptFunctionSchema).optional().describe("New function definitions"),
6487
- tools: z18.array(PromptToolSchema).optional().describe("New tool definitions"),
6956
+ parameters: z23.record(z23.string(), z23.unknown()).optional().describe("New default values for template variables"),
6957
+ model: z23.string().optional().describe("New model identifier"),
6958
+ virtual_key: z23.string().optional().describe("New virtual key slug"),
6959
+ version_description: z23.string().optional().describe("Description for this version"),
6960
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("New metadata"),
6961
+ functions: z23.array(PromptFunctionSchema).optional().describe("New function definitions"),
6962
+ tools: z23.array(PromptToolSchema).optional().describe("New tool definitions"),
6488
6963
  tool_choice: ToolChoiceSchema.optional().describe(
6489
6964
  "New tool choice strategy"
6490
6965
  ),
6491
- is_raw_template: z18.boolean().optional().describe("Enable or disable raw structural-template rendering"),
6492
- dry_run: z18.boolean().optional().describe("When true, validate without updating")
6966
+ is_raw_template: z23.boolean().optional().describe("Enable or disable raw structural-template rendering"),
6967
+ dry_run: z23.boolean().optional().describe("When true, validate without updating")
6493
6968
  },
6494
6969
  deletePrompt: {
6495
- prompt_id: z18.string().describe("Prompt ID or slug to delete")
6970
+ prompt_id: z23.string().describe("Prompt ID or slug to delete")
6496
6971
  },
6497
6972
  publishPrompt: {
6498
- prompt_id: z18.string().describe("Prompt ID or slug to publish"),
6499
- version: z18.coerce.number().positive().describe("Version number to publish as the default")
6973
+ prompt_id: z23.string().describe("Prompt ID or slug to publish"),
6974
+ version: z23.coerce.number().positive().describe("Version number to publish as the default")
6500
6975
  },
6501
6976
  listPromptVersions: {
6502
- prompt_id: z18.string().describe("Prompt ID or slug to list versions for")
6977
+ prompt_id: z23.string().describe("Prompt ID or slug to list versions for")
6503
6978
  },
6504
6979
  renderPrompt: {
6505
- prompt_id: z18.string().describe("Prompt ID or slug to render"),
6980
+ prompt_id: z23.string().describe("Prompt ID or slug to render"),
6506
6981
  variables: PROMPT_VARIABLES_SCHEMA,
6507
6982
  hyperparameters: HyperparametersSchema.optional().describe(
6508
6983
  "Override default hyperparameters"
6509
6984
  )
6510
6985
  },
6511
6986
  runPromptCompletion: {
6512
- prompt_id: z18.string().describe("Prompt ID or slug to execute"),
6987
+ prompt_id: z23.string().describe("Prompt ID or slug to execute"),
6513
6988
  variables: PROMPT_VARIABLES_SCHEMA,
6514
6989
  metadata: BillingMetadataSchema.describe(
6515
6990
  "Billing metadata - client_id, app, env are REQUIRED for cost attribution"
@@ -6519,77 +6994,77 @@ var PROMPTS_TOOL_SCHEMAS = {
6519
6994
  )
6520
6995
  },
6521
6996
  migratePrompt: {
6522
- name: z18.string().describe("Prompt name to create or find for update"),
6997
+ name: z23.string().describe("Prompt name to create or find for update"),
6523
6998
  app: PromptAppIdentifierSchema,
6524
6999
  env: PromptEnvironmentIdentifierSchema,
6525
- collection_id: z18.string().describe("Collection ID to search in and create under"),
6526
- string: z18.string().optional().describe(
7000
+ collection_id: z23.string().describe("Collection ID to search in and create under"),
7001
+ string: z23.string().optional().describe(
6527
7002
  "Legacy prompt template string with {{variable}} mustache syntax."
6528
7003
  ),
6529
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
7004
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6530
7005
  "Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
6531
7006
  ),
6532
- parameters: z18.record(z18.string(), z18.unknown()).describe("Default values for template variables"),
6533
- virtual_key: z18.string().describe("Virtual key slug for model access"),
6534
- model: z18.string().optional().describe("Model identifier"),
6535
- version_description: z18.string().optional().describe("Description for this version"),
6536
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("Additional custom metadata"),
6537
- functions: z18.array(PromptFunctionSchema).optional().describe("Function definitions"),
6538
- tools: z18.array(PromptToolSchema).optional().describe("Tool definitions"),
7007
+ parameters: z23.record(z23.string(), z23.unknown()).describe("Default values for template variables"),
7008
+ virtual_key: z23.string().describe("Virtual key slug for model access"),
7009
+ model: z23.string().optional().describe("Model identifier"),
7010
+ version_description: z23.string().optional().describe("Description for this version"),
7011
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("Additional custom metadata"),
7012
+ functions: z23.array(PromptFunctionSchema).optional().describe("Function definitions"),
7013
+ tools: z23.array(PromptToolSchema).optional().describe("Tool definitions"),
6539
7014
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6540
- is_raw_template: z18.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
6541
- dry_run: z18.boolean().optional().describe(
7015
+ is_raw_template: z23.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
7016
+ dry_run: z23.boolean().optional().describe(
6542
7017
  "When true, only check what action would be taken without making changes"
6543
7018
  )
6544
7019
  },
6545
7020
  promotePrompt: {
6546
- source_prompt_id: z18.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
6547
- target_collection_id: z18.string().describe("Target collection ID for the promoted prompt"),
6548
- target_name: z18.string().optional().describe(
7021
+ source_prompt_id: z23.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
7022
+ target_collection_id: z23.string().describe("Target collection ID for the promoted prompt"),
7023
+ target_name: z23.string().optional().describe(
6549
7024
  "Target prompt name (defaults to source name with env suffix replaced)"
6550
7025
  ),
6551
7026
  target_env: PromptEnvironmentIdentifierSchema,
6552
- virtual_key: z18.string().optional().describe(
7027
+ virtual_key: z23.string().optional().describe(
6553
7028
  "Virtual key ID to use (defaults to source prompt's virtual_key)"
6554
7029
  )
6555
7030
  },
6556
7031
  validateCompletionMetadata: {
6557
- client_id: z18.string().optional().describe("Client ID for billing attribution"),
7032
+ client_id: z23.string().optional().describe("Client ID for billing attribution"),
6558
7033
  app: PromptAppIdentifierSchema.optional(),
6559
7034
  env: PromptEnvironmentIdentifierSchema.optional(),
6560
- project_id: z18.string().optional().describe("Project ID for granular billing"),
6561
- feature: z18.string().optional().describe("Feature name for tracking")
7035
+ project_id: z23.string().optional().describe("Project ID for granular billing"),
7036
+ feature: z23.string().optional().describe("Feature name for tracking")
6562
7037
  },
6563
7038
  getPromptVersion: {
6564
- prompt_id: z18.string().describe("Prompt ID or slug"),
6565
- version_id: z18.string().describe("Version UUID to retrieve")
7039
+ prompt_id: z23.string().describe("Prompt ID or slug"),
7040
+ version_id: z23.string().describe("Version UUID to retrieve")
6566
7041
  },
6567
7042
  updatePromptVersion: {
6568
- prompt_id: z18.string().describe("Prompt ID or slug"),
6569
- version_id: z18.string().describe("Version UUID to update"),
6570
- label_id: z18.string().nullable().describe(
7043
+ prompt_id: z23.string().describe("Prompt ID or slug"),
7044
+ version_id: z23.string().describe("Version UUID to update"),
7045
+ label_id: z23.string().nullable().describe(
6571
7046
  "Label ID to assign to this version, or null to remove the label"
6572
7047
  )
6573
7048
  }
6574
7049
  };
6575
- var createPromptSchema = z18.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
7050
+ var createPromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
6576
7051
  if (!value.model && !value.ai_model_id && !value.finetune_id) {
6577
7052
  ctx.addIssue({
6578
- code: z18.ZodIssueCode.custom,
7053
+ code: z23.ZodIssueCode.custom,
6579
7054
  message: "At least one of model, ai_model_id, or finetune_id must be provided"
6580
7055
  });
6581
7056
  }
6582
7057
  if (value.string === void 0 && value.messages === void 0) {
6583
7058
  ctx.addIssue({
6584
- code: z18.ZodIssueCode.custom,
7059
+ code: z23.ZodIssueCode.custom,
6585
7060
  message: "Provide either string or messages"
6586
7061
  });
6587
7062
  }
6588
7063
  });
6589
- var migratePromptSchema = z18.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
7064
+ var migratePromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
6590
7065
  if (value.string === void 0 && value.messages === void 0) {
6591
7066
  ctx.addIssue({
6592
- code: z18.ZodIssueCode.custom,
7067
+ code: z23.ZodIssueCode.custom,
6593
7068
  message: "Provide either string or messages"
6594
7069
  });
6595
7070
  }
@@ -7042,70 +7517,70 @@ function registerPromptsTools(server, service) {
7042
7517
  }
7043
7518
 
7044
7519
  // src/tools/providers.tools.ts
7045
- import { z as z19 } from "zod";
7520
+ import { z as z24 } from "zod";
7046
7521
  var PROVIDERS_TOOL_SCHEMAS = {
7047
7522
  listProviders: {
7048
7523
  current_page: CurrentPageSchema,
7049
7524
  page_size: PageSizeSchema.describe(
7050
7525
  "Number of results per page (max 100, default 50)"
7051
7526
  ),
7052
- workspace_id: z19.string().optional().describe(
7527
+ workspace_id: z24.string().optional().describe(
7053
7528
  "Workspace ID - required when using organization admin keys, optional with workspace API keys"
7054
7529
  )
7055
7530
  },
7056
7531
  createProvider: {
7057
- name: z19.string().describe("Display name for the provider"),
7058
- integration_id: z19.string().describe(
7532
+ name: z24.string().describe("Display name for the provider"),
7533
+ integration_id: z24.string().describe(
7059
7534
  "Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
7060
7535
  ),
7061
- workspace_id: z19.string().optional().describe(
7536
+ workspace_id: z24.string().optional().describe(
7062
7537
  "Workspace ID - required when using organization admin API keys"
7063
7538
  ),
7064
- slug: z19.string().optional().describe(
7539
+ slug: z24.string().optional().describe(
7065
7540
  "Custom slug for the provider. Auto-generated with random suffix if omitted"
7066
7541
  ),
7067
- note: z19.string().optional().describe("Optional note or description for the provider"),
7068
- credit_limit: z19.coerce.number().positive().optional().describe("Credit limit for usage"),
7069
- alert_threshold: z19.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
7070
- usage_limit_type: z19.enum(["cost", "tokens"]).optional().describe(
7542
+ note: z24.string().optional().describe("Optional note or description for the provider"),
7543
+ credit_limit: z24.coerce.number().positive().optional().describe("Credit limit for usage"),
7544
+ alert_threshold: z24.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
7545
+ usage_limit_type: z24.enum(["cost", "tokens"]).optional().describe(
7071
7546
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7072
7547
  ),
7073
- periodic_reset: z19.enum(["monthly", "weekly"]).optional().describe(
7548
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7074
7549
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7075
7550
  ),
7076
- rate_limit_value: z19.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
7077
- rate_limit_unit: z19.enum(["rpm", "rph", "rpd"]).optional().describe(
7551
+ rate_limit_value: z24.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
7552
+ rate_limit_unit: z24.enum(["rpm", "rph", "rpd"]).optional().describe(
7078
7553
  "Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
7079
7554
  ),
7080
- expires_at: z19.string().optional().describe("Expiration date in ISO 8601 format")
7555
+ expires_at: z24.string().optional().describe("Expiration date in ISO 8601 format")
7081
7556
  },
7082
7557
  getProvider: {
7083
- slug: z19.string().describe("The unique slug identifier of the provider to retrieve"),
7084
- workspace_id: z19.string().optional().describe("Workspace ID - required when using organization admin keys")
7558
+ slug: z24.string().describe("The unique slug identifier of the provider to retrieve"),
7559
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys")
7085
7560
  },
7086
7561
  updateProvider: {
7087
- slug: z19.string().describe("The slug of the provider to update"),
7088
- workspace_id: z19.string().optional().describe("Workspace ID - required when using organization admin keys"),
7089
- name: z19.string().optional().describe("New display name for the provider"),
7090
- note: z19.string().optional().describe("New note or description for the provider"),
7091
- credit_limit: z19.coerce.number().positive().optional().describe("New credit limit for usage"),
7092
- alert_threshold: z19.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
7093
- usage_limit_type: z19.enum(["cost", "tokens"]).optional().describe(
7562
+ slug: z24.string().describe("The slug of the provider to update"),
7563
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys"),
7564
+ name: z24.string().optional().describe("New display name for the provider"),
7565
+ note: z24.string().optional().describe("New note or description for the provider"),
7566
+ credit_limit: z24.coerce.number().positive().optional().describe("New credit limit for usage"),
7567
+ alert_threshold: z24.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
7568
+ usage_limit_type: z24.enum(["cost", "tokens"]).optional().describe(
7094
7569
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7095
7570
  ),
7096
- periodic_reset: z19.enum(["monthly", "weekly"]).optional().describe(
7571
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7097
7572
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7098
7573
  ),
7099
- rate_limit_value: z19.coerce.number().positive().optional().describe("New rate limit value"),
7100
- rate_limit_unit: z19.enum(["rpm", "rph", "rpd"]).optional().describe(
7574
+ rate_limit_value: z24.coerce.number().positive().optional().describe("New rate limit value"),
7575
+ rate_limit_unit: z24.enum(["rpm", "rph", "rpd"]).optional().describe(
7101
7576
  "Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
7102
7577
  ),
7103
- expires_at: z19.string().optional().describe("New expiration date in ISO 8601 format"),
7104
- reset_usage: z19.boolean().optional().describe("Set to true to reset accumulated usage metrics")
7578
+ expires_at: z24.string().optional().describe("New expiration date in ISO 8601 format"),
7579
+ reset_usage: z24.boolean().optional().describe("Set to true to reset accumulated usage metrics")
7105
7580
  },
7106
7581
  deleteProvider: {
7107
- slug: z19.string().describe("The slug of the provider to delete"),
7108
- workspace_id: z19.string().optional().describe("Workspace ID - required when using organization admin keys")
7582
+ slug: z24.string().describe("The slug of the provider to delete"),
7583
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys")
7109
7584
  }
7110
7585
  };
7111
7586
  function registerProvidersTools(server, service) {
@@ -7252,73 +7727,73 @@ function registerProvidersTools(server, service) {
7252
7727
  }
7253
7728
 
7254
7729
  // src/tools/secret-references.tools.ts
7255
- import { z as z20 } from "zod";
7730
+ import { z as z25 } from "zod";
7256
7731
  var authFields = {
7257
- aws_auth_type: z20.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7732
+ aws_auth_type: z25.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7258
7733
  "AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
7259
7734
  ),
7260
- aws_access_key_id: z20.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
7261
- aws_secret_access_key: z20.string().min(1).describe(
7735
+ aws_access_key_id: z25.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
7736
+ aws_secret_access_key: z25.string().min(1).describe(
7262
7737
  "AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
7263
7738
  ),
7264
- aws_region: z20.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
7265
- aws_role_arn: z20.string().min(1).describe(
7739
+ aws_region: z25.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
7740
+ aws_role_arn: z25.string().min(1).describe(
7266
7741
  "IAM role ARN to assume; required when aws_auth_type is assumedRole"
7267
7742
  ),
7268
- aws_external_id: z20.string().nullable().describe("Optional external ID required by the target IAM role"),
7269
- azure_auth_mode: z20.enum(["entra", "managed", "default"]).describe(
7743
+ aws_external_id: z25.string().nullable().describe("Optional external ID required by the target IAM role"),
7744
+ azure_auth_mode: z25.enum(["entra", "managed", "default"]).describe(
7270
7745
  "Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
7271
7746
  ),
7272
- azure_entra_tenant_id: z20.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
7273
- azure_entra_client_id: z20.string().min(1).describe(
7747
+ azure_entra_tenant_id: z25.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
7748
+ azure_entra_client_id: z25.string().min(1).describe(
7274
7749
  "Microsoft Entra application client ID; required for entra authentication"
7275
7750
  ),
7276
- azure_entra_client_secret: z20.string().min(1).describe(
7751
+ azure_entra_client_secret: z25.string().min(1).describe(
7277
7752
  "Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
7278
7753
  ),
7279
- azure_managed_client_id: z20.string().min(1).describe(
7754
+ azure_managed_client_id: z25.string().min(1).describe(
7280
7755
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7281
7756
  ),
7282
- azure_vault_url: z20.url().describe(
7757
+ azure_vault_url: z25.url().describe(
7283
7758
  "Azure Key Vault URL, for example https://example.vault.azure.net"
7284
7759
  ),
7285
- vault_auth_type: z20.enum(["token", "approle", "kubernetes"]).describe(
7760
+ vault_auth_type: z25.enum(["token", "approle", "kubernetes"]).describe(
7286
7761
  "HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
7287
7762
  ),
7288
- vault_addr: z20.url().describe("Base URL of the HashiCorp Vault server"),
7289
- vault_token: z20.string().min(1).describe(
7763
+ vault_addr: z25.url().describe("Base URL of the HashiCorp Vault server"),
7764
+ vault_token: z25.string().min(1).describe(
7290
7765
  "HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
7291
7766
  ),
7292
- vault_namespace: z20.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
7293
- vault_role_id: z20.string().min(1).describe(
7767
+ vault_namespace: z25.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
7768
+ vault_role_id: z25.string().min(1).describe(
7294
7769
  "HashiCorp Vault AppRole role ID; required for approle authentication"
7295
7770
  ),
7296
- vault_secret_id: z20.string().min(1).describe(
7771
+ vault_secret_id: z25.string().min(1).describe(
7297
7772
  "HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
7298
7773
  ),
7299
- vault_role: z20.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7774
+ vault_role: z25.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7300
7775
  };
7301
- var authConfigSchema = z20.union([
7302
- z20.object({
7303
- aws_auth_type: z20.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
7776
+ var authConfigSchema = z25.union([
7777
+ z25.object({
7778
+ aws_auth_type: z25.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
7304
7779
  aws_access_key_id: authFields.aws_access_key_id,
7305
7780
  aws_secret_access_key: authFields.aws_secret_access_key,
7306
7781
  aws_region: authFields.aws_region
7307
7782
  }).strict(),
7308
- z20.object({
7309
- aws_auth_type: z20.literal("assumedRole").describe("Assume the specified AWS IAM role"),
7783
+ z25.object({
7784
+ aws_auth_type: z25.literal("assumedRole").describe("Assume the specified AWS IAM role"),
7310
7785
  aws_role_arn: authFields.aws_role_arn,
7311
7786
  aws_external_id: authFields.aws_external_id.optional(),
7312
7787
  aws_region: authFields.aws_region
7313
7788
  }).strict(),
7314
- z20.object({
7315
- aws_auth_type: z20.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
7316
- aws_region: z20.string().optional().describe(
7789
+ z25.object({
7790
+ aws_auth_type: z25.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
7791
+ aws_region: z25.string().optional().describe(
7317
7792
  "Optional AWS region containing the secret, for example us-east-1"
7318
7793
  )
7319
7794
  }).strict(),
7320
- z20.object({
7321
- azure_auth_mode: z20.literal("entra").describe(
7795
+ z25.object({
7796
+ azure_auth_mode: z25.literal("entra").describe(
7322
7797
  "Authenticate with a Microsoft Entra application client secret"
7323
7798
  ),
7324
7799
  azure_entra_tenant_id: authFields.azure_entra_tenant_id,
@@ -7326,30 +7801,30 @@ var authConfigSchema = z20.union([
7326
7801
  azure_entra_client_secret: authFields.azure_entra_client_secret,
7327
7802
  azure_vault_url: authFields.azure_vault_url
7328
7803
  }).strict(),
7329
- z20.object({
7330
- azure_auth_mode: z20.literal("managed").describe("Authenticate with an Azure managed identity"),
7804
+ z25.object({
7805
+ azure_auth_mode: z25.literal("managed").describe("Authenticate with an Azure managed identity"),
7331
7806
  azure_managed_client_id: authFields.azure_managed_client_id.optional(),
7332
7807
  azure_vault_url: authFields.azure_vault_url
7333
7808
  }).strict(),
7334
- z20.object({
7335
- azure_auth_mode: z20.literal("default").describe("Use Azure's default runtime credential chain"),
7809
+ z25.object({
7810
+ azure_auth_mode: z25.literal("default").describe("Use Azure's default runtime credential chain"),
7336
7811
  azure_vault_url: authFields.azure_vault_url
7337
7812
  }).strict(),
7338
- z20.object({
7339
- vault_auth_type: z20.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
7813
+ z25.object({
7814
+ vault_auth_type: z25.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
7340
7815
  vault_addr: authFields.vault_addr,
7341
7816
  vault_token: authFields.vault_token,
7342
7817
  vault_namespace: authFields.vault_namespace.optional()
7343
7818
  }).strict(),
7344
- z20.object({
7345
- vault_auth_type: z20.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
7819
+ z25.object({
7820
+ vault_auth_type: z25.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
7346
7821
  vault_addr: authFields.vault_addr,
7347
7822
  vault_role_id: authFields.vault_role_id,
7348
7823
  vault_secret_id: authFields.vault_secret_id,
7349
7824
  vault_namespace: authFields.vault_namespace.optional()
7350
7825
  }).strict(),
7351
- z20.object({
7352
- vault_auth_type: z20.literal("kubernetes").describe(
7826
+ z25.object({
7827
+ vault_auth_type: z25.literal("kubernetes").describe(
7353
7828
  "Authenticate to HashiCorp Vault with a Kubernetes service account"
7354
7829
  ),
7355
7830
  vault_addr: authFields.vault_addr,
@@ -7357,61 +7832,61 @@ var authConfigSchema = z20.union([
7357
7832
  vault_namespace: authFields.vault_namespace.optional()
7358
7833
  }).strict()
7359
7834
  ]);
7360
- var updateAuthConfigSchema = z20.union([
7361
- z20.object({
7835
+ var updateAuthConfigSchema = z25.union([
7836
+ z25.object({
7362
7837
  aws_auth_type: authFields.aws_auth_type.optional(),
7363
7838
  aws_access_key_id: authFields.aws_access_key_id.optional(),
7364
7839
  aws_secret_access_key: authFields.aws_secret_access_key.optional(),
7365
- aws_region: z20.string().optional().describe("AWS region containing the secret, for example us-east-1"),
7840
+ aws_region: z25.string().optional().describe("AWS region containing the secret, for example us-east-1"),
7366
7841
  aws_role_arn: authFields.aws_role_arn.optional(),
7367
7842
  aws_external_id: authFields.aws_external_id.optional()
7368
7843
  }).strict(),
7369
- z20.object({
7844
+ z25.object({
7370
7845
  azure_auth_mode: authFields.azure_auth_mode.optional(),
7371
7846
  azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
7372
7847
  azure_entra_client_id: authFields.azure_entra_client_id.optional(),
7373
7848
  azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
7374
- azure_managed_client_id: z20.string().optional().describe(
7849
+ azure_managed_client_id: z25.string().optional().describe(
7375
7850
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7376
7851
  ),
7377
7852
  azure_vault_url: authFields.azure_vault_url.optional()
7378
7853
  }).strict(),
7379
- z20.object({
7854
+ z25.object({
7380
7855
  vault_auth_type: authFields.vault_auth_type.optional(),
7381
7856
  vault_addr: authFields.vault_addr.optional(),
7382
7857
  vault_token: authFields.vault_token.optional(),
7383
- vault_namespace: z20.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7858
+ vault_namespace: z25.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7384
7859
  vault_role_id: authFields.vault_role_id.optional(),
7385
7860
  vault_secret_id: authFields.vault_secret_id.optional(),
7386
7861
  vault_role: authFields.vault_role.optional()
7387
7862
  }).strict()
7388
7863
  ]);
7389
- var managerTypeSchema = z20.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7864
+ var managerTypeSchema = z25.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7390
7865
  "External secret manager: aws_sm for AWS Secrets Manager, azure_kv for Azure Key Vault, or hashicorp_vault for HashiCorp Vault; must match the auth_config field family"
7391
7866
  );
7392
- var tagsSchema = z20.record(z20.string(), z20.string()).describe("Tag filters or metadata as string key-value pairs");
7867
+ var tagsSchema = z25.record(z25.string(), z25.string()).describe("Tag filters or metadata as string key-value pairs");
7393
7868
  var SECRET_REFERENCE_TOOL_SCHEMAS = {
7394
7869
  create: {
7395
- name: z20.string().min(1).max(255).describe("Human-readable name"),
7870
+ name: z25.string().min(1).max(255).describe("Human-readable name"),
7396
7871
  manager_type: managerTypeSchema,
7397
7872
  auth_config: authConfigSchema.describe(
7398
7873
  "Choose exactly one documented authentication shape matching manager_type. Credentials are sent to Portkey and visible in the MCP transcript; prefer workload identity or short-lived credentials when available."
7399
7874
  ),
7400
- secret_path: z20.string().max(1024).describe("Path of the secret in the external secret manager"),
7401
- organisation_id: z20.string().uuid().optional().describe(
7875
+ secret_path: z25.string().max(1024).describe("Path of the secret in the external secret manager"),
7876
+ organisation_id: z25.string().uuid().optional().describe(
7402
7877
  "Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
7403
7878
  ),
7404
- slug: z20.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7879
+ slug: z25.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7405
7880
  "Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
7406
7881
  ),
7407
- description: z20.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
7408
- secret_key: z20.string().max(255).nullable().optional().describe(
7882
+ description: z25.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
7883
+ secret_key: z25.string().max(255).nullable().optional().describe(
7409
7884
  "Optional key within a structured external secret; null uses the whole secret value"
7410
7885
  ),
7411
- allow_all_workspaces: z20.boolean().optional().describe(
7886
+ allow_all_workspaces: z25.boolean().optional().describe(
7412
7887
  "Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
7413
7888
  ),
7414
- allowed_workspaces: z20.array(z20.string()).min(1).optional().describe(
7889
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7415
7890
  "Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
7416
7891
  ),
7417
7892
  tags: tagsSchema.nullable().optional().describe(
@@ -7423,7 +7898,7 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7423
7898
  "Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
7424
7899
  ),
7425
7900
  tags: tagsSchema.optional().describe("Return references matching these tags"),
7426
- search: z20.string().min(1).max(255).optional().describe("Search references by name"),
7901
+ search: z25.string().min(1).max(255).optional().describe("Search references by name"),
7427
7902
  current_page: CurrentPageSchema.describe(
7428
7903
  "Zero-based page number; defaults to 0"
7429
7904
  ),
@@ -7432,29 +7907,29 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7432
7907
  )
7433
7908
  },
7434
7909
  get: {
7435
- id: z20.string().min(1).describe("Secret Reference UUID or slug")
7910
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7436
7911
  },
7437
7912
  update: {
7438
- id: z20.string().min(1).describe("Secret Reference UUID or slug"),
7439
- name: z20.string().min(1).max(255).optional().describe("New human-readable name"),
7440
- description: z20.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
7913
+ id: z25.string().min(1).describe("Secret Reference UUID or slug"),
7914
+ name: z25.string().min(1).max(255).optional().describe("New human-readable name"),
7915
+ description: z25.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
7441
7916
  auth_config: updateAuthConfigSchema.optional().describe(
7442
7917
  "Provide at least one changed authentication field to merge into the existing configuration; choose one AWS, Azure, or HashiCorp field family and do not mix families"
7443
7918
  ),
7444
- secret_path: z20.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
7445
- secret_key: z20.string().max(255).nullable().optional().describe(
7919
+ secret_path: z25.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
7920
+ secret_key: z25.string().max(255).nullable().optional().describe(
7446
7921
  "New key within a structured secret, or null to use the whole value"
7447
7922
  ),
7448
- allow_all_workspaces: z20.boolean().optional().describe(
7923
+ allow_all_workspaces: z25.boolean().optional().describe(
7449
7924
  "Whether every workspace may use this reference; cannot be true with allowed_workspaces"
7450
7925
  ),
7451
- allowed_workspaces: z20.array(z20.string()).min(1).optional().describe(
7926
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7452
7927
  "Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
7453
7928
  ),
7454
7929
  tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
7455
7930
  },
7456
7931
  delete: {
7457
- id: z20.string().min(1).describe("Secret Reference UUID or slug")
7932
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7458
7933
  }
7459
7934
  };
7460
7935
  function validateWorkspaceAccess(value) {
@@ -7618,29 +8093,29 @@ function registerSecretReferencesTools(server, service) {
7618
8093
  }
7619
8094
 
7620
8095
  // src/tools/tracing.tools.ts
7621
- import { z as z21 } from "zod";
8096
+ import { z as z26 } from "zod";
7622
8097
  var TRACING_TOOL_SCHEMAS = {
7623
8098
  createFeedback: {
7624
- trace_id: z21.string().describe(
8099
+ trace_id: z26.string().describe(
7625
8100
  "The trace ID to associate the feedback with. This links feedback to a specific request/generation."
7626
8101
  ),
7627
- value: z21.coerce.number().describe(
8102
+ value: z26.coerce.number().describe(
7628
8103
  "Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
7629
8104
  ),
7630
- weight: z21.coerce.number().positive().optional().describe(
8105
+ weight: z26.coerce.number().positive().optional().describe(
7631
8106
  "Optional weighting factor for the feedback. Use to give more importance to certain feedback."
7632
8107
  ),
7633
- metadata: z21.record(z21.string(), z21.unknown()).optional().describe(
8108
+ metadata: z26.record(z26.string(), z26.unknown()).optional().describe(
7634
8109
  "Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
7635
8110
  )
7636
8111
  },
7637
8112
  updateFeedback: {
7638
- id: z21.string().describe("The unique identifier of the feedback to update"),
7639
- value: z21.coerce.number().optional().describe(
8113
+ id: z26.string().describe("The unique identifier of the feedback to update"),
8114
+ value: z26.coerce.number().optional().describe(
7640
8115
  "New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
7641
8116
  ),
7642
- weight: z21.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
7643
- metadata: z21.record(z21.string(), z21.unknown()).optional().describe("New or updated custom metadata for the feedback")
8117
+ weight: z26.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
8118
+ metadata: z26.record(z26.string(), z26.unknown()).optional().describe("New or updated custom metadata for the feedback")
7644
8119
  }
7645
8120
  };
7646
8121
  function registerTracingTools(server, service) {
@@ -7682,82 +8157,82 @@ function registerTracingTools(server, service) {
7682
8157
  }
7683
8158
 
7684
8159
  // src/tools/users.tools.ts
7685
- import { z as z22 } from "zod";
8160
+ import { z as z27 } from "zod";
7686
8161
  var USERS_TOOL_SCHEMAS = {
7687
8162
  listAllUsers: {
7688
8163
  current_page: CurrentPageSchema,
7689
8164
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7690
- role: z22.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
7691
- email: z22.string().email().optional().describe("Filter by exact email")
8165
+ role: z27.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
8166
+ email: z27.string().email().optional().describe("Filter by exact email")
7692
8167
  },
7693
8168
  inviteUser: {
7694
- email: z22.string().email().describe("Email address of the user to invite"),
7695
- role: z22.enum(["admin", "member"]).describe(
8169
+ email: z27.string().email().describe("Email address of the user to invite"),
8170
+ role: z27.enum(["admin", "member"]).describe(
7696
8171
  "Organization-level role: 'admin' for full access, 'member' for limited access"
7697
8172
  ),
7698
- first_name: z22.string().optional().describe("User's first name"),
7699
- last_name: z22.string().optional().describe("User's last name"),
7700
- workspaces: z22.array(
7701
- z22.object({
7702
- id: z22.string().describe(
8173
+ first_name: z27.string().optional().describe("User's first name"),
8174
+ last_name: z27.string().optional().describe("User's last name"),
8175
+ workspaces: z27.array(
8176
+ z27.object({
8177
+ id: z27.string().describe(
7703
8178
  "Workspace ID/slug where the user will be granted access"
7704
8179
  ),
7705
- role: z22.enum(["admin", "member", "manager"]).describe(
8180
+ role: z27.enum(["admin", "member", "manager"]).describe(
7706
8181
  "Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
7707
8182
  )
7708
8183
  })
7709
8184
  ).describe(
7710
8185
  "List of workspaces and corresponding roles to grant to the user"
7711
8186
  ),
7712
- workspace_api_key_details: z22.object({
7713
- name: z22.string().optional().describe("Name of the API key to be created"),
7714
- expiry: z22.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
7715
- metadata: z22.record(z22.string(), z22.string()).optional().describe("Additional metadata key-value pairs for the API key"),
7716
- scopes: z22.array(z22.string()).describe("List of permission scopes for the API key")
8187
+ workspace_api_key_details: z27.object({
8188
+ name: z27.string().optional().describe("Name of the API key to be created"),
8189
+ expiry: z27.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
8190
+ metadata: z27.record(z27.string(), z27.string()).optional().describe("Additional metadata key-value pairs for the API key"),
8191
+ scopes: z27.array(z27.string()).describe("List of permission scopes for the API key")
7717
8192
  }).optional().describe("Optional API key to be created for the user")
7718
8193
  },
7719
8194
  getUserStats: {
7720
- time_of_generation_min: z22.string().describe(
8195
+ time_of_generation_min: z27.string().describe(
7721
8196
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
7722
8197
  ),
7723
- time_of_generation_max: z22.string().describe(
8198
+ time_of_generation_max: z27.string().describe(
7724
8199
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
7725
8200
  ),
7726
- total_units_min: z22.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
7727
- total_units_max: z22.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
7728
- cost_min: z22.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
7729
- cost_max: z22.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
7730
- status_code: z22.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
7731
- virtual_keys: z22.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
8201
+ total_units_min: z27.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
8202
+ total_units_max: z27.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
8203
+ cost_min: z27.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
8204
+ cost_max: z27.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
8205
+ status_code: z27.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
8206
+ virtual_keys: z27.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
7732
8207
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
7733
8208
  },
7734
8209
  getUser: {
7735
- user_id: z22.string().describe("The user ID to retrieve")
8210
+ user_id: z27.string().describe("The user ID to retrieve")
7736
8211
  },
7737
8212
  updateUser: {
7738
- user_id: z22.string().describe("The user ID to update"),
7739
- first_name: z22.string().optional().describe("New first name"),
7740
- last_name: z22.string().optional().describe("New last name"),
7741
- role: z22.enum(["admin", "member"]).optional().describe("New organization-level role")
8213
+ user_id: z27.string().describe("The user ID to update"),
8214
+ first_name: z27.string().optional().describe("New first name"),
8215
+ last_name: z27.string().optional().describe("New last name"),
8216
+ role: z27.enum(["admin", "member"]).optional().describe("New organization-level role")
7742
8217
  },
7743
8218
  deleteUser: {
7744
- user_id: z22.string().describe("The user ID to delete")
8219
+ user_id: z27.string().describe("The user ID to delete")
7745
8220
  },
7746
8221
  listUserInvites: {
7747
8222
  current_page: CurrentPageSchema,
7748
8223
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7749
- role: z22.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
7750
- email: z22.string().email().optional().describe("Filter by invited email"),
7751
- status: z22.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
8224
+ role: z27.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
8225
+ email: z27.string().email().optional().describe("Filter by invited email"),
8226
+ status: z27.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
7752
8227
  },
7753
8228
  getUserInvite: {
7754
- invite_id: z22.string().describe("The invite ID to retrieve")
8229
+ invite_id: z27.string().describe("The invite ID to retrieve")
7755
8230
  },
7756
8231
  deleteUserInvite: {
7757
- invite_id: z22.string().describe("The invite ID to delete")
8232
+ invite_id: z27.string().describe("The invite ID to delete")
7758
8233
  },
7759
8234
  resendUserInvite: {
7760
- invite_id: z22.string().describe("The invite ID to resend")
8235
+ invite_id: z27.string().describe("The invite ID to resend")
7761
8236
  }
7762
8237
  };
7763
8238
  function formatUser(user) {
@@ -7918,34 +8393,34 @@ function registerUsersTools(server, service) {
7918
8393
  }
7919
8394
 
7920
8395
  // src/tools/workspaces.tools.ts
7921
- import { z as z23 } from "zod";
8396
+ import { z as z28 } from "zod";
7922
8397
  var scimWorkspaceMappingBaseShape = {
7923
- workspace_id: z23.string().describe("Portkey workspace ID that the SCIM group should access"),
7924
- role: z23.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
8398
+ workspace_id: z28.string().describe("Portkey workspace ID that the SCIM group should access"),
8399
+ role: z28.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
7925
8400
  };
7926
8401
  var createScimWorkspaceMappingShape = {
7927
8402
  ...scimWorkspaceMappingBaseShape,
7928
- scim_group_id: z23.string().min(1).optional().describe(
8403
+ scim_group_id: z28.string().min(1).optional().describe(
7929
8404
  "Existing identity-provider SCIM group ID; provide this or scim_group_name, but not both"
7930
8405
  ),
7931
- scim_group_name: z23.string().min(1).optional().describe(
8406
+ scim_group_name: z28.string().min(1).optional().describe(
7932
8407
  "Existing SCIM group display name; provide this or scim_group_id, but not both"
7933
8408
  )
7934
8409
  };
7935
- var workspaceUsageLimitSchema = z23.object({
7936
- credit_limit: z23.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
7937
- type: z23.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
7938
- alert_threshold: z23.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
7939
- periodic_reset: z23.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
7940
- periodic_reset_days: z23.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
7941
- next_usage_reset_at: z23.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
8410
+ var workspaceUsageLimitSchema = z28.object({
8411
+ credit_limit: z28.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
8412
+ type: z28.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
8413
+ alert_threshold: z28.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
8414
+ periodic_reset: z28.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
8415
+ periodic_reset_days: z28.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
8416
+ next_usage_reset_at: z28.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
7942
8417
  });
7943
- var workspaceRateLimitSchema = z23.object({
7944
- type: z23.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
7945
- unit: z23.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
7946
- value: z23.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
8418
+ var workspaceRateLimitSchema = z28.object({
8419
+ type: z28.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
8420
+ unit: z28.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
8421
+ value: z28.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
7947
8422
  });
7948
- var createScimWorkspaceMappingSchema = z23.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
8423
+ var createScimWorkspaceMappingSchema = z28.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
7949
8424
  if (Boolean(input.scim_group_id) === Boolean(input.scim_group_name)) {
7950
8425
  context.addIssue({
7951
8426
  code: "custom",
@@ -7960,99 +8435,101 @@ var WORKSPACES_TOOL_SCHEMAS = {
7960
8435
  "Number of workspaces to return per page (max 100)"
7961
8436
  ),
7962
8437
  current_page: CurrentPageSchema,
7963
- name: z23.string().optional().describe("Case-sensitive name filter"),
7964
- exact_name: z23.string().optional().describe("Exact workspace name filter"),
7965
- status: z23.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
8438
+ name: z28.string().optional().describe("Case-sensitive name filter"),
8439
+ exact_name: z28.string().optional().describe("Exact workspace name filter"),
8440
+ status: z28.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
7966
8441
  },
7967
8442
  getWorkspace: {
7968
- workspace_id: z23.string().describe(
8443
+ workspace_id: z28.string().describe(
7969
8444
  "The unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response"
7970
8445
  )
7971
8446
  },
7972
8447
  createWorkspace: {
7973
- name: z23.string().describe("Name of the workspace"),
7974
- slug: z23.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
7975
- description: z23.string().optional().describe("Description of the workspace"),
7976
- is_default: z23.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
7977
- metadata: z23.record(z23.string(), z23.string()).optional().describe("Custom metadata key-value pairs"),
7978
- users: z23.array(z23.string()).optional().describe("Existing user IDs to add"),
7979
- usage_limits: z23.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
7980
- rate_limits: z23.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
8448
+ name: z28.string().describe("Name of the workspace"),
8449
+ slug: z28.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
8450
+ description: z28.string().optional().describe("Description of the workspace"),
8451
+ is_default: z28.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8452
+ metadata: z28.record(z28.string(), z28.string()).optional().describe("Custom metadata key-value pairs"),
8453
+ users: z28.array(z28.string()).optional().describe("Existing user IDs to add"),
8454
+ usage_limits: z28.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
8455
+ rate_limits: z28.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
7981
8456
  },
7982
8457
  updateWorkspace: {
7983
- workspace_id: z23.string().describe("The workspace ID to update"),
7984
- name: z23.string().optional().describe("New name for the workspace"),
7985
- slug: z23.string().optional().describe("New slug for the workspace"),
7986
- description: z23.string().optional().describe("New description"),
7987
- is_default: z23.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
7988
- metadata: z23.record(z23.string(), z23.string()).optional().describe("New metadata key-value pairs"),
7989
- input_guardrails: z23.array(z23.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
7990
- output_guardrails: z23.array(z23.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
7991
- user_api_key_config: z23.string().nullable().optional().describe(
8458
+ workspace_id: z28.string().describe("The workspace ID to update"),
8459
+ name: z28.string().optional().describe("New name for the workspace"),
8460
+ slug: z28.string().optional().describe("New slug for the workspace"),
8461
+ description: z28.string().optional().describe("New description"),
8462
+ is_default: z28.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8463
+ metadata: z28.record(z28.string(), z28.string()).optional().describe("New metadata key-value pairs"),
8464
+ input_guardrails: z28.array(z28.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
8465
+ output_guardrails: z28.array(z28.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
8466
+ user_api_key_config: z28.string().nullable().optional().describe(
7992
8467
  "Default config slug for workspace-user API keys, or null to clear"
7993
8468
  ),
7994
- usage_limits: z23.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
7995
- rate_limits: z23.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
8469
+ usage_limits: z28.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
8470
+ rate_limits: z28.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
7996
8471
  },
7997
8472
  deleteWorkspace: {
7998
- workspace_id: z23.string().describe("The workspace ID to delete")
8473
+ workspace_id: z28.string().describe("The workspace ID to delete")
7999
8474
  },
8000
8475
  addWorkspaceMember: {
8001
- workspace_id: z23.string().describe("The workspace ID to add the member to"),
8002
- user_id: z23.string().uuid(
8476
+ workspace_id: z28.string().describe("The workspace ID to add the member to"),
8477
+ user_id: z28.string().uuid(
8003
8478
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8004
8479
  ).describe(
8005
8480
  "The user ID to add (must be a valid UUID from list_all_users, not an email address)"
8006
8481
  ),
8007
- role: z23.enum(["admin", "member", "manager"]).describe("Role in the workspace")
8482
+ role: z28.enum(["admin", "member", "manager"]).describe("Role in the workspace")
8008
8483
  },
8009
8484
  listWorkspaceMembers: {
8010
- workspace_id: z23.string().describe("The workspace ID to list members for"),
8485
+ workspace_id: z28.string().describe("The workspace ID to list members for"),
8011
8486
  current_page: CurrentPageSchema.describe("Zero-based page number"),
8012
8487
  page_size: PageSizeSchema.describe("Number of members per page"),
8013
- role: z23.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
8014
- email: z23.string().email().optional().describe("Filter by member email")
8488
+ role: z28.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
8489
+ email: z28.string().email().optional().describe("Filter by member email")
8015
8490
  },
8016
8491
  getWorkspaceMember: {
8017
- workspace_id: z23.string().describe("The workspace ID"),
8018
- user_id: z23.string().uuid(
8492
+ workspace_id: z28.string().describe("The workspace ID"),
8493
+ user_id: z28.string().uuid(
8019
8494
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8020
8495
  ).describe(
8021
8496
  "The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
8022
8497
  )
8023
8498
  },
8024
8499
  updateWorkspaceMember: {
8025
- workspace_id: z23.string().describe("The workspace ID"),
8026
- user_id: z23.string().uuid(
8500
+ workspace_id: z28.string().describe("The workspace ID"),
8501
+ user_id: z28.string().uuid(
8027
8502
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8028
8503
  ).describe(
8029
8504
  "The user ID to update (must be a valid UUID from list_all_users, not an email address)"
8030
8505
  ),
8031
- role: z23.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8506
+ role: z28.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8032
8507
  },
8033
8508
  removeWorkspaceMember: {
8034
- workspace_id: z23.string().describe("The workspace ID"),
8035
- user_id: z23.string().uuid(
8509
+ workspace_id: z28.string().describe("The workspace ID"),
8510
+ user_id: z28.string().uuid(
8036
8511
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8037
8512
  ).describe("The user ID to remove")
8038
8513
  },
8039
8514
  listScimWorkspaceMappings: {
8040
- workspace_id: z23.string().optional().describe("Return only mappings for this Portkey workspace ID"),
8041
- scim_group_id: z23.string().optional().describe(
8515
+ workspace_id: z28.string().optional().describe(
8516
+ "Return only mappings for this Portkey workspace UUID (the id from list_workspaces, not its slug)"
8517
+ ),
8518
+ scim_group_id: z28.string().optional().describe(
8042
8519
  "Return only mappings for this identity-provider SCIM group ID"
8043
8520
  ),
8044
- role: z23.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
8045
- page: z23.coerce.number().int().nonnegative().optional().describe(
8521
+ role: z28.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
8522
+ page: z28.coerce.number().int().nonnegative().optional().describe(
8046
8523
  "Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
8047
8524
  ),
8048
8525
  page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
8049
8526
  },
8050
8527
  deleteScimWorkspaceMapping: {
8051
- mapping_id: z23.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
8528
+ mapping_id: z28.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
8052
8529
  },
8053
8530
  listScimGroups: {
8054
- search: z23.string().optional().describe("Case-insensitive text to match against SCIM group names"),
8055
- page: z23.coerce.number().int().nonnegative().optional().describe(
8531
+ search: z28.string().optional().describe("Case-insensitive text to match against SCIM group names"),
8532
+ page: z28.coerce.number().int().nonnegative().optional().describe(
8056
8533
  "Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
8057
8534
  ),
8058
8535
  page_size: PageSizeSchema.describe(
@@ -8366,6 +8843,8 @@ function registerWorkspacesTools(server, service) {
8366
8843
 
8367
8844
  // src/tools/index.ts
8368
8845
  var TOOL_DOMAIN_REGISTRARS = [
8846
+ ["access-policies", registerAccessPoliciesTools],
8847
+ ["egress-allowlist", registerEgressAllowlistTools],
8369
8848
  ["users", registerUsersTools],
8370
8849
  ["workspaces", registerWorkspacesTools],
8371
8850
  ["configs", registerConfigsTools],
@@ -8443,6 +8922,9 @@ var ENTERPRISE_GATED_TOOL_NAMES = /* @__PURE__ */ new Set([
8443
8922
  "get_analytics_group_models",
8444
8923
  "get_analytics_group_metadata",
8445
8924
  "get_analytics_group_providers",
8925
+ "get_analytics_group_mcp",
8926
+ "get_analytics_group_a2a",
8927
+ "get_analytics_group_workspaces",
8446
8928
  "list_deployments",
8447
8929
  "register_deployment",
8448
8930
  "get_deployment",
@@ -8539,7 +9021,7 @@ function escapeRegExp(value) {
8539
9021
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8540
9022
  }
8541
9023
  function getToolErrorMessage(error) {
8542
- if (error instanceof z24.ZodError) {
9024
+ if (error instanceof z29.ZodError) {
8543
9025
  return formatZodIssues(error);
8544
9026
  }
8545
9027
  if (error instanceof Error && error.message) {
@@ -8548,71 +9030,81 @@ function getToolErrorMessage(error) {
8548
9030
  return String(error);
8549
9031
  }
8550
9032
  var STANDARD_TOOL_OUTPUT_SCHEMA = {
8551
- ok: z24.boolean().describe("Whether the tool call succeeded and returned structured data"),
8552
- data: z24.unknown().optional().describe("Structured success payload when ok is true"),
8553
- error: z24.object({
8554
- message: z24.string().describe("Human-readable error message"),
8555
- details: z24.unknown().optional().describe("Optional structured error details")
9033
+ ok: z29.boolean().describe("Whether the tool call succeeded and returned structured data"),
9034
+ data: z29.unknown().optional().describe("Structured success payload when ok is true"),
9035
+ error: z29.object({
9036
+ message: z29.string().describe("Human-readable error message"),
9037
+ details: z29.unknown().optional().describe("Optional structured error details")
8556
9038
  }).optional().describe("Structured error payload when ok is false")
8557
9039
  };
8558
9040
  var TOOL_SUCCESS_DATA_SCHEMAS = {
8559
- rotate_api_key: z24.object({
8560
- message: z24.string().describe("Rotation confirmation"),
8561
- warning: z24.string().describe("Required handling guidance for the one-time secret"),
8562
- id: z24.string().uuid().describe("Rotated API key UUID"),
8563
- key: z24.string().describe("New API key secret, returned only once"),
8564
- key_transition_expires_at: z24.iso.datetime().describe("Time when the previous key stops working")
9041
+ create_access_policy: CreateAccessPolicyResponseSchema,
9042
+ list_access_policies: ListAccessPoliciesResponseSchema,
9043
+ get_access_policy: AccessPolicySchema,
9044
+ update_access_policy: z29.object({}),
9045
+ delete_access_policy: z29.object({}),
9046
+ create_egress_allowlist_entry: CreateEgressAllowlistResponseSchema,
9047
+ list_egress_allowlist: ListEgressAllowlistResponseSchema,
9048
+ get_egress_allowlist_entry: EgressAllowlistEntrySchema,
9049
+ update_egress_allowlist_entry: z29.object({}),
9050
+ delete_egress_allowlist_entry: z29.object({}),
9051
+ rotate_api_key: z29.object({
9052
+ message: z29.string().describe("Rotation confirmation"),
9053
+ warning: z29.string().describe("Required handling guidance for the one-time secret"),
9054
+ id: z29.string().uuid().describe("Rotated API key UUID"),
9055
+ key: z29.string().describe("New API key secret, returned only once"),
9056
+ key_transition_expires_at: z29.iso.datetime().describe("Time when the previous key stops working")
8565
9057
  }),
8566
- create_secret_reference: z24.object({
8567
- message: z24.string().describe("Creation confirmation"),
8568
- id: z24.string().uuid().describe("New Secret Reference UUID"),
8569
- slug: z24.string().describe("New Secret Reference slug")
9058
+ create_secret_reference: z29.object({
9059
+ message: z29.string().describe("Creation confirmation"),
9060
+ id: z29.string().uuid().describe("New Secret Reference UUID"),
9061
+ slug: z29.string().describe("New Secret Reference slug")
8570
9062
  }),
8571
- list_secret_references: z24.object({
8572
- total: z24.number().int().nonnegative().describe("Total matching references"),
8573
- secret_references: z24.array(
8574
- z24.object({
8575
- id: z24.string().uuid().describe("Secret Reference UUID"),
8576
- name: z24.string().describe("Human-readable name"),
8577
- slug: z24.string().describe("Stable Secret Reference slug"),
9063
+ list_secret_references: z29.object({
9064
+ total: z29.number().int().nonnegative().describe("Total matching references"),
9065
+ secret_references: z29.array(
9066
+ z29.object({
9067
+ id: z29.string().uuid().describe("Secret Reference UUID"),
9068
+ name: z29.string().describe("Human-readable name"),
9069
+ slug: z29.string().describe("Stable Secret Reference slug"),
8578
9070
  manager_type: SecretManagerTypeSchema.describe(
8579
9071
  "External secret manager type"
8580
9072
  ),
8581
- status: z24.literal("ACTIVE").describe("Current reference status"),
8582
- created_at: z24.iso.datetime().describe("ISO 8601 creation timestamp"),
8583
- last_updated_at: z24.iso.datetime().describe("ISO 8601 last-update timestamp")
9073
+ status: z29.literal("ACTIVE").describe("Current reference status"),
9074
+ created_at: z29.iso.datetime().describe("ISO 8601 creation timestamp"),
9075
+ last_updated_at: z29.iso.datetime().describe("ISO 8601 last-update timestamp")
8584
9076
  })
8585
9077
  ).describe(
8586
9078
  "Current page of Secret References without authentication values"
8587
9079
  )
8588
9080
  }),
8589
- get_secret_reference: z24.object({
8590
- id: z24.string().uuid().describe("Secret Reference UUID"),
8591
- organisation_id: z24.string().uuid().describe("Owning organisation UUID"),
8592
- name: z24.string().describe("Human-readable name"),
8593
- slug: z24.string().describe("Stable Secret Reference slug"),
8594
- description: z24.string().nullable().describe("Reference description"),
9081
+ get_secret_reference: z29.object({
9082
+ id: z29.string().uuid().describe("Secret Reference UUID"),
9083
+ organisation_id: z29.string().uuid().describe("Owning organisation UUID"),
9084
+ name: z29.string().describe("Human-readable name"),
9085
+ slug: z29.string().describe("Stable Secret Reference slug"),
9086
+ description: z29.string().nullable().describe("Reference description"),
8595
9087
  manager_type: SecretManagerTypeSchema.describe(
8596
9088
  "External secret manager type"
8597
9089
  ),
8598
- secret_path: z24.string().describe("Path in the external secret manager"),
8599
- secret_key: z24.string().nullable().describe("Selected key within a structured secret"),
8600
- allow_all_workspaces: z24.boolean().describe("Whether all workspaces may use the reference"),
8601
- tags: z24.record(z24.string(), z24.string()).nullable().describe("String metadata tags"),
8602
- status: z24.literal("ACTIVE").describe("Current reference status"),
8603
- created_by: z24.string().describe("Creator identifier"),
8604
- created_at: z24.iso.datetime().describe("ISO 8601 creation timestamp"),
8605
- last_updated_at: z24.iso.datetime().describe("ISO 8601 last-update timestamp"),
8606
- auth_config: z24.record(z24.string(), z24.unknown()).describe("Authentication configuration with sensitive values redacted"),
8607
- object: z24.literal("secret-reference").describe("Portkey object type")
9090
+ secret_path: z29.string().describe("Path in the external secret manager"),
9091
+ secret_key: z29.string().nullable().describe("Selected key within a structured secret"),
9092
+ allow_all_workspaces: z29.boolean().describe("Whether all workspaces may use the reference"),
9093
+ tags: z29.record(z29.string(), z29.string()).nullable().describe("String metadata tags"),
9094
+ status: z29.literal("ACTIVE").describe("Current reference status"),
9095
+ created_by: z29.string().describe("Creator identifier"),
9096
+ created_at: z29.iso.datetime().describe("ISO 8601 creation timestamp"),
9097
+ last_updated_at: z29.iso.datetime().describe("ISO 8601 last-update timestamp"),
9098
+ auth_config: z29.record(z29.string(), z29.unknown()).describe("Authentication configuration with sensitive values redacted"),
9099
+ object: z29.literal("secret-reference").describe("Portkey object type")
8608
9100
  }),
8609
- update_secret_reference: z24.object({
8610
- message: z24.string().describe("Update confirmation"),
8611
- success: z24.literal(true).describe("Whether the update succeeded")
9101
+ update_secret_reference: z29.object({
9102
+ message: z29.string().describe("Update confirmation"),
9103
+ success: z29.literal(true).describe("Whether the update succeeded")
8612
9104
  }),
8613
- delete_secret_reference: z24.object({
8614
- message: z24.string().describe("Deletion confirmation"),
8615
- success: z24.literal(true).describe("Whether the deletion succeeded")
9105
+ delete_secret_reference: z29.object({
9106
+ message: z29.string().describe("Deletion confirmation"),
9107
+ success: z29.literal(true).describe("Whether the deletion succeeded")
8616
9108
  })
8617
9109
  };
8618
9110
  function getToolOutputSchema(toolName) {
@@ -8688,7 +9180,7 @@ function wrapToolCallback(toolName, callback) {
8688
9180
  return normalizeToolResult(await callback(...args));
8689
9181
  } catch (error) {
8690
9182
  const message = getToolErrorMessage(error);
8691
- const isValidationError = error instanceof z24.ZodError;
9183
+ const isValidationError = error instanceof z29.ZodError;
8692
9184
  const text = isValidationError ? `Invalid arguments for "${toolName}": ${message}` : `Tool "${toolName}" failed: ${message}`;
8693
9185
  Logger.error("Tool callback failed", {
8694
9186
  error: message,
@@ -9799,7 +10291,7 @@ function createManagedEventStore(config) {
9799
10291
  // src/lib/mcp-server.ts
9800
10292
  import { readFileSync } from "node:fs";
9801
10293
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9802
- import { z as z25 } from "zod";
10294
+ import { z as z30 } from "zod";
9803
10295
  var PACKAGE_JSON_URL_CANDIDATES = [
9804
10296
  new URL("../../package.json", import.meta.url),
9805
10297
  new URL("../package.json", import.meta.url)
@@ -9872,8 +10364,8 @@ function registerServerPromptsAndResources(server) {
9872
10364
  title: "Plan Portkey Admin Workflow",
9873
10365
  description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
9874
10366
  argsSchema: {
9875
- task: z25.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
9876
- area: z25.string().max(80).optional().describe(
10367
+ task: z30.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
10368
+ area: z30.string().max(80).optional().describe(
9877
10369
  "Optional Portkey area, such as prompts, analytics, configs, or users"
9878
10370
  )
9879
10371
  }
@@ -9952,6 +10444,7 @@ function createMcpServer(options = {}) {
9952
10444
  version: PACKAGE_VERSION
9953
10445
  },
9954
10446
  {
10447
+ maxToolInputElements: 1e4,
9955
10448
  capabilities: {
9956
10449
  prompts: { listChanged: true },
9957
10450
  resources: { listChanged: true },