portkey-admin-mcp 0.13.0 → 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/index.js CHANGED
@@ -59,7 +59,129 @@ var Logger = {
59
59
  // src/lib/mcp-server.ts
60
60
  import { readFileSync } from "node:fs";
61
61
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
62
- import { z as z26 } from "zod";
62
+ import { z as z30 } from "zod";
63
+
64
+ // src/schemas/contracts/access-policies.contract.ts
65
+ import { z } from "zod";
66
+ var AccessPolicySubjectSchema = z.object({
67
+ type: z.enum(["user", "group", "agent"]).describe("Subject kind; users and agents are matched independently"),
68
+ id: z.string().min(1).describe(
69
+ "Subject ID; ANY matches all users or all agents, but cannot identify a group"
70
+ )
71
+ }).refine((subject) => subject.type !== "group" || subject.id !== "ANY", {
72
+ message: "ANY is supported only for users and agents"
73
+ });
74
+ var selectionSchema = z.union([
75
+ z.literal("ALL"),
76
+ z.array(z.string().min(1)).min(1)
77
+ ]);
78
+ var AccessPolicyTargetSchema = z.discriminatedUnion("type", [
79
+ z.object({
80
+ type: z.literal("mcp_server").describe("Target an MCP server"),
81
+ server_id: z.string().min(1).describe(
82
+ "MCP server UUID or slug in the workspace; responses return the UUID"
83
+ ),
84
+ tools: selectionSchema.describe(
85
+ "ALL tools on the server, or a nonempty list of tool names"
86
+ )
87
+ }),
88
+ z.object({
89
+ type: z.literal("provider").describe("Target a provider"),
90
+ provider_id: z.string().min(1).describe(
91
+ "Provider UUID or slug in the workspace; responses return the UUID"
92
+ ),
93
+ models: selectionSchema.optional().describe(
94
+ "ALL models or a nonempty list of model slugs; omitted defaults to ALL in Portkey"
95
+ )
96
+ })
97
+ ]);
98
+ var policyFields = {
99
+ name: z.string().min(1).max(64).describe("Policy name, unique within the workspace (1-64 characters)"),
100
+ description: z.string().max(256).nullable().optional().describe("Policy description; null clears it"),
101
+ effect: z.enum(["allow", "deny"]).optional().describe(
102
+ "Allow or deny access; omitted create effect is inferred, while omitted update effect keeps its stored value"
103
+ ),
104
+ subjects: z.array(AccessPolicySubjectSchema).min(1).describe(
105
+ "Complete subject list; updates replace the existing subjects. A side without entries matches requests without that principal"
106
+ ),
107
+ targets: z.array(AccessPolicyTargetSchema).min(1).describe("Complete target list; updates replace the existing targets"),
108
+ enabled: z.boolean().optional().describe(
109
+ "Whether the policy is enabled; creates default to true, updates preserve the stored value when omitted"
110
+ )
111
+ };
112
+ function hasSpecificAllowSubject(policy) {
113
+ return policy.effect !== "allow" || policy.subjects.some((subject) => subject.id !== "ANY");
114
+ }
115
+ var CreateAccessPolicyRequestSchema = z.object({
116
+ workspace_id: z.string().optional().describe(
117
+ "Workspace UUID or slug; required with an organisation-level API key"
118
+ ),
119
+ ...policyFields
120
+ }).refine(
121
+ (policy) => {
122
+ const effect = policy.effect ?? (policy.subjects.some(
123
+ (subject) => subject.type === "user" && subject.id === "ANY"
124
+ ) && policy.subjects.some(
125
+ (subject) => subject.type === "agent" && subject.id === "ANY"
126
+ ) ? "deny" : "allow");
127
+ return hasSpecificAllowSubject({ ...policy, effect });
128
+ },
129
+ {
130
+ message: "An allow policy must name at least one specific user, group, or agent"
131
+ }
132
+ );
133
+ var UpdateAccessPolicyRequestSchema = z.object({
134
+ ...policyFields,
135
+ name: policyFields.name.optional(),
136
+ version: z.number().int().min(1).describe(
137
+ "Current version from get_access_policy; a stale version returns HTTP 409"
138
+ )
139
+ }).refine(hasSpecificAllowSubject, {
140
+ message: "An allow policy must name at least one specific user, group, or agent"
141
+ });
142
+ var responseFields = {
143
+ id: z.string().uuid().optional(),
144
+ name: z.string().optional(),
145
+ description: z.string().nullable().optional(),
146
+ enabled: z.boolean().optional(),
147
+ effect: z.enum(["allow", "deny"]).optional(),
148
+ version: z.number().int().optional(),
149
+ status: z.literal("active").optional(),
150
+ workspace_id: z.string().uuid().optional(),
151
+ organisation_id: z.string().uuid().optional(),
152
+ created_by: z.string().nullable().optional(),
153
+ created_at: z.iso.datetime().optional(),
154
+ last_updated_at: z.iso.datetime().optional(),
155
+ object: z.literal("access").optional()
156
+ };
157
+ var AccessPolicyListItemSchema = z.object({
158
+ ...responseFields,
159
+ allow_all_users: z.boolean().optional(),
160
+ allow_all_agents: z.boolean().optional(),
161
+ target_server_count: z.number().int().optional(),
162
+ target_provider_count: z.number().int().optional()
163
+ });
164
+ var AccessPolicySchema = z.object({
165
+ ...responseFields,
166
+ subjects: z.array(
167
+ z.object({
168
+ type: z.enum(["user", "group", "agent"]).optional(),
169
+ id: z.string().optional(),
170
+ name: z.string().nullable().optional(),
171
+ email: z.string().nullable().optional()
172
+ })
173
+ ).optional(),
174
+ targets: z.array(AccessPolicyTargetSchema).optional()
175
+ });
176
+ var ListAccessPoliciesResponseSchema = z.object({
177
+ object: z.literal("list").optional(),
178
+ total: z.number().int().optional(),
179
+ data: z.array(AccessPolicyListItemSchema).optional()
180
+ });
181
+ var CreateAccessPolicyResponseSchema = z.object({
182
+ id: z.string().uuid().optional(),
183
+ object: z.literal("access").optional()
184
+ });
63
185
 
64
186
  // src/services/base.service.ts
65
187
  import crypto from "node:crypto";
@@ -424,6 +546,48 @@ var BaseService = class {
424
546
  }
425
547
  };
426
548
 
549
+ // src/services/access-policies.service.ts
550
+ function normalizePolicy(value) {
551
+ const policy = { ...value };
552
+ for (const field of ["enabled", "allow_all_users", "allow_all_agents"]) {
553
+ if (policy[field] === 0 || policy[field] === 1)
554
+ policy[field] = policy[field] === 1;
555
+ }
556
+ if (policy.object === "acces") policy.object = "access";
557
+ return policy;
558
+ }
559
+ var AccessPoliciesService = class extends BaseService {
560
+ async createAccessPolicy(data) {
561
+ return CreateAccessPolicyResponseSchema.parse(
562
+ normalizePolicy(await this.post("/policies/access", data))
563
+ );
564
+ }
565
+ async listAccessPolicies(params) {
566
+ const response = await this.get(
567
+ "/policies/access",
568
+ params
569
+ );
570
+ return ListAccessPoliciesResponseSchema.parse({
571
+ ...response,
572
+ ...Array.isArray(response.data) ? { data: response.data.map(normalizePolicy) } : {}
573
+ });
574
+ }
575
+ async getAccessPolicy(id) {
576
+ return AccessPolicySchema.parse(
577
+ normalizePolicy(
578
+ await this.get(`/policies/access/${this.encodePathSegment(id)}`)
579
+ )
580
+ );
581
+ }
582
+ async updateAccessPolicy(id, data) {
583
+ return this.put(`/policies/access/${this.encodePathSegment(id)}`, data);
584
+ }
585
+ async deleteAccessPolicy(id) {
586
+ await this.delete(`/policies/access/${this.encodePathSegment(id)}`);
587
+ return {};
588
+ }
589
+ };
590
+
427
591
  // src/services/analytics.service.ts
428
592
  var AnalyticsService = class extends BaseService {
429
593
  /**
@@ -763,6 +927,85 @@ var DeploymentsService = class extends BaseService {
763
927
  }
764
928
  };
765
929
 
930
+ // src/schemas/contracts/egress-allowlist.contract.ts
931
+ import { isIP } from "node:net";
932
+ import { z as z2 } from "zod";
933
+ var EgressAllowlistDomainSchema = z2.string().min(1).max(255).refine(
934
+ (value) => {
935
+ const host = value.trim();
936
+ if (isIP(host) || host.startsWith("[") && host.endsWith("]") && isIP(host.slice(1, -1)) === 6)
937
+ return true;
938
+ const hostname = host.replace(/^\*\./, "").replace(/\.$/, "");
939
+ return hostname.split(".").every(
940
+ (label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label)
941
+ );
942
+ },
943
+ {
944
+ message: "Use a hostname, IP literal, or *. wildcard without scheme, path, credentials, or port"
945
+ }
946
+ ).describe(
947
+ "Exact hostname, IPv4/IPv6 literal (optionally bracketed), or *. wildcard. No scheme, path, credentials, or port. Portkey trims/lowercases it and rejects cloud-metadata destinations"
948
+ );
949
+ var descriptionSchema = z2.string().max(500).nullable().optional().describe("Optional description (up to 500 characters); null clears it");
950
+ var CreateEgressAllowlistRequestSchema = z2.object({
951
+ domain: EgressAllowlistDomainSchema,
952
+ description: descriptionSchema
953
+ });
954
+ var UpdateEgressAllowlistRequestSchema = z2.object({
955
+ domain: EgressAllowlistDomainSchema.optional(),
956
+ description: descriptionSchema
957
+ }).refine(
958
+ (value) => value.domain !== void 0 || value.description !== void 0,
959
+ { message: "Provide domain or description to update" }
960
+ );
961
+ var EgressAllowlistEntrySchema = z2.object({
962
+ id: z2.string().uuid().optional(),
963
+ organisation_id: z2.string().uuid().optional(),
964
+ domain: z2.string().optional(),
965
+ description: z2.string().nullable().optional(),
966
+ status: z2.literal("active").optional(),
967
+ created_by: z2.string().uuid().nullable().optional(),
968
+ created_at: z2.iso.datetime().optional(),
969
+ last_updated_at: z2.iso.datetime().optional(),
970
+ object: z2.literal("egress-allowlist").optional()
971
+ });
972
+ var ListEgressAllowlistResponseSchema = z2.object({
973
+ object: z2.literal("list").optional(),
974
+ total: z2.number().int().optional(),
975
+ data: z2.array(EgressAllowlistEntrySchema).optional()
976
+ });
977
+ var CreateEgressAllowlistResponseSchema = z2.object({
978
+ id: z2.string().uuid().optional(),
979
+ domain: z2.string().optional(),
980
+ object: z2.literal("egress-allowlist").optional()
981
+ });
982
+
983
+ // src/services/egress-allowlist.service.ts
984
+ var EgressAllowlistService = class extends BaseService {
985
+ async createEgressAllowlistEntry(data) {
986
+ return CreateEgressAllowlistResponseSchema.parse(
987
+ await this.postV2("/egress-allowlist", data)
988
+ );
989
+ }
990
+ async listEgressAllowlist(params) {
991
+ return ListEgressAllowlistResponseSchema.parse(
992
+ await this.getV2("/egress-allowlist", params)
993
+ );
994
+ }
995
+ async getEgressAllowlistEntry(id) {
996
+ return EgressAllowlistEntrySchema.parse(
997
+ await this.getV2(`/egress-allowlist/${this.encodePathSegment(id)}`)
998
+ );
999
+ }
1000
+ async updateEgressAllowlistEntry(id, data) {
1001
+ return this.putV2(`/egress-allowlist/${this.encodePathSegment(id)}`, data);
1002
+ }
1003
+ async deleteEgressAllowlistEntry(id) {
1004
+ await this.deleteV2(`/egress-allowlist/${this.encodePathSegment(id)}`);
1005
+ return {};
1006
+ }
1007
+ };
1008
+
766
1009
  // src/services/guardrails.service.ts
767
1010
  var GuardrailsService = class extends BaseService {
768
1011
  /** Get the organisation-wide input and output guardrail defaults. */
@@ -969,7 +1212,12 @@ var IntegrationsService = class extends BaseService {
969
1212
  current_page: params?.current_page,
970
1213
  page_size: params?.page_size
971
1214
  });
