portkey-admin-mcp 0.11.2 → 0.11.4
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 +719 -657
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -2145,7 +2145,81 @@ var CreateSecretReferenceResponseSchema = z.object({
|
|
|
2145
2145
|
});
|
|
2146
2146
|
|
|
2147
2147
|
// src/tools/analytics.tools.ts
|
|
2148
|
+
import { z as z3 } from "zod";
|
|
2149
|
+
|
|
2150
|
+
// src/lib/schemas.ts
|
|
2148
2151
|
import { z as z2 } from "zod";
|
|
2152
|
+
var PromptFunctionSchema = z2.object({
|
|
2153
|
+
name: z2.string().describe("Function name"),
|
|
2154
|
+
description: z2.string().optional().describe("Function description"),
|
|
2155
|
+
parameters: z2.record(z2.string(), z2.unknown()).optional().describe("Function parameters schema")
|
|
2156
|
+
});
|
|
2157
|
+
var PromptToolSchema = z2.object({
|
|
2158
|
+
type: z2.literal("function").describe("Tool type"),
|
|
2159
|
+
function: PromptFunctionSchema.describe("Function definition")
|
|
2160
|
+
});
|
|
2161
|
+
var HyperparametersSchema = z2.object({
|
|
2162
|
+
max_tokens: z2.coerce.number().positive().optional().describe("Maximum tokens to generate"),
|
|
2163
|
+
temperature: z2.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
2164
|
+
top_p: z2.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
|
|
2165
|
+
top_k: z2.coerce.number().positive().optional().describe("Top-k sampling"),
|
|
2166
|
+
presence_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
|
|
2167
|
+
frequency_penalty: z2.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
|
|
2168
|
+
stop: z2.array(z2.string()).optional().describe("Stop sequences")
|
|
2169
|
+
});
|
|
2170
|
+
var PromptAppIdentifierSchema = z2.string().min(1).describe(
|
|
2171
|
+
"App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
|
|
2172
|
+
);
|
|
2173
|
+
var PromptEnvironmentIdentifierSchema = z2.string().min(1).describe(
|
|
2174
|
+
"Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
|
|
2175
|
+
);
|
|
2176
|
+
var BillingMetadataSchema = z2.object({
|
|
2177
|
+
client_id: z2.string().describe("Client ID for billing attribution (REQUIRED)"),
|
|
2178
|
+
app: PromptAppIdentifierSchema,
|
|
2179
|
+
env: PromptEnvironmentIdentifierSchema,
|
|
2180
|
+
project_id: z2.string().optional().describe("Project ID for granular billing"),
|
|
2181
|
+
feature: z2.string().optional().describe("Feature name for tracking")
|
|
2182
|
+
});
|
|
2183
|
+
var ToolChoiceSchema = z2.object({
|
|
2184
|
+
mode: z2.enum(["auto", "none", "function"]).describe(
|
|
2185
|
+
"Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
|
|
2186
|
+
),
|
|
2187
|
+
function_name: z2.string().optional().describe("Required when mode is 'function'; ignored otherwise")
|
|
2188
|
+
}).superRefine((value, ctx) => {
|
|
2189
|
+
if (value.mode === "function" && !value.function_name) {
|
|
2190
|
+
ctx.addIssue({
|
|
2191
|
+
code: z2.ZodIssueCode.custom,
|
|
2192
|
+
path: ["function_name"],
|
|
2193
|
+
message: "function_name is required when mode is 'function'"
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
if (value.mode !== "function" && value.function_name !== void 0) {
|
|
2197
|
+
ctx.addIssue({
|
|
2198
|
+
code: z2.ZodIssueCode.custom,
|
|
2199
|
+
path: ["function_name"],
|
|
2200
|
+
message: "function_name is only allowed when mode is 'function'"
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
});
|
|
2204
|
+
function toPromptToolChoice(toolChoice) {
|
|
2205
|
+
if (!toolChoice) {
|
|
2206
|
+
return void 0;
|
|
2207
|
+
}
|
|
2208
|
+
if (toolChoice.mode === "function") {
|
|
2209
|
+
return {
|
|
2210
|
+
type: "function",
|
|
2211
|
+
function: {
|
|
2212
|
+
name: toolChoice.function_name
|
|
2213
|
+
}
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
return toolChoice.mode;
|
|
2217
|
+
}
|
|
2218
|
+
var CurrentPageSchema = z2.coerce.number().int().nonnegative().optional().describe("Zero-based page number; the first page is 0");
|
|
2219
|
+
function pageSizeSchema(max = 100) {
|
|
2220
|
+
return z2.coerce.number().int().positive().max(max).optional().describe(`Results per page (max ${max})`);
|
|
2221
|
+
}
|
|
2222
|
+
var PageSizeSchema = pageSizeSchema();
|
|
2149
2223
|
|
|
2150
2224
|
// src/tools/utils.ts
|
|
2151
2225
|
function formatFullName(firstName, lastName) {
|
|
@@ -2161,42 +2235,42 @@ function jsonResult(data) {
|
|
|
2161
2235
|
|
|
2162
2236
|
// src/tools/analytics.tools.ts
|
|
2163
2237
|
var baseAnalyticsSchema = {
|
|
2164
|
-
time_of_generation_min:
|
|
2238
|
+
time_of_generation_min: z3.string().describe(
|
|
2165
2239
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
2166
2240
|
),
|
|
2167
|
-
time_of_generation_max:
|
|
2241
|
+
time_of_generation_max: z3.string().describe(
|
|
2168
2242
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
2169
2243
|
),
|
|
2170
|
-
total_units_min:
|
|
2171
|
-
total_units_max:
|
|
2172
|
-
cost_min:
|
|
2173
|
-
cost_max:
|
|
2174
|
-
prompt_token_min:
|
|
2175
|
-
prompt_token_max:
|
|
2176
|
-
completion_token_min:
|
|
2177
|
-
completion_token_max:
|
|
2178
|
-
status_code:
|
|
2244
|
+
total_units_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of total tokens to filter by"),
|
|
2245
|
+
total_units_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of total tokens to filter by"),
|
|
2246
|
+
cost_min: z3.coerce.number().nonnegative().optional().describe("Minimum cost in cents to filter by"),
|
|
2247
|
+
cost_max: z3.coerce.number().nonnegative().optional().describe("Maximum cost in cents to filter by"),
|
|
2248
|
+
prompt_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of prompt tokens"),
|
|
2249
|
+
prompt_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of prompt tokens"),
|
|
2250
|
+
completion_token_min: z3.coerce.number().nonnegative().optional().describe("Minimum number of completion tokens"),
|
|
2251
|
+
completion_token_max: z3.coerce.number().nonnegative().optional().describe("Maximum number of completion tokens"),
|
|
2252
|
+
status_code: z3.string().optional().describe(
|
|
2179
2253
|
"Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
|
|
2180
2254
|
),
|
|
2181
|
-
weighted_feedback_min:
|
|
2182
|
-
weighted_feedback_max:
|
|
2183
|
-
virtual_keys:
|
|
2255
|
+
weighted_feedback_min: z3.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
|
|
2256
|
+
weighted_feedback_max: z3.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
|
|
2257
|
+
virtual_keys: z3.string().optional().describe(
|
|
2184
2258
|
"Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
|
|
2185
2259
|
),
|
|
2186
|
-
configs:
|
|
2260
|
+
configs: z3.string().optional().describe(
|
|
2187
2261
|
"Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
|
|
2188
2262
|
),
|
|
2189
|
-
status_codes:
|
|
2263
|
+
status_codes: z3.array(z3.string()).optional().describe(
|
|
2190
2264
|
"Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
|
|
2191
2265
|
),
|
|
2192
|
-
virtual_key_slugs:
|
|
2266
|
+
virtual_key_slugs: z3.array(z3.string()).optional().describe(
|
|
2193
2267
|
"Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
|
|
2194
2268
|
),
|
|
2195
|
-
config_slugs:
|
|
2269
|
+
config_slugs: z3.array(z3.string()).optional().describe(
|
|
2196
2270
|
"Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
|
|
2197
2271
|
),
|
|
2198
|
-
workspace_slug:
|
|
2199
|
-
api_key_ids:
|
|
2272
|
+
workspace_slug: z3.string().optional().describe("Filter by specific workspace"),
|
|
2273
|
+
api_key_ids: z3.preprocess((value) => {
|
|
2200
2274
|
if (value == null) {
|
|
2201
2275
|
return value;
|
|
2202
2276
|
}
|
|
@@ -2204,45 +2278,45 @@ var baseAnalyticsSchema = {
|
|
|
2204
2278
|
return value.map((item) => String(item)).join(",");
|
|
2205
2279
|
}
|
|
2206
2280
|
return value;
|
|
2207
|
-
},
|
|
2281
|
+
}, z3.string().optional()).describe(
|
|
2208
2282
|
"Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
|
|
2209
2283
|
),
|
|
2210
|
-
metadata:
|
|
2284
|
+
metadata: z3.string().optional().describe(
|
|
2211
2285
|
`Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
|
|
2212
2286
|
),
|
|
2213
|
-
ai_org_model:
|
|
2287
|
+
ai_org_model: z3.string().optional().describe(
|
|
2214
2288
|
"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."
|
|
2215
2289
|
),
|
|
2216
|
-
provider_models:
|
|
2290
|
+
provider_models: z3.array(z3.string()).optional().describe(
|
|
2217
2291
|
"Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
|
|
2218
2292
|
),
|
|
2219
|
-
trace_id:
|
|
2293
|
+
trace_id: z3.string().optional().describe(
|
|
2220
2294
|
"Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
|
|
2221
2295
|
),
|
|
2222
|
-
trace_ids:
|
|
2296
|
+
trace_ids: z3.array(z3.string()).optional().describe(
|
|
2223
2297
|
"Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
|
|
2224
2298
|
),
|
|
2225
|
-
span_id:
|
|
2299
|
+
span_id: z3.string().optional().describe(
|
|
2226
2300
|
"Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
|
|
2227
2301
|
),
|
|
2228
|
-
span_ids:
|
|
2302
|
+
span_ids: z3.array(z3.string()).optional().describe(
|
|
2229
2303
|
"Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
|
|
2230
2304
|
),
|
|
2231
|
-
metadata_filter:
|
|
2305
|
+
metadata_filter: z3.record(z3.string(), z3.unknown()).optional().describe(
|
|
2232
2306
|
"Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
|
|
2233
2307
|
),
|
|
2234
|
-
prompt_slug:
|
|
2308
|
+
prompt_slug: z3.string().optional().describe("Filter by prompt slug")
|
|
2235
2309
|
};
|
|
2236
2310
|
var paginatedAnalyticsSchema = {
|
|
2237
2311
|
...baseAnalyticsSchema,
|
|
2238
|
-
current_page:
|
|
2239
|
-
page_size:
|
|
2312
|
+
current_page: CurrentPageSchema,
|
|
2313
|
+
page_size: PageSizeSchema
|
|
2240
2314
|
};
|
|
2241
2315
|
var cacheSummarySchema = {
|
|
2242
2316
|
...baseAnalyticsSchema,
|
|
2243
|
-
workspace_slug:
|
|
2317
|
+
workspace_slug: z3.string().min(1).describe("Workspace slug to analyze")
|
|
2244
2318
|
};
|
|
2245
|
-
var providerMetricSchema =
|
|
2319
|
+
var providerMetricSchema = z3.enum([
|
|
2246
2320
|
"requests",
|
|
2247
2321
|
"cost",
|
|
2248
2322
|
"total_tokens",
|
|
@@ -2260,16 +2334,16 @@ var providerMetricSchema = z2.enum([
|
|
|
2260
2334
|
]);
|
|
2261
2335
|
var providerGroupAnalyticsSchema = {
|
|
2262
2336
|
...cacheSummarySchema,
|
|
2263
|
-
current_page:
|
|
2264
|
-
page_size:
|
|
2265
|
-
order_by:
|
|
2266
|
-
order_by_type:
|
|
2267
|
-
columns:
|
|
2268
|
-
include_total:
|
|
2337
|
+
current_page: CurrentPageSchema.describe("Zero-based result page"),
|
|
2338
|
+
page_size: PageSizeSchema.describe("Number of provider groups per page"),
|
|
2339
|
+
order_by: z3.string().optional().describe("Metric or field used to order groups"),
|
|
2340
|
+
order_by_type: z3.string().optional().describe("Sort direction accepted by Portkey, such as asc or desc"),
|
|
2341
|
+
columns: z3.array(providerMetricSchema).optional().describe("Provider metrics to include in each grouped row"),
|
|
2342
|
+
include_total: z3.boolean().optional().describe("Request the total provider-group count")
|
|
2269
2343
|
};
|
|
2270
2344
|
var analyticsGroupMetadataSchema = {
|
|
2271
2345
|
...paginatedAnalyticsSchema,
|
|
2272
|
-
metadata_key:
|
|
2346
|
+
metadata_key: z3.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
|
|
2273
2347
|
};
|
|
2274
2348
|
function formatGraphAnalytics(summary, dataPoints) {
|
|
2275
2349
|
return {
|
|
@@ -2705,26 +2779,26 @@ function registerAnalyticsTools(server, service) {
|
|
|
2705
2779
|
}
|
|
2706
2780
|
|
|
2707
2781
|
// src/tools/audit.tools.ts
|
|
2708
|
-
import { z as
|
|
2782
|
+
import { z as z4 } from "zod";
|
|
2709
2783
|
var AUDIT_TOOL_SCHEMAS = {
|
|
2710
2784
|
listAuditLogs: {
|
|
2711
|
-
workspace_id:
|
|
2712
|
-
actor_id:
|
|
2713
|
-
action:
|
|
2785
|
+
workspace_id: z4.string().optional().describe("Filter audit logs by workspace ID"),
|
|
2786
|
+
actor_id: z4.string().optional().describe("Filter by the user ID who performed the action"),
|
|
2787
|
+
action: z4.string().optional().describe(
|
|
2714
2788
|
"Filter by action type (e.g., 'create', 'update', 'delete', 'login')"
|
|
2715
2789
|
),
|
|
2716
|
-
resource_type:
|
|
2790
|
+
resource_type: z4.string().optional().describe(
|
|
2717
2791
|
"Filter by resource type (e.g., 'user', 'workspace', 'config', 'virtual_key')"
|
|
2718
2792
|
),
|
|
2719
|
-
resource_id:
|
|
2720
|
-
start_time:
|
|
2793
|
+
resource_id: z4.string().optional().describe("Filter by specific resource ID"),
|
|
2794
|
+
start_time: z4.string().optional().describe(
|
|
2721
2795
|
"Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
2722
2796
|
),
|
|
2723
|
-
end_time:
|
|
2797
|
+
end_time: z4.string().optional().describe(
|
|
2724
2798
|
"End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
|
|
2725
2799
|
),
|
|
2726
|
-
current_page:
|
|
2727
|
-
page_size:
|
|
2800
|
+
current_page: CurrentPageSchema,
|
|
2801
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
2728
2802
|
}
|
|
2729
2803
|
};
|
|
2730
2804
|
function registerAuditTools(server, service) {
|
|
@@ -2770,30 +2844,30 @@ function registerAuditTools(server, service) {
|
|
|
2770
2844
|
}
|
|
2771
2845
|
|
|
2772
2846
|
// src/tools/collections.tools.ts
|
|
2773
|
-
import { z as
|
|
2847
|
+
import { z as z5 } from "zod";
|
|
2774
2848
|
var COLLECTIONS_TOOL_SCHEMAS = {
|
|
2775
2849
|
listCollections: {
|
|
2776
|
-
workspace_id:
|
|
2777
|
-
search:
|
|
2778
|
-
current_page:
|
|
2779
|
-
page_size:
|
|
2850
|
+
workspace_id: z5.string().optional().describe("Filter by workspace ID"),
|
|
2851
|
+
search: z5.string().optional().describe("Search collections by name"),
|
|
2852
|
+
current_page: CurrentPageSchema,
|
|
2853
|
+
page_size: PageSizeSchema
|
|
2780
2854
|
},
|
|
2781
2855
|
createCollection: {
|
|
2782
|
-
name:
|
|
2856
|
+
name: z5.string().describe(
|
|
2783
2857
|
"Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
|
|
2784
2858
|
),
|
|
2785
|
-
workspace_id:
|
|
2859
|
+
workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
|
|
2786
2860
|
},
|
|
2787
2861
|
getCollection: {
|
|
2788
|
-
collection_id:
|
|
2862
|
+
collection_id: z5.string().describe("Collection ID or slug to retrieve")
|
|
2789
2863
|
},
|
|
2790
2864
|
updateCollection: {
|
|
2791
|
-
collection_id:
|
|
2792
|
-
name:
|
|
2793
|
-
description:
|
|
2865
|
+
collection_id: z5.string().describe("Collection ID to update"),
|
|
2866
|
+
name: z5.string().optional().describe("New name for the collection"),
|
|
2867
|
+
description: z5.string().optional().describe("New description for the collection")
|
|
2794
2868
|
},
|
|
2795
2869
|
deleteCollection: {
|
|
2796
|
-
collection_id:
|
|
2870
|
+
collection_id: z5.string().describe("Collection ID to delete")
|
|
2797
2871
|
}
|
|
2798
2872
|
};
|
|
2799
2873
|
function registerCollectionsTools(server, service) {
|
|
@@ -2879,58 +2953,58 @@ function registerCollectionsTools(server, service) {
|
|
|
2879
2953
|
}
|
|
2880
2954
|
|
|
2881
2955
|
// src/tools/configs.tools.ts
|
|
2882
|
-
import { z as
|
|
2883
|
-
var configTargetSchema =
|
|
2884
|
-
provider:
|
|
2885
|
-
virtual_key:
|
|
2956
|
+
import { z as z6 } from "zod";
|
|
2957
|
+
var configTargetSchema = z6.object({
|
|
2958
|
+
provider: z6.string().optional().describe("Provider slug to route requests to"),
|
|
2959
|
+
virtual_key: z6.string().optional().describe("Virtual key slug to use for this routing target")
|
|
2886
2960
|
}).refine((target) => target.provider || target.virtual_key, {
|
|
2887
2961
|
message: "Each target must have at least provider or virtual_key"
|
|
2888
2962
|
});
|
|
2889
2963
|
var CONFIGS_TOOL_SCHEMAS = {
|
|
2890
2964
|
listConfigs: {
|
|
2891
|
-
current_page:
|
|
2892
|
-
page_size:
|
|
2965
|
+
current_page: CurrentPageSchema,
|
|
2966
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
2893
2967
|
},
|
|
2894
2968
|
getConfig: {
|
|
2895
|
-
slug:
|
|
2969
|
+
slug: z6.string().describe(
|
|
2896
2970
|
"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"
|
|
2897
2971
|
)
|
|
2898
2972
|
},
|
|
2899
2973
|
createConfig: {
|
|
2900
|
-
name:
|
|
2901
|
-
workspace_id:
|
|
2902
|
-
cache_mode:
|
|
2903
|
-
cache_max_age:
|
|
2904
|
-
retry_attempts:
|
|
2905
|
-
retry_on_status_codes:
|
|
2906
|
-
strategy_mode:
|
|
2907
|
-
targets:
|
|
2974
|
+
name: z6.string().describe("Name for the new configuration"),
|
|
2975
|
+
workspace_id: z6.string().optional().describe("Workspace ID to create config in"),
|
|
2976
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
2977
|
+
cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
2978
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
2979
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
|
|
2980
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
|
|
2981
|
+
targets: z6.array(configTargetSchema).optional().describe("Array of target providers with virtual keys")
|
|
2908
2982
|
},
|
|
2909
2983
|
updateConfig: {
|
|
2910
|
-
slug:
|
|
2911
|
-
name:
|
|
2912
|
-
status:
|
|
2913
|
-
cache_mode:
|
|
2914
|
-
cache_max_age:
|
|
2915
|
-
retry_attempts:
|
|
2916
|
-
retry_on_status_codes:
|
|
2917
|
-
strategy_mode:
|
|
2918
|
-
targets:
|
|
2984
|
+
slug: z6.string().describe("Configuration slug to update"),
|
|
2985
|
+
name: z6.string().optional().describe("New name for the configuration"),
|
|
2986
|
+
status: z6.enum(["active", "inactive"]).optional().describe("Configuration status"),
|
|
2987
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
2988
|
+
cache_max_age: z6.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
2989
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
2990
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional().describe("HTTP status codes to retry on"),
|
|
2991
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
|
|
2992
|
+
targets: z6.array(configTargetSchema).optional().describe("Array of target providers")
|
|
2919
2993
|
},
|
|
2920
2994
|
deleteConfig: {
|
|
2921
|
-
slug:
|
|
2995
|
+
slug: z6.string().describe("Configuration slug to delete")
|
|
2922
2996
|
},
|
|
2923
2997
|
listConfigVersions: {
|
|
2924
|
-
slug:
|
|
2998
|
+
slug: z6.string().describe("Configuration slug to list versions for")
|
|
2925
2999
|
}
|
|
2926
3000
|
};
|
|
2927
|
-
var configPayloadSchema =
|
|
2928
|
-
cache_mode:
|
|
2929
|
-
cache_max_age:
|
|
2930
|
-
retry_attempts:
|
|
2931
|
-
retry_on_status_codes:
|
|
2932
|
-
strategy_mode:
|
|
2933
|
-
targets:
|
|
3001
|
+
var configPayloadSchema = z6.object({
|
|
3002
|
+
cache_mode: z6.enum(["simple", "semantic"]).optional(),
|
|
3003
|
+
cache_max_age: z6.coerce.number().positive().optional(),
|
|
3004
|
+
retry_attempts: z6.coerce.number().positive().max(5).optional(),
|
|
3005
|
+
retry_on_status_codes: z6.array(z6.coerce.number()).optional(),
|
|
3006
|
+
strategy_mode: z6.enum(["loadbalance", "fallback"]).optional(),
|
|
3007
|
+
targets: z6.array(configTargetSchema).optional()
|
|
2934
3008
|
});
|
|
2935
3009
|
function buildConfigPayload(params) {
|
|
2936
3010
|
const cache = params.cache_mode !== void 0 || params.cache_max_age !== void 0 ? {
|
|
@@ -2951,10 +3025,10 @@ function buildConfigPayload(params) {
|
|
|
2951
3025
|
function hasConfigSettings(config) {
|
|
2952
3026
|
return config.cache !== void 0 || config.retry !== void 0 || config.strategy !== void 0 || config.targets !== void 0;
|
|
2953
3027
|
}
|
|
2954
|
-
var createConfigSchema =
|
|
3028
|
+
var createConfigSchema = z6.object(CONFIGS_TOOL_SCHEMAS.createConfig).superRefine((value, ctx) => {
|
|
2955
3029
|
if (!hasConfigSettings(buildConfigPayload(value))) {
|
|
2956
3030
|
ctx.addIssue({
|
|
2957
|
-
code:
|
|
3031
|
+
code: z6.ZodIssueCode.custom,
|
|
2958
3032
|
message: "At least one config setting (cache_mode, retry_attempts, strategy_mode, or targets) must be provided"
|
|
2959
3033
|
});
|
|
2960
3034
|
}
|
|
@@ -3099,56 +3173,56 @@ function registerConfigsTools(server, service) {
|
|
|
3099
3173
|
}
|
|
3100
3174
|
|
|
3101
3175
|
// src/tools/deployments.tools.ts
|
|
3102
|
-
import { z as
|
|
3103
|
-
var binaryFlagSchema =
|
|
3104
|
-
var deploymentTypeSchema =
|
|
3105
|
-
var deploymentStatusSchema =
|
|
3176
|
+
import { z as z7 } from "zod";
|
|
3177
|
+
var binaryFlagSchema = z7.union([z7.literal(0), z7.literal(1)]);
|
|
3178
|
+
var deploymentTypeSchema = z7.enum(["production", "non_production"]);
|
|
3179
|
+
var deploymentStatusSchema = z7.enum(["active", "archived"]);
|
|
3106
3180
|
var authSettingsSchema = {
|
|
3107
|
-
gateway_base_url:
|
|
3108
|
-
mcp_gateway_base_url:
|
|
3181
|
+
gateway_base_url: z7.url().optional().describe("Self-hosted Gateway base URL"),
|
|
3182
|
+
mcp_gateway_base_url: z7.url().optional().describe("MCP Gateway base URL"),
|
|
3109
3183
|
is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
|
|
3110
3184
|
is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
|
|
3111
|
-
workspaces_allowed:
|
|
3112
|
-
jwt_subs_allowed:
|
|
3113
|
-
jwt_sub_workspace_mapping:
|
|
3185
|
+
workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
|
|
3186
|
+
jwt_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values allowed to use the deployment"),
|
|
3187
|
+
jwt_sub_workspace_mapping: z7.record(z7.string(), z7.string()).optional().describe("JWT subject to workspace-slug mapping")
|
|
3114
3188
|
};
|
|
3115
3189
|
var DEPLOYMENTS_TOOL_SCHEMAS = {
|
|
3116
3190
|
listDeployments: {
|
|
3117
|
-
organisation_id:
|
|
3191
|
+
organisation_id: z7.string().optional().describe("Filter by organisation UUID"),
|
|
3118
3192
|
status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
|
|
3119
3193
|
type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
|
|
3120
|
-
workspace_slug:
|
|
3121
|
-
search:
|
|
3194
|
+
workspace_slug: z7.array(z7.string()).optional().describe("Filter by one or more workspace slugs"),
|
|
3195
|
+
search: z7.string().optional().describe("Search deployment names")
|
|
3122
3196
|
},
|
|
3123
3197
|
registerDeployment: {
|
|
3124
|
-
name:
|
|
3125
|
-
organisation_id:
|
|
3126
|
-
slug:
|
|
3198
|
+
name: z7.string().min(1).describe("Deployment display name"),
|
|
3199
|
+
organisation_id: z7.string().optional().describe("Owning organisation UUID"),
|
|
3200
|
+
slug: z7.string().min(1).max(50).optional().describe("Optional deployment slug"),
|
|
3127
3201
|
type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
|
|
3128
|
-
deployment_config:
|
|
3129
|
-
is_default:
|
|
3202
|
+
deployment_config: z7.record(z7.string(), z7.unknown()).optional().describe("Gateway deployment configuration"),
|
|
3203
|
+
is_default: z7.boolean().optional().describe("Make this the default deployment"),
|
|
3130
3204
|
...authSettingsSchema
|
|
3131
3205
|
},
|
|
3132
3206
|
getDeployment: {
|
|
3133
|
-
id:
|
|
3134
|
-
organisation_id:
|
|
3207
|
+
id: z7.string().min(1).describe("Deployment UUID or self"),
|
|
3208
|
+
organisation_id: z7.string().optional().describe("Organisation UUID scope")
|
|
3135
3209
|
},
|
|
3136
3210
|
updateDeployment: {
|
|
3137
|
-
id:
|
|
3138
|
-
name:
|
|
3211
|
+
id: z7.string().min(1).describe("Deployment UUID"),
|
|
3212
|
+
name: z7.string().optional().describe("Replacement display name"),
|
|
3139
3213
|
type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
|
|
3140
3214
|
status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
|
|
3141
|
-
deployment_config:
|
|
3142
|
-
is_default:
|
|
3143
|
-
rotate_auth:
|
|
3144
|
-
override_existing:
|
|
3215
|
+
deployment_config: z7.record(z7.string(), z7.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
|
|
3216
|
+
is_default: z7.boolean().optional().describe("Whether this is the default deployment"),
|
|
3217
|
+
rotate_auth: z7.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
|
|
3218
|
+
override_existing: z7.boolean().optional().describe("Allow replacement of existing deployment settings"),
|
|
3145
3219
|
...authSettingsSchema,
|
|
3146
|
-
allow_all_workspaces:
|
|
3147
|
-
remove_workspaces_allowed:
|
|
3148
|
-
remove_subs_allowed:
|
|
3220
|
+
allow_all_workspaces: z7.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
|
|
3221
|
+
remove_workspaces_allowed: z7.array(z7.string()).optional().describe("Workspace slugs to remove from the allowlist"),
|
|
3222
|
+
remove_subs_allowed: z7.array(z7.string()).optional().describe("JWT subject values to remove from the allowlist")
|
|
3149
3223
|
},
|
|
3150
3224
|
archiveDeployment: {
|
|
3151
|
-
id:
|
|
3225
|
+
id: z7.string().min(1).describe("Deployment UUID to archive")
|
|
3152
3226
|
}
|
|
3153
3227
|
};
|
|
3154
3228
|
function compact(value) {
|
|
@@ -3256,72 +3330,74 @@ function registerDeploymentsTools(server, service) {
|
|
|
3256
3330
|
}
|
|
3257
3331
|
|
|
3258
3332
|
// src/tools/guardrails.tools.ts
|
|
3259
|
-
import { z as
|
|
3260
|
-
var guardrailCheckSchema =
|
|
3261
|
-
id:
|
|
3262
|
-
name:
|
|
3263
|
-
is_enabled:
|
|
3264
|
-
parameters:
|
|
3333
|
+
import { z as z8 } from "zod";
|
|
3334
|
+
var guardrailCheckSchema = z8.object({
|
|
3335
|
+
id: z8.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
|
|
3336
|
+
name: z8.string().optional().describe("Display name for the check"),
|
|
3337
|
+
is_enabled: z8.boolean().optional().describe("Whether the check is enabled"),
|
|
3338
|
+
parameters: z8.record(z8.string(), z8.unknown()).optional().describe(
|
|
3265
3339
|
"Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
|
|
3266
3340
|
)
|
|
3267
3341
|
});
|
|
3268
|
-
var guardrailFeedbackSchema =
|
|
3269
|
-
value:
|
|
3270
|
-
weight:
|
|
3271
|
-
metadata:
|
|
3342
|
+
var guardrailFeedbackSchema = z8.object({
|
|
3343
|
+
value: z8.coerce.number().optional().describe("Feedback value"),
|
|
3344
|
+
weight: z8.coerce.number().optional().describe("Feedback weight"),
|
|
3345
|
+
metadata: z8.record(z8.string(), z8.unknown()).optional().describe("Additional metadata")
|
|
3272
3346
|
});
|
|
3273
|
-
var guardrailActionSchema =
|
|
3274
|
-
deny:
|
|
3275
|
-
async:
|
|
3347
|
+
var guardrailActionSchema = z8.object({
|
|
3348
|
+
deny: z8.boolean().optional().describe("Whether to deny the request on check failure"),
|
|
3349
|
+
async: z8.boolean().optional().describe("Whether to run checks asynchronously"),
|
|
3276
3350
|
on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
|
|
3277
3351
|
on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
|
|
3278
|
-
on_fail_action:
|
|
3279
|
-
message:
|
|
3352
|
+
on_fail_action: z8.string().optional().describe("Simple action on failure (e.g., 'block')"),
|
|
3353
|
+
message: z8.string().optional().describe("Message to return when guardrail triggers")
|
|
3280
3354
|
});
|
|
3281
|
-
var workspaceGuardrailExclusionSchema =
|
|
3282
|
-
workspace_id:
|
|
3283
|
-
excluded:
|
|
3355
|
+
var workspaceGuardrailExclusionSchema = z8.object({
|
|
3356
|
+
workspace_id: z8.string().describe("Workspace ID whose exclusion state changes"),
|
|
3357
|
+
excluded: z8.boolean().describe("True to exclude this workspace; false to restore enforcement")
|
|
3284
3358
|
});
|
|
3285
3359
|
var GUARDRAILS_TOOL_SCHEMAS = {
|
|
3286
3360
|
getOrganisationDefaults: {},
|
|
3287
3361
|
listGuardrails: {
|
|
3288
|
-
workspace_id:
|
|
3289
|
-
organisation_id:
|
|
3290
|
-
page_size:
|
|
3291
|
-
|
|
3362
|
+
workspace_id: z8.string().optional().describe("Filter guardrails by workspace ID"),
|
|
3363
|
+
organisation_id: z8.string().optional().describe("Filter guardrails by organization ID"),
|
|
3364
|
+
page_size: PageSizeSchema.describe(
|
|
3365
|
+
"Number of items per page (1-100, default: 100)"
|
|
3366
|
+
),
|
|
3367
|
+
current_page: CurrentPageSchema
|
|
3292
3368
|
},
|
|
3293
3369
|
getGuardrail: {
|
|
3294
|
-
guardrail_id:
|
|
3370
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
|
|
3295
3371
|
},
|
|
3296
3372
|
createGuardrail: {
|
|
3297
|
-
name:
|
|
3298
|
-
checks:
|
|
3373
|
+
name: z8.string().describe("Name of the guardrail"),
|
|
3374
|
+
checks: z8.array(guardrailCheckSchema).min(1).describe("Array of checks to apply (at least one required)"),
|
|
3299
3375
|
actions: guardrailActionSchema.describe(
|
|
3300
3376
|
"Actions to take when guardrail checks pass or fail"
|
|
3301
3377
|
),
|
|
3302
|
-
workspace_id:
|
|
3303
|
-
organisation_id:
|
|
3378
|
+
workspace_id: z8.string().optional().describe("Workspace ID to create the guardrail in"),
|
|
3379
|
+
organisation_id: z8.string().optional().describe("Organisation ID (required if workspace_id not provided)")
|
|
3304
3380
|
},
|
|
3305
3381
|
updateGuardrail: {
|
|
3306
|
-
guardrail_id:
|
|
3307
|
-
name:
|
|
3308
|
-
checks:
|
|
3382
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug to update"),
|
|
3383
|
+
name: z8.string().optional().describe("New name for the guardrail"),
|
|
3384
|
+
checks: z8.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
|
|
3309
3385
|
actions: guardrailActionSchema.optional().describe("Updated actions configuration")
|
|
3310
3386
|
},
|
|
3311
3387
|
deleteGuardrail: {
|
|
3312
|
-
guardrail_id:
|
|
3388
|
+
guardrail_id: z8.string().describe("The guardrail UUID or slug to delete")
|
|
3313
3389
|
},
|
|
3314
3390
|
updateOrganisationDefaults: {
|
|
3315
|
-
input_guardrails:
|
|
3316
|
-
output_guardrails:
|
|
3391
|
+
input_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
|
|
3392
|
+
output_guardrails: z8.array(z8.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
|
|
3317
3393
|
},
|
|
3318
3394
|
listWorkspaceExclusions: {
|
|
3319
|
-
organisation_id:
|
|
3395
|
+
organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be listed")
|
|
3320
3396
|
},
|
|
3321
3397
|
updateWorkspaceExclusions: {
|
|
3322
|
-
organisation_id:
|
|
3323
|
-
workspaces:
|
|
3324
|
-
override_existing:
|
|
3398
|
+
organisation_id: z8.string().describe("Organisation ID whose workspace exclusions should be updated"),
|
|
3399
|
+
workspaces: z8.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
|
|
3400
|
+
override_existing: z8.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
|
|
3325
3401
|
}
|
|
3326
3402
|
};
|
|
3327
3403
|
var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
|
|
@@ -3523,7 +3599,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3523
3599
|
}
|
|
3524
3600
|
|
|
3525
3601
|
// src/tools/integrations.tools.ts
|
|
3526
|
-
import { z as
|
|
3602
|
+
import { z as z10 } from "zod";
|
|
3527
3603
|
|
|
3528
3604
|
// src/lib/limits.ts
|
|
3529
3605
|
var PERIODIC_RESET_DEFAULT = "monthly";
|
|
@@ -3566,25 +3642,25 @@ function buildRateLimits(params) {
|
|
|
3566
3642
|
}
|
|
3567
3643
|
|
|
3568
3644
|
// src/tools/secret-mapping.schemas.ts
|
|
3569
|
-
import { z as
|
|
3645
|
+
import { z as z9 } from "zod";
|
|
3570
3646
|
function createSecretMappingSchema({
|
|
3571
3647
|
allowKeyTarget,
|
|
3572
3648
|
targetFieldDescription,
|
|
3573
3649
|
secretReferenceDescription,
|
|
3574
3650
|
valueFormatDescription
|
|
3575
3651
|
}) {
|
|
3576
|
-
return
|
|
3577
|
-
target_field:
|
|
3652
|
+
return z9.object({
|
|
3653
|
+
target_field: z9.string().refine(
|
|
3578
3654
|
(value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
|
|
3579
3655
|
allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
|
|
3580
3656
|
).describe(targetFieldDescription),
|
|
3581
|
-
secret_reference_id:
|
|
3582
|
-
secret_key:
|
|
3583
|
-
value_format:
|
|
3657
|
+
secret_reference_id: z9.string().describe(secretReferenceDescription),
|
|
3658
|
+
secret_key: z9.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
|
|
3659
|
+
value_format: z9.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
|
|
3584
3660
|
});
|
|
3585
3661
|
}
|
|
3586
3662
|
function uniqueSecretMappingsSchema(itemSchema) {
|
|
3587
|
-
return
|
|
3663
|
+
return z9.array(itemSchema).superRefine((mappings, context) => {
|
|
3588
3664
|
const firstIndexByTarget = /* @__PURE__ */ new Map();
|
|
3589
3665
|
for (const [index, mapping] of mappings.entries()) {
|
|
3590
3666
|
const firstIndex = firstIndexByTarget.get(mapping.target_field);
|
|
@@ -3611,8 +3687,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
|
|
|
3611
3687
|
var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
3612
3688
|
integrationSecretMappingSchema
|
|
3613
3689
|
);
|
|
3614
|
-
var nullableMultiplier = (description) =>
|
|
3615
|
-
var pricingMultiplierSchema =
|
|
3690
|
+
var nullableMultiplier = (description) => z10.coerce.number().nonnegative().nullable().optional().describe(description);
|
|
3691
|
+
var pricingMultiplierSchema = z10.object({
|
|
3616
3692
|
default: nullableMultiplier(
|
|
3617
3693
|
"Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
|
|
3618
3694
|
),
|
|
@@ -3656,69 +3732,71 @@ var pricingMultiplierSchema = z9.object({
|
|
|
3656
3732
|
cache_write_image_input_token: nullableMultiplier(
|
|
3657
3733
|
"Cache-write image input token price multiplier"
|
|
3658
3734
|
),
|
|
3659
|
-
image:
|
|
3735
|
+
image: z10.object({
|
|
3660
3736
|
default: nullableMultiplier("Default image-generation price multiplier")
|
|
3661
3737
|
}).nullable().optional().describe("Image-generation pricing multipliers"),
|
|
3662
|
-
additional_units:
|
|
3738
|
+
additional_units: z10.record(z10.string(), z10.coerce.number().nonnegative().nullable()).nullable().optional().describe(
|
|
3663
3739
|
"Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
|
|
3664
3740
|
)
|
|
3665
3741
|
});
|
|
3666
|
-
var pricingAdjustmentsSchema =
|
|
3742
|
+
var pricingAdjustmentsSchema = z10.object({
|
|
3667
3743
|
multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
|
|
3668
3744
|
}).nullable();
|
|
3669
|
-
var modelConfigurationsSchema =
|
|
3670
|
-
custom_host:
|
|
3671
|
-
custom_headers:
|
|
3745
|
+
var modelConfigurationsSchema = z10.object({
|
|
3746
|
+
custom_host: z10.string().url().optional().describe("Custom upstream URL used only for this model"),
|
|
3747
|
+
custom_headers: z10.record(z10.string(), z10.string()).optional().describe("Headers sent only for this model; values may contain secrets")
|
|
3672
3748
|
});
|
|
3673
|
-
var tokenPricingSchema =
|
|
3674
|
-
price:
|
|
3749
|
+
var tokenPricingSchema = z10.object({
|
|
3750
|
+
price: z10.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
|
|
3675
3751
|
});
|
|
3676
|
-
var integrationModelPricingSchema =
|
|
3677
|
-
type:
|
|
3678
|
-
pay_as_you_go:
|
|
3752
|
+
var integrationModelPricingSchema = z10.object({
|
|
3753
|
+
type: z10.literal("static").describe("Static per-token pricing configuration"),
|
|
3754
|
+
pay_as_you_go: z10.object({
|
|
3679
3755
|
request_token: tokenPricingSchema.optional().describe("Input token pricing"),
|
|
3680
3756
|
response_token: tokenPricingSchema.optional().describe("Output token pricing")
|
|
3681
3757
|
}).optional().describe("Pay-as-you-go rates for this integration model")
|
|
3682
3758
|
});
|
|
3683
3759
|
var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
3684
3760
|
getModelPricing: {
|
|
3685
|
-
provider:
|
|
3761
|
+
provider: z10.string().describe(
|
|
3686
3762
|
"Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
|
|
3687
3763
|
),
|
|
3688
|
-
model:
|
|
3764
|
+
model: z10.string().describe("Exact provider model identifier, such as gpt-4o")
|
|
3689
3765
|
},
|
|
3690
3766
|
listIntegrations: {
|
|
3691
|
-
current_page:
|
|
3692
|
-
page_size:
|
|
3693
|
-
|
|
3694
|
-
|
|
3767
|
+
current_page: CurrentPageSchema,
|
|
3768
|
+
page_size: PageSizeSchema.describe(
|
|
3769
|
+
"Number of results per page (default 100, max 100)"
|
|
3770
|
+
),
|
|
3771
|
+
workspace_id: z10.string().optional().describe("Filter integrations accessible by a specific workspace"),
|
|
3772
|
+
type: z10.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
3695
3773
|
"Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
|
|
3696
3774
|
)
|
|
3697
3775
|
},
|
|
3698
3776
|
createIntegration: {
|
|
3699
|
-
name:
|
|
3700
|
-
ai_provider_id:
|
|
3777
|
+
name: z10.string().describe("Human-readable name for the integration"),
|
|
3778
|
+
ai_provider_id: z10.string().describe(
|
|
3701
3779
|
"ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
|
|
3702
3780
|
),
|
|
3703
|
-
slug:
|
|
3781
|
+
slug: z10.string().optional().describe(
|
|
3704
3782
|
"URL-friendly identifier (auto-generated from name if not provided)"
|
|
3705
3783
|
),
|
|
3706
|
-
key:
|
|
3707
|
-
description:
|
|
3708
|
-
workspace_id:
|
|
3709
|
-
api_version:
|
|
3710
|
-
resource_name:
|
|
3711
|
-
deployment_name:
|
|
3712
|
-
aws_region:
|
|
3713
|
-
aws_access_key_id:
|
|
3714
|
-
aws_secret_access_key:
|
|
3715
|
-
vertex_project_id:
|
|
3716
|
-
vertex_region:
|
|
3717
|
-
custom_host:
|
|
3718
|
-
create_default_provider:
|
|
3784
|
+
key: z10.string().optional().describe("API key for the provider (if required)"),
|
|
3785
|
+
description: z10.string().optional().describe("Optional description of the integration"),
|
|
3786
|
+
workspace_id: z10.string().optional().describe("Workspace ID for workspace-scoped integrations"),
|
|
3787
|
+
api_version: z10.string().optional().describe("API version (for Azure OpenAI)"),
|
|
3788
|
+
resource_name: z10.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
3789
|
+
deployment_name: z10.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
3790
|
+
aws_region: z10.string().optional().describe("AWS region (for AWS Bedrock)"),
|
|
3791
|
+
aws_access_key_id: z10.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
|
|
3792
|
+
aws_secret_access_key: z10.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
|
|
3793
|
+
vertex_project_id: z10.string().optional().describe("GCP project ID (for Vertex AI)"),
|
|
3794
|
+
vertex_region: z10.string().optional().describe("GCP region (for Vertex AI)"),
|
|
3795
|
+
custom_host: z10.string().optional().describe("Custom base URL for the provider"),
|
|
3796
|
+
create_default_provider: z10.boolean().optional().describe(
|
|
3719
3797
|
"Create a provider automatically for a workspace-scoped integration; defaults to true"
|
|
3720
3798
|
),
|
|
3721
|
-
default_provider_slug:
|
|
3799
|
+
default_provider_slug: z10.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
|
|
3722
3800
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3723
3801
|
"Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
|
|
3724
3802
|
),
|
|
@@ -3727,22 +3805,22 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
3727
3805
|
)
|
|
3728
3806
|
},
|
|
3729
3807
|
getIntegration: {
|
|
3730
|
-
slug:
|
|
3808
|
+
slug: z10.string().describe("The unique slug identifier of the integration to retrieve")
|
|
3731
3809
|
},
|
|
3732
3810
|
updateIntegration: {
|
|
3733
|
-
slug:
|
|
3734
|
-
name:
|
|
3735
|
-
key:
|
|
3736
|
-
description:
|
|
3737
|
-
api_version:
|
|
3738
|
-
resource_name:
|
|
3739
|
-
deployment_name:
|
|
3740
|
-
aws_region:
|
|
3741
|
-
aws_access_key_id:
|
|
3742
|
-
aws_secret_access_key:
|
|
3743
|
-
vertex_project_id:
|
|
3744
|
-
vertex_region:
|
|
3745
|
-
custom_host:
|
|
3811
|
+
slug: z10.string().describe("The slug of the integration to update"),
|
|
3812
|
+
name: z10.string().optional().describe("New human-readable name for the integration"),
|
|
3813
|
+
key: z10.string().optional().describe("New API key for the provider"),
|
|
3814
|
+
description: z10.string().optional().describe("New description for the integration"),
|
|
3815
|
+
api_version: z10.string().optional().describe("New API version (for Azure OpenAI)"),
|
|
3816
|
+
resource_name: z10.string().optional().describe("New resource name (for Azure OpenAI)"),
|
|
3817
|
+
deployment_name: z10.string().optional().describe("New deployment name (for Azure OpenAI)"),
|
|
3818
|
+
aws_region: z10.string().optional().describe("New AWS region (for AWS Bedrock)"),
|
|
3819
|
+
aws_access_key_id: z10.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
|
|
3820
|
+
aws_secret_access_key: z10.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
|
|
3821
|
+
vertex_project_id: z10.string().optional().describe("New GCP project ID (for Vertex AI)"),
|
|
3822
|
+
vertex_region: z10.string().optional().describe("New GCP region (for Vertex AI)"),
|
|
3823
|
+
custom_host: z10.string().optional().describe("New custom base URL for the provider"),
|
|
3746
3824
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3747
3825
|
"Replacement runtime Secret Reference mappings; each target_field must be unique"
|
|
3748
3826
|
),
|
|
@@ -3751,78 +3829,78 @@ var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
3751
3829
|
)
|
|
3752
3830
|
},
|
|
3753
3831
|
deleteIntegration: {
|
|
3754
|
-
slug:
|
|
3832
|
+
slug: z10.string().describe("The slug of the integration to delete")
|
|
3755
3833
|
},
|
|
3756
3834
|
listIntegrationModels: {
|
|
3757
|
-
slug:
|
|
3758
|
-
current_page:
|
|
3759
|
-
page_size:
|
|
3835
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3836
|
+
current_page: CurrentPageSchema,
|
|
3837
|
+
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3760
3838
|
},
|
|
3761
3839
|
updateIntegrationModels: {
|
|
3762
|
-
slug:
|
|
3763
|
-
allow_all_models:
|
|
3840
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3841
|
+
allow_all_models: z10.boolean().optional().describe(
|
|
3764
3842
|
"Whether newly available provider models are enabled by default"
|
|
3765
3843
|
),
|
|
3766
|
-
models:
|
|
3767
|
-
|
|
3768
|
-
slug:
|
|
3769
|
-
model_name:
|
|
3844
|
+
models: z10.array(
|
|
3845
|
+
z10.object({
|
|
3846
|
+
slug: z10.string().describe("The model slug identifier"),
|
|
3847
|
+
model_name: z10.string().optional().describe(
|
|
3770
3848
|
"Display name for the model (required for custom models)"
|
|
3771
3849
|
),
|
|
3772
|
-
enabled:
|
|
3773
|
-
is_custom:
|
|
3774
|
-
is_finetune:
|
|
3775
|
-
base_model_slug:
|
|
3850
|
+
enabled: z10.boolean().describe("Whether the model is enabled"),
|
|
3851
|
+
is_custom: z10.boolean().optional().describe("Whether this is a custom model (default: false)"),
|
|
3852
|
+
is_finetune: z10.boolean().optional().describe("Whether this entry is a fine-tuned model"),
|
|
3853
|
+
base_model_slug: z10.string().optional().describe("Base model slug for a fine-tuned model"),
|
|
3776
3854
|
configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
|
|
3777
3855
|
pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
|
|
3778
3856
|
})
|
|
3779
3857
|
).describe("Array of model configurations to update")
|
|
3780
3858
|
},
|
|
3781
3859
|
deleteIntegrationModel: {
|
|
3782
|
-
slug:
|
|
3783
|
-
model_slug:
|
|
3860
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3861
|
+
model_slug: z10.string().describe("The slug of the model to delete")
|
|
3784
3862
|
},
|
|
3785
3863
|
listIntegrationWorkspaces: {
|
|
3786
|
-
slug:
|
|
3787
|
-
current_page:
|
|
3788
|
-
page_size:
|
|
3864
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3865
|
+
current_page: CurrentPageSchema,
|
|
3866
|
+
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3789
3867
|
},
|
|
3790
3868
|
updateIntegrationWorkspaces: {
|
|
3791
|
-
slug:
|
|
3792
|
-
workspaces:
|
|
3793
|
-
|
|
3794
|
-
id:
|
|
3795
|
-
enabled:
|
|
3796
|
-
credit_limit:
|
|
3797
|
-
alert_threshold:
|
|
3798
|
-
rate_limit_rpm:
|
|
3799
|
-
reset_usage:
|
|
3800
|
-
create_default_provider:
|
|
3869
|
+
slug: z10.string().describe("The slug of the integration"),
|
|
3870
|
+
workspaces: z10.array(
|
|
3871
|
+
z10.object({
|
|
3872
|
+
id: z10.string().describe("The workspace ID"),
|
|
3873
|
+
enabled: z10.boolean().describe("Whether the workspace has access to this integration"),
|
|
3874
|
+
credit_limit: z10.coerce.number().positive().optional().describe("Credit limit for this workspace"),
|
|
3875
|
+
alert_threshold: z10.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
3876
|
+
rate_limit_rpm: z10.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
3877
|
+
reset_usage: z10.boolean().optional().describe("Reset exhausted usage status to active"),
|
|
3878
|
+
create_default_provider: z10.boolean().optional().describe(
|
|
3801
3879
|
"Override whether a provider is auto-created for this workspace"
|
|
3802
3880
|
),
|
|
3803
|
-
default_provider_slug:
|
|
3881
|
+
default_provider_slug: z10.string().optional().describe(
|
|
3804
3882
|
"Override the auto-created provider slug for this workspace"
|
|
3805
3883
|
)
|
|
3806
3884
|
})
|
|
3807
3885
|
).describe("Array of workspace configurations to update"),
|
|
3808
|
-
global_workspace_access_enabled:
|
|
3886
|
+
global_workspace_access_enabled: z10.boolean().optional().describe(
|
|
3809
3887
|
"Enable or disable access for all current and future workspaces"
|
|
3810
3888
|
),
|
|
3811
|
-
global_credit_limit:
|
|
3889
|
+
global_credit_limit: z10.coerce.number().positive().optional().describe(
|
|
3812
3890
|
"Global cost credit limit applied with global workspace access"
|
|
3813
3891
|
),
|
|
3814
|
-
global_alert_threshold:
|
|
3815
|
-
global_rate_limit_rpm:
|
|
3816
|
-
override_existing_workspace_access:
|
|
3817
|
-
create_default_provider:
|
|
3818
|
-
default_provider_slug:
|
|
3892
|
+
global_alert_threshold: z10.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
|
|
3893
|
+
global_rate_limit_rpm: z10.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
|
|
3894
|
+
override_existing_workspace_access: z10.boolean().optional().describe("Apply global settings over existing per-workspace access"),
|
|
3895
|
+
create_default_provider: z10.boolean().optional().describe("Auto-create providers when granting workspace access"),
|
|
3896
|
+
default_provider_slug: z10.string().optional().describe("Default slug for providers auto-created in workspaces")
|
|
3819
3897
|
}
|
|
3820
3898
|
};
|
|
3821
|
-
var updateIntegrationWorkspacesSchema =
|
|
3899
|
+
var updateIntegrationWorkspacesSchema = z10.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
|
|
3822
3900
|
const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
|
|
3823
3901
|
if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
|
|
3824
3902
|
ctx.addIssue({
|
|
3825
|
-
code:
|
|
3903
|
+
code: z10.ZodIssueCode.custom,
|
|
3826
3904
|
path: ["global_workspace_access_enabled"],
|
|
3827
3905
|
message: "global_workspace_access_enabled is required when setting global limits."
|
|
3828
3906
|
});
|
|
@@ -4154,31 +4232,31 @@ function registerIntegrationsTools(server, service) {
|
|
|
4154
4232
|
}
|
|
4155
4233
|
|
|
4156
4234
|
// src/tools/keys.tools.ts
|
|
4157
|
-
import { z as
|
|
4158
|
-
var virtualKeySecretMappingSchema =
|
|
4159
|
-
target_field:
|
|
4235
|
+
import { z as z11 } from "zod";
|
|
4236
|
+
var virtualKeySecretMappingSchema = z11.object({
|
|
4237
|
+
target_field: z11.string().refine(
|
|
4160
4238
|
(value) => value === "key" || value.startsWith("model_config."),
|
|
4161
4239
|
"target_field must be 'key' or start with 'model_config.'"
|
|
4162
4240
|
).describe("Virtual Key field populated from the Secret Reference"),
|
|
4163
|
-
secret_reference_id:
|
|
4164
|
-
secret_key:
|
|
4165
|
-
value_format:
|
|
4241
|
+
secret_reference_id: z11.string().describe("Secret Reference ID that owns the external secret"),
|
|
4242
|
+
secret_key: z11.string().nullable().optional().describe("Optional key selected from a structured external secret"),
|
|
4243
|
+
value_format: z11.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
|
|
4166
4244
|
});
|
|
4167
|
-
var virtualKeyDeploymentSchema =
|
|
4168
|
-
api_version:
|
|
4169
|
-
deployment_name:
|
|
4170
|
-
alias:
|
|
4171
|
-
is_default:
|
|
4245
|
+
var virtualKeyDeploymentSchema = z11.object({
|
|
4246
|
+
api_version: z11.string().min(1).describe("Azure OpenAI API version"),
|
|
4247
|
+
deployment_name: z11.string().min(1).describe("Azure deployment name"),
|
|
4248
|
+
alias: z11.string().optional().describe("Optional model alias for the deployment"),
|
|
4249
|
+
is_default: z11.boolean().optional().describe("Whether this is the default Azure deployment")
|
|
4172
4250
|
});
|
|
4173
|
-
var apiKeyRateLimitSchema =
|
|
4174
|
-
type:
|
|
4175
|
-
unit:
|
|
4176
|
-
value:
|
|
4251
|
+
var apiKeyRateLimitSchema = z11.object({
|
|
4252
|
+
type: z11.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
|
|
4253
|
+
unit: z11.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
|
|
4254
|
+
value: z11.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
|
|
4177
4255
|
});
|
|
4178
|
-
var rotationPolicySchema =
|
|
4179
|
-
rotation_period:
|
|
4180
|
-
next_rotation_at:
|
|
4181
|
-
key_transition_period_ms:
|
|
4256
|
+
var rotationPolicySchema = z11.object({
|
|
4257
|
+
rotation_period: z11.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
|
|
4258
|
+
next_rotation_at: z11.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
|
|
4259
|
+
key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
|
|
4182
4260
|
}).superRefine((value, context) => {
|
|
4183
4261
|
if (value.rotation_period && value.next_rotation_at) {
|
|
4184
4262
|
context.addIssue({
|
|
@@ -4190,112 +4268,112 @@ var rotationPolicySchema = z10.object({
|
|
|
4190
4268
|
}).describe("Automatic API-key rotation policy, or null to remove it");
|
|
4191
4269
|
var KEYS_TOOL_SCHEMAS = {
|
|
4192
4270
|
listVirtualKeys: {
|
|
4193
|
-
current_page:
|
|
4194
|
-
page_size:
|
|
4271
|
+
current_page: CurrentPageSchema,
|
|
4272
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
4195
4273
|
},
|
|
4196
4274
|
createVirtualKey: {
|
|
4197
|
-
name:
|
|
4198
|
-
provider:
|
|
4275
|
+
name: z11.string().describe("Display name for the virtual key"),
|
|
4276
|
+
provider: z11.string().describe(
|
|
4199
4277
|
"Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
|
|
4200
4278
|
),
|
|
4201
|
-
key:
|
|
4202
|
-
note:
|
|
4203
|
-
workspace_id:
|
|
4204
|
-
api_version:
|
|
4205
|
-
resource_name:
|
|
4206
|
-
deployment_name:
|
|
4207
|
-
deployment_configurations:
|
|
4279
|
+
key: z11.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
|
|
4280
|
+
note: z11.string().optional().describe("Optional note or description for this key"),
|
|
4281
|
+
workspace_id: z11.string().optional().describe("Workspace ID to create the key in"),
|
|
4282
|
+
api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4283
|
+
resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4284
|
+
deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4285
|
+
deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe(
|
|
4208
4286
|
"Azure deployment configurations with API versions and aliases"
|
|
4209
4287
|
),
|
|
4210
|
-
expires_at:
|
|
4211
|
-
secret_mappings:
|
|
4212
|
-
credit_limit:
|
|
4213
|
-
alert_threshold:
|
|
4288
|
+
expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
|
|
4289
|
+
secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
|
|
4290
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
|
|
4291
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe(
|
|
4214
4292
|
"Percentage of credit_limit at which to send alert emails (0-100)"
|
|
4215
4293
|
),
|
|
4216
|
-
rate_limit_rpm:
|
|
4294
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Requests per minute limit")
|
|
4217
4295
|
},
|
|
4218
4296
|
getVirtualKey: {
|
|
4219
|
-
slug:
|
|
4297
|
+
slug: z11.string().describe("The unique slug identifier of the virtual key to retrieve")
|
|
4220
4298
|
},
|
|
4221
4299
|
updateVirtualKey: {
|
|
4222
|
-
slug:
|
|
4223
|
-
name:
|
|
4224
|
-
key:
|
|
4225
|
-
note:
|
|
4226
|
-
credit_limit:
|
|
4227
|
-
alert_threshold:
|
|
4228
|
-
rate_limit_rpm:
|
|
4229
|
-
deployment_configurations:
|
|
4230
|
-
secret_mappings:
|
|
4300
|
+
slug: z11.string().describe("The slug of the virtual key to update"),
|
|
4301
|
+
name: z11.string().optional().describe("New display name for the key"),
|
|
4302
|
+
key: z11.string().optional().describe("New provider API key value"),
|
|
4303
|
+
note: z11.string().optional().describe("New note or description"),
|
|
4304
|
+
credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4305
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4306
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4307
|
+
deployment_configurations: z11.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
|
|
4308
|
+
secret_mappings: z11.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
|
|
4231
4309
|
},
|
|
4232
4310
|
deleteVirtualKey: {
|
|
4233
|
-
slug:
|
|
4311
|
+
slug: z11.string().describe("The slug of the virtual key to delete")
|
|
4234
4312
|
},
|
|
4235
4313
|
createApiKey: {
|
|
4236
|
-
type:
|
|
4314
|
+
type: z11.enum(["organisation", "workspace"]).describe(
|
|
4237
4315
|
"Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
|
|
4238
4316
|
),
|
|
4239
|
-
sub_type:
|
|
4317
|
+
sub_type: z11.enum(["user", "service"]).describe(
|
|
4240
4318
|
"Sub-type: 'user' for user-associated keys or 'service' for service accounts"
|
|
4241
4319
|
),
|
|
4242
|
-
name:
|
|
4243
|
-
description:
|
|
4244
|
-
organisation_id:
|
|
4245
|
-
workspace_id:
|
|
4246
|
-
user_id:
|
|
4247
|
-
scopes:
|
|
4320
|
+
name: z11.string().describe("Display name for the API key"),
|
|
4321
|
+
description: z11.string().optional().describe("Optional description for the key"),
|
|
4322
|
+
organisation_id: z11.string().optional().describe("Organisation UUID"),
|
|
4323
|
+
workspace_id: z11.string().optional().describe("Workspace ID (required for workspace-type keys)"),
|
|
4324
|
+
user_id: z11.string().optional().describe("User ID (required for user sub-type keys)"),
|
|
4325
|
+
scopes: z11.array(z11.string()).describe(
|
|
4248
4326
|
"Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
|
|
4249
4327
|
),
|
|
4250
|
-
credit_limit:
|
|
4251
|
-
alert_threshold:
|
|
4252
|
-
rate_limit_rpm:
|
|
4253
|
-
rate_limits:
|
|
4254
|
-
default_config_id:
|
|
4255
|
-
default_metadata:
|
|
4256
|
-
default_allow_config_override:
|
|
4257
|
-
alert_emails:
|
|
4258
|
-
expires_at:
|
|
4328
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
4329
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4330
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4331
|
+
rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
|
|
4332
|
+
default_config_id: z11.string().optional().describe("Default configuration ID to use with this key"),
|
|
4333
|
+
default_metadata: z11.record(z11.string(), z11.string()).optional().describe("Default metadata key-value pairs"),
|
|
4334
|
+
default_allow_config_override: z11.boolean().optional().describe("Allow callers to override the default config"),
|
|
4335
|
+
alert_emails: z11.array(z11.string()).optional().describe("Email addresses for alerts"),
|
|
4336
|
+
expires_at: z11.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
|
|
4259
4337
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
|
|
4260
4338
|
},
|
|
4261
4339
|
listApiKeys: {
|
|
4262
|
-
page_size:
|
|
4263
|
-
current_page:
|
|
4264
|
-
workspace_id:
|
|
4340
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
4341
|
+
current_page: CurrentPageSchema,
|
|
4342
|
+
workspace_id: z11.string().optional().describe("Filter by workspace ID")
|
|
4265
4343
|
},
|
|
4266
4344
|
getApiKey: {
|
|
4267
|
-
id:
|
|
4345
|
+
id: z11.string().uuid().describe("The UUID of the API key to retrieve")
|
|
4268
4346
|
},
|
|
4269
4347
|
updateApiKey: {
|
|
4270
|
-
id:
|
|
4271
|
-
name:
|
|
4272
|
-
description:
|
|
4273
|
-
scopes:
|
|
4274
|
-
credit_limit:
|
|
4275
|
-
alert_threshold:
|
|
4276
|
-
rate_limit_rpm:
|
|
4277
|
-
rate_limits:
|
|
4278
|
-
reset_usage:
|
|
4279
|
-
default_config_id:
|
|
4280
|
-
default_metadata:
|
|
4281
|
-
default_allow_config_override:
|
|
4282
|
-
alert_emails:
|
|
4283
|
-
expires_at:
|
|
4348
|
+
id: z11.string().uuid().describe("The UUID of the API key to update"),
|
|
4349
|
+
name: z11.string().optional().describe("New display name for the key"),
|
|
4350
|
+
description: z11.string().optional().describe("New description for the key"),
|
|
4351
|
+
scopes: z11.array(z11.string()).optional().describe("New permission scopes for the key"),
|
|
4352
|
+
credit_limit: z11.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4353
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4354
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4355
|
+
rate_limits: z11.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
|
|
4356
|
+
reset_usage: z11.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
|
|
4357
|
+
default_config_id: z11.string().optional().describe("New default configuration ID"),
|
|
4358
|
+
default_metadata: z11.record(z11.string(), z11.string()).optional().describe("New default metadata key-value pairs"),
|
|
4359
|
+
default_allow_config_override: z11.boolean().optional().describe("Whether callers may override the key's default config"),
|
|
4360
|
+
alert_emails: z11.array(z11.string()).optional().describe("New email addresses for alerts"),
|
|
4361
|
+
expires_at: z11.iso.datetime({ offset: true }).nullable().optional().describe(
|
|
4284
4362
|
"New expiration date in ISO 8601 format, or null to remove expiration"
|
|
4285
4363
|
),
|
|
4286
4364
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
|
|
4287
4365
|
},
|
|
4288
4366
|
rotateApiKey: {
|
|
4289
|
-
id:
|
|
4290
|
-
key_transition_period_ms:
|
|
4367
|
+
id: z11.string().uuid().describe("API key UUID obtained from list_api_keys"),
|
|
4368
|
+
key_transition_period_ms: z11.coerce.number().int().min(18e5).optional().describe(
|
|
4291
4369
|
"Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
|
|
4292
4370
|
)
|
|
4293
4371
|
},
|
|
4294
4372
|
deleteApiKey: {
|
|
4295
|
-
id:
|
|
4373
|
+
id: z11.string().uuid().describe("The UUID of the API key to delete")
|
|
4296
4374
|
}
|
|
4297
4375
|
};
|
|
4298
|
-
var createVirtualKeySchema =
|
|
4376
|
+
var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
|
|
4299
4377
|
if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
|
|
4300
4378
|
context.addIssue({
|
|
4301
4379
|
code: "custom",
|
|
@@ -4304,17 +4382,17 @@ var createVirtualKeySchema = z10.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
|
|
|
4304
4382
|
});
|
|
4305
4383
|
}
|
|
4306
4384
|
});
|
|
4307
|
-
var createApiKeySchema =
|
|
4385
|
+
var createApiKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
|
|
4308
4386
|
if (value.type === "workspace" && !value.workspace_id) {
|
|
4309
4387
|
ctx.addIssue({
|
|
4310
|
-
code:
|
|
4388
|
+
code: z11.ZodIssueCode.custom,
|
|
4311
4389
|
path: ["workspace_id"],
|
|
4312
4390
|
message: "workspace_id is required when type is 'workspace'"
|
|
4313
4391
|
});
|
|
4314
4392
|
}
|
|
4315
4393
|
if (value.sub_type === "user" && !value.user_id) {
|
|
4316
4394
|
ctx.addIssue({
|
|
4317
|
-
code:
|
|
4395
|
+
code: z11.ZodIssueCode.custom,
|
|
4318
4396
|
path: ["user_id"],
|
|
4319
4397
|
message: "user_id is required when sub_type is 'user'"
|
|
4320
4398
|
});
|
|
@@ -4637,43 +4715,43 @@ function registerKeysTools(server, service) {
|
|
|
4637
4715
|
}
|
|
4638
4716
|
|
|
4639
4717
|
// src/tools/labels.tools.ts
|
|
4640
|
-
import { z as
|
|
4718
|
+
import { z as z12 } from "zod";
|
|
4641
4719
|
var LABELS_TOOL_SCHEMAS = {
|
|
4642
4720
|
createPromptLabel: {
|
|
4643
|
-
name:
|
|
4644
|
-
organisation_id:
|
|
4645
|
-
workspace_id:
|
|
4646
|
-
description:
|
|
4647
|
-
color_code:
|
|
4721
|
+
name: z12.string().describe("Name of the label"),
|
|
4722
|
+
organisation_id: z12.string().optional().describe("Organisation ID to create the label in"),
|
|
4723
|
+
workspace_id: z12.string().optional().describe("Workspace ID to create the label in"),
|
|
4724
|
+
description: z12.string().optional().describe("Description of the label"),
|
|
4725
|
+
color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
|
|
4648
4726
|
"Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
|
|
4649
4727
|
)
|
|
4650
4728
|
},
|
|
4651
4729
|
listPromptLabels: {
|
|
4652
|
-
organisation_id:
|
|
4653
|
-
workspace_id:
|
|
4654
|
-
search:
|
|
4655
|
-
current_page:
|
|
4656
|
-
page_size:
|
|
4730
|
+
organisation_id: z12.string().optional().describe("Filter by organisation ID"),
|
|
4731
|
+
workspace_id: z12.string().optional().describe("Filter by workspace ID"),
|
|
4732
|
+
search: z12.string().optional().describe("Search labels by name"),
|
|
4733
|
+
current_page: CurrentPageSchema,
|
|
4734
|
+
page_size: PageSizeSchema
|
|
4657
4735
|
},
|
|
4658
4736
|
getPromptLabel: {
|
|
4659
|
-
label_id:
|
|
4660
|
-
organisation_id:
|
|
4661
|
-
workspace_id:
|
|
4737
|
+
label_id: z12.string().describe("Label ID to retrieve"),
|
|
4738
|
+
organisation_id: z12.string().optional().describe("Organisation ID for filtering"),
|
|
4739
|
+
workspace_id: z12.string().optional().describe("Workspace ID for filtering")
|
|
4662
4740
|
},
|
|
4663
4741
|
updatePromptLabel: {
|
|
4664
|
-
label_id:
|
|
4665
|
-
name:
|
|
4666
|
-
description:
|
|
4667
|
-
color_code:
|
|
4742
|
+
label_id: z12.string().describe("Label ID to update"),
|
|
4743
|
+
name: z12.string().optional().describe("New name for the label"),
|
|
4744
|
+
description: z12.string().optional().describe("New description"),
|
|
4745
|
+
color_code: z12.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
|
|
4668
4746
|
},
|
|
4669
4747
|
deletePromptLabel: {
|
|
4670
|
-
label_id:
|
|
4748
|
+
label_id: z12.string().describe("Label ID to delete")
|
|
4671
4749
|
}
|
|
4672
4750
|
};
|
|
4673
|
-
var createPromptLabelSchema =
|
|
4751
|
+
var createPromptLabelSchema = z12.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
|
|
4674
4752
|
if (!value.organisation_id && !value.workspace_id) {
|
|
4675
4753
|
ctx.addIssue({
|
|
4676
|
-
code:
|
|
4754
|
+
code: z12.ZodIssueCode.custom,
|
|
4677
4755
|
message: "Either organisation_id or workspace_id is required"
|
|
4678
4756
|
});
|
|
4679
4757
|
}
|
|
@@ -4770,13 +4848,13 @@ function registerLabelsTools(server, service) {
|
|
|
4770
4848
|
}
|
|
4771
4849
|
|
|
4772
4850
|
// src/tools/limits.tools.ts
|
|
4773
|
-
import { z as
|
|
4774
|
-
var statusSchema =
|
|
4775
|
-
var rateUnitSchema =
|
|
4776
|
-
var rateTargetSchema =
|
|
4777
|
-
var conditionValueSchema =
|
|
4778
|
-
var conditionSchema =
|
|
4779
|
-
key:
|
|
4851
|
+
import { z as z13 } from "zod";
|
|
4852
|
+
var statusSchema = z13.enum(["active", "archived"]);
|
|
4853
|
+
var rateUnitSchema = z13.enum(["rpm", "rph", "rpd", "rpw"]);
|
|
4854
|
+
var rateTargetSchema = z13.enum(["llm", "mcp_tools"]);
|
|
4855
|
+
var conditionValueSchema = z13.union([z13.string(), z13.array(z13.string()).min(1)]);
|
|
4856
|
+
var conditionSchema = z13.object({
|
|
4857
|
+
key: z13.string().min(1).describe(
|
|
4780
4858
|
"Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
|
|
4781
4859
|
),
|
|
4782
4860
|
value: conditionValueSchema.describe(
|
|
@@ -4784,92 +4862,92 @@ var conditionSchema = z12.object({
|
|
|
4784
4862
|
),
|
|
4785
4863
|
excludes: conditionValueSchema.optional().describe("Values to exclude")
|
|
4786
4864
|
});
|
|
4787
|
-
var groupBySchema =
|
|
4788
|
-
key:
|
|
4865
|
+
var groupBySchema = z13.object({
|
|
4866
|
+
key: z13.string().min(1).describe(
|
|
4789
4867
|
"Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
|
|
4790
4868
|
)
|
|
4791
4869
|
});
|
|
4792
4870
|
var paginationSchema = {
|
|
4793
|
-
page_size:
|
|
4794
|
-
current_page:
|
|
4871
|
+
page_size: PageSizeSchema.describe("Number of policies to return per page"),
|
|
4872
|
+
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
4795
4873
|
};
|
|
4796
4874
|
var LIMITS_TOOL_SCHEMAS = {
|
|
4797
4875
|
listRateLimits: {
|
|
4798
|
-
workspace_id:
|
|
4876
|
+
workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
|
|
4799
4877
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
4800
|
-
type:
|
|
4878
|
+
type: z13.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
|
|
4801
4879
|
unit: rateUnitSchema.optional().describe("Filter by reset interval"),
|
|
4802
4880
|
target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
|
|
4803
4881
|
...paginationSchema
|
|
4804
4882
|
},
|
|
4805
4883
|
getRateLimit: {
|
|
4806
|
-
id:
|
|
4884
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID"),
|
|
4807
4885
|
status: statusSchema.optional().describe("Include an archived policy by status")
|
|
4808
4886
|
},
|
|
4809
4887
|
createRateLimit: {
|
|
4810
|
-
conditions:
|
|
4811
|
-
group_by:
|
|
4812
|
-
type:
|
|
4888
|
+
conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
4889
|
+
group_by: z13.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
|
|
4890
|
+
type: z13.enum(["requests", "tokens"]).describe("Counter type"),
|
|
4813
4891
|
unit: rateUnitSchema.describe("Counter reset interval"),
|
|
4814
|
-
value:
|
|
4815
|
-
name:
|
|
4892
|
+
value: z13.coerce.number().nonnegative().describe("Maximum requests or tokens"),
|
|
4893
|
+
name: z13.string().optional().describe("Optional policy display name"),
|
|
4816
4894
|
target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
|
|
4817
|
-
workspace_id:
|
|
4818
|
-
organisation_id:
|
|
4895
|
+
workspace_id: z13.string().optional().describe("Workspace UUID scope"),
|
|
4896
|
+
organisation_id: z13.string().optional().describe("Organisation UUID scope")
|
|
4819
4897
|
},
|
|
4820
4898
|
updateRateLimit: {
|
|
4821
|
-
id:
|
|
4822
|
-
name:
|
|
4899
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID"),
|
|
4900
|
+
name: z13.string().optional().describe("Replacement display name"),
|
|
4823
4901
|
unit: rateUnitSchema.optional().describe("Replacement reset interval"),
|
|
4824
|
-
value:
|
|
4825
|
-
conditions:
|
|
4902
|
+
value: z13.coerce.number().nonnegative().optional().describe("Replacement maximum"),
|
|
4903
|
+
conditions: z13.array(conditionSchema).min(1).optional().describe("Replacement conditions")
|
|
4826
4904
|
},
|
|
4827
4905
|
deleteRateLimit: {
|
|
4828
|
-
id:
|
|
4906
|
+
id: z13.string().min(1).describe("Rate-limit policy UUID to delete")
|
|
4829
4907
|
},
|
|
4830
4908
|
listUsageLimits: {
|
|
4831
|
-
workspace_id:
|
|
4909
|
+
workspace_id: z13.string().optional().describe("Filter by workspace UUID"),
|
|
4832
4910
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
4833
|
-
type:
|
|
4911
|
+
type: z13.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
|
|
4834
4912
|
...paginationSchema
|
|
4835
4913
|
},
|
|
4836
4914
|
getUsageLimit: {
|
|
4837
|
-
id:
|
|
4915
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4838
4916
|
status: statusSchema.optional().describe("Include an archived policy by status"),
|
|
4839
|
-
include_usage:
|
|
4917
|
+
include_usage: z13.boolean().optional().describe("Include per-value usage counters")
|
|
4840
4918
|
},
|
|
4841
4919
|
createUsageLimit: {
|
|
4842
|
-
conditions:
|
|
4843
|
-
group_by:
|
|
4844
|
-
type:
|
|
4845
|
-
credit_limit:
|
|
4846
|
-
name:
|
|
4847
|
-
alert_threshold:
|
|
4848
|
-
periodic_reset:
|
|
4849
|
-
workspace_id:
|
|
4850
|
-
organisation_id:
|
|
4920
|
+
conditions: z13.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
4921
|
+
group_by: z13.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
|
|
4922
|
+
type: z13.enum(["cost", "tokens"]).describe("Budget type"),
|
|
4923
|
+
credit_limit: z13.coerce.number().nonnegative().describe("Maximum cumulative usage"),
|
|
4924
|
+
name: z13.string().optional().describe("Optional policy display name"),
|
|
4925
|
+
alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
|
|
4926
|
+
periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
|
|
4927
|
+
workspace_id: z13.string().optional().describe("Workspace UUID scope"),
|
|
4928
|
+
organisation_id: z13.string().optional().describe("Organisation UUID scope")
|
|
4851
4929
|
},
|
|
4852
4930
|
updateUsageLimit: {
|
|
4853
|
-
id:
|
|
4854
|
-
name:
|
|
4855
|
-
credit_limit:
|
|
4856
|
-
alert_threshold:
|
|
4857
|
-
periodic_reset:
|
|
4858
|
-
reset_usage_for_value:
|
|
4931
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4932
|
+
name: z13.string().optional().describe("Replacement display name"),
|
|
4933
|
+
credit_limit: z13.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
|
|
4934
|
+
alert_threshold: z13.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
|
|
4935
|
+
periodic_reset: z13.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
|
|
4936
|
+
reset_usage_for_value: z13.string().optional().describe("Grouped value whose usage should reset")
|
|
4859
4937
|
},
|
|
4860
4938
|
deleteUsageLimit: {
|
|
4861
|
-
id:
|
|
4939
|
+
id: z13.string().min(1).describe("Usage-limit policy UUID to archive")
|
|
4862
4940
|
},
|
|
4863
4941
|
listUsageLimitEntities: {
|
|
4864
|
-
limit_id:
|
|
4865
|
-
status:
|
|
4866
|
-
search:
|
|
4867
|
-
page_size:
|
|
4868
|
-
current_page:
|
|
4942
|
+
limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4943
|
+
status: z13.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
|
|
4944
|
+
search: z13.string().optional().describe("Search tracked values"),
|
|
4945
|
+
page_size: PageSizeSchema.describe("Number of entities per page"),
|
|
4946
|
+
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
4869
4947
|
},
|
|
4870
4948
|
resetUsageLimitEntity: {
|
|
4871
|
-
limit_id:
|
|
4872
|
-
entity_id:
|
|
4949
|
+
limit_id: z13.string().min(1).describe("Usage-limit policy UUID"),
|
|
4950
|
+
entity_id: z13.string().min(1).describe("Tracked entity UUID to reset")
|
|
4873
4951
|
}
|
|
4874
4952
|
};
|
|
4875
4953
|
function compact2(value) {
|
|
@@ -5002,8 +5080,8 @@ function registerLimitsTools(server, service) {
|
|
|
5002
5080
|
}
|
|
5003
5081
|
|
|
5004
5082
|
// src/tools/logging.tools.ts
|
|
5005
|
-
import { z as
|
|
5006
|
-
var logExportFieldSchema =
|
|
5083
|
+
import { z as z14 } from "zod";
|
|
5084
|
+
var logExportFieldSchema = z14.enum([
|
|
5007
5085
|
"id",
|
|
5008
5086
|
"trace_id",
|
|
5009
5087
|
"created_at",
|
|
@@ -5026,12 +5104,12 @@ var logExportFieldSchema = z13.enum([
|
|
|
5026
5104
|
"metadata"
|
|
5027
5105
|
]);
|
|
5028
5106
|
var getLogShape = {
|
|
5029
|
-
log_id:
|
|
5030
|
-
path_format:
|
|
5031
|
-
created_at:
|
|
5032
|
-
type:
|
|
5107
|
+
log_id: z14.string().describe("Gateway log ID to retrieve"),
|
|
5108
|
+
path_format: z14.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
|
|
5109
|
+
created_at: z14.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
|
|
5110
|
+
type: z14.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
|
|
5033
5111
|
};
|
|
5034
|
-
var getLogSchema =
|
|
5112
|
+
var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
|
|
5035
5113
|
if (input.path_format === "v2" && input.created_at === void 0) {
|
|
5036
5114
|
context.addIssue({
|
|
5037
5115
|
code: "custom",
|
|
@@ -5042,67 +5120,67 @@ var getLogSchema = z13.object(getLogShape).superRefine((input, context) => {
|
|
|
5042
5120
|
});
|
|
5043
5121
|
var LOGGING_TOOL_SCHEMAS = {
|
|
5044
5122
|
getLogExportFieldRestrictions: {
|
|
5045
|
-
workspace_id:
|
|
5123
|
+
workspace_id: z14.string().describe("Workspace ID whose export field restrictions should be read")
|
|
5046
5124
|
},
|
|
5047
5125
|
insertLog: {
|
|
5048
|
-
request_url:
|
|
5049
|
-
request_provider:
|
|
5050
|
-
request_method:
|
|
5051
|
-
request_headers:
|
|
5052
|
-
request_body:
|
|
5053
|
-
response_status:
|
|
5054
|
-
response_headers:
|
|
5055
|
-
response_body:
|
|
5056
|
-
response_time:
|
|
5057
|
-
streaming_mode:
|
|
5058
|
-
metadata_organization:
|
|
5059
|
-
metadata_user:
|
|
5060
|
-
metadata_trace_id:
|
|
5061
|
-
metadata_span_id:
|
|
5062
|
-
metadata_span_name:
|
|
5063
|
-
metadata_parent_span_id:
|
|
5064
|
-
metadata_custom:
|
|
5126
|
+
request_url: z14.string().optional().describe("The endpoint URL being called"),
|
|
5127
|
+
request_provider: z14.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
|
|
5128
|
+
request_method: z14.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
|
|
5129
|
+
request_headers: z14.record(z14.string(), z14.string()).optional().describe("Request headers as key-value pairs"),
|
|
5130
|
+
request_body: z14.record(z14.string(), z14.unknown()).optional().describe("Request payload/body"),
|
|
5131
|
+
response_status: z14.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
|
|
5132
|
+
response_headers: z14.record(z14.string(), z14.string()).optional().describe("Response headers as key-value pairs"),
|
|
5133
|
+
response_body: z14.record(z14.string(), z14.unknown()).optional().describe("Response payload/body"),
|
|
5134
|
+
response_time: z14.coerce.number().optional().describe("Response latency in milliseconds"),
|
|
5135
|
+
streaming_mode: z14.boolean().optional().default(false).describe("Whether the response was streamed"),
|
|
5136
|
+
metadata_organization: z14.string().optional().describe("Organization identifier for the log"),
|
|
5137
|
+
metadata_user: z14.string().optional().describe("User identifier for the log"),
|
|
5138
|
+
metadata_trace_id: z14.string().optional().describe("Trace ID for distributed tracing"),
|
|
5139
|
+
metadata_span_id: z14.string().optional().describe("Span ID for tracing"),
|
|
5140
|
+
metadata_span_name: z14.string().optional().describe("Span name for tracing"),
|
|
5141
|
+
metadata_parent_span_id: z14.string().optional().describe("Parent span ID for tracing"),
|
|
5142
|
+
metadata_custom: z14.record(z14.string(), z14.unknown()).optional().describe("Additional custom metadata key-value pairs")
|
|
5065
5143
|
},
|
|
5066
5144
|
createLogExport: {
|
|
5067
|
-
workspace_id:
|
|
5068
|
-
description:
|
|
5069
|
-
time_min:
|
|
5145
|
+
workspace_id: z14.string().optional().describe("Workspace ID for the export"),
|
|
5146
|
+
description: z14.string().optional().describe("Human-readable description for the export job"),
|
|
5147
|
+
time_min: z14.string().describe(
|
|
5070
5148
|
"Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
|
|
5071
5149
|
),
|
|
5072
|
-
time_max:
|
|
5150
|
+
time_max: z14.string().describe(
|
|
5073
5151
|
"Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
|
|
5074
5152
|
),
|
|
5075
|
-
cost_min:
|
|
5076
|
-
cost_max:
|
|
5077
|
-
total_units_min:
|
|
5078
|
-
total_units_max:
|
|
5079
|
-
ai_model:
|
|
5080
|
-
requested_fields:
|
|
5153
|
+
cost_min: z14.coerce.number().optional().describe("Minimum cost filter"),
|
|
5154
|
+
cost_max: z14.coerce.number().optional().describe("Maximum cost filter"),
|
|
5155
|
+
total_units_min: z14.coerce.number().optional().describe("Minimum total units (tokens) filter"),
|
|
5156
|
+
total_units_max: z14.coerce.number().optional().describe("Maximum total units (tokens) filter"),
|
|
5157
|
+
ai_model: z14.array(z14.string()).optional().describe("Filter by specific AI model names"),
|
|
5158
|
+
requested_fields: z14.array(logExportFieldSchema).describe(
|
|
5081
5159
|
"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"
|
|
5082
5160
|
)
|
|
5083
5161
|
},
|
|
5084
5162
|
listLogExports: {
|
|
5085
|
-
workspace_id:
|
|
5163
|
+
workspace_id: z14.string().describe("Workspace ID to list exports for (required)")
|
|
5086
5164
|
},
|
|
5087
5165
|
getLogExport: {
|
|
5088
|
-
export_id:
|
|
5166
|
+
export_id: z14.string().describe("The unique ID of the log export")
|
|
5089
5167
|
},
|
|
5090
5168
|
startLogExport: {
|
|
5091
|
-
export_id:
|
|
5169
|
+
export_id: z14.string().describe("The unique ID of the log export to start")
|
|
5092
5170
|
},
|
|
5093
5171
|
cancelLogExport: {
|
|
5094
|
-
export_id:
|
|
5172
|
+
export_id: z14.string().describe("The unique ID of the log export to cancel")
|
|
5095
5173
|
},
|
|
5096
5174
|
downloadLogExport: {
|
|
5097
|
-
export_id:
|
|
5175
|
+
export_id: z14.string().describe("The unique ID of the log export to download")
|
|
5098
5176
|
},
|
|
5099
5177
|
updateLogExport: {
|
|
5100
|
-
export_id:
|
|
5101
|
-
workspace_id:
|
|
5102
|
-
time_of_generation_max:
|
|
5178
|
+
export_id: z14.string().describe("The unique ID of the log export to update"),
|
|
5179
|
+
workspace_id: z14.string().optional().describe("Workspace ID for the export"),
|
|
5180
|
+
time_of_generation_max: z14.string().optional().describe(
|
|
5103
5181
|
"Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
|
|
5104
5182
|
),
|
|
5105
|
-
requested_fields:
|
|
5183
|
+
requested_fields: z14.array(logExportFieldSchema).optional().describe(
|
|
5106
5184
|
"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"
|
|
5107
5185
|
)
|
|
5108
5186
|
}
|
|
@@ -5328,7 +5406,7 @@ function registerLoggingTools(server, service) {
|
|
|
5328
5406
|
}
|
|
5329
5407
|
|
|
5330
5408
|
// src/tools/mcp-integrations.tools.ts
|
|
5331
|
-
import { z as
|
|
5409
|
+
import { z as z15 } from "zod";
|
|
5332
5410
|
var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
5333
5411
|
allowKeyTarget: false,
|
|
5334
5412
|
targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
|
|
@@ -5338,10 +5416,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
|
5338
5416
|
var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
5339
5417
|
mcpSecretMappingSchema
|
|
5340
5418
|
);
|
|
5341
|
-
var mcpConfigurationsSchema =
|
|
5419
|
+
var mcpConfigurationsSchema = z15.record(z15.string(), z15.unknown()).superRefine((value, ctx) => {
|
|
5342
5420
|
if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
|
|
5343
5421
|
ctx.addIssue({
|
|
5344
|
-
code:
|
|
5422
|
+
code: z15.ZodIssueCode.custom,
|
|
5345
5423
|
path: ["custom_headers"],
|
|
5346
5424
|
message: "configurations.custom_headers must be a string-to-string record"
|
|
5347
5425
|
});
|
|
@@ -5349,33 +5427,35 @@ var mcpConfigurationsSchema = z14.record(z14.string(), z14.unknown()).superRefin
|
|
|
5349
5427
|
});
|
|
5350
5428
|
var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
5351
5429
|
listMcpIntegrations: {
|
|
5352
|
-
current_page:
|
|
5353
|
-
page_size:
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5430
|
+
current_page: CurrentPageSchema,
|
|
5431
|
+
page_size: pageSizeSchema(1e3).describe(
|
|
5432
|
+
"Number of results per page (max 1000)"
|
|
5433
|
+
),
|
|
5434
|
+
workspace_id: z15.string().optional().describe("Filter by workspace ID"),
|
|
5435
|
+
organisation_id: z15.string().optional().describe("Filter by organisation UUID"),
|
|
5436
|
+
type: z15.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
5357
5437
|
"Filter by workspace, organisation, or all integration ownership"
|
|
5358
5438
|
),
|
|
5359
|
-
search:
|
|
5439
|
+
search: z15.string().optional().describe("Search integrations by name")
|
|
5360
5440
|
},
|
|
5361
5441
|
createMcpIntegration: {
|
|
5362
|
-
name:
|
|
5363
|
-
url:
|
|
5364
|
-
auth_type:
|
|
5442
|
+
name: z15.string().describe("Display name for the MCP integration"),
|
|
5443
|
+
url: z15.string().describe("URL endpoint of the MCP server to integrate"),
|
|
5444
|
+
auth_type: z15.string().min(1).describe(
|
|
5365
5445
|
"Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5366
5446
|
),
|
|
5367
|
-
transport:
|
|
5447
|
+
transport: z15.enum(["http", "sse"]).describe(
|
|
5368
5448
|
"MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
|
|
5369
5449
|
),
|
|
5370
|
-
slug:
|
|
5371
|
-
description:
|
|
5372
|
-
custom_headers:
|
|
5450
|
+
slug: z15.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5451
|
+
description: z15.string().optional().describe("Description of the MCP integration"),
|
|
5452
|
+
custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
|
|
5373
5453
|
'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
|
|
5374
5454
|
),
|
|
5375
5455
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
5376
5456
|
"Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
|
|
5377
5457
|
),
|
|
5378
|
-
workspace_id:
|
|
5458
|
+
workspace_id: z15.string().optional().describe(
|
|
5379
5459
|
"Workspace ID \u2014 required when using organization admin API keys"
|
|
5380
5460
|
),
|
|
5381
5461
|
secret_mappings: mcpSecretMappingsSchema.optional().describe(
|
|
@@ -5383,18 +5463,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5383
5463
|
)
|
|
5384
5464
|
},
|
|
5385
5465
|
getMcpIntegration: {
|
|
5386
|
-
id:
|
|
5466
|
+
id: z15.string().describe("The MCP integration ID or slug to retrieve")
|
|
5387
5467
|
},
|
|
5388
5468
|
updateMcpIntegration: {
|
|
5389
|
-
id:
|
|
5390
|
-
name:
|
|
5391
|
-
description:
|
|
5392
|
-
url:
|
|
5393
|
-
auth_type:
|
|
5469
|
+
id: z15.string().describe("The MCP integration ID or slug to update"),
|
|
5470
|
+
name: z15.string().optional().describe("New display name"),
|
|
5471
|
+
description: z15.string().optional().describe("New description"),
|
|
5472
|
+
url: z15.string().optional().describe("New URL endpoint"),
|
|
5473
|
+
auth_type: z15.string().min(1).optional().describe(
|
|
5394
5474
|
"New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5395
5475
|
),
|
|
5396
|
-
transport:
|
|
5397
|
-
custom_headers:
|
|
5476
|
+
transport: z15.enum(["http", "sse"]).optional().describe("New transport protocol"),
|
|
5477
|
+
custom_headers: z15.record(z15.string(), z15.string()).optional().describe(
|
|
5398
5478
|
"New custom headers for authentication. Sent via configurations.custom_headers"
|
|
5399
5479
|
),
|
|
5400
5480
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
@@ -5405,50 +5485,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5405
5485
|
)
|
|
5406
5486
|
},
|
|
5407
5487
|
deleteMcpIntegration: {
|
|
5408
|
-
id:
|
|
5488
|
+
id: z15.string().describe("The MCP integration ID or slug to delete")
|
|
5409
5489
|
},
|
|
5410
5490
|
getMcpIntegrationMetadata: {
|
|
5411
|
-
id:
|
|
5491
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5412
5492
|
},
|
|
5413
5493
|
listMcpIntegrationCapabilities: {
|
|
5414
|
-
id:
|
|
5494
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5415
5495
|
},
|
|
5416
5496
|
updateMcpIntegrationCapabilities: {
|
|
5417
|
-
id:
|
|
5418
|
-
capabilities:
|
|
5419
|
-
|
|
5420
|
-
name:
|
|
5421
|
-
type:
|
|
5422
|
-
enabled:
|
|
5497
|
+
id: z15.string().describe("The MCP integration ID or slug"),
|
|
5498
|
+
capabilities: z15.array(
|
|
5499
|
+
z15.object({
|
|
5500
|
+
name: z15.string().describe("Capability name"),
|
|
5501
|
+
type: z15.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5502
|
+
enabled: z15.boolean().describe("Whether to enable the capability")
|
|
5423
5503
|
})
|
|
5424
5504
|
).min(1).describe("Array of capability updates")
|
|
5425
5505
|
},
|
|
5426
5506
|
listMcpIntegrationWorkspaces: {
|
|
5427
|
-
id:
|
|
5507
|
+
id: z15.string().describe("The MCP integration ID or slug")
|
|
5428
5508
|
},
|
|
5429
5509
|
updateMcpIntegrationWorkspaces: {
|
|
5430
|
-
id:
|
|
5431
|
-
workspaces:
|
|
5432
|
-
|
|
5433
|
-
id:
|
|
5434
|
-
enabled:
|
|
5510
|
+
id: z15.string().describe("The MCP integration ID or slug"),
|
|
5511
|
+
workspaces: z15.array(
|
|
5512
|
+
z15.object({
|
|
5513
|
+
id: z15.string().describe("Workspace ID"),
|
|
5514
|
+
enabled: z15.boolean().describe("Whether workspace has access")
|
|
5435
5515
|
})
|
|
5436
5516
|
).min(1).describe("Array of workspace access updates")
|
|
5437
5517
|
}
|
|
5438
5518
|
};
|
|
5439
|
-
var createMcpIntegrationSchema =
|
|
5519
|
+
var createMcpIntegrationSchema = z15.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
|
|
5440
5520
|
const configuredHeaders = value.configurations?.custom_headers;
|
|
5441
5521
|
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(
|
|
5442
5522
|
(mapping) => mapping.target_field === "configurations.custom_headers"
|
|
5443
5523
|
)) {
|
|
5444
5524
|
ctx.addIssue({
|
|
5445
|
-
code:
|
|
5525
|
+
code: z15.ZodIssueCode.custom,
|
|
5446
5526
|
path: [],
|
|
5447
5527
|
message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
|
|
5448
5528
|
});
|
|
5449
5529
|
}
|
|
5450
5530
|
});
|
|
5451
|
-
var updateMcpIntegrationSchema =
|
|
5531
|
+
var updateMcpIntegrationSchema = z15.object(
|
|
5452
5532
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
|
|
5453
5533
|
);
|
|
5454
5534
|
function isRecord2(value) {
|
|
@@ -5687,79 +5767,83 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5687
5767
|
}
|
|
5688
5768
|
|
|
5689
5769
|
// src/tools/mcp-servers.tools.ts
|
|
5690
|
-
import { z as
|
|
5770
|
+
import { z as z16 } from "zod";
|
|
5691
5771
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5692
5772
|
listMcpServers: {
|
|
5693
|
-
current_page:
|
|
5694
|
-
page_size:
|
|
5695
|
-
workspace_id:
|
|
5773
|
+
current_page: CurrentPageSchema,
|
|
5774
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
5775
|
+
workspace_id: z16.string().optional().describe("Filter by workspace ID")
|
|
5696
5776
|
},
|
|
5697
5777
|
createMcpServer: {
|
|
5698
|
-
name:
|
|
5699
|
-
mcp_integration_id:
|
|
5700
|
-
slug:
|
|
5701
|
-
description:
|
|
5778
|
+
name: z16.string().describe("Display name for the MCP server"),
|
|
5779
|
+
mcp_integration_id: z16.string().describe("ID or slug of the MCP integration this server belongs to"),
|
|
5780
|
+
slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5781
|
+
description: z16.string().optional().describe("Description of the MCP server")
|
|
5702
5782
|
},
|
|
5703
5783
|
getMcpServer: {
|
|
5704
|
-
id:
|
|
5784
|
+
id: z16.string().describe("The MCP server ID or slug to retrieve")
|
|
5705
5785
|
},
|
|
5706
5786
|
updateMcpServer: {
|
|
5707
|
-
id:
|
|
5708
|
-
name:
|
|
5709
|
-
description:
|
|
5787
|
+
id: z16.string().describe("The MCP server ID or slug to update"),
|
|
5788
|
+
name: z16.string().optional().describe("New display name"),
|
|
5789
|
+
description: z16.string().optional().describe("New description")
|
|
5710
5790
|
},
|
|
5711
5791
|
deleteMcpServer: {
|
|
5712
|
-
id:
|
|
5792
|
+
id: z16.string().describe("The MCP server ID or slug to delete")
|
|
5713
5793
|
},
|
|
5714
5794
|
testMcpServer: {
|
|
5715
|
-
id:
|
|
5795
|
+
id: z16.string().describe("The MCP server ID or slug to test")
|
|
5716
5796
|
},
|
|
5717
5797
|
listMcpServerCapabilities: {
|
|
5718
|
-
id:
|
|
5719
|
-
current_page:
|
|
5720
|
-
page_size:
|
|
5798
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5799
|
+
current_page: CurrentPageSchema,
|
|
5800
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5721
5801
|
},
|
|
5722
5802
|
updateMcpServerCapabilities: {
|
|
5723
|
-
id:
|
|
5724
|
-
capabilities:
|
|
5725
|
-
|
|
5726
|
-
name:
|
|
5727
|
-
type:
|
|
5728
|
-
enabled:
|
|
5803
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5804
|
+
capabilities: z16.array(
|
|
5805
|
+
z16.object({
|
|
5806
|
+
name: z16.string().describe("Capability name"),
|
|
5807
|
+
type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5808
|
+
enabled: z16.boolean().describe("Whether to enable the capability")
|
|
5729
5809
|
})
|
|
5730
5810
|
).min(1).describe("Array of capability updates")
|
|
5731
5811
|
},
|
|
5732
5812
|
listMcpServerUserAccess: {
|
|
5733
|
-
id:
|
|
5734
|
-
current_page:
|
|
5735
|
-
page_size:
|
|
5813
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5814
|
+
current_page: CurrentPageSchema,
|
|
5815
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5736
5816
|
},
|
|
5737
5817
|
updateMcpServerUserAccess: {
|
|
5738
|
-
id:
|
|
5739
|
-
users:
|
|
5740
|
-
|
|
5741
|
-
user_id:
|
|
5742
|
-
enabled:
|
|
5818
|
+
id: z16.string().describe("The MCP server ID or slug"),
|
|
5819
|
+
users: z16.array(
|
|
5820
|
+
z16.object({
|
|
5821
|
+
user_id: z16.string().describe("User ID"),
|
|
5822
|
+
enabled: z16.boolean().describe("Whether user has access")
|
|
5743
5823
|
})
|
|
5744
5824
|
).min(1).describe("Array of user access updates")
|
|
5745
5825
|
},
|
|
5746
5826
|
listMcpServerConnections: {
|
|
5747
|
-
id:
|
|
5748
|
-
user_id:
|
|
5827
|
+
id: z16.string().describe("MCP server ID or slug whose connections to list"),
|
|
5828
|
+
user_id: z16.string().uuid().optional().describe(
|
|
5749
5829
|
"User UUID to filter; user-scoped keys default to their own user when omitted"
|
|
5750
5830
|
),
|
|
5751
|
-
workspace_id:
|
|
5831
|
+
workspace_id: z16.string().optional().describe(
|
|
5752
5832
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
5753
5833
|
),
|
|
5754
|
-
current_page:
|
|
5755
|
-
|
|
5834
|
+
current_page: CurrentPageSchema.describe(
|
|
5835
|
+
"Zero-based results page; defaults to 0"
|
|
5836
|
+
),
|
|
5837
|
+
page_size: pageSizeSchema(500).describe(
|
|
5838
|
+
"Connections per page, from 1 through 500; defaults to 100"
|
|
5839
|
+
)
|
|
5756
5840
|
},
|
|
5757
5841
|
disconnectMcpServerConnection: {
|
|
5758
|
-
id:
|
|
5759
|
-
user_id:
|
|
5842
|
+
id: z16.string().describe("MCP server ID or slug containing the active connection"),
|
|
5843
|
+
user_id: z16.string().uuid().optional().describe(
|
|
5760
5844
|
"User UUID to disconnect; required with service keys and derived from user keys when omitted"
|
|
5761
5845
|
),
|
|
5762
|
-
workspace_id:
|
|
5846
|
+
workspace_id: z16.string().optional().describe(
|
|
5763
5847
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
5764
5848
|
)
|
|
5765
5849
|
}
|
|
@@ -5986,40 +6070,40 @@ function registerMcpServersTools(server, service) {
|
|
|
5986
6070
|
}
|
|
5987
6071
|
|
|
5988
6072
|
// src/tools/partials.tools.ts
|
|
5989
|
-
import { z as
|
|
6073
|
+
import { z as z17 } from "zod";
|
|
5990
6074
|
var PARTIALS_TOOL_SCHEMAS = {
|
|
5991
6075
|
createPromptPartial: {
|
|
5992
|
-
name:
|
|
5993
|
-
string:
|
|
5994
|
-
workspace_id:
|
|
6076
|
+
name: z17.string().describe("Display name for the partial"),
|
|
6077
|
+
string: z17.string().describe("The partial content/template string"),
|
|
6078
|
+
workspace_id: z17.string().optional().describe(
|
|
5995
6079
|
"Workspace ID to create partial in (required for org-level API keys)"
|
|
5996
6080
|
),
|
|
5997
|
-
version_description:
|
|
6081
|
+
version_description: z17.string().optional().describe("Description for this version")
|
|
5998
6082
|
},
|
|
5999
6083
|
listPromptPartials: {
|
|
6000
|
-
collection_id:
|
|
6084
|
+
collection_id: z17.string().optional().describe(
|
|
6001
6085
|
"Filter by collection ID. Optional \u2014 omit to list all partials across collections"
|
|
6002
6086
|
)
|
|
6003
6087
|
},
|
|
6004
6088
|
getPromptPartial: {
|
|
6005
|
-
prompt_partial_id:
|
|
6089
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to retrieve")
|
|
6006
6090
|
},
|
|
6007
6091
|
updatePromptPartial: {
|
|
6008
|
-
prompt_partial_id:
|
|
6009
|
-
name:
|
|
6010
|
-
string:
|
|
6011
|
-
description:
|
|
6012
|
-
status:
|
|
6092
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to update"),
|
|
6093
|
+
name: z17.string().optional().describe("New display name for the partial"),
|
|
6094
|
+
string: z17.string().optional().describe("New content for the partial"),
|
|
6095
|
+
description: z17.string().optional().describe("Description for this version"),
|
|
6096
|
+
status: z17.enum(["active", "archived"]).optional().describe("New status for the partial")
|
|
6013
6097
|
},
|
|
6014
6098
|
deletePromptPartial: {
|
|
6015
|
-
prompt_partial_id:
|
|
6099
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to delete")
|
|
6016
6100
|
},
|
|
6017
6101
|
listPartialVersions: {
|
|
6018
|
-
prompt_partial_id:
|
|
6102
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug to list versions for")
|
|
6019
6103
|
},
|
|
6020
6104
|
publishPartial: {
|
|
6021
|
-
prompt_partial_id:
|
|
6022
|
-
version:
|
|
6105
|
+
prompt_partial_id: z17.string().describe("Prompt partial ID or slug"),
|
|
6106
|
+
version: z17.coerce.number().positive().describe("Version number to publish as default")
|
|
6023
6107
|
}
|
|
6024
6108
|
};
|
|
6025
6109
|
function registerPartialsTools(server, service) {
|
|
@@ -6157,77 +6241,6 @@ function registerPartialsTools(server, service) {
|
|
|
6157
6241
|
|
|
6158
6242
|
// src/tools/prompts.tools.ts
|
|
6159
6243
|
import { z as z18 } from "zod";
|
|
6160
|
-
|
|
6161
|
-
// src/lib/schemas.ts
|
|
6162
|
-
import { z as z17 } from "zod";
|
|
6163
|
-
var PromptFunctionSchema = z17.object({
|
|
6164
|
-
name: z17.string().describe("Function name"),
|
|
6165
|
-
description: z17.string().optional().describe("Function description"),
|
|
6166
|
-
parameters: z17.record(z17.string(), z17.unknown()).optional().describe("Function parameters schema")
|
|
6167
|
-
});
|
|
6168
|
-
var PromptToolSchema = z17.object({
|
|
6169
|
-
type: z17.literal("function").describe("Tool type"),
|
|
6170
|
-
function: PromptFunctionSchema.describe("Function definition")
|
|
6171
|
-
});
|
|
6172
|
-
var HyperparametersSchema = z17.object({
|
|
6173
|
-
max_tokens: z17.coerce.number().positive().optional().describe("Maximum tokens to generate"),
|
|
6174
|
-
temperature: z17.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
6175
|
-
top_p: z17.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
|
|
6176
|
-
top_k: z17.coerce.number().positive().optional().describe("Top-k sampling"),
|
|
6177
|
-
presence_penalty: z17.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
|
|
6178
|
-
frequency_penalty: z17.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
|
|
6179
|
-
stop: z17.array(z17.string()).optional().describe("Stop sequences")
|
|
6180
|
-
});
|
|
6181
|
-
var PromptAppIdentifierSchema = z17.string().min(1).describe(
|
|
6182
|
-
"App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
|
|
6183
|
-
);
|
|
6184
|
-
var PromptEnvironmentIdentifierSchema = z17.string().min(1).describe(
|
|
6185
|
-
"Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
|
|
6186
|
-
);
|
|
6187
|
-
var BillingMetadataSchema = z17.object({
|
|
6188
|
-
client_id: z17.string().describe("Client ID for billing attribution (REQUIRED)"),
|
|
6189
|
-
app: PromptAppIdentifierSchema,
|
|
6190
|
-
env: PromptEnvironmentIdentifierSchema,
|
|
6191
|
-
project_id: z17.string().optional().describe("Project ID for granular billing"),
|
|
6192
|
-
feature: z17.string().optional().describe("Feature name for tracking")
|
|
6193
|
-
});
|
|
6194
|
-
var ToolChoiceSchema = z17.object({
|
|
6195
|
-
mode: z17.enum(["auto", "none", "function"]).describe(
|
|
6196
|
-
"Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
|
|
6197
|
-
),
|
|
6198
|
-
function_name: z17.string().optional().describe("Required when mode is 'function'; ignored otherwise")
|
|
6199
|
-
}).superRefine((value, ctx) => {
|
|
6200
|
-
if (value.mode === "function" && !value.function_name) {
|
|
6201
|
-
ctx.addIssue({
|
|
6202
|
-
code: z17.ZodIssueCode.custom,
|
|
6203
|
-
path: ["function_name"],
|
|
6204
|
-
message: "function_name is required when mode is 'function'"
|
|
6205
|
-
});
|
|
6206
|
-
}
|
|
6207
|
-
if (value.mode !== "function" && value.function_name !== void 0) {
|
|
6208
|
-
ctx.addIssue({
|
|
6209
|
-
code: z17.ZodIssueCode.custom,
|
|
6210
|
-
path: ["function_name"],
|
|
6211
|
-
message: "function_name is only allowed when mode is 'function'"
|
|
6212
|
-
});
|
|
6213
|
-
}
|
|
6214
|
-
});
|
|
6215
|
-
function toPromptToolChoice(toolChoice) {
|
|
6216
|
-
if (!toolChoice) {
|
|
6217
|
-
return void 0;
|
|
6218
|
-
}
|
|
6219
|
-
if (toolChoice.mode === "function") {
|
|
6220
|
-
return {
|
|
6221
|
-
type: "function",
|
|
6222
|
-
function: {
|
|
6223
|
-
name: toolChoice.function_name
|
|
6224
|
-
}
|
|
6225
|
-
};
|
|
6226
|
-
}
|
|
6227
|
-
return toolChoice.mode;
|
|
6228
|
-
}
|
|
6229
|
-
|
|
6230
|
-
// src/tools/prompts.tools.ts
|
|
6231
6244
|
var PROMPT_VARIABLES_SCHEMA = z18.record(z18.string(), z18.union([z18.string(), z18.number(), z18.boolean()])).describe("Variable values to substitute into the template");
|
|
6232
6245
|
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z18.object({
|
|
6233
6246
|
type: z18.string().describe("Content block type"),
|
|
@@ -6274,8 +6287,8 @@ var PROMPTS_TOOL_SCHEMAS = {
|
|
|
6274
6287
|
),
|
|
6275
6288
|
workspace_id: z18.string().optional().describe("Filter by workspace ID"),
|
|
6276
6289
|
search: z18.string().optional().describe("Search prompts by name"),
|
|
6277
|
-
current_page:
|
|
6278
|
-
page_size:
|
|
6290
|
+
current_page: CurrentPageSchema,
|
|
6291
|
+
page_size: PageSizeSchema
|
|
6279
6292
|
},
|
|
6280
6293
|
getPrompt: {
|
|
6281
6294
|
prompt_id: z18.string().describe("Prompt ID or slug to retrieve")
|
|
@@ -6856,8 +6869,10 @@ function registerPromptsTools(server, service) {
|
|
|
6856
6869
|
import { z as z19 } from "zod";
|
|
6857
6870
|
var PROVIDERS_TOOL_SCHEMAS = {
|
|
6858
6871
|
listProviders: {
|
|
6859
|
-
current_page:
|
|
6860
|
-
page_size:
|
|
6872
|
+
current_page: CurrentPageSchema,
|
|
6873
|
+
page_size: PageSizeSchema.describe(
|
|
6874
|
+
"Number of results per page (max 100, default 50)"
|
|
6875
|
+
),
|
|
6861
6876
|
workspace_id: z19.string().optional().describe(
|
|
6862
6877
|
"Workspace ID - required when using organization admin keys, optional with workspace API keys"
|
|
6863
6878
|
)
|
|
@@ -7233,8 +7248,12 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7233
7248
|
),
|
|
7234
7249
|
tags: tagsSchema.optional().describe("Return references matching these tags"),
|
|
7235
7250
|
search: z20.string().min(1).max(255).optional().describe("Search references by name"),
|
|
7236
|
-
current_page:
|
|
7237
|
-
|
|
7251
|
+
current_page: CurrentPageSchema.describe(
|
|
7252
|
+
"Zero-based page number; defaults to 0"
|
|
7253
|
+
),
|
|
7254
|
+
page_size: PageSizeSchema.describe(
|
|
7255
|
+
"References per page, from 1 to 100; defaults to 20"
|
|
7256
|
+
)
|
|
7238
7257
|
},
|
|
7239
7258
|
get: {
|
|
7240
7259
|
id: z20.string().min(1).describe("Secret Reference UUID or slug")
|
|
@@ -7490,8 +7509,8 @@ function registerTracingTools(server, service) {
|
|
|
7490
7509
|
import { z as z22 } from "zod";
|
|
7491
7510
|
var USERS_TOOL_SCHEMAS = {
|
|
7492
7511
|
listAllUsers: {
|
|
7493
|
-
current_page:
|
|
7494
|
-
page_size:
|
|
7512
|
+
current_page: CurrentPageSchema,
|
|
7513
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7495
7514
|
role: z22.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
|
|
7496
7515
|
email: z22.string().email().optional().describe("Filter by exact email")
|
|
7497
7516
|
},
|
|
@@ -7534,7 +7553,7 @@ var USERS_TOOL_SCHEMAS = {
|
|
|
7534
7553
|
cost_max: z22.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
7535
7554
|
status_code: z22.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
|
|
7536
7555
|
virtual_keys: z22.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
|
|
7537
|
-
page_size:
|
|
7556
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
7538
7557
|
},
|
|
7539
7558
|
getUser: {
|
|
7540
7559
|
user_id: z22.string().describe("The user ID to retrieve")
|
|
@@ -7549,8 +7568,8 @@ var USERS_TOOL_SCHEMAS = {
|
|
|
7549
7568
|
user_id: z22.string().describe("The user ID to delete")
|
|
7550
7569
|
},
|
|
7551
7570
|
listUserInvites: {
|
|
7552
|
-
current_page:
|
|
7553
|
-
page_size:
|
|
7571
|
+
current_page: CurrentPageSchema,
|
|
7572
|
+
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7554
7573
|
role: z22.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
|
|
7555
7574
|
email: z22.string().email().optional().describe("Filter by invited email"),
|
|
7556
7575
|
status: z22.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
|
|
@@ -7761,8 +7780,10 @@ var createScimWorkspaceMappingSchema = z23.object(createScimWorkspaceMappingShap
|
|
|
7761
7780
|
});
|
|
7762
7781
|
var WORKSPACES_TOOL_SCHEMAS = {
|
|
7763
7782
|
listWorkspaces: {
|
|
7764
|
-
page_size:
|
|
7765
|
-
|
|
7783
|
+
page_size: PageSizeSchema.describe(
|
|
7784
|
+
"Number of workspaces to return per page (max 100)"
|
|
7785
|
+
),
|
|
7786
|
+
current_page: CurrentPageSchema,
|
|
7766
7787
|
name: z23.string().optional().describe("Case-sensitive name filter"),
|
|
7767
7788
|
exact_name: z23.string().optional().describe("Exact workspace name filter"),
|
|
7768
7789
|
status: z23.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
|
|
@@ -7811,8 +7832,8 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7811
7832
|
},
|
|
7812
7833
|
listWorkspaceMembers: {
|
|
7813
7834
|
workspace_id: z23.string().describe("The workspace ID to list members for"),
|
|
7814
|
-
current_page:
|
|
7815
|
-
page_size:
|
|
7835
|
+
current_page: CurrentPageSchema.describe("Zero-based page number"),
|
|
7836
|
+
page_size: PageSizeSchema.describe("Number of members per page"),
|
|
7816
7837
|
role: z23.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
|
|
7817
7838
|
email: z23.string().email().optional().describe("Filter by member email")
|
|
7818
7839
|
},
|
|
@@ -7846,9 +7867,9 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7846
7867
|
),
|
|
7847
7868
|
role: z23.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
|
|
7848
7869
|
page: z23.coerce.number().int().nonnegative().optional().describe(
|
|
7849
|
-
"Zero-based results page to retrieve; the first page is 0.
|
|
7870
|
+
"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."
|
|
7850
7871
|
),
|
|
7851
|
-
page_size:
|
|
7872
|
+
page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
|
|
7852
7873
|
},
|
|
7853
7874
|
deleteScimWorkspaceMapping: {
|
|
7854
7875
|
mapping_id: z23.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
|
|
@@ -7856,9 +7877,11 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7856
7877
|
listScimGroups: {
|
|
7857
7878
|
search: z23.string().optional().describe("Case-insensitive text to match against SCIM group names"),
|
|
7858
7879
|
page: z23.coerce.number().int().nonnegative().optional().describe(
|
|
7859
|
-
"Zero-based results page to retrieve; the first page is 0.
|
|
7880
|
+
"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."
|
|
7860
7881
|
),
|
|
7861
|
-
page_size:
|
|
7882
|
+
page_size: PageSizeSchema.describe(
|
|
7883
|
+
"SCIM groups per page, from 1 through 100"
|
|
7884
|
+
)
|
|
7862
7885
|
}
|
|
7863
7886
|
};
|
|
7864
7887
|
function formatWorkspaceDefaults(defaults) {
|