portkey-admin-mcp 0.12.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/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 z25 } 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
  /**
@@ -450,6 +614,7 @@ var AnalyticsService = class extends BaseService {
450
614
  api_key_ids: params.api_key_ids,
451
615
  metadata: params.metadata,
452
616
  ai_org_model: params.ai_org_model,
617
+ deployment_id: params.deployment_id,
453
618
  trace_id: params.trace_id,
454
619
  span_id: params.span_id,
455
620
  prompt_slug: params.prompt_slug
@@ -618,6 +783,24 @@ var AnalyticsService = class extends BaseService {
618
783
  this.buildAnalyticsParams(params)
619
784
  );
620
785
  }
786
+ async getAnalyticsGroupMcp(params) {
787
+ return this.get(
788
+ "/analytics/groups/mcp",
789
+ this.buildAnalyticsParams(params)
790
+ );
791
+ }
792
+ async getAnalyticsGroupA2a(params) {
793
+ return this.get(
794
+ "/analytics/groups/a2a",
795
+ this.buildAnalyticsParams(params)
796
+ );
797
+ }
798
+ async getAnalyticsGroupWorkspaces(params) {
799
+ return this.get(
800
+ "/analytics/groups/workspaces",
801
+ this.buildAnalyticsParams(params)
802
+ );
803
+ }
621
804
  };
622
805
 
623
806
  // src/services/audit.service.ts
@@ -744,6 +927,85 @@ var DeploymentsService = class extends BaseService {
744
927
  }
745
928
  };
746
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
+
747
1009
  // src/services/guardrails.service.ts
748
1010
  var GuardrailsService = class extends BaseService {
749
1011
  /** Get the organisation-wide input and output guardrail defaults. */
@@ -920,7 +1182,8 @@ var IntegrationsService = class extends BaseService {
920
1182
  current_page: params?.current_page,
921
1183
  page_size: params?.page_size,
922
1184
  workspace_id: params?.workspace_id,
923
- type: params?.type
1185
+ type: params?.type,
1186
+ tags: params?.tags === void 0 ? void 0 : JSON.stringify(params.tags)
924
1187
  });
925
1188
  }
926
1189
  // Create a new integration
@@ -949,7 +1212,12 @@ var IntegrationsService = class extends BaseService {
949
1212
  current_page: params?.current_page,
950
1213
  page_size: params?.page_size
951
1214
  });