972
- const data = response.data ?? response.models ?? [];
1215
+ const data = (response.data ?? response.models ?? []).map(
1216
+ ({ is_custom, ...model }) => is_custom === void 0 ? model : {
1217
+ ...model,
1218
+ is_custom: typeof is_custom === "number" ? is_custom === 1 : is_custom
1219
+ }
1220
+ );
973
1221
  return {
974
1222
  object: response.object ?? "list",
975
1223
  total: response.total ?? data.length,
@@ -2062,6 +2310,8 @@ function getSharedServiceCacheKey(apiKey) {
2062
2310
  }
2063
2311
  var sharedPortkeyServices = /* @__PURE__ */ new Map();
2064
2312
  var PortkeyService = class {
2313
+ accessPolicies;
2314
+ egressAllowlist;
2065
2315
  users;
2066
2316
  workspaces;
2067
2317
  configs;
@@ -2087,6 +2337,14 @@ var PortkeyService = class {
2087
2337
  const resolvedApiKey = resolvePortkeyApiKey(apiKey);
2088
2338
  const resolvedBaseUrl = process.env.PORTKEY_BASE_URL ?? "https://api.portkey.ai/v1";
2089
2339
  validateUrl(resolvedBaseUrl);
2340
+ this.accessPolicies = new AccessPoliciesService(
2341
+ resolvedApiKey,
2342
+ resolvedBaseUrl
2343
+ );
2344
+ this.egressAllowlist = new EgressAllowlistService(
2345
+ resolvedApiKey,
2346
+ resolvedBaseUrl
2347
+ );
2090
2348
  this.users = new UsersService(resolvedApiKey, resolvedBaseUrl);
2091
2349
  this.workspaces = new WorkspacesService(resolvedApiKey, resolvedBaseUrl);
2092
2350
  this.configs = new ConfigsService(resolvedApiKey, resolvedBaseUrl);
@@ -2132,7 +2390,7 @@ function getSharedPortkeyService(apiKey) {
2132
2390
  }
2133
2391
 
2134
2392
  // src/tools/index.ts
2135
- import { z as z25 } from "zod";
2393
+ import { z as z29 } from "zod";
2136
2394
 
2137
2395
  // src/lib/type-guards.ts
2138
2396
  function isRecord(value) {
@@ -2140,97 +2398,97 @@ function isRecord(value) {
2140
2398
  }
2141
2399
 
2142
2400
  // src/schemas/contracts/secret-references.contract.ts
2143
- import { z } from "zod";
2144
- var SecretManagerTypeSchema = z.enum([
2401
+ import { z as z3 } from "zod";
2402
+ var SecretManagerTypeSchema = z3.enum([
2145
2403
  "aws_sm",
2146
2404
  "azure_kv",
2147
2405
  "hashicorp_vault"
2148
2406
  ]);
2149
- var SecretReferenceListItemSchema = z.object({
2150
- id: z.string().uuid(),
2151
- name: z.string(),
2152
- slug: z.string(),
2407
+ var SecretReferenceListItemSchema = z3.object({
2408
+ id: z3.string().uuid(),
2409
+ name: z3.string(),
2410
+ slug: z3.string(),
2153
2411
  manager_type: SecretManagerTypeSchema,
2154
- status: z.literal("ACTIVE"),
2155
- created_at: z.iso.datetime(),
2156
- last_updated_at: z.iso.datetime(),
2157
- object: z.literal("secret-reference")
2412
+ status: z3.literal("ACTIVE"),
2413
+ created_at: z3.iso.datetime(),
2414
+ last_updated_at: z3.iso.datetime(),
2415
+ object: z3.literal("secret-reference")
2158
2416
  });
2159
- var ListSecretReferencesResponseSchema = z.object({
2160
- object: z.literal("list"),
2161
- total: z.number().int().nonnegative(),
2162
- data: z.array(SecretReferenceListItemSchema)
2417
+ var ListSecretReferencesResponseSchema = z3.object({
2418
+ object: z3.literal("list"),
2419
+ total: z3.number().int().nonnegative(),
2420
+ data: z3.array(SecretReferenceListItemSchema)
2163
2421
  });
2164
2422
  var SecretReferenceDetailSchema = SecretReferenceListItemSchema.extend(
2165
2423
  {
2166
- organisation_id: z.string().uuid(),
2167
- description: z.string().nullable(),
2168
- secret_path: z.string(),
2169
- secret_key: z.string().nullable(),
2170
- allow_all_workspaces: z.boolean(),
2171
- tags: z.record(z.string(), z.string()).nullable(),
2172
- created_by: z.string(),
2173
- auth_config: z.record(z.string(), z.unknown())
2424
+ organisation_id: z3.string().uuid(),
2425
+ description: z3.string().nullable(),
2426
+ secret_path: z3.string(),
2427
+ secret_key: z3.string().nullable(),
2428
+ allow_all_workspaces: z3.boolean(),
2429
+ tags: z3.record(z3.string(), z3.string()).nullable(),
2430
+ created_by: z3.string(),
2431
+ auth_config: z3.record(z3.string(), z3.unknown())
2174
2432
  }
2175
2433
  );
2176
- var CreateSecretReferenceResponseSchema = z.object({
2177
- id: z.string().uuid(),
2178
- slug: z.string(),
2179
- object: z.literal("secret-reference")
2434
+ var CreateSecretReferenceResponseSchema = z3.object({
2435
+ id: z3.string().uuid(),
2436
+ slug: z3.string(),
2437
+ object: z3.literal("secret-reference")
2180
2438
  });
2181
2439
 
2182
- // src/tools/analytics.tools.ts
2183
- import { z as z3 } from "zod";
2440
+ // src/tools/access-policies.tools.ts
2441
+ import { z as z5 } from "zod";
2184
2442
 
2185
2443
  // src/lib/schemas.ts
2186
- import { z as z2 } from "zod";
2187
- var PromptFunctionSchema = z2.object({
2188
- name: z2.string().describe("Function name"),
2189
- description: z2.string().optional().describe("Function description"),
2190
- parameters: z2.record(z2.string(), z2.unknown()).optional().describe("Function parameters schema")
2444
+ import { z as z4 } from "zod";
2445
+ var PromptFunctionSchema = z4.object({
2446
+ name: z4.string().describe("Function name"),
2447
+ description: z4.string().optional().describe("Function description"),
2448
+ parameters: z4.record(z4.string(), z4.unknown()).optional().describe("Function parameters schema")
2191
2449
  });
2192
- var PromptToolSchema = z2.object({
2193
- type: z2.literal("function").describe("Tool type"),
2450
+ var PromptToolSchema = z4.object({
2451
+ type: z4.literal("function").describe("Tool type"),
2194
2452
  function: PromptFunctionSchema.describe("Function definition")
2195
2453
  });
2196
- var HyperparametersSchema = z2.object({
2197
- max_tokens: z2.coerce.number().positive().optional().describe("Maximum tokens to generate"),
2198
- temperature: z2.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
2199
- top_p: z2.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
2200
- top_k: z2.coerce.number().positive().optional().describe("Top-k sampling"),
2201
- presence_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
2202
- frequency_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
2203
- stop: z2.array(z2.string()).optional().describe("Stop sequences")
2454
+ var HyperparametersSchema = z4.object({
2455
+ max_tokens: z4.coerce.number().positive().optional().describe("Maximum tokens to generate"),
2456
+ temperature: z4.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
2457
+ top_p: z4.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
2458
+ top_k: z4.coerce.number().positive().optional().describe("Top-k sampling"),
2459
+ presence_penalty: z4.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
2460
+ frequency_penalty: z4.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
2461
+ stop: z4.array(z4.string()).optional().describe("Stop sequences")
2204
2462
  });
2205
- var PromptAppIdentifierSchema = z2.string().min(1).describe(
2463
+ var PromptAppIdentifierSchema = z4.string().min(1).describe(
2206
2464
  "App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
2207
2465
  );
2208
- var PromptEnvironmentIdentifierSchema = z2.string().min(1).describe(
2466
+ var PromptEnvironmentIdentifierSchema = z4.string().min(1).describe(
2209
2467
  "Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
2210
2468
  );
2211
- var BillingMetadataSchema = z2.object({
2212
- client_id: z2.string().describe("Client ID for billing attribution (REQUIRED)"),
2469
+ var BillingMetadataSchema = z4.object({
2470
+ client_id: z4.string().describe("Client ID for billing attribution (REQUIRED)"),
2213
2471
  app: PromptAppIdentifierSchema,
2214
2472
  env: PromptEnvironmentIdentifierSchema,
2215
- project_id: z2.string().optional().describe("Project ID for granular billing"),
2216
- feature: z2.string().optional().describe("Feature name for tracking")
2473
+ project_id: z4.string().optional().describe("Project ID for granular billing"),
2474
+ feature: z4.string().optional().describe("Feature name for tracking")
2217
2475
  });
2218
- var ToolChoiceSchema = z2.object({
2219
- mode: z2.enum(["auto", "none", "function"]).describe(
2476
+ var ToolChoiceSchema = z4.object({
2477
+ mode: z4.enum(["auto", "none", "function"]).describe(
2220
2478
  "Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
2221
2479
  ),
2222
- function_name: z2.string().optional().describe("Required when mode is 'function'; ignored otherwise")
2480
+ function_name: z4.string().optional().describe("Required when mode is 'function'; ignored otherwise")
2223
2481
  }).superRefine((value, ctx) => {
2224
2482
  if (value.mode === "function" && !value.function_name) {
2225
2483
  ctx.addIssue({
2226
- code: z2.ZodIssueCode.custom,
2484
+ code: z4.ZodIssueCode.custom,
2227
2485
  path: ["function_name"],
2228
2486
  message: "function_name is required when mode is 'function'"
2229
2487
  });
2230
2488
  }
2231
2489
  if (value.mode !== "function" && value.function_name !== void 0) {
2232
2490
  ctx.addIssue({
2233
- code: z2.ZodIssueCode.custom,
2491
+ code: z4.ZodIssueCode.custom,
2234
2492
  path: ["function_name"],
2235
2493
  message: "function_name is only allowed when mode is 'function'"
2236
2494
  });
@@ -2250,9 +2508,9 @@ function toPromptToolChoice(toolChoice) {
2250
2508
  }
2251
2509
  return toolChoice.mode;
2252
2510
  }
2253
- var CurrentPageSchema = z2.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
2511
+ var CurrentPageSchema = z4.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
2254
2512
  function pageSizeSchema(max = 100) {
2255
- return z2.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
2513
+ return z4.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
2256
2514
  }
2257
2515
  var PageSizeSchema = pageSizeSchema();
2258
2516
 
@@ -2268,44 +2526,111 @@ function jsonResult(data) {
2268
2526
  };
2269
2527
  }
2270
2528
 
2529
+ // src/tools/access-policies.tools.ts
2530
+ var idSchema = z5.string().uuid().describe(
2531
+ "Access policy UUID from list_access_policies or create_access_policy"
2532
+ );
2533
+ var listSchema = {
2534
+ workspace_id: z5.string().optional().describe("Workspace UUID or slug"),
2535
+ effect: z5.enum(["allow", "deny"]).optional().describe("Filter by allow or deny effect"),
2536
+ enabled: z5.boolean().optional().describe("Filter enabled or disabled policies; false is preserved"),
2537
+ user_id: z5.string().max(36).optional().describe("Policies naming this user or matching all users"),
2538
+ agent_id: z5.string().max(36).optional().describe("Policies naming this agent or matching all agents"),
2539
+ server_id: z5.string().max(100).optional().describe("Policies targeting this MCP server ID"),
2540
+ search: z5.string().max(64).optional().describe("Search policy names"),
2541
+ created_by: z5.string().max(255).optional().describe("Filter by creator user ID"),
2542
+ start_time: z5.iso.datetime().optional().describe("Policies created at or after this ISO 8601 timestamp"),
2543
+ end_time: z5.iso.datetime().optional().describe("Policies created at or before this ISO 8601 timestamp"),
2544
+ current_page: CurrentPageSchema,
2545
+ page_size: z5.coerce.number().int().nonnegative().optional().describe("Items per page; the published API permits zero")
2546
+ };
2547
+ var lookupSchema = { id: idSchema };
2548
+ var updateSchema = UpdateAccessPolicyRequestSchema.safeExtend({
2549
+ id: idSchema
2550
+ });
2551
+ function registerAccessPoliciesTools(server, service) {
2552
+ server.registerTool(
2553
+ "create_access_policy",
2554
+ {
2555
+ 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.",
2556
+ inputSchema: CreateAccessPolicyRequestSchema
2557
+ },
2558
+ async (params) => jsonResult(await service.accessPolicies.createAccessPolicy(params))
2559
+ );
2560
+ server.registerTool(
2561
+ "list_access_policies",
2562
+ {
2563
+ 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.",
2564
+ inputSchema: listSchema
2565
+ },
2566
+ async (params) => jsonResult(await service.accessPolicies.listAccessPolicies(params))
2567
+ );
2568
+ server.registerTool(
2569
+ "get_access_policy",
2570
+ {
2571
+ 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.",
2572
+ inputSchema: lookupSchema
2573
+ },
2574
+ async ({ id }) => jsonResult(await service.accessPolicies.getAccessPolicy(id))
2575
+ );
2576
+ server.registerTool(
2577
+ "update_access_policy",
2578
+ {
2579
+ 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.",
2580
+ inputSchema: updateSchema,
2581
+ annotations: { destructiveHint: true }
2582
+ },
2583
+ async ({ id, ...params }) => jsonResult(await service.accessPolicies.updateAccessPolicy(id, params))
2584
+ );
2585
+ server.registerTool(
2586
+ "delete_access_policy",
2587
+ {
2588
+ 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.",
2589
+ inputSchema: lookupSchema
2590
+ },
2591
+ async ({ id }) => jsonResult(await service.accessPolicies.deleteAccessPolicy(id))
2592
+ );
2593
+ }
2594
+
2271
2595
  // src/tools/analytics.tools.ts
2596
+ import { z as z6 } from "zod";
2272
2597
  var baseAnalyticsSchema = {
2273
- time_of_generation_min: z3.string().describe(
2598
+ time_of_generation_min: z6.string().describe(
2274
2599
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
2275
2600
  ),
2276
- time_of_generation_max: z3.string().describe(
2601
+ time_of_generation_max: z6.string().describe(
2277
2602
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
2278
2603
  ),
2279
- total_units_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
2280
- total_units_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
2281
- cost_min: z3.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
2282
- cost_max: z3.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
2283
- prompt_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
2284
- prompt_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
2285
- completion_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
2286
- completion_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
2287
- status_code: z3.string().optional().describe(
2604
+ total_units_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
2605
+ total_units_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
2606
+ cost_min: z6.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
2607
+ cost_max: z6.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
2608
+ prompt_token_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
2609
+ prompt_token_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
2610
+ completion_token_min: z6.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
2611
+ completion_token_max: z6.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
2612
+ status_code: z6.string().optional().describe(
2288
2613
  "Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
2289
2614
  ),
2290
- weighted_feedback_min: z3.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
2291
- weighted_feedback_max: z3.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
2292
- virtual_keys: z3.string().optional().describe(
2615
+ weighted_feedback_min: z6.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
2616
+ weighted_feedback_max: z6.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
2617
+ virtual_keys: z6.string().optional().describe(
2293
2618
  "Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
2294
2619
  ),
2295
- configs: z3.string().optional().describe(
2620
+ configs: z6.string().optional().describe(
2296
2621
  "Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
2297
2622
  ),
2298
- status_codes: z3.array(z3.string()).optional().describe(
2623
+ status_codes: z6.array(z6.string()).optional().describe(
2299
2624
  "Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
2300
2625
  ),
2301
- virtual_key_slugs: z3.array(z3.string()).optional().describe(
2626
+ virtual_key_slugs: z6.array(z6.string()).optional().describe(
2302
2627
  "Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
2303
2628
  ),
2304
- config_slugs: z3.array(z3.string()).optional().describe(
2629
+ config_slugs: z6.array(z6.string()).optional().describe(
2305
2630
  "Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
2306
2631
  ),
2307
- workspace_slug: z3.string().optional().describe("Filter by specific workspace"),
2308
- api_key_ids: z3.preprocess((value) => {
2632
+ workspace_slug: z6.string().optional().describe("Filter by specific workspace"),
2633
+ api_key_ids: z6.preprocess((value) => {
2309
2634
  if (value == null) {
2310
2635
  return value;
2311
2636
  }
@@ -2313,40 +2638,40 @@ var baseAnalyticsSchema = {
2313
2638
  return value.map((item) => String(item)).join(",");
2314
2639
  }
2315
2640
  return value;
2316
- }, z3.string().optional()).describe(
2641
+ }, z6.string().optional()).describe(
2317
2642
  "Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
2318
2643
  ),
2319
- metadata: z3.string().optional().describe(
2644
+ metadata: z6.string().optional().describe(
2320
2645
  `Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
2321
2646
  ),
2322
- ai_org_model: z3.string().optional().describe(
2647
+ ai_org_model: z6.string().optional().describe(
2323
2648
  "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."
2324
2649
  ),
2325
- provider_models: z3.array(z3.string()).optional().describe(
2650
+ provider_models: z6.array(z6.string()).optional().describe(
2326
2651
  "Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
2327
2652
  ),
2328
- deployment_id: z3.string().optional().describe(
2653
+ deployment_id: z6.string().optional().describe(
2329
2654
  "Comma-separated list of deployment IDs (UUIDs) to filter by. Prefer deployment_ids for structured inputs."
2330
2655
  ),
2331
- deployment_ids: z3.array(z3.string()).optional().describe(
2656
+ deployment_ids: z6.array(z6.string()).optional().describe(
2332
2657
  "Structured alias for deployment_id. Use an array of deployment UUIDs; normalized to the comma-separated Portkey query param."
2333
2658
  ),
2334
- trace_id: z3.string().optional().describe(
2659
+ trace_id: z6.string().optional().describe(
2335
2660
  "Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
2336
2661
  ),
2337
- trace_ids: z3.array(z3.string()).optional().describe(
2662
+ trace_ids: z6.array(z6.string()).optional().describe(
2338
2663
  "Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
2339
2664
  ),
2340
- span_id: z3.string().optional().describe(
2665
+ span_id: z6.string().optional().describe(
2341
2666
  "Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
2342
2667
  ),
2343
- span_ids: z3.array(z3.string()).optional().describe(
2668
+ span_ids: z6.array(z6.string()).optional().describe(
2344
2669
  "Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
2345
2670
  ),
2346
- metadata_filter: z3.record(z3.string(), z3.unknown()).optional().describe(
2671
+ metadata_filter: z6.record(z6.string(), z6.unknown()).optional().describe(
2347
2672
  "Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
2348
2673
  ),
2349
- prompt_slug: z3.string().optional().describe("Filter by prompt slug")
2674
+ prompt_slug: z6.string().optional().describe("Filter by prompt slug")
2350
2675
  };
2351
2676
  var paginatedAnalyticsSchema = {
2352
2677
  ...baseAnalyticsSchema,
@@ -2355,9 +2680,9 @@ var paginatedAnalyticsSchema = {
2355
2680
  };
2356
2681
  var cacheSummarySchema = {
2357
2682
  ...baseAnalyticsSchema,
2358
- workspace_slug: z3.string().min(1).describe("Workspace slug to analyze")
2683
+ workspace_slug: z6.string().min(1).describe("Workspace slug to analyze")
2359
2684
  };
2360
- var providerMetricSchema = z3.enum([
2685
+ var providerMetricSchema = z6.enum([
2361
2686
  "requests",
2362
2687
  "cost",
2363
2688
  "total_tokens",
@@ -2377,14 +2702,14 @@ var providerGroupAnalyticsSchema = {
2377
2702
  ...cacheSummarySchema,
2378
2703
  current_page: CurrentPageSchema.describe("Zero-based result page"),
2379
2704
  page_size: PageSizeSchema.describe("Number of provider groups per page"),
2380
- order_by: z3.string().optional().describe("Metric or field used to order groups"),
2381
- order_by_type: z3.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
2382
- columns: z3.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
2383
- include_total: z3.boolean().optional().describe("Request the total provider-group count")
2705
+ order_by: z6.string().optional().describe("Metric or field used to order groups"),
2706
+ order_by_type: z6.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
2707
+ columns: z6.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
2708
+ include_total: z6.boolean().optional().describe("Request the total provider-group count")
2384
2709
  };
2385
2710
  var analyticsGroupMetadataSchema = {
2386
2711
  ...paginatedAnalyticsSchema,
2387
- metadata_key: z3.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
2712
+ metadata_key: z6.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
2388
2713
  };
2389
2714
  function formatGraphAnalytics(summary, dataPoints) {
2390
2715
  return {
@@ -2861,29 +3186,29 @@ function registerAnalyticsTools(server, service) {
2861
3186
  }
2862
3187
 
2863
3188
  // src/tools/audit.tools.ts
2864
- import { z as z4 } from "zod";
3189
+ import { z as z7 } from "zod";
2865
3190
  var AUDIT_TOOL_SCHEMAS = {
2866
3191
  listAuditLogs: {
2867
- start_time: z4.string().describe(
3192
+ start_time: z7.string().describe(
2868
3193
  "Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
2869
3194
  ),
2870
- end_time: z4.string().describe(
3195
+ end_time: z7.string().describe(
2871
3196
  "End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
2872
3197
  ),
2873
- organisation_id: z4.string().describe("Organisation ID whose audit logs to list"),
2874
- workspace_id: z4.string().optional().describe("Filter audit logs by workspace ID"),
2875
- user_id: z4.string().optional().describe(
3198
+ organisation_id: z7.string().describe("Organisation ID whose audit logs to list"),
3199
+ workspace_id: z7.string().optional().describe("Filter audit logs by workspace ID"),
3200
+ user_id: z7.string().optional().describe(
2876
3201
  "Filter by the ID of the user or API key that made the request"
2877
3202
  ),
2878
- user_type: z4.enum(["user", "api_key"]).optional().describe("Filter by whether the request came from a user or an API key"),
2879
- request_id: z4.string().optional().describe("Filter by request ID"),
2880
- method: z4.enum(["POST", "PUT", "DELETE"]).optional().describe("Filter by HTTP method of the audited request"),
2881
- uri: z4.string().optional().describe("Filter by request URI path"),
2882
- client_ip: z4.string().optional().describe("Filter by client IP address"),
2883
- country: z4.string().optional().describe("Filter by country derived from the client IP"),
2884
- response_status_code: z4.coerce.number().int().optional().describe("Filter by HTTP response status code (e.g., 200, 403)"),
2885
- action: z4.string().optional().describe("Filter by action type (e.g., 'create', 'update', 'delete')"),
2886
- resource_type: z4.string().optional().describe(
3203
+ user_type: z7.enum(["user", "api_key"]).optional().describe("Filter by whether the request came from a user or an API key"),
3204
+ request_id: z7.string().optional().describe("Filter by request ID"),
3205
+ method: z7.enum(["POST", "PUT", "DELETE"]).optional().describe("Filter by HTTP method of the audited request"),
3206
+ uri: z7.string().optional().describe("Filter by request URI path"),
3207
+ client_ip: z7.string().optional().describe("Filter by client IP address"),
3208
+ country: z7.string().optional().describe("Filter by country derived from the client IP"),
3209
+ response_status_code: z7.coerce.number().int().optional().describe("Filter by HTTP response status code (e.g., 200, 403)"),
3210
+ action: z7.string().optional().describe("Filter by action type (e.g., 'create', 'update', 'delete')"),
3211
+ resource_type: z7.string().optional().describe(
2887
3212
  "Filter by resource type (e.g., 'workspace', 'config', 'virtual_key')"
2888
3213
  ),
2889
3214
  current_page: CurrentPageSchema,
@@ -2940,33 +3265,33 @@ function registerAuditTools(server, service) {
2940
3265
  }
2941
3266
 
2942
3267
  // src/tools/collections.tools.ts
2943
- import { z as z5 } from "zod";
3268
+ import { z as z8 } from "zod";
2944
3269
  var COLLECTIONS_TOOL_SCHEMAS = {
2945
3270
  listCollections: {
2946
- workspace_id: z5.string().optional().describe("Filter by workspace ID"),
2947
- search: z5.string().optional().describe("Search collections by name"),
3271
+ workspace_id: z8.string().optional().describe("Filter by workspace ID"),
3272
+ search: z8.string().optional().describe("Search collections by name"),
2948
3273
  current_page: CurrentPageSchema,
2949
3274
  page_size: PageSizeSchema
2950
3275
  },
2951
3276
  createCollection: {
2952
- name: z5.string().describe(
3277
+ name: z8.string().describe(
2953
3278
  "Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
2954
3279
  ),
2955
- workspace_id: z5.string().optional().describe("Workspace ID to create collection in"),
2956
- parent_collection_id: z5.string().optional().describe(
3280
+ workspace_id: z8.string().optional().describe("Workspace ID to create collection in"),
3281
+ parent_collection_id: z8.string().optional().describe(
2957
3282
  "ID or slug of the parent collection to nest under; omit for a top-level collection"
2958
3283
  )
2959
3284
  },
2960
3285
  getCollection: {
2961
- collection_id: z5.string().describe("Collection ID or slug to retrieve")
3286
+ collection_id: z8.string().describe("Collection ID or slug to retrieve")
2962
3287
  },
2963
3288
  updateCollection: {
2964
- collection_id: z5.string().describe("Collection ID to update"),
2965
- name: z5.string().optional().describe("New name for the collection"),
2966
- description: z5.string().optional().describe("New description for the collection")
3289
+ collection_id: z8.string().describe("Collection ID to update"),
3290
+ name: z8.string().optional().describe("New name for the collection"),
3291
+ description: z8.string().optional().describe("New description for the collection")
2967
3292
  },
2968
3293
  deleteCollection: {
2969
- collection_id: z5.string().describe("Collection ID to delete")
3294
+ collection_id: z8.string().describe("Collection ID to delete")
2970
3295
  }
2971
3296
  };
2972
3297
  function registerCollectionsTools(server, service) {
@@ -3055,10 +3380,10 @@ function registerCollectionsTools(server, service) {
3055
3380
  }
3056
3381
 
3057
3382
  // src/tools/configs.tools.ts
3058
- import { z as z6 } from "zod";
3059
- var configTargetSchema = z6.object({
3060
- provider: z6.string().optional().describe("Provider slug to route requests to"),
3061
- virtual_key: z6.string().optional().describe("Virtual key slug to use for this routing target")
3383
+ import { z as z9 } from "zod";
3384
+ var configTargetSchema = z9.object({
3385
+ provider: z9.string().optional().describe("Provider slug to route requests to"),
3386
+ virtual_key: z9.string().optional().describe("Virtual key slug to use for this routing target")
3062
3387
  }).refine((target) => target.provider || target.virtual_key, {
3063
3388
  message: "Each target must have at least provider or virtual_key"
3064
3389
  });
@@ -3068,45 +3393,45 @@ var CONFIGS_TOOL_SCHEMAS = {
3068
3393
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
3069
3394
  },
3070
3395
  getConfig: {
3071
- slug: z6.string().describe(
3396
+ slug: z9.string().describe(
3072
3397
  "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"
3073
3398
  )
3074
3399
  },
3075
3400
  createConfig: {
3076
- name: z6.string().describe("Name for the new configuration"),
3077
- workspace_id: z6.string().optional().describe("Workspace ID to create config in"),
3078
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3079
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3080
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3081
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
3082
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
3083
- targets: z6.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
3401
+ name: z9.string().describe("Name for the new configuration"),
3402
+ workspace_id: z9.string().optional().describe("Workspace ID to create config in"),
3403
+ cache_mode: z9.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3404
+ cache_max_age: z9.coerce.number().positive().optional().describe("Cache max age in seconds"),
3405
+ retry_attempts: z9.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3406
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
3407
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
3408
+ targets: z9.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
3084
3409
  },
3085
3410
  updateConfig: {
3086
- slug: z6.string().describe("Configuration slug to update"),
3087
- name: z6.string().optional().describe("New name for the configuration"),
3088
- status: z6.enum(["active", "inactive"]).optional().describe("Configuration status"),
3089
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3090
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3091
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3092
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on"),
3093
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
3094
- targets: z6.array(configTargetSchema).optional().describe("Array of target providers")
3411
+ slug: z9.string().describe("Configuration slug to update"),
3412
+ name: z9.string().optional().describe("New name for the configuration"),
3413
+ status: z9.enum(["active", "inactive"]).optional().describe("Configuration status"),
3414
+ cache_mode: z9.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3415
+ cache_max_age: z9.coerce.number().positive().optional().describe("Cache max age in seconds"),
3416
+ retry_attempts: z9.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3417
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional().describe("HTTP status codes to retry on"),
3418
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
3419
+ targets: z9.array(configTargetSchema).optional().describe("Array of target providers")
3095
3420
  },
3096
3421
  deleteConfig: {
3097
- slug: z6.string().describe("Configuration slug to delete")
3422
+ slug: z9.string().describe("Configuration slug to delete")
3098
3423
  },
3099
3424
  listConfigVersions: {
3100
- slug: z6.string().describe("Configuration slug to list versions for")
3425
+ slug: z9.string().describe("Configuration slug to list versions for")
3101
3426
  }
3102
3427
  };
3103
- var configPayloadSchema = z6.object({
3104
- cache_mode: z6.enum(["simple", "semantic"]).optional(),
3105
- cache_max_age: z6.coerce.number().positive().optional(),
3106
- retry_attempts: z6.coerce.number().positive().max(5).optional(),
3107
- retry_on_status_codes: z6.array(z6.coerce.number()).optional(),
3108
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional(),
3109
- targets: z6.array(configTargetSchema).optional()
3428
+ var configPayloadSchema = z9.object({
3429
+ cache_mode: z9.enum(["simple", "semantic"]).optional(),
3430
+ cache_max_age: z9.coerce.number().positive().optional(),
3431
+ retry_attempts: z9.coerce.number().positive().max(5).optional(),
3432
+ retry_on_status_codes: z9.array(z9.coerce.number()).optional(),
3433
+ strategy_mode: z9.enum(["loadbalance", "fallback"]).optional(),
3434
+ targets: z9.array(configTargetSchema).optional()
3110
3435
  });
3111
3436
  function buildConfigPayload(params) {
3112
3437
  const cache = params.cache_mode !== void 0 || params.cache_max_age !== void 0 ? {
@@ -3127,10 +3452,10 @@ function buildConfigPayload(params) {
3127
3452
  function hasConfigSettings(config) {
3128
3453
  return config.cache !== void 0 || config.retry !== void 0 || config.strategy !== void 0 || config.targets !== void 0;
3129
3454
  }
3130
- var createConfigSchema = z6.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3455
+ var createConfigSchema = z9.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3131
3456
  if (!hasConfigSettings(buildConfigPayload(value))) {
3132
3457
  ctx.addIssue({
3133
- code: z6.ZodIssueCode.custom,
3458
+ code: z9.ZodIssueCode.custom,
3134
3459
  message: "At least one config setting (cache_mode, retry_attempts, strategy_mode, or targets) must be provided"
3135
3460
  });
3136
3461
  }
@@ -3275,73 +3600,73 @@ function registerConfigsTools(server, service) {
3275
3600
  }
3276
3601
 
3277
3602
  // src/tools/deployments.tools.ts
3278
- import { z as z8 } from "zod";
3603
+ import { z as z11 } from "zod";
3279
3604
 
3280
3605
  // src/tools/tags.schemas.ts
3281
- import { z as z7 } from "zod";
3282
- var resourceTagsSchema = z7.record(
3283
- z7.string().regex(
3606
+ import { z as z10 } from "zod";
3607
+ var resourceTagsSchema = z10.record(
3608
+ z10.string().regex(
3284
3609
  /^[a-zA-Z0-9_-]+$/,
3285
3610
  "Tag keys may contain only letters, numbers, underscores, and hyphens"
3286
3611
  ),
3287
- z7.string()
3612
+ z10.string()
3288
3613
  );
3289
- var integrationTagsSchema = z7.record(z7.string(), z7.string());
3614
+ var integrationTagsSchema = z10.record(z10.string(), z10.string());
3290
3615
 
3291
3616
  // src/tools/deployments.tools.ts
3292
- var binaryFlagSchema = z8.union([z8.literal(0), z8.literal(1)]);
3293
- var deploymentTypeSchema = z8.enum(["production", "non_production"]);
3294
- var deploymentStatusSchema = z8.enum(["active", "archived"]);
3617
+ var binaryFlagSchema = z11.union([z11.literal(0), z11.literal(1)]);
3618
+ var deploymentTypeSchema = z11.enum(["production", "non_production"]);
3619
+ var deploymentStatusSchema = z11.enum(["active", "archived"]);
3295
3620
  var deploymentTagsSchema = resourceTagsSchema;
3296
3621
  var authSettingsSchema = {
3297
- gateway_base_url: z8.url().optional().describe("Self-hosted Gateway base URL"),
3298
- mcp_gateway_base_url: z8.url().optional().describe("MCP Gateway base URL"),
3622
+ gateway_base_url: z11.url().optional().describe("Self-hosted Gateway base URL"),
3623
+ mcp_gateway_base_url: z11.url().optional().describe("MCP Gateway base URL"),
3299
3624
  is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
3300
3625
  is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
3301
- workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
3302
- jwt_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values allowed to use the deployment"),
3303
- jwt_sub_workspace_mapping: z8.record(z8.string(), z8.string()).optional().describe("JWT subject to workspace-slug mapping")
3626
+ workspaces_allowed: z11.array(z11.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
3627
+ jwt_subs_allowed: z11.array(z11.string()).optional().describe("JWT subject values allowed to use the deployment"),
3628
+ jwt_sub_workspace_mapping: z11.record(z11.string(), z11.string()).optional().describe("JWT subject to workspace-slug mapping")
3304
3629
  };
3305
3630
  var DEPLOYMENTS_TOOL_SCHEMAS = {
3306
3631
  listDeployments: {
3307
- organisation_id: z8.string().optional().describe("Filter by organisation UUID"),
3632
+ organisation_id: z11.string().optional().describe("Filter by organisation UUID"),
3308
3633
  status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
3309
3634
  type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
3310
- workspace_slug: z8.array(z8.string()).optional().describe("Filter by one or more workspace slugs"),
3311
- search: z8.string().optional().describe("Search deployment names"),
3635
+ workspace_slug: z11.array(z11.string()).optional().describe("Filter by one or more workspace slugs"),
3636
+ search: z11.string().optional().describe("Search deployment names"),
3312
3637
  tags: deploymentTagsSchema.optional().describe("Match deployments with all supplied tags")
3313
3638
  },
3314
3639
  registerDeployment: {
3315
- name: z8.string().min(1).describe("Deployment display name"),
3316
- organisation_id: z8.string().optional().describe("Owning organisation UUID"),
3317
- slug: z8.string().min(1).max(50).optional().describe("Optional deployment slug"),
3640
+ name: z11.string().min(1).describe("Deployment display name"),
3641
+ organisation_id: z11.string().optional().describe("Owning organisation UUID"),
3642
+ slug: z11.string().min(1).max(50).optional().describe("Optional deployment slug"),
3318
3643
  type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
3319
- deployment_config: z8.record(z8.string(), z8.unknown()).optional().describe("Gateway deployment configuration"),
3320
- is_default: z8.boolean().optional().describe("Make this the default deployment"),
3644
+ deployment_config: z11.record(z11.string(), z11.unknown()).optional().describe("Gateway deployment configuration"),
3645
+ is_default: z11.boolean().optional().describe("Make this the default deployment"),
3321
3646
  tags: deploymentTagsSchema.nullable().optional().describe("Deployment tags, or null to create without tags"),
3322
3647
  ...authSettingsSchema
3323
3648
  },
3324
3649
  getDeployment: {
3325
- id: z8.string().min(1).describe("Deployment UUID or self"),
3326
- organisation_id: z8.string().optional().describe("Organisation UUID scope")
3650
+ id: z11.string().min(1).describe("Deployment UUID or self"),
3651
+ organisation_id: z11.string().optional().describe("Organisation UUID scope")
3327
3652
  },
3328
3653
  updateDeployment: {
3329
- id: z8.string().min(1).describe("Deployment UUID"),
3330
- name: z8.string().optional().describe("Replacement display name"),
3654
+ id: z11.string().min(1).describe("Deployment UUID"),
3655
+ name: z11.string().optional().describe("Replacement display name"),
3331
3656
  type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
3332
3657
  status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
3333
- deployment_config: z8.record(z8.string(), z8.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
3334
- is_default: z8.boolean().optional().describe("Whether this is the default deployment"),
3335
- rotate_auth: z8.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
3336
- override_existing: z8.boolean().optional().describe("Allow replacement of existing deployment settings"),
3658
+ deployment_config: z11.record(z11.string(), z11.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
3659
+ is_default: z11.boolean().optional().describe("Whether this is the default deployment"),
3660
+ rotate_auth: z11.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
3661
+ override_existing: z11.boolean().optional().describe("Allow replacement of existing deployment settings"),
3337
3662
  tags: deploymentTagsSchema.nullable().optional().describe("Replacement deployment tags, or null to clear all tags"),
3338
3663
  ...authSettingsSchema,
3339
- allow_all_workspaces: z8.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
3340
- remove_workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs to remove from the allowlist"),
3341
- remove_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values to remove from the allowlist")
3664
+ allow_all_workspaces: z11.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
3665
+ remove_workspaces_allowed: z11.array(z11.string()).optional().describe("Workspace slugs to remove from the allowlist"),
3666
+ remove_subs_allowed: z11.array(z11.string()).optional().describe("JWT subject values to remove from the allowlist")
3342
3667
  },
3343
3668
  archiveDeployment: {
3344
- id: z8.string().min(1).describe("Deployment UUID to archive")
3669
+ id: z11.string().min(1).describe("Deployment UUID to archive")
3345
3670
  }
3346
3671
  };
3347
3672
  function compact(value) {
@@ -3450,101 +3775,165 @@ function registerDeploymentsTools(server, service) {
3450
3775
  );
3451
3776
  }
3452
3777
 
3778
+ // src/tools/egress-allowlist.tools.ts
3779
+ import { z as z12 } from "zod";
3780
+ var idSchema2 = z12.string().uuid().describe(
3781
+ "Egress allowlist entry UUID from list_egress_allowlist or create_egress_allowlist_entry"
3782
+ );
3783
+ var listSchema2 = {
3784
+ search: z12.string().min(1).max(255).optional().describe("Search allowlisted domains"),
3785
+ current_page: CurrentPageSchema,
3786
+ page_size: PageSizeSchema.describe(
3787
+ "Items per page, 1-100; Portkey defaults to 20"
3788
+ )
3789
+ };
3790
+ var lookupSchema2 = { id: idSchema2 };
3791
+ var updateSchema2 = UpdateEgressAllowlistRequestSchema.safeExtend({
3792
+ id: idSchema2
3793
+ });
3794
+ function registerEgressAllowlistTools(server, service) {
3795
+ server.registerTool(
3796
+ "list_egress_allowlist",
3797
+ {
3798
+ 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.",
3799
+ inputSchema: listSchema2
3800
+ },
3801
+ async (params) => jsonResult(await service.egressAllowlist.listEgressAllowlist(params))
3802
+ );
3803
+ server.registerTool(
3804
+ "create_egress_allowlist_entry",
3805
+ {
3806
+ 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.",
3807
+ inputSchema: CreateEgressAllowlistRequestSchema
3808
+ },
3809
+ async (params) => jsonResult(
3810
+ await service.egressAllowlist.createEgressAllowlistEntry(params)
3811
+ )
3812
+ );
3813
+ server.registerTool(
3814
+ "get_egress_allowlist_entry",
3815
+ {
3816
+ 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.",
3817
+ inputSchema: lookupSchema2
3818
+ },
3819
+ async ({ id }) => jsonResult(await service.egressAllowlist.getEgressAllowlistEntry(id))
3820
+ );
3821
+ server.registerTool(
3822
+ "update_egress_allowlist_entry",
3823
+ {
3824
+ 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.",
3825
+ inputSchema: updateSchema2,
3826
+ annotations: { destructiveHint: true }
3827
+ },
3828
+ async ({ id, ...params }) => jsonResult(
3829
+ await service.egressAllowlist.updateEgressAllowlistEntry(id, params)
3830
+ )
3831
+ );
3832
+ server.registerTool(
3833
+ "delete_egress_allowlist_entry",
3834
+ {
3835
+ 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.",
3836
+ inputSchema: lookupSchema2
3837
+ },
3838
+ async ({ id }) => jsonResult(await service.egressAllowlist.deleteEgressAllowlistEntry(id))
3839
+ );
3840
+ }
3841
+
3453
3842
  // src/tools/guardrails.tools.ts
3454
- import { z as z9 } from "zod";
3455
- var guardrailCheckSchema = z9.object({
3456
- id: z9.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
3457
- name: z9.string().optional().describe("Display name for the check"),
3458
- is_enabled: z9.boolean().optional().describe("Whether the check is enabled"),
3459
- parameters: z9.record(z9.string(), z9.unknown()).optional().describe(
3843
+ import { z as z13 } from "zod";
3844
+ var guardrailCheckSchema = z13.object({
3845
+ id: z13.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
3846
+ name: z13.string().optional().describe("Display name for the check"),
3847
+ is_enabled: z13.boolean().optional().describe("Whether the check is enabled"),
3848
+ parameters: z13.record(z13.string(), z13.unknown()).optional().describe(
3460
3849
  "Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
3461
3850
  )
3462
3851
  });
3463
- var guardrailFeedbackSchema = z9.object({
3464
- value: z9.coerce.number().optional().describe("Feedback value"),
3465
- weight: z9.coerce.number().optional().describe("Feedback weight"),
3466
- metadata: z9.record(z9.string(), z9.unknown()).optional().describe("Additional metadata")
3852
+ var guardrailFeedbackSchema = z13.object({
3853
+ value: z13.coerce.number().optional().describe("Feedback value"),
3854
+ weight: z13.coerce.number().optional().describe("Feedback weight"),
3855
+ metadata: z13.record(z13.string(), z13.unknown()).optional().describe("Additional metadata")
3467
3856
  });
3468
- var guardrailActionSchema = z9.object({
3469
- deny: z9.boolean().optional().describe("Whether to deny the request on check failure"),
3470
- async: z9.boolean().optional().describe("Whether to run checks asynchronously"),
3857
+ var guardrailActionSchema = z13.object({
3858
+ deny: z13.boolean().optional().describe("Whether to deny the request on check failure"),
3859
+ async: z13.boolean().optional().describe("Whether to run checks asynchronously"),
3471
3860
  on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
3472
3861
  on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
3473
- on_fail_action: z9.string().optional().describe("Simple action on failure (e.g., 'block')"),
3474
- message: z9.string().optional().describe("Message to return when guardrail triggers")
3862
+ on_fail_action: z13.string().optional().describe("Simple action on failure (e.g., 'block')"),
3863
+ message: z13.string().optional().describe("Message to return when guardrail triggers")
3475
3864
  });
3476
- var workspaceGuardrailExclusionSchema = z9.object({
3477
- workspace_id: z9.string().describe("Workspace ID whose exclusion state changes"),
3478
- excluded: z9.boolean().describe("True to exclude this workspace; false to restore enforcement")
3865
+ var workspaceGuardrailExclusionSchema = z13.object({
3866
+ workspace_id: z13.string().describe("Workspace ID whose exclusion state changes"),
3867
+ excluded: z13.boolean().describe("True to exclude this workspace; false to restore enforcement")
3479
3868
  });
3480
- var guardrailTargetSchema = z9.enum(["llm", "mcp_tools"]);
3869
+ var guardrailTargetSchema = z13.enum(["llm", "mcp_tools"]);
3481
3870
  var guardrailMcpServerMappingConfigShape = {
3482
- run_on: z9.array(z9.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
3483
- mcp_integration_capability_ids: z9.array(z9.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
3871
+ run_on: z13.array(z13.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
3872
+ mcp_integration_capability_ids: z13.array(z13.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
3484
3873
  };
3485
- var guardrailMcpServerMappingConfigSchema = z9.object(
3874
+ var guardrailMcpServerMappingConfigSchema = z13.object(
3486
3875
  guardrailMcpServerMappingConfigShape
3487
3876
  );
3488
3877
  var GUARDRAILS_TOOL_SCHEMAS = {
3489
3878
  getOrganisationDefaults: {},
3490
3879
  listGuardrails: {
3491
- workspace_id: z9.string().optional().describe("Filter guardrails by workspace ID"),
3492
- organisation_id: z9.string().optional().describe("Filter guardrails by organization ID"),
3880
+ workspace_id: z13.string().optional().describe("Filter guardrails by workspace ID"),
3881
+ organisation_id: z13.string().optional().describe("Filter guardrails by organization ID"),
3493
3882
  page_size: PageSizeSchema.describe(
3494
3883
  "Number of items per page (1-100, default: 100)"
3495
3884
  ),
3496
3885
  current_page: CurrentPageSchema
3497
3886
  },
3498
3887
  getGuardrail: {
3499
- guardrail_id: z9.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
3888
+ guardrail_id: z13.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
3500
3889
  },
3501
3890
  createGuardrail: {
3502
- name: z9.string().describe("Name of the guardrail"),
3891
+ name: z13.string().describe("Name of the guardrail"),
3503
3892
  target: guardrailTargetSchema.optional().describe("LLM traffic by default, or MCP tool calls"),
3504
- checks: z9.array(guardrailCheckSchema).min(1).optional().describe(
3893
+ checks: z13.array(guardrailCheckSchema).min(1).optional().describe(
3505
3894
  "Checks to apply; at least one entry. Required when target is llm."
3506
3895
  ),
3507
3896
  actions: guardrailActionSchema.optional().describe("Actions to take when guardrail checks pass or fail"),
3508
- workspace_id: z9.string().optional().describe("Workspace ID to create the guardrail in"),
3509
- organisation_id: z9.string().optional().describe("Organisation ID (required if workspace_id not provided)")
3897
+ workspace_id: z13.string().optional().describe("Workspace ID to create the guardrail in"),
3898
+ organisation_id: z13.string().optional().describe("Organisation ID (required if workspace_id not provided)")
3510
3899
  },
3511
3900
  updateGuardrail: {
3512
- guardrail_id: z9.string().describe("The guardrail UUID or slug to update"),
3513
- name: z9.string().optional().describe("New name for the guardrail"),
3514
- checks: z9.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
3901
+ guardrail_id: z13.string().describe("The guardrail UUID or slug to update"),
3902
+ name: z13.string().optional().describe("New name for the guardrail"),
3903
+ checks: z13.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
3515
3904
  actions: guardrailActionSchema.optional().describe("Updated actions configuration")
3516
3905
  },
3517
3906
  deleteGuardrail: {
3518
- guardrail_id: z9.string().describe("The guardrail UUID or slug to delete")
3907
+ guardrail_id: z13.string().describe("The guardrail UUID or slug to delete")
3519
3908
  },
3520
3909
  updateOrganisationDefaults: {
3521
- input_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
3522
- output_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
3910
+ input_guardrails: z13.array(z13.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
3911
+ output_guardrails: z13.array(z13.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
3523
3912
  },
3524
3913
  listWorkspaceExclusions: {
3525
- organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be listed")
3914
+ organisation_id: z13.string().describe("Organisation ID whose workspace exclusions should be listed")
3526
3915
  },
3527
3916
  updateWorkspaceExclusions: {
3528
- organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be updated"),
3529
- workspaces: z9.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
3530
- override_existing: z9.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
3917
+ organisation_id: z13.string().describe("Organisation ID whose workspace exclusions should be updated"),
3918
+ workspaces: z13.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
3919
+ override_existing: z13.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
3531
3920
  },
3532
3921
  listGuardrailMcpServerMappings: {
3533
- guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug")
3922
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug")
3534
3923
  },
3535
3924
  replaceGuardrailMcpServerMappings: {
3536
- guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
3537
- mcp_servers: z9.record(z9.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
3925
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug"),
3926
+ mcp_servers: z13.record(z13.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
3538
3927
  "Complete MCP-server mapping set keyed by server UUID; an empty object clears every mapping"
3539
3928
  )
3540
3929
  },
3541
3930
  upsertGuardrailMcpServerMapping: {
3542
- guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
3543
- mcp_server_id: z9.string().uuid().describe("MCP server UUID"),
3931
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug"),
3932
+ mcp_server_id: z13.string().uuid().describe("MCP server UUID"),
3544
3933
  ...guardrailMcpServerMappingConfigShape
3545
3934
  }
3546
3935
  };
3547
- var createGuardrailSchema = z9.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3936
+ var createGuardrailSchema = z13.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3548
3937
  if ((value.target ?? "llm") === "llm" && (!value.checks || !value.actions)) {
3549
3938
  context.addIssue({
3550
3939
  code: "custom",
@@ -3553,10 +3942,10 @@ var createGuardrailSchema = z9.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).s
3553
3942
  });
3554
3943
  }
3555
3944
  });
3556
- var replaceGuardrailMcpServerMappingsSchema = z9.object(
3945
+ var replaceGuardrailMcpServerMappingsSchema = z13.object(
3557
3946
  GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings
3558
3947
  );
3559
- var upsertGuardrailMcpServerMappingSchema = z9.object(
3948
+ var upsertGuardrailMcpServerMappingSchema = z13.object(
3560
3949
  GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping
3561
3950
  );
3562
3951
  var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
@@ -3821,7 +4210,7 @@ function registerGuardrailsTools(server, service) {
3821
4210
  }
3822
4211
 
3823
4212
  // src/tools/integrations.tools.ts
3824
- import { z as z11 } from "zod";
4213
+ import { z as z15 } from "zod";
3825
4214
 
3826
4215
  // src/lib/limits.ts
3827
4216
  var PERIODIC_RESET_DEFAULT = "monthly";
@@ -3864,25 +4253,25 @@ function buildRateLimits(params) {
3864
4253
  }
3865
4254
 
3866
4255
  // src/tools/secret-mapping.schemas.ts
3867
- import { z as z10 } from "zod";
4256
+ import { z as z14 } from "zod";
3868
4257
  function createSecretMappingSchema({
3869
4258
  allowKeyTarget,
3870
4259
  targetFieldDescription,
3871
4260
  secretReferenceDescription,
3872
4261
  valueFormatDescription
3873
4262
  }) {
3874
- return z10.object({
3875
- target_field: z10.string().refine(
4263
+ return z14.object({
4264
+ target_field: z14.string().refine(
3876
4265
  (value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
3877
4266
  allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
3878
4267
  ).describe(targetFieldDescription),
3879
- secret_reference_id: z10.string().describe(secretReferenceDescription),
3880
- secret_key: z10.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
3881
- value_format: z10.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
4268
+ secret_reference_id: z14.string().describe(secretReferenceDescription),
4269
+ secret_key: z14.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
4270
+ value_format: z14.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
3882
4271
  });
3883
4272
  }
3884
4273
  function uniqueSecretMappingsSchema(itemSchema) {
3885
- return z10.array(itemSchema).superRefine((mappings, context) => {
4274
+ return z14.array(itemSchema).superRefine((mappings, context) => {
3886
4275
  const firstIndexByTarget = /* @__PURE__ */ new Map();
3887
4276
  for (const [index, mapping] of mappings.entries()) {
3888
4277
  const firstIndex = firstIndexByTarget.get(mapping.target_field);
@@ -3909,8 +4298,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
3909
4298
  var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
3910
4299
  integrationSecretMappingSchema
3911
4300
  );
3912
- var nullableMultiplier = (description) => z11.coerce.number().nonnegative().nullable().optional().describe(description);
3913
- var pricingMultiplierSchema = z11.object({
4301
+ var nullableMultiplier = (description) => z15.coerce.number().nonnegative().nullable().optional().describe(description);
4302
+ var pricingMultiplierSchema = z15.object({
3914
4303
  default: nullableMultiplier(
3915
4304
  "Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
3916
4305
  ),
@@ -3954,72 +4343,72 @@ var pricingMultiplierSchema = z11.object({
3954
4343
  cache_write_image_input_token: nullableMultiplier(
3955
4344
  "Cache-write image input token price multiplier"
3956
4345
  ),
3957
- image: z11.object({
4346
+ image: z15.object({
3958
4347
  default: nullableMultiplier("Default image-generation price multiplier")
3959
4348
  }).nullable().optional().describe("Image-generation pricing multipliers"),
3960
- additional_units: z11.record(z11.string(), z11.coerce.number().nonnegative().nullable()).nullable().optional().describe(
4349
+ additional_units: z15.record(z15.string(), z15.coerce.number().nonnegative().nullable()).nullable().optional().describe(
3961
4350
  "Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
3962
4351
  )
3963
4352
  });
3964
- var pricingAdjustmentsSchema = z11.object({
4353
+ var pricingAdjustmentsSchema = z15.object({
3965
4354
  multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
3966
4355
  }).nullable();
3967
- var modelConfigurationsSchema = z11.object({
3968
- custom_host: z11.string().url().optional().describe("Custom upstream URL used only for this model"),
3969
- custom_headers: z11.record(z11.string(), z11.string()).optional().describe("Headers sent only for this model; values may contain secrets")
4356
+ var modelConfigurationsSchema = z15.object({
4357
+ custom_host: z15.string().url().optional().describe("Custom upstream URL used only for this model"),
4358
+ custom_headers: z15.record(z15.string(), z15.string()).optional().describe("Headers sent only for this model; values may contain secrets")
3970
4359
  });
3971
- var tokenPricingSchema = z11.object({
3972
- price: z11.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
4360
+ var tokenPricingSchema = z15.object({
4361
+ price: z15.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
3973
4362
  });
3974
- var integrationModelPricingSchema = z11.object({
3975
- type: z11.literal("static").describe("Static per-token pricing configuration"),
3976
- pay_as_you_go: z11.object({
4363
+ var integrationModelPricingSchema = z15.object({
4364
+ type: z15.literal("static").describe("Static per-token pricing configuration"),
4365
+ pay_as_you_go: z15.object({
3977
4366
  request_token: tokenPricingSchema.optional().describe("Input token pricing"),
3978
4367
  response_token: tokenPricingSchema.optional().describe("Output token pricing")
3979
4368
  }).optional().describe("Pay-as-you-go rates for this integration model")
3980
4369
  });
3981
4370
  var INTEGRATIONS_TOOL_SCHEMAS = {
3982
4371
  getModelPricing: {
3983
- provider: z11.string().describe(
4372
+ provider: z15.string().describe(
3984
4373
  "Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
3985
4374
  ),
3986
- model: z11.string().describe("Exact provider model identifier, such as gpt-4o")
4375
+ model: z15.string().describe("Exact provider model identifier, such as gpt-4o")
3987
4376
  },
3988
4377
  listIntegrations: {
3989
4378
  current_page: CurrentPageSchema,
3990
4379
  page_size: PageSizeSchema.describe(
3991
4380
  "Number of results per page (default 100, max 100)"
3992
4381
  ),
3993
- workspace_id: z11.string().optional().describe("Filter integrations accessible by a specific workspace"),
3994
- type: z11.enum(["workspace", "organisation", "all"]).optional().describe(
4382
+ workspace_id: z15.string().optional().describe("Filter integrations accessible by a specific workspace"),
4383
+ type: z15.enum(["workspace", "organisation", "all"]).optional().describe(
3995
4384
  "Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
3996
4385
  ),
3997
4386
  tags: integrationTagsSchema.optional().describe("Match integrations that carry all supplied tags")
3998
4387
  },
3999
4388
  createIntegration: {
4000
- name: z11.string().describe("Human-readable name for the integration"),
4001
- ai_provider_id: z11.string().describe(
4389
+ name: z15.string().describe("Human-readable name for the integration"),
4390
+ ai_provider_id: z15.string().describe(
4002
4391
  "ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
4003
4392
  ),
4004
- slug: z11.string().optional().describe(
4393
+ slug: z15.string().optional().describe(
4005
4394
  "URL-friendly identifier (auto-generated from name if not provided)"
4006
4395
  ),
4007
- key: z11.string().optional().describe("API key for the provider (if required)"),
4008
- description: z11.string().optional().describe("Optional description of the integration"),
4009
- workspace_id: z11.string().optional().describe("Workspace ID for workspace-scoped integrations"),
4010
- api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
4011
- resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
4012
- deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
4013
- aws_region: z11.string().optional().describe("AWS region (for AWS Bedrock)"),
4014
- aws_access_key_id: z11.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
4015
- aws_secret_access_key: z11.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
4016
- vertex_project_id: z11.string().optional().describe("GCP project ID (for Vertex AI)"),
4017
- vertex_region: z11.string().optional().describe("GCP region (for Vertex AI)"),
4018
- custom_host: z11.string().optional().describe("Custom base URL for the provider"),
4019
- create_default_provider: z11.boolean().optional().describe(
4396
+ key: z15.string().optional().describe("API key for the provider (if required)"),
4397
+ description: z15.string().optional().describe("Optional description of the integration"),
4398
+ workspace_id: z15.string().optional().describe("Workspace ID for workspace-scoped integrations"),
4399
+ api_version: z15.string().optional().describe("API version (for Azure OpenAI)"),
4400
+ resource_name: z15.string().optional().describe("Resource name (for Azure OpenAI)"),
4401
+ deployment_name: z15.string().optional().describe("Deployment name (for Azure OpenAI)"),
4402
+ aws_region: z15.string().optional().describe("AWS region (for AWS Bedrock)"),
4403
+ aws_access_key_id: z15.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
4404
+ aws_secret_access_key: z15.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
4405
+ vertex_project_id: z15.string().optional().describe("GCP project ID (for Vertex AI)"),
4406
+ vertex_region: z15.string().optional().describe("GCP region (for Vertex AI)"),
4407
+ custom_host: z15.string().optional().describe("Custom base URL for the provider"),
4408
+ create_default_provider: z15.boolean().optional().describe(
4020
4409
  "Create a provider automatically for a workspace-scoped integration; defaults to true"
4021
4410
  ),
4022
- default_provider_slug: z11.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
4411
+ default_provider_slug: z15.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
4023
4412
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
4024
4413
  "Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
4025
4414
  ),
@@ -4029,22 +4418,22 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
4029
4418
  tags: integrationTagsSchema.nullable().optional().describe("Integration tags, or null to create without tags")
4030
4419
  },
4031
4420
  getIntegration: {
4032
- slug: z11.string().describe("The unique slug identifier of the integration to retrieve")
4421
+ slug: z15.string().describe("The unique slug identifier of the integration to retrieve")
4033
4422
  },
4034
4423
  updateIntegration: {
4035
- slug: z11.string().describe("The slug of the integration to update"),
4036
- name: z11.string().optional().describe("New human-readable name for the integration"),
4037
- key: z11.string().optional().describe("New API key for the provider"),
4038
- description: z11.string().optional().describe("New description for the integration"),
4039
- api_version: z11.string().optional().describe("New API version (for Azure OpenAI)"),
4040
- resource_name: z11.string().optional().describe("New resource name (for Azure OpenAI)"),
4041
- deployment_name: z11.string().optional().describe("New deployment name (for Azure OpenAI)"),
4042
- aws_region: z11.string().optional().describe("New AWS region (for AWS Bedrock)"),
4043
- aws_access_key_id: z11.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
4044
- aws_secret_access_key: z11.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
4045
- vertex_project_id: z11.string().optional().describe("New GCP project ID (for Vertex AI)"),
4046
- vertex_region: z11.string().optional().describe("New GCP region (for Vertex AI)"),
4047
- custom_host: z11.string().optional().describe("New custom base URL for the provider"),
4424
+ slug: z15.string().describe("The slug of the integration to update"),
4425
+ name: z15.string().optional().describe("New human-readable name for the integration"),
4426
+ key: z15.string().optional().describe("New API key for the provider"),
4427
+ description: z15.string().optional().describe("New description for the integration"),
4428
+ api_version: z15.string().optional().describe("New API version (for Azure OpenAI)"),
4429
+ resource_name: z15.string().optional().describe("New resource name (for Azure OpenAI)"),
4430
+ deployment_name: z15.string().optional().describe("New deployment name (for Azure OpenAI)"),
4431
+ aws_region: z15.string().optional().describe("New AWS region (for AWS Bedrock)"),
4432
+ aws_access_key_id: z15.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
4433
+ aws_secret_access_key: z15.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
4434
+ vertex_project_id: z15.string().optional().describe("New GCP project ID (for Vertex AI)"),
4435
+ vertex_region: z15.string().optional().describe("New GCP region (for Vertex AI)"),
4436
+ custom_host: z15.string().optional().describe("New custom base URL for the provider"),
4048
4437
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
4049
4438
  "Replacement runtime Secret Reference mappings; each target_field must be unique"
4050
4439
  ),
@@ -4054,78 +4443,78 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
4054
4443
  tags: integrationTagsSchema.nullable().optional().describe("Replacement integration tags, or null to clear all tags")
4055
4444
  },
4056
4445
  deleteIntegration: {
4057
- slug: z11.string().describe("The slug of the integration to delete")
4446
+ slug: z15.string().describe("The slug of the integration to delete")
4058
4447
  },
4059
4448
  listIntegrationModels: {
4060
- slug: z11.string().describe("The slug of the integration"),
4449
+ slug: z15.string().describe("The slug of the integration"),
4061
4450
  current_page: CurrentPageSchema,
4062
4451
  page_size: PageSizeSchema.describe("Number of results per page")
4063
4452
  },
4064
4453
  updateIntegrationModels: {
4065
- slug: z11.string().describe("The slug of the integration"),
4066
- allow_all_models: z11.boolean().optional().describe(
4454
+ slug: z15.string().describe("The slug of the integration"),
4455
+ allow_all_models: z15.boolean().optional().describe(
4067
4456
  "Whether newly available provider models are enabled by default"
4068
4457
  ),
4069
- models: z11.array(
4070
- z11.object({
4071
- slug: z11.string().describe("The model slug identifier"),
4072
- model_name: z11.string().optional().describe(
4458
+ models: z15.array(
4459
+ z15.object({
4460
+ slug: z15.string().describe("The model slug identifier"),
4461
+ model_name: z15.string().optional().describe(
4073
4462
  "Display name for the model (required for custom models)"
4074
4463
  ),
4075
- enabled: z11.boolean().describe("Whether the model is enabled"),
4076
- is_custom: z11.boolean().optional().describe("Whether this is a custom model (default: false)"),
4077
- is_finetune: z11.boolean().optional().describe("Whether this entry is a fine-tuned model"),
4078
- base_model_slug: z11.string().optional().describe("Base model slug for a fine-tuned model"),
4464
+ enabled: z15.boolean().describe("Whether the model is enabled"),
4465
+ is_custom: z15.boolean().optional().describe("Whether this is a custom model (default: false)"),
4466
+ is_finetune: z15.boolean().optional().describe("Whether this entry is a fine-tuned model"),
4467
+ base_model_slug: z15.string().optional().describe("Base model slug for a fine-tuned model"),
4079
4468
  configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
4080
4469
  pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
4081
4470
  })
4082
4471
  ).describe("Array of model configurations to update")
4083
4472
  },
4084
4473
  deleteIntegrationModel: {
4085
- slug: z11.string().describe("The slug of the integration"),
4086
- model_slug: z11.string().describe("The slug of the model to delete")
4474
+ slug: z15.string().describe("The slug of the integration"),
4475
+ model_slug: z15.string().describe("The slug of the model to delete")
4087
4476
  },
4088
4477
  listIntegrationWorkspaces: {
4089
- slug: z11.string().describe("The slug of the integration"),
4478
+ slug: z15.string().describe("The slug of the integration"),
4090
4479
  current_page: CurrentPageSchema,
4091
4480
  page_size: PageSizeSchema.describe("Number of results per page")
4092
4481
  },
4093
4482
  updateIntegrationWorkspaces: {
4094
- slug: z11.string().describe("The slug of the integration"),
4095
- workspaces: z11.array(
4096
- z11.object({
4097
- id: z11.string().describe("The workspace ID"),
4098
- enabled: z11.boolean().describe("Whether the workspace has access to this integration"),
4099
- credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for this workspace"),
4100
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4101
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4102
- reset_usage: z11.boolean().optional().describe("Reset exhausted usage status to active"),
4103
- create_default_provider: z11.boolean().optional().describe(
4483
+ slug: z15.string().describe("The slug of the integration"),
4484
+ workspaces: z15.array(
4485
+ z15.object({
4486
+ id: z15.string().describe("The workspace ID"),
4487
+ enabled: z15.boolean().describe("Whether the workspace has access to this integration"),
4488
+ credit_limit: z15.coerce.number().positive().optional().describe("Credit limit for this workspace"),
4489
+ alert_threshold: z15.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4490
+ rate_limit_rpm: z15.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4491
+ reset_usage: z15.boolean().optional().describe("Reset exhausted usage status to active"),
4492
+ create_default_provider: z15.boolean().optional().describe(
4104
4493
  "Override whether a provider is auto-created for this workspace"
4105
4494
  ),
4106
- default_provider_slug: z11.string().optional().describe(
4495
+ default_provider_slug: z15.string().optional().describe(
4107
4496
  "Override the auto-created provider slug for this workspace"
4108
4497
  )
4109
4498
  })
4110
4499
  ).describe("Array of workspace configurations to update"),
4111
- global_workspace_access_enabled: z11.boolean().optional().describe(
4500
+ global_workspace_access_enabled: z15.boolean().optional().describe(
4112
4501
  "Enable or disable access for all current and future workspaces"
4113
4502
  ),
4114
- global_credit_limit: z11.coerce.number().positive().optional().describe(
4503
+ global_credit_limit: z15.coerce.number().positive().optional().describe(
4115
4504
  "Global cost credit limit applied with global workspace access"
4116
4505
  ),
4117
- global_alert_threshold: z11.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
4118
- global_rate_limit_rpm: z11.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
4119
- override_existing_workspace_access: z11.boolean().optional().describe("Apply global settings over existing per-workspace access"),
4120
- create_default_provider: z11.boolean().optional().describe("Auto-create providers when granting workspace access"),
4121
- default_provider_slug: z11.string().optional().describe("Default slug for providers auto-created in workspaces")
4506
+ global_alert_threshold: z15.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
4507
+ global_rate_limit_rpm: z15.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
4508
+ override_existing_workspace_access: z15.boolean().optional().describe("Apply global settings over existing per-workspace access"),
4509
+ create_default_provider: z15.boolean().optional().describe("Auto-create providers when granting workspace access"),
4510
+ default_provider_slug: z15.string().optional().describe("Default slug for providers auto-created in workspaces")
4122
4511
  }
4123
4512
  };
4124
- var updateIntegrationWorkspacesSchema = z11.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4513
+ var updateIntegrationWorkspacesSchema = z15.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4125
4514
  const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
4126
4515
  if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
4127
4516
  ctx.addIssue({
4128
- code: z11.ZodIssueCode.custom,
4517
+ code: z15.ZodIssueCode.custom,
4129
4518
  path: ["global_workspace_access_enabled"],
4130
4519
  message: "global_workspace_access_enabled is required when setting global limits."
4131
4520
  });
@@ -4320,7 +4709,7 @@ function registerIntegrationsTools(server, service) {
4320
4709
  slug: model.slug ?? model.model_id,
4321
4710
  name: model.name ?? model.model_name,
4322
4711
  enabled: model.enabled,
4323
- is_custom: model.is_custom ?? model.custom,
4712
+ is_custom: model.is_custom !== void 0 ? model.is_custom : model.custom,
4324
4713
  is_finetune: model.is_finetune,
4325
4714
  base_model_slug: model.base_model_slug,
4326
4715
  configurations: model.configurations,
@@ -4460,31 +4849,31 @@ function registerIntegrationsTools(server, service) {
4460
4849
  }
4461
4850
 
4462
4851
  // src/tools/keys.tools.ts
4463
- import { z as z12 } from "zod";
4464
- var virtualKeySecretMappingSchema = z12.object({
4465
- target_field: z12.string().refine(
4852
+ import { z as z16 } from "zod";
4853
+ var virtualKeySecretMappingSchema = z16.object({
4854
+ target_field: z16.string().refine(
4466
4855
  (value) => value === "key" || value.startsWith("model_config."),
4467
4856
  "target_field must be 'key' or start with 'model_config.'"
4468
4857
  ).describe("Virtual Key field populated from the Secret Reference"),
4469
- secret_reference_id: z12.string().describe("Secret Reference ID that owns the external secret"),
4470
- secret_key: z12.string().nullable().optional().describe("Optional key selected from a structured external secret"),
4471
- value_format: z12.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
4858
+ secret_reference_id: z16.string().describe("Secret Reference ID that owns the external secret"),
4859
+ secret_key: z16.string().nullable().optional().describe("Optional key selected from a structured external secret"),
4860
+ value_format: z16.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
4472
4861
  });
4473
- var virtualKeyDeploymentSchema = z12.object({
4474
- api_version: z12.string().min(1).describe("Azure OpenAI API version"),
4475
- deployment_name: z12.string().min(1).describe("Azure deployment name"),
4476
- alias: z12.string().optional().describe("Optional model alias for the deployment"),
4477
- is_default: z12.boolean().optional().describe("Whether this is the default Azure deployment")
4862
+ var virtualKeyDeploymentSchema = z16.object({
4863
+ api_version: z16.string().min(1).describe("Azure OpenAI API version"),
4864
+ deployment_name: z16.string().min(1).describe("Azure deployment name"),
4865
+ alias: z16.string().optional().describe("Optional model alias for the deployment"),
4866
+ is_default: z16.boolean().optional().describe("Whether this is the default Azure deployment")
4478
4867
  });
4479
- var apiKeyRateLimitSchema = z12.object({
4480
- type: z12.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
4481
- unit: z12.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
4482
- value: z12.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
4868
+ var apiKeyRateLimitSchema = z16.object({
4869
+ type: z16.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
4870
+ unit: z16.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
4871
+ value: z16.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
4483
4872
  });
4484
- var rotationPolicySchema = z12.object({
4485
- rotation_period: z12.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
4486
- next_rotation_at: z12.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
4487
- key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
4873
+ var rotationPolicySchema = z16.object({
4874
+ rotation_period: z16.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
4875
+ next_rotation_at: z16.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
4876
+ key_transition_period_ms: z16.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
4488
4877
  }).superRefine((value, context) => {
4489
4878
  if (value.rotation_period && value.next_rotation_at) {
4490
4879
  context.addIssue({
@@ -4500,108 +4889,108 @@ var KEYS_TOOL_SCHEMAS = {
4500
4889
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
4501
4890
  },
4502
4891
  createVirtualKey: {
4503
- name: z12.string().describe("Display name for the virtual key"),
4504
- provider: z12.string().describe(
4892
+ name: z16.string().describe("Display name for the virtual key"),
4893
+ provider: z16.string().describe(
4505
4894
  "Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
4506
4895
  ),
4507
- key: z12.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
4508
- note: z12.string().optional().describe("Optional note or description for this key"),
4509
- workspace_id: z12.string().optional().describe("Workspace ID to create the key in"),
4510
- api_version: z12.string().optional().describe("API version (for Azure OpenAI)"),
4511
- resource_name: z12.string().optional().describe("Resource name (for Azure OpenAI)"),
4512
- deployment_name: z12.string().optional().describe("Deployment name (for Azure OpenAI)"),
4513
- deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe(
4896
+ key: z16.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
4897
+ note: z16.string().optional().describe("Optional note or description for this key"),
4898
+ workspace_id: z16.string().optional().describe("Workspace ID to create the key in"),
4899
+ api_version: z16.string().optional().describe("API version (for Azure OpenAI)"),
4900
+ resource_name: z16.string().optional().describe("Resource name (for Azure OpenAI)"),
4901
+ deployment_name: z16.string().optional().describe("Deployment name (for Azure OpenAI)"),
4902
+ deployment_configurations: z16.array(virtualKeyDeploymentSchema).optional().describe(
4514
4903
  "Azure deployment configurations with API versions and aliases"
4515
4904
  ),
4516
- expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
4517
- secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
4518
- credit_limit: z12.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
4519
- alert_threshold: z12.coerce.number().min(0).max(100).optional().describe(
4905
+ expires_at: z16.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
4906
+ secret_mappings: z16.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
4907
+ credit_limit: z16.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
4908
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe(
4520
4909
  "Percentage of credit_limit at which to send alert emails (0-100)"
4521
4910
  ),
4522
- rate_limit_rpm: z12.coerce.number().positive().optional().describe("Requests per minute limit")
4911
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("Requests per minute limit")
4523
4912
  },
4524
4913
  getVirtualKey: {
4525
- slug: z12.string().describe("The unique slug identifier of the virtual key to retrieve")
4914
+ slug: z16.string().describe("The unique slug identifier of the virtual key to retrieve")
4526
4915
  },
4527
4916
  updateVirtualKey: {
4528
- slug: z12.string().describe("The slug of the virtual key to update"),
4529
- name: z12.string().optional().describe("New display name for the key"),
4530
- key: z12.string().optional().describe("New provider API key value"),
4531
- note: z12.string().optional().describe("New note or description"),
4532
- credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
4533
- alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4534
- rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4535
- deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
4536
- secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
4917
+ slug: z16.string().describe("The slug of the virtual key to update"),
4918
+ name: z16.string().optional().describe("New display name for the key"),
4919
+ key: z16.string().optional().describe("New provider API key value"),
4920
+ note: z16.string().optional().describe("New note or description"),
4921
+ credit_limit: z16.coerce.number().positive().optional().describe("New credit limit for usage"),
4922
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4923
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4924
+ deployment_configurations: z16.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
4925
+ secret_mappings: z16.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
4537
4926
  },
4538
4927
  deleteVirtualKey: {
4539
- slug: z12.string().describe("The slug of the virtual key to delete")
4928
+ slug: z16.string().describe("The slug of the virtual key to delete")
4540
4929
  },
4541
4930
  createApiKey: {
4542
- type: z12.enum(["organisation", "workspace"]).describe(
4931
+ type: z16.enum(["organisation", "workspace"]).describe(
4543
4932
  "Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
4544
4933
  ),
4545
- sub_type: z12.enum(["user", "service"]).describe(
4934
+ sub_type: z16.enum(["user", "service"]).describe(
4546
4935
  "Sub-type: 'user' for user-associated keys or 'service' for service accounts"
4547
4936
  ),
4548
- name: z12.string().describe("Display name for the API key"),
4549
- description: z12.string().optional().describe("Optional description for the key"),
4550
- organisation_id: z12.string().optional().describe("Organisation UUID"),
4551
- workspace_id: z12.string().optional().describe("Workspace ID (required for workspace-type keys)"),
4552
- user_id: z12.string().optional().describe("User ID (required for user sub-type keys)"),
4553
- scopes: z12.array(z12.string()).describe(
4937
+ name: z16.string().describe("Display name for the API key"),
4938
+ description: z16.string().optional().describe("Optional description for the key"),
4939
+ organisation_id: z16.string().optional().describe("Organisation UUID"),
4940
+ workspace_id: z16.string().optional().describe("Workspace ID (required for workspace-type keys)"),
4941
+ user_id: z16.string().optional().describe("User ID (required for user sub-type keys)"),
4942
+ scopes: z16.array(z16.string()).describe(
4554
4943
  "Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
4555
4944
  ),
4556
- credit_limit: z12.coerce.number().positive().optional().describe("Credit limit for usage"),
4557
- alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4558
- rate_limit_rpm: z12.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4559
- rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
4560
- default_config_id: z12.string().optional().describe("Default configuration ID to use with this key"),
4561
- default_metadata: z12.record(z12.string(), z12.string()).optional().describe("Default metadata key-value pairs"),
4562
- default_allow_config_override: z12.boolean().optional().describe("Allow callers to override the default config"),
4563
- alert_emails: z12.array(z12.string()).optional().describe("Email addresses for alerts"),
4564
- expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
4945
+ credit_limit: z16.coerce.number().positive().optional().describe("Credit limit for usage"),
4946
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4947
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4948
+ rate_limits: z16.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
4949
+ default_config_id: z16.string().optional().describe("Default configuration ID to use with this key"),
4950
+ default_metadata: z16.record(z16.string(), z16.string()).optional().describe("Default metadata key-value pairs"),
4951
+ default_allow_config_override: z16.boolean().optional().describe("Allow callers to override the default config"),
4952
+ alert_emails: z16.array(z16.string()).optional().describe("Email addresses for alerts"),
4953
+ expires_at: z16.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
4565
4954
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
4566
4955
  },
4567
4956
  listApiKeys: {
4568
4957
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
4569
4958
  current_page: CurrentPageSchema,
4570
- workspace_id: z12.string().optional().describe("Filter by workspace ID")
4959
+ workspace_id: z16.string().optional().describe("Filter by workspace ID")
4571
4960
  },
4572
4961
  getApiKey: {
4573
- id: z12.string().uuid().describe("The UUID of the API key to retrieve")
4962
+ id: z16.string().uuid().describe("The UUID of the API key to retrieve")
4574
4963
  },
4575
4964
  updateApiKey: {
4576
- id: z12.string().uuid().describe("The UUID of the API key to update"),
4577
- name: z12.string().optional().describe("New display name for the key"),
4578
- description: z12.string().optional().describe("New description for the key"),
4579
- scopes: z12.array(z12.string()).optional().describe("New permission scopes for the key"),
4580
- credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
4581
- alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4582
- rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4583
- rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
4584
- reset_usage: z12.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
4585
- default_config_id: z12.string().optional().describe("New default configuration ID"),
4586
- default_metadata: z12.record(z12.string(), z12.string()).optional().describe("New default metadata key-value pairs"),
4587
- default_allow_config_override: z12.boolean().optional().describe("Whether callers may override the key's default config"),
4588
- alert_emails: z12.array(z12.string()).optional().describe("New email addresses for alerts"),
4589
- expires_at: z12.iso.datetime({ offset: true }).nullable().optional().describe(
4965
+ id: z16.string().uuid().describe("The UUID of the API key to update"),
4966
+ name: z16.string().optional().describe("New display name for the key"),
4967
+ description: z16.string().optional().describe("New description for the key"),
4968
+ scopes: z16.array(z16.string()).optional().describe("New permission scopes for the key"),
4969
+ credit_limit: z16.coerce.number().positive().optional().describe("New credit limit for usage"),
4970
+ alert_threshold: z16.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4971
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4972
+ rate_limits: z16.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
4973
+ reset_usage: z16.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
4974
+ default_config_id: z16.string().optional().describe("New default configuration ID"),
4975
+ default_metadata: z16.record(z16.string(), z16.string()).optional().describe("New default metadata key-value pairs"),
4976
+ default_allow_config_override: z16.boolean().optional().describe("Whether callers may override the key's default config"),
4977
+ alert_emails: z16.array(z16.string()).optional().describe("New email addresses for alerts"),
4978
+ expires_at: z16.iso.datetime({ offset: true }).nullable().optional().describe(
4590
4979
  "New expiration date in ISO 8601 format, or null to remove expiration"
4591
4980
  ),
4592
4981
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
4593
4982
  },
4594
4983
  rotateApiKey: {
4595
- id: z12.string().uuid().describe("API key UUID obtained from list_api_keys"),
4596
- key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe(
4984
+ id: z16.string().uuid().describe("API key UUID obtained from list_api_keys"),
4985
+ key_transition_period_ms: z16.coerce.number().int().min(18e5).optional().describe(
4597
4986
  "Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
4598
4987
  )
4599
4988
  },
4600
4989
  deleteApiKey: {
4601
- id: z12.string().uuid().describe("The UUID of the API key to delete")
4990
+ id: z16.string().uuid().describe("The UUID of the API key to delete")
4602
4991
  }
4603
4992
  };
4604
- var createVirtualKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
4993
+ var createVirtualKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
4605
4994
  if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
4606
4995
  context.addIssue({
4607
4996
  code: "custom",
@@ -4610,17 +4999,17 @@ var createVirtualKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
4610
4999
  });
4611
5000
  }
4612
5001
  });
4613
- var createApiKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
5002
+ var createApiKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
4614
5003
  if (value.type === "workspace" && !value.workspace_id) {
4615
5004
  ctx.addIssue({
4616
- code: z12.ZodIssueCode.custom,
5005
+ code: z16.ZodIssueCode.custom,
4617
5006
  path: ["workspace_id"],
4618
5007
  message: "workspace_id is required when type is 'workspace'"
4619
5008
  });
4620
5009
  }
4621
5010
  if (value.sub_type === "user" && !value.user_id) {
4622
5011
  ctx.addIssue({
4623
- code: z12.ZodIssueCode.custom,
5012
+ code: z16.ZodIssueCode.custom,
4624
5013
  path: ["user_id"],
4625
5014
  message: "user_id is required when sub_type is 'user'"
4626
5015
  });
@@ -4943,43 +5332,43 @@ function registerKeysTools(server, service) {
4943
5332
  }
4944
5333
 
4945
5334
  // src/tools/labels.tools.ts
4946
- import { z as z13 } from "zod";
5335
+ import { z as z17 } from "zod";
4947
5336
  var LABELS_TOOL_SCHEMAS = {
4948
5337
  createPromptLabel: {
4949
- name: z13.string().describe("Name of the label"),
4950
- organisation_id: z13.string().optional().describe("Organisation ID to create the label in"),
4951
- workspace_id: z13.string().optional().describe("Workspace ID to create the label in"),
4952
- description: z13.string().optional().describe("Description of the label"),
4953
- color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
5338
+ name: z17.string().describe("Name of the label"),
5339
+ organisation_id: z17.string().optional().describe("Organisation ID to create the label in"),
5340
+ workspace_id: z17.string().optional().describe("Workspace ID to create the label in"),
5341
+ description: z17.string().optional().describe("Description of the label"),
5342
+ color_code: z17.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
4954
5343
  "Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
4955
5344
  )
4956
5345
  },
4957
5346
  listPromptLabels: {
4958
- organisation_id: z13.string().optional().describe("Filter by organisation ID"),
4959
- workspace_id: z13.string().optional().describe("Filter by workspace ID"),
4960
- search: z13.string().optional().describe("Search labels by name"),
5347
+ organisation_id: z17.string().optional().describe("Filter by organisation ID"),
5348
+ workspace_id: z17.string().optional().describe("Filter by workspace ID"),
5349
+ search: z17.string().optional().describe("Search labels by name"),
4961
5350
  current_page: CurrentPageSchema,
4962
5351
  page_size: PageSizeSchema
4963
5352
  },
4964
5353
  getPromptLabel: {
4965
- label_id: z13.string().describe("Label ID to retrieve"),
4966
- organisation_id: z13.string().optional().describe("Organisation ID for filtering"),
4967
- workspace_id: z13.string().optional().describe("Workspace ID for filtering")
5354
+ label_id: z17.string().describe("Label ID to retrieve"),
5355
+ organisation_id: z17.string().optional().describe("Organisation ID for filtering"),
5356
+ workspace_id: z17.string().optional().describe("Workspace ID for filtering")
4968
5357
  },
4969
5358
  updatePromptLabel: {
4970
- label_id: z13.string().describe("Label ID to update"),
4971
- name: z13.string().optional().describe("New name for the label"),
4972
- description: z13.string().optional().describe("New description"),
4973
- color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
5359
+ label_id: z17.string().describe("Label ID to update"),
5360
+ name: z17.string().optional().describe("New name for the label"),
5361
+ description: z17.string().optional().describe("New description"),
5362
+ color_code: z17.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
4974
5363
  },
4975
5364
  deletePromptLabel: {
4976
- label_id: z13.string().describe("Label ID to delete")
5365
+ label_id: z17.string().describe("Label ID to delete")
4977
5366
  }
4978
5367
  };
4979
- var createPromptLabelSchema = z13.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
5368
+ var createPromptLabelSchema = z17.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
4980
5369
  if (!value.organisation_id && !value.workspace_id) {
4981
5370
  ctx.addIssue({
4982
- code: z13.ZodIssueCode.custom,
5371
+ code: z17.ZodIssueCode.custom,
4983
5372
  message: "Either organisation_id or workspace_id is required"
4984
5373
  });
4985
5374
  }
@@ -5076,13 +5465,13 @@ function registerLabelsTools(server, service) {
5076
5465
  }
5077
5466
 
5078
5467
  // src/tools/limits.tools.ts
5079
- import { z as z14 } from "zod";
5080
- var statusSchema = z14.enum(["active", "archived"]);
5081
- var rateUnitSchema = z14.enum(["rpm", "rph", "rpd", "rpw"]);
5082
- var rateTargetSchema = z14.enum(["llm", "mcp_tools"]);
5083
- var conditionValueSchema = z14.union([z14.string(), z14.array(z14.string()).min(1)]);
5084
- var conditionSchema = z14.object({
5085
- key: z14.string().min(1).describe(
5468
+ import { z as z18 } from "zod";
5469
+ var statusSchema = z18.enum(["active", "archived"]);
5470
+ var rateUnitSchema = z18.enum(["rpm", "rph", "rpd", "rpw"]);
5471
+ var rateTargetSchema = z18.enum(["llm", "mcp_tools"]);
5472
+ var conditionValueSchema = z18.union([z18.string(), z18.array(z18.string()).min(1)]);
5473
+ var conditionSchema = z18.object({
5474
+ key: z18.string().min(1).describe(
5086
5475
  "Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
5087
5476
  ),
5088
5477
  value: conditionValueSchema.describe(
@@ -5090,8 +5479,8 @@ var conditionSchema = z14.object({
5090
5479
  ),
5091
5480
  excludes: conditionValueSchema.optional().describe("Values to exclude")
5092
5481
  });
5093
- var groupBySchema = z14.object({
5094
- key: z14.string().min(1).describe(
5482
+ var groupBySchema = z18.object({
5483
+ key: z18.string().min(1).describe(
5095
5484
  "Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
5096
5485
  )
5097
5486
  });
@@ -5101,88 +5490,88 @@ var paginationSchema = {
5101
5490
  };
5102
5491
  var LIMITS_TOOL_SCHEMAS = {
5103
5492
  listRateLimits: {
5104
- workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
5493
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5105
5494
  status: statusSchema.optional().describe("Filter by active or archived status"),
5106
- type: z14.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5495
+ type: z18.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5107
5496
  unit: rateUnitSchema.optional().describe("Filter by reset interval"),
5108
5497
  target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
5109
5498
  ...paginationSchema
5110
5499
  },
5111
5500
  getRateLimit: {
5112
- id: z14.string().min(1).describe("Rate-limit policy UUID"),
5501
+ id: z18.string().min(1).describe("Rate-limit policy UUID"),
5113
5502
  status: statusSchema.optional().describe("Include an archived policy by status")
5114
5503
  },
5115
5504
  createRateLimit: {
5116
- conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
5117
- group_by: z14.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
5118
- type: z14.enum(["requests", "tokens"]).describe("Counter type"),
5505
+ conditions: z18.array(conditionSchema).min(1).describe("Policy match conditions"),
5506
+ group_by: z18.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
5507
+ type: z18.enum(["requests", "tokens"]).describe("Counter type"),
5119
5508
  unit: rateUnitSchema.describe("Counter reset interval"),
5120
- value: z14.coerce.number().nonnegative().describe("Maximum requests or tokens"),
5121
- name: z14.string().optional().describe("Optional policy display name"),
5509
+ value: z18.coerce.number().nonnegative().describe("Maximum requests or tokens"),
5510
+ name: z18.string().optional().describe("Optional policy display name"),
5122
5511
  target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
5123
- workspace_id: z14.string().optional().describe("Workspace UUID scope"),
5124
- organisation_id: z14.string().optional().describe("Organisation UUID scope")
5512
+ workspace_id: z18.string().optional().describe("Workspace UUID scope"),
5513
+ organisation_id: z18.string().optional().describe("Organisation UUID scope")
5125
5514
  },
5126
5515
  updateRateLimit: {
5127
- id: z14.string().min(1).describe("Rate-limit policy UUID"),
5128
- name: z14.string().optional().describe("Replacement display name"),
5516
+ id: z18.string().min(1).describe("Rate-limit policy UUID"),
5517
+ name: z18.string().optional().describe("Replacement display name"),
5129
5518
  unit: rateUnitSchema.optional().describe("Replacement reset interval"),
5130
- value: z14.coerce.number().nonnegative().optional().describe("Replacement maximum"),
5131
- conditions: z14.array(conditionSchema).min(1).optional().describe("Replacement conditions")
5519
+ value: z18.coerce.number().nonnegative().optional().describe("Replacement maximum"),
5520
+ conditions: z18.array(conditionSchema).min(1).optional().describe("Replacement conditions")
5132
5521
  },
5133
5522
  deleteRateLimit: {
5134
- id: z14.string().min(1).describe("Rate-limit policy UUID to delete")
5523
+ id: z18.string().min(1).describe("Rate-limit policy UUID to delete")
5135
5524
  },
5136
5525
  listUsageLimits: {
5137
- workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
5526
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5138
5527
  status: statusSchema.optional().describe("Filter by active or archived status"),
5139
- type: z14.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5528
+ type: z18.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5140
5529
  ...paginationSchema
5141
5530
  },
5142
5531
  getUsageLimit: {
5143
- id: z14.string().min(1).describe("Usage-limit policy UUID"),
5532
+ id: z18.string().min(1).describe("Usage-limit policy UUID"),
5144
5533
  status: statusSchema.optional().describe("Include an archived policy by status"),
5145
- include_usage: z14.boolean().optional().describe("Include per-value usage counters")
5534
+ include_usage: z18.boolean().optional().describe("Include per-value usage counters")
5146
5535
  },
5147
5536
  createUsageLimit: {
5148
- conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
5149
- group_by: z14.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
5150
- type: z14.enum(["cost", "tokens"]).describe("Budget type"),
5151
- credit_limit: z14.coerce.number().nonnegative().describe("Maximum cumulative usage"),
5152
- name: z14.string().optional().describe("Optional policy display name"),
5153
- alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
5154
- periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
5155
- workspace_id: z14.string().optional().describe("Workspace UUID scope"),
5156
- organisation_id: z14.string().optional().describe("Organisation UUID scope")
5537
+ conditions: z18.array(conditionSchema).min(1).describe("Policy match conditions"),
5538
+ group_by: z18.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
5539
+ type: z18.enum(["cost", "tokens"]).describe("Budget type"),
5540
+ credit_limit: z18.coerce.number().nonnegative().describe("Maximum cumulative usage"),
5541
+ name: z18.string().optional().describe("Optional policy display name"),
5542
+ alert_threshold: z18.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
5543
+ periodic_reset: z18.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
5544
+ workspace_id: z18.string().optional().describe("Workspace UUID scope"),
5545
+ organisation_id: z18.string().optional().describe("Organisation UUID scope")
5157
5546
  },
5158
5547
  updateUsageLimit: {
5159
- id: z14.string().min(1).describe("Usage-limit policy UUID"),
5160
- name: z14.string().max(255).optional().describe("Replacement display name"),
5161
- description: z14.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
5162
- conditions: z14.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
5163
- credit_limit: z14.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
5164
- alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
5165
- periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
5166
- periodic_reset_days: z14.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
5167
- next_usage_reset_at: z14.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
5168
- reset_usage_for_value: z14.string().optional().describe("Grouped value whose usage should reset")
5548
+ id: z18.string().min(1).describe("Usage-limit policy UUID"),
5549
+ name: z18.string().max(255).optional().describe("Replacement display name"),
5550
+ description: z18.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
5551
+ conditions: z18.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
5552
+ credit_limit: z18.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
5553
+ alert_threshold: z18.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
5554
+ periodic_reset: z18.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
5555
+ periodic_reset_days: z18.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
5556
+ next_usage_reset_at: z18.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
5557
+ reset_usage_for_value: z18.string().optional().describe("Grouped value whose usage should reset")
5169
5558
  },
5170
5559
  deleteUsageLimit: {
5171
- id: z14.string().min(1).describe("Usage-limit policy UUID to archive")
5560
+ id: z18.string().min(1).describe("Usage-limit policy UUID to archive")
5172
5561
  },
5173
5562
  listUsageLimitEntities: {
5174
- limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
5175
- status: z14.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
5176
- search: z14.string().optional().describe("Search tracked values"),
5563
+ limit_id: z18.string().min(1).describe("Usage-limit policy UUID"),
5564
+ status: z18.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
5565
+ search: z18.string().optional().describe("Search tracked values"),
5177
5566
  page_size: PageSizeSchema.describe("Number of entities per page"),
5178
5567
  current_page: CurrentPageSchema.describe("Zero-based page number")
5179
5568
  },
5180
5569
  resetUsageLimitEntity: {
5181
- limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
5182
- entity_id: z14.string().min(1).describe("Tracked entity UUID to reset")
5570
+ limit_id: z18.string().min(1).describe("Usage-limit policy UUID"),
5571
+ entity_id: z18.string().min(1).describe("Tracked entity UUID to reset")
5183
5572
  }
5184
5573
  };
5185
- var updateUsageLimitSchema = z14.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5574
+ var updateUsageLimitSchema = z18.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5186
5575
  if (value.periodic_reset != null && value.periodic_reset_days != null) {
5187
5576
  context.addIssue({
5188
5577
  code: "custom",
@@ -5322,8 +5711,8 @@ function registerLimitsTools(server, service) {
5322
5711
  }
5323
5712
 
5324
5713
  // src/tools/logging.tools.ts
5325
- import { z as z15 } from "zod";
5326
- var logExportFieldSchema = z15.enum([
5714
+ import { z as z19 } from "zod";
5715
+ var logExportFieldSchema = z19.enum([
5327
5716
  "id",
5328
5717
  "trace_id",
5329
5718
  "created_at",
@@ -5346,12 +5735,12 @@ var logExportFieldSchema = z15.enum([
5346
5735
  "metadata"
5347
5736
  ]);
5348
5737
  var getLogShape = {
5349
- log_id: z15.string().describe("Gateway log ID to retrieve"),
5350
- path_format: z15.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
5351
- created_at: z15.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
5352
- type: z15.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
5738
+ log_id: z19.string().describe("Gateway log ID to retrieve"),
5739
+ path_format: z19.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
5740
+ created_at: z19.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
5741
+ type: z19.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
5353
5742
  };
5354
- var getLogSchema = z15.object(getLogShape).superRefine((input, context) => {
5743
+ var getLogSchema = z19.object(getLogShape).superRefine((input, context) => {
5355
5744
  if (input.path_format === "v2" && input.created_at === void 0) {
5356
5745
  context.addIssue({
5357
5746
  code: "custom",
@@ -5362,67 +5751,67 @@ var getLogSchema = z15.object(getLogShape).superRefine((input, context) => {
5362
5751
  });
5363
5752
  var LOGGING_TOOL_SCHEMAS = {
5364
5753
  getLogExportFieldRestrictions: {
5365
- workspace_id: z15.string().describe("Workspace ID whose export field restrictions should be read")
5754
+ workspace_id: z19.string().describe("Workspace ID whose export field restrictions should be read")
5366
5755
  },
5367
5756
  insertLog: {
5368
- request_url: z15.string().optional().describe("The endpoint URL being called"),
5369
- request_provider: z15.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
5370
- request_method: z15.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
5371
- request_headers: z15.record(z15.string(), z15.string()).optional().describe("Request headers as key-value pairs"),
5372
- request_body: z15.record(z15.string(), z15.unknown()).optional().describe("Request payload/body"),
5373
- response_status: z15.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
5374
- response_headers: z15.record(z15.string(), z15.string()).optional().describe("Response headers as key-value pairs"),
5375
- response_body: z15.record(z15.string(), z15.unknown()).optional().describe("Response payload/body"),
5376
- response_time: z15.coerce.number().optional().describe("Response latency in milliseconds"),
5377
- streaming_mode: z15.boolean().optional().default(false).describe("Whether the response was streamed"),
5378
- metadata_organization: z15.string().optional().describe("Organization identifier for the log"),
5379
- metadata_user: z15.string().optional().describe("User identifier for the log"),
5380
- metadata_trace_id: z15.string().optional().describe("Trace ID for distributed tracing"),
5381
- metadata_span_id: z15.string().optional().describe("Span ID for tracing"),
5382
- metadata_span_name: z15.string().optional().describe("Span name for tracing"),
5383
- metadata_parent_span_id: z15.string().optional().describe("Parent span ID for tracing"),
5384
- metadata_custom: z15.record(z15.string(), z15.unknown()).optional().describe("Additional custom metadata key-value pairs")
5757
+ request_url: z19.string().optional().describe("The endpoint URL being called"),
5758
+ request_provider: z19.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
5759
+ request_method: z19.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
5760
+ request_headers: z19.record(z19.string(), z19.string()).optional().describe("Request headers as key-value pairs"),
5761
+ request_body: z19.record(z19.string(), z19.unknown()).optional().describe("Request payload/body"),
5762
+ response_status: z19.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
5763
+ response_headers: z19.record(z19.string(), z19.string()).optional().describe("Response headers as key-value pairs"),
5764
+ response_body: z19.record(z19.string(), z19.unknown()).optional().describe("Response payload/body"),
5765
+ response_time: z19.coerce.number().optional().describe("Response latency in milliseconds"),
5766
+ streaming_mode: z19.boolean().optional().default(false).describe("Whether the response was streamed"),
5767
+ metadata_organization: z19.string().optional().describe("Organization identifier for the log"),
5768
+ metadata_user: z19.string().optional().describe("User identifier for the log"),
5769
+ metadata_trace_id: z19.string().optional().describe("Trace ID for distributed tracing"),
5770
+ metadata_span_id: z19.string().optional().describe("Span ID for tracing"),
5771
+ metadata_span_name: z19.string().optional().describe("Span name for tracing"),
5772
+ metadata_parent_span_id: z19.string().optional().describe("Parent span ID for tracing"),
5773
+ metadata_custom: z19.record(z19.string(), z19.unknown()).optional().describe("Additional custom metadata key-value pairs")
5385
5774
  },
5386
5775
  createLogExport: {
5387
- workspace_id: z15.string().optional().describe("Workspace ID for the export"),
5388
- description: z15.string().optional().describe("Human-readable description for the export job"),
5389
- time_min: z15.string().describe(
5776
+ workspace_id: z19.string().optional().describe("Workspace ID for the export"),
5777
+ description: z19.string().optional().describe("Human-readable description for the export job"),
5778
+ time_min: z19.string().describe(
5390
5779
  "Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
5391
5780
  ),
5392
- time_max: z15.string().describe(
5781
+ time_max: z19.string().describe(
5393
5782
  "Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
5394
5783
  ),
5395
- cost_min: z15.coerce.number().optional().describe("Minimum cost filter"),
5396
- cost_max: z15.coerce.number().optional().describe("Maximum cost filter"),
5397
- total_units_min: z15.coerce.number().optional().describe("Minimum total units (tokens) filter"),
5398
- total_units_max: z15.coerce.number().optional().describe("Maximum total units (tokens) filter"),
5399
- ai_model: z15.array(z15.string()).optional().describe("Filter by specific AI model names"),
5400
- requested_fields: z15.array(logExportFieldSchema).describe(
5784
+ cost_min: z19.coerce.number().optional().describe("Minimum cost filter"),
5785
+ cost_max: z19.coerce.number().optional().describe("Maximum cost filter"),
5786
+ total_units_min: z19.coerce.number().optional().describe("Minimum total units (tokens) filter"),
5787
+ total_units_max: z19.coerce.number().optional().describe("Maximum total units (tokens) filter"),
5788
+ ai_model: z19.array(z19.string()).optional().describe("Filter by specific AI model names"),
5789
+ requested_fields: z19.array(logExportFieldSchema).describe(
5401
5790
  "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"
5402
5791
  )
5403
5792
  },
5404
5793
  listLogExports: {
5405
- workspace_id: z15.string().describe("Workspace ID to list exports for (required)")
5794
+ workspace_id: z19.string().describe("Workspace ID to list exports for (required)")
5406
5795
  },
5407
5796
  getLogExport: {
5408
- export_id: z15.string().describe("The unique ID of the log export")
5797
+ export_id: z19.string().describe("The unique ID of the log export")
5409
5798
  },
5410
5799
  startLogExport: {
5411
- export_id: z15.string().describe("The unique ID of the log export to start")
5800
+ export_id: z19.string().describe("The unique ID of the log export to start")
5412
5801
  },
5413
5802
  cancelLogExport: {
5414
- export_id: z15.string().describe("The unique ID of the log export to cancel")
5803
+ export_id: z19.string().describe("The unique ID of the log export to cancel")
5415
5804
  },
5416
5805
  downloadLogExport: {
5417
- export_id: z15.string().describe("The unique ID of the log export to download")
5806
+ export_id: z19.string().describe("The unique ID of the log export to download")
5418
5807
  },
5419
5808
  updateLogExport: {
5420
- export_id: z15.string().describe("The unique ID of the log export to update"),
5421
- workspace_id: z15.string().optional().describe("Workspace ID for the export"),
5422
- time_of_generation_max: z15.string().optional().describe(
5809
+ export_id: z19.string().describe("The unique ID of the log export to update"),
5810
+ workspace_id: z19.string().optional().describe("Workspace ID for the export"),
5811
+ time_of_generation_max: z19.string().optional().describe(
5423
5812
  "Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
5424
5813
  ),
5425
- requested_fields: z15.array(logExportFieldSchema).optional().describe(
5814
+ requested_fields: z19.array(logExportFieldSchema).optional().describe(
5426
5815
  "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"
5427
5816
  )
5428
5817
  }
@@ -5648,7 +6037,7 @@ function registerLoggingTools(server, service) {
5648
6037
  }
5649
6038
 
5650
6039
  // src/tools/mcp-integrations.tools.ts
5651
- import { z as z16 } from "zod";
6040
+ import { z as z20 } from "zod";
5652
6041
  var mcpSecretMappingSchema = createSecretMappingSchema({
5653
6042
  allowKeyTarget: false,
5654
6043
  targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
@@ -5658,10 +6047,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
5658
6047
  var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
5659
6048
  mcpSecretMappingSchema
5660
6049
  );
5661
- var mcpConfigurationsSchema = z16.record(z16.string(), z16.unknown()).superRefine((value, ctx) => {
6050
+ var mcpConfigurationsSchema = z20.record(z20.string(), z20.unknown()).superRefine((value, ctx) => {
5662
6051
  if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
5663
6052
  ctx.addIssue({
5664
- code: z16.ZodIssueCode.custom,
6053
+ code: z20.ZodIssueCode.custom,
5665
6054
  path: ["custom_headers"],
5666
6055
  message: "configurations.custom_headers must be a string-to-string record"
5667
6056
  });
@@ -5673,31 +6062,31 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5673
6062
  page_size: pageSizeSchema(1e3).describe(
5674
6063
  "Number of results per page (max 1000)"
5675
6064
  ),
5676
- workspace_id: z16.string().optional().describe("Filter by workspace ID"),
5677
- organisation_id: z16.string().optional().describe("Filter by organisation UUID"),
5678
- type: z16.enum(["workspace", "organisation", "all"]).optional().describe(
6065
+ workspace_id: z20.string().optional().describe("Filter by workspace ID"),
6066
+ organisation_id: z20.string().optional().describe("Filter by organisation UUID"),
6067
+ type: z20.enum(["workspace", "organisation", "all"]).optional().describe(
5679
6068
  "Filter by workspace, organisation, or all integration ownership"
5680
6069
  ),
5681
- search: z16.string().optional().describe("Search integrations by name")
6070
+ search: z20.string().optional().describe("Search integrations by name")
5682
6071
  },
5683
6072
  createMcpIntegration: {
5684
- name: z16.string().describe("Display name for the MCP integration"),
5685
- url: z16.string().describe("URL endpoint of the MCP server to integrate"),
5686
- auth_type: z16.string().min(1).describe(
6073
+ name: z20.string().describe("Display name for the MCP integration"),
6074
+ url: z20.string().describe("URL endpoint of the MCP server to integrate"),
6075
+ auth_type: z20.string().min(1).describe(
5687
6076
  "Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5688
6077
  ),
5689
- transport: z16.enum(["http", "sse"]).describe(
6078
+ transport: z20.enum(["http", "sse"]).describe(
5690
6079
  "MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
5691
6080
  ),
5692
- slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
5693
- description: z16.string().optional().describe("Description of the MCP integration"),
5694
- custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
6081
+ slug: z20.string().optional().describe("Custom slug. Auto-generated if omitted"),
6082
+ description: z20.string().optional().describe("Description of the MCP integration"),
6083
+ custom_headers: z20.record(z20.string(), z20.string()).optional().describe(
5695
6084
  'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
5696
6085
  ),
5697
6086
  configurations: mcpConfigurationsSchema.optional().describe(
5698
6087
  "Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
5699
6088
  ),
5700
- workspace_id: z16.string().optional().describe(
6089
+ workspace_id: z20.string().optional().describe(
5701
6090
  "Workspace ID \u2014 required when using organization admin API keys"
5702
6091
  ),
5703
6092
  secret_mappings: mcpSecretMappingsSchema.optional().describe(
@@ -5705,18 +6094,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5705
6094
  )
5706
6095
  },
5707
6096
  getMcpIntegration: {
5708
- id: z16.string().describe("The MCP integration ID or slug to retrieve")
6097
+ id: z20.string().describe("The MCP integration ID or slug to retrieve")
5709
6098
  },
5710
6099
  updateMcpIntegration: {
5711
- id: z16.string().describe("The MCP integration ID or slug to update"),
5712
- name: z16.string().optional().describe("New display name"),
5713
- description: z16.string().optional().describe("New description"),
5714
- url: z16.string().optional().describe("New URL endpoint"),
5715
- auth_type: z16.string().min(1).optional().describe(
6100
+ id: z20.string().describe("The MCP integration ID or slug to update"),
6101
+ name: z20.string().optional().describe("New display name"),
6102
+ description: z20.string().optional().describe("New description"),
6103
+ url: z20.string().optional().describe("New URL endpoint"),
6104
+ auth_type: z20.string().min(1).optional().describe(
5716
6105
  "New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5717
6106
  ),
5718
- transport: z16.enum(["http", "sse"]).optional().describe("New transport protocol"),
5719
- custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
6107
+ transport: z20.enum(["http", "sse"]).optional().describe("New transport protocol"),
6108
+ custom_headers: z20.record(z20.string(), z20.string()).optional().describe(
5720
6109
  "New custom headers for authentication. Sent via configurations.custom_headers"
5721
6110
  ),
5722
6111
  configurations: mcpConfigurationsSchema.optional().describe(
@@ -5727,50 +6116,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5727
6116
  )
5728
6117
  },
5729
6118
  deleteMcpIntegration: {
5730
- id: z16.string().describe("The MCP integration ID or slug to delete")
6119
+ id: z20.string().describe("The MCP integration ID or slug to delete")
5731
6120
  },
5732
6121
  getMcpIntegrationMetadata: {
5733
- id: z16.string().describe("The MCP integration ID or slug")
6122
+ id: z20.string().describe("The MCP integration ID or slug")
5734
6123
  },
5735
6124
  listMcpIntegrationCapabilities: {
5736
- id: z16.string().describe("The MCP integration ID or slug")
6125
+ id: z20.string().describe("The MCP integration ID or slug")
5737
6126
  },
5738
6127
  updateMcpIntegrationCapabilities: {
5739
- id: z16.string().describe("The MCP integration ID or slug"),
5740
- capabilities: z16.array(
5741
- z16.object({
5742
- name: z16.string().describe("Capability name"),
5743
- type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
5744
- enabled: z16.boolean().describe("Whether to enable the capability")
6128
+ id: z20.string().describe("The MCP integration ID or slug"),
6129
+ capabilities: z20.array(
6130
+ z20.object({
6131
+ name: z20.string().describe("Capability name"),
6132
+ type: z20.enum(["tool", "prompt", "resource"]).describe("Capability type"),
6133
+ enabled: z20.boolean().describe("Whether to enable the capability")
5745
6134
  })
5746
6135
  ).min(1).describe("Array of capability updates")
5747
6136
  },
5748
6137
  listMcpIntegrationWorkspaces: {
5749
- id: z16.string().describe("The MCP integration ID or slug")
6138
+ id: z20.string().describe("The MCP integration ID or slug")
5750
6139
  },
5751
6140
  updateMcpIntegrationWorkspaces: {
5752
- id: z16.string().describe("The MCP integration ID or slug"),
5753
- workspaces: z16.array(
5754
- z16.object({
5755
- id: z16.string().describe("Workspace ID"),
5756
- enabled: z16.boolean().describe("Whether workspace has access")
6141
+ id: z20.string().describe("The MCP integration ID or slug"),
6142
+ workspaces: z20.array(
6143
+ z20.object({
6144
+ id: z20.string().describe("Workspace ID"),
6145
+ enabled: z20.boolean().describe("Whether workspace has access")
5757
6146
  })
5758
6147
  ).min(1).describe("Array of workspace access updates")
5759
6148
  }
5760
6149
  };
5761
- var createMcpIntegrationSchema = z16.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
6150
+ var createMcpIntegrationSchema = z20.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
5762
6151
  const configuredHeaders = value.configurations?.custom_headers;
5763
6152
  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(
5764
6153
  (mapping) => mapping.target_field === "configurations.custom_headers"
5765
6154
  )) {
5766
6155
  ctx.addIssue({
5767
- code: z16.ZodIssueCode.custom,
6156
+ code: z20.ZodIssueCode.custom,
5768
6157
  path: [],
5769
6158
  message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
5770
6159
  });
5771
6160
  }
5772
6161
  });
5773
- var updateMcpIntegrationSchema = z16.object(
6162
+ var updateMcpIntegrationSchema = z20.object(
5774
6163
  MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
5775
6164
  );
5776
6165
  function isRecord2(value) {
@@ -6011,68 +6400,68 @@ function registerMcpIntegrationsTools(server, service) {
6011
6400
  }
6012
6401
 
6013
6402
  // src/tools/mcp-servers.tools.ts
6014
- import { z as z17 } from "zod";
6403
+ import { z as z21 } from "zod";
6015
6404
  var MCP_SERVERS_TOOL_SCHEMAS = {
6016
6405
  listMcpServers: {
6017
6406
  current_page: CurrentPageSchema,
6018
6407
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
6019
- workspace_id: z17.string().optional().describe("Filter by workspace ID")
6408
+ workspace_id: z21.string().optional().describe("Filter by workspace ID")
6020
6409
  },
6021
6410
  createMcpServer: {
6022
- name: z17.string().describe("Display name for the MCP server"),
6023
- mcp_integration_id: z17.string().describe("ID or slug of the MCP integration this server belongs to"),
6024
- slug: z17.string().optional().describe("Custom slug. Auto-generated if omitted"),
6025
- description: z17.string().optional().describe("Description of the MCP server")
6411
+ name: z21.string().describe("Display name for the MCP server"),
6412
+ mcp_integration_id: z21.string().describe("ID or slug of the MCP integration this server belongs to"),
6413
+ slug: z21.string().optional().describe("Custom slug. Auto-generated if omitted"),
6414
+ description: z21.string().optional().describe("Description of the MCP server")
6026
6415
  },
6027
6416
  getMcpServer: {
6028
- id: z17.string().describe("The MCP server ID or slug to retrieve")
6417
+ id: z21.string().describe("The MCP server ID or slug to retrieve")
6029
6418
  },
6030
6419
  updateMcpServer: {
6031
- id: z17.string().describe("The MCP server ID or slug to update"),
6032
- name: z17.string().optional().describe("New display name"),
6033
- description: z17.string().optional().describe("New description")
6420
+ id: z21.string().describe("The MCP server ID or slug to update"),
6421
+ name: z21.string().optional().describe("New display name"),
6422
+ description: z21.string().optional().describe("New description")
6034
6423
  },
6035
6424
  deleteMcpServer: {
6036
- id: z17.string().describe("The MCP server ID or slug to delete")
6425
+ id: z21.string().describe("The MCP server ID or slug to delete")
6037
6426
  },
6038
6427
  testMcpServer: {
6039
- id: z17.string().describe("The MCP server ID or slug to test")
6428
+ id: z21.string().describe("The MCP server ID or slug to test")
6040
6429
  },
6041
6430
  listMcpServerCapabilities: {
6042
- id: z17.string().describe("The MCP server ID or slug"),
6431
+ id: z21.string().describe("The MCP server ID or slug"),
6043
6432
  current_page: CurrentPageSchema,
6044
6433
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
6045
6434
  },
6046
6435
  updateMcpServerCapabilities: {
6047
- id: z17.string().describe("The MCP server ID or slug"),
6048
- capabilities: z17.array(
6049
- z17.object({
6050
- name: z17.string().describe("Capability name"),
6051
- type: z17.enum(["tool", "prompt", "resource"]).describe("Capability type"),
6052
- enabled: z17.boolean().describe("Whether to enable the capability")
6436
+ id: z21.string().describe("The MCP server ID or slug"),
6437
+ capabilities: z21.array(
6438
+ z21.object({
6439
+ name: z21.string().describe("Capability name"),
6440
+ type: z21.enum(["tool", "prompt", "resource"]).describe("Capability type"),
6441
+ enabled: z21.boolean().describe("Whether to enable the capability")
6053
6442
  })
6054
6443
  ).min(1).describe("Array of capability updates")
6055
6444
  },
6056
6445
  listMcpServerUserAccess: {
6057
- id: z17.string().describe("The MCP server ID or slug"),
6446
+ id: z21.string().describe("The MCP server ID or slug"),
6058
6447
  current_page: CurrentPageSchema,
6059
6448
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
6060
6449
  },
6061
6450
  updateMcpServerUserAccess: {
6062
- id: z17.string().describe("The MCP server ID or slug"),
6063
- users: z17.array(
6064
- z17.object({
6065
- user_id: z17.string().describe("User ID"),
6066
- enabled: z17.boolean().describe("Whether user has access")
6451
+ id: z21.string().describe("The MCP server ID or slug"),
6452
+ users: z21.array(
6453
+ z21.object({
6454
+ user_id: z21.string().describe("User ID"),
6455
+ enabled: z21.boolean().describe("Whether user has access")
6067
6456
  })
6068
6457
  ).min(1).describe("Array of user access updates")
6069
6458
  },
6070
6459
  listMcpServerConnections: {
6071
- id: z17.string().describe("MCP server ID or slug whose connections to list"),
6072
- user_id: z17.string().uuid().optional().describe(
6460
+ id: z21.string().describe("MCP server ID or slug whose connections to list"),
6461
+ user_id: z21.string().uuid().optional().describe(
6073
6462
  "User UUID to filter; user-scoped keys default to their own user when omitted"
6074
6463
  ),
6075
- workspace_id: z17.string().optional().describe(
6464
+ workspace_id: z21.string().optional().describe(
6076
6465
  "Workspace ID or slug; required with an organisation admin API key"
6077
6466
  ),
6078
6467
  current_page: CurrentPageSchema.describe(
@@ -6083,11 +6472,11 @@ var MCP_SERVERS_TOOL_SCHEMAS = {
6083
6472
  )
6084
6473
  },
6085
6474
  disconnectMcpServerConnection: {
6086
- id: z17.string().describe("MCP server ID or slug containing the active connection"),
6087
- user_id: z17.string().uuid().optional().describe(
6475
+ id: z21.string().describe("MCP server ID or slug containing the active connection"),
6476
+ user_id: z21.string().uuid().optional().describe(
6088
6477
  "User UUID to disconnect; required with service keys and derived from user keys when omitted"
6089
6478
  ),
6090
- workspace_id: z17.string().optional().describe(
6479
+ workspace_id: z21.string().optional().describe(
6091
6480
  "Workspace ID or slug; required with an organisation admin API key"
6092
6481
  )
6093
6482
  }
@@ -6314,40 +6703,40 @@ function registerMcpServersTools(server, service) {
6314
6703
  }
6315
6704
 
6316
6705
  // src/tools/partials.tools.ts
6317
- import { z as z18 } from "zod";
6706
+ import { z as z22 } from "zod";
6318
6707
  var PARTIALS_TOOL_SCHEMAS = {
6319
6708
  createPromptPartial: {
6320
- name: z18.string().describe("Display name for the partial"),
6321
- string: z18.string().describe("The partial content/template string"),
6322
- workspace_id: z18.string().optional().describe(
6709
+ name: z22.string().describe("Display name for the partial"),
6710
+ string: z22.string().describe("The partial content/template string"),
6711
+ workspace_id: z22.string().optional().describe(
6323
6712
  "Workspace ID to create partial in (required for org-level API keys)"
6324
6713
  ),
6325
- version_description: z18.string().optional().describe("Description for this version")
6714
+ version_description: z22.string().optional().describe("Description for this version")
6326
6715
  },
6327
6716
  listPromptPartials: {
6328
- collection_id: z18.string().optional().describe(
6717
+ collection_id: z22.string().optional().describe(
6329
6718
  "Filter by collection ID. Optional \u2014 omit to list all partials across collections"
6330
6719
  )
6331
6720
  },
6332
6721
  getPromptPartial: {
6333
- prompt_partial_id: z18.string().describe("Prompt partial ID or slug to retrieve")
6722
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to retrieve")
6334
6723
  },
6335
6724
  updatePromptPartial: {
6336
- prompt_partial_id: z18.string().describe("Prompt partial ID or slug to update"),
6337
- name: z18.string().optional().describe("New display name for the partial"),
6338
- string: z18.string().optional().describe("New content for the partial"),
6339
- description: z18.string().optional().describe("Description for this version"),
6340
- status: z18.enum(["active", "archived"]).optional().describe("New status for the partial")
6725
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to update"),
6726
+ name: z22.string().optional().describe("New display name for the partial"),
6727
+ string: z22.string().optional().describe("New content for the partial"),
6728
+ description: z22.string().optional().describe("Description for this version"),
6729
+ status: z22.enum(["active", "archived"]).optional().describe("New status for the partial")
6341
6730
  },
6342
6731
  deletePromptPartial: {
6343
- prompt_partial_id: z18.string().describe("Prompt partial ID or slug to delete")
6732
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to delete")
6344
6733
  },
6345
6734
  listPartialVersions: {
6346
- prompt_partial_id: z18.string().describe("Prompt partial ID or slug to list versions for")
6735
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to list versions for")
6347
6736
  },
6348
6737
  publishPartial: {
6349
- prompt_partial_id: z18.string().describe("Prompt partial ID or slug"),
6350
- version: z18.coerce.number().positive().describe("Version number to publish as default")
6738
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug"),
6739
+ version: z22.coerce.number().positive().describe("Version number to publish as default")
6351
6740
  }
6352
6741
  };
6353
6742
  function registerPartialsTools(server, service) {
@@ -6484,101 +6873,101 @@ function registerPartialsTools(server, service) {
6484
6873
  }
6485
6874
 
6486
6875
  // src/tools/prompts.tools.ts
6487
- import { z as z19 } from "zod";
6488
- var PROMPT_VARIABLES_SCHEMA = z19.record(z19.string(), z19.union([z19.string(), z19.number(), z19.boolean()])).describe("Variable values to substitute into the template");
6489
- var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z19.object({
6490
- type: z19.string().describe("Content block type"),
6491
- text: z19.string().optional().describe("Text content for text-based blocks")
6876
+ import { z as z23 } from "zod";
6877
+ var PROMPT_VARIABLES_SCHEMA = z23.record(z23.string(), z23.union([z23.string(), z23.number(), z23.boolean()])).describe("Variable values to substitute into the template");
6878
+ var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z23.object({
6879
+ type: z23.string().describe("Content block type"),
6880
+ text: z23.string().optional().describe("Text content for text-based blocks")
6492
6881
  }).passthrough().describe("Content block within a structured chat message");
6493
- var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z19.object({
6494
- role: z19.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
6495
- content: z19.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
6882
+ var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z23.object({
6883
+ role: z23.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
6884
+ content: z23.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
6496
6885
  }).passthrough().describe("Structured chat message in a prompt template");
6497
6886
  var PROMPTS_TOOL_SCHEMAS = {
6498
6887
  createPrompt: {
6499
- name: z19.string().describe("Display name for the prompt"),
6500
- collection_id: z19.string().describe(
6888
+ name: z23.string().describe("Display name for the prompt"),
6889
+ collection_id: z23.string().describe(
6501
6890
  "Collection ID to organize the prompt in (use list_collections to find)"
6502
6891
  ),
6503
- string: z19.string().optional().describe(
6892
+ string: z23.string().optional().describe(
6504
6893
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6505
6894
  ),
6506
- messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6895
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6507
6896
  "Structured chat template alias. Serialized to the legacy string format before creation."
6508
6897
  ),
6509
- parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
6510
- virtual_key: z19.string().describe("Virtual key slug for model access"),
6511
- model: z19.string().optional().describe(
6898
+ parameters: z23.record(z23.string(), z23.unknown()).describe("Default values for template variables"),
6899
+ virtual_key: z23.string().describe("Virtual key slug for model access"),
6900
+ model: z23.string().optional().describe(
6512
6901
  "Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
6513
6902
  ),
6514
- ai_model_id: z19.string().optional().describe(
6903
+ ai_model_id: z23.string().optional().describe(
6515
6904
  "AI model ID (alternative to model). Required unless model or finetune_id is provided"
6516
6905
  ),
6517
- finetune_id: z19.string().optional().describe(
6906
+ finetune_id: z23.string().optional().describe(
6518
6907
  "Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
6519
6908
  ),
6520
- version_description: z19.string().optional().describe("Description for this prompt version"),
6521
- template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
6522
- functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
6523
- tools: z19.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
6909
+ version_description: z23.string().optional().describe("Description for this prompt version"),
6910
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
6911
+ functions: z23.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
6912
+ tools: z23.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
6524
6913
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6525
- is_raw_template: z19.boolean().optional().describe("Render the stored template as a raw structural template"),
6526
- dry_run: z19.boolean().optional().describe("When true, validate without creating")
6914
+ is_raw_template: z23.boolean().optional().describe("Render the stored template as a raw structural template"),
6915
+ dry_run: z23.boolean().optional().describe("When true, validate without creating")
6527
6916
  },
6528
6917
  listPrompts: {
6529
- collection_id: z19.string().optional().describe(
6918
+ collection_id: z23.string().optional().describe(
6530
6919
  "Filter by collection ID (recommended for app-specific prompts)"
6531
6920
  ),
6532
- workspace_id: z19.string().optional().describe("Filter by workspace ID"),
6533
- search: z19.string().optional().describe("Search prompts by name"),
6921
+ workspace_id: z23.string().optional().describe("Filter by workspace ID"),
6922
+ search: z23.string().optional().describe("Search prompts by name"),
6534
6923
  current_page: CurrentPageSchema,
6535
6924
  page_size: PageSizeSchema
6536
6925
  },
6537
6926
  getPrompt: {
6538
- prompt_id: z19.string().describe("Prompt ID or slug to retrieve")
6927
+ prompt_id: z23.string().describe("Prompt ID or slug to retrieve")
6539
6928
  },
6540
6929
  updatePrompt: {
6541
- prompt_id: z19.string().describe("Prompt ID or slug to update"),
6542
- name: z19.string().optional().describe("New display name for the prompt"),
6543
- collection_id: z19.string().optional().describe("Move to a different collection"),
6544
- string: z19.string().optional().describe(
6930
+ prompt_id: z23.string().describe("Prompt ID or slug to update"),
6931
+ name: z23.string().optional().describe("New display name for the prompt"),
6932
+ collection_id: z23.string().optional().describe("Move to a different collection"),
6933
+ string: z23.string().optional().describe(
6545
6934
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6546
6935
  ),
6547
- messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6936
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6548
6937
  "Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
6549
6938
  ),
6550
- parameters: z19.record(z19.string(), z19.unknown()).optional().describe("New default values for template variables"),
6551
- model: z19.string().optional().describe("New model identifier"),
6552
- virtual_key: z19.string().optional().describe("New virtual key slug"),
6553
- version_description: z19.string().optional().describe("Description for this version"),
6554
- template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("New metadata"),
6555
- functions: z19.array(PromptFunctionSchema).optional().describe("New function definitions"),
6556
- tools: z19.array(PromptToolSchema).optional().describe("New tool definitions"),
6939
+ parameters: z23.record(z23.string(), z23.unknown()).optional().describe("New default values for template variables"),
6940
+ model: z23.string().optional().describe("New model identifier"),
6941
+ virtual_key: z23.string().optional().describe("New virtual key slug"),
6942
+ version_description: z23.string().optional().describe("Description for this version"),
6943
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("New metadata"),
6944
+ functions: z23.array(PromptFunctionSchema).optional().describe("New function definitions"),
6945
+ tools: z23.array(PromptToolSchema).optional().describe("New tool definitions"),
6557
6946
  tool_choice: ToolChoiceSchema.optional().describe(
6558
6947
  "New tool choice strategy"
6559
6948
  ),
6560
- is_raw_template: z19.boolean().optional().describe("Enable or disable raw structural-template rendering"),
6561
- dry_run: z19.boolean().optional().describe("When true, validate without updating")
6949
+ is_raw_template: z23.boolean().optional().describe("Enable or disable raw structural-template rendering"),
6950
+ dry_run: z23.boolean().optional().describe("When true, validate without updating")
6562
6951
  },
6563
6952
  deletePrompt: {
6564
- prompt_id: z19.string().describe("Prompt ID or slug to delete")
6953
+ prompt_id: z23.string().describe("Prompt ID or slug to delete")
6565
6954
  },
6566
6955
  publishPrompt: {
6567
- prompt_id: z19.string().describe("Prompt ID or slug to publish"),
6568
- version: z19.coerce.number().positive().describe("Version number to publish as the default")
6956
+ prompt_id: z23.string().describe("Prompt ID or slug to publish"),
6957
+ version: z23.coerce.number().positive().describe("Version number to publish as the default")
6569
6958
  },
6570
6959
  listPromptVersions: {
6571
- prompt_id: z19.string().describe("Prompt ID or slug to list versions for")
6960
+ prompt_id: z23.string().describe("Prompt ID or slug to list versions for")
6572
6961
  },
6573
6962
  renderPrompt: {
6574
- prompt_id: z19.string().describe("Prompt ID or slug to render"),
6963
+ prompt_id: z23.string().describe("Prompt ID or slug to render"),
6575
6964
  variables: PROMPT_VARIABLES_SCHEMA,
6576
6965
  hyperparameters: HyperparametersSchema.optional().describe(
6577
6966
  "Override default hyperparameters"
6578
6967
  )
6579
6968
  },
6580
6969
  runPromptCompletion: {
6581
- prompt_id: z19.string().describe("Prompt ID or slug to execute"),
6970
+ prompt_id: z23.string().describe("Prompt ID or slug to execute"),
6582
6971
  variables: PROMPT_VARIABLES_SCHEMA,
6583
6972
  metadata: BillingMetadataSchema.describe(
6584
6973
  "Billing metadata - client_id, app, env are REQUIRED for cost attribution"
@@ -6588,77 +6977,77 @@ var PROMPTS_TOOL_SCHEMAS = {
6588
6977
  )
6589
6978
  },
6590
6979
  migratePrompt: {
6591
- name: z19.string().describe("Prompt name to create or find for update"),
6980
+ name: z23.string().describe("Prompt name to create or find for update"),
6592
6981
  app: PromptAppIdentifierSchema,
6593
6982
  env: PromptEnvironmentIdentifierSchema,
6594
- collection_id: z19.string().describe("Collection ID to search in and create under"),
6595
- string: z19.string().optional().describe(
6983
+ collection_id: z23.string().describe("Collection ID to search in and create under"),
6984
+ string: z23.string().optional().describe(
6596
6985
  "Legacy prompt template string with {{variable}} mustache syntax."
6597
6986
  ),
6598
- messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6987
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6599
6988
  "Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
6600
6989
  ),
6601
- parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
6602
- virtual_key: z19.string().describe("Virtual key slug for model access"),
6603
- model: z19.string().optional().describe("Model identifier"),
6604
- version_description: z19.string().optional().describe("Description for this version"),
6605
- template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Additional custom metadata"),
6606
- functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions"),
6607
- tools: z19.array(PromptToolSchema).optional().describe("Tool definitions"),
6990
+ parameters: z23.record(z23.string(), z23.unknown()).describe("Default values for template variables"),
6991
+ virtual_key: z23.string().describe("Virtual key slug for model access"),
6992
+ model: z23.string().optional().describe("Model identifier"),
6993
+ version_description: z23.string().optional().describe("Description for this version"),
6994
+ template_metadata: z23.record(z23.string(), z23.unknown()).optional().describe("Additional custom metadata"),
6995
+ functions: z23.array(PromptFunctionSchema).optional().describe("Function definitions"),
6996
+ tools: z23.array(PromptToolSchema).optional().describe("Tool definitions"),
6608
6997
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6609
- is_raw_template: z19.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
6610
- dry_run: z19.boolean().optional().describe(
6998
+ is_raw_template: z23.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
6999
+ dry_run: z23.boolean().optional().describe(
6611
7000
  "When true, only check what action would be taken without making changes"
6612
7001
  )
6613
7002
  },
6614
7003
  promotePrompt: {
6615
- source_prompt_id: z19.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
6616
- target_collection_id: z19.string().describe("Target collection ID for the promoted prompt"),
6617
- target_name: z19.string().optional().describe(
7004
+ source_prompt_id: z23.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
7005
+ target_collection_id: z23.string().describe("Target collection ID for the promoted prompt"),
7006
+ target_name: z23.string().optional().describe(
6618
7007
  "Target prompt name (defaults to source name with env suffix replaced)"
6619
7008
  ),
6620
7009
  target_env: PromptEnvironmentIdentifierSchema,
6621
- virtual_key: z19.string().optional().describe(
7010
+ virtual_key: z23.string().optional().describe(
6622
7011
  "Virtual key ID to use (defaults to source prompt's virtual_key)"
6623
7012
  )
6624
7013
  },
6625
7014
  validateCompletionMetadata: {
6626
- client_id: z19.string().optional().describe("Client ID for billing attribution"),
7015
+ client_id: z23.string().optional().describe("Client ID for billing attribution"),
6627
7016
  app: PromptAppIdentifierSchema.optional(),
6628
7017
  env: PromptEnvironmentIdentifierSchema.optional(),
6629
- project_id: z19.string().optional().describe("Project ID for granular billing"),
6630
- feature: z19.string().optional().describe("Feature name for tracking")
7018
+ project_id: z23.string().optional().describe("Project ID for granular billing"),
7019
+ feature: z23.string().optional().describe("Feature name for tracking")
6631
7020
  },
6632
7021
  getPromptVersion: {
6633
- prompt_id: z19.string().describe("Prompt ID or slug"),
6634
- version_id: z19.string().describe("Version UUID to retrieve")
7022
+ prompt_id: z23.string().describe("Prompt ID or slug"),
7023
+ version_id: z23.string().describe("Version UUID to retrieve")
6635
7024
  },
6636
7025
  updatePromptVersion: {
6637
- prompt_id: z19.string().describe("Prompt ID or slug"),
6638
- version_id: z19.string().describe("Version UUID to update"),
6639
- label_id: z19.string().nullable().describe(
7026
+ prompt_id: z23.string().describe("Prompt ID or slug"),
7027
+ version_id: z23.string().describe("Version UUID to update"),
7028
+ label_id: z23.string().nullable().describe(
6640
7029
  "Label ID to assign to this version, or null to remove the label"
6641
7030
  )
6642
7031
  }
6643
7032
  };
6644
- var createPromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
7033
+ var createPromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
6645
7034
  if (!value.model && !value.ai_model_id && !value.finetune_id) {
6646
7035
  ctx.addIssue({
6647
- code: z19.ZodIssueCode.custom,
7036
+ code: z23.ZodIssueCode.custom,
6648
7037
  message: "At least one of model, ai_model_id, or finetune_id must be provided"
6649
7038
  });
6650
7039
  }
6651
7040
  if (value.string === void 0 && value.messages === void 0) {
6652
7041
  ctx.addIssue({
6653
- code: z19.ZodIssueCode.custom,
7042
+ code: z23.ZodIssueCode.custom,
6654
7043
  message: "Provide either string or messages"
6655
7044
  });
6656
7045
  }
6657
7046
  });
6658
- var migratePromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
7047
+ var migratePromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
6659
7048
  if (value.string === void 0 && value.messages === void 0) {
6660
7049
  ctx.addIssue({
6661
- code: z19.ZodIssueCode.custom,
7050
+ code: z23.ZodIssueCode.custom,
6662
7051
  message: "Provide either string or messages"
6663
7052
  });
6664
7053
  }
@@ -7111,70 +7500,70 @@ function registerPromptsTools(server, service) {
7111
7500
  }
7112
7501
 
7113
7502
  // src/tools/providers.tools.ts
7114
- import { z as z20 } from "zod";
7503
+ import { z as z24 } from "zod";
7115
7504
  var PROVIDERS_TOOL_SCHEMAS = {
7116
7505
  listProviders: {
7117
7506
  current_page: CurrentPageSchema,
7118
7507
  page_size: PageSizeSchema.describe(
7119
7508
  "Number of results per page (max 100, default 50)"
7120
7509
  ),
7121
- workspace_id: z20.string().optional().describe(
7510
+ workspace_id: z24.string().optional().describe(
7122
7511
  "Workspace ID - required when using organization admin keys, optional with workspace API keys"
7123
7512
  )
7124
7513
  },
7125
7514
  createProvider: {
7126
- name: z20.string().describe("Display name for the provider"),
7127
- integration_id: z20.string().describe(
7515
+ name: z24.string().describe("Display name for the provider"),
7516
+ integration_id: z24.string().describe(
7128
7517
  "Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
7129
7518
  ),
7130
- workspace_id: z20.string().optional().describe(
7519
+ workspace_id: z24.string().optional().describe(
7131
7520
  "Workspace ID - required when using organization admin API keys"
7132
7521
  ),
7133
- slug: z20.string().optional().describe(
7522
+ slug: z24.string().optional().describe(
7134
7523
  "Custom slug for the provider. Auto-generated with random suffix if omitted"
7135
7524
  ),
7136
- note: z20.string().optional().describe("Optional note or description for the provider"),
7137
- credit_limit: z20.coerce.number().positive().optional().describe("Credit limit for usage"),
7138
- alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
7139
- usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
7525
+ note: z24.string().optional().describe("Optional note or description for the provider"),
7526
+ credit_limit: z24.coerce.number().positive().optional().describe("Credit limit for usage"),
7527
+ alert_threshold: z24.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
7528
+ usage_limit_type: z24.enum(["cost", "tokens"]).optional().describe(
7140
7529
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7141
7530
  ),
7142
- periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
7531
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7143
7532
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7144
7533
  ),
7145
- rate_limit_value: z20.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
7146
- rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
7534
+ rate_limit_value: z24.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
7535
+ rate_limit_unit: z24.enum(["rpm", "rph", "rpd"]).optional().describe(
7147
7536
  "Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
7148
7537
  ),
7149
- expires_at: z20.string().optional().describe("Expiration date in ISO 8601 format")
7538
+ expires_at: z24.string().optional().describe("Expiration date in ISO 8601 format")
7150
7539
  },
7151
7540
  getProvider: {
7152
- slug: z20.string().describe("The unique slug identifier of the provider to retrieve"),
7153
- workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
7541
+ slug: z24.string().describe("The unique slug identifier of the provider to retrieve"),
7542
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys")
7154
7543
  },
7155
7544
  updateProvider: {
7156
- slug: z20.string().describe("The slug of the provider to update"),
7157
- workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys"),
7158
- name: z20.string().optional().describe("New display name for the provider"),
7159
- note: z20.string().optional().describe("New note or description for the provider"),
7160
- credit_limit: z20.coerce.number().positive().optional().describe("New credit limit for usage"),
7161
- alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
7162
- usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
7545
+ slug: z24.string().describe("The slug of the provider to update"),
7546
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys"),
7547
+ name: z24.string().optional().describe("New display name for the provider"),
7548
+ note: z24.string().optional().describe("New note or description for the provider"),
7549
+ credit_limit: z24.coerce.number().positive().optional().describe("New credit limit for usage"),
7550
+ alert_threshold: z24.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
7551
+ usage_limit_type: z24.enum(["cost", "tokens"]).optional().describe(
7163
7552
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7164
7553
  ),
7165
- periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
7554
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7166
7555
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7167
7556
  ),
7168
- rate_limit_value: z20.coerce.number().positive().optional().describe("New rate limit value"),
7169
- rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
7557
+ rate_limit_value: z24.coerce.number().positive().optional().describe("New rate limit value"),
7558
+ rate_limit_unit: z24.enum(["rpm", "rph", "rpd"]).optional().describe(
7170
7559
  "Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
7171
7560
  ),
7172
- expires_at: z20.string().optional().describe("New expiration date in ISO 8601 format"),
7173
- reset_usage: z20.boolean().optional().describe("Set to true to reset accumulated usage metrics")
7561
+ expires_at: z24.string().optional().describe("New expiration date in ISO 8601 format"),
7562
+ reset_usage: z24.boolean().optional().describe("Set to true to reset accumulated usage metrics")
7174
7563
  },
7175
7564
  deleteProvider: {
7176
- slug: z20.string().describe("The slug of the provider to delete"),
7177
- workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
7565
+ slug: z24.string().describe("The slug of the provider to delete"),
7566
+ workspace_id: z24.string().optional().describe("Workspace ID - required when using organization admin keys")
7178
7567
  }
7179
7568
  };
7180
7569
  function registerProvidersTools(server, service) {
@@ -7321,73 +7710,73 @@ function registerProvidersTools(server, service) {
7321
7710
  }
7322
7711
 
7323
7712
  // src/tools/secret-references.tools.ts
7324
- import { z as z21 } from "zod";
7713
+ import { z as z25 } from "zod";
7325
7714
  var authFields = {
7326
- aws_auth_type: z21.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7715
+ aws_auth_type: z25.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7327
7716
  "AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
7328
7717
  ),
7329
- aws_access_key_id: z21.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
7330
- aws_secret_access_key: z21.string().min(1).describe(
7718
+ aws_access_key_id: z25.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
7719
+ aws_secret_access_key: z25.string().min(1).describe(
7331
7720
  "AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
7332
7721
  ),
7333
- aws_region: z21.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
7334
- aws_role_arn: z21.string().min(1).describe(
7722
+ aws_region: z25.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
7723
+ aws_role_arn: z25.string().min(1).describe(
7335
7724
  "IAM role ARN to assume; required when aws_auth_type is assumedRole"
7336
7725
  ),
7337
- aws_external_id: z21.string().nullable().describe("Optional external ID required by the target IAM role"),
7338
- azure_auth_mode: z21.enum(["entra", "managed", "default"]).describe(
7726
+ aws_external_id: z25.string().nullable().describe("Optional external ID required by the target IAM role"),
7727
+ azure_auth_mode: z25.enum(["entra", "managed", "default"]).describe(
7339
7728
  "Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
7340
7729
  ),
7341
- azure_entra_tenant_id: z21.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
7342
- azure_entra_client_id: z21.string().min(1).describe(
7730
+ azure_entra_tenant_id: z25.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
7731
+ azure_entra_client_id: z25.string().min(1).describe(
7343
7732
  "Microsoft Entra application client ID; required for entra authentication"
7344
7733
  ),
7345
- azure_entra_client_secret: z21.string().min(1).describe(
7734
+ azure_entra_client_secret: z25.string().min(1).describe(
7346
7735
  "Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
7347
7736
  ),
7348
- azure_managed_client_id: z21.string().min(1).describe(
7737
+ azure_managed_client_id: z25.string().min(1).describe(
7349
7738
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7350
7739
  ),
7351
- azure_vault_url: z21.url().describe(
7740
+ azure_vault_url: z25.url().describe(
7352
7741
  "Azure Key Vault URL, for example https://example.vault.azure.net"
7353
7742
  ),
7354
- vault_auth_type: z21.enum(["token", "approle", "kubernetes"]).describe(
7743
+ vault_auth_type: z25.enum(["token", "approle", "kubernetes"]).describe(
7355
7744
  "HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
7356
7745
  ),
7357
- vault_addr: z21.url().describe("Base URL of the HashiCorp Vault server"),
7358
- vault_token: z21.string().min(1).describe(
7746
+ vault_addr: z25.url().describe("Base URL of the HashiCorp Vault server"),
7747
+ vault_token: z25.string().min(1).describe(
7359
7748
  "HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
7360
7749
  ),
7361
- vault_namespace: z21.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
7362
- vault_role_id: z21.string().min(1).describe(
7750
+ vault_namespace: z25.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
7751
+ vault_role_id: z25.string().min(1).describe(
7363
7752
  "HashiCorp Vault AppRole role ID; required for approle authentication"
7364
7753
  ),
7365
- vault_secret_id: z21.string().min(1).describe(
7754
+ vault_secret_id: z25.string().min(1).describe(
7366
7755
  "HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
7367
7756
  ),
7368
- vault_role: z21.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7757
+ vault_role: z25.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7369
7758
  };
7370
- var authConfigSchema = z21.union([
7371
- z21.object({
7372
- aws_auth_type: z21.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
7759
+ var authConfigSchema = z25.union([
7760
+ z25.object({
7761
+ aws_auth_type: z25.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
7373
7762
  aws_access_key_id: authFields.aws_access_key_id,
7374
7763
  aws_secret_access_key: authFields.aws_secret_access_key,
7375
7764
  aws_region: authFields.aws_region
7376
7765
  }).strict(),
7377
- z21.object({
7378
- aws_auth_type: z21.literal("assumedRole").describe("Assume the specified AWS IAM role"),
7766
+ z25.object({
7767
+ aws_auth_type: z25.literal("assumedRole").describe("Assume the specified AWS IAM role"),
7379
7768
  aws_role_arn: authFields.aws_role_arn,
7380
7769
  aws_external_id: authFields.aws_external_id.optional(),
7381
7770
  aws_region: authFields.aws_region
7382
7771
  }).strict(),
7383
- z21.object({
7384
- aws_auth_type: z21.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
7385
- aws_region: z21.string().optional().describe(
7772
+ z25.object({
7773
+ aws_auth_type: z25.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
7774
+ aws_region: z25.string().optional().describe(
7386
7775
  "Optional AWS region containing the secret, for example us-east-1"
7387
7776
  )
7388
7777
  }).strict(),
7389
- z21.object({
7390
- azure_auth_mode: z21.literal("entra").describe(
7778
+ z25.object({
7779
+ azure_auth_mode: z25.literal("entra").describe(
7391
7780
  "Authenticate with a Microsoft Entra application client secret"
7392
7781
  ),
7393
7782
  azure_entra_tenant_id: authFields.azure_entra_tenant_id,
@@ -7395,30 +7784,30 @@ var authConfigSchema = z21.union([
7395
7784
  azure_entra_client_secret: authFields.azure_entra_client_secret,
7396
7785
  azure_vault_url: authFields.azure_vault_url
7397
7786
  }).strict(),
7398
- z21.object({
7399
- azure_auth_mode: z21.literal("managed").describe("Authenticate with an Azure managed identity"),
7787
+ z25.object({
7788
+ azure_auth_mode: z25.literal("managed").describe("Authenticate with an Azure managed identity"),
7400
7789
  azure_managed_client_id: authFields.azure_managed_client_id.optional(),
7401
7790
  azure_vault_url: authFields.azure_vault_url
7402
7791
  }).strict(),
7403
- z21.object({
7404
- azure_auth_mode: z21.literal("default").describe("Use Azure's default runtime credential chain"),
7792
+ z25.object({
7793
+ azure_auth_mode: z25.literal("default").describe("Use Azure's default runtime credential chain"),
7405
7794
  azure_vault_url: authFields.azure_vault_url
7406
7795
  }).strict(),
7407
- z21.object({
7408
- vault_auth_type: z21.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
7796
+ z25.object({
7797
+ vault_auth_type: z25.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
7409
7798
  vault_addr: authFields.vault_addr,
7410
7799
  vault_token: authFields.vault_token,
7411
7800
  vault_namespace: authFields.vault_namespace.optional()
7412
7801
  }).strict(),
7413
- z21.object({
7414
- vault_auth_type: z21.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
7802
+ z25.object({
7803
+ vault_auth_type: z25.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
7415
7804
  vault_addr: authFields.vault_addr,
7416
7805
  vault_role_id: authFields.vault_role_id,
7417
7806
  vault_secret_id: authFields.vault_secret_id,
7418
7807
  vault_namespace: authFields.vault_namespace.optional()
7419
7808
  }).strict(),
7420
- z21.object({
7421
- vault_auth_type: z21.literal("kubernetes").describe(
7809
+ z25.object({
7810
+ vault_auth_type: z25.literal("kubernetes").describe(
7422
7811
  "Authenticate to HashiCorp Vault with a Kubernetes service account"
7423
7812
  ),
7424
7813
  vault_addr: authFields.vault_addr,
@@ -7426,61 +7815,61 @@ var authConfigSchema = z21.union([
7426
7815
  vault_namespace: authFields.vault_namespace.optional()
7427
7816
  }).strict()
7428
7817
  ]);
7429
- var updateAuthConfigSchema = z21.union([
7430
- z21.object({
7818
+ var updateAuthConfigSchema = z25.union([
7819
+ z25.object({
7431
7820
  aws_auth_type: authFields.aws_auth_type.optional(),
7432
7821
  aws_access_key_id: authFields.aws_access_key_id.optional(),
7433
7822
  aws_secret_access_key: authFields.aws_secret_access_key.optional(),
7434
- aws_region: z21.string().optional().describe("AWS region containing the secret, for example us-east-1"),
7823
+ aws_region: z25.string().optional().describe("AWS region containing the secret, for example us-east-1"),
7435
7824
  aws_role_arn: authFields.aws_role_arn.optional(),
7436
7825
  aws_external_id: authFields.aws_external_id.optional()
7437
7826
  }).strict(),
7438
- z21.object({
7827
+ z25.object({
7439
7828
  azure_auth_mode: authFields.azure_auth_mode.optional(),
7440
7829
  azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
7441
7830
  azure_entra_client_id: authFields.azure_entra_client_id.optional(),
7442
7831
  azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
7443
- azure_managed_client_id: z21.string().optional().describe(
7832
+ azure_managed_client_id: z25.string().optional().describe(
7444
7833
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7445
7834
  ),
7446
7835
  azure_vault_url: authFields.azure_vault_url.optional()
7447
7836
  }).strict(),
7448
- z21.object({
7837
+ z25.object({
7449
7838
  vault_auth_type: authFields.vault_auth_type.optional(),
7450
7839
  vault_addr: authFields.vault_addr.optional(),
7451
7840
  vault_token: authFields.vault_token.optional(),
7452
- vault_namespace: z21.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7841
+ vault_namespace: z25.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7453
7842
  vault_role_id: authFields.vault_role_id.optional(),
7454
7843
  vault_secret_id: authFields.vault_secret_id.optional(),
7455
7844
  vault_role: authFields.vault_role.optional()
7456
7845
  }).strict()
7457
7846
  ]);
7458
- var managerTypeSchema = z21.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7847
+ var managerTypeSchema = z25.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7459
7848
  "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"
7460
7849
  );
7461
- var tagsSchema = z21.record(z21.string(), z21.string()).describe("Tag filters or metadata as string key-value pairs");
7850
+ var tagsSchema = z25.record(z25.string(), z25.string()).describe("Tag filters or metadata as string key-value pairs");
7462
7851
  var SECRET_REFERENCE_TOOL_SCHEMAS = {
7463
7852
  create: {
7464
- name: z21.string().min(1).max(255).describe("Human-readable name"),
7853
+ name: z25.string().min(1).max(255).describe("Human-readable name"),
7465
7854
  manager_type: managerTypeSchema,
7466
7855
  auth_config: authConfigSchema.describe(
7467
7856
  "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."
7468
7857
  ),
7469
- secret_path: z21.string().max(1024).describe("Path of the secret in the external secret manager"),
7470
- organisation_id: z21.string().uuid().optional().describe(
7858
+ secret_path: z25.string().max(1024).describe("Path of the secret in the external secret manager"),
7859
+ organisation_id: z25.string().uuid().optional().describe(
7471
7860
  "Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
7472
7861
  ),
7473
- slug: z21.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7862
+ slug: z25.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7474
7863
  "Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
7475
7864
  ),
7476
- description: z21.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
7477
- secret_key: z21.string().max(255).nullable().optional().describe(
7865
+ description: z25.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
7866
+ secret_key: z25.string().max(255).nullable().optional().describe(
7478
7867
  "Optional key within a structured external secret; null uses the whole secret value"
7479
7868
  ),
7480
- allow_all_workspaces: z21.boolean().optional().describe(
7869
+ allow_all_workspaces: z25.boolean().optional().describe(
7481
7870
  "Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
7482
7871
  ),
7483
- allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
7872
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7484
7873
  "Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
7485
7874
  ),
7486
7875
  tags: tagsSchema.nullable().optional().describe(
@@ -7492,7 +7881,7 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7492
7881
  "Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
7493
7882
  ),
7494
7883
  tags: tagsSchema.optional().describe("Return references matching these tags"),
7495
- search: z21.string().min(1).max(255).optional().describe("Search references by name"),
7884
+ search: z25.string().min(1).max(255).optional().describe("Search references by name"),
7496
7885
  current_page: CurrentPageSchema.describe(
7497
7886
  "Zero-based page number; defaults to 0"
7498
7887
  ),
@@ -7501,29 +7890,29 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7501
7890
  )
7502
7891
  },
7503
7892
  get: {
7504
- id: z21.string().min(1).describe("Secret Reference UUID or slug")
7893
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7505
7894
  },
7506
7895
  update: {
7507
- id: z21.string().min(1).describe("Secret Reference UUID or slug"),
7508
- name: z21.string().min(1).max(255).optional().describe("New human-readable name"),
7509
- description: z21.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
7896
+ id: z25.string().min(1).describe("Secret Reference UUID or slug"),
7897
+ name: z25.string().min(1).max(255).optional().describe("New human-readable name"),
7898
+ description: z25.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
7510
7899
  auth_config: updateAuthConfigSchema.optional().describe(
7511
7900
  "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"
7512
7901
  ),
7513
- secret_path: z21.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
7514
- secret_key: z21.string().max(255).nullable().optional().describe(
7902
+ secret_path: z25.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
7903
+ secret_key: z25.string().max(255).nullable().optional().describe(
7515
7904
  "New key within a structured secret, or null to use the whole value"
7516
7905
  ),
7517
- allow_all_workspaces: z21.boolean().optional().describe(
7906
+ allow_all_workspaces: z25.boolean().optional().describe(
7518
7907
  "Whether every workspace may use this reference; cannot be true with allowed_workspaces"
7519
7908
  ),
7520
- allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
7909
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7521
7910
  "Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
7522
7911
  ),
7523
7912
  tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
7524
7913
  },
7525
7914
  delete: {
7526
- id: z21.string().min(1).describe("Secret Reference UUID or slug")
7915
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7527
7916
  }
7528
7917
  };
7529
7918
  function validateWorkspaceAccess(value) {
@@ -7687,29 +8076,29 @@ function registerSecretReferencesTools(server, service) {
7687
8076
  }
7688
8077
 
7689
8078
  // src/tools/tracing.tools.ts
7690
- import { z as z22 } from "zod";
8079
+ import { z as z26 } from "zod";
7691
8080
  var TRACING_TOOL_SCHEMAS = {
7692
8081
  createFeedback: {
7693
- trace_id: z22.string().describe(
8082
+ trace_id: z26.string().describe(
7694
8083
  "The trace ID to associate the feedback with. This links feedback to a specific request/generation."
7695
8084
  ),
7696
- value: z22.coerce.number().describe(
8085
+ value: z26.coerce.number().describe(
7697
8086
  "Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
7698
8087
  ),
7699
- weight: z22.coerce.number().positive().optional().describe(
8088
+ weight: z26.coerce.number().positive().optional().describe(
7700
8089
  "Optional weighting factor for the feedback. Use to give more importance to certain feedback."
7701
8090
  ),
7702
- metadata: z22.record(z22.string(), z22.unknown()).optional().describe(
8091
+ metadata: z26.record(z26.string(), z26.unknown()).optional().describe(
7703
8092
  "Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
7704
8093
  )
7705
8094
  },
7706
8095
  updateFeedback: {
7707
- id: z22.string().describe("The unique identifier of the feedback to update"),
7708
- value: z22.coerce.number().optional().describe(
8096
+ id: z26.string().describe("The unique identifier of the feedback to update"),
8097
+ value: z26.coerce.number().optional().describe(
7709
8098
  "New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
7710
8099
  ),
7711
- weight: z22.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
7712
- metadata: z22.record(z22.string(), z22.unknown()).optional().describe("New or updated custom metadata for the feedback")
8100
+ weight: z26.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
8101
+ metadata: z26.record(z26.string(), z26.unknown()).optional().describe("New or updated custom metadata for the feedback")
7713
8102
  }
7714
8103
  };
7715
8104
  function registerTracingTools(server, service) {
@@ -7751,82 +8140,82 @@ function registerTracingTools(server, service) {
7751
8140
  }
7752
8141
 
7753
8142
  // src/tools/users.tools.ts
7754
- import { z as z23 } from "zod";
8143
+ import { z as z27 } from "zod";
7755
8144
  var USERS_TOOL_SCHEMAS = {
7756
8145
  listAllUsers: {
7757
8146
  current_page: CurrentPageSchema,
7758
8147
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7759
- role: z23.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
7760
- email: z23.string().email().optional().describe("Filter by exact email")
8148
+ role: z27.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
8149
+ email: z27.string().email().optional().describe("Filter by exact email")
7761
8150
  },
7762
8151
  inviteUser: {
7763
- email: z23.string().email().describe("Email address of the user to invite"),
7764
- role: z23.enum(["admin", "member"]).describe(
8152
+ email: z27.string().email().describe("Email address of the user to invite"),
8153
+ role: z27.enum(["admin", "member"]).describe(
7765
8154
  "Organization-level role: 'admin' for full access, 'member' for limited access"
7766
8155
  ),
7767
- first_name: z23.string().optional().describe("User's first name"),
7768
- last_name: z23.string().optional().describe("User's last name"),
7769
- workspaces: z23.array(
7770
- z23.object({
7771
- id: z23.string().describe(
8156
+ first_name: z27.string().optional().describe("User's first name"),
8157
+ last_name: z27.string().optional().describe("User's last name"),
8158
+ workspaces: z27.array(
8159
+ z27.object({
8160
+ id: z27.string().describe(
7772
8161
  "Workspace ID/slug where the user will be granted access"
7773
8162
  ),
7774
- role: z23.enum(["admin", "member", "manager"]).describe(
8163
+ role: z27.enum(["admin", "member", "manager"]).describe(
7775
8164
  "Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
7776
8165
  )
7777
8166
  })
7778
8167
  ).describe(
7779
8168
  "List of workspaces and corresponding roles to grant to the user"
7780
8169
  ),
7781
- workspace_api_key_details: z23.object({
7782
- name: z23.string().optional().describe("Name of the API key to be created"),
7783
- expiry: z23.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
7784
- metadata: z23.record(z23.string(), z23.string()).optional().describe("Additional metadata key-value pairs for the API key"),
7785
- scopes: z23.array(z23.string()).describe("List of permission scopes for the API key")
8170
+ workspace_api_key_details: z27.object({
8171
+ name: z27.string().optional().describe("Name of the API key to be created"),
8172
+ expiry: z27.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
8173
+ metadata: z27.record(z27.string(), z27.string()).optional().describe("Additional metadata key-value pairs for the API key"),
8174
+ scopes: z27.array(z27.string()).describe("List of permission scopes for the API key")
7786
8175
  }).optional().describe("Optional API key to be created for the user")
7787
8176
  },
7788
8177
  getUserStats: {
7789
- time_of_generation_min: z23.string().describe(
8178
+ time_of_generation_min: z27.string().describe(
7790
8179
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
7791
8180
  ),
7792
- time_of_generation_max: z23.string().describe(
8181
+ time_of_generation_max: z27.string().describe(
7793
8182
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
7794
8183
  ),
7795
- total_units_min: z23.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
7796
- total_units_max: z23.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
7797
- cost_min: z23.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
7798
- cost_max: z23.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
7799
- status_code: z23.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
7800
- virtual_keys: z23.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
8184
+ total_units_min: z27.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
8185
+ total_units_max: z27.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
8186
+ cost_min: z27.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
8187
+ cost_max: z27.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
8188
+ status_code: z27.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
8189
+ virtual_keys: z27.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
7801
8190
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
7802
8191
  },
7803
8192
  getUser: {
7804
- user_id: z23.string().describe("The user ID to retrieve")
8193
+ user_id: z27.string().describe("The user ID to retrieve")
7805
8194
  },
7806
8195
  updateUser: {
7807
- user_id: z23.string().describe("The user ID to update"),
7808
- first_name: z23.string().optional().describe("New first name"),
7809
- last_name: z23.string().optional().describe("New last name"),
7810
- role: z23.enum(["admin", "member"]).optional().describe("New organization-level role")
8196
+ user_id: z27.string().describe("The user ID to update"),
8197
+ first_name: z27.string().optional().describe("New first name"),
8198
+ last_name: z27.string().optional().describe("New last name"),
8199
+ role: z27.enum(["admin", "member"]).optional().describe("New organization-level role")
7811
8200
  },
7812
8201
  deleteUser: {
7813
- user_id: z23.string().describe("The user ID to delete")
8202
+ user_id: z27.string().describe("The user ID to delete")
7814
8203
  },
7815
8204
  listUserInvites: {
7816
8205
  current_page: CurrentPageSchema,
7817
8206
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7818
- role: z23.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
7819
- email: z23.string().email().optional().describe("Filter by invited email"),
7820
- status: z23.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
8207
+ role: z27.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
8208
+ email: z27.string().email().optional().describe("Filter by invited email"),
8209
+ status: z27.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
7821
8210
  },
7822
8211
  getUserInvite: {
7823
- invite_id: z23.string().describe("The invite ID to retrieve")
8212
+ invite_id: z27.string().describe("The invite ID to retrieve")
7824
8213
  },
7825
8214
  deleteUserInvite: {
7826
- invite_id: z23.string().describe("The invite ID to delete")
8215
+ invite_id: z27.string().describe("The invite ID to delete")
7827
8216
  },
7828
8217
  resendUserInvite: {
7829
- invite_id: z23.string().describe("The invite ID to resend")
8218
+ invite_id: z27.string().describe("The invite ID to resend")
7830
8219
  }
7831
8220
  };
7832
8221
  function formatUser(user) {
@@ -7987,34 +8376,34 @@ function registerUsersTools(server, service) {
7987
8376
  }
7988
8377
 
7989
8378
  // src/tools/workspaces.tools.ts
7990
- import { z as z24 } from "zod";
8379
+ import { z as z28 } from "zod";
7991
8380
  var scimWorkspaceMappingBaseShape = {
7992
- workspace_id: z24.string().describe("Portkey workspace ID that the SCIM group should access"),
7993
- role: z24.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
8381
+ workspace_id: z28.string().describe("Portkey workspace ID that the SCIM group should access"),
8382
+ role: z28.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
7994
8383
  };
7995
8384
  var createScimWorkspaceMappingShape = {
7996
8385
  ...scimWorkspaceMappingBaseShape,
7997
- scim_group_id: z24.string().min(1).optional().describe(
8386
+ scim_group_id: z28.string().min(1).optional().describe(
7998
8387
  "Existing identity-provider SCIM group ID; provide this or scim_group_name, but not both"
7999
8388
  ),
8000
- scim_group_name: z24.string().min(1).optional().describe(
8389
+ scim_group_name: z28.string().min(1).optional().describe(
8001
8390
  "Existing SCIM group display name; provide this or scim_group_id, but not both"
8002
8391
  )
8003
8392
  };
8004
- var workspaceUsageLimitSchema = z24.object({
8005
- credit_limit: z24.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
8006
- type: z24.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
8007
- alert_threshold: z24.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
8008
- periodic_reset: z24.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
8009
- periodic_reset_days: z24.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
8010
- next_usage_reset_at: z24.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
8393
+ var workspaceUsageLimitSchema = z28.object({
8394
+ credit_limit: z28.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
8395
+ type: z28.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
8396
+ alert_threshold: z28.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
8397
+ periodic_reset: z28.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
8398
+ periodic_reset_days: z28.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
8399
+ next_usage_reset_at: z28.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
8011
8400
  });
8012
- var workspaceRateLimitSchema = z24.object({
8013
- type: z24.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
8014
- unit: z24.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
8015
- value: z24.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
8401
+ var workspaceRateLimitSchema = z28.object({
8402
+ type: z28.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
8403
+ unit: z28.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
8404
+ value: z28.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
8016
8405
  });
8017
- var createScimWorkspaceMappingSchema = z24.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
8406
+ var createScimWorkspaceMappingSchema = z28.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
8018
8407
  if (Boolean(input.scim_group_id) === Boolean(input.scim_group_name)) {
8019
8408
  context.addIssue({
8020
8409
  code: "custom",
@@ -8029,99 +8418,101 @@ var WORKSPACES_TOOL_SCHEMAS = {
8029
8418
  "Number of workspaces to return per page (max 100)"
8030
8419
  ),
8031
8420
  current_page: CurrentPageSchema,
8032
- name: z24.string().optional().describe("Case-sensitive name filter"),
8033
- exact_name: z24.string().optional().describe("Exact workspace name filter"),
8034
- status: z24.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
8421
+ name: z28.string().optional().describe("Case-sensitive name filter"),
8422
+ exact_name: z28.string().optional().describe("Exact workspace name filter"),
8423
+ status: z28.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
8035
8424
  },
8036
8425
  getWorkspace: {
8037
- workspace_id: z24.string().describe(
8426
+ workspace_id: z28.string().describe(
8038
8427
  "The unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response"
8039
8428
  )
8040
8429
  },
8041
8430
  createWorkspace: {
8042
- name: z24.string().describe("Name of the workspace"),
8043
- slug: z24.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
8044
- description: z24.string().optional().describe("Description of the workspace"),
8045
- is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8046
- metadata: z24.record(z24.string(), z24.string()).optional().describe("Custom metadata key-value pairs"),
8047
- users: z24.array(z24.string()).optional().describe("Existing user IDs to add"),
8048
- usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
8049
- rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
8431
+ name: z28.string().describe("Name of the workspace"),
8432
+ slug: z28.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
8433
+ description: z28.string().optional().describe("Description of the workspace"),
8434
+ is_default: z28.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8435
+ metadata: z28.record(z28.string(), z28.string()).optional().describe("Custom metadata key-value pairs"),
8436
+ users: z28.array(z28.string()).optional().describe("Existing user IDs to add"),
8437
+ usage_limits: z28.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
8438
+ rate_limits: z28.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
8050
8439
  },
8051
8440
  updateWorkspace: {
8052
- workspace_id: z24.string().describe("The workspace ID to update"),
8053
- name: z24.string().optional().describe("New name for the workspace"),
8054
- slug: z24.string().optional().describe("New slug for the workspace"),
8055
- description: z24.string().optional().describe("New description"),
8056
- is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8057
- metadata: z24.record(z24.string(), z24.string()).optional().describe("New metadata key-value pairs"),
8058
- input_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
8059
- output_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
8060
- user_api_key_config: z24.string().nullable().optional().describe(
8441
+ workspace_id: z28.string().describe("The workspace ID to update"),
8442
+ name: z28.string().optional().describe("New name for the workspace"),
8443
+ slug: z28.string().optional().describe("New slug for the workspace"),
8444
+ description: z28.string().optional().describe("New description"),
8445
+ is_default: z28.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
8446
+ metadata: z28.record(z28.string(), z28.string()).optional().describe("New metadata key-value pairs"),
8447
+ input_guardrails: z28.array(z28.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
8448
+ output_guardrails: z28.array(z28.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
8449
+ user_api_key_config: z28.string().nullable().optional().describe(
8061
8450
  "Default config slug for workspace-user API keys, or null to clear"
8062
8451
  ),
8063
- usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
8064
- rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
8452
+ usage_limits: z28.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
8453
+ rate_limits: z28.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
8065
8454
  },
8066
8455
  deleteWorkspace: {
8067
- workspace_id: z24.string().describe("The workspace ID to delete")
8456
+ workspace_id: z28.string().describe("The workspace ID to delete")
8068
8457
  },
8069
8458
  addWorkspaceMember: {
8070
- workspace_id: z24.string().describe("The workspace ID to add the member to"),
8071
- user_id: z24.string().uuid(
8459
+ workspace_id: z28.string().describe("The workspace ID to add the member to"),
8460
+ user_id: z28.string().uuid(
8072
8461
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8073
8462
  ).describe(
8074
8463
  "The user ID to add (must be a valid UUID from list_all_users, not an email address)"
8075
8464
  ),
8076
- role: z24.enum(["admin", "member", "manager"]).describe("Role in the workspace")
8465
+ role: z28.enum(["admin", "member", "manager"]).describe("Role in the workspace")
8077
8466
  },
8078
8467
  listWorkspaceMembers: {
8079
- workspace_id: z24.string().describe("The workspace ID to list members for"),
8468
+ workspace_id: z28.string().describe("The workspace ID to list members for"),
8080
8469
  current_page: CurrentPageSchema.describe("Zero-based page number"),
8081
8470
  page_size: PageSizeSchema.describe("Number of members per page"),
8082
- role: z24.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
8083
- email: z24.string().email().optional().describe("Filter by member email")
8471
+ role: z28.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
8472
+ email: z28.string().email().optional().describe("Filter by member email")
8084
8473
  },
8085
8474
  getWorkspaceMember: {
8086
- workspace_id: z24.string().describe("The workspace ID"),
8087
- user_id: z24.string().uuid(
8475
+ workspace_id: z28.string().describe("The workspace ID"),
8476
+ user_id: z28.string().uuid(
8088
8477
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8089
8478
  ).describe(
8090
8479
  "The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
8091
8480
  )
8092
8481
  },
8093
8482
  updateWorkspaceMember: {
8094
- workspace_id: z24.string().describe("The workspace ID"),
8095
- user_id: z24.string().uuid(
8483
+ workspace_id: z28.string().describe("The workspace ID"),
8484
+ user_id: z28.string().uuid(
8096
8485
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8097
8486
  ).describe(
8098
8487
  "The user ID to update (must be a valid UUID from list_all_users, not an email address)"
8099
8488
  ),
8100
- role: z24.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8489
+ role: z28.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8101
8490
  },
8102
8491
  removeWorkspaceMember: {
8103
- workspace_id: z24.string().describe("The workspace ID"),
8104
- user_id: z24.string().uuid(
8492
+ workspace_id: z28.string().describe("The workspace ID"),
8493
+ user_id: z28.string().uuid(
8105
8494
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8106
8495
  ).describe("The user ID to remove")
8107
8496
  },
8108
8497
  listScimWorkspaceMappings: {
8109
- workspace_id: z24.string().optional().describe("Return only mappings for this Portkey workspace ID"),
8110
- scim_group_id: z24.string().optional().describe(
8498
+ workspace_id: z28.string().optional().describe(
8499
+ "Return only mappings for this Portkey workspace UUID (the id from list_workspaces, not its slug)"
8500
+ ),
8501
+ scim_group_id: z28.string().optional().describe(
8111
8502
  "Return only mappings for this identity-provider SCIM group ID"
8112
8503
  ),
8113
- role: z24.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
8114
- page: z24.coerce.number().int().nonnegative().optional().describe(
8504
+ role: z28.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
8505
+ page: z28.coerce.number().int().nonnegative().optional().describe(
8115
8506
  "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."
8116
8507
  ),
8117
8508
  page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
8118
8509
  },
8119
8510
  deleteScimWorkspaceMapping: {
8120
- mapping_id: z24.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
8511
+ mapping_id: z28.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
8121
8512
  },
8122
8513
  listScimGroups: {
8123
- search: z24.string().optional().describe("Case-insensitive text to match against SCIM group names"),
8124
- page: z24.coerce.number().int().nonnegative().optional().describe(
8514
+ search: z28.string().optional().describe("Case-insensitive text to match against SCIM group names"),
8515
+ page: z28.coerce.number().int().nonnegative().optional().describe(
8125
8516
  "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."
8126
8517
  ),
8127
8518
  page_size: PageSizeSchema.describe(
@@ -8435,6 +8826,8 @@ function registerWorkspacesTools(server, service) {
8435
8826
 
8436
8827
  // src/tools/index.ts
8437
8828
  var TOOL_DOMAIN_REGISTRARS = [
8829
+ ["access-policies", registerAccessPoliciesTools],
8830
+ ["egress-allowlist", registerEgressAllowlistTools],
8438
8831
  ["users", registerUsersTools],
8439
8832
  ["workspaces", registerWorkspacesTools],
8440
8833
  ["configs", registerConfigsTools],
@@ -8611,7 +9004,7 @@ function escapeRegExp(value) {
8611
9004
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8612
9005
  }
8613
9006
  function getToolErrorMessage(error) {
8614
- if (error instanceof z25.ZodError) {
9007
+ if (error instanceof z29.ZodError) {
8615
9008
  return formatZodIssues(error);
8616
9009
  }
8617
9010
  if (error instanceof Error && error.message) {
@@ -8620,71 +9013,81 @@ function getToolErrorMessage(error) {
8620
9013
  return String(error);
8621
9014
  }
8622
9015
  var STANDARD_TOOL_OUTPUT_SCHEMA = {
8623
- ok: z25.boolean().describe("Whether the tool call succeeded and returned structured data"),
8624
- data: z25.unknown().optional().describe("Structured success payload when ok is true"),
8625
- error: z25.object({
8626
- message: z25.string().describe("Human-readable error message"),
8627
- details: z25.unknown().optional().describe("Optional structured error details")
9016
+ ok: z29.boolean().describe("Whether the tool call succeeded and returned structured data"),
9017
+ data: z29.unknown().optional().describe("Structured success payload when ok is true"),
9018
+ error: z29.object({
9019
+ message: z29.string().describe("Human-readable error message"),
9020
+ details: z29.unknown().optional().describe("Optional structured error details")
8628
9021
  }).optional().describe("Structured error payload when ok is false")
8629
9022
  };
8630
9023
  var TOOL_SUCCESS_DATA_SCHEMAS = {
8631
- rotate_api_key: z25.object({
8632
- message: z25.string().describe("Rotation confirmation"),
8633
- warning: z25.string().describe("Required handling guidance for the one-time secret"),
8634
- id: z25.string().uuid().describe("Rotated API key UUID"),
8635
- key: z25.string().describe("New API key secret, returned only once"),
8636
- key_transition_expires_at: z25.iso.datetime().describe("Time when the previous key stops working")
9024
+ create_access_policy: CreateAccessPolicyResponseSchema,
9025
+ list_access_policies: ListAccessPoliciesResponseSchema,
9026
+ get_access_policy: AccessPolicySchema,
9027
+ update_access_policy: z29.object({}),
9028
+ delete_access_policy: z29.object({}),
9029
+ create_egress_allowlist_entry: CreateEgressAllowlistResponseSchema,
9030
+ list_egress_allowlist: ListEgressAllowlistResponseSchema,
9031
+ get_egress_allowlist_entry: EgressAllowlistEntrySchema,
9032
+ update_egress_allowlist_entry: z29.object({}),
9033
+ delete_egress_allowlist_entry: z29.object({}),
9034
+ rotate_api_key: z29.object({
9035
+ message: z29.string().describe("Rotation confirmation"),
9036
+ warning: z29.string().describe("Required handling guidance for the one-time secret"),
9037
+ id: z29.string().uuid().describe("Rotated API key UUID"),
9038
+ key: z29.string().describe("New API key secret, returned only once"),
9039
+ key_transition_expires_at: z29.iso.datetime().describe("Time when the previous key stops working")
8637
9040
  }),
8638
- create_secret_reference: z25.object({
8639
- message: z25.string().describe("Creation confirmation"),
8640
- id: z25.string().uuid().describe("New Secret Reference UUID"),
8641
- slug: z25.string().describe("New Secret Reference slug")
9041
+ create_secret_reference: z29.object({
9042
+ message: z29.string().describe("Creation confirmation"),
9043
+ id: z29.string().uuid().describe("New Secret Reference UUID"),
9044
+ slug: z29.string().describe("New Secret Reference slug")
8642
9045
  }),
8643
- list_secret_references: z25.object({
8644
- total: z25.number().int().nonnegative().describe("Total matching references"),
8645
- secret_references: z25.array(
8646
- z25.object({
8647
- id: z25.string().uuid().describe("Secret Reference UUID"),
8648
- name: z25.string().describe("Human-readable name"),
8649
- slug: z25.string().describe("Stable Secret Reference slug"),
9046
+ list_secret_references: z29.object({
9047
+ total: z29.number().int().nonnegative().describe("Total matching references"),
9048
+ secret_references: z29.array(
9049
+ z29.object({
9050
+ id: z29.string().uuid().describe("Secret Reference UUID"),
9051
+ name: z29.string().describe("Human-readable name"),
9052
+ slug: z29.string().describe("Stable Secret Reference slug"),
8650
9053
  manager_type: SecretManagerTypeSchema.describe(
8651
9054
  "External secret manager type"
8652
9055
  ),
8653
- status: z25.literal("ACTIVE").describe("Current reference status"),
8654
- created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
8655
- last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp")
9056
+ status: z29.literal("ACTIVE").describe("Current reference status"),
9057
+ created_at: z29.iso.datetime().describe("ISO 8601 creation timestamp"),
9058
+ last_updated_at: z29.iso.datetime().describe("ISO 8601 last-update timestamp")
8656
9059
  })
8657
9060
  ).describe(
8658
9061
  "Current page of Secret References without authentication values"
8659
9062
  )
8660
9063
  }),
8661
- get_secret_reference: z25.object({
8662
- id: z25.string().uuid().describe("Secret Reference UUID"),
8663
- organisation_id: z25.string().uuid().describe("Owning organisation UUID"),
8664
- name: z25.string().describe("Human-readable name"),
8665
- slug: z25.string().describe("Stable Secret Reference slug"),
8666
- description: z25.string().nullable().describe("Reference description"),
9064
+ get_secret_reference: z29.object({
9065
+ id: z29.string().uuid().describe("Secret Reference UUID"),
9066
+ organisation_id: z29.string().uuid().describe("Owning organisation UUID"),
9067
+ name: z29.string().describe("Human-readable name"),
9068
+ slug: z29.string().describe("Stable Secret Reference slug"),
9069
+ description: z29.string().nullable().describe("Reference description"),
8667
9070
  manager_type: SecretManagerTypeSchema.describe(
8668
9071
  "External secret manager type"
8669
9072
  ),
8670
- secret_path: z25.string().describe("Path in the external secret manager"),
8671
- secret_key: z25.string().nullable().describe("Selected key within a structured secret"),
8672
- allow_all_workspaces: z25.boolean().describe("Whether all workspaces may use the reference"),
8673
- tags: z25.record(z25.string(), z25.string()).nullable().describe("String metadata tags"),
8674
- status: z25.literal("ACTIVE").describe("Current reference status"),
8675
- created_by: z25.string().describe("Creator identifier"),
8676
- created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
8677
- last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp"),
8678
- auth_config: z25.record(z25.string(), z25.unknown()).describe("Authentication configuration with sensitive values redacted"),
8679
- object: z25.literal("secret-reference").describe("Portkey object type")
9073
+ secret_path: z29.string().describe("Path in the external secret manager"),
9074
+ secret_key: z29.string().nullable().describe("Selected key within a structured secret"),
9075
+ allow_all_workspaces: z29.boolean().describe("Whether all workspaces may use the reference"),
9076
+ tags: z29.record(z29.string(), z29.string()).nullable().describe("String metadata tags"),
9077
+ status: z29.literal("ACTIVE").describe("Current reference status"),
9078
+ created_by: z29.string().describe("Creator identifier"),
9079
+ created_at: z29.iso.datetime().describe("ISO 8601 creation timestamp"),
9080
+ last_updated_at: z29.iso.datetime().describe("ISO 8601 last-update timestamp"),
9081
+ auth_config: z29.record(z29.string(), z29.unknown()).describe("Authentication configuration with sensitive values redacted"),
9082
+ object: z29.literal("secret-reference").describe("Portkey object type")
8680
9083
  }),
8681
- update_secret_reference: z25.object({
8682
- message: z25.string().describe("Update confirmation"),
8683
- success: z25.literal(true).describe("Whether the update succeeded")
9084
+ update_secret_reference: z29.object({
9085
+ message: z29.string().describe("Update confirmation"),
9086
+ success: z29.literal(true).describe("Whether the update succeeded")
8684
9087
  }),
8685
- delete_secret_reference: z25.object({
8686
- message: z25.string().describe("Deletion confirmation"),
8687
- success: z25.literal(true).describe("Whether the deletion succeeded")
9088
+ delete_secret_reference: z29.object({
9089
+ message: z29.string().describe("Deletion confirmation"),
9090
+ success: z29.literal(true).describe("Whether the deletion succeeded")
8688
9091
  })
8689
9092
  };
8690
9093
  function getToolOutputSchema(toolName) {
@@ -8760,7 +9163,7 @@ function wrapToolCallback(toolName, callback) {
8760
9163
  return normalizeToolResult(await callback(...args));
8761
9164
  } catch (error) {
8762
9165
  const message = getToolErrorMessage(error);
8763
- const isValidationError = error instanceof z25.ZodError;
9166
+ const isValidationError = error instanceof z29.ZodError;
8764
9167
  const text = isValidationError ? `Invalid arguments for "${toolName}": ${message}` : `Tool "${toolName}" failed: ${message}`;
8765
9168
  Logger.error("Tool callback failed", {
8766
9169
  error: message,
@@ -8978,8 +9381,8 @@ function registerServerPromptsAndResources(server) {
8978
9381
  title: "Plan Portkey Admin Workflow",
8979
9382
  description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
8980
9383
  argsSchema: {
8981
- task: z26.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
8982
- area: z26.string().max(80).optional().describe(
9384
+ task: z30.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
9385
+ area: z30.string().max(80).optional().describe(
8983
9386
  "Optional Portkey area, such as prompts, analytics, configs, or users"
8984
9387
  )
8985
9388
  }
@@ -9058,6 +9461,7 @@ function createMcpServer(options = {}) {
9058
9461
  version: PACKAGE_VERSION
9059
9462
  },
9060
9463
  {
9464
+ maxToolInputElements: 1e4,
9061
9465
  capabilities: {
9062
9466
  prompts: { listChanged: true },
9063
9467
  resources: { listChanged: true },