portkey-admin-mcp 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ENDPOINTS.md +25 -15
- package/README.md +6 -6
- package/build/index.js +895 -806
- package/build/server.js +895 -806
- package/docs/DISTRIBUTION.md +1 -1
- package/package.json +3 -3
package/build/server.js
CHANGED
|
@@ -467,6 +467,7 @@ var AnalyticsService = class extends BaseService {
|
|
|
467
467
|
api_key_ids: params.api_key_ids,
|
|
468
468
|
metadata: params.metadata,
|
|
469
469
|
ai_org_model: params.ai_org_model,
|
|
470
|
+
deployment_id: params.deployment_id,
|
|
470
471
|
trace_id: params.trace_id,
|
|
471
472
|
span_id: params.span_id,
|
|
472
473
|
prompt_slug: params.prompt_slug
|
|
@@ -635,6 +636,24 @@ var AnalyticsService = class extends BaseService {
|
|
|
635
636
|
this.buildAnalyticsParams(params)
|
|
636
637
|
);
|
|
637
638
|
}
|
|
639
|
+
async getAnalyticsGroupMcp(params) {
|
|
640
|
+
return this.get(
|
|
641
|
+
"/analytics/groups/mcp",
|
|
642
|
+
this.buildAnalyticsParams(params)
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
async getAnalyticsGroupA2a(params) {
|
|
646
|
+
return this.get(
|
|
647
|
+
"/analytics/groups/a2a",
|
|
648
|
+
this.buildAnalyticsParams(params)
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
async getAnalyticsGroupWorkspaces(params) {
|
|
652
|
+
return this.get(
|
|
653
|
+
"/analytics/groups/workspaces",
|
|
654
|
+
this.buildAnalyticsParams(params)
|
|
655
|
+
);
|
|
656
|
+
}
|
|
638
657
|
};
|
|
639
658
|
|
|
640
659
|
// src/services/audit.service.ts
|
|
@@ -937,7 +956,8 @@ var IntegrationsService = class extends BaseService {
|
|
|
937
956
|
current_page: params?.current_page,
|
|
938
957
|
page_size: params?.page_size,
|
|
939
958
|
workspace_id: params?.workspace_id,
|
|
940
|
-
type: params?.type
|
|
959
|
+
type: params?.type,
|
|
960
|
+
tags: params?.tags === void 0 ? void 0 : JSON.stringify(params.tags)
|
|
941
961
|
});
|
|
942
962
|
}
|
|
943
963
|
// Create a new integration
|
|
@@ -2129,7 +2149,7 @@ function getSharedPortkeyService(apiKey) {
|
|
|
2129
2149
|
}
|
|
2130
2150
|
|
|
2131
2151
|
// src/tools/index.ts
|
|
2132
|
-
import { z as
|
|
2152
|
+
import { z as z25 } from "zod";
|
|
2133
2153
|
|
|
2134
2154
|
// src/lib/type-guards.ts
|
|
2135
2155
|
function isRecord(value) {
|
|
@@ -2322,6 +2342,12 @@ var baseAnalyticsSchema = {
|
|
|
2322
2342
|
provider_models: z3.array(z3.string()).optional().describe(
|
|
2323
2343
|
"Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
|
|
2324
2344
|
),
|
|
2345
|
+
deployment_id: z3.string().optional().describe(
|
|
2346
|
+
"Comma-separated list of deployment IDs (UUIDs) to filter by. Prefer deployment_ids for structured inputs."
|
|
2347
|
+
),
|
|
2348
|
+
deployment_ids: z3.array(z3.string()).optional().describe(
|
|
2349
|
+
"Structured alias for deployment_id. Use an array of deployment UUIDs; normalized to the comma-separated Portkey query param."
|
|
2350
|
+
),
|
|
2325
2351
|
trace_id: z3.string().optional().describe(
|
|
2326
2352
|
"Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
|
|
2327
2353
|
),
|
|
@@ -2469,6 +2495,7 @@ function normalizeAnalyticsParams(params) {
|
|
|
2469
2495
|
trace_ids,
|
|
2470
2496
|
span_ids,
|
|
2471
2497
|
provider_models,
|
|
2498
|
+
deployment_ids,
|
|
2472
2499
|
metadata_filter,
|
|
2473
2500
|
...legacyParams
|
|
2474
2501
|
} = params;
|
|
@@ -2499,6 +2526,10 @@ function normalizeAnalyticsParams(params) {
|
|
|
2499
2526
|
if (providerModels !== void 0) {
|
|
2500
2527
|
normalizedParams.ai_org_model = providerModels;
|
|
2501
2528
|
}
|
|
2529
|
+
const deploymentId = normalizeCommaSeparatedParam(deployment_ids) ?? normalizeCommaSeparatedParam(legacyParams.deployment_id);
|
|
2530
|
+
if (deploymentId !== void 0) {
|
|
2531
|
+
normalizedParams.deployment_id = deploymentId;
|
|
2532
|
+
}
|
|
2502
2533
|
const traceId = normalizeCommaSeparatedParam(trace_ids) ?? normalizeCommaSeparatedParam(legacyParams.trace_id);
|
|
2503
2534
|
if (traceId !== void 0) {
|
|
2504
2535
|
normalizedParams.trace_id = traceId;
|
|
@@ -2808,6 +2839,42 @@ function registerAnalyticsTools(server, service) {
|
|
|
2808
2839
|
return jsonResult(formatGroupedAnalytics(analytics, "metadata_groups"));
|
|
2809
2840
|
}
|
|
2810
2841
|
);
|
|
2842
|
+
server.tool(
|
|
2843
|
+
"get_analytics_group_mcp",
|
|
2844
|
+
"Get a paginated per-MCP-server breakdown with total_groups, group_count, and an mcp_servers array containing each server name and its request count. Use this to see which MCP servers receive the most traffic; use get_analytics_group_a2a for A2A agents or get_analytics_group_users and get_analytics_group_models for other breakdowns.",
|
|
2845
|
+
paginatedAnalyticsSchema,
|
|
2846
|
+
async (params) => {
|
|
2847
|
+
const analytics = await service.analytics.getAnalyticsGroupMcp(
|
|
2848
|
+
normalizeAnalyticsParams(params)
|
|
2849
|
+
);
|
|
2850
|
+
return jsonResult(formatGroupedAnalytics(analytics, "mcp_servers"));
|
|
2851
|
+
}
|
|
2852
|
+
);
|
|
2853
|
+
server.tool(
|
|
2854
|
+
"get_analytics_group_a2a",
|
|
2855
|
+
"Get a paginated per-agent breakdown with total_groups, group_count, and an agents array containing each A2A (agent-to-agent) agent name and its request count. Use this to see which agents receive the most traffic; use get_analytics_group_mcp for MCP servers instead.",
|
|
2856
|
+
paginatedAnalyticsSchema,
|
|
2857
|
+
async (params) => {
|
|
2858
|
+
const analytics = await service.analytics.getAnalyticsGroupA2a(
|
|
2859
|
+
normalizeAnalyticsParams(params)
|
|
2860
|
+
);
|
|
2861
|
+
return jsonResult(formatGroupedAnalytics(analytics, "agents"));
|
|
2862
|
+
}
|
|
2863
|
+
);
|
|
2864
|
+
server.tool(
|
|
2865
|
+
"get_analytics_group_workspaces",
|
|
2866
|
+
"Get a paginated per-workspace breakdown with total_groups, group_count, is_quota_exceeded when reported, and a workspaces array containing each workspace_slug with request count and cost. Use this for org-wide chargeback or comparing workspaces; pass workspace_slug to other analytics tools to drill into one workspace.",
|
|
2867
|
+
paginatedAnalyticsSchema,
|
|
2868
|
+
async (params) => {
|
|
2869
|
+
const analytics = await service.analytics.getAnalyticsGroupWorkspaces(
|
|
2870
|
+
normalizeAnalyticsParams(params)
|
|
2871
|
+
);
|
|
2872
|
+
return jsonResult({
|
|
2873
|
+
...formatGroupedAnalytics(analytics, "workspaces"),
|
|
2874
|
+
is_quota_exceeded: analytics.is_quota_exceeded
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
);
|
|
2811
2878
|
}
|
|
2812
2879
|
|
|
2813
2880
|
// src/tools/audit.tools.ts
|
|
@@ -2902,7 +2969,10 @@ var COLLECTIONS_TOOL_SCHEMAS = {
|
|
|
2902
2969
|
name: z5.string().describe(
|
|
2903
2970
|
"Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
|
|
2904
2971
|
),
|
|
2905
|
-
workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
|
|
2972
|
+
workspace_id: z5.string().optional().describe("Workspace ID to create collection in"),
|
|
2973
|
+
parent_collection_id: z5.string().optional().describe(
|
|
2974
|
+
"ID or slug of the parent collection to nest under; omit for a top-level collection"
|
|
2975
|
+
)
|
|
2906
2976
|
},
|
|
2907
2977
|
getCollection: {
|
|
2908
2978
|
collection_id: z5.string().describe("Collection ID or slug to retrieve")
|
|
@@ -2919,7 +2989,7 @@ var COLLECTIONS_TOOL_SCHEMAS = {
|
|
|
2919
2989
|
function registerCollectionsTools(server, service) {
|
|
2920
2990
|
server.tool(
|
|
2921
2991
|
"list_collections",
|
|
2922
|
-
"List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
|
|
2992
|
+
"List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, parent collection ids, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
|
|
2923
2993
|
COLLECTIONS_TOOL_SCHEMAS.listCollections,
|
|
2924
2994
|
async (params) => {
|
|
2925
2995
|
const collections = await service.collections.listCollections(params);
|
|
@@ -2930,6 +3000,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2930
3000
|
name: collection.name,
|
|
2931
3001
|
slug: collection.slug,
|
|
2932
3002
|
workspace_id: collection.workspace_id,
|
|
3003
|
+
parent_collection_id: collection.parent_collection_id,
|
|
2933
3004
|
created_at: collection.created_at,
|
|
2934
3005
|
last_updated_at: collection.last_updated_at
|
|
2935
3006
|
}))
|
|
@@ -2938,7 +3009,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2938
3009
|
);
|
|
2939
3010
|
server.tool(
|
|
2940
3011
|
"create_collection",
|
|
2941
|
-
"Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt;
|
|
3012
|
+
"Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; set parent_collection_id to nest it under an existing collection. Returns the collection id and slug, and does not move any prompts.",
|
|
2942
3013
|
COLLECTIONS_TOOL_SCHEMAS.createCollection,
|
|
2943
3014
|
async (params) => {
|
|
2944
3015
|
const result = await service.collections.createCollection(params);
|
|
@@ -2951,7 +3022,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2951
3022
|
);
|
|
2952
3023
|
server.tool(
|
|
2953
3024
|
"get_collection",
|
|
2954
|
-
"Fetch one collection by id or slug and return its name, slug, workspace, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
|
|
3025
|
+
"Fetch one collection by id or slug and return its name, slug, workspace, parent collection id, child collections with prompt counts, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
|
|
2955
3026
|
COLLECTIONS_TOOL_SCHEMAS.getCollection,
|
|
2956
3027
|
async (params) => {
|
|
2957
3028
|
const collection = await service.collections.getCollection(
|
|
@@ -2962,6 +3033,8 @@ function registerCollectionsTools(server, service) {
|
|
|
2962
3033
|
name: collection.name,
|
|
2963
3034
|
slug: collection.slug,
|
|
2964
3035
|
workspace_id: collection.workspace_id,
|
|
3036
|
+
parent_collection_id: collection.parent_collection_id,
|
|
3037
|
+
child_collections: collection.child_collections,
|
|
2965
3038
|
created_at: collection.created_at,
|
|
2966
3039
|
last_updated_at: collection.last_updated_at
|
|
2967
3040
|
});
|
|
@@ -3219,66 +3292,73 @@ function registerConfigsTools(server, service) {
|
|
|
3219
3292
|
}
|
|
3220
3293
|
|
|
3221
3294
|
// src/tools/deployments.tools.ts
|
|
3295
|
+
import { z as z8 } from "zod";
|
|
3296
|
+
|
|
3297
|
+
// src/tools/tags.schemas.ts
|
|
3222
3298
|
import { z as z7 } from "zod";
|
|
3223
|
-
var
|
|
3224
|
-
var deploymentTypeSchema = z7.enum(["production", "non_production"]);
|
|
3225
|
-
var deploymentStatusSchema = z7.enum(["active", "archived"]);
|
|
3226
|
-
var deploymentTagsSchema = z7.record(
|
|
3299
|
+
var resourceTagsSchema = z7.record(
|
|
3227
3300
|
z7.string().regex(
|
|
3228
3301
|
/^[a-zA-Z0-9_-]+$/,
|
|
3229
3302
|
"Tag keys may contain only letters, numbers, underscores, and hyphens"
|
|
3230
3303
|
),
|
|
3231
3304
|
z7.string()
|
|
3232
3305
|
);
|
|
3306
|
+
var integrationTagsSchema = z7.record(z7.string(), z7.string());
|
|
3307
|
+
|
|
3308
|
+
// src/tools/deployments.tools.ts
|
|
3309
|
+
var binaryFlagSchema = z8.union([z8.literal(0), z8.literal(1)]);
|
|
3310
|
+
var deploymentTypeSchema = z8.enum(["production", "non_production"]);
|
|
3311
|
+
var deploymentStatusSchema = z8.enum(["active", "archived"]);
|
|
3312
|
+
var deploymentTagsSchema = resourceTagsSchema;
|
|
3233
3313
|
var authSettingsSchema = {
|
|
3234
|
-
gateway_base_url:
|
|
3235
|
-
mcp_gateway_base_url:
|
|
3314
|
+
gateway_base_url: z8.url().optional().describe("Self-hosted Gateway base URL"),
|
|
3315
|
+
mcp_gateway_base_url: z8.url().optional().describe("MCP Gateway base URL"),
|
|
3236
3316
|
is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
|
|
3237
3317
|
is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
|
|
3238
|
-
workspaces_allowed:
|
|
3239
|
-
jwt_subs_allowed:
|
|
3240
|
-
jwt_sub_workspace_mapping:
|
|
3318
|
+
workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
|
|
3319
|
+
jwt_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values allowed to use the deployment"),
|
|
3320
|
+
jwt_sub_workspace_mapping: z8.record(z8.string(), z8.string()).optional().describe("JWT subject to workspace-slug mapping")
|
|
3241
3321
|
};
|
|
3242
3322
|
var DEPLOYMENTS_TOOL_SCHEMAS = {
|
|
3243
3323
|
listDeployments: {
|
|
3244
|
-
organisation_id:
|
|
3324
|
+
organisation_id: z8.string().optional().describe("Filter by organisation UUID"),
|
|
3245
3325
|
status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
|
|
3246
3326
|
type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
|
|
3247
|
-
workspace_slug:
|
|
3248
|
-
search:
|
|
3327
|
+
workspace_slug: z8.array(z8.string()).optional().describe("Filter by one or more workspace slugs"),
|
|
3328
|
+
search: z8.string().optional().describe("Search deployment names"),
|
|
3249
3329
|
tags: deploymentTagsSchema.optional().describe("Match deployments with all supplied tags")
|
|
3250
3330
|
},
|
|
3251
3331
|
registerDeployment: {
|
|
3252
|
-
name:
|
|
3253
|
-
organisation_id:
|
|
3254
|
-
slug:
|
|
3332
|
+
name: z8.string().min(1).describe("Deployment display name"),
|
|
3333
|
+
organisation_id: z8.string().optional().describe("Owning organisation UUID"),
|
|
3334
|
+
slug: z8.string().min(1).max(50).optional().describe("Optional deployment slug"),
|
|
3255
3335
|
type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
|
|
3256
|
-
deployment_config:
|
|
3257
|
-
is_default:
|
|
3336
|
+
deployment_config: z8.record(z8.string(), z8.unknown()).optional().describe("Gateway deployment configuration"),
|
|
3337
|
+
is_default: z8.boolean().optional().describe("Make this the default deployment"),
|
|
3258
3338
|
tags: deploymentTagsSchema.nullable().optional().describe("Deployment tags, or null to create without tags"),
|
|
3259
3339
|
...authSettingsSchema
|
|
3260
3340
|
},
|
|
3261
3341
|
getDeployment: {
|
|
3262
|
-
id:
|
|
3263
|
-
organisation_id:
|
|
3342
|
+
id: z8.string().min(1).describe("Deployment UUID or self"),
|
|
3343
|
+
organisation_id: z8.string().optional().describe("Organisation UUID scope")
|
|
3264
3344
|
},
|
|
3265
3345
|
updateDeployment: {
|
|
3266
|
-
id:
|
|
3267
|
-
name:
|
|
3346
|
+
id: z8.string().min(1).describe("Deployment UUID"),
|
|
3347
|
+
name: z8.string().optional().describe("Replacement display name"),
|
|
3268
3348
|
type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
|
|
3269
3349
|
status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
|
|
3270
|
-
deployment_config:
|
|
3271
|
-
is_default:
|
|
3272
|
-
rotate_auth:
|
|
3273
|
-
override_existing:
|
|
3350
|
+
deployment_config: z8.record(z8.string(), z8.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
|
|
3351
|
+
is_default: z8.boolean().optional().describe("Whether this is the default deployment"),
|
|
3352
|
+
rotate_auth: z8.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
|
|
3353
|
+
override_existing: z8.boolean().optional().describe("Allow replacement of existing deployment settings"),
|
|
3274
3354
|
tags: deploymentTagsSchema.nullable().optional().describe("Replacement deployment tags, or null to clear all tags"),
|
|
3275
3355
|
...authSettingsSchema,
|
|
3276
|
-
allow_all_workspaces:
|
|
3277
|
-
remove_workspaces_allowed:
|
|
3278
|
-
remove_subs_allowed:
|
|
3356
|
+
allow_all_workspaces: z8.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
|
|
3357
|
+
remove_workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs to remove from the allowlist"),
|
|
3358
|
+
remove_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values to remove from the allowlist")
|
|
3279
3359
|
},
|
|
3280
3360
|
archiveDeployment: {
|
|
3281
|
-
id:
|
|
3361
|
+
id: z8.string().min(1).describe("Deployment UUID to archive")
|
|
3282
3362
|
}
|
|
3283
3363
|
};
|
|
3284
3364
|
function compact(value) {
|
|
@@ -3388,100 +3468,100 @@ function registerDeploymentsTools(server, service) {
|
|
|
3388
3468
|
}
|
|
3389
3469
|
|
|
3390
3470
|
// src/tools/guardrails.tools.ts
|
|
3391
|
-
import { z as
|
|
3392
|
-
var guardrailCheckSchema =
|
|
3393
|
-
id:
|
|
3394
|
-
name:
|
|
3395
|
-
is_enabled:
|
|
3396
|
-
parameters:
|
|
3471
|
+
import { z as z9 } from "zod";
|
|
3472
|
+
var guardrailCheckSchema = z9.object({
|
|
3473
|
+
id: z9.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
|
|
3474
|
+
name: z9.string().optional().describe("Display name for the check"),
|
|
3475
|
+
is_enabled: z9.boolean().optional().describe("Whether the check is enabled"),
|
|
3476
|
+
parameters: z9.record(z9.string(), z9.unknown()).optional().describe(
|
|
3397
3477
|
"Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
|
|
3398
3478
|
)
|
|
3399
3479
|
});
|
|
3400
|
-
var guardrailFeedbackSchema =
|
|
3401
|
-
value:
|
|
3402
|
-
weight:
|
|
3403
|
-
metadata:
|
|
3480
|
+
var guardrailFeedbackSchema = z9.object({
|
|
3481
|
+
value: z9.coerce.number().optional().describe("Feedback value"),
|
|
3482
|
+
weight: z9.coerce.number().optional().describe("Feedback weight"),
|
|
3483
|
+
metadata: z9.record(z9.string(), z9.unknown()).optional().describe("Additional metadata")
|
|
3404
3484
|
});
|
|
3405
|
-
var guardrailActionSchema =
|
|
3406
|
-
deny:
|
|
3407
|
-
async:
|
|
3485
|
+
var guardrailActionSchema = z9.object({
|
|
3486
|
+
deny: z9.boolean().optional().describe("Whether to deny the request on check failure"),
|
|
3487
|
+
async: z9.boolean().optional().describe("Whether to run checks asynchronously"),
|
|
3408
3488
|
on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
|
|
3409
3489
|
on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
|
|
3410
|
-
on_fail_action:
|
|
3411
|
-
message:
|
|
3490
|
+
on_fail_action: z9.string().optional().describe("Simple action on failure (e.g., 'block')"),
|
|
3491
|
+
message: z9.string().optional().describe("Message to return when guardrail triggers")
|
|
3412
3492
|
});
|
|
3413
|
-
var workspaceGuardrailExclusionSchema =
|
|
3414
|
-
workspace_id:
|
|
3415
|
-
excluded:
|
|
3493
|
+
var workspaceGuardrailExclusionSchema = z9.object({
|
|
3494
|
+
workspace_id: z9.string().describe("Workspace ID whose exclusion state changes"),
|
|
3495
|
+
excluded: z9.boolean().describe("True to exclude this workspace; false to restore enforcement")
|
|
3416
3496
|
});
|
|
3417
|
-
var guardrailTargetSchema =
|
|
3497
|
+
var guardrailTargetSchema = z9.enum(["llm", "mcp_tools"]);
|
|
3418
3498
|
var guardrailMcpServerMappingConfigShape = {
|
|
3419
|
-
run_on:
|
|
3420
|
-
mcp_integration_capability_ids:
|
|
3499
|
+
run_on: z9.array(z9.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
|
|
3500
|
+
mcp_integration_capability_ids: z9.array(z9.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
|
|
3421
3501
|
};
|
|
3422
|
-
var guardrailMcpServerMappingConfigSchema =
|
|
3502
|
+
var guardrailMcpServerMappingConfigSchema = z9.object(
|
|
3423
3503
|
guardrailMcpServerMappingConfigShape
|
|
3424
3504
|
);
|
|
3425
3505
|
var GUARDRAILS_TOOL_SCHEMAS = {
|
|
3426
3506
|
getOrganisationDefaults: {},
|
|
3427
3507
|
listGuardrails: {
|
|
3428
|
-
workspace_id:
|
|
3429
|
-
organisation_id:
|
|
3508
|
+
workspace_id: z9.string().optional().describe("Filter guardrails by workspace ID"),
|
|
3509
|
+
organisation_id: z9.string().optional().describe("Filter guardrails by organization ID"),
|
|
3430
3510
|
page_size: PageSizeSchema.describe(
|
|
3431
3511
|
"Number of items per page (1-100, default: 100)"
|
|
3432
3512
|
),
|
|
3433
3513
|
current_page: CurrentPageSchema
|
|
3434
3514
|
},
|
|
3435
3515
|
getGuardrail: {
|
|
3436
|
-
guardrail_id:
|
|
3516
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
|
|
3437
3517
|
},
|
|
3438
3518
|
createGuardrail: {
|
|
3439
|
-
name:
|
|
3519
|
+
name: z9.string().describe("Name of the guardrail"),
|
|
3440
3520
|
target: guardrailTargetSchema.optional().describe("LLM traffic by default, or MCP tool calls"),
|
|
3441
|
-
checks:
|
|
3521
|
+
checks: z9.array(guardrailCheckSchema).min(1).optional().describe(
|
|
3442
3522
|
"Checks to apply; at least one entry. Required when target is llm."
|
|
3443
3523
|
),
|
|
3444
3524
|
actions: guardrailActionSchema.optional().describe("Actions to take when guardrail checks pass or fail"),
|
|
3445
|
-
workspace_id:
|
|
3446
|
-
organisation_id:
|
|
3525
|
+
workspace_id: z9.string().optional().describe("Workspace ID to create the guardrail in"),
|
|
3526
|
+
organisation_id: z9.string().optional().describe("Organisation ID (required if workspace_id not provided)")
|
|
3447
3527
|
},
|
|
3448
3528
|
updateGuardrail: {
|
|
3449
|
-
guardrail_id:
|
|
3450
|
-
name:
|
|
3451
|
-
checks:
|
|
3529
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug to update"),
|
|
3530
|
+
name: z9.string().optional().describe("New name for the guardrail"),
|
|
3531
|
+
checks: z9.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
|
|
3452
3532
|
actions: guardrailActionSchema.optional().describe("Updated actions configuration")
|
|
3453
3533
|
},
|
|
3454
3534
|
deleteGuardrail: {
|
|
3455
|
-
guardrail_id:
|
|
3535
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug to delete")
|
|
3456
3536
|
},
|
|
3457
3537
|
updateOrganisationDefaults: {
|
|
3458
|
-
input_guardrails:
|
|
3459
|
-
output_guardrails:
|
|
3538
|
+
input_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
|
|
3539
|
+
output_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
|
|
3460
3540
|
},
|
|
3461
3541
|
listWorkspaceExclusions: {
|
|
3462
|
-
organisation_id:
|
|
3542
|
+
organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be listed")
|
|
3463
3543
|
},
|
|
3464
3544
|
updateWorkspaceExclusions: {
|
|
3465
|
-
organisation_id:
|
|
3466
|
-
workspaces:
|
|
3467
|
-
override_existing:
|
|
3545
|
+
organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be updated"),
|
|
3546
|
+
workspaces: z9.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
|
|
3547
|
+
override_existing: z9.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
|
|
3468
3548
|
},
|
|
3469
3549
|
listGuardrailMcpServerMappings: {
|
|
3470
|
-
guardrail_id:
|
|
3550
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug")
|
|
3471
3551
|
},
|
|
3472
3552
|
replaceGuardrailMcpServerMappings: {
|
|
3473
|
-
guardrail_id:
|
|
3474
|
-
mcp_servers:
|
|
3553
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
|
|
3554
|
+
mcp_servers: z9.record(z9.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
|
|
3475
3555
|
"Complete MCP-server mapping set keyed by server UUID; an empty object clears every mapping"
|
|
3476
3556
|
)
|
|
3477
3557
|
},
|
|
3478
3558
|
upsertGuardrailMcpServerMapping: {
|
|
3479
|
-
guardrail_id:
|
|
3480
|
-
mcp_server_id:
|
|
3559
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
|
|
3560
|
+
mcp_server_id: z9.string().uuid().describe("MCP server UUID"),
|
|
3481
3561
|
...guardrailMcpServerMappingConfigShape
|
|
3482
3562
|
}
|
|
3483
3563
|
};
|
|
3484
|
-
var createGuardrailSchema =
|
|
3564
|
+
var createGuardrailSchema = z9.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
|
|
3485
3565
|
if ((value.target ?? "llm") === "llm" && (!value.checks || !value.actions)) {
|
|
3486
3566
|
context.addIssue({
|
|
3487
3567
|
code: "custom",
|
|
@@ -3490,10 +3570,10 @@ var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).s
|
|
|
3490
3570
|
});
|
|
3491
3571
|
}
|
|
3492
3572
|
});
|
|
3493
|
-
var replaceGuardrailMcpServerMappingsSchema =
|
|
3573
|
+
var replaceGuardrailMcpServerMappingsSchema = z9.object(
|
|
3494
3574
|
GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings
|
|
3495
3575
|
);
|
|
3496
|
-
var upsertGuardrailMcpServerMappingSchema =
|
|
3576
|
+
var upsertGuardrailMcpServerMappingSchema = z9.object(
|
|
3497
3577
|
GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping
|
|
3498
3578
|
);
|
|
3499
3579
|
var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
|
|
@@ -3658,7 +3738,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3658
3738
|
);
|
|
3659
3739
|
server.tool(
|
|
3660
3740
|
"list_guardrail_mcp_servers",
|
|
3661
|
-
"List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
|
|
3741
|
+
"List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Requires a guardrail with target mcp_tools. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
|
|
3662
3742
|
GUARDRAILS_TOOL_SCHEMAS.listGuardrailMcpServerMappings,
|
|
3663
3743
|
{
|
|
3664
3744
|
title: "List Guardrail MCP Servers",
|
|
@@ -3673,7 +3753,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3673
3753
|
);
|
|
3674
3754
|
server.tool(
|
|
3675
3755
|
"replace_guardrail_mcp_servers",
|
|
3676
|
-
"Replace the complete MCP-server mapping set for one guardrail. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
|
|
3756
|
+
"Replace the complete MCP-server mapping set for one guardrail. Requires a guardrail with target mcp_tools. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
|
|
3677
3757
|
GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings,
|
|
3678
3758
|
{
|
|
3679
3759
|
title: "Replace Guardrail MCP Servers",
|
|
@@ -3694,7 +3774,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3694
3774
|
);
|
|
3695
3775
|
server.tool(
|
|
3696
3776
|
"upsert_guardrail_mcp_server",
|
|
3697
|
-
"Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
|
|
3777
|
+
"Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. Requires a guardrail with target mcp_tools. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
|
|
3698
3778
|
GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping,
|
|
3699
3779
|
{
|
|
3700
3780
|
title: "Upsert Guardrail MCP Server",
|
|
@@ -3758,7 +3838,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3758
3838
|
}
|
|
3759
3839
|
|
|
3760
3840
|
// src/tools/integrations.tools.ts
|
|
3761
|
-
import { z as
|
|
3841
|
+
import { z as z11 } from "zod";
|
|
3762
3842
|
|
|
3763
3843
|
// src/lib/limits.ts
|
|
3764
3844
|
var PERIODIC_RESET_DEFAULT = "monthly";
|
|
@@ -3801,25 +3881,25 @@ function buildRateLimits(params) {
|
|
|
3801
3881
|
}
|
|
3802
3882
|
|
|
3803
3883
|
// src/tools/secret-mapping.schemas.ts
|
|
3804
|
-
import { z as
|
|
3884
|
+
import { z as z10 } from "zod";
|
|
3805
3885
|
function createSecretMappingSchema({
|
|
3806
3886
|
allowKeyTarget,
|
|
3807
3887
|
targetFieldDescription,
|
|
3808
3888
|
secretReferenceDescription,
|
|
3809
3889
|
valueFormatDescription
|
|
3810
3890
|
}) {
|
|
3811
|
-
return
|
|
3812
|
-
target_field:
|
|
3891
|
+
return z10.object({
|
|
3892
|
+
target_field: z10.string().refine(
|
|
3813
3893
|
(value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
|
|
3814
3894
|
allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
|
|
3815
3895
|
).describe(targetFieldDescription),
|
|
3816
|
-
secret_reference_id:
|
|
3817
|
-
secret_key:
|
|
3818
|
-
value_format:
|
|
3896
|
+
secret_reference_id: z10.string().describe(secretReferenceDescription),
|
|
3897
|
+
secret_key: z10.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
|
|
3898
|
+
value_format: z10.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
|
|
3819
3899
|
});
|
|
3820
3900
|
}
|
|
3821
3901
|
function uniqueSecretMappingsSchema(itemSchema) {
|
|
3822
|
-
return
|
|
3902
|
+
return z10.array(itemSchema).superRefine((mappings, context) => {
|
|
3823
3903
|
const firstIndexByTarget = /* @__PURE__ */ new Map();
|
|
3824
3904
|
for (const [index, mapping] of mappings.entries()) {
|
|
3825
3905
|
const firstIndex = firstIndexByTarget.get(mapping.target_field);
|
|
@@ -3846,8 +3926,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
|
|
|
3846
3926
|
var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
3847
3927
|
integrationSecretMappingSchema
|
|
3848
3928
|
);
|
|
3849
|
-
var nullableMultiplier = (description) =>
|
|
3850
|
-
var pricingMultiplierSchema =
|
|
3929
|
+
var nullableMultiplier = (description) => z11.coerce.number().nonnegative().nullable().optional().describe(description);
|
|
3930
|
+
var pricingMultiplierSchema = z11.object({
|
|
3851
3931
|
default: nullableMultiplier(
|
|
3852
3932
|
"Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
|
|
3853
3933
|
),
|
|
@@ -3891,175 +3971,178 @@ var pricingMultiplierSchema = z10.object({
|
|
|
3891
3971
|
cache_write_image_input_token: nullableMultiplier(
|
|
3892
3972
|
"Cache-write image input token price multiplier"
|
|
3893
3973
|
),
|
|
3894
|
-
image:
|
|
3974
|
+
image: z11.object({
|
|
3895
3975
|
default: nullableMultiplier("Default image-generation price multiplier")
|
|
3896
3976
|
}).nullable().optional().describe("Image-generation pricing multipliers"),
|
|
3897
|
-
additional_units:
|
|
3977
|
+
additional_units: z11.record(z11.string(), z11.coerce.number().nonnegative().nullable()).nullable().optional().describe(
|
|
3898
3978
|
"Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
|
|
3899
3979
|
)
|
|
3900
3980
|
});
|
|
3901
|
-
var pricingAdjustmentsSchema =
|
|
3981
|
+
var pricingAdjustmentsSchema = z11.object({
|
|
3902
3982
|
multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
|
|
3903
3983
|
}).nullable();
|
|
3904
|
-
var modelConfigurationsSchema =
|
|
3905
|
-
custom_host:
|
|
3906
|
-
custom_headers:
|
|
3984
|
+
var modelConfigurationsSchema = z11.object({
|
|
3985
|
+
custom_host: z11.string().url().optional().describe("Custom upstream URL used only for this model"),
|
|
3986
|
+
custom_headers: z11.record(z11.string(), z11.string()).optional().describe("Headers sent only for this model; values may contain secrets")
|
|
3907
3987
|
});
|
|
3908
|
-
var tokenPricingSchema =
|
|
3909
|
-
price:
|
|
3988
|
+
var tokenPricingSchema = z11.object({
|
|
3989
|
+
price: z11.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
|
|
3910
3990
|
});
|
|
3911
|
-
var integrationModelPricingSchema =
|
|
3912
|
-
type:
|
|
3913
|
-
pay_as_you_go:
|
|
3991
|
+
var integrationModelPricingSchema = z11.object({
|
|
3992
|
+
type: z11.literal("static").describe("Static per-token pricing configuration"),
|
|
3993
|
+
pay_as_you_go: z11.object({
|
|
3914
3994
|
request_token: tokenPricingSchema.optional().describe("Input token pricing"),
|
|
3915
3995
|
response_token: tokenPricingSchema.optional().describe("Output token pricing")
|
|
3916
3996
|
}).optional().describe("Pay-as-you-go rates for this integration model")
|
|
3917
3997
|
});
|
|
3918
3998
|
var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
3919
3999
|
getModelPricing: {
|
|
3920
|
-
provider:
|
|
4000
|
+
provider: z11.string().describe(
|
|
3921
4001
|
"Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
|
|
3922
4002
|
),
|
|
3923
|
-
model:
|
|
4003
|
+
model: z11.string().describe("Exact provider model identifier, such as gpt-4o")
|
|
3924
4004
|
},
|
|
3925
4005
|
listIntegrations: {
|
|
3926
4006
|
current_page: CurrentPageSchema,
|
|
3927
4007
|
page_size: PageSizeSchema.describe(
|
|
3928
4008
|
"Number of results per page (default 100, max 100)"
|
|
3929
4009
|
),
|
|
3930
|
-
workspace_id:
|
|
3931
|
-
type:
|
|
4010
|
+
workspace_id: z11.string().optional().describe("Filter integrations accessible by a specific workspace"),
|
|
4011
|
+
type: z11.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
3932
4012
|
"Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
|
|
3933
|
-
)
|
|
4013
|
+
),
|
|
4014
|
+
tags: integrationTagsSchema.optional().describe("Match integrations that carry all supplied tags")
|
|
3934
4015
|
},
|
|
3935
4016
|
createIntegration: {
|
|
3936
|
-
name:
|
|
3937
|
-
ai_provider_id:
|
|
4017
|
+
name: z11.string().describe("Human-readable name for the integration"),
|
|
4018
|
+
ai_provider_id: z11.string().describe(
|
|
3938
4019
|
"ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
|
|
3939
4020
|
),
|
|
3940
|
-
slug:
|
|
4021
|
+
slug: z11.string().optional().describe(
|
|
3941
4022
|
"URL-friendly identifier (auto-generated from name if not provided)"
|
|
3942
4023
|
),
|
|
3943
|
-
key:
|
|
3944
|
-
description:
|
|
3945
|
-
workspace_id:
|
|
3946
|
-
api_version:
|
|
3947
|
-
resource_name:
|
|
3948
|
-
deployment_name:
|
|
3949
|
-
aws_region:
|
|
3950
|
-
aws_access_key_id:
|
|
3951
|
-
aws_secret_access_key:
|
|
3952
|
-
vertex_project_id:
|
|
3953
|
-
vertex_region:
|
|
3954
|
-
custom_host:
|
|
3955
|
-
create_default_provider:
|
|
4024
|
+
key: z11.string().optional().describe("API key for the provider (if required)"),
|
|
4025
|
+
description: z11.string().optional().describe("Optional description of the integration"),
|
|
4026
|
+
workspace_id: z11.string().optional().describe("Workspace ID for workspace-scoped integrations"),
|
|
4027
|
+
api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4028
|
+
resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4029
|
+
deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4030
|
+
aws_region: z11.string().optional().describe("AWS region (for AWS Bedrock)"),
|
|
4031
|
+
aws_access_key_id: z11.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
|
|
4032
|
+
aws_secret_access_key: z11.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
|
|
4033
|
+
vertex_project_id: z11.string().optional().describe("GCP project ID (for Vertex AI)"),
|
|
4034
|
+
vertex_region: z11.string().optional().describe("GCP region (for Vertex AI)"),
|
|
4035
|
+
custom_host: z11.string().optional().describe("Custom base URL for the provider"),
|
|
4036
|
+
create_default_provider: z11.boolean().optional().describe(
|
|
3956
4037
|
"Create a provider automatically for a workspace-scoped integration; defaults to true"
|
|
3957
4038
|
),
|
|
3958
|
-
default_provider_slug:
|
|
4039
|
+
default_provider_slug: z11.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
|
|
3959
4040
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3960
4041
|
"Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
|
|
3961
4042
|
),
|
|
3962
4043
|
pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
|
|
3963
4044
|
"Negotiated discount or markup multipliers for cost accounting"
|
|
3964
|
-
)
|
|
4045
|
+
),
|
|
4046
|
+
tags: integrationTagsSchema.nullable().optional().describe("Integration tags, or null to create without tags")
|
|
3965
4047
|
},
|
|
3966
4048
|
getIntegration: {
|
|
3967
|
-
slug:
|
|
4049
|
+
slug: z11.string().describe("The unique slug identifier of the integration to retrieve")
|
|
3968
4050
|
},
|
|
3969
4051
|
updateIntegration: {
|
|
3970
|
-
slug:
|
|
3971
|
-
name:
|
|
3972
|
-
key:
|
|
3973
|
-
description:
|
|
3974
|
-
api_version:
|
|
3975
|
-
resource_name:
|
|
3976
|
-
deployment_name:
|
|
3977
|
-
aws_region:
|
|
3978
|
-
aws_access_key_id:
|
|
3979
|
-
aws_secret_access_key:
|
|
3980
|
-
vertex_project_id:
|
|
3981
|
-
vertex_region:
|
|
3982
|
-
custom_host:
|
|
4052
|
+
slug: z11.string().describe("The slug of the integration to update"),
|
|
4053
|
+
name: z11.string().optional().describe("New human-readable name for the integration"),
|
|
4054
|
+
key: z11.string().optional().describe("New API key for the provider"),
|
|
4055
|
+
description: z11.string().optional().describe("New description for the integration"),
|
|
4056
|
+
api_version: z11.string().optional().describe("New API version (for Azure OpenAI)"),
|
|
4057
|
+
resource_name: z11.string().optional().describe("New resource name (for Azure OpenAI)"),
|
|
4058
|
+
deployment_name: z11.string().optional().describe("New deployment name (for Azure OpenAI)"),
|
|
4059
|
+
aws_region: z11.string().optional().describe("New AWS region (for AWS Bedrock)"),
|
|
4060
|
+
aws_access_key_id: z11.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
|
|
4061
|
+
aws_secret_access_key: z11.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
|
|
4062
|
+
vertex_project_id: z11.string().optional().describe("New GCP project ID (for Vertex AI)"),
|
|
4063
|
+
vertex_region: z11.string().optional().describe("New GCP region (for Vertex AI)"),
|
|
4064
|
+
custom_host: z11.string().optional().describe("New custom base URL for the provider"),
|
|
3983
4065
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3984
4066
|
"Replacement runtime Secret Reference mappings; each target_field must be unique"
|
|
3985
4067
|
),
|
|
3986
4068
|
pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
|
|
3987
4069
|
"Replacement cost multiplier configuration, or null to clear adjustments"
|
|
3988
|
-
)
|
|
4070
|
+
),
|
|
4071
|
+
tags: integrationTagsSchema.nullable().optional().describe("Replacement integration tags, or null to clear all tags")
|
|
3989
4072
|
},
|
|
3990
4073
|
deleteIntegration: {
|
|
3991
|
-
slug:
|
|
4074
|
+
slug: z11.string().describe("The slug of the integration to delete")
|
|
3992
4075
|
},
|
|
3993
4076
|
listIntegrationModels: {
|
|
3994
|
-
slug:
|
|
4077
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
3995
4078
|
current_page: CurrentPageSchema,
|
|
3996
4079
|
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3997
4080
|
},
|
|
3998
4081
|
updateIntegrationModels: {
|
|
3999
|
-
slug:
|
|
4000
|
-
allow_all_models:
|
|
4082
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4083
|
+
allow_all_models: z11.boolean().optional().describe(
|
|
4001
4084
|
"Whether newly available provider models are enabled by default"
|
|
4002
4085
|
),
|
|
4003
|
-
models:
|
|
4004
|
-
|
|
4005
|
-
slug:
|
|
4006
|
-
model_name:
|
|
4086
|
+
models: z11.array(
|
|
4087
|
+
z11.object({
|
|
4088
|
+
slug: z11.string().describe("The model slug identifier"),
|
|
4089
|
+
model_name: z11.string().optional().describe(
|
|
4007
4090
|
"Display name for the model (required for custom models)"
|
|
4008
4091
|
),
|
|
4009
|
-
enabled:
|
|
4010
|
-
is_custom:
|
|
4011
|
-
is_finetune:
|
|
4012
|
-
base_model_slug:
|
|
4092
|
+
enabled: z11.boolean().describe("Whether the model is enabled"),
|
|
4093
|
+
is_custom: z11.boolean().optional().describe("Whether this is a custom model (default: false)"),
|
|
4094
|
+
is_finetune: z11.boolean().optional().describe("Whether this entry is a fine-tuned model"),
|
|
4095
|
+
base_model_slug: z11.string().optional().describe("Base model slug for a fine-tuned model"),
|
|
4013
4096
|
configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
|
|
4014
4097
|
pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
|
|
4015
4098
|
})
|
|
4016
4099
|
).describe("Array of model configurations to update")
|
|
4017
4100
|
},
|
|
4018
4101
|
deleteIntegrationModel: {
|
|
4019
|
-
slug:
|
|
4020
|
-
model_slug:
|
|
4102
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4103
|
+
model_slug: z11.string().describe("The slug of the model to delete")
|
|
4021
4104
|
},
|
|
4022
4105
|
listIntegrationWorkspaces: {
|
|
4023
|
-
slug:
|
|
4106
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4024
4107
|
current_page: CurrentPageSchema,
|
|
4025
4108
|
page_size: PageSizeSchema.describe("Number of results per page")
|
|
4026
4109
|
},
|
|
4027
4110
|
updateIntegrationWorkspaces: {
|
|
4028
|
-
slug:
|
|
4029
|
-
workspaces:
|
|
4030
|
-
|
|
4031
|
-
id:
|
|
4032
|
-
enabled:
|
|
4033
|
-
credit_limit:
|
|
4034
|
-
alert_threshold:
|
|
4035
|
-
rate_limit_rpm:
|
|
4036
|
-
reset_usage:
|
|
4037
|
-
create_default_provider:
|
|
4111
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4112
|
+
workspaces: z11.array(
|
|
4113
|
+
z11.object({
|
|
4114
|
+
id: z11.string().describe("The workspace ID"),
|
|
4115
|
+
enabled: z11.boolean().describe("Whether the workspace has access to this integration"),
|
|
4116
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for this workspace"),
|
|
4117
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4118
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4119
|
+
reset_usage: z11.boolean().optional().describe("Reset exhausted usage status to active"),
|
|
4120
|
+
create_default_provider: z11.boolean().optional().describe(
|
|
4038
4121
|
"Override whether a provider is auto-created for this workspace"
|
|
4039
4122
|
),
|
|
4040
|
-
default_provider_slug:
|
|
4123
|
+
default_provider_slug: z11.string().optional().describe(
|
|
4041
4124
|
"Override the auto-created provider slug for this workspace"
|
|
4042
4125
|
)
|
|
4043
4126
|
})
|
|
4044
4127
|
).describe("Array of workspace configurations to update"),
|
|
4045
|
-
global_workspace_access_enabled:
|
|
4128
|
+
global_workspace_access_enabled: z11.boolean().optional().describe(
|
|
4046
4129
|
"Enable or disable access for all current and future workspaces"
|
|
4047
4130
|
),
|
|
4048
|
-
global_credit_limit:
|
|
4131
|
+
global_credit_limit: z11.coerce.number().positive().optional().describe(
|
|
4049
4132
|
"Global cost credit limit applied with global workspace access"
|
|
4050
4133
|
),
|
|
4051
|
-
global_alert_threshold:
|
|
4052
|
-
global_rate_limit_rpm:
|
|
4053
|
-
override_existing_workspace_access:
|
|
4054
|
-
create_default_provider:
|
|
4055
|
-
default_provider_slug:
|
|
4134
|
+
global_alert_threshold: z11.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
|
|
4135
|
+
global_rate_limit_rpm: z11.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
|
|
4136
|
+
override_existing_workspace_access: z11.boolean().optional().describe("Apply global settings over existing per-workspace access"),
|
|
4137
|
+
create_default_provider: z11.boolean().optional().describe("Auto-create providers when granting workspace access"),
|
|
4138
|
+
default_provider_slug: z11.string().optional().describe("Default slug for providers auto-created in workspaces")
|
|
4056
4139
|
}
|
|
4057
4140
|
};
|
|
4058
|
-
var updateIntegrationWorkspacesSchema =
|
|
4141
|
+
var updateIntegrationWorkspacesSchema = z11.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
|
|
4059
4142
|
const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
|
|
4060
4143
|
if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
|
|
4061
4144
|
ctx.addIssue({
|
|
4062
|
-
code:
|
|
4145
|
+
code: z11.ZodIssueCode.custom,
|
|
4063
4146
|
path: ["global_workspace_access_enabled"],
|
|
4064
4147
|
message: "global_workspace_access_enabled is required when setting global limits."
|
|
4065
4148
|
});
|
|
@@ -4108,14 +4191,15 @@ function registerIntegrationsTools(server, service) {
|
|
|
4108
4191
|
);
|
|
4109
4192
|
server.tool(
|
|
4110
4193
|
"list_integrations",
|
|
4111
|
-
"List org-level AI provider connections with optional workspace or
|
|
4194
|
+
"List org-level AI provider connections with optional workspace, type, or tag filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
|
|
4112
4195
|
INTEGRATIONS_TOOL_SCHEMAS.listIntegrations,
|
|
4113
4196
|
async (params) => {
|
|
4114
4197
|
const integrations = await service.integrations.listIntegrations({
|
|
4115
4198
|
current_page: params.current_page,
|
|
4116
4199
|
page_size: params.page_size,
|
|
4117
4200
|
workspace_id: params.workspace_id,
|
|
4118
|
-
type: params.type
|
|
4201
|
+
type: params.type,
|
|
4202
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4119
4203
|
});
|
|
4120
4204
|
return jsonResult({
|
|
4121
4205
|
total: integrations.total,
|
|
@@ -4135,7 +4219,7 @@ function registerIntegrationsTools(server, service) {
|
|
|
4135
4219
|
);
|
|
4136
4220
|
server.tool(
|
|
4137
4221
|
"create_integration",
|
|
4138
|
-
"Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
|
|
4222
|
+
"Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting; tags attach key-value labels that list_integrations can filter on. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
|
|
4139
4223
|
INTEGRATIONS_TOOL_SCHEMAS.createIntegration,
|
|
4140
4224
|
{
|
|
4141
4225
|
title: "Create AI Provider Integration",
|
|
@@ -4156,7 +4240,8 @@ function registerIntegrationsTools(server, service) {
|
|
|
4156
4240
|
...params.create_default_provider !== void 0 ? { create_default_provider: params.create_default_provider } : {},
|
|
4157
4241
|
...params.default_provider_slug !== void 0 ? { default_provider_slug: params.default_provider_slug } : {},
|
|
4158
4242
|
...params.secret_mappings !== void 0 ? { secret_mappings: params.secret_mappings } : {},
|
|
4159
|
-
...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {}
|
|
4243
|
+
...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {},
|
|
4244
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4160
4245
|
});
|
|
4161
4246
|
return jsonResult({
|
|
4162
4247
|
message: `Successfully created integration "${params.name}"`,
|
|
@@ -4195,7 +4280,7 @@ function registerIntegrationsTools(server, service) {
|
|
|
4195
4280
|
);
|
|
4196
4281
|
server.tool(
|
|
4197
4282
|
"update_integration",
|
|
4198
|
-
"Update an integration's name, description, API key, provider config, Secret Reference mappings,
|
|
4283
|
+
"Update an integration's name, description, API key, provider config, Secret Reference mappings, pricing adjustments, or tags by slug. Only provided fields change; tags replaces the whole map and null clears it; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
|
|
4199
4284
|
INTEGRATIONS_TOOL_SCHEMAS.updateIntegration,
|
|
4200
4285
|
{
|
|
4201
4286
|
title: "Update AI Provider Integration",
|
|
@@ -4211,7 +4296,8 @@ function registerIntegrationsTools(server, service) {
|
|
|
4211
4296
|
description: params.description,
|
|
4212
4297
|
configurations: buildIntegrationConfigurations(params),
|
|
4213
4298
|
secret_mappings: params.secret_mappings,
|
|
4214
|
-
pricing_adjustments: params.pricing_adjustments
|
|
4299
|
+
pricing_adjustments: params.pricing_adjustments,
|
|
4300
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4215
4301
|
});
|
|
4216
4302
|
return jsonResult({
|
|
4217
4303
|
message: `Successfully updated integration "${params.slug}"`,
|
|
@@ -4391,31 +4477,31 @@ function registerIntegrationsTools(server, service) {
|
|
|
4391
4477
|
}
|
|
4392
4478
|
|
|
4393
4479
|
// src/tools/keys.tools.ts
|
|
4394
|
-
import { z as
|
|
4395
|
-
var virtualKeySecretMappingSchema =
|
|
4396
|
-
target_field:
|
|
4480
|
+
import { z as z12 } from "zod";
|
|
4481
|
+
var virtualKeySecretMappingSchema = z12.object({
|
|
4482
|
+
target_field: z12.string().refine(
|
|
4397
4483
|
(value) => value === "key" || value.startsWith("model_config."),
|
|
4398
4484
|
"target_field must be 'key' or start with 'model_config.'"
|
|
4399
4485
|
).describe("Virtual Key field populated from the Secret Reference"),
|
|
4400
|
-
secret_reference_id:
|
|
4401
|
-
secret_key:
|
|
4402
|
-
value_format:
|
|
4486
|
+
secret_reference_id: z12.string().describe("Secret Reference ID that owns the external secret"),
|
|
4487
|
+
secret_key: z12.string().nullable().optional().describe("Optional key selected from a structured external secret"),
|
|
4488
|
+
value_format: z12.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
|
|
4403
4489
|
});
|
|
4404
|
-
var virtualKeyDeploymentSchema =
|
|
4405
|
-
api_version:
|
|
4406
|
-
deployment_name:
|
|
4407
|
-
alias:
|
|
4408
|
-
is_default:
|
|
4490
|
+
var virtualKeyDeploymentSchema = z12.object({
|
|
4491
|
+
api_version: z12.string().min(1).describe("Azure OpenAI API version"),
|
|
4492
|
+
deployment_name: z12.string().min(1).describe("Azure deployment name"),
|
|
4493
|
+
alias: z12.string().optional().describe("Optional model alias for the deployment"),
|
|
4494
|
+
is_default: z12.boolean().optional().describe("Whether this is the default Azure deployment")
|
|
4409
4495
|
});
|
|
4410
|
-
var apiKeyRateLimitSchema =
|
|
4411
|
-
type:
|
|
4412
|
-
unit:
|
|
4413
|
-
value:
|
|
4496
|
+
var apiKeyRateLimitSchema = z12.object({
|
|
4497
|
+
type: z12.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
|
|
4498
|
+
unit: z12.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
|
|
4499
|
+
value: z12.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
|
|
4414
4500
|
});
|
|
4415
|
-
var rotationPolicySchema =
|
|
4416
|
-
rotation_period:
|
|
4417
|
-
next_rotation_at:
|
|
4418
|
-
key_transition_period_ms:
|
|
4501
|
+
var rotationPolicySchema = z12.object({
|
|
4502
|
+
rotation_period: z12.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
|
|
4503
|
+
next_rotation_at: z12.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
|
|
4504
|
+
key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
|
|
4419
4505
|
}).superRefine((value, context) => {
|
|
4420
4506
|
if (value.rotation_period && value.next_rotation_at) {
|
|
4421
4507
|
context.addIssue({
|
|
@@ -4431,108 +4517,108 @@ var KEYS_TOOL_SCHEMAS = {
|
|
|
4431
4517
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
4432
4518
|
},
|
|
4433
4519
|
createVirtualKey: {
|
|
4434
|
-
name:
|
|
4435
|
-
provider:
|
|
4520
|
+
name: z12.string().describe("Display name for the virtual key"),
|
|
4521
|
+
provider: z12.string().describe(
|
|
4436
4522
|
"Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
|
|
4437
4523
|
),
|
|
4438
|
-
key:
|
|
4439
|
-
note:
|
|
4440
|
-
workspace_id:
|
|
4441
|
-
api_version:
|
|
4442
|
-
resource_name:
|
|
4443
|
-
deployment_name:
|
|
4444
|
-
deployment_configurations:
|
|
4524
|
+
key: z12.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
|
|
4525
|
+
note: z12.string().optional().describe("Optional note or description for this key"),
|
|
4526
|
+
workspace_id: z12.string().optional().describe("Workspace ID to create the key in"),
|
|
4527
|
+
api_version: z12.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4528
|
+
resource_name: z12.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4529
|
+
deployment_name: z12.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4530
|
+
deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe(
|
|
4445
4531
|
"Azure deployment configurations with API versions and aliases"
|
|
4446
4532
|
),
|
|
4447
|
-
expires_at:
|
|
4448
|
-
secret_mappings:
|
|
4449
|
-
credit_limit:
|
|
4450
|
-
alert_threshold:
|
|
4533
|
+
expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
|
|
4534
|
+
secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
|
|
4535
|
+
credit_limit: z12.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
|
|
4536
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe(
|
|
4451
4537
|
"Percentage of credit_limit at which to send alert emails (0-100)"
|
|
4452
4538
|
),
|
|
4453
|
-
rate_limit_rpm:
|
|
4539
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("Requests per minute limit")
|
|
4454
4540
|
},
|
|
4455
4541
|
getVirtualKey: {
|
|
4456
|
-
slug:
|
|
4542
|
+
slug: z12.string().describe("The unique slug identifier of the virtual key to retrieve")
|
|
4457
4543
|
},
|
|
4458
4544
|
updateVirtualKey: {
|
|
4459
|
-
slug:
|
|
4460
|
-
name:
|
|
4461
|
-
key:
|
|
4462
|
-
note:
|
|
4463
|
-
credit_limit:
|
|
4464
|
-
alert_threshold:
|
|
4465
|
-
rate_limit_rpm:
|
|
4466
|
-
deployment_configurations:
|
|
4467
|
-
secret_mappings:
|
|
4545
|
+
slug: z12.string().describe("The slug of the virtual key to update"),
|
|
4546
|
+
name: z12.string().optional().describe("New display name for the key"),
|
|
4547
|
+
key: z12.string().optional().describe("New provider API key value"),
|
|
4548
|
+
note: z12.string().optional().describe("New note or description"),
|
|
4549
|
+
credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4550
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4551
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4552
|
+
deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
|
|
4553
|
+
secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
|
|
4468
4554
|
},
|
|
4469
4555
|
deleteVirtualKey: {
|
|
4470
|
-
slug:
|
|
4556
|
+
slug: z12.string().describe("The slug of the virtual key to delete")
|
|
4471
4557
|
},
|
|
4472
4558
|
createApiKey: {
|
|
4473
|
-
type:
|
|
4559
|
+
type: z12.enum(["organisation", "workspace"]).describe(
|
|
4474
4560
|
"Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
|
|
4475
4561
|
),
|
|
4476
|
-
sub_type:
|
|
4562
|
+
sub_type: z12.enum(["user", "service"]).describe(
|
|
4477
4563
|
"Sub-type: 'user' for user-associated keys or 'service' for service accounts"
|
|
4478
4564
|
),
|
|
4479
|
-
name:
|
|
4480
|
-
description:
|
|
4481
|
-
organisation_id:
|
|
4482
|
-
workspace_id:
|
|
4483
|
-
user_id:
|
|
4484
|
-
scopes:
|
|
4565
|
+
name: z12.string().describe("Display name for the API key"),
|
|
4566
|
+
description: z12.string().optional().describe("Optional description for the key"),
|
|
4567
|
+
organisation_id: z12.string().optional().describe("Organisation UUID"),
|
|
4568
|
+
workspace_id: z12.string().optional().describe("Workspace ID (required for workspace-type keys)"),
|
|
4569
|
+
user_id: z12.string().optional().describe("User ID (required for user sub-type keys)"),
|
|
4570
|
+
scopes: z12.array(z12.string()).describe(
|
|
4485
4571
|
"Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
|
|
4486
4572
|
),
|
|
4487
|
-
credit_limit:
|
|
4488
|
-
alert_threshold:
|
|
4489
|
-
rate_limit_rpm:
|
|
4490
|
-
rate_limits:
|
|
4491
|
-
default_config_id:
|
|
4492
|
-
default_metadata:
|
|
4493
|
-
default_allow_config_override:
|
|
4494
|
-
alert_emails:
|
|
4495
|
-
expires_at:
|
|
4573
|
+
credit_limit: z12.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
4574
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4575
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4576
|
+
rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
|
|
4577
|
+
default_config_id: z12.string().optional().describe("Default configuration ID to use with this key"),
|
|
4578
|
+
default_metadata: z12.record(z12.string(), z12.string()).optional().describe("Default metadata key-value pairs"),
|
|
4579
|
+
default_allow_config_override: z12.boolean().optional().describe("Allow callers to override the default config"),
|
|
4580
|
+
alert_emails: z12.array(z12.string()).optional().describe("Email addresses for alerts"),
|
|
4581
|
+
expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
|
|
4496
4582
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
|
|
4497
4583
|
},
|
|
4498
4584
|
listApiKeys: {
|
|
4499
4585
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
4500
4586
|
current_page: CurrentPageSchema,
|
|
4501
|
-
workspace_id:
|
|
4587
|
+
workspace_id: z12.string().optional().describe("Filter by workspace ID")
|
|
4502
4588
|
},
|
|
4503
4589
|
getApiKey: {
|
|
4504
|
-
id:
|
|
4590
|
+
id: z12.string().uuid().describe("The UUID of the API key to retrieve")
|
|
4505
4591
|
},
|
|
4506
4592
|
updateApiKey: {
|
|
4507
|
-
id:
|
|
4508
|
-
name:
|
|
4509
|
-
description:
|
|
4510
|
-
scopes:
|
|
4511
|
-
credit_limit:
|
|
4512
|
-
alert_threshold:
|
|
4513
|
-
rate_limit_rpm:
|
|
4514
|
-
rate_limits:
|
|
4515
|
-
reset_usage:
|
|
4516
|
-
default_config_id:
|
|
4517
|
-
default_metadata:
|
|
4518
|
-
default_allow_config_override:
|
|
4519
|
-
alert_emails:
|
|
4520
|
-
expires_at:
|
|
4593
|
+
id: z12.string().uuid().describe("The UUID of the API key to update"),
|
|
4594
|
+
name: z12.string().optional().describe("New display name for the key"),
|
|
4595
|
+
description: z12.string().optional().describe("New description for the key"),
|
|
4596
|
+
scopes: z12.array(z12.string()).optional().describe("New permission scopes for the key"),
|
|
4597
|
+
credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4598
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4599
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4600
|
+
rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
|
|
4601
|
+
reset_usage: z12.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
|
|
4602
|
+
default_config_id: z12.string().optional().describe("New default configuration ID"),
|
|
4603
|
+
default_metadata: z12.record(z12.string(), z12.string()).optional().describe("New default metadata key-value pairs"),
|
|
4604
|
+
default_allow_config_override: z12.boolean().optional().describe("Whether callers may override the key's default config"),
|
|
4605
|
+
alert_emails: z12.array(z12.string()).optional().describe("New email addresses for alerts"),
|
|
4606
|
+
expires_at: z12.iso.datetime({ offset: true }).nullable().optional().describe(
|
|
4521
4607
|
"New expiration date in ISO 8601 format, or null to remove expiration"
|
|
4522
4608
|
),
|
|
4523
4609
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
|
|
4524
4610
|
},
|
|
4525
4611
|
rotateApiKey: {
|
|
4526
|
-
id:
|
|
4527
|
-
key_transition_period_ms:
|
|
4612
|
+
id: z12.string().uuid().describe("API key UUID obtained from list_api_keys"),
|
|
4613
|
+
key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe(
|
|
4528
4614
|
"Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
|
|
4529
4615
|
)
|
|
4530
4616
|
},
|
|
4531
4617
|
deleteApiKey: {
|
|
4532
|
-
id:
|
|
4618
|
+
id: z12.string().uuid().describe("The UUID of the API key to delete")
|
|
4533
4619
|
}
|
|
4534
4620
|
};
|
|
4535
|
-
var createVirtualKeySchema =
|
|
4621
|
+
var createVirtualKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
|
|
4536
4622
|
if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
|
|
4537
4623
|
context.addIssue({
|
|
4538
4624
|
code: "custom",
|
|
@@ -4541,17 +4627,17 @@ var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
|
|
|
4541
4627
|
});
|
|
4542
4628
|
}
|
|
4543
4629
|
});
|
|
4544
|
-
var createApiKeySchema =
|
|
4630
|
+
var createApiKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
|
|
4545
4631
|
if (value.type === "workspace" && !value.workspace_id) {
|
|
4546
4632
|
ctx.addIssue({
|
|
4547
|
-
code:
|
|
4633
|
+
code: z12.ZodIssueCode.custom,
|
|
4548
4634
|
path: ["workspace_id"],
|
|
4549
4635
|
message: "workspace_id is required when type is 'workspace'"
|
|
4550
4636
|
});
|
|
4551
4637
|
}
|
|
4552
4638
|
if (value.sub_type === "user" && !value.user_id) {
|
|
4553
4639
|
ctx.addIssue({
|
|
4554
|
-
code:
|
|
4640
|
+
code: z12.ZodIssueCode.custom,
|
|
4555
4641
|
path: ["user_id"],
|
|
4556
4642
|
message: "user_id is required when sub_type is 'user'"
|
|
4557
4643
|
});
|
|
@@ -4874,43 +4960,43 @@ function registerKeysTools(server, service) {
|
|
|
4874
4960
|
}
|
|
4875
4961
|
|
|
4876
4962
|
// src/tools/labels.tools.ts
|
|
4877
|
-
import { z as
|
|
4963
|
+
import { z as z13 } from "zod";
|
|
4878
4964
|
var LABELS_TOOL_SCHEMAS = {
|
|
4879
4965
|
createPromptLabel: {
|
|
4880
|
-
name:
|
|
4881
|
-
organisation_id:
|
|
4882
|
-
workspace_id:
|
|
4883
|
-
description:
|
|
4884
|
-
color_code:
|
|
4966
|
+
name: z13.string().describe("Name of the label"),
|
|
4967
|
+
organisation_id: z13.string().optional().describe("Organisation ID to create the label in"),
|
|
4968
|
+
workspace_id: z13.string().optional().describe("Workspace ID to create the label in"),
|
|
4969
|
+
description: z13.string().optional().describe("Description of the label"),
|
|
4970
|
+
color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
|
|
4885
4971
|
"Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
|
|
4886
4972
|
)
|
|
4887
4973
|
},
|
|
4888
4974
|
listPromptLabels: {
|
|
4889
|
-
organisation_id:
|
|
4890
|
-
workspace_id:
|
|
4891
|
-
search:
|
|
4975
|
+
organisation_id: z13.string().optional().describe("Filter by organisation ID"),
|
|
4976
|
+
workspace_id: z13.string().optional().describe("Filter by workspace ID"),
|
|
4977
|
+
search: z13.string().optional().describe("Search labels by name"),
|
|
4892
4978
|
current_page: CurrentPageSchema,
|
|
4893
4979
|
page_size: PageSizeSchema
|
|
4894
4980
|
},
|
|
4895
4981
|
getPromptLabel: {
|
|
4896
|
-
label_id:
|
|
4897
|
-
organisation_id:
|
|
4898
|
-
workspace_id:
|
|
4982
|
+
label_id: z13.string().describe("Label ID to retrieve"),
|
|
4983
|
+
organisation_id: z13.string().optional().describe("Organisation ID for filtering"),
|
|
4984
|
+
workspace_id: z13.string().optional().describe("Workspace ID for filtering")
|
|
4899
4985
|
},
|
|
4900
4986
|
updatePromptLabel: {
|
|
4901
|
-
label_id:
|
|
4902
|
-
name:
|
|
4903
|
-
description:
|
|
4904
|
-
color_code:
|
|
4987
|
+
label_id: z13.string().describe("Label ID to update"),
|
|
4988
|
+
name: z13.string().optional().describe("New name for the label"),
|
|
4989
|
+
description: z13.string().optional().describe("New description"),
|
|
4990
|
+
color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
|
|
4905
4991
|
},
|
|
4906
4992
|
deletePromptLabel: {
|
|
4907
|
-
label_id:
|
|
4993
|
+
label_id: z13.string().describe("Label ID to delete")
|
|
4908
4994
|
}
|
|
4909
4995
|
};
|
|
4910
|
-
var createPromptLabelSchema =
|
|
4996
|
+
var createPromptLabelSchema = z13.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
|
|
4911
4997
|
if (!value.organisation_id && !value.workspace_id) {
|
|
4912
4998
|
ctx.addIssue({
|
|
4913
|
-
code:
|
|
4999
|
+
code: z13.ZodIssueCode.custom,
|
|
4914
5000
|
message: "Either organisation_id or workspace_id is required"
|
|
4915
5001
|
});
|
|
4916
5002
|
}
|
|
@@ -5007,13 +5093,13 @@ function registerLabelsTools(server, service) {
|
|
|
5007
5093
|
}
|
|
5008
5094
|
|
|
5009
5095
|
// src/tools/limits.tools.ts
|
|
5010
|
-
import { z as
|
|
5011
|
-
var statusSchema =
|
|
5012
|
-
var rateUnitSchema =
|
|
5013
|
-
var rateTargetSchema =
|
|
5014
|
-
var conditionValueSchema =
|
|
5015
|
-
var conditionSchema =
|
|
5016
|
-
key:
|
|
5096
|
+
import { z as z14 } from "zod";
|
|
5097
|
+
var statusSchema = z14.enum(["active", "archived"]);
|
|
5098
|
+
var rateUnitSchema = z14.enum(["rpm", "rph", "rpd", "rpw"]);
|
|
5099
|
+
var rateTargetSchema = z14.enum(["llm", "mcp_tools"]);
|
|
5100
|
+
var conditionValueSchema = z14.union([z14.string(), z14.array(z14.string()).min(1)]);
|
|
5101
|
+
var conditionSchema = z14.object({
|
|
5102
|
+
key: z14.string().min(1).describe(
|
|
5017
5103
|
"Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
|
|
5018
5104
|
),
|
|
5019
5105
|
value: conditionValueSchema.describe(
|
|
@@ -5021,8 +5107,8 @@ var conditionSchema = z13.object({
|
|
|
5021
5107
|
),
|
|
5022
5108
|
excludes: conditionValueSchema.optional().describe("Values to exclude")
|
|
5023
5109
|
});
|
|
5024
|
-
var groupBySchema =
|
|
5025
|
-
key:
|
|
5110
|
+
var groupBySchema = z14.object({
|
|
5111
|
+
key: z14.string().min(1).describe(
|
|
5026
5112
|
"Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
|
|
5027
5113
|
)
|
|
5028
5114
|
});
|
|
@@ -5032,88 +5118,88 @@ var paginationSchema = {
|
|
|
5032
5118
|
};
|
|
5033
5119
|
var LIMITS_TOOL_SCHEMAS = {
|
|
5034
5120
|
listRateLimits: {
|
|
5035
|
-
workspace_id:
|
|
5121
|
+
workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
|
|
5036
5122
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
5037
|
-
type:
|
|
5123
|
+
type: z14.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
|
|
5038
5124
|
unit: rateUnitSchema.optional().describe("Filter by reset interval"),
|
|
5039
5125
|
target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
|
|
5040
5126
|
...paginationSchema
|
|
5041
5127
|
},
|
|
5042
5128
|
getRateLimit: {
|
|
5043
|
-
id:
|
|
5129
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID"),
|
|
5044
5130
|
status: statusSchema.optional().describe("Include an archived policy by status")
|
|
5045
5131
|
},
|
|
5046
5132
|
createRateLimit: {
|
|
5047
|
-
conditions:
|
|
5048
|
-
group_by:
|
|
5049
|
-
type:
|
|
5133
|
+
conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
5134
|
+
group_by: z14.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
|
|
5135
|
+
type: z14.enum(["requests", "tokens"]).describe("Counter type"),
|
|
5050
5136
|
unit: rateUnitSchema.describe("Counter reset interval"),
|
|
5051
|
-
value:
|
|
5052
|
-
name:
|
|
5137
|
+
value: z14.coerce.number().nonnegative().describe("Maximum requests or tokens"),
|
|
5138
|
+
name: z14.string().optional().describe("Optional policy display name"),
|
|
5053
5139
|
target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
|
|
5054
|
-
workspace_id:
|
|
5055
|
-
organisation_id:
|
|
5140
|
+
workspace_id: z14.string().optional().describe("Workspace UUID scope"),
|
|
5141
|
+
organisation_id: z14.string().optional().describe("Organisation UUID scope")
|
|
5056
5142
|
},
|
|
5057
5143
|
updateRateLimit: {
|
|
5058
|
-
id:
|
|
5059
|
-
name:
|
|
5144
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID"),
|
|
5145
|
+
name: z14.string().optional().describe("Replacement display name"),
|
|
5060
5146
|
unit: rateUnitSchema.optional().describe("Replacement reset interval"),
|
|
5061
|
-
value:
|
|
5062
|
-
conditions:
|
|
5147
|
+
value: z14.coerce.number().nonnegative().optional().describe("Replacement maximum"),
|
|
5148
|
+
conditions: z14.array(conditionSchema).min(1).optional().describe("Replacement conditions")
|
|
5063
5149
|
},
|
|
5064
5150
|
deleteRateLimit: {
|
|
5065
|
-
id:
|
|
5151
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID to delete")
|
|
5066
5152
|
},
|
|
5067
5153
|
listUsageLimits: {
|
|
5068
|
-
workspace_id:
|
|
5154
|
+
workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
|
|
5069
5155
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
5070
|
-
type:
|
|
5156
|
+
type: z14.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
|
|
5071
5157
|
...paginationSchema
|
|
5072
5158
|
},
|
|
5073
5159
|
getUsageLimit: {
|
|
5074
|
-
id:
|
|
5160
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5075
5161
|
status: statusSchema.optional().describe("Include an archived policy by status"),
|
|
5076
|
-
include_usage:
|
|
5162
|
+
include_usage: z14.boolean().optional().describe("Include per-value usage counters")
|
|
5077
5163
|
},
|
|
5078
5164
|
createUsageLimit: {
|
|
5079
|
-
conditions:
|
|
5080
|
-
group_by:
|
|
5081
|
-
type:
|
|
5082
|
-
credit_limit:
|
|
5083
|
-
name:
|
|
5084
|
-
alert_threshold:
|
|
5085
|
-
periodic_reset:
|
|
5086
|
-
workspace_id:
|
|
5087
|
-
organisation_id:
|
|
5165
|
+
conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
5166
|
+
group_by: z14.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
|
|
5167
|
+
type: z14.enum(["cost", "tokens"]).describe("Budget type"),
|
|
5168
|
+
credit_limit: z14.coerce.number().nonnegative().describe("Maximum cumulative usage"),
|
|
5169
|
+
name: z14.string().optional().describe("Optional policy display name"),
|
|
5170
|
+
alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
|
|
5171
|
+
periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
|
|
5172
|
+
workspace_id: z14.string().optional().describe("Workspace UUID scope"),
|
|
5173
|
+
organisation_id: z14.string().optional().describe("Organisation UUID scope")
|
|
5088
5174
|
},
|
|
5089
5175
|
updateUsageLimit: {
|
|
5090
|
-
id:
|
|
5091
|
-
name:
|
|
5092
|
-
description:
|
|
5093
|
-
conditions:
|
|
5094
|
-
credit_limit:
|
|
5095
|
-
alert_threshold:
|
|
5096
|
-
periodic_reset:
|
|
5097
|
-
periodic_reset_days:
|
|
5098
|
-
next_usage_reset_at:
|
|
5099
|
-
reset_usage_for_value:
|
|
5176
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5177
|
+
name: z14.string().max(255).optional().describe("Replacement display name"),
|
|
5178
|
+
description: z14.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
|
|
5179
|
+
conditions: z14.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
|
|
5180
|
+
credit_limit: z14.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
|
|
5181
|
+
alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
|
|
5182
|
+
periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
|
|
5183
|
+
periodic_reset_days: z14.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
|
|
5184
|
+
next_usage_reset_at: z14.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
|
|
5185
|
+
reset_usage_for_value: z14.string().optional().describe("Grouped value whose usage should reset")
|
|
5100
5186
|
},
|
|
5101
5187
|
deleteUsageLimit: {
|
|
5102
|
-
id:
|
|
5188
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID to archive")
|
|
5103
5189
|
},
|
|
5104
5190
|
listUsageLimitEntities: {
|
|
5105
|
-
limit_id:
|
|
5106
|
-
status:
|
|
5107
|
-
search:
|
|
5191
|
+
limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5192
|
+
status: z14.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
|
|
5193
|
+
search: z14.string().optional().describe("Search tracked values"),
|
|
5108
5194
|
page_size: PageSizeSchema.describe("Number of entities per page"),
|
|
5109
5195
|
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
5110
5196
|
},
|
|
5111
5197
|
resetUsageLimitEntity: {
|
|
5112
|
-
limit_id:
|
|
5113
|
-
entity_id:
|
|
5198
|
+
limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5199
|
+
entity_id: z14.string().min(1).describe("Tracked entity UUID to reset")
|
|
5114
5200
|
}
|
|
5115
5201
|
};
|
|
5116
|
-
var updateUsageLimitSchema =
|
|
5202
|
+
var updateUsageLimitSchema = z14.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
|
|
5117
5203
|
if (value.periodic_reset != null && value.periodic_reset_days != null) {
|
|
5118
5204
|
context.addIssue({
|
|
5119
5205
|
code: "custom",
|
|
@@ -5253,8 +5339,8 @@ function registerLimitsTools(server, service) {
|
|
|
5253
5339
|
}
|
|
5254
5340
|
|
|
5255
5341
|
// src/tools/logging.tools.ts
|
|
5256
|
-
import { z as
|
|
5257
|
-
var logExportFieldSchema =
|
|
5342
|
+
import { z as z15 } from "zod";
|
|
5343
|
+
var logExportFieldSchema = z15.enum([
|
|
5258
5344
|
"id",
|
|
5259
5345
|
"trace_id",
|
|
5260
5346
|
"created_at",
|
|
@@ -5277,12 +5363,12 @@ var logExportFieldSchema = z14.enum([
|
|
|
5277
5363
|
"metadata"
|
|
5278
5364
|
]);
|
|
5279
5365
|
var getLogShape = {
|
|
5280
|
-
log_id:
|
|
5281
|
-
path_format:
|
|
5282
|
-
created_at:
|
|
5283
|
-
type:
|
|
5366
|
+
log_id: z15.string().describe("Gateway log ID to retrieve"),
|
|
5367
|
+
path_format: z15.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
|
|
5368
|
+
created_at: z15.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
|
|
5369
|
+
type: z15.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
|
|
5284
5370
|
};
|
|
5285
|
-
var getLogSchema =
|
|
5371
|
+
var getLogSchema = z15.object(getLogShape).superRefine((input, context) => {
|
|
5286
5372
|
if (input.path_format === "v2" && input.created_at === void 0) {
|
|
5287
5373
|
context.addIssue({
|
|
5288
5374
|
code: "custom",
|
|
@@ -5293,67 +5379,67 @@ var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
|
|
|
5293
5379
|
});
|
|
5294
5380
|
var LOGGING_TOOL_SCHEMAS = {
|
|
5295
5381
|
getLogExportFieldRestrictions: {
|
|
5296
|
-
workspace_id:
|
|
5382
|
+
workspace_id: z15.string().describe("Workspace ID whose export field restrictions should be read")
|
|
5297
5383
|
},
|
|
5298
5384
|
insertLog: {
|
|
5299
|
-
request_url:
|
|
5300
|
-
request_provider:
|
|
5301
|
-
request_method:
|
|
5302
|
-
request_headers:
|
|
5303
|
-
request_body:
|
|
5304
|
-
response_status:
|
|
5305
|
-
response_headers:
|
|
5306
|
-
response_body:
|
|
5307
|
-
response_time:
|
|
5308
|
-
streaming_mode:
|
|
5309
|
-
metadata_organization:
|
|
5310
|
-
metadata_user:
|
|
5311
|
-
metadata_trace_id:
|
|
5312
|
-
metadata_span_id:
|
|
5313
|
-
metadata_span_name:
|
|
5314
|
-
metadata_parent_span_id:
|
|
5315
|
-
metadata_custom:
|
|
5385
|
+
request_url: z15.string().optional().describe("The endpoint URL being called"),
|
|
5386
|
+
request_provider: z15.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
|
|
5387
|
+
request_method: z15.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
|
|
5388
|
+
request_headers: z15.record(z15.string(), z15.string()).optional().describe("Request headers as key-value pairs"),
|
|
5389
|
+
request_body: z15.record(z15.string(), z15.unknown()).optional().describe("Request payload/body"),
|
|
5390
|
+
response_status: z15.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
|
|
5391
|
+
response_headers: z15.record(z15.string(), z15.string()).optional().describe("Response headers as key-value pairs"),
|
|
5392
|
+
response_body: z15.record(z15.string(), z15.unknown()).optional().describe("Response payload/body"),
|
|
5393
|
+
response_time: z15.coerce.number().optional().describe("Response latency in milliseconds"),
|
|
5394
|
+
streaming_mode: z15.boolean().optional().default(false).describe("Whether the response was streamed"),
|
|
5395
|
+
metadata_organization: z15.string().optional().describe("Organization identifier for the log"),
|
|
5396
|
+
metadata_user: z15.string().optional().describe("User identifier for the log"),
|
|
5397
|
+
metadata_trace_id: z15.string().optional().describe("Trace ID for distributed tracing"),
|
|
5398
|
+
metadata_span_id: z15.string().optional().describe("Span ID for tracing"),
|
|
5399
|
+
metadata_span_name: z15.string().optional().describe("Span name for tracing"),
|
|
5400
|
+
metadata_parent_span_id: z15.string().optional().describe("Parent span ID for tracing"),
|
|
5401
|
+
metadata_custom: z15.record(z15.string(), z15.unknown()).optional().describe("Additional custom metadata key-value pairs")
|
|
5316
5402
|
},
|
|
5317
5403
|
createLogExport: {
|
|
5318
|
-
workspace_id:
|
|
5319
|
-
description:
|
|
5320
|
-
time_min:
|
|
5404
|
+
workspace_id: z15.string().optional().describe("Workspace ID for the export"),
|
|
5405
|
+
description: z15.string().optional().describe("Human-readable description for the export job"),
|
|
5406
|
+
time_min: z15.string().describe(
|
|
5321
5407
|
"Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
|
|
5322
5408
|
),
|
|
5323
|
-
time_max:
|
|
5409
|
+
time_max: z15.string().describe(
|
|
5324
5410
|
"Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
|
|
5325
5411
|
),
|
|
5326
|
-
cost_min:
|
|
5327
|
-
cost_max:
|
|
5328
|
-
total_units_min:
|
|
5329
|
-
total_units_max:
|
|
5330
|
-
ai_model:
|
|
5331
|
-
requested_fields:
|
|
5412
|
+
cost_min: z15.coerce.number().optional().describe("Minimum cost filter"),
|
|
5413
|
+
cost_max: z15.coerce.number().optional().describe("Maximum cost filter"),
|
|
5414
|
+
total_units_min: z15.coerce.number().optional().describe("Minimum total units (tokens) filter"),
|
|
5415
|
+
total_units_max: z15.coerce.number().optional().describe("Maximum total units (tokens) filter"),
|
|
5416
|
+
ai_model: z15.array(z15.string()).optional().describe("Filter by specific AI model names"),
|
|
5417
|
+
requested_fields: z15.array(logExportFieldSchema).describe(
|
|
5332
5418
|
"Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
|
|
5333
5419
|
)
|
|
5334
5420
|
},
|
|
5335
5421
|
listLogExports: {
|
|
5336
|
-
workspace_id:
|
|
5422
|
+
workspace_id: z15.string().describe("Workspace ID to list exports for (required)")
|
|
5337
5423
|
},
|
|
5338
5424
|
getLogExport: {
|
|
5339
|
-
export_id:
|
|
5425
|
+
export_id: z15.string().describe("The unique ID of the log export")
|
|
5340
5426
|
},
|
|
5341
5427
|
startLogExport: {
|
|
5342
|
-
export_id:
|
|
5428
|
+
export_id: z15.string().describe("The unique ID of the log export to start")
|
|
5343
5429
|
},
|
|
5344
5430
|
cancelLogExport: {
|
|
5345
|
-
export_id:
|
|
5431
|
+
export_id: z15.string().describe("The unique ID of the log export to cancel")
|
|
5346
5432
|
},
|
|
5347
5433
|
downloadLogExport: {
|
|
5348
|
-
export_id:
|
|
5434
|
+
export_id: z15.string().describe("The unique ID of the log export to download")
|
|
5349
5435
|
},
|
|
5350
5436
|
updateLogExport: {
|
|
5351
|
-
export_id:
|
|
5352
|
-
workspace_id:
|
|
5353
|
-
time_of_generation_max:
|
|
5437
|
+
export_id: z15.string().describe("The unique ID of the log export to update"),
|
|
5438
|
+
workspace_id: z15.string().optional().describe("Workspace ID for the export"),
|
|
5439
|
+
time_of_generation_max: z15.string().optional().describe(
|
|
5354
5440
|
"Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
|
|
5355
5441
|
),
|
|
5356
|
-
requested_fields:
|
|
5442
|
+
requested_fields: z15.array(logExportFieldSchema).optional().describe(
|
|
5357
5443
|
"Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
|
|
5358
5444
|
)
|
|
5359
5445
|
}
|
|
@@ -5579,7 +5665,7 @@ function registerLoggingTools(server, service) {
|
|
|
5579
5665
|
}
|
|
5580
5666
|
|
|
5581
5667
|
// src/tools/mcp-integrations.tools.ts
|
|
5582
|
-
import { z as
|
|
5668
|
+
import { z as z16 } from "zod";
|
|
5583
5669
|
var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
5584
5670
|
allowKeyTarget: false,
|
|
5585
5671
|
targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
|
|
@@ -5589,10 +5675,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
|
5589
5675
|
var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
5590
5676
|
mcpSecretMappingSchema
|
|
5591
5677
|
);
|
|
5592
|
-
var mcpConfigurationsSchema =
|
|
5678
|
+
var mcpConfigurationsSchema = z16.record(z16.string(), z16.unknown()).superRefine((value, ctx) => {
|
|
5593
5679
|
if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
|
|
5594
5680
|
ctx.addIssue({
|
|
5595
|
-
code:
|
|
5681
|
+
code: z16.ZodIssueCode.custom,
|
|
5596
5682
|
path: ["custom_headers"],
|
|
5597
5683
|
message: "configurations.custom_headers must be a string-to-string record"
|
|
5598
5684
|
});
|
|
@@ -5604,31 +5690,31 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5604
5690
|
page_size: pageSizeSchema(1e3).describe(
|
|
5605
5691
|
"Number of results per page (max 1000)"
|
|
5606
5692
|
),
|
|
5607
|
-
workspace_id:
|
|
5608
|
-
organisation_id:
|
|
5609
|
-
type:
|
|
5693
|
+
workspace_id: z16.string().optional().describe("Filter by workspace ID"),
|
|
5694
|
+
organisation_id: z16.string().optional().describe("Filter by organisation UUID"),
|
|
5695
|
+
type: z16.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
5610
5696
|
"Filter by workspace, organisation, or all integration ownership"
|
|
5611
5697
|
),
|
|
5612
|
-
search:
|
|
5698
|
+
search: z16.string().optional().describe("Search integrations by name")
|
|
5613
5699
|
},
|
|
5614
5700
|
createMcpIntegration: {
|
|
5615
|
-
name:
|
|
5616
|
-
url:
|
|
5617
|
-
auth_type:
|
|
5701
|
+
name: z16.string().describe("Display name for the MCP integration"),
|
|
5702
|
+
url: z16.string().describe("URL endpoint of the MCP server to integrate"),
|
|
5703
|
+
auth_type: z16.string().min(1).describe(
|
|
5618
5704
|
"Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5619
5705
|
),
|
|
5620
|
-
transport:
|
|
5706
|
+
transport: z16.enum(["http", "sse"]).describe(
|
|
5621
5707
|
"MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
|
|
5622
5708
|
),
|
|
5623
|
-
slug:
|
|
5624
|
-
description:
|
|
5625
|
-
custom_headers:
|
|
5709
|
+
slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5710
|
+
description: z16.string().optional().describe("Description of the MCP integration"),
|
|
5711
|
+
custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
|
|
5626
5712
|
'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
|
|
5627
5713
|
),
|
|
5628
5714
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
5629
5715
|
"Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
|
|
5630
5716
|
),
|
|
5631
|
-
workspace_id:
|
|
5717
|
+
workspace_id: z16.string().optional().describe(
|
|
5632
5718
|
"Workspace ID \u2014 required when using organization admin API keys"
|
|
5633
5719
|
),
|
|
5634
5720
|
secret_mappings: mcpSecretMappingsSchema.optional().describe(
|
|
@@ -5636,18 +5722,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5636
5722
|
)
|
|
5637
5723
|
},
|
|
5638
5724
|
getMcpIntegration: {
|
|
5639
|
-
id:
|
|
5725
|
+
id: z16.string().describe("The MCP integration ID or slug to retrieve")
|
|
5640
5726
|
},
|
|
5641
5727
|
updateMcpIntegration: {
|
|
5642
|
-
id:
|
|
5643
|
-
name:
|
|
5644
|
-
description:
|
|
5645
|
-
url:
|
|
5646
|
-
auth_type:
|
|
5728
|
+
id: z16.string().describe("The MCP integration ID or slug to update"),
|
|
5729
|
+
name: z16.string().optional().describe("New display name"),
|
|
5730
|
+
description: z16.string().optional().describe("New description"),
|
|
5731
|
+
url: z16.string().optional().describe("New URL endpoint"),
|
|
5732
|
+
auth_type: z16.string().min(1).optional().describe(
|
|
5647
5733
|
"New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5648
5734
|
),
|
|
5649
|
-
transport:
|
|
5650
|
-
custom_headers:
|
|
5735
|
+
transport: z16.enum(["http", "sse"]).optional().describe("New transport protocol"),
|
|
5736
|
+
custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
|
|
5651
5737
|
"New custom headers for authentication. Sent via configurations.custom_headers"
|
|
5652
5738
|
),
|
|
5653
5739
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
@@ -5658,50 +5744,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5658
5744
|
)
|
|
5659
5745
|
},
|
|
5660
5746
|
deleteMcpIntegration: {
|
|
5661
|
-
id:
|
|
5747
|
+
id: z16.string().describe("The MCP integration ID or slug to delete")
|
|
5662
5748
|
},
|
|
5663
5749
|
getMcpIntegrationMetadata: {
|
|
5664
|
-
id:
|
|
5750
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5665
5751
|
},
|
|
5666
5752
|
listMcpIntegrationCapabilities: {
|
|
5667
|
-
id:
|
|
5753
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5668
5754
|
},
|
|
5669
5755
|
updateMcpIntegrationCapabilities: {
|
|
5670
|
-
id:
|
|
5671
|
-
capabilities:
|
|
5672
|
-
|
|
5673
|
-
name:
|
|
5674
|
-
type:
|
|
5675
|
-
enabled:
|
|
5756
|
+
id: z16.string().describe("The MCP integration ID or slug"),
|
|
5757
|
+
capabilities: z16.array(
|
|
5758
|
+
z16.object({
|
|
5759
|
+
name: z16.string().describe("Capability name"),
|
|
5760
|
+
type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5761
|
+
enabled: z16.boolean().describe("Whether to enable the capability")
|
|
5676
5762
|
})
|
|
5677
5763
|
).min(1).describe("Array of capability updates")
|
|
5678
5764
|
},
|
|
5679
5765
|
listMcpIntegrationWorkspaces: {
|
|
5680
|
-
id:
|
|
5766
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5681
5767
|
},
|
|
5682
5768
|
updateMcpIntegrationWorkspaces: {
|
|
5683
|
-
id:
|
|
5684
|
-
workspaces:
|
|
5685
|
-
|
|
5686
|
-
id:
|
|
5687
|
-
enabled:
|
|
5769
|
+
id: z16.string().describe("The MCP integration ID or slug"),
|
|
5770
|
+
workspaces: z16.array(
|
|
5771
|
+
z16.object({
|
|
5772
|
+
id: z16.string().describe("Workspace ID"),
|
|
5773
|
+
enabled: z16.boolean().describe("Whether workspace has access")
|
|
5688
5774
|
})
|
|
5689
5775
|
).min(1).describe("Array of workspace access updates")
|
|
5690
5776
|
}
|
|
5691
5777
|
};
|
|
5692
|
-
var createMcpIntegrationSchema =
|
|
5778
|
+
var createMcpIntegrationSchema = z16.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
|
|
5693
5779
|
const configuredHeaders = value.configurations?.custom_headers;
|
|
5694
5780
|
if (value.auth_type === "headers" && (!value.custom_headers || Object.keys(value.custom_headers).length === 0) && (!isStringRecord(configuredHeaders) || Object.keys(configuredHeaders).length === 0) && !value.secret_mappings?.some(
|
|
5695
5781
|
(mapping) => mapping.target_field === "configurations.custom_headers"
|
|
5696
5782
|
)) {
|
|
5697
5783
|
ctx.addIssue({
|
|
5698
|
-
code:
|
|
5784
|
+
code: z16.ZodIssueCode.custom,
|
|
5699
5785
|
path: [],
|
|
5700
5786
|
message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
|
|
5701
5787
|
});
|
|
5702
5788
|
}
|
|
5703
5789
|
});
|
|
5704
|
-
var updateMcpIntegrationSchema =
|
|
5790
|
+
var updateMcpIntegrationSchema = z16.object(
|
|
5705
5791
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
|
|
5706
5792
|
);
|
|
5707
5793
|
function isRecord2(value) {
|
|
@@ -5942,68 +6028,68 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5942
6028
|
}
|
|
5943
6029
|
|
|
5944
6030
|
// src/tools/mcp-servers.tools.ts
|
|
5945
|
-
import { z as
|
|
6031
|
+
import { z as z17 } from "zod";
|
|
5946
6032
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5947
6033
|
listMcpServers: {
|
|
5948
6034
|
current_page: CurrentPageSchema,
|
|
5949
6035
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
5950
|
-
workspace_id:
|
|
6036
|
+
workspace_id: z17.string().optional().describe("Filter by workspace ID")
|
|
5951
6037
|
},
|
|
5952
6038
|
createMcpServer: {
|
|
5953
|
-
name:
|
|
5954
|
-
mcp_integration_id:
|
|
5955
|
-
slug:
|
|
5956
|
-
description:
|
|
6039
|
+
name: z17.string().describe("Display name for the MCP server"),
|
|
6040
|
+
mcp_integration_id: z17.string().describe("ID or slug of the MCP integration this server belongs to"),
|
|
6041
|
+
slug: z17.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
6042
|
+
description: z17.string().optional().describe("Description of the MCP server")
|
|
5957
6043
|
},
|
|
5958
6044
|
getMcpServer: {
|
|
5959
|
-
id:
|
|
6045
|
+
id: z17.string().describe("The MCP server ID or slug to retrieve")
|
|
5960
6046
|
},
|
|
5961
6047
|
updateMcpServer: {
|
|
5962
|
-
id:
|
|
5963
|
-
name:
|
|
5964
|
-
description:
|
|
6048
|
+
id: z17.string().describe("The MCP server ID or slug to update"),
|
|
6049
|
+
name: z17.string().optional().describe("New display name"),
|
|
6050
|
+
description: z17.string().optional().describe("New description")
|
|
5965
6051
|
},
|
|
5966
6052
|
deleteMcpServer: {
|
|
5967
|
-
id:
|
|
6053
|
+
id: z17.string().describe("The MCP server ID or slug to delete")
|
|
5968
6054
|
},
|
|
5969
6055
|
testMcpServer: {
|
|
5970
|
-
id:
|
|
6056
|
+
id: z17.string().describe("The MCP server ID or slug to test")
|
|
5971
6057
|
},
|
|
5972
6058
|
listMcpServerCapabilities: {
|
|
5973
|
-
id:
|
|
6059
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
5974
6060
|
current_page: CurrentPageSchema,
|
|
5975
6061
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5976
6062
|
},
|
|
5977
6063
|
updateMcpServerCapabilities: {
|
|
5978
|
-
id:
|
|
5979
|
-
capabilities:
|
|
5980
|
-
|
|
5981
|
-
name:
|
|
5982
|
-
type:
|
|
5983
|
-
enabled:
|
|
6064
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
6065
|
+
capabilities: z17.array(
|
|
6066
|
+
z17.object({
|
|
6067
|
+
name: z17.string().describe("Capability name"),
|
|
6068
|
+
type: z17.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
6069
|
+
enabled: z17.boolean().describe("Whether to enable the capability")
|
|
5984
6070
|
})
|
|
5985
6071
|
).min(1).describe("Array of capability updates")
|
|
5986
6072
|
},
|
|
5987
6073
|
listMcpServerUserAccess: {
|
|
5988
|
-
id:
|
|
6074
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
5989
6075
|
current_page: CurrentPageSchema,
|
|
5990
6076
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5991
6077
|
},
|
|
5992
6078
|
updateMcpServerUserAccess: {
|
|
5993
|
-
id:
|
|
5994
|
-
users:
|
|
5995
|
-
|
|
5996
|
-
user_id:
|
|
5997
|
-
enabled:
|
|
6079
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
6080
|
+
users: z17.array(
|
|
6081
|
+
z17.object({
|
|
6082
|
+
user_id: z17.string().describe("User ID"),
|
|
6083
|
+
enabled: z17.boolean().describe("Whether user has access")
|
|
5998
6084
|
})
|
|
5999
6085
|
).min(1).describe("Array of user access updates")
|
|
6000
6086
|
},
|
|
6001
6087
|
listMcpServerConnections: {
|
|
6002
|
-
id:
|
|
6003
|
-
user_id:
|
|
6088
|
+
id: z17.string().describe("MCP server ID or slug whose connections to list"),
|
|
6089
|
+
user_id: z17.string().uuid().optional().describe(
|
|
6004
6090
|
"User UUID to filter; user-scoped keys default to their own user when omitted"
|
|
6005
6091
|
),
|
|
6006
|
-
workspace_id:
|
|
6092
|
+
workspace_id: z17.string().optional().describe(
|
|
6007
6093
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
6008
6094
|
),
|
|
6009
6095
|
current_page: CurrentPageSchema.describe(
|
|
@@ -6014,11 +6100,11 @@ var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
|
6014
6100
|
)
|
|
6015
6101
|
},
|
|
6016
6102
|
disconnectMcpServerConnection: {
|
|
6017
|
-
id:
|
|
6018
|
-
user_id:
|
|
6103
|
+
id: z17.string().describe("MCP server ID or slug containing the active connection"),
|
|
6104
|
+
user_id: z17.string().uuid().optional().describe(
|
|
6019
6105
|
"User UUID to disconnect; required with service keys and derived from user keys when omitted"
|
|
6020
6106
|
),
|
|
6021
|
-
workspace_id:
|
|
6107
|
+
workspace_id: z17.string().optional().describe(
|
|
6022
6108
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
6023
6109
|
)
|
|
6024
6110
|
}
|
|
@@ -6245,40 +6331,40 @@ function registerMcpServersTools(server, service) {
|
|
|
6245
6331
|
}
|
|
6246
6332
|
|
|
6247
6333
|
// src/tools/partials.tools.ts
|
|
6248
|
-
import { z as
|
|
6334
|
+
import { z as z18 } from "zod";
|
|
6249
6335
|
var PARTIALS_TOOL_SCHEMAS = {
|
|
6250
6336
|
createPromptPartial: {
|
|
6251
|
-
name:
|
|
6252
|
-
string:
|
|
6253
|
-
workspace_id:
|
|
6337
|
+
name: z18.string().describe("Display name for the partial"),
|
|
6338
|
+
string: z18.string().describe("The partial content/template string"),
|
|
6339
|
+
workspace_id: z18.string().optional().describe(
|
|
6254
6340
|
"Workspace ID to create partial in (required for org-level API keys)"
|
|
6255
6341
|
),
|
|
6256
|
-
version_description:
|
|
6342
|
+
version_description: z18.string().optional().describe("Description for this version")
|
|
6257
6343
|
},
|
|
6258
6344
|
listPromptPartials: {
|
|
6259
|
-
collection_id:
|
|
6345
|
+
collection_id: z18.string().optional().describe(
|
|
6260
6346
|
"Filter by collection ID. Optional \u2014 omit to list all partials across collections"
|
|
6261
6347
|
)
|
|
6262
6348
|
},
|
|
6263
6349
|
getPromptPartial: {
|
|
6264
|
-
prompt_partial_id:
|
|
6350
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to retrieve")
|
|
6265
6351
|
},
|
|
6266
6352
|
updatePromptPartial: {
|
|
6267
|
-
prompt_partial_id:
|
|
6268
|
-
name:
|
|
6269
|
-
string:
|
|
6270
|
-
description:
|
|
6271
|
-
status:
|
|
6353
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to update"),
|
|
6354
|
+
name: z18.string().optional().describe("New display name for the partial"),
|
|
6355
|
+
string: z18.string().optional().describe("New content for the partial"),
|
|
6356
|
+
description: z18.string().optional().describe("Description for this version"),
|
|
6357
|
+
status: z18.enum(["active", "archived"]).optional().describe("New status for the partial")
|
|
6272
6358
|
},
|
|
6273
6359
|
deletePromptPartial: {
|
|
6274
|
-
prompt_partial_id:
|
|
6360
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to delete")
|
|
6275
6361
|
},
|
|
6276
6362
|
listPartialVersions: {
|
|
6277
|
-
prompt_partial_id:
|
|
6363
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to list versions for")
|
|
6278
6364
|
},
|
|
6279
6365
|
publishPartial: {
|
|
6280
|
-
prompt_partial_id:
|
|
6281
|
-
version:
|
|
6366
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug"),
|
|
6367
|
+
version: z18.coerce.number().positive().describe("Version number to publish as default")
|
|
6282
6368
|
}
|
|
6283
6369
|
};
|
|
6284
6370
|
function registerPartialsTools(server, service) {
|
|
@@ -6415,101 +6501,101 @@ function registerPartialsTools(server, service) {
|
|
|
6415
6501
|
}
|
|
6416
6502
|
|
|
6417
6503
|
// src/tools/prompts.tools.ts
|
|
6418
|
-
import { z as
|
|
6419
|
-
var PROMPT_VARIABLES_SCHEMA =
|
|
6420
|
-
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA =
|
|
6421
|
-
type:
|
|
6422
|
-
text:
|
|
6504
|
+
import { z as z19 } from "zod";
|
|
6505
|
+
var PROMPT_VARIABLES_SCHEMA = z19.record(z19.string(), z19.union([z19.string(), z19.number(), z19.boolean()])).describe("Variable values to substitute into the template");
|
|
6506
|
+
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z19.object({
|
|
6507
|
+
type: z19.string().describe("Content block type"),
|
|
6508
|
+
text: z19.string().optional().describe("Text content for text-based blocks")
|
|
6423
6509
|
}).passthrough().describe("Content block within a structured chat message");
|
|
6424
|
-
var PROMPT_TEMPLATE_MESSAGE_SCHEMA =
|
|
6425
|
-
role:
|
|
6426
|
-
content:
|
|
6510
|
+
var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z19.object({
|
|
6511
|
+
role: z19.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
|
|
6512
|
+
content: z19.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
|
|
6427
6513
|
}).passthrough().describe("Structured chat message in a prompt template");
|
|
6428
6514
|
var PROMPTS_TOOL_SCHEMAS = {
|
|
6429
6515
|
createPrompt: {
|
|
6430
|
-
name:
|
|
6431
|
-
collection_id:
|
|
6516
|
+
name: z19.string().describe("Display name for the prompt"),
|
|
6517
|
+
collection_id: z19.string().describe(
|
|
6432
6518
|
"Collection ID to organize the prompt in (use list_collections to find)"
|
|
6433
6519
|
),
|
|
6434
|
-
string:
|
|
6520
|
+
string: z19.string().optional().describe(
|
|
6435
6521
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
6436
6522
|
),
|
|
6437
|
-
messages:
|
|
6523
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6438
6524
|
"Structured chat template alias. Serialized to the legacy string format before creation."
|
|
6439
6525
|
),
|
|
6440
|
-
parameters:
|
|
6441
|
-
virtual_key:
|
|
6442
|
-
model:
|
|
6526
|
+
parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
|
|
6527
|
+
virtual_key: z19.string().describe("Virtual key slug for model access"),
|
|
6528
|
+
model: z19.string().optional().describe(
|
|
6443
6529
|
"Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
|
|
6444
6530
|
),
|
|
6445
|
-
ai_model_id:
|
|
6531
|
+
ai_model_id: z19.string().optional().describe(
|
|
6446
6532
|
"AI model ID (alternative to model). Required unless model or finetune_id is provided"
|
|
6447
6533
|
),
|
|
6448
|
-
finetune_id:
|
|
6534
|
+
finetune_id: z19.string().optional().describe(
|
|
6449
6535
|
"Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
|
|
6450
6536
|
),
|
|
6451
|
-
version_description:
|
|
6452
|
-
template_metadata:
|
|
6453
|
-
functions:
|
|
6454
|
-
tools:
|
|
6537
|
+
version_description: z19.string().optional().describe("Description for this prompt version"),
|
|
6538
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
|
|
6539
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
|
|
6540
|
+
tools: z19.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
|
|
6455
6541
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
6456
|
-
is_raw_template:
|
|
6457
|
-
dry_run:
|
|
6542
|
+
is_raw_template: z19.boolean().optional().describe("Render the stored template as a raw structural template"),
|
|
6543
|
+
dry_run: z19.boolean().optional().describe("When true, validate without creating")
|
|
6458
6544
|
},
|
|
6459
6545
|
listPrompts: {
|
|
6460
|
-
collection_id:
|
|
6546
|
+
collection_id: z19.string().optional().describe(
|
|
6461
6547
|
"Filter by collection ID (recommended for app-specific prompts)"
|
|
6462
6548
|
),
|
|
6463
|
-
workspace_id:
|
|
6464
|
-
search:
|
|
6549
|
+
workspace_id: z19.string().optional().describe("Filter by workspace ID"),
|
|
6550
|
+
search: z19.string().optional().describe("Search prompts by name"),
|
|
6465
6551
|
current_page: CurrentPageSchema,
|
|
6466
6552
|
page_size: PageSizeSchema
|
|
6467
6553
|
},
|
|
6468
6554
|
getPrompt: {
|
|
6469
|
-
prompt_id:
|
|
6555
|
+
prompt_id: z19.string().describe("Prompt ID or slug to retrieve")
|
|
6470
6556
|
},
|
|
6471
6557
|
updatePrompt: {
|
|
6472
|
-
prompt_id:
|
|
6473
|
-
name:
|
|
6474
|
-
collection_id:
|
|
6475
|
-
string:
|
|
6558
|
+
prompt_id: z19.string().describe("Prompt ID or slug to update"),
|
|
6559
|
+
name: z19.string().optional().describe("New display name for the prompt"),
|
|
6560
|
+
collection_id: z19.string().optional().describe("Move to a different collection"),
|
|
6561
|
+
string: z19.string().optional().describe(
|
|
6476
6562
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
6477
6563
|
),
|
|
6478
|
-
messages:
|
|
6564
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6479
6565
|
"Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
|
|
6480
6566
|
),
|
|
6481
|
-
parameters:
|
|
6482
|
-
model:
|
|
6483
|
-
virtual_key:
|
|
6484
|
-
version_description:
|
|
6485
|
-
template_metadata:
|
|
6486
|
-
functions:
|
|
6487
|
-
tools:
|
|
6567
|
+
parameters: z19.record(z19.string(), z19.unknown()).optional().describe("New default values for template variables"),
|
|
6568
|
+
model: z19.string().optional().describe("New model identifier"),
|
|
6569
|
+
virtual_key: z19.string().optional().describe("New virtual key slug"),
|
|
6570
|
+
version_description: z19.string().optional().describe("Description for this version"),
|
|
6571
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("New metadata"),
|
|
6572
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("New function definitions"),
|
|
6573
|
+
tools: z19.array(PromptToolSchema).optional().describe("New tool definitions"),
|
|
6488
6574
|
tool_choice: ToolChoiceSchema.optional().describe(
|
|
6489
6575
|
"New tool choice strategy"
|
|
6490
6576
|
),
|
|
6491
|
-
is_raw_template:
|
|
6492
|
-
dry_run:
|
|
6577
|
+
is_raw_template: z19.boolean().optional().describe("Enable or disable raw structural-template rendering"),
|
|
6578
|
+
dry_run: z19.boolean().optional().describe("When true, validate without updating")
|
|
6493
6579
|
},
|
|
6494
6580
|
deletePrompt: {
|
|
6495
|
-
prompt_id:
|
|
6581
|
+
prompt_id: z19.string().describe("Prompt ID or slug to delete")
|
|
6496
6582
|
},
|
|
6497
6583
|
publishPrompt: {
|
|
6498
|
-
prompt_id:
|
|
6499
|
-
version:
|
|
6584
|
+
prompt_id: z19.string().describe("Prompt ID or slug to publish"),
|
|
6585
|
+
version: z19.coerce.number().positive().describe("Version number to publish as the default")
|
|
6500
6586
|
},
|
|
6501
6587
|
listPromptVersions: {
|
|
6502
|
-
prompt_id:
|
|
6588
|
+
prompt_id: z19.string().describe("Prompt ID or slug to list versions for")
|
|
6503
6589
|
},
|
|
6504
6590
|
renderPrompt: {
|
|
6505
|
-
prompt_id:
|
|
6591
|
+
prompt_id: z19.string().describe("Prompt ID or slug to render"),
|
|
6506
6592
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
6507
6593
|
hyperparameters: HyperparametersSchema.optional().describe(
|
|
6508
6594
|
"Override default hyperparameters"
|
|
6509
6595
|
)
|
|
6510
6596
|
},
|
|
6511
6597
|
runPromptCompletion: {
|
|
6512
|
-
prompt_id:
|
|
6598
|
+
prompt_id: z19.string().describe("Prompt ID or slug to execute"),
|
|
6513
6599
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
6514
6600
|
metadata: BillingMetadataSchema.describe(
|
|
6515
6601
|
"Billing metadata - client_id, app, env are REQUIRED for cost attribution"
|
|
@@ -6519,77 +6605,77 @@ var PROMPTS_TOOL_SCHEMAS = {
|
|
|
6519
6605
|
)
|
|
6520
6606
|
},
|
|
6521
6607
|
migratePrompt: {
|
|
6522
|
-
name:
|
|
6608
|
+
name: z19.string().describe("Prompt name to create or find for update"),
|
|
6523
6609
|
app: PromptAppIdentifierSchema,
|
|
6524
6610
|
env: PromptEnvironmentIdentifierSchema,
|
|
6525
|
-
collection_id:
|
|
6526
|
-
string:
|
|
6611
|
+
collection_id: z19.string().describe("Collection ID to search in and create under"),
|
|
6612
|
+
string: z19.string().optional().describe(
|
|
6527
6613
|
"Legacy prompt template string with {{variable}} mustache syntax."
|
|
6528
6614
|
),
|
|
6529
|
-
messages:
|
|
6615
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6530
6616
|
"Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
|
|
6531
6617
|
),
|
|
6532
|
-
parameters:
|
|
6533
|
-
virtual_key:
|
|
6534
|
-
model:
|
|
6535
|
-
version_description:
|
|
6536
|
-
template_metadata:
|
|
6537
|
-
functions:
|
|
6538
|
-
tools:
|
|
6618
|
+
parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
|
|
6619
|
+
virtual_key: z19.string().describe("Virtual key slug for model access"),
|
|
6620
|
+
model: z19.string().optional().describe("Model identifier"),
|
|
6621
|
+
version_description: z19.string().optional().describe("Description for this version"),
|
|
6622
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Additional custom metadata"),
|
|
6623
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions"),
|
|
6624
|
+
tools: z19.array(PromptToolSchema).optional().describe("Tool definitions"),
|
|
6539
6625
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
6540
|
-
is_raw_template:
|
|
6541
|
-
dry_run:
|
|
6626
|
+
is_raw_template: z19.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
|
|
6627
|
+
dry_run: z19.boolean().optional().describe(
|
|
6542
6628
|
"When true, only check what action would be taken without making changes"
|
|
6543
6629
|
)
|
|
6544
6630
|
},
|
|
6545
6631
|
promotePrompt: {
|
|
6546
|
-
source_prompt_id:
|
|
6547
|
-
target_collection_id:
|
|
6548
|
-
target_name:
|
|
6632
|
+
source_prompt_id: z19.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
|
|
6633
|
+
target_collection_id: z19.string().describe("Target collection ID for the promoted prompt"),
|
|
6634
|
+
target_name: z19.string().optional().describe(
|
|
6549
6635
|
"Target prompt name (defaults to source name with env suffix replaced)"
|
|
6550
6636
|
),
|
|
6551
6637
|
target_env: PromptEnvironmentIdentifierSchema,
|
|
6552
|
-
virtual_key:
|
|
6638
|
+
virtual_key: z19.string().optional().describe(
|
|
6553
6639
|
"Virtual key ID to use (defaults to source prompt's virtual_key)"
|
|
6554
6640
|
)
|
|
6555
6641
|
},
|
|
6556
6642
|
validateCompletionMetadata: {
|
|
6557
|
-
client_id:
|
|
6643
|
+
client_id: z19.string().optional().describe("Client ID for billing attribution"),
|
|
6558
6644
|
app: PromptAppIdentifierSchema.optional(),
|
|
6559
6645
|
env: PromptEnvironmentIdentifierSchema.optional(),
|
|
6560
|
-
project_id:
|
|
6561
|
-
feature:
|
|
6646
|
+
project_id: z19.string().optional().describe("Project ID for granular billing"),
|
|
6647
|
+
feature: z19.string().optional().describe("Feature name for tracking")
|
|
6562
6648
|
},
|
|
6563
6649
|
getPromptVersion: {
|
|
6564
|
-
prompt_id:
|
|
6565
|
-
version_id:
|
|
6650
|
+
prompt_id: z19.string().describe("Prompt ID or slug"),
|
|
6651
|
+
version_id: z19.string().describe("Version UUID to retrieve")
|
|
6566
6652
|
},
|
|
6567
6653
|
updatePromptVersion: {
|
|
6568
|
-
prompt_id:
|
|
6569
|
-
version_id:
|
|
6570
|
-
label_id:
|
|
6654
|
+
prompt_id: z19.string().describe("Prompt ID or slug"),
|
|
6655
|
+
version_id: z19.string().describe("Version UUID to update"),
|
|
6656
|
+
label_id: z19.string().nullable().describe(
|
|
6571
6657
|
"Label ID to assign to this version, or null to remove the label"
|
|
6572
6658
|
)
|
|
6573
6659
|
}
|
|
6574
6660
|
};
|
|
6575
|
-
var createPromptSchema =
|
|
6661
|
+
var createPromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
|
|
6576
6662
|
if (!value.model && !value.ai_model_id && !value.finetune_id) {
|
|
6577
6663
|
ctx.addIssue({
|
|
6578
|
-
code:
|
|
6664
|
+
code: z19.ZodIssueCode.custom,
|
|
6579
6665
|
message: "At least one of model, ai_model_id, or finetune_id must be provided"
|
|
6580
6666
|
});
|
|
6581
6667
|
}
|
|
6582
6668
|
if (value.string === void 0 && value.messages === void 0) {
|
|
6583
6669
|
ctx.addIssue({
|
|
6584
|
-
code:
|
|
6670
|
+
code: z19.ZodIssueCode.custom,
|
|
6585
6671
|
message: "Provide either string or messages"
|
|
6586
6672
|
});
|
|
6587
6673
|
}
|
|
6588
6674
|
});
|
|
6589
|
-
var migratePromptSchema =
|
|
6675
|
+
var migratePromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
|
|
6590
6676
|
if (value.string === void 0 && value.messages === void 0) {
|
|
6591
6677
|
ctx.addIssue({
|
|
6592
|
-
code:
|
|
6678
|
+
code: z19.ZodIssueCode.custom,
|
|
6593
6679
|
message: "Provide either string or messages"
|
|
6594
6680
|
});
|
|
6595
6681
|
}
|
|
@@ -7042,70 +7128,70 @@ function registerPromptsTools(server, service) {
|
|
|
7042
7128
|
}
|
|
7043
7129
|
|
|
7044
7130
|
// src/tools/providers.tools.ts
|
|
7045
|
-
import { z as
|
|
7131
|
+
import { z as z20 } from "zod";
|
|
7046
7132
|
var PROVIDERS_TOOL_SCHEMAS = {
|
|
7047
7133
|
listProviders: {
|
|
7048
7134
|
current_page: CurrentPageSchema,
|
|
7049
7135
|
page_size: PageSizeSchema.describe(
|
|
7050
7136
|
"Number of results per page (max 100, default 50)"
|
|
7051
7137
|
),
|
|
7052
|
-
workspace_id:
|
|
7138
|
+
workspace_id: z20.string().optional().describe(
|
|
7053
7139
|
"Workspace ID - required when using organization admin keys, optional with workspace API keys"
|
|
7054
7140
|
)
|
|
7055
7141
|
},
|
|
7056
7142
|
createProvider: {
|
|
7057
|
-
name:
|
|
7058
|
-
integration_id:
|
|
7143
|
+
name: z20.string().describe("Display name for the provider"),
|
|
7144
|
+
integration_id: z20.string().describe(
|
|
7059
7145
|
"Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
|
|
7060
7146
|
),
|
|
7061
|
-
workspace_id:
|
|
7147
|
+
workspace_id: z20.string().optional().describe(
|
|
7062
7148
|
"Workspace ID - required when using organization admin API keys"
|
|
7063
7149
|
),
|
|
7064
|
-
slug:
|
|
7150
|
+
slug: z20.string().optional().describe(
|
|
7065
7151
|
"Custom slug for the provider. Auto-generated with random suffix if omitted"
|
|
7066
7152
|
),
|
|
7067
|
-
note:
|
|
7068
|
-
credit_limit:
|
|
7069
|
-
alert_threshold:
|
|
7070
|
-
usage_limit_type:
|
|
7153
|
+
note: z20.string().optional().describe("Optional note or description for the provider"),
|
|
7154
|
+
credit_limit: z20.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
7155
|
+
alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
7156
|
+
usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
|
|
7071
7157
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
7072
7158
|
),
|
|
7073
|
-
periodic_reset:
|
|
7159
|
+
periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
|
|
7074
7160
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
7075
7161
|
),
|
|
7076
|
-
rate_limit_value:
|
|
7077
|
-
rate_limit_unit:
|
|
7162
|
+
rate_limit_value: z20.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
|
|
7163
|
+
rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
7078
7164
|
"Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
|
|
7079
7165
|
),
|
|
7080
|
-
expires_at:
|
|
7166
|
+
expires_at: z20.string().optional().describe("Expiration date in ISO 8601 format")
|
|
7081
7167
|
},
|
|
7082
7168
|
getProvider: {
|
|
7083
|
-
slug:
|
|
7084
|
-
workspace_id:
|
|
7169
|
+
slug: z20.string().describe("The unique slug identifier of the provider to retrieve"),
|
|
7170
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
7085
7171
|
},
|
|
7086
7172
|
updateProvider: {
|
|
7087
|
-
slug:
|
|
7088
|
-
workspace_id:
|
|
7089
|
-
name:
|
|
7090
|
-
note:
|
|
7091
|
-
credit_limit:
|
|
7092
|
-
alert_threshold:
|
|
7093
|
-
usage_limit_type:
|
|
7173
|
+
slug: z20.string().describe("The slug of the provider to update"),
|
|
7174
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys"),
|
|
7175
|
+
name: z20.string().optional().describe("New display name for the provider"),
|
|
7176
|
+
note: z20.string().optional().describe("New note or description for the provider"),
|
|
7177
|
+
credit_limit: z20.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
7178
|
+
alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
7179
|
+
usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
|
|
7094
7180
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
7095
7181
|
),
|
|
7096
|
-
periodic_reset:
|
|
7182
|
+
periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
|
|
7097
7183
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
7098
7184
|
),
|
|
7099
|
-
rate_limit_value:
|
|
7100
|
-
rate_limit_unit:
|
|
7185
|
+
rate_limit_value: z20.coerce.number().positive().optional().describe("New rate limit value"),
|
|
7186
|
+
rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
7101
7187
|
"Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
|
|
7102
7188
|
),
|
|
7103
|
-
expires_at:
|
|
7104
|
-
reset_usage:
|
|
7189
|
+
expires_at: z20.string().optional().describe("New expiration date in ISO 8601 format"),
|
|
7190
|
+
reset_usage: z20.boolean().optional().describe("Set to true to reset accumulated usage metrics")
|
|
7105
7191
|
},
|
|
7106
7192
|
deleteProvider: {
|
|
7107
|
-
slug:
|
|
7108
|
-
workspace_id:
|
|
7193
|
+
slug: z20.string().describe("The slug of the provider to delete"),
|
|
7194
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
7109
7195
|
}
|
|
7110
7196
|
};
|
|
7111
7197
|
function registerProvidersTools(server, service) {
|
|
@@ -7252,73 +7338,73 @@ function registerProvidersTools(server, service) {
|
|
|
7252
7338
|
}
|
|
7253
7339
|
|
|
7254
7340
|
// src/tools/secret-references.tools.ts
|
|
7255
|
-
import { z as
|
|
7341
|
+
import { z as z21 } from "zod";
|
|
7256
7342
|
var authFields = {
|
|
7257
|
-
aws_auth_type:
|
|
7343
|
+
aws_auth_type: z21.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
|
|
7258
7344
|
"AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
|
|
7259
7345
|
),
|
|
7260
|
-
aws_access_key_id:
|
|
7261
|
-
aws_secret_access_key:
|
|
7346
|
+
aws_access_key_id: z21.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
|
|
7347
|
+
aws_secret_access_key: z21.string().min(1).describe(
|
|
7262
7348
|
"AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
|
|
7263
7349
|
),
|
|
7264
|
-
aws_region:
|
|
7265
|
-
aws_role_arn:
|
|
7350
|
+
aws_region: z21.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
|
|
7351
|
+
aws_role_arn: z21.string().min(1).describe(
|
|
7266
7352
|
"IAM role ARN to assume; required when aws_auth_type is assumedRole"
|
|
7267
7353
|
),
|
|
7268
|
-
aws_external_id:
|
|
7269
|
-
azure_auth_mode:
|
|
7354
|
+
aws_external_id: z21.string().nullable().describe("Optional external ID required by the target IAM role"),
|
|
7355
|
+
azure_auth_mode: z21.enum(["entra", "managed", "default"]).describe(
|
|
7270
7356
|
"Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
|
|
7271
7357
|
),
|
|
7272
|
-
azure_entra_tenant_id:
|
|
7273
|
-
azure_entra_client_id:
|
|
7358
|
+
azure_entra_tenant_id: z21.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
|
|
7359
|
+
azure_entra_client_id: z21.string().min(1).describe(
|
|
7274
7360
|
"Microsoft Entra application client ID; required for entra authentication"
|
|
7275
7361
|
),
|
|
7276
|
-
azure_entra_client_secret:
|
|
7362
|
+
azure_entra_client_secret: z21.string().min(1).describe(
|
|
7277
7363
|
"Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
|
|
7278
7364
|
),
|
|
7279
|
-
azure_managed_client_id:
|
|
7365
|
+
azure_managed_client_id: z21.string().min(1).describe(
|
|
7280
7366
|
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
7281
7367
|
),
|
|
7282
|
-
azure_vault_url:
|
|
7368
|
+
azure_vault_url: z21.url().describe(
|
|
7283
7369
|
"Azure Key Vault URL, for example https://example.vault.azure.net"
|
|
7284
7370
|
),
|
|
7285
|
-
vault_auth_type:
|
|
7371
|
+
vault_auth_type: z21.enum(["token", "approle", "kubernetes"]).describe(
|
|
7286
7372
|
"HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
|
|
7287
7373
|
),
|
|
7288
|
-
vault_addr:
|
|
7289
|
-
vault_token:
|
|
7374
|
+
vault_addr: z21.url().describe("Base URL of the HashiCorp Vault server"),
|
|
7375
|
+
vault_token: z21.string().min(1).describe(
|
|
7290
7376
|
"HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
|
|
7291
7377
|
),
|
|
7292
|
-
vault_namespace:
|
|
7293
|
-
vault_role_id:
|
|
7378
|
+
vault_namespace: z21.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
7379
|
+
vault_role_id: z21.string().min(1).describe(
|
|
7294
7380
|
"HashiCorp Vault AppRole role ID; required for approle authentication"
|
|
7295
7381
|
),
|
|
7296
|
-
vault_secret_id:
|
|
7382
|
+
vault_secret_id: z21.string().min(1).describe(
|
|
7297
7383
|
"HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
|
|
7298
7384
|
),
|
|
7299
|
-
vault_role:
|
|
7385
|
+
vault_role: z21.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
|
|
7300
7386
|
};
|
|
7301
|
-
var authConfigSchema =
|
|
7302
|
-
|
|
7303
|
-
aws_auth_type:
|
|
7387
|
+
var authConfigSchema = z21.union([
|
|
7388
|
+
z21.object({
|
|
7389
|
+
aws_auth_type: z21.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
|
|
7304
7390
|
aws_access_key_id: authFields.aws_access_key_id,
|
|
7305
7391
|
aws_secret_access_key: authFields.aws_secret_access_key,
|
|
7306
7392
|
aws_region: authFields.aws_region
|
|
7307
7393
|
}).strict(),
|
|
7308
|
-
|
|
7309
|
-
aws_auth_type:
|
|
7394
|
+
z21.object({
|
|
7395
|
+
aws_auth_type: z21.literal("assumedRole").describe("Assume the specified AWS IAM role"),
|
|
7310
7396
|
aws_role_arn: authFields.aws_role_arn,
|
|
7311
7397
|
aws_external_id: authFields.aws_external_id.optional(),
|
|
7312
7398
|
aws_region: authFields.aws_region
|
|
7313
7399
|
}).strict(),
|
|
7314
|
-
|
|
7315
|
-
aws_auth_type:
|
|
7316
|
-
aws_region:
|
|
7400
|
+
z21.object({
|
|
7401
|
+
aws_auth_type: z21.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
|
|
7402
|
+
aws_region: z21.string().optional().describe(
|
|
7317
7403
|
"Optional AWS region containing the secret, for example us-east-1"
|
|
7318
7404
|
)
|
|
7319
7405
|
}).strict(),
|
|
7320
|
-
|
|
7321
|
-
azure_auth_mode:
|
|
7406
|
+
z21.object({
|
|
7407
|
+
azure_auth_mode: z21.literal("entra").describe(
|
|
7322
7408
|
"Authenticate with a Microsoft Entra application client secret"
|
|
7323
7409
|
),
|
|
7324
7410
|
azure_entra_tenant_id: authFields.azure_entra_tenant_id,
|
|
@@ -7326,30 +7412,30 @@ var authConfigSchema = z20.union([
|
|
|
7326
7412
|
azure_entra_client_secret: authFields.azure_entra_client_secret,
|
|
7327
7413
|
azure_vault_url: authFields.azure_vault_url
|
|
7328
7414
|
}).strict(),
|
|
7329
|
-
|
|
7330
|
-
azure_auth_mode:
|
|
7415
|
+
z21.object({
|
|
7416
|
+
azure_auth_mode: z21.literal("managed").describe("Authenticate with an Azure managed identity"),
|
|
7331
7417
|
azure_managed_client_id: authFields.azure_managed_client_id.optional(),
|
|
7332
7418
|
azure_vault_url: authFields.azure_vault_url
|
|
7333
7419
|
}).strict(),
|
|
7334
|
-
|
|
7335
|
-
azure_auth_mode:
|
|
7420
|
+
z21.object({
|
|
7421
|
+
azure_auth_mode: z21.literal("default").describe("Use Azure's default runtime credential chain"),
|
|
7336
7422
|
azure_vault_url: authFields.azure_vault_url
|
|
7337
7423
|
}).strict(),
|
|
7338
|
-
|
|
7339
|
-
vault_auth_type:
|
|
7424
|
+
z21.object({
|
|
7425
|
+
vault_auth_type: z21.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
|
|
7340
7426
|
vault_addr: authFields.vault_addr,
|
|
7341
7427
|
vault_token: authFields.vault_token,
|
|
7342
7428
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7343
7429
|
}).strict(),
|
|
7344
|
-
|
|
7345
|
-
vault_auth_type:
|
|
7430
|
+
z21.object({
|
|
7431
|
+
vault_auth_type: z21.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
|
|
7346
7432
|
vault_addr: authFields.vault_addr,
|
|
7347
7433
|
vault_role_id: authFields.vault_role_id,
|
|
7348
7434
|
vault_secret_id: authFields.vault_secret_id,
|
|
7349
7435
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7350
7436
|
}).strict(),
|
|
7351
|
-
|
|
7352
|
-
vault_auth_type:
|
|
7437
|
+
z21.object({
|
|
7438
|
+
vault_auth_type: z21.literal("kubernetes").describe(
|
|
7353
7439
|
"Authenticate to HashiCorp Vault with a Kubernetes service account"
|
|
7354
7440
|
),
|
|
7355
7441
|
vault_addr: authFields.vault_addr,
|
|
@@ -7357,61 +7443,61 @@ var authConfigSchema = z20.union([
|
|
|
7357
7443
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7358
7444
|
}).strict()
|
|
7359
7445
|
]);
|
|
7360
|
-
var updateAuthConfigSchema =
|
|
7361
|
-
|
|
7446
|
+
var updateAuthConfigSchema = z21.union([
|
|
7447
|
+
z21.object({
|
|
7362
7448
|
aws_auth_type: authFields.aws_auth_type.optional(),
|
|
7363
7449
|
aws_access_key_id: authFields.aws_access_key_id.optional(),
|
|
7364
7450
|
aws_secret_access_key: authFields.aws_secret_access_key.optional(),
|
|
7365
|
-
aws_region:
|
|
7451
|
+
aws_region: z21.string().optional().describe("AWS region containing the secret, for example us-east-1"),
|
|
7366
7452
|
aws_role_arn: authFields.aws_role_arn.optional(),
|
|
7367
7453
|
aws_external_id: authFields.aws_external_id.optional()
|
|
7368
7454
|
}).strict(),
|
|
7369
|
-
|
|
7455
|
+
z21.object({
|
|
7370
7456
|
azure_auth_mode: authFields.azure_auth_mode.optional(),
|
|
7371
7457
|
azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
|
|
7372
7458
|
azure_entra_client_id: authFields.azure_entra_client_id.optional(),
|
|
7373
7459
|
azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
|
|
7374
|
-
azure_managed_client_id:
|
|
7460
|
+
azure_managed_client_id: z21.string().optional().describe(
|
|
7375
7461
|
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
7376
7462
|
),
|
|
7377
7463
|
azure_vault_url: authFields.azure_vault_url.optional()
|
|
7378
7464
|
}).strict(),
|
|
7379
|
-
|
|
7465
|
+
z21.object({
|
|
7380
7466
|
vault_auth_type: authFields.vault_auth_type.optional(),
|
|
7381
7467
|
vault_addr: authFields.vault_addr.optional(),
|
|
7382
7468
|
vault_token: authFields.vault_token.optional(),
|
|
7383
|
-
vault_namespace:
|
|
7469
|
+
vault_namespace: z21.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
7384
7470
|
vault_role_id: authFields.vault_role_id.optional(),
|
|
7385
7471
|
vault_secret_id: authFields.vault_secret_id.optional(),
|
|
7386
7472
|
vault_role: authFields.vault_role.optional()
|
|
7387
7473
|
}).strict()
|
|
7388
7474
|
]);
|
|
7389
|
-
var managerTypeSchema =
|
|
7475
|
+
var managerTypeSchema = z21.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
|
|
7390
7476
|
"External secret manager: aws_sm for AWS Secrets Manager, azure_kv for Azure Key Vault, or hashicorp_vault for HashiCorp Vault; must match the auth_config field family"
|
|
7391
7477
|
);
|
|
7392
|
-
var tagsSchema =
|
|
7478
|
+
var tagsSchema = z21.record(z21.string(), z21.string()).describe("Tag filters or metadata as string key-value pairs");
|
|
7393
7479
|
var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
7394
7480
|
create: {
|
|
7395
|
-
name:
|
|
7481
|
+
name: z21.string().min(1).max(255).describe("Human-readable name"),
|
|
7396
7482
|
manager_type: managerTypeSchema,
|
|
7397
7483
|
auth_config: authConfigSchema.describe(
|
|
7398
7484
|
"Choose exactly one documented authentication shape matching manager_type. Credentials are sent to Portkey and visible in the MCP transcript; prefer workload identity or short-lived credentials when available."
|
|
7399
7485
|
),
|
|
7400
|
-
secret_path:
|
|
7401
|
-
organisation_id:
|
|
7486
|
+
secret_path: z21.string().max(1024).describe("Path of the secret in the external secret manager"),
|
|
7487
|
+
organisation_id: z21.string().uuid().optional().describe(
|
|
7402
7488
|
"Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
|
|
7403
7489
|
),
|
|
7404
|
-
slug:
|
|
7490
|
+
slug: z21.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
|
|
7405
7491
|
"Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
|
|
7406
7492
|
),
|
|
7407
|
-
description:
|
|
7408
|
-
secret_key:
|
|
7493
|
+
description: z21.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
|
|
7494
|
+
secret_key: z21.string().max(255).nullable().optional().describe(
|
|
7409
7495
|
"Optional key within a structured external secret; null uses the whole secret value"
|
|
7410
7496
|
),
|
|
7411
|
-
allow_all_workspaces:
|
|
7497
|
+
allow_all_workspaces: z21.boolean().optional().describe(
|
|
7412
7498
|
"Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
|
|
7413
7499
|
),
|
|
7414
|
-
allowed_workspaces:
|
|
7500
|
+
allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
|
|
7415
7501
|
"Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
|
|
7416
7502
|
),
|
|
7417
7503
|
tags: tagsSchema.nullable().optional().describe(
|
|
@@ -7423,7 +7509,7 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7423
7509
|
"Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
|
|
7424
7510
|
),
|
|
7425
7511
|
tags: tagsSchema.optional().describe("Return references matching these tags"),
|
|
7426
|
-
search:
|
|
7512
|
+
search: z21.string().min(1).max(255).optional().describe("Search references by name"),
|
|
7427
7513
|
current_page: CurrentPageSchema.describe(
|
|
7428
7514
|
"Zero-based page number; defaults to 0"
|
|
7429
7515
|
),
|
|
@@ -7432,29 +7518,29 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7432
7518
|
)
|
|
7433
7519
|
},
|
|
7434
7520
|
get: {
|
|
7435
|
-
id:
|
|
7521
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug")
|
|
7436
7522
|
},
|
|
7437
7523
|
update: {
|
|
7438
|
-
id:
|
|
7439
|
-
name:
|
|
7440
|
-
description:
|
|
7524
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug"),
|
|
7525
|
+
name: z21.string().min(1).max(255).optional().describe("New human-readable name"),
|
|
7526
|
+
description: z21.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
|
|
7441
7527
|
auth_config: updateAuthConfigSchema.optional().describe(
|
|
7442
7528
|
"Provide at least one changed authentication field to merge into the existing configuration; choose one AWS, Azure, or HashiCorp field family and do not mix families"
|
|
7443
7529
|
),
|
|
7444
|
-
secret_path:
|
|
7445
|
-
secret_key:
|
|
7530
|
+
secret_path: z21.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
|
|
7531
|
+
secret_key: z21.string().max(255).nullable().optional().describe(
|
|
7446
7532
|
"New key within a structured secret, or null to use the whole value"
|
|
7447
7533
|
),
|
|
7448
|
-
allow_all_workspaces:
|
|
7534
|
+
allow_all_workspaces: z21.boolean().optional().describe(
|
|
7449
7535
|
"Whether every workspace may use this reference; cannot be true with allowed_workspaces"
|
|
7450
7536
|
),
|
|
7451
|
-
allowed_workspaces:
|
|
7537
|
+
allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
|
|
7452
7538
|
"Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
|
|
7453
7539
|
),
|
|
7454
7540
|
tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
|
|
7455
7541
|
},
|
|
7456
7542
|
delete: {
|
|
7457
|
-
id:
|
|
7543
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug")
|
|
7458
7544
|
}
|
|
7459
7545
|
};
|
|
7460
7546
|
function validateWorkspaceAccess(value) {
|
|
@@ -7618,29 +7704,29 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7618
7704
|
}
|
|
7619
7705
|
|
|
7620
7706
|
// src/tools/tracing.tools.ts
|
|
7621
|
-
import { z as
|
|
7707
|
+
import { z as z22 } from "zod";
|
|
7622
7708
|
var TRACING_TOOL_SCHEMAS = {
|
|
7623
7709
|
createFeedback: {
|
|
7624
|
-
trace_id:
|
|
7710
|
+
trace_id: z22.string().describe(
|
|
7625
7711
|
"The trace ID to associate the feedback with. This links feedback to a specific request/generation."
|
|
7626
7712
|
),
|
|
7627
|
-
value:
|
|
7713
|
+
value: z22.coerce.number().describe(
|
|
7628
7714
|
"Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
|
|
7629
7715
|
),
|
|
7630
|
-
weight:
|
|
7716
|
+
weight: z22.coerce.number().positive().optional().describe(
|
|
7631
7717
|
"Optional weighting factor for the feedback. Use to give more importance to certain feedback."
|
|
7632
7718
|
),
|
|
7633
|
-
metadata:
|
|
7719
|
+
metadata: z22.record(z22.string(), z22.unknown()).optional().describe(
|
|
7634
7720
|
"Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
|
|
7635
7721
|
)
|
|
7636
7722
|
},
|
|
7637
7723
|
updateFeedback: {
|
|
7638
|
-
id:
|
|
7639
|
-
value:
|
|
7724
|
+
id: z22.string().describe("The unique identifier of the feedback to update"),
|
|
7725
|
+
value: z22.coerce.number().optional().describe(
|
|
7640
7726
|
"New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
|
|
7641
7727
|
),
|
|
7642
|
-
weight:
|
|
7643
|
-
metadata:
|
|
7728
|
+
weight: z22.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
|
|
7729
|
+
metadata: z22.record(z22.string(), z22.unknown()).optional().describe("New or updated custom metadata for the feedback")
|
|
7644
7730
|
}
|
|
7645
7731
|
};
|
|
7646
7732
|
function registerTracingTools(server, service) {
|
|
@@ -7682,82 +7768,82 @@ function registerTracingTools(server, service) {
|
|
|
7682
7768
|
}
|
|
7683
7769
|
|
|
7684
7770
|
// src/tools/users.tools.ts
|
|
7685
|
-
import { z as
|
|
7771
|
+
import { z as z23 } from "zod";
|
|
7686
7772
|
var USERS_TOOL_SCHEMAS = {
|
|
7687
7773
|
listAllUsers: {
|
|
7688
7774
|
current_page: CurrentPageSchema,
|
|
7689
7775
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7690
|
-
role:
|
|
7691
|
-
email:
|
|
7776
|
+
role: z23.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
|
|
7777
|
+
email: z23.string().email().optional().describe("Filter by exact email")
|
|
7692
7778
|
},
|
|
7693
7779
|
inviteUser: {
|
|
7694
|
-
email:
|
|
7695
|
-
role:
|
|
7780
|
+
email: z23.string().email().describe("Email address of the user to invite"),
|
|
7781
|
+
role: z23.enum(["admin", "member"]).describe(
|
|
7696
7782
|
"Organization-level role: 'admin' for full access, 'member' for limited access"
|
|
7697
7783
|
),
|
|
7698
|
-
first_name:
|
|
7699
|
-
last_name:
|
|
7700
|
-
workspaces:
|
|
7701
|
-
|
|
7702
|
-
id:
|
|
7784
|
+
first_name: z23.string().optional().describe("User's first name"),
|
|
7785
|
+
last_name: z23.string().optional().describe("User's last name"),
|
|
7786
|
+
workspaces: z23.array(
|
|
7787
|
+
z23.object({
|
|
7788
|
+
id: z23.string().describe(
|
|
7703
7789
|
"Workspace ID/slug where the user will be granted access"
|
|
7704
7790
|
),
|
|
7705
|
-
role:
|
|
7791
|
+
role: z23.enum(["admin", "member", "manager"]).describe(
|
|
7706
7792
|
"Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
|
|
7707
7793
|
)
|
|
7708
7794
|
})
|
|
7709
7795
|
).describe(
|
|
7710
7796
|
"List of workspaces and corresponding roles to grant to the user"
|
|
7711
7797
|
),
|
|
7712
|
-
workspace_api_key_details:
|
|
7713
|
-
name:
|
|
7714
|
-
expiry:
|
|
7715
|
-
metadata:
|
|
7716
|
-
scopes:
|
|
7798
|
+
workspace_api_key_details: z23.object({
|
|
7799
|
+
name: z23.string().optional().describe("Name of the API key to be created"),
|
|
7800
|
+
expiry: z23.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
|
|
7801
|
+
metadata: z23.record(z23.string(), z23.string()).optional().describe("Additional metadata key-value pairs for the API key"),
|
|
7802
|
+
scopes: z23.array(z23.string()).describe("List of permission scopes for the API key")
|
|
7717
7803
|
}).optional().describe("Optional API key to be created for the user")
|
|
7718
7804
|
},
|
|
7719
7805
|
getUserStats: {
|
|
7720
|
-
time_of_generation_min:
|
|
7806
|
+
time_of_generation_min: z23.string().describe(
|
|
7721
7807
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
7722
7808
|
),
|
|
7723
|
-
time_of_generation_max:
|
|
7809
|
+
time_of_generation_max: z23.string().describe(
|
|
7724
7810
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
7725
7811
|
),
|
|
7726
|
-
total_units_min:
|
|
7727
|
-
total_units_max:
|
|
7728
|
-
cost_min:
|
|
7729
|
-
cost_max:
|
|
7730
|
-
status_code:
|
|
7731
|
-
virtual_keys:
|
|
7812
|
+
total_units_min: z23.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
|
|
7813
|
+
total_units_max: z23.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
|
|
7814
|
+
cost_min: z23.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
|
|
7815
|
+
cost_max: z23.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
7816
|
+
status_code: z23.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
|
|
7817
|
+
virtual_keys: z23.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
|
|
7732
7818
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
7733
7819
|
},
|
|
7734
7820
|
getUser: {
|
|
7735
|
-
user_id:
|
|
7821
|
+
user_id: z23.string().describe("The user ID to retrieve")
|
|
7736
7822
|
},
|
|
7737
7823
|
updateUser: {
|
|
7738
|
-
user_id:
|
|
7739
|
-
first_name:
|
|
7740
|
-
last_name:
|
|
7741
|
-
role:
|
|
7824
|
+
user_id: z23.string().describe("The user ID to update"),
|
|
7825
|
+
first_name: z23.string().optional().describe("New first name"),
|
|
7826
|
+
last_name: z23.string().optional().describe("New last name"),
|
|
7827
|
+
role: z23.enum(["admin", "member"]).optional().describe("New organization-level role")
|
|
7742
7828
|
},
|
|
7743
7829
|
deleteUser: {
|
|
7744
|
-
user_id:
|
|
7830
|
+
user_id: z23.string().describe("The user ID to delete")
|
|
7745
7831
|
},
|
|
7746
7832
|
listUserInvites: {
|
|
7747
7833
|
current_page: CurrentPageSchema,
|
|
7748
7834
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7749
|
-
role:
|
|
7750
|
-
email:
|
|
7751
|
-
status:
|
|
7835
|
+
role: z23.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
|
|
7836
|
+
email: z23.string().email().optional().describe("Filter by invited email"),
|
|
7837
|
+
status: z23.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
|
|
7752
7838
|
},
|
|
7753
7839
|
getUserInvite: {
|
|
7754
|
-
invite_id:
|
|
7840
|
+
invite_id: z23.string().describe("The invite ID to retrieve")
|
|
7755
7841
|
},
|
|
7756
7842
|
deleteUserInvite: {
|
|
7757
|
-
invite_id:
|
|
7843
|
+
invite_id: z23.string().describe("The invite ID to delete")
|
|
7758
7844
|
},
|
|
7759
7845
|
resendUserInvite: {
|
|
7760
|
-
invite_id:
|
|
7846
|
+
invite_id: z23.string().describe("The invite ID to resend")
|
|
7761
7847
|
}
|
|
7762
7848
|
};
|
|
7763
7849
|
function formatUser(user) {
|
|
@@ -7918,34 +8004,34 @@ function registerUsersTools(server, service) {
|
|
|
7918
8004
|
}
|
|
7919
8005
|
|
|
7920
8006
|
// src/tools/workspaces.tools.ts
|
|
7921
|
-
import { z as
|
|
8007
|
+
import { z as z24 } from "zod";
|
|
7922
8008
|
var scimWorkspaceMappingBaseShape = {
|
|
7923
|
-
workspace_id:
|
|
7924
|
-
role:
|
|
8009
|
+
workspace_id: z24.string().describe("Portkey workspace ID that the SCIM group should access"),
|
|
8010
|
+
role: z24.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
|
|
7925
8011
|
};
|
|
7926
8012
|
var createScimWorkspaceMappingShape = {
|
|
7927
8013
|
...scimWorkspaceMappingBaseShape,
|
|
7928
|
-
scim_group_id:
|
|
8014
|
+
scim_group_id: z24.string().min(1).optional().describe(
|
|
7929
8015
|
"Existing identity-provider SCIM group ID; provide this or scim_group_name, but not both"
|
|
7930
8016
|
),
|
|
7931
|
-
scim_group_name:
|
|
8017
|
+
scim_group_name: z24.string().min(1).optional().describe(
|
|
7932
8018
|
"Existing SCIM group display name; provide this or scim_group_id, but not both"
|
|
7933
8019
|
)
|
|
7934
8020
|
};
|
|
7935
|
-
var workspaceUsageLimitSchema =
|
|
7936
|
-
credit_limit:
|
|
7937
|
-
type:
|
|
7938
|
-
alert_threshold:
|
|
7939
|
-
periodic_reset:
|
|
7940
|
-
periodic_reset_days:
|
|
7941
|
-
next_usage_reset_at:
|
|
8021
|
+
var workspaceUsageLimitSchema = z24.object({
|
|
8022
|
+
credit_limit: z24.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
|
|
8023
|
+
type: z24.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
|
|
8024
|
+
alert_threshold: z24.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
|
|
8025
|
+
periodic_reset: z24.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
|
|
8026
|
+
periodic_reset_days: z24.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
|
|
8027
|
+
next_usage_reset_at: z24.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
|
|
7942
8028
|
});
|
|
7943
|
-
var workspaceRateLimitSchema =
|
|
7944
|
-
type:
|
|
7945
|
-
unit:
|
|
7946
|
-
value:
|
|
8029
|
+
var workspaceRateLimitSchema = z24.object({
|
|
8030
|
+
type: z24.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
|
|
8031
|
+
unit: z24.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
|
|
8032
|
+
value: z24.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
|
|
7947
8033
|
});
|
|
7948
|
-
var createScimWorkspaceMappingSchema =
|
|
8034
|
+
var createScimWorkspaceMappingSchema = z24.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
|
|
7949
8035
|
if (Boolean(input.scim_group_id) === Boolean(input.scim_group_name)) {
|
|
7950
8036
|
context.addIssue({
|
|
7951
8037
|
code: "custom",
|
|
@@ -7960,99 +8046,99 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7960
8046
|
"Number of workspaces to return per page (max 100)"
|
|
7961
8047
|
),
|
|
7962
8048
|
current_page: CurrentPageSchema,
|
|
7963
|
-
name:
|
|
7964
|
-
exact_name:
|
|
7965
|
-
status:
|
|
8049
|
+
name: z24.string().optional().describe("Case-sensitive name filter"),
|
|
8050
|
+
exact_name: z24.string().optional().describe("Exact workspace name filter"),
|
|
8051
|
+
status: z24.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
|
|
7966
8052
|
},
|
|
7967
8053
|
getWorkspace: {
|
|
7968
|
-
workspace_id:
|
|
8054
|
+
workspace_id: z24.string().describe(
|
|
7969
8055
|
"The unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response"
|
|
7970
8056
|
)
|
|
7971
8057
|
},
|
|
7972
8058
|
createWorkspace: {
|
|
7973
|
-
name:
|
|
7974
|
-
slug:
|
|
7975
|
-
description:
|
|
7976
|
-
is_default:
|
|
7977
|
-
metadata:
|
|
7978
|
-
users:
|
|
7979
|
-
usage_limits:
|
|
7980
|
-
rate_limits:
|
|
8059
|
+
name: z24.string().describe("Name of the workspace"),
|
|
8060
|
+
slug: z24.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
|
|
8061
|
+
description: z24.string().optional().describe("Description of the workspace"),
|
|
8062
|
+
is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
8063
|
+
metadata: z24.record(z24.string(), z24.string()).optional().describe("Custom metadata key-value pairs"),
|
|
8064
|
+
users: z24.array(z24.string()).optional().describe("Existing user IDs to add"),
|
|
8065
|
+
usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
|
|
8066
|
+
rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
|
|
7981
8067
|
},
|
|
7982
8068
|
updateWorkspace: {
|
|
7983
|
-
workspace_id:
|
|
7984
|
-
name:
|
|
7985
|
-
slug:
|
|
7986
|
-
description:
|
|
7987
|
-
is_default:
|
|
7988
|
-
metadata:
|
|
7989
|
-
input_guardrails:
|
|
7990
|
-
output_guardrails:
|
|
7991
|
-
user_api_key_config:
|
|
8069
|
+
workspace_id: z24.string().describe("The workspace ID to update"),
|
|
8070
|
+
name: z24.string().optional().describe("New name for the workspace"),
|
|
8071
|
+
slug: z24.string().optional().describe("New slug for the workspace"),
|
|
8072
|
+
description: z24.string().optional().describe("New description"),
|
|
8073
|
+
is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
8074
|
+
metadata: z24.record(z24.string(), z24.string()).optional().describe("New metadata key-value pairs"),
|
|
8075
|
+
input_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
|
|
8076
|
+
output_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
|
|
8077
|
+
user_api_key_config: z24.string().nullable().optional().describe(
|
|
7992
8078
|
"Default config slug for workspace-user API keys, or null to clear"
|
|
7993
8079
|
),
|
|
7994
|
-
usage_limits:
|
|
7995
|
-
rate_limits:
|
|
8080
|
+
usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
|
|
8081
|
+
rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
|
|
7996
8082
|
},
|
|
7997
8083
|
deleteWorkspace: {
|
|
7998
|
-
workspace_id:
|
|
8084
|
+
workspace_id: z24.string().describe("The workspace ID to delete")
|
|
7999
8085
|
},
|
|
8000
8086
|
addWorkspaceMember: {
|
|
8001
|
-
workspace_id:
|
|
8002
|
-
user_id:
|
|
8087
|
+
workspace_id: z24.string().describe("The workspace ID to add the member to"),
|
|
8088
|
+
user_id: z24.string().uuid(
|
|
8003
8089
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8004
8090
|
).describe(
|
|
8005
8091
|
"The user ID to add (must be a valid UUID from list_all_users, not an email address)"
|
|
8006
8092
|
),
|
|
8007
|
-
role:
|
|
8093
|
+
role: z24.enum(["admin", "member", "manager"]).describe("Role in the workspace")
|
|
8008
8094
|
},
|
|
8009
8095
|
listWorkspaceMembers: {
|
|
8010
|
-
workspace_id:
|
|
8096
|
+
workspace_id: z24.string().describe("The workspace ID to list members for"),
|
|
8011
8097
|
current_page: CurrentPageSchema.describe("Zero-based page number"),
|
|
8012
8098
|
page_size: PageSizeSchema.describe("Number of members per page"),
|
|
8013
|
-
role:
|
|
8014
|
-
email:
|
|
8099
|
+
role: z24.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
|
|
8100
|
+
email: z24.string().email().optional().describe("Filter by member email")
|
|
8015
8101
|
},
|
|
8016
8102
|
getWorkspaceMember: {
|
|
8017
|
-
workspace_id:
|
|
8018
|
-
user_id:
|
|
8103
|
+
workspace_id: z24.string().describe("The workspace ID"),
|
|
8104
|
+
user_id: z24.string().uuid(
|
|
8019
8105
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8020
8106
|
).describe(
|
|
8021
8107
|
"The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
|
|
8022
8108
|
)
|
|
8023
8109
|
},
|
|
8024
8110
|
updateWorkspaceMember: {
|
|
8025
|
-
workspace_id:
|
|
8026
|
-
user_id:
|
|
8111
|
+
workspace_id: z24.string().describe("The workspace ID"),
|
|
8112
|
+
user_id: z24.string().uuid(
|
|
8027
8113
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8028
8114
|
).describe(
|
|
8029
8115
|
"The user ID to update (must be a valid UUID from list_all_users, not an email address)"
|
|
8030
8116
|
),
|
|
8031
|
-
role:
|
|
8117
|
+
role: z24.enum(["admin", "member", "manager"]).describe("New role in the workspace")
|
|
8032
8118
|
},
|
|
8033
8119
|
removeWorkspaceMember: {
|
|
8034
|
-
workspace_id:
|
|
8035
|
-
user_id:
|
|
8120
|
+
workspace_id: z24.string().describe("The workspace ID"),
|
|
8121
|
+
user_id: z24.string().uuid(
|
|
8036
8122
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8037
8123
|
).describe("The user ID to remove")
|
|
8038
8124
|
},
|
|
8039
8125
|
listScimWorkspaceMappings: {
|
|
8040
|
-
workspace_id:
|
|
8041
|
-
scim_group_id:
|
|
8126
|
+
workspace_id: z24.string().optional().describe("Return only mappings for this Portkey workspace ID"),
|
|
8127
|
+
scim_group_id: z24.string().optional().describe(
|
|
8042
8128
|
"Return only mappings for this identity-provider SCIM group ID"
|
|
8043
8129
|
),
|
|
8044
|
-
role:
|
|
8045
|
-
page:
|
|
8130
|
+
role: z24.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
|
|
8131
|
+
page: z24.coerce.number().int().nonnegative().optional().describe(
|
|
8046
8132
|
"Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
|
|
8047
8133
|
),
|
|
8048
8134
|
page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
|
|
8049
8135
|
},
|
|
8050
8136
|
deleteScimWorkspaceMapping: {
|
|
8051
|
-
mapping_id:
|
|
8137
|
+
mapping_id: z24.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
|
|
8052
8138
|
},
|
|
8053
8139
|
listScimGroups: {
|
|
8054
|
-
search:
|
|
8055
|
-
page:
|
|
8140
|
+
search: z24.string().optional().describe("Case-insensitive text to match against SCIM group names"),
|
|
8141
|
+
page: z24.coerce.number().int().nonnegative().optional().describe(
|
|
8056
8142
|
"Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
|
|
8057
8143
|
),
|
|
8058
8144
|
page_size: PageSizeSchema.describe(
|
|
@@ -8443,6 +8529,9 @@ var ENTERPRISE_GATED_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
8443
8529
|
"get_analytics_group_models",
|
|
8444
8530
|
"get_analytics_group_metadata",
|
|
8445
8531
|
"get_analytics_group_providers",
|
|
8532
|
+
"get_analytics_group_mcp",
|
|
8533
|
+
"get_analytics_group_a2a",
|
|
8534
|
+
"get_analytics_group_workspaces",
|
|
8446
8535
|
"list_deployments",
|
|
8447
8536
|
"register_deployment",
|
|
8448
8537
|
"get_deployment",
|
|
@@ -8539,7 +8628,7 @@ function escapeRegExp(value) {
|
|
|
8539
8628
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8540
8629
|
}
|
|
8541
8630
|
function getToolErrorMessage(error) {
|
|
8542
|
-
if (error instanceof
|
|
8631
|
+
if (error instanceof z25.ZodError) {
|
|
8543
8632
|
return formatZodIssues(error);
|
|
8544
8633
|
}
|
|
8545
8634
|
if (error instanceof Error && error.message) {
|
|
@@ -8548,71 +8637,71 @@ function getToolErrorMessage(error) {
|
|
|
8548
8637
|
return String(error);
|
|
8549
8638
|
}
|
|
8550
8639
|
var STANDARD_TOOL_OUTPUT_SCHEMA = {
|
|
8551
|
-
ok:
|
|
8552
|
-
data:
|
|
8553
|
-
error:
|
|
8554
|
-
message:
|
|
8555
|
-
details:
|
|
8640
|
+
ok: z25.boolean().describe("Whether the tool call succeeded and returned structured data"),
|
|
8641
|
+
data: z25.unknown().optional().describe("Structured success payload when ok is true"),
|
|
8642
|
+
error: z25.object({
|
|
8643
|
+
message: z25.string().describe("Human-readable error message"),
|
|
8644
|
+
details: z25.unknown().optional().describe("Optional structured error details")
|
|
8556
8645
|
}).optional().describe("Structured error payload when ok is false")
|
|
8557
8646
|
};
|
|
8558
8647
|
var TOOL_SUCCESS_DATA_SCHEMAS = {
|
|
8559
|
-
rotate_api_key:
|
|
8560
|
-
message:
|
|
8561
|
-
warning:
|
|
8562
|
-
id:
|
|
8563
|
-
key:
|
|
8564
|
-
key_transition_expires_at:
|
|
8648
|
+
rotate_api_key: z25.object({
|
|
8649
|
+
message: z25.string().describe("Rotation confirmation"),
|
|
8650
|
+
warning: z25.string().describe("Required handling guidance for the one-time secret"),
|
|
8651
|
+
id: z25.string().uuid().describe("Rotated API key UUID"),
|
|
8652
|
+
key: z25.string().describe("New API key secret, returned only once"),
|
|
8653
|
+
key_transition_expires_at: z25.iso.datetime().describe("Time when the previous key stops working")
|
|
8565
8654
|
}),
|
|
8566
|
-
create_secret_reference:
|
|
8567
|
-
message:
|
|
8568
|
-
id:
|
|
8569
|
-
slug:
|
|
8655
|
+
create_secret_reference: z25.object({
|
|
8656
|
+
message: z25.string().describe("Creation confirmation"),
|
|
8657
|
+
id: z25.string().uuid().describe("New Secret Reference UUID"),
|
|
8658
|
+
slug: z25.string().describe("New Secret Reference slug")
|
|
8570
8659
|
}),
|
|
8571
|
-
list_secret_references:
|
|
8572
|
-
total:
|
|
8573
|
-
secret_references:
|
|
8574
|
-
|
|
8575
|
-
id:
|
|
8576
|
-
name:
|
|
8577
|
-
slug:
|
|
8660
|
+
list_secret_references: z25.object({
|
|
8661
|
+
total: z25.number().int().nonnegative().describe("Total matching references"),
|
|
8662
|
+
secret_references: z25.array(
|
|
8663
|
+
z25.object({
|
|
8664
|
+
id: z25.string().uuid().describe("Secret Reference UUID"),
|
|
8665
|
+
name: z25.string().describe("Human-readable name"),
|
|
8666
|
+
slug: z25.string().describe("Stable Secret Reference slug"),
|
|
8578
8667
|
manager_type: SecretManagerTypeSchema.describe(
|
|
8579
8668
|
"External secret manager type"
|
|
8580
8669
|
),
|
|
8581
|
-
status:
|
|
8582
|
-
created_at:
|
|
8583
|
-
last_updated_at:
|
|
8670
|
+
status: z25.literal("ACTIVE").describe("Current reference status"),
|
|
8671
|
+
created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8672
|
+
last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp")
|
|
8584
8673
|
})
|
|
8585
8674
|
).describe(
|
|
8586
8675
|
"Current page of Secret References without authentication values"
|
|
8587
8676
|
)
|
|
8588
8677
|
}),
|
|
8589
|
-
get_secret_reference:
|
|
8590
|
-
id:
|
|
8591
|
-
organisation_id:
|
|
8592
|
-
name:
|
|
8593
|
-
slug:
|
|
8594
|
-
description:
|
|
8678
|
+
get_secret_reference: z25.object({
|
|
8679
|
+
id: z25.string().uuid().describe("Secret Reference UUID"),
|
|
8680
|
+
organisation_id: z25.string().uuid().describe("Owning organisation UUID"),
|
|
8681
|
+
name: z25.string().describe("Human-readable name"),
|
|
8682
|
+
slug: z25.string().describe("Stable Secret Reference slug"),
|
|
8683
|
+
description: z25.string().nullable().describe("Reference description"),
|
|
8595
8684
|
manager_type: SecretManagerTypeSchema.describe(
|
|
8596
8685
|
"External secret manager type"
|
|
8597
8686
|
),
|
|
8598
|
-
secret_path:
|
|
8599
|
-
secret_key:
|
|
8600
|
-
allow_all_workspaces:
|
|
8601
|
-
tags:
|
|
8602
|
-
status:
|
|
8603
|
-
created_by:
|
|
8604
|
-
created_at:
|
|
8605
|
-
last_updated_at:
|
|
8606
|
-
auth_config:
|
|
8607
|
-
object:
|
|
8687
|
+
secret_path: z25.string().describe("Path in the external secret manager"),
|
|
8688
|
+
secret_key: z25.string().nullable().describe("Selected key within a structured secret"),
|
|
8689
|
+
allow_all_workspaces: z25.boolean().describe("Whether all workspaces may use the reference"),
|
|
8690
|
+
tags: z25.record(z25.string(), z25.string()).nullable().describe("String metadata tags"),
|
|
8691
|
+
status: z25.literal("ACTIVE").describe("Current reference status"),
|
|
8692
|
+
created_by: z25.string().describe("Creator identifier"),
|
|
8693
|
+
created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8694
|
+
last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp"),
|
|
8695
|
+
auth_config: z25.record(z25.string(), z25.unknown()).describe("Authentication configuration with sensitive values redacted"),
|
|
8696
|
+
object: z25.literal("secret-reference").describe("Portkey object type")
|
|
8608
8697
|
}),
|
|
8609
|
-
update_secret_reference:
|
|
8610
|
-
message:
|
|
8611
|
-
success:
|
|
8698
|
+
update_secret_reference: z25.object({
|
|
8699
|
+
message: z25.string().describe("Update confirmation"),
|
|
8700
|
+
success: z25.literal(true).describe("Whether the update succeeded")
|
|
8612
8701
|
}),
|
|
8613
|
-
delete_secret_reference:
|
|
8614
|
-
message:
|
|
8615
|
-
success:
|
|
8702
|
+
delete_secret_reference: z25.object({
|
|
8703
|
+
message: z25.string().describe("Deletion confirmation"),
|
|
8704
|
+
success: z25.literal(true).describe("Whether the deletion succeeded")
|
|
8616
8705
|
})
|
|
8617
8706
|
};
|
|
8618
8707
|
function getToolOutputSchema(toolName) {
|
|
@@ -8688,7 +8777,7 @@ function wrapToolCallback(toolName, callback) {
|
|
|
8688
8777
|
return normalizeToolResult(await callback(...args));
|
|
8689
8778
|
} catch (error) {
|
|
8690
8779
|
const message = getToolErrorMessage(error);
|
|
8691
|
-
const isValidationError = error instanceof
|
|
8780
|
+
const isValidationError = error instanceof z25.ZodError;
|
|
8692
8781
|
const text = isValidationError ? `Invalid arguments for "${toolName}": ${message}` : `Tool "${toolName}" failed: ${message}`;
|
|
8693
8782
|
Logger.error("Tool callback failed", {
|
|
8694
8783
|
error: message,
|
|
@@ -9799,7 +9888,7 @@ function createManagedEventStore(config) {
|
|
|
9799
9888
|
// src/lib/mcp-server.ts
|
|
9800
9889
|
import { readFileSync } from "node:fs";
|
|
9801
9890
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9802
|
-
import { z as
|
|
9891
|
+
import { z as z26 } from "zod";
|
|
9803
9892
|
var PACKAGE_JSON_URL_CANDIDATES = [
|
|
9804
9893
|
new URL("../../package.json", import.meta.url),
|
|
9805
9894
|
new URL("../package.json", import.meta.url)
|
|
@@ -9872,8 +9961,8 @@ function registerServerPromptsAndResources(server) {
|
|
|
9872
9961
|
title: "Plan Portkey Admin Workflow",
|
|
9873
9962
|
description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
|
|
9874
9963
|
argsSchema: {
|
|
9875
|
-
task:
|
|
9876
|
-
area:
|
|
9964
|
+
task: z26.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
|
|
9965
|
+
area: z26.string().max(80).optional().describe(
|
|
9877
9966
|
"Optional Portkey area, such as prompts, analytics, configs, or users"
|
|
9878
9967
|
)
|
|
9879
9968
|
}
|