portkey-admin-mcp 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +678 -655
- package/build/server.js +678 -655
- package/package.json +1 -1
package/build/server.js
CHANGED
|
@@ -2162,7 +2162,81 @@ var CreateSecretReferenceResponseSchema = z.object({
|
|
|
2162
2162
|
});
|
|
2163
2163
|
|
|
2164
2164
|
// src/tools/analytics.tools.ts
|
|
2165
|
+
import { z as z3 } from "zod";
|
|
2166
|
+
|
|
2167
|
+
// src/lib/schemas.ts
|
|
2165
2168
|
import { z as z2 } from "zod";
|
|
2169
|
+
var PromptFunctionSchema = z2.object({
|
|
2170
|
+
name: z2.string().describe("Function name"),
|
|
2171
|
+
description: z2.string().optional().describe("Function description"),
|
|
2172
|
+
parameters: z2.record(z2.string(), z2.unknown()).optional().describe("Function parameters schema")
|
|
2173
|
+
});
|
|
2174
|
+
var PromptToolSchema = z2.object({
|
|
2175
|
+
type: z2.literal("function").describe("Tool type"),
|
|
2176
|
+
function: PromptFunctionSchema.describe("Function definition")
|
|
2177
|
+
});
|
|
2178
|
+
var HyperparametersSchema = z2.object({
|
|
2179
|
+
max_tokens: z2.coerce.number().positive().optional().describe("Maximum tokens to generate"),
|
|
2180
|
+
temperature: z2.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
2181
|
+
top_p: z2.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
|
|
2182
|
+
top_k: z2.coerce.number().positive().optional().describe("Top-k sampling"),
|
|
2183
|
+
presence_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
|
|
2184
|
+
frequency_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
|
|
2185
|
+
stop: z2.array(z2.string()).optional().describe("Stop sequences")
|
|
2186
|
+
});
|
|
2187
|
+
var PromptAppIdentifierSchema = z2.string().min(1).describe(
|
|
2188
|
+
"App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
|
|
2189
|
+
);
|
|
2190
|
+
var PromptEnvironmentIdentifierSchema = z2.string().min(1).describe(
|
|
2191
|
+
"Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
|
|
2192
|
+
);
|
|
2193
|
+
var BillingMetadataSchema = z2.object({
|
|
2194
|
+
client_id: z2.string().describe("Client ID for billing attribution (REQUIRED)"),
|
|
2195
|
+
app: PromptAppIdentifierSchema,
|
|
2196
|
+
env: PromptEnvironmentIdentifierSchema,
|
|
2197
|
+
project_id: z2.string().optional().describe("Project ID for granular billing"),
|
|
2198
|
+
feature: z2.string().optional().describe("Feature name for tracking")
|
|
2199
|
+
});
|
|
2200
|
+
var ToolChoiceSchema = z2.object({
|
|
2201
|
+
mode: z2.enum(["auto", "none", "function"]).describe(
|
|
2202
|
+
"Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
|
|
2203
|
+
),
|
|
2204
|
+
function_name: z2.string().optional().describe("Required when mode is 'function'; ignored otherwise")
|
|
2205
|
+
}).superRefine((value, ctx) => {
|
|
2206
|
+
if (value.mode === "function" && !value.function_name) {
|
|
2207
|
+
ctx.addIssue({
|
|
2208
|
+
code: z2.ZodIssueCode.custom,
|
|
2209
|
+
path: ["function_name"],
|
|
2210
|
+
message: "function_name is required when mode is 'function'"
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
if (value.mode !== "function" && value.function_name !== void 0) {
|
|
2214
|
+
ctx.addIssue({
|
|
2215
|
+
code: z2.ZodIssueCode.custom,
|
|
2216
|
+
path: ["function_name"],
|
|
2217
|
+
message: "function_name is only allowed when mode is 'function'"
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
});
|
|
2221
|
+
function toPromptToolChoice(toolChoice) {
|
|
2222
|
+
if (!toolChoice) {
|
|
2223
|
+
return void 0;
|
|
2224
|
+
}
|
|
2225
|
+
if (toolChoice.mode === "function") {
|
|
2226
|
+
return {
|
|
2227
|
+
type: "function",
|
|
2228
|
+
function: {
|
|
2229
|
+
name: toolChoice.function_name
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
return toolChoice.mode;
|
|
2234
|
+
}
|
|
2235
|
+
var CurrentPageSchema = z2.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
|
|
2236
|
+
function pageSizeSchema(max = 100) {
|
|
2237
|
+
return z2.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
|
|
2238
|
+
}
|
|
2239
|
+
var PageSizeSchema = pageSizeSchema();
|
|
2166
2240
|
|
|
2167
2241
|
// src/tools/utils.ts
|
|
2168
2242
|
function formatFullName(firstName, lastName) {
|
|
@@ -2178,42 +2252,42 @@ function jsonResult(data) {
|
|
|
2178
2252
|
|
|
2179
2253
|
// src/tools/analytics.tools.ts
|
|
2180
2254
|
var baseAnalyticsSchema = {
|
|
2181
|
-
time_of_generation_min:
|
|
2255
|
+
time_of_generation_min: z3.string().describe(
|
|
2182
2256
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
2183
2257
|
),
|
|
2184
|
-
time_of_generation_max:
|
|
2258
|
+
time_of_generation_max: z3.string().describe(
|
|
2185
2259
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
2186
2260
|
),
|
|
2187
|
-
total_units_min:
|
|
2188
|
-
total_units_max:
|
|
2189
|
-
cost_min:
|
|
2190
|
-
cost_max:
|
|
2191
|
-
prompt_token_min:
|
|
2192
|
-
prompt_token_max:
|
|
2193
|
-
completion_token_min:
|
|
2194
|
-
completion_token_max:
|
|
2195
|
-
status_code:
|
|
2261
|
+
total_units_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
|
|
2262
|
+
total_units_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
|
|
2263
|
+
cost_min: z3.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
|
|
2264
|
+
cost_max: z3.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
|
|
2265
|
+
prompt_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
|
|
2266
|
+
prompt_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
|
|
2267
|
+
completion_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
|
|
2268
|
+
completion_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
|
|
2269
|
+
status_code: z3.string().optional().describe(
|
|
2196
2270
|
"Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
|
|
2197
2271
|
),
|
|
2198
|
-
weighted_feedback_min:
|
|
2199
|
-
weighted_feedback_max:
|
|
2200
|
-
virtual_keys:
|
|
2272
|
+
weighted_feedback_min: z3.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
|
|
2273
|
+
weighted_feedback_max: z3.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
|
|
2274
|
+
virtual_keys: z3.string().optional().describe(
|
|
2201
2275
|
"Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
|
|
2202
2276
|
),
|
|
2203
|
-
configs:
|
|
2277
|
+
configs: z3.string().optional().describe(
|
|
2204
2278
|
"Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
|
|
2205
2279
|
),
|
|
2206
|
-
status_codes:
|
|
2280
|
+
status_codes: z3.array(z3.string()).optional().describe(
|
|
2207
2281
|
"Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
|
|
2208
2282
|
),
|
|
2209
|
-
virtual_key_slugs:
|
|
2283
|
+
virtual_key_slugs: z3.array(z3.string()).optional().describe(
|
|
2210
2284
|
"Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
|
|
2211
2285
|
),
|
|
2212
|
-
config_slugs:
|
|
2286
|
+
config_slugs: z3.array(z3.string()).optional().describe(
|
|
2213
2287
|
"Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
|
|
2214
2288
|
),
|
|
2215
|
-
workspace_slug:
|
|
2216
|
-
api_key_ids:
|
|
2289
|
+
workspace_slug: z3.string().optional().describe("Filter by specific workspace"),
|
|
2290
|
+
api_key_ids: z3.preprocess((value) => {
|
|
2217
2291
|
if (value == null) {
|
|
2218
2292
|
return value;
|
|
2219
2293
|
}
|
|
@@ -2221,45 +2295,45 @@ var baseAnalyticsSchema = {
|
|
|
2221
2295
|
return value.map((item) => String(item)).join(",");
|
|
2222
2296
|
}
|
|
2223
2297
|
return value;
|
|
2224
|
-
},
|
|
2298
|
+
}, z3.string().optional()).describe(
|
|
2225
2299
|
"Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
|
|
2226
2300
|
),
|
|
2227
|
-
metadata:
|
|
2301
|
+
metadata: z3.string().optional().describe(
|
|
2228
2302
|
`Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
|
|
2229
2303
|
),
|
|
2230
|
-
ai_org_model:
|
|
2304
|
+
ai_org_model: z3.string().optional().describe(
|
|
2231
2305
|
"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."
|
|
2232
2306
|
),
|
|
2233
|
-
provider_models:
|
|
2307
|
+
provider_models: z3.array(z3.string()).optional().describe(
|
|
2234
2308
|
"Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
|
|
2235
2309
|
),
|
|
2236
|
-
trace_id:
|
|
2310
|
+
trace_id: z3.string().optional().describe(
|
|
2237
2311
|
"Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
|
|
2238
2312
|
),
|
|
2239
|
-
trace_ids:
|
|
2313
|
+
trace_ids: z3.array(z3.string()).optional().describe(
|
|
2240
2314
|
"Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
|
|
2241
2315
|
),
|
|
2242
|
-
span_id:
|
|
2316
|
+
span_id: z3.string().optional().describe(
|
|
2243
2317
|
"Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
|
|
2244
2318
|
),
|
|
2245
|
-
span_ids:
|
|
2319
|
+
span_ids: z3.array(z3.string()).optional().describe(
|
|
2246
2320
|
"Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
|
|
2247
2321
|
),
|
|
2248
|
-
metadata_filter:
|
|
2322
|
+
metadata_filter: z3.record(z3.string(), z3.unknown()).optional().describe(
|
|
2249
2323
|
"Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
|
|
2250
2324
|
),
|
|
2251
|
-
prompt_slug:
|
|
2325
|
+
prompt_slug: z3.string().optional().describe("Filter by prompt slug")
|
|
2252
2326
|
};
|
|
2253
2327
|
var paginatedAnalyticsSchema = {
|
|
2254
2328
|
...baseAnalyticsSchema,
|
|
2255
|
-
current_page:
|
|
2256
|
-
page_size:
|
|
2329
|
+
current_page: CurrentPageSchema,
|
|
2330
|
+
page_size: PageSizeSchema
|
|
2257
2331
|
};
|
|
2258
2332
|
var cacheSummarySchema = {
|
|
2259
2333
|
...baseAnalyticsSchema,
|
|
2260
|
-
workspace_slug:
|
|
2334
|
+
workspace_slug: z3.string().min(1).describe("Workspace slug to analyze")
|
|
2261
2335
|
};
|
|
2262
|
-
var providerMetricSchema =
|
|
2336
|
+
var providerMetricSchema = z3.enum([
|
|
2263
2337
|
"requests",
|
|
2264
2338
|
"cost",
|
|
2265
2339
|
"total_tokens",
|
|
@@ -2277,16 +2351,16 @@ var providerMetricSchema = z2.enum([
|
|
|
2277
2351
|
]);
|
|
2278
2352
|
var providerGroupAnalyticsSchema = {
|
|
2279
2353
|
...cacheSummarySchema,
|
|
2280
|
-
current_page:
|
|
2281
|
-
page_size:
|
|
2282
|
-
order_by:
|
|
2283
|
-
order_by_type:
|
|
2284
|
-
columns:
|
|
2285
|
-
include_total:
|
|
2354
|
+
current_page: CurrentPageSchema.describe("Zero-based result page"),
|
|
2355
|
+
page_size: PageSizeSchema.describe("Number of provider groups per page"),
|
|
2356
|
+
order_by: z3.string().optional().describe("Metric or field used to order groups"),
|
|
2357
|
+
order_by_type: z3.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
|
|
2358
|
+
columns: z3.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
|
|
2359
|
+
include_total: z3.boolean().optional().describe("Request the total provider-group count")
|
|
2286
2360
|
};
|
|
2287
2361
|
var analyticsGroupMetadataSchema = {
|
|
2288
2362
|
...paginatedAnalyticsSchema,
|
|
2289
|
-
metadata_key:
|
|
2363
|
+
metadata_key: z3.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
|
|
2290
2364
|
};
|
|
2291
2365
|
function formatGraphAnalytics(summary, dataPoints) {
|
|
2292
2366
|
return {
|
|
@@ -2722,26 +2796,26 @@ function registerAnalyticsTools(server, service) {
|
|
|
2722
2796
|
}
|
|
2723
2797
|
|
|
2724
2798
|
// src/tools/audit.tools.ts
|
|
2725
|
-
import { z as
|
|
2799
|
+
import { z as z4 } from "zod";
|
|
2726
2800
|
var AUDIT_TOOL_SCHEMAS = {
|
|
2727
2801
|
listAuditLogs: {
|
|
2728
|
-
workspace_id:
|
|
2729
|
-
actor_id:
|
|
2730
|
-
action:
|
|
2802
|
+
workspace_id: z4.string().optional().describe("Filter audit logs by workspace ID"),
|
|
2803
|
+
actor_id: z4.string().optional().describe("Filter by the user ID who performed the action"),
|
|
2804
|
+
action: z4.string().optional().describe(
|
|
2731
2805
|
"Filter by action type (e.g., 'create', 'update', 'delete', 'login')"
|
|
2732
2806
|
),
|
|
2733
|
-
resource_type:
|
|
2807
|
+
resource_type: z4.string().optional().describe(
|
|
2734
2808
|
"Filter by resource type (e.g., 'user', 'workspace', 'config', 'virtual_key')"
|
|
2735
2809
|
),
|
|
2736
|
-
resource_id:
|
|
2737
|
-
start_time:
|
|
2810
|
+
resource_id: z4.string().optional().describe("Filter by specific resource ID"),
|
|
2811
|
+
start_time: z4.string().optional().describe(
|
|
2738
2812
|
"Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
2739
2813
|
),
|
|
2740
|
-
end_time:
|
|
2814
|
+
end_time: z4.string().optional().describe(
|
|
2741
2815
|
"End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
|
|
2742
2816
|
),
|
|
2743
|
-
current_page:
|
|
2744
|
-
page_size:
|
|
2817
|
+
current_page: CurrentPageSchema,
|
|
2818
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
2745
2819
|
}
|
|
2746
2820
|
};
|
|
2747
2821
|
function registerAuditTools(server, service) {
|
|
@@ -2787,30 +2861,30 @@ function registerAuditTools(server, service) {
|
|
|
2787
2861
|
}
|
|
2788
2862
|
|
|
2789
2863
|
// src/tools/collections.tools.ts
|
|
2790
|
-
import { z as
|
|
2864
|
+
import { z as z5 } from "zod";
|
|
2791
2865
|
var COLLECTIONS_TOOL_SCHEMAS = {
|
|
2792
2866
|
listCollections: {
|
|
2793
|
-
workspace_id:
|
|
2794
|
-
search:
|
|
2795
|
-
current_page:
|
|
2796
|
-
page_size:
|
|
2867
|
+
workspace_id: z5.string().optional().describe("Filter by workspace ID"),
|
|
2868
|
+
search: z5.string().optional().describe("Search collections by name"),
|
|
2869
|
+
current_page: CurrentPageSchema,
|
|
2870
|
+
page_size: PageSizeSchema
|
|
2797
2871
|
},
|
|
2798
2872
|
createCollection: {
|
|
2799
|
-
name:
|
|
2873
|
+
name: z5.string().describe(
|
|
2800
2874
|
"Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
|
|
2801
2875
|
),
|
|
2802
|
-
workspace_id:
|
|
2876
|
+
workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
|
|
2803
2877
|
},
|
|
2804
2878
|
getCollection: {
|
|
2805
|
-
collection_id:
|
|
2879
|
+
collection_id: z5.string().describe("Collection ID or slug to retrieve")
|
|
2806
2880
|
},
|
|
2807
2881
|
updateCollection: {
|
|
2808
|
-
collection_id:
|
|
2809
|
-
name:
|
|
2810
|
-
description:
|
|
2882
|
+
collection_id: z5.string().describe("Collection ID to update"),
|
|
2883
|
+
name: z5.string().optional().describe("New name for the collection"),
|
|
2884
|
+
description: z5.string().optional().describe("New description for the collection")
|
|
2811
2885
|
},
|
|
2812
2886
|
deleteCollection: {
|
|
2813
|
-
collection_id:
|
|
2887
|
+
collection_id: z5.string().describe("Collection ID to delete")
|
|
2814
2888
|
}
|
|
2815
2889
|
};
|
|
2816
2890
|
function registerCollectionsTools(server, service) {
|
|
@@ -2896,58 +2970,58 @@ function registerCollectionsTools(server, service) {
|
|
|
2896
2970
|
}
|
|
2897
2971
|
|
|
2898
2972
|
// src/tools/configs.tools.ts
|
|
2899
|
-
import { z as
|
|
2900
|
-
var configTargetSchema =
|
|
2901
|
-
provider:
|
|
2902
|
-
virtual_key:
|
|
2973
|
+
import { z as z6 } from "zod";
|
|
2974
|
+
var configTargetSchema = z6.object({
|
|
2975
|
+
provider: z6.string().optional().describe("Provider slug to route requests to"),
|
|
2976
|
+
virtual_key: z6.string().optional().describe("Virtual key slug to use for this routing target")
|
|
2903
2977
|
}).refine((target) => target.provider || target.virtual_key, {
|
|
2904
2978
|
message: "Each target must have at least provider or virtual_key"
|
|
2905
2979
|
});
|
|
2906
2980
|
var CONFIGS_TOOL_SCHEMAS = {
|
|
2907
2981
|
listConfigs: {
|
|
2908
|
-
current_page:
|
|
2909
|
-
page_size:
|
|
2982
|
+
current_page: CurrentPageSchema,
|
|
2983
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
2910
2984
|
},
|
|
2911
2985
|
getConfig: {
|
|
2912
|
-
slug:
|
|
2986
|
+
slug: z6.string().describe(
|
|
2913
2987
|
"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"
|
|
2914
2988
|
)
|
|
2915
2989
|
},
|
|
2916
2990
|
createConfig: {
|
|
2917
|
-
name:
|
|
2918
|
-
workspace_id:
|
|
2919
|
-
cache_mode:
|
|
2920
|
-
cache_max_age:
|
|
2921
|
-
retry_attempts:
|
|
2922
|
-
retry_on_status_codes:
|
|
2923
|
-
strategy_mode:
|
|
2924
|
-
targets:
|
|
2991
|
+
name: z6.string().describe("Name for the new configuration"),
|
|
2992
|
+
workspace_id: z6.string().optional().describe("Workspace ID to create config in"),
|
|
2993
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
2994
|
+
cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
2995
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
2996
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
|
|
2997
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
|
|
2998
|
+
targets: z6.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
|
|
2925
2999
|
},
|
|
2926
3000
|
updateConfig: {
|
|
2927
|
-
slug:
|
|
2928
|
-
name:
|
|
2929
|
-
status:
|
|
2930
|
-
cache_mode:
|
|
2931
|
-
cache_max_age:
|
|
2932
|
-
retry_attempts:
|
|
2933
|
-
retry_on_status_codes:
|
|
2934
|
-
strategy_mode:
|
|
2935
|
-
targets:
|
|
3001
|
+
slug: z6.string().describe("Configuration slug to update"),
|
|
3002
|
+
name: z6.string().optional().describe("New name for the configuration"),
|
|
3003
|
+
status: z6.enum(["active", "inactive"]).optional().describe("Configuration status"),
|
|
3004
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
3005
|
+
cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
3006
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
3007
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on"),
|
|
3008
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
|
|
3009
|
+
targets: z6.array(configTargetSchema).optional().describe("Array of target providers")
|
|
2936
3010
|
},
|
|
2937
3011
|
deleteConfig: {
|
|
2938
|
-
slug:
|
|
3012
|
+
slug: z6.string().describe("Configuration slug to delete")
|
|
2939
3013
|
},
|
|
2940
3014
|
listConfigVersions: {
|
|
2941
|
-
slug:
|
|
3015
|
+
slug: z6.string().describe("Configuration slug to list versions for")
|
|
2942
3016
|
}
|
|
2943
3017
|
};
|
|
2944
|
-
var configPayloadSchema =
|
|
2945
|
-
cache_mode:
|
|
2946
|
-
cache_max_age:
|
|
2947
|
-
retry_attempts:
|
|
2948
|
-
retry_on_status_codes:
|
|
2949
|
-
strategy_mode:
|
|
2950
|
-
targets:
|
|
3018
|
+
var configPayloadSchema = z6.object({
|
|
3019
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional(),
|
|
3020
|
+
cache_max_age: z6.coerce.number().positive().optional(),
|
|
3021
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional(),
|
|
3022
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional(),
|
|
3023
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional(),
|
|
3024
|
+
targets: z6.array(configTargetSchema).optional()
|
|
2951
3025
|
});
|
|
2952
3026
|
function buildConfigPayload(params) {
|
|
2953
3027
|
const cache = params.cache_mode !== void 0 || params.cache_max_age !== void 0 ? {
|
|
@@ -2968,10 +3042,10 @@ function buildConfigPayload(params) {
|
|
|
2968
3042
|
function hasConfigSettings(config) {
|
|
2969
3043
|
return config.cache !== void 0 || config.retry !== void 0 || config.strategy !== void 0 || config.targets !== void 0;
|
|
2970
3044
|
}
|
|
2971
|
-
var createConfigSchema =
|
|
3045
|
+
var createConfigSchema = z6.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
|
|
2972
3046
|
if (!hasConfigSettings(buildConfigPayload(value))) {
|
|
2973
3047
|
ctx.addIssue({
|
|
2974
|
-
code:
|
|
3048
|
+
code: z6.ZodIssueCode.custom,
|
|
2975
3049
|
message: "At least one config setting (cache_mode, retry_attempts, strategy_mode, or targets) must be provided"
|
|
2976
3050
|
});
|
|
2977
3051
|
}
|
|
@@ -3116,56 +3190,56 @@ function registerConfigsTools(server, service) {
|
|
|
3116
3190
|
}
|
|
3117
3191
|
|
|
3118
3192
|
// src/tools/deployments.tools.ts
|
|
3119
|
-
import { z as
|
|
3120
|
-
var binaryFlagSchema =
|
|
3121
|
-
var deploymentTypeSchema =
|
|
3122
|
-
var deploymentStatusSchema =
|
|
3193
|
+
import { z as z7 } from "zod";
|
|
3194
|
+
var binaryFlagSchema = z7.union([z7.literal(0), z7.literal(1)]);
|
|
3195
|
+
var deploymentTypeSchema = z7.enum(["production", "non_production"]);
|
|
3196
|
+
var deploymentStatusSchema = z7.enum(["active", "archived"]);
|
|
3123
3197
|
var authSettingsSchema = {
|
|
3124
|
-
gateway_base_url:
|
|
3125
|
-
mcp_gateway_base_url:
|
|
3198
|
+
gateway_base_url: z7.url().optional().describe("Self-hosted Gateway base URL"),
|
|
3199
|
+
mcp_gateway_base_url: z7.url().optional().describe("MCP Gateway base URL"),
|
|
3126
3200
|
is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
|
|
3127
3201
|
is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
|
|
3128
|
-
workspaces_allowed:
|
|
3129
|
-
jwt_subs_allowed:
|
|
3130
|
-
jwt_sub_workspace_mapping:
|
|
3202
|
+
workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
|
|
3203
|
+
jwt_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values allowed to use the deployment"),
|
|
3204
|
+
jwt_sub_workspace_mapping: z7.record(z7.string(), z7.string()).optional().describe("JWT subject to workspace-slug mapping")
|
|
3131
3205
|
};
|
|
3132
3206
|
var DEPLOYMENTS_TOOL_SCHEMAS = {
|
|
3133
3207
|
listDeployments: {
|
|
3134
|
-
organisation_id:
|
|
3208
|
+
organisation_id: z7.string().optional().describe("Filter by organisation UUID"),
|
|
3135
3209
|
status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
|
|
3136
3210
|
type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
|
|
3137
|
-
workspace_slug:
|
|
3138
|
-
search:
|
|
3211
|
+
workspace_slug: z7.array(z7.string()).optional().describe("Filter by one or more workspace slugs"),
|
|
3212
|
+
search: z7.string().optional().describe("Search deployment names")
|
|
3139
3213
|
},
|
|
3140
3214
|
registerDeployment: {
|
|
3141
|
-
name:
|
|
3142
|
-
organisation_id:
|
|
3143
|
-
slug:
|
|
3215
|
+
name: z7.string().min(1).describe("Deployment display name"),
|
|
3216
|
+
organisation_id: z7.string().optional().describe("Owning organisation UUID"),
|
|
3217
|
+
slug: z7.string().min(1).max(50).optional().describe("Optional deployment slug"),
|
|
3144
3218
|
type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
|
|
3145
|
-
deployment_config:
|
|
3146
|
-
is_default:
|
|
3219
|
+
deployment_config: z7.record(z7.string(), z7.unknown()).optional().describe("Gateway deployment configuration"),
|
|
3220
|
+
is_default: z7.boolean().optional().describe("Make this the default deployment"),
|
|
3147
3221
|
...authSettingsSchema
|
|
3148
3222
|
},
|
|
3149
3223
|
getDeployment: {
|
|
3150
|
-
id:
|
|
3151
|
-
organisation_id:
|
|
3224
|
+
id: z7.string().min(1).describe("Deployment UUID or self"),
|
|
3225
|
+
organisation_id: z7.string().optional().describe("Organisation UUID scope")
|
|
3152
3226
|
},
|
|
3153
3227
|
updateDeployment: {
|
|
3154
|
-
id:
|
|
3155
|
-
name:
|
|
3228
|
+
id: z7.string().min(1).describe("Deployment UUID"),
|
|
3229
|
+
name: z7.string().optional().describe("Replacement display name"),
|
|
3156
3230
|
type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
|
|
3157
3231
|
status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
|
|
3158
|
-
deployment_config:
|
|
3159
|
-
is_default:
|
|
3160
|
-
rotate_auth:
|
|
3161
|
-
override_existing:
|
|
3232
|
+
deployment_config: z7.record(z7.string(), z7.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
|
|
3233
|
+
is_default: z7.boolean().optional().describe("Whether this is the default deployment"),
|
|
3234
|
+
rotate_auth: z7.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
|
|
3235
|
+
override_existing: z7.boolean().optional().describe("Allow replacement of existing deployment settings"),
|
|
3162
3236
|
...authSettingsSchema,
|
|
3163
|
-
allow_all_workspaces:
|
|
3164
|
-
remove_workspaces_allowed:
|
|
3165
|
-
remove_subs_allowed:
|
|
3237
|
+
allow_all_workspaces: z7.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
|
|
3238
|
+
remove_workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs to remove from the allowlist"),
|
|
3239
|
+
remove_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values to remove from the allowlist")
|
|
3166
3240
|
},
|
|
3167
3241
|
archiveDeployment: {
|
|
3168
|
-
id:
|
|
3242
|
+
id: z7.string().min(1).describe("Deployment UUID to archive")
|
|
3169
3243
|
}
|
|
3170
3244
|
};
|
|
3171
3245
|
function compact(value) {
|
|
@@ -3273,72 +3347,74 @@ function registerDeploymentsTools(server, service) {
|
|
|
3273
3347
|
}
|
|
3274
3348
|
|
|
3275
3349
|
// src/tools/guardrails.tools.ts
|
|
3276
|
-
import { z as
|
|
3277
|
-
var guardrailCheckSchema =
|
|
3278
|
-
id:
|
|
3279
|
-
name:
|
|
3280
|
-
is_enabled:
|
|
3281
|
-
parameters:
|
|
3350
|
+
import { z as z8 } from "zod";
|
|
3351
|
+
var guardrailCheckSchema = z8.object({
|
|
3352
|
+
id: z8.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
|
|
3353
|
+
name: z8.string().optional().describe("Display name for the check"),
|
|
3354
|
+
is_enabled: z8.boolean().optional().describe("Whether the check is enabled"),
|
|
3355
|
+
parameters: z8.record(z8.string(), z8.unknown()).optional().describe(
|
|
3282
3356
|
"Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
|
|
3283
3357
|
)
|
|
3284
3358
|
});
|
|
3285
|
-
var guardrailFeedbackSchema =
|
|
3286
|
-
value:
|
|
3287
|
-
weight:
|
|
3288
|
-
metadata:
|
|
3359
|
+
var guardrailFeedbackSchema = z8.object({
|
|
3360
|
+
value: z8.coerce.number().optional().describe("Feedback value"),
|
|
3361
|
+
weight: z8.coerce.number().optional().describe("Feedback weight"),
|
|
3362
|
+
metadata: z8.record(z8.string(), z8.unknown()).optional().describe("Additional metadata")
|
|
3289
3363
|
});
|
|
3290
|
-
var guardrailActionSchema =
|
|
3291
|
-
deny:
|
|
3292
|
-
async:
|
|
3364
|
+
var guardrailActionSchema = z8.object({
|
|
3365
|
+
deny: z8.boolean().optional().describe("Whether to deny the request on check failure"),
|
|
3366
|
+
async: z8.boolean().optional().describe("Whether to run checks asynchronously"),
|
|
3293
3367
|
on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
|
|
3294
3368
|
on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
|
|
3295
|
-
on_fail_action:
|
|
3296
|
-
message:
|
|
3369
|
+
on_fail_action: z8.string().optional().describe("Simple action on failure (e.g., 'block')"),
|
|
3370
|
+
message: z8.string().optional().describe("Message to return when guardrail triggers")
|
|
3297
3371
|
});
|
|
3298
|
-
var workspaceGuardrailExclusionSchema =
|
|
3299
|
-
workspace_id:
|
|
3300
|
-
excluded:
|
|
3372
|
+
var workspaceGuardrailExclusionSchema = z8.object({
|
|
3373
|
+
workspace_id: z8.string().describe("Workspace ID whose exclusion state changes"),
|
|
3374
|
+
excluded: z8.boolean().describe("True to exclude this workspace; false to restore enforcement")
|
|
3301
3375
|
});
|
|
3302
3376
|
var GUARDRAILS_TOOL_SCHEMAS = {
|
|
3303
3377
|
getOrganisationDefaults: {},
|
|
3304
3378
|
listGuardrails: {
|
|
3305
|
-
workspace_id:
|
|
3306
|
-
organisation_id:
|
|
3307
|
-
page_size:
|
|
3308
|
-
|
|
3379
|
+
workspace_id: z8.string().optional().describe("Filter guardrails by workspace ID"),
|
|
3380
|
+
organisation_id: z8.string().optional().describe("Filter guardrails by organization ID"),
|
|
3381
|
+
page_size: PageSizeSchema.describe(
|
|
3382
|
+
"Number of items per page (1-100, default: 100)"
|
|
3383
|
+
),
|
|
3384
|
+
current_page: CurrentPageSchema
|
|
3309
3385
|
},
|
|
3310
3386
|
getGuardrail: {
|
|
3311
|
-
guardrail_id:
|
|
3387
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
|
|
3312
3388
|
},
|
|
3313
3389
|
createGuardrail: {
|
|
3314
|
-
name:
|
|
3315
|
-
checks:
|
|
3390
|
+
name: z8.string().describe("Name of the guardrail"),
|
|
3391
|
+
checks: z8.array(guardrailCheckSchema).min(1).describe("Array of checks to apply (at least one required)"),
|
|
3316
3392
|
actions: guardrailActionSchema.describe(
|
|
3317
3393
|
"Actions to take when guardrail checks pass or fail"
|
|
3318
3394
|
),
|
|
3319
|
-
workspace_id:
|
|
3320
|
-
organisation_id:
|
|
3395
|
+
workspace_id: z8.string().optional().describe("Workspace ID to create the guardrail in"),
|
|
3396
|
+
organisation_id: z8.string().optional().describe("Organisation ID (required if workspace_id not provided)")
|
|
3321
3397
|
},
|
|
3322
3398
|
updateGuardrail: {
|
|
3323
|
-
guardrail_id:
|
|
3324
|
-
name:
|
|
3325
|
-
checks:
|
|
3399
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug to update"),
|
|
3400
|
+
name: z8.string().optional().describe("New name for the guardrail"),
|
|
3401
|
+
checks: z8.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
|
|
3326
3402
|
actions: guardrailActionSchema.optional().describe("Updated actions configuration")
|
|
3327
3403
|
},
|
|
3328
3404
|
deleteGuardrail: {
|
|
3329
|
-
guardrail_id:
|
|
3405
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug to delete")
|
|
3330
3406
|
},
|
|
3331
3407
|
updateOrganisationDefaults: {
|
|
3332
|
-
input_guardrails:
|
|
3333
|
-
output_guardrails:
|
|
3408
|
+
input_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
|
|
3409
|
+
output_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
|
|
3334
3410
|
},
|
|
3335
3411
|
listWorkspaceExclusions: {
|
|
3336
|
-
organisation_id:
|
|
3412
|
+
organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be listed")
|
|
3337
3413
|
},
|
|
3338
3414
|
updateWorkspaceExclusions: {
|
|
3339
|
-
organisation_id:
|
|
3340
|
-
workspaces:
|
|
3341
|
-
override_existing:
|
|
3415
|
+
organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be updated"),
|
|
3416
|
+
workspaces: z8.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
|
|
3417
|
+
override_existing: z8.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
|
|
3342
3418
|
}
|
|
3343
3419
|
};
|
|
3344
3420
|
var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
|
|
@@ -3540,7 +3616,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3540
3616
|
}
|
|
3541
3617
|
|
|
3542
3618
|
// src/tools/integrations.tools.ts
|
|
3543
|
-
import { z as
|
|
3619
|
+
import { z as z10 } from "zod";
|
|
3544
3620
|
|
|
3545
3621
|
// src/lib/limits.ts
|
|
3546
3622
|
var PERIODIC_RESET_DEFAULT = "monthly";
|
|
@@ -3583,25 +3659,25 @@ function buildRateLimits(params) {
|
|
|
3583
3659
|
}
|
|
3584
3660
|
|
|
3585
3661
|
// src/tools/secret-mapping.schemas.ts
|
|
3586
|
-
import { z as
|
|
3662
|
+
import { z as z9 } from "zod";
|
|
3587
3663
|
function createSecretMappingSchema({
|
|
3588
3664
|
allowKeyTarget,
|
|
3589
3665
|
targetFieldDescription,
|
|
3590
3666
|
secretReferenceDescription,
|
|
3591
3667
|
valueFormatDescription
|
|
3592
3668
|
}) {
|
|
3593
|
-
return
|
|
3594
|
-
target_field:
|
|
3669
|
+
return z9.object({
|
|
3670
|
+
target_field: z9.string().refine(
|
|
3595
3671
|
(value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
|
|
3596
3672
|
allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
|
|
3597
3673
|
).describe(targetFieldDescription),
|
|
3598
|
-
secret_reference_id:
|
|
3599
|
-
secret_key:
|
|
3600
|
-
value_format:
|
|
3674
|
+
secret_reference_id: z9.string().describe(secretReferenceDescription),
|
|
3675
|
+
secret_key: z9.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
|
|
3676
|
+
value_format: z9.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
|
|
3601
3677
|
});
|
|
3602
3678
|
}
|
|
3603
3679
|
function uniqueSecretMappingsSchema(itemSchema) {
|
|
3604
|
-
return
|
|
3680
|
+
return z9.array(itemSchema).superRefine((mappings, context) => {
|
|
3605
3681
|
const firstIndexByTarget = /* @__PURE__ */ new Map();
|
|
3606
3682
|
for (const [index, mapping] of mappings.entries()) {
|
|
3607
3683
|
const firstIndex = firstIndexByTarget.get(mapping.target_field);
|
|
@@ -3628,8 +3704,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
|
|
|
3628
3704
|
var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
3629
3705
|
integrationSecretMappingSchema
|
|
3630
3706
|
);
|
|
3631
|
-
var nullableMultiplier = (description) =>
|
|
3632
|
-
var pricingMultiplierSchema =
|
|
3707
|
+
var nullableMultiplier = (description) => z10.coerce.number().nonnegative().nullable().optional().describe(description);
|
|
3708
|
+
var pricingMultiplierSchema = z10.object({
|
|
3633
3709
|
default: nullableMultiplier(
|
|
3634
3710
|
"Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
|
|
3635
3711
|
),
|
|
@@ -3673,69 +3749,71 @@ var pricingMultiplierSchema = z9.object({
|
|
|
3673
3749
|
cache_write_image_input_token: nullableMultiplier(
|
|
3674
3750
|
"Cache-write image input token price multiplier"
|
|
3675
3751
|
),
|
|
3676
|
-
image:
|
|
3752
|
+
image: z10.object({
|
|
3677
3753
|
default: nullableMultiplier("Default image-generation price multiplier")
|
|
3678
3754
|
}).nullable().optional().describe("Image-generation pricing multipliers"),
|
|
3679
|
-
additional_units:
|
|
3755
|
+
additional_units: z10.record(z10.string(), z10.coerce.number().nonnegative().nullable()).nullable().optional().describe(
|
|
3680
3756
|
"Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
|
|
3681
3757
|
)
|
|
3682
3758
|
});
|
|
3683
|
-
var pricingAdjustmentsSchema =
|
|
3759
|
+
var pricingAdjustmentsSchema = z10.object({
|
|
3684
3760
|
multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
|
|
3685
3761
|
}).nullable();
|
|
3686
|
-
var modelConfigurationsSchema =
|
|
3687
|
-
custom_host:
|
|
3688
|
-
custom_headers:
|
|
3762
|
+
var modelConfigurationsSchema = z10.object({
|
|
3763
|
+
custom_host: z10.string().url().optional().describe("Custom upstream URL used only for this model"),
|
|
3764
|
+
custom_headers: z10.record(z10.string(), z10.string()).optional().describe("Headers sent only for this model; values may contain secrets")
|
|
3689
3765
|
});
|
|
3690
|
-
var tokenPricingSchema =
|
|
3691
|
-
price:
|
|
3766
|
+
var tokenPricingSchema = z10.object({
|
|
3767
|
+
price: z10.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
|
|
3692
3768
|
});
|
|
3693
|
-
var integrationModelPricingSchema =
|
|
3694
|
-
type:
|
|
3695
|
-
pay_as_you_go:
|
|
3769
|
+
var integrationModelPricingSchema = z10.object({
|
|
3770
|
+
type: z10.literal("static").describe("Static per-token pricing configuration"),
|
|
3771
|
+
pay_as_you_go: z10.object({
|
|
3696
3772
|
request_token: tokenPricingSchema.optional().describe("Input token pricing"),
|
|
3697
3773
|
response_token: tokenPricingSchema.optional().describe("Output token pricing")
|
|
3698
3774
|
}).optional().describe("Pay-as-you-go rates for this integration model")
|
|
3699
3775
|
});
|
|
3700
3776
|
var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
3701
3777
|
getModelPricing: {
|
|
3702
|
-
provider:
|
|
3778
|
+
provider: z10.string().describe(
|
|
3703
3779
|
"Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
|
|
3704
3780
|
),
|
|
3705
|
-
model:
|
|
3781
|
+
model: z10.string().describe("Exact provider model identifier, such as gpt-4o")
|
|
3706
3782
|
},
|
|
3707
3783
|
listIntegrations: {
|
|
3708
|
-
current_page:
|
|
3709
|
-
page_size:
|
|
3710
|
-
|
|
3711
|
-
|
|
3784
|
+
current_page: CurrentPageSchema,
|
|
3785
|
+
page_size: PageSizeSchema.describe(
|
|
3786
|
+
"Number of results per page (default 100, max 100)"
|
|
3787
|
+
),
|
|
3788
|
+
workspace_id: z10.string().optional().describe("Filter integrations accessible by a specific workspace"),
|
|
3789
|
+
type: z10.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
3712
3790
|
"Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
|
|
3713
3791
|
)
|
|
3714
3792
|
},
|
|
3715
3793
|
createIntegration: {
|
|
3716
|
-
name:
|
|
3717
|
-
ai_provider_id:
|
|
3794
|
+
name: z10.string().describe("Human-readable name for the integration"),
|
|
3795
|
+
ai_provider_id: z10.string().describe(
|
|
3718
3796
|
"ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
|
|
3719
3797
|
),
|
|
3720
|
-
slug:
|
|
3798
|
+
slug: z10.string().optional().describe(
|
|
3721
3799
|
"URL-friendly identifier (auto-generated from name if not provided)"
|
|
3722
3800
|
),
|
|
3723
|
-
key:
|
|
3724
|
-
description:
|
|
3725
|
-
workspace_id:
|
|
3726
|
-
api_version:
|
|
3727
|
-
resource_name:
|
|
3728
|
-
deployment_name:
|
|
3729
|
-
aws_region:
|
|
3730
|
-
aws_access_key_id:
|
|
3731
|
-
aws_secret_access_key:
|
|
3732
|
-
vertex_project_id:
|
|
3733
|
-
vertex_region:
|
|
3734
|
-
custom_host:
|
|
3735
|
-
create_default_provider:
|
|
3801
|
+
key: z10.string().optional().describe("API key for the provider (if required)"),
|
|
3802
|
+
description: z10.string().optional().describe("Optional description of the integration"),
|
|
3803
|
+
workspace_id: z10.string().optional().describe("Workspace ID for workspace-scoped integrations"),
|
|
3804
|
+
api_version: z10.string().optional().describe("API version (for Azure OpenAI)"),
|
|
3805
|
+
resource_name: z10.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
3806
|
+
deployment_name: z10.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
3807
|
+
aws_region: z10.string().optional().describe("AWS region (for AWS Bedrock)"),
|
|
3808
|
+
aws_access_key_id: z10.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
|
|
3809
|
+
aws_secret_access_key: z10.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
|
|
3810
|
+
vertex_project_id: z10.string().optional().describe("GCP project ID (for Vertex AI)"),
|
|
3811
|
+
vertex_region: z10.string().optional().describe("GCP region (for Vertex AI)"),
|
|
3812
|
+
custom_host: z10.string().optional().describe("Custom base URL for the provider"),
|
|
3813
|
+
create_default_provider: z10.boolean().optional().describe(
|
|
3736
3814
|
"Create a provider automatically for a workspace-scoped integration; defaults to true"
|
|
3737
3815
|
),
|
|
3738
|
-
default_provider_slug:
|
|
3816
|
+
default_provider_slug: z10.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
|
|
3739
3817
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3740
3818
|
"Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
|
|
3741
3819
|
),
|
|
@@ -3744,22 +3822,22 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
3744
3822
|
)
|
|
3745
3823
|
},
|
|
3746
3824
|
getIntegration: {
|
|
3747
|
-
slug:
|
|
3825
|
+
slug: z10.string().describe("The unique slug identifier of the integration to retrieve")
|
|
3748
3826
|
},
|
|
3749
3827
|
updateIntegration: {
|
|
3750
|
-
slug:
|
|
3751
|
-
name:
|
|
3752
|
-
key:
|
|
3753
|
-
description:
|
|
3754
|
-
api_version:
|
|
3755
|
-
resource_name:
|
|
3756
|
-
deployment_name:
|
|
3757
|
-
aws_region:
|
|
3758
|
-
aws_access_key_id:
|
|
3759
|
-
aws_secret_access_key:
|
|
3760
|
-
vertex_project_id:
|
|
3761
|
-
vertex_region:
|
|
3762
|
-
custom_host:
|
|
3828
|
+
slug: z10.string().describe("The slug of the integration to update"),
|
|
3829
|
+
name: z10.string().optional().describe("New human-readable name for the integration"),
|
|
3830
|
+
key: z10.string().optional().describe("New API key for the provider"),
|
|
3831
|
+
description: z10.string().optional().describe("New description for the integration"),
|
|
3832
|
+
api_version: z10.string().optional().describe("New API version (for Azure OpenAI)"),
|
|
3833
|
+
resource_name: z10.string().optional().describe("New resource name (for Azure OpenAI)"),
|
|
3834
|
+
deployment_name: z10.string().optional().describe("New deployment name (for Azure OpenAI)"),
|
|
3835
|
+
aws_region: z10.string().optional().describe("New AWS region (for AWS Bedrock)"),
|
|
3836
|
+
aws_access_key_id: z10.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
|
|
3837
|
+
aws_secret_access_key: z10.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
|
|
3838
|
+
vertex_project_id: z10.string().optional().describe("New GCP project ID (for Vertex AI)"),
|
|
3839
|
+
vertex_region: z10.string().optional().describe("New GCP region (for Vertex AI)"),
|
|
3840
|
+
custom_host: z10.string().optional().describe("New custom base URL for the provider"),
|
|
3763
3841
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3764
3842
|
"Replacement runtime Secret Reference mappings; each target_field must be unique"
|
|
3765
3843
|
),
|
|
@@ -3768,78 +3846,78 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
3768
3846
|
)
|
|
3769
3847
|
},
|
|
3770
3848
|
deleteIntegration: {
|
|
3771
|
-
slug:
|
|
3849
|
+
slug: z10.string().describe("The slug of the integration to delete")
|
|
3772
3850
|
},
|
|
3773
3851
|
listIntegrationModels: {
|
|
3774
|
-
slug:
|
|
3775
|
-
current_page:
|
|
3776
|
-
page_size:
|
|
3852
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3853
|
+
current_page: CurrentPageSchema,
|
|
3854
|
+
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3777
3855
|
},
|
|
3778
3856
|
updateIntegrationModels: {
|
|
3779
|
-
slug:
|
|
3780
|
-
allow_all_models:
|
|
3857
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3858
|
+
allow_all_models: z10.boolean().optional().describe(
|
|
3781
3859
|
"Whether newly available provider models are enabled by default"
|
|
3782
3860
|
),
|
|
3783
|
-
models:
|
|
3784
|
-
|
|
3785
|
-
slug:
|
|
3786
|
-
model_name:
|
|
3861
|
+
models: z10.array(
|
|
3862
|
+
z10.object({
|
|
3863
|
+
slug: z10.string().describe("The model slug identifier"),
|
|
3864
|
+
model_name: z10.string().optional().describe(
|
|
3787
3865
|
"Display name for the model (required for custom models)"
|
|
3788
3866
|
),
|
|
3789
|
-
enabled:
|
|
3790
|
-
is_custom:
|
|
3791
|
-
is_finetune:
|
|
3792
|
-
base_model_slug:
|
|
3867
|
+
enabled: z10.boolean().describe("Whether the model is enabled"),
|
|
3868
|
+
is_custom: z10.boolean().optional().describe("Whether this is a custom model (default: false)"),
|
|
3869
|
+
is_finetune: z10.boolean().optional().describe("Whether this entry is a fine-tuned model"),
|
|
3870
|
+
base_model_slug: z10.string().optional().describe("Base model slug for a fine-tuned model"),
|
|
3793
3871
|
configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
|
|
3794
3872
|
pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
|
|
3795
3873
|
})
|
|
3796
3874
|
).describe("Array of model configurations to update")
|
|
3797
3875
|
},
|
|
3798
3876
|
deleteIntegrationModel: {
|
|
3799
|
-
slug:
|
|
3800
|
-
model_slug:
|
|
3877
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3878
|
+
model_slug: z10.string().describe("The slug of the model to delete")
|
|
3801
3879
|
},
|
|
3802
3880
|
listIntegrationWorkspaces: {
|
|
3803
|
-
slug:
|
|
3804
|
-
current_page:
|
|
3805
|
-
page_size:
|
|
3881
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3882
|
+
current_page: CurrentPageSchema,
|
|
3883
|
+
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3806
3884
|
},
|
|
3807
3885
|
updateIntegrationWorkspaces: {
|
|
3808
|
-
slug:
|
|
3809
|
-
workspaces:
|
|
3810
|
-
|
|
3811
|
-
id:
|
|
3812
|
-
enabled:
|
|
3813
|
-
credit_limit:
|
|
3814
|
-
alert_threshold:
|
|
3815
|
-
rate_limit_rpm:
|
|
3816
|
-
reset_usage:
|
|
3817
|
-
create_default_provider:
|
|
3886
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3887
|
+
workspaces: z10.array(
|
|
3888
|
+
z10.object({
|
|
3889
|
+
id: z10.string().describe("The workspace ID"),
|
|
3890
|
+
enabled: z10.boolean().describe("Whether the workspace has access to this integration"),
|
|
3891
|
+
credit_limit: z10.coerce.number().positive().optional().describe("Credit limit for this workspace"),
|
|
3892
|
+
alert_threshold: z10.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
3893
|
+
rate_limit_rpm: z10.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
3894
|
+
reset_usage: z10.boolean().optional().describe("Reset exhausted usage status to active"),
|
|
3895
|
+
create_default_provider: z10.boolean().optional().describe(
|
|
3818
3896
|
"Override whether a provider is auto-created for this workspace"
|
|
3819
3897
|
),
|
|
3820
|
-
default_provider_slug:
|
|
3898
|
+
default_provider_slug: z10.string().optional().describe(
|
|
3821
3899
|
"Override the auto-created provider slug for this workspace"
|
|
3822
3900
|
)
|
|
3823
3901
|
})
|
|
3824
3902
|
).describe("Array of workspace configurations to update"),
|
|
3825
|
-
global_workspace_access_enabled:
|
|
3903
|
+
global_workspace_access_enabled: z10.boolean().optional().describe(
|
|
3826
3904
|
"Enable or disable access for all current and future workspaces"
|
|
3827
3905
|
),
|
|
3828
|
-
global_credit_limit:
|
|
3906
|
+
global_credit_limit: z10.coerce.number().positive().optional().describe(
|
|
3829
3907
|
"Global cost credit limit applied with global workspace access"
|
|
3830
3908
|
),
|
|
3831
|
-
global_alert_threshold:
|
|
3832
|
-
global_rate_limit_rpm:
|
|
3833
|
-
override_existing_workspace_access:
|
|
3834
|
-
create_default_provider:
|
|
3835
|
-
default_provider_slug:
|
|
3909
|
+
global_alert_threshold: z10.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
|
|
3910
|
+
global_rate_limit_rpm: z10.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
|
|
3911
|
+
override_existing_workspace_access: z10.boolean().optional().describe("Apply global settings over existing per-workspace access"),
|
|
3912
|
+
create_default_provider: z10.boolean().optional().describe("Auto-create providers when granting workspace access"),
|
|
3913
|
+
default_provider_slug: z10.string().optional().describe("Default slug for providers auto-created in workspaces")
|
|
3836
3914
|
}
|
|
3837
3915
|
};
|
|
3838
|
-
var updateIntegrationWorkspacesSchema =
|
|
3916
|
+
var updateIntegrationWorkspacesSchema = z10.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
|
|
3839
3917
|
const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
|
|
3840
3918
|
if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
|
|
3841
3919
|
ctx.addIssue({
|
|
3842
|
-
code:
|
|
3920
|
+
code: z10.ZodIssueCode.custom,
|
|
3843
3921
|
path: ["global_workspace_access_enabled"],
|
|
3844
3922
|
message: "global_workspace_access_enabled is required when setting global limits."
|
|
3845
3923
|
});
|
|
@@ -4171,31 +4249,31 @@ function registerIntegrationsTools(server, service) {
|
|
|
4171
4249
|
}
|
|
4172
4250
|
|
|
4173
4251
|
// src/tools/keys.tools.ts
|
|
4174
|
-
import { z as
|
|
4175
|
-
var virtualKeySecretMappingSchema =
|
|
4176
|
-
target_field:
|
|
4252
|
+
import { z as z11 } from "zod";
|
|
4253
|
+
var virtualKeySecretMappingSchema = z11.object({
|
|
4254
|
+
target_field: z11.string().refine(
|
|
4177
4255
|
(value) => value === "key" || value.startsWith("model_config."),
|
|
4178
4256
|
"target_field must be 'key' or start with 'model_config.'"
|
|
4179
4257
|
).describe("Virtual Key field populated from the Secret Reference"),
|
|
4180
|
-
secret_reference_id:
|
|
4181
|
-
secret_key:
|
|
4182
|
-
value_format:
|
|
4258
|
+
secret_reference_id: z11.string().describe("Secret Reference ID that owns the external secret"),
|
|
4259
|
+
secret_key: z11.string().nullable().optional().describe("Optional key selected from a structured external secret"),
|
|
4260
|
+
value_format: z11.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
|
|
4183
4261
|
});
|
|
4184
|
-
var virtualKeyDeploymentSchema =
|
|
4185
|
-
api_version:
|
|
4186
|
-
deployment_name:
|
|
4187
|
-
alias:
|
|
4188
|
-
is_default:
|
|
4262
|
+
var virtualKeyDeploymentSchema = z11.object({
|
|
4263
|
+
api_version: z11.string().min(1).describe("Azure OpenAI API version"),
|
|
4264
|
+
deployment_name: z11.string().min(1).describe("Azure deployment name"),
|
|
4265
|
+
alias: z11.string().optional().describe("Optional model alias for the deployment"),
|
|
4266
|
+
is_default: z11.boolean().optional().describe("Whether this is the default Azure deployment")
|
|
4189
4267
|
});
|
|
4190
|
-
var apiKeyRateLimitSchema =
|
|
4191
|
-
type:
|
|
4192
|
-
unit:
|
|
4193
|
-
value:
|
|
4268
|
+
var apiKeyRateLimitSchema = z11.object({
|
|
4269
|
+
type: z11.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
|
|
4270
|
+
unit: z11.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
|
|
4271
|
+
value: z11.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
|
|
4194
4272
|
});
|
|
4195
|
-
var rotationPolicySchema =
|
|
4196
|
-
rotation_period:
|
|
4197
|
-
next_rotation_at:
|
|
4198
|
-
key_transition_period_ms:
|
|
4273
|
+
var rotationPolicySchema = z11.object({
|
|
4274
|
+
rotation_period: z11.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
|
|
4275
|
+
next_rotation_at: z11.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
|
|
4276
|
+
key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
|
|
4199
4277
|
}).superRefine((value, context) => {
|
|
4200
4278
|
if (value.rotation_period && value.next_rotation_at) {
|
|
4201
4279
|
context.addIssue({
|
|
@@ -4207,112 +4285,112 @@ var rotationPolicySchema = z10.object({
|
|
|
4207
4285
|
}).describe("Automatic API-key rotation policy, or null to remove it");
|
|
4208
4286
|
var KEYS_TOOL_SCHEMAS = {
|
|
4209
4287
|
listVirtualKeys: {
|
|
4210
|
-
current_page:
|
|
4211
|
-
page_size:
|
|
4288
|
+
current_page: CurrentPageSchema,
|
|
4289
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
4212
4290
|
},
|
|
4213
4291
|
createVirtualKey: {
|
|
4214
|
-
name:
|
|
4215
|
-
provider:
|
|
4292
|
+
name: z11.string().describe("Display name for the virtual key"),
|
|
4293
|
+
provider: z11.string().describe(
|
|
4216
4294
|
"Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
|
|
4217
4295
|
),
|
|
4218
|
-
key:
|
|
4219
|
-
note:
|
|
4220
|
-
workspace_id:
|
|
4221
|
-
api_version:
|
|
4222
|
-
resource_name:
|
|
4223
|
-
deployment_name:
|
|
4224
|
-
deployment_configurations:
|
|
4296
|
+
key: z11.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
|
|
4297
|
+
note: z11.string().optional().describe("Optional note or description for this key"),
|
|
4298
|
+
workspace_id: z11.string().optional().describe("Workspace ID to create the key in"),
|
|
4299
|
+
api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4300
|
+
resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4301
|
+
deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4302
|
+
deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe(
|
|
4225
4303
|
"Azure deployment configurations with API versions and aliases"
|
|
4226
4304
|
),
|
|
4227
|
-
expires_at:
|
|
4228
|
-
secret_mappings:
|
|
4229
|
-
credit_limit:
|
|
4230
|
-
alert_threshold:
|
|
4305
|
+
expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
|
|
4306
|
+
secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
|
|
4307
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
|
|
4308
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe(
|
|
4231
4309
|
"Percentage of credit_limit at which to send alert emails (0-100)"
|
|
4232
4310
|
),
|
|
4233
|
-
rate_limit_rpm:
|
|
4311
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Requests per minute limit")
|
|
4234
4312
|
},
|
|
4235
4313
|
getVirtualKey: {
|
|
4236
|
-
slug:
|
|
4314
|
+
slug: z11.string().describe("The unique slug identifier of the virtual key to retrieve")
|
|
4237
4315
|
},
|
|
4238
4316
|
updateVirtualKey: {
|
|
4239
|
-
slug:
|
|
4240
|
-
name:
|
|
4241
|
-
key:
|
|
4242
|
-
note:
|
|
4243
|
-
credit_limit:
|
|
4244
|
-
alert_threshold:
|
|
4245
|
-
rate_limit_rpm:
|
|
4246
|
-
deployment_configurations:
|
|
4247
|
-
secret_mappings:
|
|
4317
|
+
slug: z11.string().describe("The slug of the virtual key to update"),
|
|
4318
|
+
name: z11.string().optional().describe("New display name for the key"),
|
|
4319
|
+
key: z11.string().optional().describe("New provider API key value"),
|
|
4320
|
+
note: z11.string().optional().describe("New note or description"),
|
|
4321
|
+
credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4322
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4323
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4324
|
+
deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
|
|
4325
|
+
secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
|
|
4248
4326
|
},
|
|
4249
4327
|
deleteVirtualKey: {
|
|
4250
|
-
slug:
|
|
4328
|
+
slug: z11.string().describe("The slug of the virtual key to delete")
|
|
4251
4329
|
},
|
|
4252
4330
|
createApiKey: {
|
|
4253
|
-
type:
|
|
4331
|
+
type: z11.enum(["organisation", "workspace"]).describe(
|
|
4254
4332
|
"Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
|
|
4255
4333
|
),
|
|
4256
|
-
sub_type:
|
|
4334
|
+
sub_type: z11.enum(["user", "service"]).describe(
|
|
4257
4335
|
"Sub-type: 'user' for user-associated keys or 'service' for service accounts"
|
|
4258
4336
|
),
|
|
4259
|
-
name:
|
|
4260
|
-
description:
|
|
4261
|
-
organisation_id:
|
|
4262
|
-
workspace_id:
|
|
4263
|
-
user_id:
|
|
4264
|
-
scopes:
|
|
4337
|
+
name: z11.string().describe("Display name for the API key"),
|
|
4338
|
+
description: z11.string().optional().describe("Optional description for the key"),
|
|
4339
|
+
organisation_id: z11.string().optional().describe("Organisation UUID"),
|
|
4340
|
+
workspace_id: z11.string().optional().describe("Workspace ID (required for workspace-type keys)"),
|
|
4341
|
+
user_id: z11.string().optional().describe("User ID (required for user sub-type keys)"),
|
|
4342
|
+
scopes: z11.array(z11.string()).describe(
|
|
4265
4343
|
"Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
|
|
4266
4344
|
),
|
|
4267
|
-
credit_limit:
|
|
4268
|
-
alert_threshold:
|
|
4269
|
-
rate_limit_rpm:
|
|
4270
|
-
rate_limits:
|
|
4271
|
-
default_config_id:
|
|
4272
|
-
default_metadata:
|
|
4273
|
-
default_allow_config_override:
|
|
4274
|
-
alert_emails:
|
|
4275
|
-
expires_at:
|
|
4345
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
4346
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4347
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4348
|
+
rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
|
|
4349
|
+
default_config_id: z11.string().optional().describe("Default configuration ID to use with this key"),
|
|
4350
|
+
default_metadata: z11.record(z11.string(), z11.string()).optional().describe("Default metadata key-value pairs"),
|
|
4351
|
+
default_allow_config_override: z11.boolean().optional().describe("Allow callers to override the default config"),
|
|
4352
|
+
alert_emails: z11.array(z11.string()).optional().describe("Email addresses for alerts"),
|
|
4353
|
+
expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
|
|
4276
4354
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
|
|
4277
4355
|
},
|
|
4278
4356
|
listApiKeys: {
|
|
4279
|
-
page_size:
|
|
4280
|
-
current_page:
|
|
4281
|
-
workspace_id:
|
|
4357
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
4358
|
+
current_page: CurrentPageSchema,
|
|
4359
|
+
workspace_id: z11.string().optional().describe("Filter by workspace ID")
|
|
4282
4360
|
},
|
|
4283
4361
|
getApiKey: {
|
|
4284
|
-
id:
|
|
4362
|
+
id: z11.string().uuid().describe("The UUID of the API key to retrieve")
|
|
4285
4363
|
},
|
|
4286
4364
|
updateApiKey: {
|
|
4287
|
-
id:
|
|
4288
|
-
name:
|
|
4289
|
-
description:
|
|
4290
|
-
scopes:
|
|
4291
|
-
credit_limit:
|
|
4292
|
-
alert_threshold:
|
|
4293
|
-
rate_limit_rpm:
|
|
4294
|
-
rate_limits:
|
|
4295
|
-
reset_usage:
|
|
4296
|
-
default_config_id:
|
|
4297
|
-
default_metadata:
|
|
4298
|
-
default_allow_config_override:
|
|
4299
|
-
alert_emails:
|
|
4300
|
-
expires_at:
|
|
4365
|
+
id: z11.string().uuid().describe("The UUID of the API key to update"),
|
|
4366
|
+
name: z11.string().optional().describe("New display name for the key"),
|
|
4367
|
+
description: z11.string().optional().describe("New description for the key"),
|
|
4368
|
+
scopes: z11.array(z11.string()).optional().describe("New permission scopes for the key"),
|
|
4369
|
+
credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4370
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4371
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4372
|
+
rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
|
|
4373
|
+
reset_usage: z11.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
|
|
4374
|
+
default_config_id: z11.string().optional().describe("New default configuration ID"),
|
|
4375
|
+
default_metadata: z11.record(z11.string(), z11.string()).optional().describe("New default metadata key-value pairs"),
|
|
4376
|
+
default_allow_config_override: z11.boolean().optional().describe("Whether callers may override the key's default config"),
|
|
4377
|
+
alert_emails: z11.array(z11.string()).optional().describe("New email addresses for alerts"),
|
|
4378
|
+
expires_at: z11.iso.datetime({ offset: true }).nullable().optional().describe(
|
|
4301
4379
|
"New expiration date in ISO 8601 format, or null to remove expiration"
|
|
4302
4380
|
),
|
|
4303
4381
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
|
|
4304
4382
|
},
|
|
4305
4383
|
rotateApiKey: {
|
|
4306
|
-
id:
|
|
4307
|
-
key_transition_period_ms:
|
|
4384
|
+
id: z11.string().uuid().describe("API key UUID obtained from list_api_keys"),
|
|
4385
|
+
key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe(
|
|
4308
4386
|
"Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
|
|
4309
4387
|
)
|
|
4310
4388
|
},
|
|
4311
4389
|
deleteApiKey: {
|
|
4312
|
-
id:
|
|
4390
|
+
id: z11.string().uuid().describe("The UUID of the API key to delete")
|
|
4313
4391
|
}
|
|
4314
4392
|
};
|
|
4315
|
-
var createVirtualKeySchema =
|
|
4393
|
+
var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
|
|
4316
4394
|
if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
|
|
4317
4395
|
context.addIssue({
|
|
4318
4396
|
code: "custom",
|
|
@@ -4321,17 +4399,17 @@ var createVirtualKeySchema = z10.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
|
|
|
4321
4399
|
});
|
|
4322
4400
|
}
|
|
4323
4401
|
});
|
|
4324
|
-
var createApiKeySchema =
|
|
4402
|
+
var createApiKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
|
|
4325
4403
|
if (value.type === "workspace" && !value.workspace_id) {
|
|
4326
4404
|
ctx.addIssue({
|
|
4327
|
-
code:
|
|
4405
|
+
code: z11.ZodIssueCode.custom,
|
|
4328
4406
|
path: ["workspace_id"],
|
|
4329
4407
|
message: "workspace_id is required when type is 'workspace'"
|
|
4330
4408
|
});
|
|
4331
4409
|
}
|
|
4332
4410
|
if (value.sub_type === "user" && !value.user_id) {
|
|
4333
4411
|
ctx.addIssue({
|
|
4334
|
-
code:
|
|
4412
|
+
code: z11.ZodIssueCode.custom,
|
|
4335
4413
|
path: ["user_id"],
|
|
4336
4414
|
message: "user_id is required when sub_type is 'user'"
|
|
4337
4415
|
});
|
|
@@ -4654,43 +4732,43 @@ function registerKeysTools(server, service) {
|
|
|
4654
4732
|
}
|
|
4655
4733
|
|
|
4656
4734
|
// src/tools/labels.tools.ts
|
|
4657
|
-
import { z as
|
|
4735
|
+
import { z as z12 } from "zod";
|
|
4658
4736
|
var LABELS_TOOL_SCHEMAS = {
|
|
4659
4737
|
createPromptLabel: {
|
|
4660
|
-
name:
|
|
4661
|
-
organisation_id:
|
|
4662
|
-
workspace_id:
|
|
4663
|
-
description:
|
|
4664
|
-
color_code:
|
|
4738
|
+
name: z12.string().describe("Name of the label"),
|
|
4739
|
+
organisation_id: z12.string().optional().describe("Organisation ID to create the label in"),
|
|
4740
|
+
workspace_id: z12.string().optional().describe("Workspace ID to create the label in"),
|
|
4741
|
+
description: z12.string().optional().describe("Description of the label"),
|
|
4742
|
+
color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
|
|
4665
4743
|
"Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
|
|
4666
4744
|
)
|
|
4667
4745
|
},
|
|
4668
4746
|
listPromptLabels: {
|
|
4669
|
-
organisation_id:
|
|
4670
|
-
workspace_id:
|
|
4671
|
-
search:
|
|
4672
|
-
current_page:
|
|
4673
|
-
page_size:
|
|
4747
|
+
organisation_id: z12.string().optional().describe("Filter by organisation ID"),
|
|
4748
|
+
workspace_id: z12.string().optional().describe("Filter by workspace ID"),
|
|
4749
|
+
search: z12.string().optional().describe("Search labels by name"),
|
|
4750
|
+
current_page: CurrentPageSchema,
|
|
4751
|
+
page_size: PageSizeSchema
|
|
4674
4752
|
},
|
|
4675
4753
|
getPromptLabel: {
|
|
4676
|
-
label_id:
|
|
4677
|
-
organisation_id:
|
|
4678
|
-
workspace_id:
|
|
4754
|
+
label_id: z12.string().describe("Label ID to retrieve"),
|
|
4755
|
+
organisation_id: z12.string().optional().describe("Organisation ID for filtering"),
|
|
4756
|
+
workspace_id: z12.string().optional().describe("Workspace ID for filtering")
|
|
4679
4757
|
},
|
|
4680
4758
|
updatePromptLabel: {
|
|
4681
|
-
label_id:
|
|
4682
|
-
name:
|
|
4683
|
-
description:
|
|
4684
|
-
color_code:
|
|
4759
|
+
label_id: z12.string().describe("Label ID to update"),
|
|
4760
|
+
name: z12.string().optional().describe("New name for the label"),
|
|
4761
|
+
description: z12.string().optional().describe("New description"),
|
|
4762
|
+
color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
|
|
4685
4763
|
},
|
|
4686
4764
|
deletePromptLabel: {
|
|
4687
|
-
label_id:
|
|
4765
|
+
label_id: z12.string().describe("Label ID to delete")
|
|
4688
4766
|
}
|
|
4689
4767
|
};
|
|
4690
|
-
var createPromptLabelSchema =
|
|
4768
|
+
var createPromptLabelSchema = z12.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
|
|
4691
4769
|
if (!value.organisation_id && !value.workspace_id) {
|
|
4692
4770
|
ctx.addIssue({
|
|
4693
|
-
code:
|
|
4771
|
+
code: z12.ZodIssueCode.custom,
|
|
4694
4772
|
message: "Either organisation_id or workspace_id is required"
|
|
4695
4773
|
});
|
|
4696
4774
|
}
|
|
@@ -4787,13 +4865,13 @@ function registerLabelsTools(server, service) {
|
|
|
4787
4865
|
}
|
|
4788
4866
|
|
|
4789
4867
|
// src/tools/limits.tools.ts
|
|
4790
|
-
import { z as
|
|
4791
|
-
var statusSchema =
|
|
4792
|
-
var rateUnitSchema =
|
|
4793
|
-
var rateTargetSchema =
|
|
4794
|
-
var conditionValueSchema =
|
|
4795
|
-
var conditionSchema =
|
|
4796
|
-
key:
|
|
4868
|
+
import { z as z13 } from "zod";
|
|
4869
|
+
var statusSchema = z13.enum(["active", "archived"]);
|
|
4870
|
+
var rateUnitSchema = z13.enum(["rpm", "rph", "rpd", "rpw"]);
|
|
4871
|
+
var rateTargetSchema = z13.enum(["llm", "mcp_tools"]);
|
|
4872
|
+
var conditionValueSchema = z13.union([z13.string(), z13.array(z13.string()).min(1)]);
|
|
4873
|
+
var conditionSchema = z13.object({
|
|
4874
|
+
key: z13.string().min(1).describe(
|
|
4797
4875
|
"Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
|
|
4798
4876
|
),
|
|
4799
4877
|
value: conditionValueSchema.describe(
|
|
@@ -4801,92 +4879,92 @@ var conditionSchema = z12.object({
|
|
|
4801
4879
|
),
|
|
4802
4880
|
excludes: conditionValueSchema.optional().describe("Values to exclude")
|
|
4803
4881
|
});
|
|
4804
|
-
var groupBySchema =
|
|
4805
|
-
key:
|
|
4882
|
+
var groupBySchema = z13.object({
|
|
4883
|
+
key: z13.string().min(1).describe(
|
|
4806
4884
|
"Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
|
|
4807
4885
|
)
|
|
4808
4886
|
});
|
|
4809
4887
|
var paginationSchema = {
|
|
4810
|
-
page_size:
|
|
4811
|
-
current_page:
|
|
4888
|
+
page_size: PageSizeSchema.describe("Number of policies to return per page"),
|
|
4889
|
+
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
4812
4890
|
};
|
|
4813
4891
|
var LIMITS_TOOL_SCHEMAS = {
|
|
4814
4892
|
listRateLimits: {
|
|
4815
|
-
workspace_id:
|
|
4893
|
+
workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
|
|
4816
4894
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
4817
|
-
type:
|
|
4895
|
+
type: z13.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
|
|
4818
4896
|
unit: rateUnitSchema.optional().describe("Filter by reset interval"),
|
|
4819
4897
|
target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
|
|
4820
4898
|
...paginationSchema
|
|
4821
4899
|
},
|
|
4822
4900
|
getRateLimit: {
|
|
4823
|
-
id:
|
|
4901
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID"),
|
|
4824
4902
|
status: statusSchema.optional().describe("Include an archived policy by status")
|
|
4825
4903
|
},
|
|
4826
4904
|
createRateLimit: {
|
|
4827
|
-
conditions:
|
|
4828
|
-
group_by:
|
|
4829
|
-
type:
|
|
4905
|
+
conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
4906
|
+
group_by: z13.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
|
|
4907
|
+
type: z13.enum(["requests", "tokens"]).describe("Counter type"),
|
|
4830
4908
|
unit: rateUnitSchema.describe("Counter reset interval"),
|
|
4831
|
-
value:
|
|
4832
|
-
name:
|
|
4909
|
+
value: z13.coerce.number().nonnegative().describe("Maximum requests or tokens"),
|
|
4910
|
+
name: z13.string().optional().describe("Optional policy display name"),
|
|
4833
4911
|
target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
|
|
4834
|
-
workspace_id:
|
|
4835
|
-
organisation_id:
|
|
4912
|
+
workspace_id: z13.string().optional().describe("Workspace UUID scope"),
|
|
4913
|
+
organisation_id: z13.string().optional().describe("Organisation UUID scope")
|
|
4836
4914
|
},
|
|
4837
4915
|
updateRateLimit: {
|
|
4838
|
-
id:
|
|
4839
|
-
name:
|
|
4916
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID"),
|
|
4917
|
+
name: z13.string().optional().describe("Replacement display name"),
|
|
4840
4918
|
unit: rateUnitSchema.optional().describe("Replacement reset interval"),
|
|
4841
|
-
value:
|
|
4842
|
-
conditions:
|
|
4919
|
+
value: z13.coerce.number().nonnegative().optional().describe("Replacement maximum"),
|
|
4920
|
+
conditions: z13.array(conditionSchema).min(1).optional().describe("Replacement conditions")
|
|
4843
4921
|
},
|
|
4844
4922
|
deleteRateLimit: {
|
|
4845
|
-
id:
|
|
4923
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID to delete")
|
|
4846
4924
|
},
|
|
4847
4925
|
listUsageLimits: {
|
|
4848
|
-
workspace_id:
|
|
4926
|
+
workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
|
|
4849
4927
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
4850
|
-
type:
|
|
4928
|
+
type: z13.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
|
|
4851
4929
|
...paginationSchema
|
|
4852
4930
|
},
|
|
4853
4931
|
getUsageLimit: {
|
|
4854
|
-
id:
|
|
4932
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4855
4933
|
status: statusSchema.optional().describe("Include an archived policy by status"),
|
|
4856
|
-
include_usage:
|
|
4934
|
+
include_usage: z13.boolean().optional().describe("Include per-value usage counters")
|
|
4857
4935
|
},
|
|
4858
4936
|
createUsageLimit: {
|
|
4859
|
-
conditions:
|
|
4860
|
-
group_by:
|
|
4861
|
-
type:
|
|
4862
|
-
credit_limit:
|
|
4863
|
-
name:
|
|
4864
|
-
alert_threshold:
|
|
4865
|
-
periodic_reset:
|
|
4866
|
-
workspace_id:
|
|
4867
|
-
organisation_id:
|
|
4937
|
+
conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
4938
|
+
group_by: z13.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
|
|
4939
|
+
type: z13.enum(["cost", "tokens"]).describe("Budget type"),
|
|
4940
|
+
credit_limit: z13.coerce.number().nonnegative().describe("Maximum cumulative usage"),
|
|
4941
|
+
name: z13.string().optional().describe("Optional policy display name"),
|
|
4942
|
+
alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
|
|
4943
|
+
periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
|
|
4944
|
+
workspace_id: z13.string().optional().describe("Workspace UUID scope"),
|
|
4945
|
+
organisation_id: z13.string().optional().describe("Organisation UUID scope")
|
|
4868
4946
|
},
|
|
4869
4947
|
updateUsageLimit: {
|
|
4870
|
-
id:
|
|
4871
|
-
name:
|
|
4872
|
-
credit_limit:
|
|
4873
|
-
alert_threshold:
|
|
4874
|
-
periodic_reset:
|
|
4875
|
-
reset_usage_for_value:
|
|
4948
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4949
|
+
name: z13.string().optional().describe("Replacement display name"),
|
|
4950
|
+
credit_limit: z13.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
|
|
4951
|
+
alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
|
|
4952
|
+
periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
|
|
4953
|
+
reset_usage_for_value: z13.string().optional().describe("Grouped value whose usage should reset")
|
|
4876
4954
|
},
|
|
4877
4955
|
deleteUsageLimit: {
|
|
4878
|
-
id:
|
|
4956
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID to archive")
|
|
4879
4957
|
},
|
|
4880
4958
|
listUsageLimitEntities: {
|
|
4881
|
-
limit_id:
|
|
4882
|
-
status:
|
|
4883
|
-
search:
|
|
4884
|
-
page_size:
|
|
4885
|
-
current_page:
|
|
4959
|
+
limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4960
|
+
status: z13.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
|
|
4961
|
+
search: z13.string().optional().describe("Search tracked values"),
|
|
4962
|
+
page_size: PageSizeSchema.describe("Number of entities per page"),
|
|
4963
|
+
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
4886
4964
|
},
|
|
4887
4965
|
resetUsageLimitEntity: {
|
|
4888
|
-
limit_id:
|
|
4889
|
-
entity_id:
|
|
4966
|
+
limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4967
|
+
entity_id: z13.string().min(1).describe("Tracked entity UUID to reset")
|
|
4890
4968
|
}
|
|
4891
4969
|
};
|
|
4892
4970
|
function compact2(value) {
|
|
@@ -5019,8 +5097,8 @@ function registerLimitsTools(server, service) {
|
|
|
5019
5097
|
}
|
|
5020
5098
|
|
|
5021
5099
|
// src/tools/logging.tools.ts
|
|
5022
|
-
import { z as
|
|
5023
|
-
var logExportFieldSchema =
|
|
5100
|
+
import { z as z14 } from "zod";
|
|
5101
|
+
var logExportFieldSchema = z14.enum([
|
|
5024
5102
|
"id",
|
|
5025
5103
|
"trace_id",
|
|
5026
5104
|
"created_at",
|
|
@@ -5043,12 +5121,12 @@ var logExportFieldSchema = z13.enum([
|
|
|
5043
5121
|
"metadata"
|
|
5044
5122
|
]);
|
|
5045
5123
|
var getLogShape = {
|
|
5046
|
-
log_id:
|
|
5047
|
-
path_format:
|
|
5048
|
-
created_at:
|
|
5049
|
-
type:
|
|
5124
|
+
log_id: z14.string().describe("Gateway log ID to retrieve"),
|
|
5125
|
+
path_format: z14.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
|
|
5126
|
+
created_at: z14.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
|
|
5127
|
+
type: z14.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
|
|
5050
5128
|
};
|
|
5051
|
-
var getLogSchema =
|
|
5129
|
+
var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
|
|
5052
5130
|
if (input.path_format === "v2" && input.created_at === void 0) {
|
|
5053
5131
|
context.addIssue({
|
|
5054
5132
|
code: "custom",
|
|
@@ -5059,67 +5137,67 @@ var getLogSchema = z13.object(getLogShape).superRefine((input, context) => {
|
|
|
5059
5137
|
});
|
|
5060
5138
|
var LOGGING_TOOL_SCHEMAS = {
|
|
5061
5139
|
getLogExportFieldRestrictions: {
|
|
5062
|
-
workspace_id:
|
|
5140
|
+
workspace_id: z14.string().describe("Workspace ID whose export field restrictions should be read")
|
|
5063
5141
|
},
|
|
5064
5142
|
insertLog: {
|
|
5065
|
-
request_url:
|
|
5066
|
-
request_provider:
|
|
5067
|
-
request_method:
|
|
5068
|
-
request_headers:
|
|
5069
|
-
request_body:
|
|
5070
|
-
response_status:
|
|
5071
|
-
response_headers:
|
|
5072
|
-
response_body:
|
|
5073
|
-
response_time:
|
|
5074
|
-
streaming_mode:
|
|
5075
|
-
metadata_organization:
|
|
5076
|
-
metadata_user:
|
|
5077
|
-
metadata_trace_id:
|
|
5078
|
-
metadata_span_id:
|
|
5079
|
-
metadata_span_name:
|
|
5080
|
-
metadata_parent_span_id:
|
|
5081
|
-
metadata_custom:
|
|
5143
|
+
request_url: z14.string().optional().describe("The endpoint URL being called"),
|
|
5144
|
+
request_provider: z14.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
|
|
5145
|
+
request_method: z14.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
|
|
5146
|
+
request_headers: z14.record(z14.string(), z14.string()).optional().describe("Request headers as key-value pairs"),
|
|
5147
|
+
request_body: z14.record(z14.string(), z14.unknown()).optional().describe("Request payload/body"),
|
|
5148
|
+
response_status: z14.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
|
|
5149
|
+
response_headers: z14.record(z14.string(), z14.string()).optional().describe("Response headers as key-value pairs"),
|
|
5150
|
+
response_body: z14.record(z14.string(), z14.unknown()).optional().describe("Response payload/body"),
|
|
5151
|
+
response_time: z14.coerce.number().optional().describe("Response latency in milliseconds"),
|
|
5152
|
+
streaming_mode: z14.boolean().optional().default(false).describe("Whether the response was streamed"),
|
|
5153
|
+
metadata_organization: z14.string().optional().describe("Organization identifier for the log"),
|
|
5154
|
+
metadata_user: z14.string().optional().describe("User identifier for the log"),
|
|
5155
|
+
metadata_trace_id: z14.string().optional().describe("Trace ID for distributed tracing"),
|
|
5156
|
+
metadata_span_id: z14.string().optional().describe("Span ID for tracing"),
|
|
5157
|
+
metadata_span_name: z14.string().optional().describe("Span name for tracing"),
|
|
5158
|
+
metadata_parent_span_id: z14.string().optional().describe("Parent span ID for tracing"),
|
|
5159
|
+
metadata_custom: z14.record(z14.string(), z14.unknown()).optional().describe("Additional custom metadata key-value pairs")
|
|
5082
5160
|
},
|
|
5083
5161
|
createLogExport: {
|
|
5084
|
-
workspace_id:
|
|
5085
|
-
description:
|
|
5086
|
-
time_min:
|
|
5162
|
+
workspace_id: z14.string().optional().describe("Workspace ID for the export"),
|
|
5163
|
+
description: z14.string().optional().describe("Human-readable description for the export job"),
|
|
5164
|
+
time_min: z14.string().describe(
|
|
5087
5165
|
"Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
|
|
5088
5166
|
),
|
|
5089
|
-
time_max:
|
|
5167
|
+
time_max: z14.string().describe(
|
|
5090
5168
|
"Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
|
|
5091
5169
|
),
|
|
5092
|
-
cost_min:
|
|
5093
|
-
cost_max:
|
|
5094
|
-
total_units_min:
|
|
5095
|
-
total_units_max:
|
|
5096
|
-
ai_model:
|
|
5097
|
-
requested_fields:
|
|
5170
|
+
cost_min: z14.coerce.number().optional().describe("Minimum cost filter"),
|
|
5171
|
+
cost_max: z14.coerce.number().optional().describe("Maximum cost filter"),
|
|
5172
|
+
total_units_min: z14.coerce.number().optional().describe("Minimum total units (tokens) filter"),
|
|
5173
|
+
total_units_max: z14.coerce.number().optional().describe("Maximum total units (tokens) filter"),
|
|
5174
|
+
ai_model: z14.array(z14.string()).optional().describe("Filter by specific AI model names"),
|
|
5175
|
+
requested_fields: z14.array(logExportFieldSchema).describe(
|
|
5098
5176
|
"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"
|
|
5099
5177
|
)
|
|
5100
5178
|
},
|
|
5101
5179
|
listLogExports: {
|
|
5102
|
-
workspace_id:
|
|
5180
|
+
workspace_id: z14.string().describe("Workspace ID to list exports for (required)")
|
|
5103
5181
|
},
|
|
5104
5182
|
getLogExport: {
|
|
5105
|
-
export_id:
|
|
5183
|
+
export_id: z14.string().describe("The unique ID of the log export")
|
|
5106
5184
|
},
|
|
5107
5185
|
startLogExport: {
|
|
5108
|
-
export_id:
|
|
5186
|
+
export_id: z14.string().describe("The unique ID of the log export to start")
|
|
5109
5187
|
},
|
|
5110
5188
|
cancelLogExport: {
|
|
5111
|
-
export_id:
|
|
5189
|
+
export_id: z14.string().describe("The unique ID of the log export to cancel")
|
|
5112
5190
|
},
|
|
5113
5191
|
downloadLogExport: {
|
|
5114
|
-
export_id:
|
|
5192
|
+
export_id: z14.string().describe("The unique ID of the log export to download")
|
|
5115
5193
|
},
|
|
5116
5194
|
updateLogExport: {
|
|
5117
|
-
export_id:
|
|
5118
|
-
workspace_id:
|
|
5119
|
-
time_of_generation_max:
|
|
5195
|
+
export_id: z14.string().describe("The unique ID of the log export to update"),
|
|
5196
|
+
workspace_id: z14.string().optional().describe("Workspace ID for the export"),
|
|
5197
|
+
time_of_generation_max: z14.string().optional().describe(
|
|
5120
5198
|
"Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
|
|
5121
5199
|
),
|
|
5122
|
-
requested_fields:
|
|
5200
|
+
requested_fields: z14.array(logExportFieldSchema).optional().describe(
|
|
5123
5201
|
"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"
|
|
5124
5202
|
)
|
|
5125
5203
|
}
|
|
@@ -5345,7 +5423,7 @@ function registerLoggingTools(server, service) {
|
|
|
5345
5423
|
}
|
|
5346
5424
|
|
|
5347
5425
|
// src/tools/mcp-integrations.tools.ts
|
|
5348
|
-
import { z as
|
|
5426
|
+
import { z as z15 } from "zod";
|
|
5349
5427
|
var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
5350
5428
|
allowKeyTarget: false,
|
|
5351
5429
|
targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
|
|
@@ -5355,10 +5433,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
|
5355
5433
|
var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
5356
5434
|
mcpSecretMappingSchema
|
|
5357
5435
|
);
|
|
5358
|
-
var mcpConfigurationsSchema =
|
|
5436
|
+
var mcpConfigurationsSchema = z15.record(z15.string(), z15.unknown()).superRefine((value, ctx) => {
|
|
5359
5437
|
if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
|
|
5360
5438
|
ctx.addIssue({
|
|
5361
|
-
code:
|
|
5439
|
+
code: z15.ZodIssueCode.custom,
|
|
5362
5440
|
path: ["custom_headers"],
|
|
5363
5441
|
message: "configurations.custom_headers must be a string-to-string record"
|
|
5364
5442
|
});
|
|
@@ -5366,33 +5444,35 @@ var mcpConfigurationsSchema = z14.record(z14.string(), z14.unknown()).superRefin
|
|
|
5366
5444
|
});
|
|
5367
5445
|
var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
5368
5446
|
listMcpIntegrations: {
|
|
5369
|
-
current_page:
|
|
5370
|
-
page_size:
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5447
|
+
current_page: CurrentPageSchema,
|
|
5448
|
+
page_size: pageSizeSchema(1e3).describe(
|
|
5449
|
+
"Number of results per page (max 1000)"
|
|
5450
|
+
),
|
|
5451
|
+
workspace_id: z15.string().optional().describe("Filter by workspace ID"),
|
|
5452
|
+
organisation_id: z15.string().optional().describe("Filter by organisation UUID"),
|
|
5453
|
+
type: z15.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
5374
5454
|
"Filter by workspace, organisation, or all integration ownership"
|
|
5375
5455
|
),
|
|
5376
|
-
search:
|
|
5456
|
+
search: z15.string().optional().describe("Search integrations by name")
|
|
5377
5457
|
},
|
|
5378
5458
|
createMcpIntegration: {
|
|
5379
|
-
name:
|
|
5380
|
-
url:
|
|
5381
|
-
auth_type:
|
|
5459
|
+
name: z15.string().describe("Display name for the MCP integration"),
|
|
5460
|
+
url: z15.string().describe("URL endpoint of the MCP server to integrate"),
|
|
5461
|
+
auth_type: z15.string().min(1).describe(
|
|
5382
5462
|
"Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5383
5463
|
),
|
|
5384
|
-
transport:
|
|
5464
|
+
transport: z15.enum(["http", "sse"]).describe(
|
|
5385
5465
|
"MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
|
|
5386
5466
|
),
|
|
5387
|
-
slug:
|
|
5388
|
-
description:
|
|
5389
|
-
custom_headers:
|
|
5467
|
+
slug: z15.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5468
|
+
description: z15.string().optional().describe("Description of the MCP integration"),
|
|
5469
|
+
custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
|
|
5390
5470
|
'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
|
|
5391
5471
|
),
|
|
5392
5472
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
5393
5473
|
"Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
|
|
5394
5474
|
),
|
|
5395
|
-
workspace_id:
|
|
5475
|
+
workspace_id: z15.string().optional().describe(
|
|
5396
5476
|
"Workspace ID \u2014 required when using organization admin API keys"
|
|
5397
5477
|
),
|
|
5398
5478
|
secret_mappings: mcpSecretMappingsSchema.optional().describe(
|
|
@@ -5400,18 +5480,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5400
5480
|
)
|
|
5401
5481
|
},
|
|
5402
5482
|
getMcpIntegration: {
|
|
5403
|
-
id:
|
|
5483
|
+
id: z15.string().describe("The MCP integration ID or slug to retrieve")
|
|
5404
5484
|
},
|
|
5405
5485
|
updateMcpIntegration: {
|
|
5406
|
-
id:
|
|
5407
|
-
name:
|
|
5408
|
-
description:
|
|
5409
|
-
url:
|
|
5410
|
-
auth_type:
|
|
5486
|
+
id: z15.string().describe("The MCP integration ID or slug to update"),
|
|
5487
|
+
name: z15.string().optional().describe("New display name"),
|
|
5488
|
+
description: z15.string().optional().describe("New description"),
|
|
5489
|
+
url: z15.string().optional().describe("New URL endpoint"),
|
|
5490
|
+
auth_type: z15.string().min(1).optional().describe(
|
|
5411
5491
|
"New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5412
5492
|
),
|
|
5413
|
-
transport:
|
|
5414
|
-
custom_headers:
|
|
5493
|
+
transport: z15.enum(["http", "sse"]).optional().describe("New transport protocol"),
|
|
5494
|
+
custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
|
|
5415
5495
|
"New custom headers for authentication. Sent via configurations.custom_headers"
|
|
5416
5496
|
),
|
|
5417
5497
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
@@ -5422,50 +5502,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5422
5502
|
)
|
|
5423
5503
|
},
|
|
5424
5504
|
deleteMcpIntegration: {
|
|
5425
|
-
id:
|
|
5505
|
+
id: z15.string().describe("The MCP integration ID or slug to delete")
|
|
5426
5506
|
},
|
|
5427
5507
|
getMcpIntegrationMetadata: {
|
|
5428
|
-
id:
|
|
5508
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5429
5509
|
},
|
|
5430
5510
|
listMcpIntegrationCapabilities: {
|
|
5431
|
-
id:
|
|
5511
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5432
5512
|
},
|
|
5433
5513
|
updateMcpIntegrationCapabilities: {
|
|
5434
|
-
id:
|
|
5435
|
-
capabilities:
|
|
5436
|
-
|
|
5437
|
-
name:
|
|
5438
|
-
type:
|
|
5439
|
-
enabled:
|
|
5514
|
+
id: z15.string().describe("The MCP integration ID or slug"),
|
|
5515
|
+
capabilities: z15.array(
|
|
5516
|
+
z15.object({
|
|
5517
|
+
name: z15.string().describe("Capability name"),
|
|
5518
|
+
type: z15.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5519
|
+
enabled: z15.boolean().describe("Whether to enable the capability")
|
|
5440
5520
|
})
|
|
5441
5521
|
).min(1).describe("Array of capability updates")
|
|
5442
5522
|
},
|
|
5443
5523
|
listMcpIntegrationWorkspaces: {
|
|
5444
|
-
id:
|
|
5524
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5445
5525
|
},
|
|
5446
5526
|
updateMcpIntegrationWorkspaces: {
|
|
5447
|
-
id:
|
|
5448
|
-
workspaces:
|
|
5449
|
-
|
|
5450
|
-
id:
|
|
5451
|
-
enabled:
|
|
5527
|
+
id: z15.string().describe("The MCP integration ID or slug"),
|
|
5528
|
+
workspaces: z15.array(
|
|
5529
|
+
z15.object({
|
|
5530
|
+
id: z15.string().describe("Workspace ID"),
|
|
5531
|
+
enabled: z15.boolean().describe("Whether workspace has access")
|
|
5452
5532
|
})
|
|
5453
5533
|
).min(1).describe("Array of workspace access updates")
|
|
5454
5534
|
}
|
|
5455
5535
|
};
|
|
5456
|
-
var createMcpIntegrationSchema =
|
|
5536
|
+
var createMcpIntegrationSchema = z15.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
|
|
5457
5537
|
const configuredHeaders = value.configurations?.custom_headers;
|
|
5458
5538
|
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(
|
|
5459
5539
|
(mapping) => mapping.target_field === "configurations.custom_headers"
|
|
5460
5540
|
)) {
|
|
5461
5541
|
ctx.addIssue({
|
|
5462
|
-
code:
|
|
5542
|
+
code: z15.ZodIssueCode.custom,
|
|
5463
5543
|
path: [],
|
|
5464
5544
|
message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
|
|
5465
5545
|
});
|
|
5466
5546
|
}
|
|
5467
5547
|
});
|
|
5468
|
-
var updateMcpIntegrationSchema =
|
|
5548
|
+
var updateMcpIntegrationSchema = z15.object(
|
|
5469
5549
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
|
|
5470
5550
|
);
|
|
5471
5551
|
function isRecord2(value) {
|
|
@@ -5704,79 +5784,83 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5704
5784
|
}
|
|
5705
5785
|
|
|
5706
5786
|
// src/tools/mcp-servers.tools.ts
|
|
5707
|
-
import { z as
|
|
5787
|
+
import { z as z16 } from "zod";
|
|
5708
5788
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5709
5789
|
listMcpServers: {
|
|
5710
|
-
current_page:
|
|
5711
|
-
page_size:
|
|
5712
|
-
workspace_id:
|
|
5790
|
+
current_page: CurrentPageSchema,
|
|
5791
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
5792
|
+
workspace_id: z16.string().optional().describe("Filter by workspace ID")
|
|
5713
5793
|
},
|
|
5714
5794
|
createMcpServer: {
|
|
5715
|
-
name:
|
|
5716
|
-
mcp_integration_id:
|
|
5717
|
-
slug:
|
|
5718
|
-
description:
|
|
5795
|
+
name: z16.string().describe("Display name for the MCP server"),
|
|
5796
|
+
mcp_integration_id: z16.string().describe("ID or slug of the MCP integration this server belongs to"),
|
|
5797
|
+
slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5798
|
+
description: z16.string().optional().describe("Description of the MCP server")
|
|
5719
5799
|
},
|
|
5720
5800
|
getMcpServer: {
|
|
5721
|
-
id:
|
|
5801
|
+
id: z16.string().describe("The MCP server ID or slug to retrieve")
|
|
5722
5802
|
},
|
|
5723
5803
|
updateMcpServer: {
|
|
5724
|
-
id:
|
|
5725
|
-
name:
|
|
5726
|
-
description:
|
|
5804
|
+
id: z16.string().describe("The MCP server ID or slug to update"),
|
|
5805
|
+
name: z16.string().optional().describe("New display name"),
|
|
5806
|
+
description: z16.string().optional().describe("New description")
|
|
5727
5807
|
},
|
|
5728
5808
|
deleteMcpServer: {
|
|
5729
|
-
id:
|
|
5809
|
+
id: z16.string().describe("The MCP server ID or slug to delete")
|
|
5730
5810
|
},
|
|
5731
5811
|
testMcpServer: {
|
|
5732
|
-
id:
|
|
5812
|
+
id: z16.string().describe("The MCP server ID or slug to test")
|
|
5733
5813
|
},
|
|
5734
5814
|
listMcpServerCapabilities: {
|
|
5735
|
-
id:
|
|
5736
|
-
current_page:
|
|
5737
|
-
page_size:
|
|
5815
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5816
|
+
current_page: CurrentPageSchema,
|
|
5817
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5738
5818
|
},
|
|
5739
5819
|
updateMcpServerCapabilities: {
|
|
5740
|
-
id:
|
|
5741
|
-
capabilities:
|
|
5742
|
-
|
|
5743
|
-
name:
|
|
5744
|
-
type:
|
|
5745
|
-
enabled:
|
|
5820
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5821
|
+
capabilities: z16.array(
|
|
5822
|
+
z16.object({
|
|
5823
|
+
name: z16.string().describe("Capability name"),
|
|
5824
|
+
type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5825
|
+
enabled: z16.boolean().describe("Whether to enable the capability")
|
|
5746
5826
|
})
|
|
5747
5827
|
).min(1).describe("Array of capability updates")
|
|
5748
5828
|
},
|
|
5749
5829
|
listMcpServerUserAccess: {
|
|
5750
|
-
id:
|
|
5751
|
-
current_page:
|
|
5752
|
-
page_size:
|
|
5830
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5831
|
+
current_page: CurrentPageSchema,
|
|
5832
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5753
5833
|
},
|
|
5754
5834
|
updateMcpServerUserAccess: {
|
|
5755
|
-
id:
|
|
5756
|
-
users:
|
|
5757
|
-
|
|
5758
|
-
user_id:
|
|
5759
|
-
enabled:
|
|
5835
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5836
|
+
users: z16.array(
|
|
5837
|
+
z16.object({
|
|
5838
|
+
user_id: z16.string().describe("User ID"),
|
|
5839
|
+
enabled: z16.boolean().describe("Whether user has access")
|
|
5760
5840
|
})
|
|
5761
5841
|
).min(1).describe("Array of user access updates")
|
|
5762
5842
|
},
|
|
5763
5843
|
listMcpServerConnections: {
|
|
5764
|
-
id:
|
|
5765
|
-
user_id:
|
|
5844
|
+
id: z16.string().describe("MCP server ID or slug whose connections to list"),
|
|
5845
|
+
user_id: z16.string().uuid().optional().describe(
|
|
5766
5846
|
"User UUID to filter; user-scoped keys default to their own user when omitted"
|
|
5767
5847
|
),
|
|
5768
|
-
workspace_id:
|
|
5848
|
+
workspace_id: z16.string().optional().describe(
|
|
5769
5849
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
5770
5850
|
),
|
|
5771
|
-
current_page:
|
|
5772
|
-
|
|
5851
|
+
current_page: CurrentPageSchema.describe(
|
|
5852
|
+
"Zero-based results page; defaults to 0"
|
|
5853
|
+
),
|
|
5854
|
+
page_size: pageSizeSchema(500).describe(
|
|
5855
|
+
"Connections per page, from 1 through 500; defaults to 100"
|
|
5856
|
+
)
|
|
5773
5857
|
},
|
|
5774
5858
|
disconnectMcpServerConnection: {
|
|
5775
|
-
id:
|
|
5776
|
-
user_id:
|
|
5859
|
+
id: z16.string().describe("MCP server ID or slug containing the active connection"),
|
|
5860
|
+
user_id: z16.string().uuid().optional().describe(
|
|
5777
5861
|
"User UUID to disconnect; required with service keys and derived from user keys when omitted"
|
|
5778
5862
|
),
|
|
5779
|
-
workspace_id:
|
|
5863
|
+
workspace_id: z16.string().optional().describe(
|
|
5780
5864
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
5781
5865
|
)
|
|
5782
5866
|
}
|
|
@@ -6003,40 +6087,40 @@ function registerMcpServersTools(server, service) {
|
|
|
6003
6087
|
}
|
|
6004
6088
|
|
|
6005
6089
|
// src/tools/partials.tools.ts
|
|
6006
|
-
import { z as
|
|
6090
|
+
import { z as z17 } from "zod";
|
|
6007
6091
|
var PARTIALS_TOOL_SCHEMAS = {
|
|
6008
6092
|
createPromptPartial: {
|
|
6009
|
-
name:
|
|
6010
|
-
string:
|
|
6011
|
-
workspace_id:
|
|
6093
|
+
name: z17.string().describe("Display name for the partial"),
|
|
6094
|
+
string: z17.string().describe("The partial content/template string"),
|
|
6095
|
+
workspace_id: z17.string().optional().describe(
|
|
6012
6096
|
"Workspace ID to create partial in (required for org-level API keys)"
|
|
6013
6097
|
),
|
|
6014
|
-
version_description:
|
|
6098
|
+
version_description: z17.string().optional().describe("Description for this version")
|
|
6015
6099
|
},
|
|
6016
6100
|
listPromptPartials: {
|
|
6017
|
-
collection_id:
|
|
6101
|
+
collection_id: z17.string().optional().describe(
|
|
6018
6102
|
"Filter by collection ID. Optional \u2014 omit to list all partials across collections"
|
|
6019
6103
|
)
|
|
6020
6104
|
},
|
|
6021
6105
|
getPromptPartial: {
|
|
6022
|
-
prompt_partial_id:
|
|
6106
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to retrieve")
|
|
6023
6107
|
},
|
|
6024
6108
|
updatePromptPartial: {
|
|
6025
|
-
prompt_partial_id:
|
|
6026
|
-
name:
|
|
6027
|
-
string:
|
|
6028
|
-
description:
|
|
6029
|
-
status:
|
|
6109
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to update"),
|
|
6110
|
+
name: z17.string().optional().describe("New display name for the partial"),
|
|
6111
|
+
string: z17.string().optional().describe("New content for the partial"),
|
|
6112
|
+
description: z17.string().optional().describe("Description for this version"),
|
|
6113
|
+
status: z17.enum(["active", "archived"]).optional().describe("New status for the partial")
|
|
6030
6114
|
},
|
|
6031
6115
|
deletePromptPartial: {
|
|
6032
|
-
prompt_partial_id:
|
|
6116
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to delete")
|
|
6033
6117
|
},
|
|
6034
6118
|
listPartialVersions: {
|
|
6035
|
-
prompt_partial_id:
|
|
6119
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to list versions for")
|
|
6036
6120
|
},
|
|
6037
6121
|
publishPartial: {
|
|
6038
|
-
prompt_partial_id:
|
|
6039
|
-
version:
|
|
6122
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug"),
|
|
6123
|
+
version: z17.coerce.number().positive().describe("Version number to publish as default")
|
|
6040
6124
|
}
|
|
6041
6125
|
};
|
|
6042
6126
|
function registerPartialsTools(server, service) {
|
|
@@ -6174,77 +6258,6 @@ function registerPartialsTools(server, service) {
|
|
|
6174
6258
|
|
|
6175
6259
|
// src/tools/prompts.tools.ts
|
|
6176
6260
|
import { z as z18 } from "zod";
|
|
6177
|
-
|
|
6178
|
-
// src/lib/schemas.ts
|
|
6179
|
-
import { z as z17 } from "zod";
|
|
6180
|
-
var PromptFunctionSchema = z17.object({
|
|
6181
|
-
name: z17.string().describe("Function name"),
|
|
6182
|
-
description: z17.string().optional().describe("Function description"),
|
|
6183
|
-
parameters: z17.record(z17.string(), z17.unknown()).optional().describe("Function parameters schema")
|
|
6184
|
-
});
|
|
6185
|
-
var PromptToolSchema = z17.object({
|
|
6186
|
-
type: z17.literal("function").describe("Tool type"),
|
|
6187
|
-
function: PromptFunctionSchema.describe("Function definition")
|
|
6188
|
-
});
|
|
6189
|
-
var HyperparametersSchema = z17.object({
|
|
6190
|
-
max_tokens: z17.coerce.number().positive().optional().describe("Maximum tokens to generate"),
|
|
6191
|
-
temperature: z17.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
6192
|
-
top_p: z17.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
|
|
6193
|
-
top_k: z17.coerce.number().positive().optional().describe("Top-k sampling"),
|
|
6194
|
-
presence_penalty: z17.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
|
|
6195
|
-
frequency_penalty: z17.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
|
|
6196
|
-
stop: z17.array(z17.string()).optional().describe("Stop sequences")
|
|
6197
|
-
});
|
|
6198
|
-
var PromptAppIdentifierSchema = z17.string().min(1).describe(
|
|
6199
|
-
"App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
|
|
6200
|
-
);
|
|
6201
|
-
var PromptEnvironmentIdentifierSchema = z17.string().min(1).describe(
|
|
6202
|
-
"Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
|
|
6203
|
-
);
|
|
6204
|
-
var BillingMetadataSchema = z17.object({
|
|
6205
|
-
client_id: z17.string().describe("Client ID for billing attribution (REQUIRED)"),
|
|
6206
|
-
app: PromptAppIdentifierSchema,
|
|
6207
|
-
env: PromptEnvironmentIdentifierSchema,
|
|
6208
|
-
project_id: z17.string().optional().describe("Project ID for granular billing"),
|
|
6209
|
-
feature: z17.string().optional().describe("Feature name for tracking")
|
|
6210
|
-
});
|
|
6211
|
-
var ToolChoiceSchema = z17.object({
|
|
6212
|
-
mode: z17.enum(["auto", "none", "function"]).describe(
|
|
6213
|
-
"Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
|
|
6214
|
-
),
|
|
6215
|
-
function_name: z17.string().optional().describe("Required when mode is 'function'; ignored otherwise")
|
|
6216
|
-
}).superRefine((value, ctx) => {
|
|
6217
|
-
if (value.mode === "function" && !value.function_name) {
|
|
6218
|
-
ctx.addIssue({
|
|
6219
|
-
code: z17.ZodIssueCode.custom,
|
|
6220
|
-
path: ["function_name"],
|
|
6221
|
-
message: "function_name is required when mode is 'function'"
|
|
6222
|
-
});
|
|
6223
|
-
}
|
|
6224
|
-
if (value.mode !== "function" && value.function_name !== void 0) {
|
|
6225
|
-
ctx.addIssue({
|
|
6226
|
-
code: z17.ZodIssueCode.custom,
|
|
6227
|
-
path: ["function_name"],
|
|
6228
|
-
message: "function_name is only allowed when mode is 'function'"
|
|
6229
|
-
});
|
|
6230
|
-
}
|
|
6231
|
-
});
|
|
6232
|
-
function toPromptToolChoice(toolChoice) {
|
|
6233
|
-
if (!toolChoice) {
|
|
6234
|
-
return void 0;
|
|
6235
|
-
}
|
|
6236
|
-
if (toolChoice.mode === "function") {
|
|
6237
|
-
return {
|
|
6238
|
-
type: "function",
|
|
6239
|
-
function: {
|
|
6240
|
-
name: toolChoice.function_name
|
|
6241
|
-
}
|
|
6242
|
-
};
|
|
6243
|
-
}
|
|
6244
|
-
return toolChoice.mode;
|
|
6245
|
-
}
|
|
6246
|
-
|
|
6247
|
-
// src/tools/prompts.tools.ts
|
|
6248
6261
|
var PROMPT_VARIABLES_SCHEMA = z18.record(z18.string(), z18.union([z18.string(), z18.number(), z18.boolean()])).describe("Variable values to substitute into the template");
|
|
6249
6262
|
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z18.object({
|
|
6250
6263
|
type: z18.string().describe("Content block type"),
|
|
@@ -6291,8 +6304,8 @@ var PROMPTS_TOOL_SCHEMAS = {
|
|
|
6291
6304
|
),
|
|
6292
6305
|
workspace_id: z18.string().optional().describe("Filter by workspace ID"),
|
|
6293
6306
|
search: z18.string().optional().describe("Search prompts by name"),
|
|
6294
|
-
current_page:
|
|
6295
|
-
page_size:
|
|
6307
|
+
current_page: CurrentPageSchema,
|
|
6308
|
+
page_size: PageSizeSchema
|
|
6296
6309
|
},
|
|
6297
6310
|
getPrompt: {
|
|
6298
6311
|
prompt_id: z18.string().describe("Prompt ID or slug to retrieve")
|
|
@@ -6873,8 +6886,10 @@ function registerPromptsTools(server, service) {
|
|
|
6873
6886
|
import { z as z19 } from "zod";
|
|
6874
6887
|
var PROVIDERS_TOOL_SCHEMAS = {
|
|
6875
6888
|
listProviders: {
|
|
6876
|
-
current_page:
|
|
6877
|
-
page_size:
|
|
6889
|
+
current_page: CurrentPageSchema,
|
|
6890
|
+
page_size: PageSizeSchema.describe(
|
|
6891
|
+
"Number of results per page (max 100, default 50)"
|
|
6892
|
+
),
|
|
6878
6893
|
workspace_id: z19.string().optional().describe(
|
|
6879
6894
|
"Workspace ID - required when using organization admin keys, optional with workspace API keys"
|
|
6880
6895
|
)
|
|
@@ -7250,8 +7265,12 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7250
7265
|
),
|
|
7251
7266
|
tags: tagsSchema.optional().describe("Return references matching these tags"),
|
|
7252
7267
|
search: z20.string().min(1).max(255).optional().describe("Search references by name"),
|
|
7253
|
-
current_page:
|
|
7254
|
-
|
|
7268
|
+
current_page: CurrentPageSchema.describe(
|
|
7269
|
+
"Zero-based page number; defaults to 0"
|
|
7270
|
+
),
|
|
7271
|
+
page_size: PageSizeSchema.describe(
|
|
7272
|
+
"References per page, from 1 to 100; defaults to 20"
|
|
7273
|
+
)
|
|
7255
7274
|
},
|
|
7256
7275
|
get: {
|
|
7257
7276
|
id: z20.string().min(1).describe("Secret Reference UUID or slug")
|
|
@@ -7507,8 +7526,8 @@ function registerTracingTools(server, service) {
|
|
|
7507
7526
|
import { z as z22 } from "zod";
|
|
7508
7527
|
var USERS_TOOL_SCHEMAS = {
|
|
7509
7528
|
listAllUsers: {
|
|
7510
|
-
current_page:
|
|
7511
|
-
page_size:
|
|
7529
|
+
current_page: CurrentPageSchema,
|
|
7530
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7512
7531
|
role: z22.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
|
|
7513
7532
|
email: z22.string().email().optional().describe("Filter by exact email")
|
|
7514
7533
|
},
|
|
@@ -7551,7 +7570,7 @@ var USERS_TOOL_SCHEMAS = {
|
|
|
7551
7570
|
cost_max: z22.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
7552
7571
|
status_code: z22.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
|
|
7553
7572
|
virtual_keys: z22.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
|
|
7554
|
-
page_size:
|
|
7573
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
7555
7574
|
},
|
|
7556
7575
|
getUser: {
|
|
7557
7576
|
user_id: z22.string().describe("The user ID to retrieve")
|
|
@@ -7566,8 +7585,8 @@ var USERS_TOOL_SCHEMAS = {
|
|
|
7566
7585
|
user_id: z22.string().describe("The user ID to delete")
|
|
7567
7586
|
},
|
|
7568
7587
|
listUserInvites: {
|
|
7569
|
-
current_page:
|
|
7570
|
-
page_size:
|
|
7588
|
+
current_page: CurrentPageSchema,
|
|
7589
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7571
7590
|
role: z22.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
|
|
7572
7591
|
email: z22.string().email().optional().describe("Filter by invited email"),
|
|
7573
7592
|
status: z22.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
|
|
@@ -7778,8 +7797,10 @@ var createScimWorkspaceMappingSchema = z23.object(createScimWorkspaceMappingShap
|
|
|
7778
7797
|
});
|
|
7779
7798
|
var WORKSPACES_TOOL_SCHEMAS = {
|
|
7780
7799
|
listWorkspaces: {
|
|
7781
|
-
page_size:
|
|
7782
|
-
|
|
7800
|
+
page_size: PageSizeSchema.describe(
|
|
7801
|
+
"Number of workspaces to return per page (max 100)"
|
|
7802
|
+
),
|
|
7803
|
+
current_page: CurrentPageSchema,
|
|
7783
7804
|
name: z23.string().optional().describe("Case-sensitive name filter"),
|
|
7784
7805
|
exact_name: z23.string().optional().describe("Exact workspace name filter"),
|
|
7785
7806
|
status: z23.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
|
|
@@ -7828,8 +7849,8 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7828
7849
|
},
|
|
7829
7850
|
listWorkspaceMembers: {
|
|
7830
7851
|
workspace_id: z23.string().describe("The workspace ID to list members for"),
|
|
7831
|
-
current_page:
|
|
7832
|
-
page_size:
|
|
7852
|
+
current_page: CurrentPageSchema.describe("Zero-based page number"),
|
|
7853
|
+
page_size: PageSizeSchema.describe("Number of members per page"),
|
|
7833
7854
|
role: z23.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
|
|
7834
7855
|
email: z23.string().email().optional().describe("Filter by member email")
|
|
7835
7856
|
},
|
|
@@ -7863,9 +7884,9 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7863
7884
|
),
|
|
7864
7885
|
role: z23.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
|
|
7865
7886
|
page: z23.coerce.number().int().nonnegative().optional().describe(
|
|
7866
|
-
"Zero-based results page to retrieve; the first page is 0.
|
|
7887
|
+
"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."
|
|
7867
7888
|
),
|
|
7868
|
-
page_size:
|
|
7889
|
+
page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
|
|
7869
7890
|
},
|
|
7870
7891
|
deleteScimWorkspaceMapping: {
|
|
7871
7892
|
mapping_id: z23.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
|
|
@@ -7873,9 +7894,11 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7873
7894
|
listScimGroups: {
|
|
7874
7895
|
search: z23.string().optional().describe("Case-insensitive text to match against SCIM group names"),
|
|
7875
7896
|
page: z23.coerce.number().int().nonnegative().optional().describe(
|
|
7876
|
-
"Zero-based results page to retrieve; the first page is 0.
|
|
7897
|
+
"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."
|
|
7877
7898
|
),
|
|
7878
|
-
page_size:
|
|
7899
|
+
page_size: PageSizeSchema.describe(
|
|
7900
|
+
"SCIM groups per page, from 1 through 100"
|
|
7901
|
+
)
|
|
7879
7902
|
}
|
|
7880
7903
|
};
|
|
7881
7904
|
function formatWorkspaceDefaults(defaults) {
|