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