952
- 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
+ );
953
1221
  return {
954
1222
  object: response.object ?? "list",
955
1223
  total: response.total ?? data.length,
@@ -2042,6 +2310,8 @@ function getSharedServiceCacheKey(apiKey) {
2042
2310
  }
2043
2311
  var sharedPortkeyServices = /* @__PURE__ */ new Map();
2044
2312
  var PortkeyService = class {
2313
+ accessPolicies;
2314
+ egressAllowlist;
2045
2315
  users;
2046
2316
  workspaces;
2047
2317
  configs;
@@ -2067,6 +2337,14 @@ var PortkeyService = class {
2067
2337
  const resolvedApiKey = resolvePortkeyApiKey(apiKey);
2068
2338
  const resolvedBaseUrl = process.env.PORTKEY_BASE_URL ?? "https://api.portkey.ai/v1";
2069
2339
  validateUrl(resolvedBaseUrl);
2340
+ this.accessPolicies = new AccessPoliciesService(
2341
+ resolvedApiKey,
2342
+ resolvedBaseUrl
2343
+ );
2344
+ this.egressAllowlist = new EgressAllowlistService(
2345
+ resolvedApiKey,
2346
+ resolvedBaseUrl
2347
+ );
2070
2348
  this.users = new UsersService(resolvedApiKey, resolvedBaseUrl);
2071
2349
  this.workspaces = new WorkspacesService(resolvedApiKey, resolvedBaseUrl);
2072
2350
  this.configs = new ConfigsService(resolvedApiKey, resolvedBaseUrl);
@@ -2112,7 +2390,7 @@ function getSharedPortkeyService(apiKey) {
2112
2390
  }
2113
2391
 
2114
2392
  // src/tools/index.ts
2115
- import { z as z24 } from "zod";
2393
+ import { z as z29 } from "zod";
2116
2394
 
2117
2395
  // src/lib/type-guards.ts
2118
2396
  function isRecord(value) {
@@ -2120,97 +2398,97 @@ function isRecord(value) {
2120
2398
  }
2121
2399
 
2122
2400
  // src/schemas/contracts/secret-references.contract.ts
2123
- import { z } from "zod";
2124
- var SecretManagerTypeSchema = z.enum([
2401
+ import { z as z3 } from "zod";
2402
+ var SecretManagerTypeSchema = z3.enum([
2125
2403
  "aws_sm",
2126
2404
  "azure_kv",
2127
2405
  "hashicorp_vault"
2128
2406
  ]);
2129
- var SecretReferenceListItemSchema = z.object({
2130
- id: z.string().uuid(),
2131
- name: z.string(),
2132
- slug: z.string(),
2407
+ var SecretReferenceListItemSchema = z3.object({
2408
+ id: z3.string().uuid(),
2409
+ name: z3.string(),
2410
+ slug: z3.string(),
2133
2411
  manager_type: SecretManagerTypeSchema,
2134
- status: z.literal("ACTIVE"),
2135
- created_at: z.iso.datetime(),
2136
- last_updated_at: z.iso.datetime(),
2137
- 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")
2138
2416
  });
2139
- var ListSecretReferencesResponseSchema = z.object({
2140
- object: z.literal("list"),
2141
- total: z.number().int().nonnegative(),
2142
- 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)
2143
2421
  });
2144
2422
  var SecretReferenceDetailSchema = SecretReferenceListItemSchema.extend(
2145
2423
  {
2146
- organisation_id: z.string().uuid(),
2147
- description: z.string().nullable(),
2148
- secret_path: z.string(),
2149
- secret_key: z.string().nullable(),
2150
- allow_all_workspaces: z.boolean(),
2151
- tags: z.record(z.string(), z.string()).nullable(),
2152
- created_by: z.string(),
2153
- 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())
2154
2432
  }
2155
2433
  );
2156
- var CreateSecretReferenceResponseSchema = z.object({
2157
- id: z.string().uuid(),
2158
- slug: z.string(),
2159
- 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")
2160
2438
  });
2161
2439
 
2162
- // src/tools/analytics.tools.ts
2163
- import { z as z3 } from "zod";
2440
+ // src/tools/access-policies.tools.ts
2441
+ import { z as z5 } from "zod";
2164
2442
 
2165
2443
  // src/lib/schemas.ts
2166
- import { z as z2 } from "zod";
2167
- var PromptFunctionSchema = z2.object({
2168
- name: z2.string().describe("Function name"),
2169
- description: z2.string().optional().describe("Function description"),
2170
- 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")
2171
2449
  });
2172
- var PromptToolSchema = z2.object({
2173
- type: z2.literal("function").describe("Tool type"),
2450
+ var PromptToolSchema = z4.object({
2451
+ type: z4.literal("function").describe("Tool type"),
2174
2452
  function: PromptFunctionSchema.describe("Function definition")
2175
2453
  });
2176
- var HyperparametersSchema = z2.object({
2177
- max_tokens: z2.coerce.number().positive().optional().describe("Maximum tokens to generate"),
2178
- temperature: z2.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
2179
- top_p: z2.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
2180
- top_k: z2.coerce.number().positive().optional().describe("Top-k sampling"),
2181
- presence_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
2182
- frequency_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
2183
- 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")
2184
2462
  });
2185
- var PromptAppIdentifierSchema = z2.string().min(1).describe(
2463
+ var PromptAppIdentifierSchema = z4.string().min(1).describe(
2186
2464
  "App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
2187
2465
  );
2188
- var PromptEnvironmentIdentifierSchema = z2.string().min(1).describe(
2466
+ var PromptEnvironmentIdentifierSchema = z4.string().min(1).describe(
2189
2467
  "Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
2190
2468
  );
2191
- var BillingMetadataSchema = z2.object({
2192
- 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)"),
2193
2471
  app: PromptAppIdentifierSchema,
2194
2472
  env: PromptEnvironmentIdentifierSchema,
2195
- project_id: z2.string().optional().describe("Project ID for granular billing"),
2196
- 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")
2197
2475
  });
2198
- var ToolChoiceSchema = z2.object({
2199
- mode: z2.enum(["auto", "none", "function"]).describe(
2476
+ var ToolChoiceSchema = z4.object({
2477
+ mode: z4.enum(["auto", "none", "function"]).describe(
2200
2478
  "Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
2201
2479
  ),
2202
- 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")
2203
2481
  }).superRefine((value, ctx) => {
2204
2482
  if (value.mode === "function" && !value.function_name) {
2205
2483
  ctx.addIssue({
2206
- code: z2.ZodIssueCode.custom,
2484
+ code: z4.ZodIssueCode.custom,
2207
2485
  path: ["function_name"],
2208
2486
  message: "function_name is required when mode is 'function'"
2209
2487
  });
2210
2488
  }
2211
2489
  if (value.mode !== "function" && value.function_name !== void 0) {
2212
2490
  ctx.addIssue({
2213
- code: z2.ZodIssueCode.custom,
2491
+ code: z4.ZodIssueCode.custom,
2214
2492
  path: ["function_name"],
2215
2493
  message: "function_name is only allowed when mode is 'function'"
2216
2494
  });
@@ -2230,9 +2508,9 @@ function toPromptToolChoice(toolChoice) {
2230
2508
  }
2231
2509
  return toolChoice.mode;
2232
2510
  }
2233
- 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");
2234
2512
  function pageSizeSchema(max = 100) {
2235
- 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})`);
2236
2514
  }
2237
2515
  var PageSizeSchema = pageSizeSchema();
2238
2516
 
@@ -2248,44 +2526,111 @@ function jsonResult(data) {
2248
2526
  };
2249
2527
  }
2250
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
+
2251
2595
  // src/tools/analytics.tools.ts
2596
+ import { z as z6 } from "zod";
2252
2597
  var baseAnalyticsSchema = {
2253
- time_of_generation_min: z3.string().describe(
2598
+ time_of_generation_min: z6.string().describe(
2254
2599
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
2255
2600
  ),
2256
- time_of_generation_max: z3.string().describe(
2601
+ time_of_generation_max: z6.string().describe(
2257
2602
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
2258
2603
  ),
2259
- total_units_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
2260
- total_units_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
2261
- cost_min: z3.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
2262
- cost_max: z3.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
2263
- prompt_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
2264
- prompt_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
2265
- completion_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
2266
- completion_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
2267
- 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(
2268
2613
  "Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
2269
2614
  ),
2270
- weighted_feedback_min: z3.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
2271
- weighted_feedback_max: z3.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
2272
- 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(
2273
2618
  "Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
2274
2619
  ),
2275
- configs: z3.string().optional().describe(
2620
+ configs: z6.string().optional().describe(
2276
2621
  "Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
2277
2622
  ),
2278
- status_codes: z3.array(z3.string()).optional().describe(
2623
+ status_codes: z6.array(z6.string()).optional().describe(
2279
2624
  "Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
2280
2625
  ),
2281
- virtual_key_slugs: z3.array(z3.string()).optional().describe(
2626
+ virtual_key_slugs: z6.array(z6.string()).optional().describe(
2282
2627
  "Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
2283
2628
  ),
2284
- config_slugs: z3.array(z3.string()).optional().describe(
2629
+ config_slugs: z6.array(z6.string()).optional().describe(
2285
2630
  "Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
2286
2631
  ),
2287
- workspace_slug: z3.string().optional().describe("Filter by specific workspace"),
2288
- api_key_ids: z3.preprocess((value) => {
2632
+ workspace_slug: z6.string().optional().describe("Filter by specific workspace"),
2633
+ api_key_ids: z6.preprocess((value) => {
2289
2634
  if (value == null) {
2290
2635
  return value;
2291
2636
  }
@@ -2293,34 +2638,40 @@ var baseAnalyticsSchema = {
2293
2638
  return value.map((item) => String(item)).join(",");
2294
2639
  }
2295
2640
  return value;
2296
- }, z3.string().optional()).describe(
2641
+ }, z6.string().optional()).describe(
2297
2642
  "Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
2298
2643
  ),
2299
- metadata: z3.string().optional().describe(
2644
+ metadata: z6.string().optional().describe(
2300
2645
  `Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
2301
2646
  ),
2302
- ai_org_model: z3.string().optional().describe(
2647
+ ai_org_model: z6.string().optional().describe(
2303
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."
2304
2649
  ),
2305
- provider_models: z3.array(z3.string()).optional().describe(
2650
+ provider_models: z6.array(z6.string()).optional().describe(
2306
2651
  "Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
2307
2652
  ),
2308
- trace_id: z3.string().optional().describe(
2653
+ deployment_id: z6.string().optional().describe(
2654
+ "Comma-separated list of deployment IDs (UUIDs) to filter by. Prefer deployment_ids for structured inputs."
2655
+ ),
2656
+ deployment_ids: z6.array(z6.string()).optional().describe(
2657
+ "Structured alias for deployment_id. Use an array of deployment UUIDs; normalized to the comma-separated Portkey query param."
2658
+ ),
2659
+ trace_id: z6.string().optional().describe(
2309
2660
  "Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
2310
2661
  ),
2311
- trace_ids: z3.array(z3.string()).optional().describe(
2662
+ trace_ids: z6.array(z6.string()).optional().describe(
2312
2663
  "Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
2313
2664
  ),
2314
- span_id: z3.string().optional().describe(
2665
+ span_id: z6.string().optional().describe(
2315
2666
  "Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
2316
2667
  ),
2317
- span_ids: z3.array(z3.string()).optional().describe(
2668
+ span_ids: z6.array(z6.string()).optional().describe(
2318
2669
  "Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
2319
2670
  ),
2320
- metadata_filter: z3.record(z3.string(), z3.unknown()).optional().describe(
2671
+ metadata_filter: z6.record(z6.string(), z6.unknown()).optional().describe(
2321
2672
  "Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
2322
2673
  ),
2323
- prompt_slug: z3.string().optional().describe("Filter by prompt slug")
2674
+ prompt_slug: z6.string().optional().describe("Filter by prompt slug")
2324
2675
  };
2325
2676
  var paginatedAnalyticsSchema = {
2326
2677
  ...baseAnalyticsSchema,
@@ -2329,9 +2680,9 @@ var paginatedAnalyticsSchema = {
2329
2680
  };
2330
2681
  var cacheSummarySchema = {
2331
2682
  ...baseAnalyticsSchema,
2332
- workspace_slug: z3.string().min(1).describe("Workspace slug to analyze")
2683
+ workspace_slug: z6.string().min(1).describe("Workspace slug to analyze")
2333
2684
  };
2334
- var providerMetricSchema = z3.enum([
2685
+ var providerMetricSchema = z6.enum([
2335
2686
  "requests",
2336
2687
  "cost",
2337
2688
  "total_tokens",
@@ -2351,14 +2702,14 @@ var providerGroupAnalyticsSchema = {
2351
2702
  ...cacheSummarySchema,
2352
2703
  current_page: CurrentPageSchema.describe("Zero-based result page"),
2353
2704
  page_size: PageSizeSchema.describe("Number of provider groups per page"),
2354
- order_by: z3.string().optional().describe("Metric or field used to order groups"),
2355
- order_by_type: z3.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
2356
- columns: z3.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
2357
- 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")
2358
2709
  };
2359
2710
  var analyticsGroupMetadataSchema = {
2360
2711
  ...paginatedAnalyticsSchema,
2361
- 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')")
2362
2713
  };
2363
2714
  function formatGraphAnalytics(summary, dataPoints) {
2364
2715
  return {
@@ -2452,6 +2803,7 @@ function normalizeAnalyticsParams(params) {
2452
2803
  trace_ids,
2453
2804
  span_ids,
2454
2805
  provider_models,
2806
+ deployment_ids,
2455
2807
  metadata_filter,
2456
2808
  ...legacyParams
2457
2809
  } = params;
@@ -2482,6 +2834,10 @@ function normalizeAnalyticsParams(params) {
2482
2834
  if (providerModels !== void 0) {
2483
2835
  normalizedParams.ai_org_model = providerModels;
2484
2836
  }
2837
+ const deploymentId = normalizeCommaSeparatedParam(deployment_ids) ?? normalizeCommaSeparatedParam(legacyParams.deployment_id);
2838
+ if (deploymentId !== void 0) {
2839
+ normalizedParams.deployment_id = deploymentId;
2840
+ }
2485
2841
  const traceId = normalizeCommaSeparatedParam(trace_ids) ?? normalizeCommaSeparatedParam(legacyParams.trace_id);
2486
2842
  if (traceId !== void 0) {
2487
2843
  normalizedParams.trace_id = traceId;
@@ -2791,32 +3147,68 @@ function registerAnalyticsTools(server, service) {
2791
3147
  return jsonResult(formatGroupedAnalytics(analytics, "metadata_groups"));
2792
3148
  }
2793
3149
  );
3150
+ server.tool(
3151
+ "get_analytics_group_mcp",
3152
+ "Get a paginated per-MCP-server breakdown with total_groups, group_count, and an mcp_servers array containing each server name and its request count. Use this to see which MCP servers receive the most traffic; use get_analytics_group_a2a for A2A agents or get_analytics_group_users and get_analytics_group_models for other breakdowns.",
3153
+ paginatedAnalyticsSchema,
3154
+ async (params) => {
3155
+ const analytics = await service.analytics.getAnalyticsGroupMcp(
3156
+ normalizeAnalyticsParams(params)
3157
+ );
3158
+ return jsonResult(formatGroupedAnalytics(analytics, "mcp_servers"));
3159
+ }
3160
+ );
3161
+ server.tool(
3162
+ "get_analytics_group_a2a",
3163
+ "Get a paginated per-agent breakdown with total_groups, group_count, and an agents array containing each A2A (agent-to-agent) agent name and its request count. Use this to see which agents receive the most traffic; use get_analytics_group_mcp for MCP servers instead.",
3164
+ paginatedAnalyticsSchema,
3165
+ async (params) => {
3166
+ const analytics = await service.analytics.getAnalyticsGroupA2a(
3167
+ normalizeAnalyticsParams(params)
3168
+ );
3169
+ return jsonResult(formatGroupedAnalytics(analytics, "agents"));
3170
+ }
3171
+ );
3172
+ server.tool(
3173
+ "get_analytics_group_workspaces",
3174
+ "Get a paginated per-workspace breakdown with total_groups, group_count, is_quota_exceeded when reported, and a workspaces array containing each workspace_slug with request count and cost. Use this for org-wide chargeback or comparing workspaces; pass workspace_slug to other analytics tools to drill into one workspace.",
3175
+ paginatedAnalyticsSchema,
3176
+ async (params) => {
3177
+ const analytics = await service.analytics.getAnalyticsGroupWorkspaces(
3178
+ normalizeAnalyticsParams(params)
3179
+ );
3180
+ return jsonResult({
3181
+ ...formatGroupedAnalytics(analytics, "workspaces"),
3182
+ is_quota_exceeded: analytics.is_quota_exceeded
3183
+ });
3184
+ }
3185
+ );
2794
3186
  }
2795
3187
 
2796
3188
  // src/tools/audit.tools.ts
2797
- import { z as z4 } from "zod";
3189
+ import { z as z7 } from "zod";
2798
3190
  var AUDIT_TOOL_SCHEMAS = {
2799
3191
  listAuditLogs: {
2800
- start_time: z4.string().describe(
3192
+ start_time: z7.string().describe(
2801
3193
  "Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
2802
3194
  ),
2803
- end_time: z4.string().describe(
3195
+ end_time: z7.string().describe(
2804
3196
  "End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
2805
3197
  ),
2806
- organisation_id: z4.string().describe("Organisation ID whose audit logs to list"),
2807
- workspace_id: z4.string().optional().describe("Filter audit logs by workspace ID"),
2808
- 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(
2809
3201
  "Filter by the ID of the user or API key that made the request"
2810
3202
  ),
2811
- user_type: z4.enum(["user", "api_key"]).optional().describe("Filter by whether the request came from a user or an API key"),
2812
- request_id: z4.string().optional().describe("Filter by request ID"),
2813
- method: z4.enum(["POST", "PUT", "DELETE"]).optional().describe("Filter by HTTP method of the audited request"),
2814
- uri: z4.string().optional().describe("Filter by request URI path"),
2815
- client_ip: z4.string().optional().describe("Filter by client IP address"),
2816
- country: z4.string().optional().describe("Filter by country derived from the client IP"),
2817
- response_status_code: z4.coerce.number().int().optional().describe("Filter by HTTP response status code (e.g., 200, 403)"),
2818
- action: z4.string().optional().describe("Filter by action type (e.g., 'create', 'update', 'delete')"),
2819
- 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(
2820
3212
  "Filter by resource type (e.g., 'workspace', 'config', 'virtual_key')"
2821
3213
  ),
2822
3214
  current_page: CurrentPageSchema,
@@ -2873,36 +3265,39 @@ function registerAuditTools(server, service) {
2873
3265
  }
2874
3266
 
2875
3267
  // src/tools/collections.tools.ts
2876
- import { z as z5 } from "zod";
3268
+ import { z as z8 } from "zod";
2877
3269
  var COLLECTIONS_TOOL_SCHEMAS = {
2878
3270
  listCollections: {
2879
- workspace_id: z5.string().optional().describe("Filter by workspace ID"),
2880
- 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"),
2881
3273
  current_page: CurrentPageSchema,
2882
3274
  page_size: PageSizeSchema
2883
3275
  },
2884
3276
  createCollection: {
2885
- name: z5.string().describe(
3277
+ name: z8.string().describe(
2886
3278
  "Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
2887
3279
  ),
2888
- workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
3280
+ workspace_id: z8.string().optional().describe("Workspace ID to create collection in"),
3281
+ parent_collection_id: z8.string().optional().describe(
3282
+ "ID or slug of the parent collection to nest under; omit for a top-level collection"
3283
+ )
2889
3284
  },
2890
3285
  getCollection: {
2891
- collection_id: z5.string().describe("Collection ID or slug to retrieve")
3286
+ collection_id: z8.string().describe("Collection ID or slug to retrieve")
2892
3287
  },
2893
3288
  updateCollection: {
2894
- collection_id: z5.string().describe("Collection ID to update"),
2895
- name: z5.string().optional().describe("New name for the collection"),
2896
- 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")
2897
3292
  },
2898
3293
  deleteCollection: {
2899
- collection_id: z5.string().describe("Collection ID to delete")
3294
+ collection_id: z8.string().describe("Collection ID to delete")
2900
3295
  }
2901
3296
  };
2902
3297
  function registerCollectionsTools(server, service) {
2903
3298
  server.tool(
2904
3299
  "list_collections",
2905
- "List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
3300
+ "List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, parent collection ids, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
2906
3301
  COLLECTIONS_TOOL_SCHEMAS.listCollections,
2907
3302
  async (params) => {
2908
3303
  const collections = await service.collections.listCollections(params);
@@ -2913,6 +3308,7 @@ function registerCollectionsTools(server, service) {
2913
3308
  name: collection.name,
2914
3309
  slug: collection.slug,
2915
3310
  workspace_id: collection.workspace_id,
3311
+ parent_collection_id: collection.parent_collection_id,
2916
3312
  created_at: collection.created_at,
2917
3313
  last_updated_at: collection.last_updated_at
2918
3314
  }))
@@ -2921,7 +3317,7 @@ function registerCollectionsTools(server, service) {
2921
3317
  );
2922
3318
  server.tool(
2923
3319
  "create_collection",
2924
- "Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; returns the collection id and slug, and does not move any prompts.",
3320
+ "Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; set parent_collection_id to nest it under an existing collection. Returns the collection id and slug, and does not move any prompts.",
2925
3321
  COLLECTIONS_TOOL_SCHEMAS.createCollection,
2926
3322
  async (params) => {
2927
3323
  const result = await service.collections.createCollection(params);
@@ -2934,7 +3330,7 @@ function registerCollectionsTools(server, service) {
2934
3330
  );
2935
3331
  server.tool(
2936
3332
  "get_collection",
2937
- "Fetch one collection by id or slug and return its name, slug, workspace, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
3333
+ "Fetch one collection by id or slug and return its name, slug, workspace, parent collection id, child collections with prompt counts, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
2938
3334
  COLLECTIONS_TOOL_SCHEMAS.getCollection,
2939
3335
  async (params) => {
2940
3336
  const collection = await service.collections.getCollection(
@@ -2945,6 +3341,8 @@ function registerCollectionsTools(server, service) {
2945
3341
  name: collection.name,
2946
3342
  slug: collection.slug,
2947
3343
  workspace_id: collection.workspace_id,
3344
+ parent_collection_id: collection.parent_collection_id,
3345
+ child_collections: collection.child_collections,
2948
3346
  created_at: collection.created_at,
2949
3347
  last_updated_at: collection.last_updated_at
2950
3348
  });
@@ -2982,10 +3380,10 @@ function registerCollectionsTools(server, service) {
2982
3380
  }
2983
3381
 
2984
3382
  // src/tools/configs.tools.ts
2985
- import { z as z6 } from "zod";
2986
- var configTargetSchema = z6.object({
2987
- provider: z6.string().optional().describe("Provider slug to route requests to"),
2988
- 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")
2989
3387
  }).refine((target) => target.provider || target.virtual_key, {
2990
3388
  message: "Each target must have at least provider or virtual_key"
2991
3389
  });
@@ -2995,45 +3393,45 @@ var CONFIGS_TOOL_SCHEMAS = {
2995
3393
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
2996
3394
  },
2997
3395
  getConfig: {
2998
- slug: z6.string().describe(
3396
+ slug: z9.string().describe(
2999
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"
3000
3398
  )
3001
3399
  },
3002
3400
  createConfig: {
3003
- name: z6.string().describe("Name for the new configuration"),
3004
- workspace_id: z6.string().optional().describe("Workspace ID to create config in"),
3005
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3006
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3007
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3008
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
3009
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
3010
- 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")
3011
3409
  },
3012
3410
  updateConfig: {
3013
- slug: z6.string().describe("Configuration slug to update"),
3014
- name: z6.string().optional().describe("New name for the configuration"),
3015
- status: z6.enum(["active", "inactive"]).optional().describe("Configuration status"),
3016
- cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
3017
- cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
3018
- retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
3019
- retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on"),
3020
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
3021
- 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")
3022
3420
  },
3023
3421
  deleteConfig: {
3024
- slug: z6.string().describe("Configuration slug to delete")
3422
+ slug: z9.string().describe("Configuration slug to delete")
3025
3423
  },
3026
3424
  listConfigVersions: {
3027
- slug: z6.string().describe("Configuration slug to list versions for")
3425
+ slug: z9.string().describe("Configuration slug to list versions for")
3028
3426
  }
3029
3427
  };
3030
- var configPayloadSchema = z6.object({
3031
- cache_mode: z6.enum(["simple", "semantic"]).optional(),
3032
- cache_max_age: z6.coerce.number().positive().optional(),
3033
- retry_attempts: z6.coerce.number().positive().max(5).optional(),
3034
- retry_on_status_codes: z6.array(z6.coerce.number()).optional(),
3035
- strategy_mode: z6.enum(["loadbalance", "fallback"]).optional(),
3036
- 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()
3037
3435
  });
3038
3436
  function buildConfigPayload(params) {
3039
3437
  const cache = params.cache_mode !== void 0 || params.cache_max_age !== void 0 ? {
@@ -3054,10 +3452,10 @@ function buildConfigPayload(params) {
3054
3452
  function hasConfigSettings(config) {
3055
3453
  return config.cache !== void 0 || config.retry !== void 0 || config.strategy !== void 0 || config.targets !== void 0;
3056
3454
  }
3057
- var createConfigSchema = z6.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3455
+ var createConfigSchema = z9.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
3058
3456
  if (!hasConfigSettings(buildConfigPayload(value))) {
3059
3457
  ctx.addIssue({
3060
- code: z6.ZodIssueCode.custom,
3458
+ code: z9.ZodIssueCode.custom,
3061
3459
  message: "At least one config setting (cache_mode, retry_attempts, strategy_mode, or targets) must be provided"
3062
3460
  });
3063
3461
  }
@@ -3202,66 +3600,73 @@ function registerConfigsTools(server, service) {
3202
3600
  }
3203
3601
 
3204
3602
  // src/tools/deployments.tools.ts
3205
- import { z as z7 } from "zod";
3206
- var binaryFlagSchema = z7.union([z7.literal(0), z7.literal(1)]);
3207
- var deploymentTypeSchema = z7.enum(["production", "non_production"]);
3208
- var deploymentStatusSchema = z7.enum(["active", "archived"]);
3209
- var deploymentTagsSchema = z7.record(
3210
- z7.string().regex(
3603
+ import { z as z11 } from "zod";
3604
+
3605
+ // src/tools/tags.schemas.ts
3606
+ import { z as z10 } from "zod";
3607
+ var resourceTagsSchema = z10.record(
3608
+ z10.string().regex(
3211
3609
  /^[a-zA-Z0-9_-]+$/,
3212
3610
  "Tag keys may contain only letters, numbers, underscores, and hyphens"
3213
3611
  ),
3214
- z7.string()
3612
+ z10.string()
3215
3613
  );
3614
+ var integrationTagsSchema = z10.record(z10.string(), z10.string());
3615
+
3616
+ // src/tools/deployments.tools.ts
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"]);
3620
+ var deploymentTagsSchema = resourceTagsSchema;
3216
3621
  var authSettingsSchema = {
3217
- gateway_base_url: z7.url().optional().describe("Self-hosted Gateway base URL"),
3218
- mcp_gateway_base_url: z7.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"),
3219
3624
  is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
3220
3625
  is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
3221
- workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
3222
- jwt_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values allowed to use the deployment"),
3223
- jwt_sub_workspace_mapping: z7.record(z7.string(), z7.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")
3224
3629
  };
3225
3630
  var DEPLOYMENTS_TOOL_SCHEMAS = {
3226
3631
  listDeployments: {
3227
- organisation_id: z7.string().optional().describe("Filter by organisation UUID"),
3632
+ organisation_id: z11.string().optional().describe("Filter by organisation UUID"),
3228
3633
  status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
3229
3634
  type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
3230
- workspace_slug: z7.array(z7.string()).optional().describe("Filter by one or more workspace slugs"),
3231
- search: z7.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"),
3232
3637
  tags: deploymentTagsSchema.optional().describe("Match deployments with all supplied tags")
3233
3638
  },
3234
3639
  registerDeployment: {
3235
- name: z7.string().min(1).describe("Deployment display name"),
3236
- organisation_id: z7.string().optional().describe("Owning organisation UUID"),
3237
- slug: z7.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"),
3238
3643
  type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
3239
- deployment_config: z7.record(z7.string(), z7.unknown()).optional().describe("Gateway deployment configuration"),
3240
- is_default: z7.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"),
3241
3646
  tags: deploymentTagsSchema.nullable().optional().describe("Deployment tags, or null to create without tags"),
3242
3647
  ...authSettingsSchema
3243
3648
  },
3244
3649
  getDeployment: {
3245
- id: z7.string().min(1).describe("Deployment UUID or self"),
3246
- organisation_id: z7.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")
3247
3652
  },
3248
3653
  updateDeployment: {
3249
- id: z7.string().min(1).describe("Deployment UUID"),
3250
- name: z7.string().optional().describe("Replacement display name"),
3654
+ id: z11.string().min(1).describe("Deployment UUID"),
3655
+ name: z11.string().optional().describe("Replacement display name"),
3251
3656
  type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
3252
3657
  status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
3253
- deployment_config: z7.record(z7.string(), z7.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
3254
- is_default: z7.boolean().optional().describe("Whether this is the default deployment"),
3255
- rotate_auth: z7.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
3256
- override_existing: z7.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"),
3257
3662
  tags: deploymentTagsSchema.nullable().optional().describe("Replacement deployment tags, or null to clear all tags"),
3258
3663
  ...authSettingsSchema,
3259
- allow_all_workspaces: z7.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
3260
- remove_workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs to remove from the allowlist"),
3261
- remove_subs_allowed: z7.array(z7.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")
3262
3667
  },
3263
3668
  archiveDeployment: {
3264
- id: z7.string().min(1).describe("Deployment UUID to archive")
3669
+ id: z11.string().min(1).describe("Deployment UUID to archive")
3265
3670
  }
3266
3671
  };
3267
3672
  function compact(value) {
@@ -3370,101 +3775,165 @@ function registerDeploymentsTools(server, service) {
3370
3775
  );
3371
3776
  }
3372
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
+
3373
3842
  // src/tools/guardrails.tools.ts
3374
- import { z as z8 } from "zod";
3375
- var guardrailCheckSchema = z8.object({
3376
- id: z8.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
3377
- name: z8.string().optional().describe("Display name for the check"),
3378
- is_enabled: z8.boolean().optional().describe("Whether the check is enabled"),
3379
- parameters: z8.record(z8.string(), z8.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(
3380
3849
  "Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
3381
3850
  )
3382
3851
  });
3383
- var guardrailFeedbackSchema = z8.object({
3384
- value: z8.coerce.number().optional().describe("Feedback value"),
3385
- weight: z8.coerce.number().optional().describe("Feedback weight"),
3386
- metadata: z8.record(z8.string(), z8.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")
3387
3856
  });
3388
- var guardrailActionSchema = z8.object({
3389
- deny: z8.boolean().optional().describe("Whether to deny the request on check failure"),
3390
- async: z8.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"),
3391
3860
  on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
3392
3861
  on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
3393
- on_fail_action: z8.string().optional().describe("Simple action on failure (e.g., 'block')"),
3394
- message: z8.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")
3395
3864
  });
3396
- var workspaceGuardrailExclusionSchema = z8.object({
3397
- workspace_id: z8.string().describe("Workspace ID whose exclusion state changes"),
3398
- excluded: z8.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")
3399
3868
  });
3400
- var guardrailTargetSchema = z8.enum(["llm", "mcp_tools"]);
3869
+ var guardrailTargetSchema = z13.enum(["llm", "mcp_tools"]);
3401
3870
  var guardrailMcpServerMappingConfigShape = {
3402
- run_on: z8.array(z8.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
3403
- mcp_integration_capability_ids: z8.array(z8.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")
3404
3873
  };
3405
- var guardrailMcpServerMappingConfigSchema = z8.object(
3874
+ var guardrailMcpServerMappingConfigSchema = z13.object(
3406
3875
  guardrailMcpServerMappingConfigShape
3407
3876
  );
3408
3877
  var GUARDRAILS_TOOL_SCHEMAS = {
3409
3878
  getOrganisationDefaults: {},
3410
3879
  listGuardrails: {
3411
- workspace_id: z8.string().optional().describe("Filter guardrails by workspace ID"),
3412
- organisation_id: z8.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"),
3413
3882
  page_size: PageSizeSchema.describe(
3414
3883
  "Number of items per page (1-100, default: 100)"
3415
3884
  ),
3416
3885
  current_page: CurrentPageSchema
3417
3886
  },
3418
3887
  getGuardrail: {
3419
- guardrail_id: z8.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")
3420
3889
  },
3421
3890
  createGuardrail: {
3422
- name: z8.string().describe("Name of the guardrail"),
3891
+ name: z13.string().describe("Name of the guardrail"),
3423
3892
  target: guardrailTargetSchema.optional().describe("LLM traffic by default, or MCP tool calls"),
3424
- checks: z8.array(guardrailCheckSchema).min(1).optional().describe(
3893
+ checks: z13.array(guardrailCheckSchema).min(1).optional().describe(
3425
3894
  "Checks to apply; at least one entry. Required when target is llm."
3426
3895
  ),
3427
3896
  actions: guardrailActionSchema.optional().describe("Actions to take when guardrail checks pass or fail"),
3428
- workspace_id: z8.string().optional().describe("Workspace ID to create the guardrail in"),
3429
- organisation_id: z8.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)")
3430
3899
  },
3431
3900
  updateGuardrail: {
3432
- guardrail_id: z8.string().describe("The guardrail UUID or slug to update"),
3433
- name: z8.string().optional().describe("New name for the guardrail"),
3434
- checks: z8.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"),
3435
3904
  actions: guardrailActionSchema.optional().describe("Updated actions configuration")
3436
3905
  },
3437
3906
  deleteGuardrail: {
3438
- guardrail_id: z8.string().describe("The guardrail UUID or slug to delete")
3907
+ guardrail_id: z13.string().describe("The guardrail UUID or slug to delete")
3439
3908
  },
3440
3909
  updateOrganisationDefaults: {
3441
- input_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
3442
- output_guardrails: z8.array(z8.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")
3443
3912
  },
3444
3913
  listWorkspaceExclusions: {
3445
- organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be listed")
3914
+ organisation_id: z13.string().describe("Organisation ID whose workspace exclusions should be listed")
3446
3915
  },
3447
3916
  updateWorkspaceExclusions: {
3448
- organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be updated"),
3449
- workspaces: z8.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
3450
- override_existing: z8.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")
3451
3920
  },
3452
3921
  listGuardrailMcpServerMappings: {
3453
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug")
3922
+ guardrail_id: z13.string().min(1).describe("Guardrail UUID or slug")
3454
3923
  },
3455
3924
  replaceGuardrailMcpServerMappings: {
3456
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug"),
3457
- mcp_servers: z8.record(z8.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(
3458
3927
  "Complete MCP-server mapping set keyed by server UUID; an empty object clears every mapping"
3459
3928
  )
3460
3929
  },
3461
3930
  upsertGuardrailMcpServerMapping: {
3462
- guardrail_id: z8.string().min(1).describe("Guardrail UUID or slug"),
3463
- mcp_server_id: z8.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"),
3464
3933
  ...guardrailMcpServerMappingConfigShape
3465
3934
  }
3466
3935
  };
3467
- var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3936
+ var createGuardrailSchema = z13.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
3468
3937
  if ((value.target ?? "llm") === "llm" && (!value.checks || !value.actions)) {
3469
3938
  context.addIssue({
3470
3939
  code: "custom",
@@ -3473,10 +3942,10 @@ var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).s
3473
3942
  });
3474
3943
  }
3475
3944
  });
3476
- var replaceGuardrailMcpServerMappingsSchema = z8.object(
3945
+ var replaceGuardrailMcpServerMappingsSchema = z13.object(
3477
3946
  GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings
3478
3947
  );
3479
- var upsertGuardrailMcpServerMappingSchema = z8.object(
3948
+ var upsertGuardrailMcpServerMappingSchema = z13.object(
3480
3949
  GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping
3481
3950
  );
3482
3951
  var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
@@ -3641,7 +4110,7 @@ function registerGuardrailsTools(server, service) {
3641
4110
  );
3642
4111
  server.tool(
3643
4112
  "list_guardrail_mcp_servers",
3644
- "List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
4113
+ "List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Requires a guardrail with target mcp_tools. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
3645
4114
  GUARDRAILS_TOOL_SCHEMAS.listGuardrailMcpServerMappings,
3646
4115
  {
3647
4116
  title: "List Guardrail MCP Servers",
@@ -3656,7 +4125,7 @@ function registerGuardrailsTools(server, service) {
3656
4125
  );
3657
4126
  server.tool(
3658
4127
  "replace_guardrail_mcp_servers",
3659
- "Replace the complete MCP-server mapping set for one guardrail. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
4128
+ "Replace the complete MCP-server mapping set for one guardrail. Requires a guardrail with target mcp_tools. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
3660
4129
  GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings,
3661
4130
  {
3662
4131
  title: "Replace Guardrail MCP Servers",
@@ -3677,7 +4146,7 @@ function registerGuardrailsTools(server, service) {
3677
4146
  );
3678
4147
  server.tool(
3679
4148
  "upsert_guardrail_mcp_server",
3680
- "Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
4149
+ "Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. Requires a guardrail with target mcp_tools. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
3681
4150
  GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping,
3682
4151
  {
3683
4152
  title: "Upsert Guardrail MCP Server",
@@ -3741,7 +4210,7 @@ function registerGuardrailsTools(server, service) {
3741
4210
  }
3742
4211
 
3743
4212
  // src/tools/integrations.tools.ts
3744
- import { z as z10 } from "zod";
4213
+ import { z as z15 } from "zod";
3745
4214
 
3746
4215
  // src/lib/limits.ts
3747
4216
  var PERIODIC_RESET_DEFAULT = "monthly";
@@ -3784,25 +4253,25 @@ function buildRateLimits(params) {
3784
4253
  }
3785
4254
 
3786
4255
  // src/tools/secret-mapping.schemas.ts
3787
- import { z as z9 } from "zod";
4256
+ import { z as z14 } from "zod";
3788
4257
  function createSecretMappingSchema({
3789
4258
  allowKeyTarget,
3790
4259
  targetFieldDescription,
3791
4260
  secretReferenceDescription,
3792
4261
  valueFormatDescription
3793
4262
  }) {
3794
- return z9.object({
3795
- target_field: z9.string().refine(
4263
+ return z14.object({
4264
+ target_field: z14.string().refine(
3796
4265
  (value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
3797
4266
  allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
3798
4267
  ).describe(targetFieldDescription),
3799
- secret_reference_id: z9.string().describe(secretReferenceDescription),
3800
- secret_key: z9.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
3801
- value_format: z9.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)
3802
4271
  });
3803
4272
  }
3804
4273
  function uniqueSecretMappingsSchema(itemSchema) {
3805
- return z9.array(itemSchema).superRefine((mappings, context) => {
4274
+ return z14.array(itemSchema).superRefine((mappings, context) => {
3806
4275
  const firstIndexByTarget = /* @__PURE__ */ new Map();
3807
4276
  for (const [index, mapping] of mappings.entries()) {
3808
4277
  const firstIndex = firstIndexByTarget.get(mapping.target_field);
@@ -3829,8 +4298,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
3829
4298
  var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
3830
4299
  integrationSecretMappingSchema
3831
4300
  );
3832
- var nullableMultiplier = (description) => z10.coerce.number().nonnegative().nullable().optional().describe(description);
3833
- var pricingMultiplierSchema = z10.object({
4301
+ var nullableMultiplier = (description) => z15.coerce.number().nonnegative().nullable().optional().describe(description);
4302
+ var pricingMultiplierSchema = z15.object({
3834
4303
  default: nullableMultiplier(
3835
4304
  "Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
3836
4305
  ),
@@ -3874,175 +4343,178 @@ var pricingMultiplierSchema = z10.object({
3874
4343
  cache_write_image_input_token: nullableMultiplier(
3875
4344
  "Cache-write image input token price multiplier"
3876
4345
  ),
3877
- image: z10.object({
4346
+ image: z15.object({
3878
4347
  default: nullableMultiplier("Default image-generation price multiplier")
3879
4348
  }).nullable().optional().describe("Image-generation pricing multipliers"),
3880
- additional_units: z10.record(z10.string(), z10.coerce.number().nonnegative().nullable()).nullable().optional().describe(
4349
+ additional_units: z15.record(z15.string(), z15.coerce.number().nonnegative().nullable()).nullable().optional().describe(
3881
4350
  "Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
3882
4351
  )
3883
4352
  });
3884
- var pricingAdjustmentsSchema = z10.object({
4353
+ var pricingAdjustmentsSchema = z15.object({
3885
4354
  multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
3886
4355
  }).nullable();
3887
- var modelConfigurationsSchema = z10.object({
3888
- custom_host: z10.string().url().optional().describe("Custom upstream URL used only for this model"),
3889
- custom_headers: z10.record(z10.string(), z10.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")
3890
4359
  });
3891
- var tokenPricingSchema = z10.object({
3892
- price: z10.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")
3893
4362
  });
3894
- var integrationModelPricingSchema = z10.object({
3895
- type: z10.literal("static").describe("Static per-token pricing configuration"),
3896
- pay_as_you_go: z10.object({
4363
+ var integrationModelPricingSchema = z15.object({
4364
+ type: z15.literal("static").describe("Static per-token pricing configuration"),
4365
+ pay_as_you_go: z15.object({
3897
4366
  request_token: tokenPricingSchema.optional().describe("Input token pricing"),
3898
4367
  response_token: tokenPricingSchema.optional().describe("Output token pricing")
3899
4368
  }).optional().describe("Pay-as-you-go rates for this integration model")
3900
4369
  });
3901
4370
  var INTEGRATIONS_TOOL_SCHEMAS = {
3902
4371
  getModelPricing: {
3903
- provider: z10.string().describe(
4372
+ provider: z15.string().describe(
3904
4373
  "Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
3905
4374
  ),
3906
- model: z10.string().describe("Exact provider model identifier, such as gpt-4o")
4375
+ model: z15.string().describe("Exact provider model identifier, such as gpt-4o")
3907
4376
  },
3908
4377
  listIntegrations: {
3909
4378
  current_page: CurrentPageSchema,
3910
4379
  page_size: PageSizeSchema.describe(
3911
4380
  "Number of results per page (default 100, max 100)"
3912
4381
  ),
3913
- workspace_id: z10.string().optional().describe("Filter integrations accessible by a specific workspace"),
3914
- type: z10.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(
3915
4384
  "Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
3916
- )
4385
+ ),
4386
+ tags: integrationTagsSchema.optional().describe("Match integrations that carry all supplied tags")
3917
4387
  },
3918
4388
  createIntegration: {
3919
- name: z10.string().describe("Human-readable name for the integration"),
3920
- ai_provider_id: z10.string().describe(
4389
+ name: z15.string().describe("Human-readable name for the integration"),
4390
+ ai_provider_id: z15.string().describe(
3921
4391
  "ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
3922
4392
  ),
3923
- slug: z10.string().optional().describe(
4393
+ slug: z15.string().optional().describe(
3924
4394
  "URL-friendly identifier (auto-generated from name if not provided)"
3925
4395
  ),
3926
- key: z10.string().optional().describe("API key for the provider (if required)"),
3927
- description: z10.string().optional().describe("Optional description of the integration"),
3928
- workspace_id: z10.string().optional().describe("Workspace ID for workspace-scoped integrations"),
3929
- api_version: z10.string().optional().describe("API version (for Azure OpenAI)"),
3930
- resource_name: z10.string().optional().describe("Resource name (for Azure OpenAI)"),
3931
- deployment_name: z10.string().optional().describe("Deployment name (for Azure OpenAI)"),
3932
- aws_region: z10.string().optional().describe("AWS region (for AWS Bedrock)"),
3933
- aws_access_key_id: z10.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
3934
- aws_secret_access_key: z10.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
3935
- vertex_project_id: z10.string().optional().describe("GCP project ID (for Vertex AI)"),
3936
- vertex_region: z10.string().optional().describe("GCP region (for Vertex AI)"),
3937
- custom_host: z10.string().optional().describe("Custom base URL for the provider"),
3938
- create_default_provider: z10.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(
3939
4409
  "Create a provider automatically for a workspace-scoped integration; defaults to true"
3940
4410
  ),
3941
- default_provider_slug: z10.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"),
3942
4412
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
3943
4413
  "Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
3944
4414
  ),
3945
4415
  pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
3946
4416
  "Negotiated discount or markup multipliers for cost accounting"
3947
- )
4417
+ ),
4418
+ tags: integrationTagsSchema.nullable().optional().describe("Integration tags, or null to create without tags")
3948
4419
  },
3949
4420
  getIntegration: {
3950
- slug: z10.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")
3951
4422
  },
3952
4423
  updateIntegration: {
3953
- slug: z10.string().describe("The slug of the integration to update"),
3954
- name: z10.string().optional().describe("New human-readable name for the integration"),
3955
- key: z10.string().optional().describe("New API key for the provider"),
3956
- description: z10.string().optional().describe("New description for the integration"),
3957
- api_version: z10.string().optional().describe("New API version (for Azure OpenAI)"),
3958
- resource_name: z10.string().optional().describe("New resource name (for Azure OpenAI)"),
3959
- deployment_name: z10.string().optional().describe("New deployment name (for Azure OpenAI)"),
3960
- aws_region: z10.string().optional().describe("New AWS region (for AWS Bedrock)"),
3961
- aws_access_key_id: z10.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
3962
- aws_secret_access_key: z10.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
3963
- vertex_project_id: z10.string().optional().describe("New GCP project ID (for Vertex AI)"),
3964
- vertex_region: z10.string().optional().describe("New GCP region (for Vertex AI)"),
3965
- custom_host: z10.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"),
3966
4437
  secret_mappings: integrationSecretMappingsSchema.optional().describe(
3967
4438
  "Replacement runtime Secret Reference mappings; each target_field must be unique"
3968
4439
  ),
3969
4440
  pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
3970
4441
  "Replacement cost multiplier configuration, or null to clear adjustments"
3971
- )
4442
+ ),
4443
+ tags: integrationTagsSchema.nullable().optional().describe("Replacement integration tags, or null to clear all tags")
3972
4444
  },
3973
4445
  deleteIntegration: {
3974
- slug: z10.string().describe("The slug of the integration to delete")
4446
+ slug: z15.string().describe("The slug of the integration to delete")
3975
4447
  },
3976
4448
  listIntegrationModels: {
3977
- slug: z10.string().describe("The slug of the integration"),
4449
+ slug: z15.string().describe("The slug of the integration"),
3978
4450
  current_page: CurrentPageSchema,
3979
4451
  page_size: PageSizeSchema.describe("Number of results per page")
3980
4452
  },
3981
4453
  updateIntegrationModels: {
3982
- slug: z10.string().describe("The slug of the integration"),
3983
- allow_all_models: z10.boolean().optional().describe(
4454
+ slug: z15.string().describe("The slug of the integration"),
4455
+ allow_all_models: z15.boolean().optional().describe(
3984
4456
  "Whether newly available provider models are enabled by default"
3985
4457
  ),
3986
- models: z10.array(
3987
- z10.object({
3988
- slug: z10.string().describe("The model slug identifier"),
3989
- model_name: z10.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(
3990
4462
  "Display name for the model (required for custom models)"
3991
4463
  ),
3992
- enabled: z10.boolean().describe("Whether the model is enabled"),
3993
- is_custom: z10.boolean().optional().describe("Whether this is a custom model (default: false)"),
3994
- is_finetune: z10.boolean().optional().describe("Whether this entry is a fine-tuned model"),
3995
- base_model_slug: z10.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"),
3996
4468
  configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
3997
4469
  pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
3998
4470
  })
3999
4471
  ).describe("Array of model configurations to update")
4000
4472
  },
4001
4473
  deleteIntegrationModel: {
4002
- slug: z10.string().describe("The slug of the integration"),
4003
- model_slug: z10.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")
4004
4476
  },
4005
4477
  listIntegrationWorkspaces: {
4006
- slug: z10.string().describe("The slug of the integration"),
4478
+ slug: z15.string().describe("The slug of the integration"),
4007
4479
  current_page: CurrentPageSchema,
4008
4480
  page_size: PageSizeSchema.describe("Number of results per page")
4009
4481
  },
4010
4482
  updateIntegrationWorkspaces: {
4011
- slug: z10.string().describe("The slug of the integration"),
4012
- workspaces: z10.array(
4013
- z10.object({
4014
- id: z10.string().describe("The workspace ID"),
4015
- enabled: z10.boolean().describe("Whether the workspace has access to this integration"),
4016
- credit_limit: z10.coerce.number().positive().optional().describe("Credit limit for this workspace"),
4017
- alert_threshold: z10.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4018
- rate_limit_rpm: z10.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4019
- reset_usage: z10.boolean().optional().describe("Reset exhausted usage status to active"),
4020
- create_default_provider: z10.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(
4021
4493
  "Override whether a provider is auto-created for this workspace"
4022
4494
  ),
4023
- default_provider_slug: z10.string().optional().describe(
4495
+ default_provider_slug: z15.string().optional().describe(
4024
4496
  "Override the auto-created provider slug for this workspace"
4025
4497
  )
4026
4498
  })
4027
4499
  ).describe("Array of workspace configurations to update"),
4028
- global_workspace_access_enabled: z10.boolean().optional().describe(
4500
+ global_workspace_access_enabled: z15.boolean().optional().describe(
4029
4501
  "Enable or disable access for all current and future workspaces"
4030
4502
  ),
4031
- global_credit_limit: z10.coerce.number().positive().optional().describe(
4503
+ global_credit_limit: z15.coerce.number().positive().optional().describe(
4032
4504
  "Global cost credit limit applied with global workspace access"
4033
4505
  ),
4034
- global_alert_threshold: z10.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
4035
- global_rate_limit_rpm: z10.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
4036
- override_existing_workspace_access: z10.boolean().optional().describe("Apply global settings over existing per-workspace access"),
4037
- create_default_provider: z10.boolean().optional().describe("Auto-create providers when granting workspace access"),
4038
- default_provider_slug: z10.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")
4039
4511
  }
4040
4512
  };
4041
- var updateIntegrationWorkspacesSchema = z10.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4513
+ var updateIntegrationWorkspacesSchema = z15.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
4042
4514
  const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
4043
4515
  if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
4044
4516
  ctx.addIssue({
4045
- code: z10.ZodIssueCode.custom,
4517
+ code: z15.ZodIssueCode.custom,
4046
4518
  path: ["global_workspace_access_enabled"],
4047
4519
  message: "global_workspace_access_enabled is required when setting global limits."
4048
4520
  });
@@ -4091,14 +4563,15 @@ function registerIntegrationsTools(server, service) {
4091
4563
  );
4092
4564
  server.tool(
4093
4565
  "list_integrations",
4094
- "List org-level AI provider connections with optional workspace or type filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
4566
+ "List org-level AI provider connections with optional workspace, type, or tag filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
4095
4567
  INTEGRATIONS_TOOL_SCHEMAS.listIntegrations,
4096
4568
  async (params) => {
4097
4569
  const integrations = await service.integrations.listIntegrations({
4098
4570
  current_page: params.current_page,
4099
4571
  page_size: params.page_size,
4100
4572
  workspace_id: params.workspace_id,
4101
- type: params.type
4573
+ type: params.type,
4574
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4102
4575
  });
4103
4576
  return jsonResult({
4104
4577
  total: integrations.total,
@@ -4118,7 +4591,7 @@ function registerIntegrationsTools(server, service) {
4118
4591
  );
4119
4592
  server.tool(
4120
4593
  "create_integration",
4121
- "Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
4594
+ "Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting; tags attach key-value labels that list_integrations can filter on. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
4122
4595
  INTEGRATIONS_TOOL_SCHEMAS.createIntegration,
4123
4596
  {
4124
4597
  title: "Create AI Provider Integration",
@@ -4139,7 +4612,8 @@ function registerIntegrationsTools(server, service) {
4139
4612
  ...params.create_default_provider !== void 0 ? { create_default_provider: params.create_default_provider } : {},
4140
4613
  ...params.default_provider_slug !== void 0 ? { default_provider_slug: params.default_provider_slug } : {},
4141
4614
  ...params.secret_mappings !== void 0 ? { secret_mappings: params.secret_mappings } : {},
4142
- ...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {}
4615
+ ...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {},
4616
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4143
4617
  });
4144
4618
  return jsonResult({
4145
4619
  message: `Successfully created integration "${params.name}"`,
@@ -4178,7 +4652,7 @@ function registerIntegrationsTools(server, service) {
4178
4652
  );
4179
4653
  server.tool(
4180
4654
  "update_integration",
4181
- "Update an integration's name, description, API key, provider config, Secret Reference mappings, or pricing adjustments by slug. Only provided fields change; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
4655
+ "Update an integration's name, description, API key, provider config, Secret Reference mappings, pricing adjustments, or tags by slug. Only provided fields change; tags replaces the whole map and null clears it; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
4182
4656
  INTEGRATIONS_TOOL_SCHEMAS.updateIntegration,
4183
4657
  {
4184
4658
  title: "Update AI Provider Integration",
@@ -4194,7 +4668,8 @@ function registerIntegrationsTools(server, service) {
4194
4668
  description: params.description,
4195
4669
  configurations: buildIntegrationConfigurations(params),
4196
4670
  secret_mappings: params.secret_mappings,
4197
- pricing_adjustments: params.pricing_adjustments
4671
+ pricing_adjustments: params.pricing_adjustments,
4672
+ ...params.tags !== void 0 ? { tags: params.tags } : {}
4198
4673
  });
4199
4674
  return jsonResult({
4200
4675
  message: `Successfully updated integration "${params.slug}"`,
@@ -4234,7 +4709,7 @@ function registerIntegrationsTools(server, service) {
4234
4709
  slug: model.slug ?? model.model_id,
4235
4710
  name: model.name ?? model.model_name,
4236
4711
  enabled: model.enabled,
4237
- is_custom: model.is_custom ?? model.custom,
4712
+ is_custom: model.is_custom !== void 0 ? model.is_custom : model.custom,
4238
4713
  is_finetune: model.is_finetune,
4239
4714
  base_model_slug: model.base_model_slug,
4240
4715
  configurations: model.configurations,
@@ -4374,31 +4849,31 @@ function registerIntegrationsTools(server, service) {
4374
4849
  }
4375
4850
 
4376
4851
  // src/tools/keys.tools.ts
4377
- import { z as z11 } from "zod";
4378
- var virtualKeySecretMappingSchema = z11.object({
4379
- target_field: z11.string().refine(
4852
+ import { z as z16 } from "zod";
4853
+ var virtualKeySecretMappingSchema = z16.object({
4854
+ target_field: z16.string().refine(
4380
4855
  (value) => value === "key" || value.startsWith("model_config."),
4381
4856
  "target_field must be 'key' or start with 'model_config.'"
4382
4857
  ).describe("Virtual Key field populated from the Secret Reference"),
4383
- secret_reference_id: z11.string().describe("Secret Reference ID that owns the external secret"),
4384
- secret_key: z11.string().nullable().optional().describe("Optional key selected from a structured external secret"),
4385
- value_format: z11.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")
4386
4861
  });
4387
- var virtualKeyDeploymentSchema = z11.object({
4388
- api_version: z11.string().min(1).describe("Azure OpenAI API version"),
4389
- deployment_name: z11.string().min(1).describe("Azure deployment name"),
4390
- alias: z11.string().optional().describe("Optional model alias for the deployment"),
4391
- is_default: z11.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")
4392
4867
  });
4393
- var apiKeyRateLimitSchema = z11.object({
4394
- type: z11.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
4395
- unit: z11.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
4396
- value: z11.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")
4397
4872
  });
4398
- var rotationPolicySchema = z11.object({
4399
- rotation_period: z11.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
4400
- next_rotation_at: z11.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
4401
- key_transition_period_ms: z11.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")
4402
4877
  }).superRefine((value, context) => {
4403
4878
  if (value.rotation_period && value.next_rotation_at) {
4404
4879
  context.addIssue({
@@ -4414,108 +4889,108 @@ var KEYS_TOOL_SCHEMAS = {
4414
4889
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
4415
4890
  },
4416
4891
  createVirtualKey: {
4417
- name: z11.string().describe("Display name for the virtual key"),
4418
- provider: z11.string().describe(
4892
+ name: z16.string().describe("Display name for the virtual key"),
4893
+ provider: z16.string().describe(
4419
4894
  "Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
4420
4895
  ),
4421
- key: z11.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
4422
- note: z11.string().optional().describe("Optional note or description for this key"),
4423
- workspace_id: z11.string().optional().describe("Workspace ID to create the key in"),
4424
- api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
4425
- resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
4426
- deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
4427
- deployment_configurations: z11.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(
4428
4903
  "Azure deployment configurations with API versions and aliases"
4429
4904
  ),
4430
- expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
4431
- secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
4432
- credit_limit: z11.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
4433
- alert_threshold: z11.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(
4434
4909
  "Percentage of credit_limit at which to send alert emails (0-100)"
4435
4910
  ),
4436
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("Requests per minute limit")
4911
+ rate_limit_rpm: z16.coerce.number().positive().optional().describe("Requests per minute limit")
4437
4912
  },
4438
4913
  getVirtualKey: {
4439
- slug: z11.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")
4440
4915
  },
4441
4916
  updateVirtualKey: {
4442
- slug: z11.string().describe("The slug of the virtual key to update"),
4443
- name: z11.string().optional().describe("New display name for the key"),
4444
- key: z11.string().optional().describe("New provider API key value"),
4445
- note: z11.string().optional().describe("New note or description"),
4446
- credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
4447
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4448
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4449
- deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
4450
- secret_mappings: z11.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")
4451
4926
  },
4452
4927
  deleteVirtualKey: {
4453
- slug: z11.string().describe("The slug of the virtual key to delete")
4928
+ slug: z16.string().describe("The slug of the virtual key to delete")
4454
4929
  },
4455
4930
  createApiKey: {
4456
- type: z11.enum(["organisation", "workspace"]).describe(
4931
+ type: z16.enum(["organisation", "workspace"]).describe(
4457
4932
  "Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
4458
4933
  ),
4459
- sub_type: z11.enum(["user", "service"]).describe(
4934
+ sub_type: z16.enum(["user", "service"]).describe(
4460
4935
  "Sub-type: 'user' for user-associated keys or 'service' for service accounts"
4461
4936
  ),
4462
- name: z11.string().describe("Display name for the API key"),
4463
- description: z11.string().optional().describe("Optional description for the key"),
4464
- organisation_id: z11.string().optional().describe("Organisation UUID"),
4465
- workspace_id: z11.string().optional().describe("Workspace ID (required for workspace-type keys)"),
4466
- user_id: z11.string().optional().describe("User ID (required for user sub-type keys)"),
4467
- scopes: z11.array(z11.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(
4468
4943
  "Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
4469
4944
  ),
4470
- credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for usage"),
4471
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
4472
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
4473
- rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
4474
- default_config_id: z11.string().optional().describe("Default configuration ID to use with this key"),
4475
- default_metadata: z11.record(z11.string(), z11.string()).optional().describe("Default metadata key-value pairs"),
4476
- default_allow_config_override: z11.boolean().optional().describe("Allow callers to override the default config"),
4477
- alert_emails: z11.array(z11.string()).optional().describe("Email addresses for alerts"),
4478
- expires_at: z11.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"),
4479
4954
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
4480
4955
  },
4481
4956
  listApiKeys: {
4482
4957
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
4483
4958
  current_page: CurrentPageSchema,
4484
- workspace_id: z11.string().optional().describe("Filter by workspace ID")
4959
+ workspace_id: z16.string().optional().describe("Filter by workspace ID")
4485
4960
  },
4486
4961
  getApiKey: {
4487
- id: z11.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")
4488
4963
  },
4489
4964
  updateApiKey: {
4490
- id: z11.string().uuid().describe("The UUID of the API key to update"),
4491
- name: z11.string().optional().describe("New display name for the key"),
4492
- description: z11.string().optional().describe("New description for the key"),
4493
- scopes: z11.array(z11.string()).optional().describe("New permission scopes for the key"),
4494
- credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
4495
- alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
4496
- rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
4497
- rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
4498
- reset_usage: z11.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
4499
- default_config_id: z11.string().optional().describe("New default configuration ID"),
4500
- default_metadata: z11.record(z11.string(), z11.string()).optional().describe("New default metadata key-value pairs"),
4501
- default_allow_config_override: z11.boolean().optional().describe("Whether callers may override the key's default config"),
4502
- alert_emails: z11.array(z11.string()).optional().describe("New email addresses for alerts"),
4503
- expires_at: z11.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(
4504
4979
  "New expiration date in ISO 8601 format, or null to remove expiration"
4505
4980
  ),
4506
4981
  rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
4507
4982
  },
4508
4983
  rotateApiKey: {
4509
- id: z11.string().uuid().describe("API key UUID obtained from list_api_keys"),
4510
- key_transition_period_ms: z11.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(
4511
4986
  "Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
4512
4987
  )
4513
4988
  },
4514
4989
  deleteApiKey: {
4515
- id: z11.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")
4516
4991
  }
4517
4992
  };
4518
- var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
4993
+ var createVirtualKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
4519
4994
  if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
4520
4995
  context.addIssue({
4521
4996
  code: "custom",
@@ -4524,17 +4999,17 @@ var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
4524
4999
  });
4525
5000
  }
4526
5001
  });
4527
- var createApiKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
5002
+ var createApiKeySchema = z16.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
4528
5003
  if (value.type === "workspace" && !value.workspace_id) {
4529
5004
  ctx.addIssue({
4530
- code: z11.ZodIssueCode.custom,
5005
+ code: z16.ZodIssueCode.custom,
4531
5006
  path: ["workspace_id"],
4532
5007
  message: "workspace_id is required when type is 'workspace'"
4533
5008
  });
4534
5009
  }
4535
5010
  if (value.sub_type === "user" && !value.user_id) {
4536
5011
  ctx.addIssue({
4537
- code: z11.ZodIssueCode.custom,
5012
+ code: z16.ZodIssueCode.custom,
4538
5013
  path: ["user_id"],
4539
5014
  message: "user_id is required when sub_type is 'user'"
4540
5015
  });
@@ -4857,43 +5332,43 @@ function registerKeysTools(server, service) {
4857
5332
  }
4858
5333
 
4859
5334
  // src/tools/labels.tools.ts
4860
- import { z as z12 } from "zod";
5335
+ import { z as z17 } from "zod";
4861
5336
  var LABELS_TOOL_SCHEMAS = {
4862
5337
  createPromptLabel: {
4863
- name: z12.string().describe("Name of the label"),
4864
- organisation_id: z12.string().optional().describe("Organisation ID to create the label in"),
4865
- workspace_id: z12.string().optional().describe("Workspace ID to create the label in"),
4866
- description: z12.string().optional().describe("Description of the label"),
4867
- color_code: z12.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(
4868
5343
  "Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
4869
5344
  )
4870
5345
  },
4871
5346
  listPromptLabels: {
4872
- organisation_id: z12.string().optional().describe("Filter by organisation ID"),
4873
- workspace_id: z12.string().optional().describe("Filter by workspace ID"),
4874
- search: z12.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"),
4875
5350
  current_page: CurrentPageSchema,
4876
5351
  page_size: PageSizeSchema
4877
5352
  },
4878
5353
  getPromptLabel: {
4879
- label_id: z12.string().describe("Label ID to retrieve"),
4880
- organisation_id: z12.string().optional().describe("Organisation ID for filtering"),
4881
- workspace_id: z12.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")
4882
5357
  },
4883
5358
  updatePromptLabel: {
4884
- label_id: z12.string().describe("Label ID to update"),
4885
- name: z12.string().optional().describe("New name for the label"),
4886
- description: z12.string().optional().describe("New description"),
4887
- color_code: z12.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')")
4888
5363
  },
4889
5364
  deletePromptLabel: {
4890
- label_id: z12.string().describe("Label ID to delete")
5365
+ label_id: z17.string().describe("Label ID to delete")
4891
5366
  }
4892
5367
  };
4893
- var createPromptLabelSchema = z12.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
5368
+ var createPromptLabelSchema = z17.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
4894
5369
  if (!value.organisation_id && !value.workspace_id) {
4895
5370
  ctx.addIssue({
4896
- code: z12.ZodIssueCode.custom,
5371
+ code: z17.ZodIssueCode.custom,
4897
5372
  message: "Either organisation_id or workspace_id is required"
4898
5373
  });
4899
5374
  }
@@ -4990,13 +5465,13 @@ function registerLabelsTools(server, service) {
4990
5465
  }
4991
5466
 
4992
5467
  // src/tools/limits.tools.ts
4993
- import { z as z13 } from "zod";
4994
- var statusSchema = z13.enum(["active", "archived"]);
4995
- var rateUnitSchema = z13.enum(["rpm", "rph", "rpd", "rpw"]);
4996
- var rateTargetSchema = z13.enum(["llm", "mcp_tools"]);
4997
- var conditionValueSchema = z13.union([z13.string(), z13.array(z13.string()).min(1)]);
4998
- var conditionSchema = z13.object({
4999
- key: z13.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(
5000
5475
  "Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
5001
5476
  ),
5002
5477
  value: conditionValueSchema.describe(
@@ -5004,8 +5479,8 @@ var conditionSchema = z13.object({
5004
5479
  ),
5005
5480
  excludes: conditionValueSchema.optional().describe("Values to exclude")
5006
5481
  });
5007
- var groupBySchema = z13.object({
5008
- key: z13.string().min(1).describe(
5482
+ var groupBySchema = z18.object({
5483
+ key: z18.string().min(1).describe(
5009
5484
  "Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
5010
5485
  )
5011
5486
  });
@@ -5015,88 +5490,88 @@ var paginationSchema = {
5015
5490
  };
5016
5491
  var LIMITS_TOOL_SCHEMAS = {
5017
5492
  listRateLimits: {
5018
- workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
5493
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5019
5494
  status: statusSchema.optional().describe("Filter by active or archived status"),
5020
- type: z13.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5495
+ type: z18.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
5021
5496
  unit: rateUnitSchema.optional().describe("Filter by reset interval"),
5022
5497
  target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
5023
5498
  ...paginationSchema
5024
5499
  },
5025
5500
  getRateLimit: {
5026
- id: z13.string().min(1).describe("Rate-limit policy UUID"),
5501
+ id: z18.string().min(1).describe("Rate-limit policy UUID"),
5027
5502
  status: statusSchema.optional().describe("Include an archived policy by status")
5028
5503
  },
5029
5504
  createRateLimit: {
5030
- conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
5031
- group_by: z13.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
5032
- type: z13.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"),
5033
5508
  unit: rateUnitSchema.describe("Counter reset interval"),
5034
- value: z13.coerce.number().nonnegative().describe("Maximum requests or tokens"),
5035
- name: z13.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"),
5036
5511
  target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
5037
- workspace_id: z13.string().optional().describe("Workspace UUID scope"),
5038
- organisation_id: z13.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")
5039
5514
  },
5040
5515
  updateRateLimit: {
5041
- id: z13.string().min(1).describe("Rate-limit policy UUID"),
5042
- name: z13.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"),
5043
5518
  unit: rateUnitSchema.optional().describe("Replacement reset interval"),
5044
- value: z13.coerce.number().nonnegative().optional().describe("Replacement maximum"),
5045
- conditions: z13.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")
5046
5521
  },
5047
5522
  deleteRateLimit: {
5048
- id: z13.string().min(1).describe("Rate-limit policy UUID to delete")
5523
+ id: z18.string().min(1).describe("Rate-limit policy UUID to delete")
5049
5524
  },
5050
5525
  listUsageLimits: {
5051
- workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
5526
+ workspace_id: z18.string().optional().describe("Filter by workspace UUID"),
5052
5527
  status: statusSchema.optional().describe("Filter by active or archived status"),
5053
- type: z13.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5528
+ type: z18.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
5054
5529
  ...paginationSchema
5055
5530
  },
5056
5531
  getUsageLimit: {
5057
- id: z13.string().min(1).describe("Usage-limit policy UUID"),
5532
+ id: z18.string().min(1).describe("Usage-limit policy UUID"),
5058
5533
  status: statusSchema.optional().describe("Include an archived policy by status"),
5059
- include_usage: z13.boolean().optional().describe("Include per-value usage counters")
5534
+ include_usage: z18.boolean().optional().describe("Include per-value usage counters")
5060
5535
  },
5061
5536
  createUsageLimit: {
5062
- conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
5063
- group_by: z13.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
5064
- type: z13.enum(["cost", "tokens"]).describe("Budget type"),
5065
- credit_limit: z13.coerce.number().nonnegative().describe("Maximum cumulative usage"),
5066
- name: z13.string().optional().describe("Optional policy display name"),
5067
- alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
5068
- periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
5069
- workspace_id: z13.string().optional().describe("Workspace UUID scope"),
5070
- organisation_id: z13.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")
5071
5546
  },
5072
5547
  updateUsageLimit: {
5073
- id: z13.string().min(1).describe("Usage-limit policy UUID"),
5074
- name: z13.string().max(255).optional().describe("Replacement display name"),
5075
- description: z13.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
5076
- conditions: z13.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
5077
- credit_limit: z13.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
5078
- alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
5079
- periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
5080
- periodic_reset_days: z13.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
5081
- next_usage_reset_at: z13.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
5082
- reset_usage_for_value: z13.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")
5083
5558
  },
5084
5559
  deleteUsageLimit: {
5085
- id: z13.string().min(1).describe("Usage-limit policy UUID to archive")
5560
+ id: z18.string().min(1).describe("Usage-limit policy UUID to archive")
5086
5561
  },
5087
5562
  listUsageLimitEntities: {
5088
- limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
5089
- status: z13.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
5090
- search: z13.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"),
5091
5566
  page_size: PageSizeSchema.describe("Number of entities per page"),
5092
5567
  current_page: CurrentPageSchema.describe("Zero-based page number")
5093
5568
  },
5094
5569
  resetUsageLimitEntity: {
5095
- limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
5096
- entity_id: z13.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")
5097
5572
  }
5098
5573
  };
5099
- var updateUsageLimitSchema = z13.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5574
+ var updateUsageLimitSchema = z18.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
5100
5575
  if (value.periodic_reset != null && value.periodic_reset_days != null) {
5101
5576
  context.addIssue({
5102
5577
  code: "custom",
@@ -5236,8 +5711,8 @@ function registerLimitsTools(server, service) {
5236
5711
  }
5237
5712
 
5238
5713
  // src/tools/logging.tools.ts
5239
- import { z as z14 } from "zod";
5240
- var logExportFieldSchema = z14.enum([
5714
+ import { z as z19 } from "zod";
5715
+ var logExportFieldSchema = z19.enum([
5241
5716
  "id",
5242
5717
  "trace_id",
5243
5718
  "created_at",
@@ -5260,12 +5735,12 @@ var logExportFieldSchema = z14.enum([
5260
5735
  "metadata"
5261
5736
  ]);
5262
5737
  var getLogShape = {
5263
- log_id: z14.string().describe("Gateway log ID to retrieve"),
5264
- path_format: z14.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
5265
- created_at: z14.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
5266
- type: z14.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")
5267
5742
  };
5268
- var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
5743
+ var getLogSchema = z19.object(getLogShape).superRefine((input, context) => {
5269
5744
  if (input.path_format === "v2" && input.created_at === void 0) {
5270
5745
  context.addIssue({
5271
5746
  code: "custom",
@@ -5276,67 +5751,67 @@ var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
5276
5751
  });
5277
5752
  var LOGGING_TOOL_SCHEMAS = {
5278
5753
  getLogExportFieldRestrictions: {
5279
- workspace_id: z14.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")
5280
5755
  },
5281
5756
  insertLog: {
5282
- request_url: z14.string().optional().describe("The endpoint URL being called"),
5283
- request_provider: z14.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
5284
- request_method: z14.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
5285
- request_headers: z14.record(z14.string(), z14.string()).optional().describe("Request headers as key-value pairs"),
5286
- request_body: z14.record(z14.string(), z14.unknown()).optional().describe("Request payload/body"),
5287
- response_status: z14.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
5288
- response_headers: z14.record(z14.string(), z14.string()).optional().describe("Response headers as key-value pairs"),
5289
- response_body: z14.record(z14.string(), z14.unknown()).optional().describe("Response payload/body"),
5290
- response_time: z14.coerce.number().optional().describe("Response latency in milliseconds"),
5291
- streaming_mode: z14.boolean().optional().default(false).describe("Whether the response was streamed"),
5292
- metadata_organization: z14.string().optional().describe("Organization identifier for the log"),
5293
- metadata_user: z14.string().optional().describe("User identifier for the log"),
5294
- metadata_trace_id: z14.string().optional().describe("Trace ID for distributed tracing"),
5295
- metadata_span_id: z14.string().optional().describe("Span ID for tracing"),
5296
- metadata_span_name: z14.string().optional().describe("Span name for tracing"),
5297
- metadata_parent_span_id: z14.string().optional().describe("Parent span ID for tracing"),
5298
- metadata_custom: z14.record(z14.string(), z14.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")
5299
5774
  },
5300
5775
  createLogExport: {
5301
- workspace_id: z14.string().optional().describe("Workspace ID for the export"),
5302
- description: z14.string().optional().describe("Human-readable description for the export job"),
5303
- time_min: z14.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(
5304
5779
  "Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
5305
5780
  ),
5306
- time_max: z14.string().describe(
5781
+ time_max: z19.string().describe(
5307
5782
  "Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
5308
5783
  ),
5309
- cost_min: z14.coerce.number().optional().describe("Minimum cost filter"),
5310
- cost_max: z14.coerce.number().optional().describe("Maximum cost filter"),
5311
- total_units_min: z14.coerce.number().optional().describe("Minimum total units (tokens) filter"),
5312
- total_units_max: z14.coerce.number().optional().describe("Maximum total units (tokens) filter"),
5313
- ai_model: z14.array(z14.string()).optional().describe("Filter by specific AI model names"),
5314
- requested_fields: z14.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(
5315
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"
5316
5791
  )
5317
5792
  },
5318
5793
  listLogExports: {
5319
- workspace_id: z14.string().describe("Workspace ID to list exports for (required)")
5794
+ workspace_id: z19.string().describe("Workspace ID to list exports for (required)")
5320
5795
  },
5321
5796
  getLogExport: {
5322
- export_id: z14.string().describe("The unique ID of the log export")
5797
+ export_id: z19.string().describe("The unique ID of the log export")
5323
5798
  },
5324
5799
  startLogExport: {
5325
- export_id: z14.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")
5326
5801
  },
5327
5802
  cancelLogExport: {
5328
- export_id: z14.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")
5329
5804
  },
5330
5805
  downloadLogExport: {
5331
- export_id: z14.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")
5332
5807
  },
5333
5808
  updateLogExport: {
5334
- export_id: z14.string().describe("The unique ID of the log export to update"),
5335
- workspace_id: z14.string().optional().describe("Workspace ID for the export"),
5336
- time_of_generation_max: z14.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(
5337
5812
  "Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
5338
5813
  ),
5339
- requested_fields: z14.array(logExportFieldSchema).optional().describe(
5814
+ requested_fields: z19.array(logExportFieldSchema).optional().describe(
5340
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"
5341
5816
  )
5342
5817
  }
@@ -5562,7 +6037,7 @@ function registerLoggingTools(server, service) {
5562
6037
  }
5563
6038
 
5564
6039
  // src/tools/mcp-integrations.tools.ts
5565
- import { z as z15 } from "zod";
6040
+ import { z as z20 } from "zod";
5566
6041
  var mcpSecretMappingSchema = createSecretMappingSchema({
5567
6042
  allowKeyTarget: false,
5568
6043
  targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
@@ -5572,10 +6047,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
5572
6047
  var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
5573
6048
  mcpSecretMappingSchema
5574
6049
  );
5575
- var mcpConfigurationsSchema = z15.record(z15.string(), z15.unknown()).superRefine((value, ctx) => {
6050
+ var mcpConfigurationsSchema = z20.record(z20.string(), z20.unknown()).superRefine((value, ctx) => {
5576
6051
  if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
5577
6052
  ctx.addIssue({
5578
- code: z15.ZodIssueCode.custom,
6053
+ code: z20.ZodIssueCode.custom,
5579
6054
  path: ["custom_headers"],
5580
6055
  message: "configurations.custom_headers must be a string-to-string record"
5581
6056
  });
@@ -5587,31 +6062,31 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5587
6062
  page_size: pageSizeSchema(1e3).describe(
5588
6063
  "Number of results per page (max 1000)"
5589
6064
  ),
5590
- workspace_id: z15.string().optional().describe("Filter by workspace ID"),
5591
- organisation_id: z15.string().optional().describe("Filter by organisation UUID"),
5592
- type: z15.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(
5593
6068
  "Filter by workspace, organisation, or all integration ownership"
5594
6069
  ),
5595
- search: z15.string().optional().describe("Search integrations by name")
6070
+ search: z20.string().optional().describe("Search integrations by name")
5596
6071
  },
5597
6072
  createMcpIntegration: {
5598
- name: z15.string().describe("Display name for the MCP integration"),
5599
- url: z15.string().describe("URL endpoint of the MCP server to integrate"),
5600
- auth_type: z15.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(
5601
6076
  "Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5602
6077
  ),
5603
- transport: z15.enum(["http", "sse"]).describe(
6078
+ transport: z20.enum(["http", "sse"]).describe(
5604
6079
  "MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
5605
6080
  ),
5606
- slug: z15.string().optional().describe("Custom slug. Auto-generated if omitted"),
5607
- description: z15.string().optional().describe("Description of the MCP integration"),
5608
- custom_headers: z15.record(z15.string(), z15.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(
5609
6084
  'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
5610
6085
  ),
5611
6086
  configurations: mcpConfigurationsSchema.optional().describe(
5612
6087
  "Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
5613
6088
  ),
5614
- workspace_id: z15.string().optional().describe(
6089
+ workspace_id: z20.string().optional().describe(
5615
6090
  "Workspace ID \u2014 required when using organization admin API keys"
5616
6091
  ),
5617
6092
  secret_mappings: mcpSecretMappingsSchema.optional().describe(
@@ -5619,18 +6094,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5619
6094
  )
5620
6095
  },
5621
6096
  getMcpIntegration: {
5622
- id: z15.string().describe("The MCP integration ID or slug to retrieve")
6097
+ id: z20.string().describe("The MCP integration ID or slug to retrieve")
5623
6098
  },
5624
6099
  updateMcpIntegration: {
5625
- id: z15.string().describe("The MCP integration ID or slug to update"),
5626
- name: z15.string().optional().describe("New display name"),
5627
- description: z15.string().optional().describe("New description"),
5628
- url: z15.string().optional().describe("New URL endpoint"),
5629
- auth_type: z15.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(
5630
6105
  "New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
5631
6106
  ),
5632
- transport: z15.enum(["http", "sse"]).optional().describe("New transport protocol"),
5633
- custom_headers: z15.record(z15.string(), z15.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(
5634
6109
  "New custom headers for authentication. Sent via configurations.custom_headers"
5635
6110
  ),
5636
6111
  configurations: mcpConfigurationsSchema.optional().describe(
@@ -5641,50 +6116,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
5641
6116
  )
5642
6117
  },
5643
6118
  deleteMcpIntegration: {
5644
- id: z15.string().describe("The MCP integration ID or slug to delete")
6119
+ id: z20.string().describe("The MCP integration ID or slug to delete")
5645
6120
  },
5646
6121
  getMcpIntegrationMetadata: {
5647
- id: z15.string().describe("The MCP integration ID or slug")
6122
+ id: z20.string().describe("The MCP integration ID or slug")
5648
6123
  },
5649
6124
  listMcpIntegrationCapabilities: {
5650
- id: z15.string().describe("The MCP integration ID or slug")
6125
+ id: z20.string().describe("The MCP integration ID or slug")
5651
6126
  },
5652
6127
  updateMcpIntegrationCapabilities: {
5653
- id: z15.string().describe("The MCP integration ID or slug"),
5654
- capabilities: z15.array(
5655
- z15.object({
5656
- name: z15.string().describe("Capability name"),
5657
- type: z15.enum(["tool", "prompt", "resource"]).describe("Capability type"),
5658
- enabled: z15.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")
5659
6134
  })
5660
6135
  ).min(1).describe("Array of capability updates")
5661
6136
  },
5662
6137
  listMcpIntegrationWorkspaces: {
5663
- id: z15.string().describe("The MCP integration ID or slug")
6138
+ id: z20.string().describe("The MCP integration ID or slug")
5664
6139
  },
5665
6140
  updateMcpIntegrationWorkspaces: {
5666
- id: z15.string().describe("The MCP integration ID or slug"),
5667
- workspaces: z15.array(
5668
- z15.object({
5669
- id: z15.string().describe("Workspace ID"),
5670
- enabled: z15.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")
5671
6146
  })
5672
6147
  ).min(1).describe("Array of workspace access updates")
5673
6148
  }
5674
6149
  };
5675
- var createMcpIntegrationSchema = z15.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
6150
+ var createMcpIntegrationSchema = z20.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
5676
6151
  const configuredHeaders = value.configurations?.custom_headers;
5677
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(
5678
6153
  (mapping) => mapping.target_field === "configurations.custom_headers"
5679
6154
  )) {
5680
6155
  ctx.addIssue({
5681
- code: z15.ZodIssueCode.custom,
6156
+ code: z20.ZodIssueCode.custom,
5682
6157
  path: [],
5683
6158
  message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
5684
6159
  });
5685
6160
  }
5686
6161
  });
5687
- var updateMcpIntegrationSchema = z15.object(
6162
+ var updateMcpIntegrationSchema = z20.object(
5688
6163
  MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
5689
6164
  );
5690
6165
  function isRecord2(value) {
@@ -5925,68 +6400,68 @@ function registerMcpIntegrationsTools(server, service) {
5925
6400
  }
5926
6401
 
5927
6402
  // src/tools/mcp-servers.tools.ts
5928
- import { z as z16 } from "zod";
6403
+ import { z as z21 } from "zod";
5929
6404
  var MCP_SERVERS_TOOL_SCHEMAS = {
5930
6405
  listMcpServers: {
5931
6406
  current_page: CurrentPageSchema,
5932
6407
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
5933
- workspace_id: z16.string().optional().describe("Filter by workspace ID")
6408
+ workspace_id: z21.string().optional().describe("Filter by workspace ID")
5934
6409
  },
5935
6410
  createMcpServer: {
5936
- name: z16.string().describe("Display name for the MCP server"),
5937
- mcp_integration_id: z16.string().describe("ID or slug of the MCP integration this server belongs to"),
5938
- slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
5939
- description: z16.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")
5940
6415
  },
5941
6416
  getMcpServer: {
5942
- id: z16.string().describe("The MCP server ID or slug to retrieve")
6417
+ id: z21.string().describe("The MCP server ID or slug to retrieve")
5943
6418
  },
5944
6419
  updateMcpServer: {
5945
- id: z16.string().describe("The MCP server ID or slug to update"),
5946
- name: z16.string().optional().describe("New display name"),
5947
- description: z16.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")
5948
6423
  },
5949
6424
  deleteMcpServer: {
5950
- id: z16.string().describe("The MCP server ID or slug to delete")
6425
+ id: z21.string().describe("The MCP server ID or slug to delete")
5951
6426
  },
5952
6427
  testMcpServer: {
5953
- id: z16.string().describe("The MCP server ID or slug to test")
6428
+ id: z21.string().describe("The MCP server ID or slug to test")
5954
6429
  },
5955
6430
  listMcpServerCapabilities: {
5956
- id: z16.string().describe("The MCP server ID or slug"),
6431
+ id: z21.string().describe("The MCP server ID or slug"),
5957
6432
  current_page: CurrentPageSchema,
5958
6433
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
5959
6434
  },
5960
6435
  updateMcpServerCapabilities: {
5961
- id: z16.string().describe("The MCP server ID or slug"),
5962
- capabilities: z16.array(
5963
- z16.object({
5964
- name: z16.string().describe("Capability name"),
5965
- type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
5966
- enabled: z16.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")
5967
6442
  })
5968
6443
  ).min(1).describe("Array of capability updates")
5969
6444
  },
5970
6445
  listMcpServerUserAccess: {
5971
- id: z16.string().describe("The MCP server ID or slug"),
6446
+ id: z21.string().describe("The MCP server ID or slug"),
5972
6447
  current_page: CurrentPageSchema,
5973
6448
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
5974
6449
  },
5975
6450
  updateMcpServerUserAccess: {
5976
- id: z16.string().describe("The MCP server ID or slug"),
5977
- users: z16.array(
5978
- z16.object({
5979
- user_id: z16.string().describe("User ID"),
5980
- enabled: z16.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")
5981
6456
  })
5982
6457
  ).min(1).describe("Array of user access updates")
5983
6458
  },
5984
6459
  listMcpServerConnections: {
5985
- id: z16.string().describe("MCP server ID or slug whose connections to list"),
5986
- user_id: z16.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(
5987
6462
  "User UUID to filter; user-scoped keys default to their own user when omitted"
5988
6463
  ),
5989
- workspace_id: z16.string().optional().describe(
6464
+ workspace_id: z21.string().optional().describe(
5990
6465
  "Workspace ID or slug; required with an organisation admin API key"
5991
6466
  ),
5992
6467
  current_page: CurrentPageSchema.describe(
@@ -5997,11 +6472,11 @@ var MCP_SERVERS_TOOL_SCHEMAS = {
5997
6472
  )
5998
6473
  },
5999
6474
  disconnectMcpServerConnection: {
6000
- id: z16.string().describe("MCP server ID or slug containing the active connection"),
6001
- user_id: z16.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(
6002
6477
  "User UUID to disconnect; required with service keys and derived from user keys when omitted"
6003
6478
  ),
6004
- workspace_id: z16.string().optional().describe(
6479
+ workspace_id: z21.string().optional().describe(
6005
6480
  "Workspace ID or slug; required with an organisation admin API key"
6006
6481
  )
6007
6482
  }
@@ -6228,40 +6703,40 @@ function registerMcpServersTools(server, service) {
6228
6703
  }
6229
6704
 
6230
6705
  // src/tools/partials.tools.ts
6231
- import { z as z17 } from "zod";
6706
+ import { z as z22 } from "zod";
6232
6707
  var PARTIALS_TOOL_SCHEMAS = {
6233
6708
  createPromptPartial: {
6234
- name: z17.string().describe("Display name for the partial"),
6235
- string: z17.string().describe("The partial content/template string"),
6236
- workspace_id: z17.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(
6237
6712
  "Workspace ID to create partial in (required for org-level API keys)"
6238
6713
  ),
6239
- version_description: z17.string().optional().describe("Description for this version")
6714
+ version_description: z22.string().optional().describe("Description for this version")
6240
6715
  },
6241
6716
  listPromptPartials: {
6242
- collection_id: z17.string().optional().describe(
6717
+ collection_id: z22.string().optional().describe(
6243
6718
  "Filter by collection ID. Optional \u2014 omit to list all partials across collections"
6244
6719
  )
6245
6720
  },
6246
6721
  getPromptPartial: {
6247
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to retrieve")
6722
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to retrieve")
6248
6723
  },
6249
6724
  updatePromptPartial: {
6250
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to update"),
6251
- name: z17.string().optional().describe("New display name for the partial"),
6252
- string: z17.string().optional().describe("New content for the partial"),
6253
- description: z17.string().optional().describe("Description for this version"),
6254
- status: z17.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")
6255
6730
  },
6256
6731
  deletePromptPartial: {
6257
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug to delete")
6732
+ prompt_partial_id: z22.string().describe("Prompt partial ID or slug to delete")
6258
6733
  },
6259
6734
  listPartialVersions: {
6260
- prompt_partial_id: z17.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")
6261
6736
  },
6262
6737
  publishPartial: {
6263
- prompt_partial_id: z17.string().describe("Prompt partial ID or slug"),
6264
- version: z17.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")
6265
6740
  }
6266
6741
  };
6267
6742
  function registerPartialsTools(server, service) {
@@ -6398,101 +6873,101 @@ function registerPartialsTools(server, service) {
6398
6873
  }
6399
6874
 
6400
6875
  // src/tools/prompts.tools.ts
6401
- import { z as z18 } from "zod";
6402
- var PROMPT_VARIABLES_SCHEMA = z18.record(z18.string(), z18.union([z18.string(), z18.number(), z18.boolean()])).describe("Variable values to substitute into the template");
6403
- var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z18.object({
6404
- type: z18.string().describe("Content block type"),
6405
- text: z18.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")
6406
6881
  }).passthrough().describe("Content block within a structured chat message");
6407
- var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z18.object({
6408
- role: z18.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
6409
- content: z18.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")
6410
6885
  }).passthrough().describe("Structured chat message in a prompt template");
6411
6886
  var PROMPTS_TOOL_SCHEMAS = {
6412
6887
  createPrompt: {
6413
- name: z18.string().describe("Display name for the prompt"),
6414
- collection_id: z18.string().describe(
6888
+ name: z23.string().describe("Display name for the prompt"),
6889
+ collection_id: z23.string().describe(
6415
6890
  "Collection ID to organize the prompt in (use list_collections to find)"
6416
6891
  ),
6417
- string: z18.string().optional().describe(
6892
+ string: z23.string().optional().describe(
6418
6893
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6419
6894
  ),
6420
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6895
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6421
6896
  "Structured chat template alias. Serialized to the legacy string format before creation."
6422
6897
  ),
6423
- parameters: z18.record(z18.string(), z18.unknown()).describe("Default values for template variables"),
6424
- virtual_key: z18.string().describe("Virtual key slug for model access"),
6425
- model: z18.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(
6426
6901
  "Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
6427
6902
  ),
6428
- ai_model_id: z18.string().optional().describe(
6903
+ ai_model_id: z23.string().optional().describe(
6429
6904
  "AI model ID (alternative to model). Required unless model or finetune_id is provided"
6430
6905
  ),
6431
- finetune_id: z18.string().optional().describe(
6906
+ finetune_id: z23.string().optional().describe(
6432
6907
  "Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
6433
6908
  ),
6434
- version_description: z18.string().optional().describe("Description for this prompt version"),
6435
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
6436
- functions: z18.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
6437
- tools: z18.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"),
6438
6913
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6439
- is_raw_template: z18.boolean().optional().describe("Render the stored template as a raw structural template"),
6440
- dry_run: z18.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")
6441
6916
  },
6442
6917
  listPrompts: {
6443
- collection_id: z18.string().optional().describe(
6918
+ collection_id: z23.string().optional().describe(
6444
6919
  "Filter by collection ID (recommended for app-specific prompts)"
6445
6920
  ),
6446
- workspace_id: z18.string().optional().describe("Filter by workspace ID"),
6447
- search: z18.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"),
6448
6923
  current_page: CurrentPageSchema,
6449
6924
  page_size: PageSizeSchema
6450
6925
  },
6451
6926
  getPrompt: {
6452
- prompt_id: z18.string().describe("Prompt ID or slug to retrieve")
6927
+ prompt_id: z23.string().describe("Prompt ID or slug to retrieve")
6453
6928
  },
6454
6929
  updatePrompt: {
6455
- prompt_id: z18.string().describe("Prompt ID or slug to update"),
6456
- name: z18.string().optional().describe("New display name for the prompt"),
6457
- collection_id: z18.string().optional().describe("Move to a different collection"),
6458
- string: z18.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(
6459
6934
  "Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
6460
6935
  ),
6461
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6936
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6462
6937
  "Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
6463
6938
  ),
6464
- parameters: z18.record(z18.string(), z18.unknown()).optional().describe("New default values for template variables"),
6465
- model: z18.string().optional().describe("New model identifier"),
6466
- virtual_key: z18.string().optional().describe("New virtual key slug"),
6467
- version_description: z18.string().optional().describe("Description for this version"),
6468
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("New metadata"),
6469
- functions: z18.array(PromptFunctionSchema).optional().describe("New function definitions"),
6470
- tools: z18.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"),
6471
6946
  tool_choice: ToolChoiceSchema.optional().describe(
6472
6947
  "New tool choice strategy"
6473
6948
  ),
6474
- is_raw_template: z18.boolean().optional().describe("Enable or disable raw structural-template rendering"),
6475
- dry_run: z18.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")
6476
6951
  },
6477
6952
  deletePrompt: {
6478
- prompt_id: z18.string().describe("Prompt ID or slug to delete")
6953
+ prompt_id: z23.string().describe("Prompt ID or slug to delete")
6479
6954
  },
6480
6955
  publishPrompt: {
6481
- prompt_id: z18.string().describe("Prompt ID or slug to publish"),
6482
- version: z18.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")
6483
6958
  },
6484
6959
  listPromptVersions: {
6485
- prompt_id: z18.string().describe("Prompt ID or slug to list versions for")
6960
+ prompt_id: z23.string().describe("Prompt ID or slug to list versions for")
6486
6961
  },
6487
6962
  renderPrompt: {
6488
- prompt_id: z18.string().describe("Prompt ID or slug to render"),
6963
+ prompt_id: z23.string().describe("Prompt ID or slug to render"),
6489
6964
  variables: PROMPT_VARIABLES_SCHEMA,
6490
6965
  hyperparameters: HyperparametersSchema.optional().describe(
6491
6966
  "Override default hyperparameters"
6492
6967
  )
6493
6968
  },
6494
6969
  runPromptCompletion: {
6495
- prompt_id: z18.string().describe("Prompt ID or slug to execute"),
6970
+ prompt_id: z23.string().describe("Prompt ID or slug to execute"),
6496
6971
  variables: PROMPT_VARIABLES_SCHEMA,
6497
6972
  metadata: BillingMetadataSchema.describe(
6498
6973
  "Billing metadata - client_id, app, env are REQUIRED for cost attribution"
@@ -6502,77 +6977,77 @@ var PROMPTS_TOOL_SCHEMAS = {
6502
6977
  )
6503
6978
  },
6504
6979
  migratePrompt: {
6505
- name: z18.string().describe("Prompt name to create or find for update"),
6980
+ name: z23.string().describe("Prompt name to create or find for update"),
6506
6981
  app: PromptAppIdentifierSchema,
6507
6982
  env: PromptEnvironmentIdentifierSchema,
6508
- collection_id: z18.string().describe("Collection ID to search in and create under"),
6509
- string: z18.string().optional().describe(
6983
+ collection_id: z23.string().describe("Collection ID to search in and create under"),
6984
+ string: z23.string().optional().describe(
6510
6985
  "Legacy prompt template string with {{variable}} mustache syntax."
6511
6986
  ),
6512
- messages: z18.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6987
+ messages: z23.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
6513
6988
  "Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
6514
6989
  ),
6515
- parameters: z18.record(z18.string(), z18.unknown()).describe("Default values for template variables"),
6516
- virtual_key: z18.string().describe("Virtual key slug for model access"),
6517
- model: z18.string().optional().describe("Model identifier"),
6518
- version_description: z18.string().optional().describe("Description for this version"),
6519
- template_metadata: z18.record(z18.string(), z18.unknown()).optional().describe("Additional custom metadata"),
6520
- functions: z18.array(PromptFunctionSchema).optional().describe("Function definitions"),
6521
- tools: z18.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"),
6522
6997
  tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
6523
- is_raw_template: z18.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
6524
- dry_run: z18.boolean().optional().describe(
6998
+ is_raw_template: z23.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
6999
+ dry_run: z23.boolean().optional().describe(
6525
7000
  "When true, only check what action would be taken without making changes"
6526
7001
  )
6527
7002
  },
6528
7003
  promotePrompt: {
6529
- source_prompt_id: z18.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
6530
- target_collection_id: z18.string().describe("Target collection ID for the promoted prompt"),
6531
- target_name: z18.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(
6532
7007
  "Target prompt name (defaults to source name with env suffix replaced)"
6533
7008
  ),
6534
7009
  target_env: PromptEnvironmentIdentifierSchema,
6535
- virtual_key: z18.string().optional().describe(
7010
+ virtual_key: z23.string().optional().describe(
6536
7011
  "Virtual key ID to use (defaults to source prompt's virtual_key)"
6537
7012
  )
6538
7013
  },
6539
7014
  validateCompletionMetadata: {
6540
- client_id: z18.string().optional().describe("Client ID for billing attribution"),
7015
+ client_id: z23.string().optional().describe("Client ID for billing attribution"),
6541
7016
  app: PromptAppIdentifierSchema.optional(),
6542
7017
  env: PromptEnvironmentIdentifierSchema.optional(),
6543
- project_id: z18.string().optional().describe("Project ID for granular billing"),
6544
- feature: z18.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")
6545
7020
  },
6546
7021
  getPromptVersion: {
6547
- prompt_id: z18.string().describe("Prompt ID or slug"),
6548
- version_id: z18.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")
6549
7024
  },
6550
7025
  updatePromptVersion: {
6551
- prompt_id: z18.string().describe("Prompt ID or slug"),
6552
- version_id: z18.string().describe("Version UUID to update"),
6553
- label_id: z18.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(
6554
7029
  "Label ID to assign to this version, or null to remove the label"
6555
7030
  )
6556
7031
  }
6557
7032
  };
6558
- var createPromptSchema = z18.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
7033
+ var createPromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
6559
7034
  if (!value.model && !value.ai_model_id && !value.finetune_id) {
6560
7035
  ctx.addIssue({
6561
- code: z18.ZodIssueCode.custom,
7036
+ code: z23.ZodIssueCode.custom,
6562
7037
  message: "At least one of model, ai_model_id, or finetune_id must be provided"
6563
7038
  });
6564
7039
  }
6565
7040
  if (value.string === void 0 && value.messages === void 0) {
6566
7041
  ctx.addIssue({
6567
- code: z18.ZodIssueCode.custom,
7042
+ code: z23.ZodIssueCode.custom,
6568
7043
  message: "Provide either string or messages"
6569
7044
  });
6570
7045
  }
6571
7046
  });
6572
- var migratePromptSchema = z18.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
7047
+ var migratePromptSchema = z23.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
6573
7048
  if (value.string === void 0 && value.messages === void 0) {
6574
7049
  ctx.addIssue({
6575
- code: z18.ZodIssueCode.custom,
7050
+ code: z23.ZodIssueCode.custom,
6576
7051
  message: "Provide either string or messages"
6577
7052
  });
6578
7053
  }
@@ -7025,70 +7500,70 @@ function registerPromptsTools(server, service) {
7025
7500
  }
7026
7501
 
7027
7502
  // src/tools/providers.tools.ts
7028
- import { z as z19 } from "zod";
7503
+ import { z as z24 } from "zod";
7029
7504
  var PROVIDERS_TOOL_SCHEMAS = {
7030
7505
  listProviders: {
7031
7506
  current_page: CurrentPageSchema,
7032
7507
  page_size: PageSizeSchema.describe(
7033
7508
  "Number of results per page (max 100, default 50)"
7034
7509
  ),
7035
- workspace_id: z19.string().optional().describe(
7510
+ workspace_id: z24.string().optional().describe(
7036
7511
  "Workspace ID - required when using organization admin keys, optional with workspace API keys"
7037
7512
  )
7038
7513
  },
7039
7514
  createProvider: {
7040
- name: z19.string().describe("Display name for the provider"),
7041
- integration_id: z19.string().describe(
7515
+ name: z24.string().describe("Display name for the provider"),
7516
+ integration_id: z24.string().describe(
7042
7517
  "Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
7043
7518
  ),
7044
- workspace_id: z19.string().optional().describe(
7519
+ workspace_id: z24.string().optional().describe(
7045
7520
  "Workspace ID - required when using organization admin API keys"
7046
7521
  ),
7047
- slug: z19.string().optional().describe(
7522
+ slug: z24.string().optional().describe(
7048
7523
  "Custom slug for the provider. Auto-generated with random suffix if omitted"
7049
7524
  ),
7050
- note: z19.string().optional().describe("Optional note or description for the provider"),
7051
- credit_limit: z19.coerce.number().positive().optional().describe("Credit limit for usage"),
7052
- alert_threshold: z19.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
7053
- usage_limit_type: z19.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(
7054
7529
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7055
7530
  ),
7056
- periodic_reset: z19.enum(["monthly", "weekly"]).optional().describe(
7531
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7057
7532
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7058
7533
  ),
7059
- rate_limit_value: z19.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
7060
- rate_limit_unit: z19.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(
7061
7536
  "Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
7062
7537
  ),
7063
- expires_at: z19.string().optional().describe("Expiration date in ISO 8601 format")
7538
+ expires_at: z24.string().optional().describe("Expiration date in ISO 8601 format")
7064
7539
  },
7065
7540
  getProvider: {
7066
- slug: z19.string().describe("The unique slug identifier of the provider to retrieve"),
7067
- workspace_id: z19.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")
7068
7543
  },
7069
7544
  updateProvider: {
7070
- slug: z19.string().describe("The slug of the provider to update"),
7071
- workspace_id: z19.string().optional().describe("Workspace ID - required when using organization admin keys"),
7072
- name: z19.string().optional().describe("New display name for the provider"),
7073
- note: z19.string().optional().describe("New note or description for the provider"),
7074
- credit_limit: z19.coerce.number().positive().optional().describe("New credit limit for usage"),
7075
- alert_threshold: z19.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
7076
- usage_limit_type: z19.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(
7077
7552
  "Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
7078
7553
  ),
7079
- periodic_reset: z19.enum(["monthly", "weekly"]).optional().describe(
7554
+ periodic_reset: z24.enum(["monthly", "weekly"]).optional().describe(
7080
7555
  "Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
7081
7556
  ),
7082
- rate_limit_value: z19.coerce.number().positive().optional().describe("New rate limit value"),
7083
- rate_limit_unit: z19.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(
7084
7559
  "Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
7085
7560
  ),
7086
- expires_at: z19.string().optional().describe("New expiration date in ISO 8601 format"),
7087
- reset_usage: z19.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")
7088
7563
  },
7089
7564
  deleteProvider: {
7090
- slug: z19.string().describe("The slug of the provider to delete"),
7091
- workspace_id: z19.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")
7092
7567
  }
7093
7568
  };
7094
7569
  function registerProvidersTools(server, service) {
@@ -7235,73 +7710,73 @@ function registerProvidersTools(server, service) {
7235
7710
  }
7236
7711
 
7237
7712
  // src/tools/secret-references.tools.ts
7238
- import { z as z20 } from "zod";
7713
+ import { z as z25 } from "zod";
7239
7714
  var authFields = {
7240
- aws_auth_type: z20.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7715
+ aws_auth_type: z25.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
7241
7716
  "AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
7242
7717
  ),
7243
- aws_access_key_id: z20.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
7244
- aws_secret_access_key: z20.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(
7245
7720
  "AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
7246
7721
  ),
7247
- aws_region: z20.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
7248
- aws_role_arn: z20.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(
7249
7724
  "IAM role ARN to assume; required when aws_auth_type is assumedRole"
7250
7725
  ),
7251
- aws_external_id: z20.string().nullable().describe("Optional external ID required by the target IAM role"),
7252
- azure_auth_mode: z20.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(
7253
7728
  "Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
7254
7729
  ),
7255
- azure_entra_tenant_id: z20.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
7256
- azure_entra_client_id: z20.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(
7257
7732
  "Microsoft Entra application client ID; required for entra authentication"
7258
7733
  ),
7259
- azure_entra_client_secret: z20.string().min(1).describe(
7734
+ azure_entra_client_secret: z25.string().min(1).describe(
7260
7735
  "Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
7261
7736
  ),
7262
- azure_managed_client_id: z20.string().min(1).describe(
7737
+ azure_managed_client_id: z25.string().min(1).describe(
7263
7738
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7264
7739
  ),
7265
- azure_vault_url: z20.url().describe(
7740
+ azure_vault_url: z25.url().describe(
7266
7741
  "Azure Key Vault URL, for example https://example.vault.azure.net"
7267
7742
  ),
7268
- vault_auth_type: z20.enum(["token", "approle", "kubernetes"]).describe(
7743
+ vault_auth_type: z25.enum(["token", "approle", "kubernetes"]).describe(
7269
7744
  "HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
7270
7745
  ),
7271
- vault_addr: z20.url().describe("Base URL of the HashiCorp Vault server"),
7272
- vault_token: z20.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(
7273
7748
  "HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
7274
7749
  ),
7275
- vault_namespace: z20.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
7276
- vault_role_id: z20.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(
7277
7752
  "HashiCorp Vault AppRole role ID; required for approle authentication"
7278
7753
  ),
7279
- vault_secret_id: z20.string().min(1).describe(
7754
+ vault_secret_id: z25.string().min(1).describe(
7280
7755
  "HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
7281
7756
  ),
7282
- vault_role: z20.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7757
+ vault_role: z25.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
7283
7758
  };
7284
- var authConfigSchema = z20.union([
7285
- z20.object({
7286
- aws_auth_type: z20.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"),
7287
7762
  aws_access_key_id: authFields.aws_access_key_id,
7288
7763
  aws_secret_access_key: authFields.aws_secret_access_key,
7289
7764
  aws_region: authFields.aws_region
7290
7765
  }).strict(),
7291
- z20.object({
7292
- aws_auth_type: z20.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"),
7293
7768
  aws_role_arn: authFields.aws_role_arn,
7294
7769
  aws_external_id: authFields.aws_external_id.optional(),
7295
7770
  aws_region: authFields.aws_region
7296
7771
  }).strict(),
7297
- z20.object({
7298
- aws_auth_type: z20.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
7299
- aws_region: z20.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(
7300
7775
  "Optional AWS region containing the secret, for example us-east-1"
7301
7776
  )
7302
7777
  }).strict(),
7303
- z20.object({
7304
- azure_auth_mode: z20.literal("entra").describe(
7778
+ z25.object({
7779
+ azure_auth_mode: z25.literal("entra").describe(
7305
7780
  "Authenticate with a Microsoft Entra application client secret"
7306
7781
  ),
7307
7782
  azure_entra_tenant_id: authFields.azure_entra_tenant_id,
@@ -7309,30 +7784,30 @@ var authConfigSchema = z20.union([
7309
7784
  azure_entra_client_secret: authFields.azure_entra_client_secret,
7310
7785
  azure_vault_url: authFields.azure_vault_url
7311
7786
  }).strict(),
7312
- z20.object({
7313
- azure_auth_mode: z20.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"),
7314
7789
  azure_managed_client_id: authFields.azure_managed_client_id.optional(),
7315
7790
  azure_vault_url: authFields.azure_vault_url
7316
7791
  }).strict(),
7317
- z20.object({
7318
- azure_auth_mode: z20.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"),
7319
7794
  azure_vault_url: authFields.azure_vault_url
7320
7795
  }).strict(),
7321
- z20.object({
7322
- vault_auth_type: z20.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"),
7323
7798
  vault_addr: authFields.vault_addr,
7324
7799
  vault_token: authFields.vault_token,
7325
7800
  vault_namespace: authFields.vault_namespace.optional()
7326
7801
  }).strict(),
7327
- z20.object({
7328
- vault_auth_type: z20.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"),
7329
7804
  vault_addr: authFields.vault_addr,
7330
7805
  vault_role_id: authFields.vault_role_id,
7331
7806
  vault_secret_id: authFields.vault_secret_id,
7332
7807
  vault_namespace: authFields.vault_namespace.optional()
7333
7808
  }).strict(),
7334
- z20.object({
7335
- vault_auth_type: z20.literal("kubernetes").describe(
7809
+ z25.object({
7810
+ vault_auth_type: z25.literal("kubernetes").describe(
7336
7811
  "Authenticate to HashiCorp Vault with a Kubernetes service account"
7337
7812
  ),
7338
7813
  vault_addr: authFields.vault_addr,
@@ -7340,61 +7815,61 @@ var authConfigSchema = z20.union([
7340
7815
  vault_namespace: authFields.vault_namespace.optional()
7341
7816
  }).strict()
7342
7817
  ]);
7343
- var updateAuthConfigSchema = z20.union([
7344
- z20.object({
7818
+ var updateAuthConfigSchema = z25.union([
7819
+ z25.object({
7345
7820
  aws_auth_type: authFields.aws_auth_type.optional(),
7346
7821
  aws_access_key_id: authFields.aws_access_key_id.optional(),
7347
7822
  aws_secret_access_key: authFields.aws_secret_access_key.optional(),
7348
- aws_region: z20.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"),
7349
7824
  aws_role_arn: authFields.aws_role_arn.optional(),
7350
7825
  aws_external_id: authFields.aws_external_id.optional()
7351
7826
  }).strict(),
7352
- z20.object({
7827
+ z25.object({
7353
7828
  azure_auth_mode: authFields.azure_auth_mode.optional(),
7354
7829
  azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
7355
7830
  azure_entra_client_id: authFields.azure_entra_client_id.optional(),
7356
7831
  azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
7357
- azure_managed_client_id: z20.string().optional().describe(
7832
+ azure_managed_client_id: z25.string().optional().describe(
7358
7833
  "Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
7359
7834
  ),
7360
7835
  azure_vault_url: authFields.azure_vault_url.optional()
7361
7836
  }).strict(),
7362
- z20.object({
7837
+ z25.object({
7363
7838
  vault_auth_type: authFields.vault_auth_type.optional(),
7364
7839
  vault_addr: authFields.vault_addr.optional(),
7365
7840
  vault_token: authFields.vault_token.optional(),
7366
- vault_namespace: z20.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7841
+ vault_namespace: z25.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
7367
7842
  vault_role_id: authFields.vault_role_id.optional(),
7368
7843
  vault_secret_id: authFields.vault_secret_id.optional(),
7369
7844
  vault_role: authFields.vault_role.optional()
7370
7845
  }).strict()
7371
7846
  ]);
7372
- var managerTypeSchema = z20.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7847
+ var managerTypeSchema = z25.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
7373
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"
7374
7849
  );
7375
- var tagsSchema = z20.record(z20.string(), z20.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");
7376
7851
  var SECRET_REFERENCE_TOOL_SCHEMAS = {
7377
7852
  create: {
7378
- name: z20.string().min(1).max(255).describe("Human-readable name"),
7853
+ name: z25.string().min(1).max(255).describe("Human-readable name"),
7379
7854
  manager_type: managerTypeSchema,
7380
7855
  auth_config: authConfigSchema.describe(
7381
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."
7382
7857
  ),
7383
- secret_path: z20.string().max(1024).describe("Path of the secret in the external secret manager"),
7384
- organisation_id: z20.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(
7385
7860
  "Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
7386
7861
  ),
7387
- slug: z20.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7862
+ slug: z25.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
7388
7863
  "Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
7389
7864
  ),
7390
- description: z20.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
7391
- secret_key: z20.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(
7392
7867
  "Optional key within a structured external secret; null uses the whole secret value"
7393
7868
  ),
7394
- allow_all_workspaces: z20.boolean().optional().describe(
7869
+ allow_all_workspaces: z25.boolean().optional().describe(
7395
7870
  "Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
7396
7871
  ),
7397
- allowed_workspaces: z20.array(z20.string()).min(1).optional().describe(
7872
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7398
7873
  "Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
7399
7874
  ),
7400
7875
  tags: tagsSchema.nullable().optional().describe(
@@ -7406,7 +7881,7 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7406
7881
  "Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
7407
7882
  ),
7408
7883
  tags: tagsSchema.optional().describe("Return references matching these tags"),
7409
- search: z20.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"),
7410
7885
  current_page: CurrentPageSchema.describe(
7411
7886
  "Zero-based page number; defaults to 0"
7412
7887
  ),
@@ -7415,29 +7890,29 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
7415
7890
  )
7416
7891
  },
7417
7892
  get: {
7418
- id: z20.string().min(1).describe("Secret Reference UUID or slug")
7893
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7419
7894
  },
7420
7895
  update: {
7421
- id: z20.string().min(1).describe("Secret Reference UUID or slug"),
7422
- name: z20.string().min(1).max(255).optional().describe("New human-readable name"),
7423
- description: z20.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"),
7424
7899
  auth_config: updateAuthConfigSchema.optional().describe(
7425
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"
7426
7901
  ),
7427
- secret_path: z20.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
7428
- secret_key: z20.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(
7429
7904
  "New key within a structured secret, or null to use the whole value"
7430
7905
  ),
7431
- allow_all_workspaces: z20.boolean().optional().describe(
7906
+ allow_all_workspaces: z25.boolean().optional().describe(
7432
7907
  "Whether every workspace may use this reference; cannot be true with allowed_workspaces"
7433
7908
  ),
7434
- allowed_workspaces: z20.array(z20.string()).min(1).optional().describe(
7909
+ allowed_workspaces: z25.array(z25.string()).min(1).optional().describe(
7435
7910
  "Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
7436
7911
  ),
7437
7912
  tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
7438
7913
  },
7439
7914
  delete: {
7440
- id: z20.string().min(1).describe("Secret Reference UUID or slug")
7915
+ id: z25.string().min(1).describe("Secret Reference UUID or slug")
7441
7916
  }
7442
7917
  };
7443
7918
  function validateWorkspaceAccess(value) {
@@ -7601,29 +8076,29 @@ function registerSecretReferencesTools(server, service) {
7601
8076
  }
7602
8077
 
7603
8078
  // src/tools/tracing.tools.ts
7604
- import { z as z21 } from "zod";
8079
+ import { z as z26 } from "zod";
7605
8080
  var TRACING_TOOL_SCHEMAS = {
7606
8081
  createFeedback: {
7607
- trace_id: z21.string().describe(
8082
+ trace_id: z26.string().describe(
7608
8083
  "The trace ID to associate the feedback with. This links feedback to a specific request/generation."
7609
8084
  ),
7610
- value: z21.coerce.number().describe(
8085
+ value: z26.coerce.number().describe(
7611
8086
  "Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
7612
8087
  ),
7613
- weight: z21.coerce.number().positive().optional().describe(
8088
+ weight: z26.coerce.number().positive().optional().describe(
7614
8089
  "Optional weighting factor for the feedback. Use to give more importance to certain feedback."
7615
8090
  ),
7616
- metadata: z21.record(z21.string(), z21.unknown()).optional().describe(
8091
+ metadata: z26.record(z26.string(), z26.unknown()).optional().describe(
7617
8092
  "Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
7618
8093
  )
7619
8094
  },
7620
8095
  updateFeedback: {
7621
- id: z21.string().describe("The unique identifier of the feedback to update"),
7622
- value: z21.coerce.number().optional().describe(
8096
+ id: z26.string().describe("The unique identifier of the feedback to update"),
8097
+ value: z26.coerce.number().optional().describe(
7623
8098
  "New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
7624
8099
  ),
7625
- weight: z21.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
7626
- metadata: z21.record(z21.string(), z21.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")
7627
8102
  }
7628
8103
  };
7629
8104
  function registerTracingTools(server, service) {
@@ -7665,82 +8140,82 @@ function registerTracingTools(server, service) {
7665
8140
  }
7666
8141
 
7667
8142
  // src/tools/users.tools.ts
7668
- import { z as z22 } from "zod";
8143
+ import { z as z27 } from "zod";
7669
8144
  var USERS_TOOL_SCHEMAS = {
7670
8145
  listAllUsers: {
7671
8146
  current_page: CurrentPageSchema,
7672
8147
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7673
- role: z22.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
7674
- email: z22.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")
7675
8150
  },
7676
8151
  inviteUser: {
7677
- email: z22.string().email().describe("Email address of the user to invite"),
7678
- role: z22.enum(["admin", "member"]).describe(
8152
+ email: z27.string().email().describe("Email address of the user to invite"),
8153
+ role: z27.enum(["admin", "member"]).describe(
7679
8154
  "Organization-level role: 'admin' for full access, 'member' for limited access"
7680
8155
  ),
7681
- first_name: z22.string().optional().describe("User's first name"),
7682
- last_name: z22.string().optional().describe("User's last name"),
7683
- workspaces: z22.array(
7684
- z22.object({
7685
- id: z22.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(
7686
8161
  "Workspace ID/slug where the user will be granted access"
7687
8162
  ),
7688
- role: z22.enum(["admin", "member", "manager"]).describe(
8163
+ role: z27.enum(["admin", "member", "manager"]).describe(
7689
8164
  "Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
7690
8165
  )
7691
8166
  })
7692
8167
  ).describe(
7693
8168
  "List of workspaces and corresponding roles to grant to the user"
7694
8169
  ),
7695
- workspace_api_key_details: z22.object({
7696
- name: z22.string().optional().describe("Name of the API key to be created"),
7697
- expiry: z22.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
7698
- metadata: z22.record(z22.string(), z22.string()).optional().describe("Additional metadata key-value pairs for the API key"),
7699
- scopes: z22.array(z22.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")
7700
8175
  }).optional().describe("Optional API key to be created for the user")
7701
8176
  },
7702
8177
  getUserStats: {
7703
- time_of_generation_min: z22.string().describe(
8178
+ time_of_generation_min: z27.string().describe(
7704
8179
  "Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
7705
8180
  ),
7706
- time_of_generation_max: z22.string().describe(
8181
+ time_of_generation_max: z27.string().describe(
7707
8182
  "End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
7708
8183
  ),
7709
- total_units_min: z22.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
7710
- total_units_max: z22.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
7711
- cost_min: z22.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
7712
- cost_max: z22.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
7713
- status_code: z22.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
7714
- virtual_keys: z22.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)"),
7715
8190
  page_size: PageSizeSchema.describe("Number of results per page (max 100)")
7716
8191
  },
7717
8192
  getUser: {
7718
- user_id: z22.string().describe("The user ID to retrieve")
8193
+ user_id: z27.string().describe("The user ID to retrieve")
7719
8194
  },
7720
8195
  updateUser: {
7721
- user_id: z22.string().describe("The user ID to update"),
7722
- first_name: z22.string().optional().describe("New first name"),
7723
- last_name: z22.string().optional().describe("New last name"),
7724
- role: z22.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")
7725
8200
  },
7726
8201
  deleteUser: {
7727
- user_id: z22.string().describe("The user ID to delete")
8202
+ user_id: z27.string().describe("The user ID to delete")
7728
8203
  },
7729
8204
  listUserInvites: {
7730
8205
  current_page: CurrentPageSchema,
7731
8206
  page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
7732
- role: z22.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
7733
- email: z22.string().email().optional().describe("Filter by invited email"),
7734
- status: z22.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")
7735
8210
  },
7736
8211
  getUserInvite: {
7737
- invite_id: z22.string().describe("The invite ID to retrieve")
8212
+ invite_id: z27.string().describe("The invite ID to retrieve")
7738
8213
  },
7739
8214
  deleteUserInvite: {
7740
- invite_id: z22.string().describe("The invite ID to delete")
8215
+ invite_id: z27.string().describe("The invite ID to delete")
7741
8216
  },
7742
8217
  resendUserInvite: {
7743
- invite_id: z22.string().describe("The invite ID to resend")
8218
+ invite_id: z27.string().describe("The invite ID to resend")
7744
8219
  }
7745
8220
  };
7746
8221
  function formatUser(user) {
@@ -7901,34 +8376,34 @@ function registerUsersTools(server, service) {
7901
8376
  }
7902
8377
 
7903
8378
  // src/tools/workspaces.tools.ts
7904
- import { z as z23 } from "zod";
8379
+ import { z as z28 } from "zod";
7905
8380
  var scimWorkspaceMappingBaseShape = {
7906
- workspace_id: z23.string().describe("Portkey workspace ID that the SCIM group should access"),
7907
- role: z23.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")
7908
8383
  };
7909
8384
  var createScimWorkspaceMappingShape = {
7910
8385
  ...scimWorkspaceMappingBaseShape,
7911
- scim_group_id: z23.string().min(1).optional().describe(
8386
+ scim_group_id: z28.string().min(1).optional().describe(
7912
8387
  "Existing identity-provider SCIM group ID; provide this or scim_group_name, but not both"
7913
8388
  ),
7914
- scim_group_name: z23.string().min(1).optional().describe(
8389
+ scim_group_name: z28.string().min(1).optional().describe(
7915
8390
  "Existing SCIM group display name; provide this or scim_group_id, but not both"
7916
8391
  )
7917
8392
  };
7918
- var workspaceUsageLimitSchema = z23.object({
7919
- credit_limit: z23.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
7920
- type: z23.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
7921
- alert_threshold: z23.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
7922
- periodic_reset: z23.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
7923
- periodic_reset_days: z23.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
7924
- next_usage_reset_at: z23.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")
7925
8400
  });
7926
- var workspaceRateLimitSchema = z23.object({
7927
- type: z23.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
7928
- unit: z23.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
7929
- value: z23.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")
7930
8405
  });
7931
- var createScimWorkspaceMappingSchema = z23.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
8406
+ var createScimWorkspaceMappingSchema = z28.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
7932
8407
  if (Boolean(input.scim_group_id) === Boolean(input.scim_group_name)) {
7933
8408
  context.addIssue({
7934
8409
  code: "custom",
@@ -7943,99 +8418,101 @@ var WORKSPACES_TOOL_SCHEMAS = {
7943
8418
  "Number of workspaces to return per page (max 100)"
7944
8419
  ),
7945
8420
  current_page: CurrentPageSchema,
7946
- name: z23.string().optional().describe("Case-sensitive name filter"),
7947
- exact_name: z23.string().optional().describe("Exact workspace name filter"),
7948
- status: z23.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")
7949
8424
  },
7950
8425
  getWorkspace: {
7951
- workspace_id: z23.string().describe(
8426
+ workspace_id: z28.string().describe(
7952
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"
7953
8428
  )
7954
8429
  },
7955
8430
  createWorkspace: {
7956
- name: z23.string().describe("Name of the workspace"),
7957
- slug: z23.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
7958
- description: z23.string().optional().describe("Description of the workspace"),
7959
- is_default: z23.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
7960
- metadata: z23.record(z23.string(), z23.string()).optional().describe("Custom metadata key-value pairs"),
7961
- users: z23.array(z23.string()).optional().describe("Existing user IDs to add"),
7962
- usage_limits: z23.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
7963
- rate_limits: z23.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")
7964
8439
  },
7965
8440
  updateWorkspace: {
7966
- workspace_id: z23.string().describe("The workspace ID to update"),
7967
- name: z23.string().optional().describe("New name for the workspace"),
7968
- slug: z23.string().optional().describe("New slug for the workspace"),
7969
- description: z23.string().optional().describe("New description"),
7970
- is_default: z23.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
7971
- metadata: z23.record(z23.string(), z23.string()).optional().describe("New metadata key-value pairs"),
7972
- input_guardrails: z23.array(z23.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
7973
- output_guardrails: z23.array(z23.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
7974
- user_api_key_config: z23.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(
7975
8450
  "Default config slug for workspace-user API keys, or null to clear"
7976
8451
  ),
7977
- usage_limits: z23.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
7978
- rate_limits: z23.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")
7979
8454
  },
7980
8455
  deleteWorkspace: {
7981
- workspace_id: z23.string().describe("The workspace ID to delete")
8456
+ workspace_id: z28.string().describe("The workspace ID to delete")
7982
8457
  },
7983
8458
  addWorkspaceMember: {
7984
- workspace_id: z23.string().describe("The workspace ID to add the member to"),
7985
- user_id: z23.string().uuid(
8459
+ workspace_id: z28.string().describe("The workspace ID to add the member to"),
8460
+ user_id: z28.string().uuid(
7986
8461
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
7987
8462
  ).describe(
7988
8463
  "The user ID to add (must be a valid UUID from list_all_users, not an email address)"
7989
8464
  ),
7990
- role: z23.enum(["admin", "member", "manager"]).describe("Role in the workspace")
8465
+ role: z28.enum(["admin", "member", "manager"]).describe("Role in the workspace")
7991
8466
  },
7992
8467
  listWorkspaceMembers: {
7993
- workspace_id: z23.string().describe("The workspace ID to list members for"),
8468
+ workspace_id: z28.string().describe("The workspace ID to list members for"),
7994
8469
  current_page: CurrentPageSchema.describe("Zero-based page number"),
7995
8470
  page_size: PageSizeSchema.describe("Number of members per page"),
7996
- role: z23.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
7997
- email: z23.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")
7998
8473
  },
7999
8474
  getWorkspaceMember: {
8000
- workspace_id: z23.string().describe("The workspace ID"),
8001
- user_id: z23.string().uuid(
8475
+ workspace_id: z28.string().describe("The workspace ID"),
8476
+ user_id: z28.string().uuid(
8002
8477
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8003
8478
  ).describe(
8004
8479
  "The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
8005
8480
  )
8006
8481
  },
8007
8482
  updateWorkspaceMember: {
8008
- workspace_id: z23.string().describe("The workspace ID"),
8009
- user_id: z23.string().uuid(
8483
+ workspace_id: z28.string().describe("The workspace ID"),
8484
+ user_id: z28.string().uuid(
8010
8485
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8011
8486
  ).describe(
8012
8487
  "The user ID to update (must be a valid UUID from list_all_users, not an email address)"
8013
8488
  ),
8014
- role: z23.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8489
+ role: z28.enum(["admin", "member", "manager"]).describe("New role in the workspace")
8015
8490
  },
8016
8491
  removeWorkspaceMember: {
8017
- workspace_id: z23.string().describe("The workspace ID"),
8018
- user_id: z23.string().uuid(
8492
+ workspace_id: z28.string().describe("The workspace ID"),
8493
+ user_id: z28.string().uuid(
8019
8494
  "user_id must be a valid UUID (use list_all_users to find user IDs)"
8020
8495
  ).describe("The user ID to remove")
8021
8496
  },
8022
8497
  listScimWorkspaceMappings: {
8023
- workspace_id: z23.string().optional().describe("Return only mappings for this Portkey workspace ID"),
8024
- scim_group_id: z23.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(
8025
8502
  "Return only mappings for this identity-provider SCIM group ID"
8026
8503
  ),
8027
- role: z23.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
8028
- page: z23.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(
8029
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."
8030
8507
  ),
8031
8508
  page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
8032
8509
  },
8033
8510
  deleteScimWorkspaceMapping: {
8034
- mapping_id: z23.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")
8035
8512
  },
8036
8513
  listScimGroups: {
8037
- search: z23.string().optional().describe("Case-insensitive text to match against SCIM group names"),
8038
- page: z23.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(
8039
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."
8040
8517
  ),
8041
8518
  page_size: PageSizeSchema.describe(
@@ -8349,6 +8826,8 @@ function registerWorkspacesTools(server, service) {
8349
8826
 
8350
8827
  // src/tools/index.ts
8351
8828
  var TOOL_DOMAIN_REGISTRARS = [
8829
+ ["access-policies", registerAccessPoliciesTools],
8830
+ ["egress-allowlist", registerEgressAllowlistTools],
8352
8831
  ["users", registerUsersTools],
8353
8832
  ["workspaces", registerWorkspacesTools],
8354
8833
  ["configs", registerConfigsTools],
@@ -8426,6 +8905,9 @@ var ENTERPRISE_GATED_TOOL_NAMES = /* @__PURE__ */ new Set([
8426
8905
  "get_analytics_group_models",
8427
8906
  "get_analytics_group_metadata",
8428
8907
  "get_analytics_group_providers",
8908
+ "get_analytics_group_mcp",
8909
+ "get_analytics_group_a2a",
8910
+ "get_analytics_group_workspaces",
8429
8911
  "list_deployments",
8430
8912
  "register_deployment",
8431
8913
  "get_deployment",
@@ -8522,7 +9004,7 @@ function escapeRegExp(value) {
8522
9004
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8523
9005
  }
8524
9006
  function getToolErrorMessage(error) {
8525
- if (error instanceof z24.ZodError) {
9007
+ if (error instanceof z29.ZodError) {
8526
9008
  return formatZodIssues(error);
8527
9009
  }
8528
9010
  if (error instanceof Error && error.message) {
@@ -8531,71 +9013,81 @@ function getToolErrorMessage(error) {
8531
9013
  return String(error);
8532
9014
  }
8533
9015
  var STANDARD_TOOL_OUTPUT_SCHEMA = {
8534
- ok: z24.boolean().describe("Whether the tool call succeeded and returned structured data"),
8535
- data: z24.unknown().optional().describe("Structured success payload when ok is true"),
8536
- error: z24.object({
8537
- message: z24.string().describe("Human-readable error message"),
8538
- details: z24.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")
8539
9021
  }).optional().describe("Structured error payload when ok is false")
8540
9022
  };
8541
9023
  var TOOL_SUCCESS_DATA_SCHEMAS = {
8542
- rotate_api_key: z24.object({
8543
- message: z24.string().describe("Rotation confirmation"),
8544
- warning: z24.string().describe("Required handling guidance for the one-time secret"),
8545
- id: z24.string().uuid().describe("Rotated API key UUID"),
8546
- key: z24.string().describe("New API key secret, returned only once"),
8547
- key_transition_expires_at: z24.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")
8548
9040
  }),
8549
- create_secret_reference: z24.object({
8550
- message: z24.string().describe("Creation confirmation"),
8551
- id: z24.string().uuid().describe("New Secret Reference UUID"),
8552
- slug: z24.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")
8553
9045
  }),
8554
- list_secret_references: z24.object({
8555
- total: z24.number().int().nonnegative().describe("Total matching references"),
8556
- secret_references: z24.array(
8557
- z24.object({
8558
- id: z24.string().uuid().describe("Secret Reference UUID"),
8559
- name: z24.string().describe("Human-readable name"),
8560
- slug: z24.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"),
8561
9053
  manager_type: SecretManagerTypeSchema.describe(
8562
9054
  "External secret manager type"
8563
9055
  ),
8564
- status: z24.literal("ACTIVE").describe("Current reference status"),
8565
- created_at: z24.iso.datetime().describe("ISO 8601 creation timestamp"),
8566
- last_updated_at: z24.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")
8567
9059
  })
8568
9060
  ).describe(
8569
9061
  "Current page of Secret References without authentication values"
8570
9062
  )
8571
9063
  }),
8572
- get_secret_reference: z24.object({
8573
- id: z24.string().uuid().describe("Secret Reference UUID"),
8574
- organisation_id: z24.string().uuid().describe("Owning organisation UUID"),
8575
- name: z24.string().describe("Human-readable name"),
8576
- slug: z24.string().describe("Stable Secret Reference slug"),
8577
- description: z24.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"),
8578
9070
  manager_type: SecretManagerTypeSchema.describe(
8579
9071
  "External secret manager type"
8580
9072
  ),
8581
- secret_path: z24.string().describe("Path in the external secret manager"),
8582
- secret_key: z24.string().nullable().describe("Selected key within a structured secret"),
8583
- allow_all_workspaces: z24.boolean().describe("Whether all workspaces may use the reference"),
8584
- tags: z24.record(z24.string(), z24.string()).nullable().describe("String metadata tags"),
8585
- status: z24.literal("ACTIVE").describe("Current reference status"),
8586
- created_by: z24.string().describe("Creator identifier"),
8587
- created_at: z24.iso.datetime().describe("ISO 8601 creation timestamp"),
8588
- last_updated_at: z24.iso.datetime().describe("ISO 8601 last-update timestamp"),
8589
- auth_config: z24.record(z24.string(), z24.unknown()).describe("Authentication configuration with sensitive values redacted"),
8590
- object: z24.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")
8591
9083
  }),
8592
- update_secret_reference: z24.object({
8593
- message: z24.string().describe("Update confirmation"),
8594
- success: z24.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")
8595
9087
  }),
8596
- delete_secret_reference: z24.object({
8597
- message: z24.string().describe("Deletion confirmation"),
8598
- success: z24.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")
8599
9091
  })
8600
9092
  };
8601
9093
  function getToolOutputSchema(toolName) {
@@ -8671,7 +9163,7 @@ function wrapToolCallback(toolName, callback) {
8671
9163
  return normalizeToolResult(await callback(...args));
8672
9164
  } catch (error) {
8673
9165
  const message = getToolErrorMessage(error);
8674
- const isValidationError = error instanceof z24.ZodError;
9166
+ const isValidationError = error instanceof z29.ZodError;
8675
9167
  const text = isValidationError ? `Invalid arguments for "${toolName}": ${message}` : `Tool "${toolName}" failed: ${message}`;
8676
9168
  Logger.error("Tool callback failed", {
8677
9169
  error: message,
@@ -8889,8 +9381,8 @@ function registerServerPromptsAndResources(server) {
8889
9381
  title: "Plan Portkey Admin Workflow",
8890
9382
  description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
8891
9383
  argsSchema: {
8892
- task: z25.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
8893
- area: z25.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(
8894
9386
  "Optional Portkey area, such as prompts, analytics, configs, or users"
8895
9387
  )
8896
9388
  }
@@ -8969,6 +9461,7 @@ function createMcpServer(options = {}) {
8969
9461
  version: PACKAGE_VERSION
8970
9462
  },
8971
9463
  {
9464
+ maxToolInputElements: 1e4,
8972
9465
  capabilities: {
8973
9466
  prompts: { listChanged: true },
8974
9467
  resources: { listChanged: true },