portkey-admin-mcp 0.12.1 → 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 +26 -16
- package/README.md +26 -7
- package/build/index.js +895 -806
- package/build/server.js +895 -806
- package/docs/DISTRIBUTION.md +14 -11
- package/package.json +7 -6
package/build/index.js
CHANGED
|
@@ -59,7 +59,7 @@ var Logger = {
|
|
|
59
59
|
// src/lib/mcp-server.ts
|
|
60
60
|
import { readFileSync } from "node:fs";
|
|
61
61
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
62
|
-
import { z as
|
|
62
|
+
import { z as z26 } from "zod";
|
|
63
63
|
|
|
64
64
|
// src/services/base.service.ts
|
|
65
65
|
import crypto from "node:crypto";
|
|
@@ -450,6 +450,7 @@ var AnalyticsService = class extends BaseService {
|
|
|
450
450
|
api_key_ids: params.api_key_ids,
|
|
451
451
|
metadata: params.metadata,
|
|
452
452
|
ai_org_model: params.ai_org_model,
|
|
453
|
+
deployment_id: params.deployment_id,
|
|
453
454
|
trace_id: params.trace_id,
|
|
454
455
|
span_id: params.span_id,
|
|
455
456
|
prompt_slug: params.prompt_slug
|
|
@@ -618,6 +619,24 @@ var AnalyticsService = class extends BaseService {
|
|
|
618
619
|
this.buildAnalyticsParams(params)
|
|
619
620
|
);
|
|
620
621
|
}
|
|
622
|
+
async getAnalyticsGroupMcp(params) {
|
|
623
|
+
return this.get(
|
|
624
|
+
"/analytics/groups/mcp",
|
|
625
|
+
this.buildAnalyticsParams(params)
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
async getAnalyticsGroupA2a(params) {
|
|
629
|
+
return this.get(
|
|
630
|
+
"/analytics/groups/a2a",
|
|
631
|
+
this.buildAnalyticsParams(params)
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
async getAnalyticsGroupWorkspaces(params) {
|
|
635
|
+
return this.get(
|
|
636
|
+
"/analytics/groups/workspaces",
|
|
637
|
+
this.buildAnalyticsParams(params)
|
|
638
|
+
);
|
|
639
|
+
}
|
|
621
640
|
};
|
|
622
641
|
|
|
623
642
|
// src/services/audit.service.ts
|
|
@@ -920,7 +939,8 @@ var IntegrationsService = class extends BaseService {
|
|
|
920
939
|
current_page: params?.current_page,
|
|
921
940
|
page_size: params?.page_size,
|
|
922
941
|
workspace_id: params?.workspace_id,
|
|
923
|
-
type: params?.type
|
|
942
|
+
type: params?.type,
|
|
943
|
+
tags: params?.tags === void 0 ? void 0 : JSON.stringify(params.tags)
|
|
924
944
|
});
|
|
925
945
|
}
|
|
926
946
|
// Create a new integration
|
|
@@ -2112,7 +2132,7 @@ function getSharedPortkeyService(apiKey) {
|
|
|
2112
2132
|
}
|
|
2113
2133
|
|
|
2114
2134
|
// src/tools/index.ts
|
|
2115
|
-
import { z as
|
|
2135
|
+
import { z as z25 } from "zod";
|
|
2116
2136
|
|
|
2117
2137
|
// src/lib/type-guards.ts
|
|
2118
2138
|
function isRecord(value) {
|
|
@@ -2305,6 +2325,12 @@ var baseAnalyticsSchema = {
|
|
|
2305
2325
|
provider_models: z3.array(z3.string()).optional().describe(
|
|
2306
2326
|
"Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
|
|
2307
2327
|
),
|
|
2328
|
+
deployment_id: z3.string().optional().describe(
|
|
2329
|
+
"Comma-separated list of deployment IDs (UUIDs) to filter by. Prefer deployment_ids for structured inputs."
|
|
2330
|
+
),
|
|
2331
|
+
deployment_ids: z3.array(z3.string()).optional().describe(
|
|
2332
|
+
"Structured alias for deployment_id. Use an array of deployment UUIDs; normalized to the comma-separated Portkey query param."
|
|
2333
|
+
),
|
|
2308
2334
|
trace_id: z3.string().optional().describe(
|
|
2309
2335
|
"Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
|
|
2310
2336
|
),
|
|
@@ -2452,6 +2478,7 @@ function normalizeAnalyticsParams(params) {
|
|
|
2452
2478
|
trace_ids,
|
|
2453
2479
|
span_ids,
|
|
2454
2480
|
provider_models,
|
|
2481
|
+
deployment_ids,
|
|
2455
2482
|
metadata_filter,
|
|
2456
2483
|
...legacyParams
|
|
2457
2484
|
} = params;
|
|
@@ -2482,6 +2509,10 @@ function normalizeAnalyticsParams(params) {
|
|
|
2482
2509
|
if (providerModels !== void 0) {
|
|
2483
2510
|
normalizedParams.ai_org_model = providerModels;
|
|
2484
2511
|
}
|
|
2512
|
+
const deploymentId = normalizeCommaSeparatedParam(deployment_ids) ?? normalizeCommaSeparatedParam(legacyParams.deployment_id);
|
|
2513
|
+
if (deploymentId !== void 0) {
|
|
2514
|
+
normalizedParams.deployment_id = deploymentId;
|
|
2515
|
+
}
|
|
2485
2516
|
const traceId = normalizeCommaSeparatedParam(trace_ids) ?? normalizeCommaSeparatedParam(legacyParams.trace_id);
|
|
2486
2517
|
if (traceId !== void 0) {
|
|
2487
2518
|
normalizedParams.trace_id = traceId;
|
|
@@ -2791,6 +2822,42 @@ function registerAnalyticsTools(server, service) {
|
|
|
2791
2822
|
return jsonResult(formatGroupedAnalytics(analytics, "metadata_groups"));
|
|
2792
2823
|
}
|
|
2793
2824
|
);
|
|
2825
|
+
server.tool(
|
|
2826
|
+
"get_analytics_group_mcp",
|
|
2827
|
+
"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.",
|
|
2828
|
+
paginatedAnalyticsSchema,
|
|
2829
|
+
async (params) => {
|
|
2830
|
+
const analytics = await service.analytics.getAnalyticsGroupMcp(
|
|
2831
|
+
normalizeAnalyticsParams(params)
|
|
2832
|
+
);
|
|
2833
|
+
return jsonResult(formatGroupedAnalytics(analytics, "mcp_servers"));
|
|
2834
|
+
}
|
|
2835
|
+
);
|
|
2836
|
+
server.tool(
|
|
2837
|
+
"get_analytics_group_a2a",
|
|
2838
|
+
"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.",
|
|
2839
|
+
paginatedAnalyticsSchema,
|
|
2840
|
+
async (params) => {
|
|
2841
|
+
const analytics = await service.analytics.getAnalyticsGroupA2a(
|
|
2842
|
+
normalizeAnalyticsParams(params)
|
|
2843
|
+
);
|
|
2844
|
+
return jsonResult(formatGroupedAnalytics(analytics, "agents"));
|
|
2845
|
+
}
|
|
2846
|
+
);
|
|
2847
|
+
server.tool(
|
|
2848
|
+
"get_analytics_group_workspaces",
|
|
2849
|
+
"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.",
|
|
2850
|
+
paginatedAnalyticsSchema,
|
|
2851
|
+
async (params) => {
|
|
2852
|
+
const analytics = await service.analytics.getAnalyticsGroupWorkspaces(
|
|
2853
|
+
normalizeAnalyticsParams(params)
|
|
2854
|
+
);
|
|
2855
|
+
return jsonResult({
|
|
2856
|
+
...formatGroupedAnalytics(analytics, "workspaces"),
|
|
2857
|
+
is_quota_exceeded: analytics.is_quota_exceeded
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
);
|
|
2794
2861
|
}
|
|
2795
2862
|
|
|
2796
2863
|
// src/tools/audit.tools.ts
|
|
@@ -2885,7 +2952,10 @@ var COLLECTIONS_TOOL_SCHEMAS = {
|
|
|
2885
2952
|
name: z5.string().describe(
|
|
2886
2953
|
"Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
|
|
2887
2954
|
),
|
|
2888
|
-
workspace_id: z5.string().optional().describe("Workspace ID to create collection in")
|
|
2955
|
+
workspace_id: z5.string().optional().describe("Workspace ID to create collection in"),
|
|
2956
|
+
parent_collection_id: z5.string().optional().describe(
|
|
2957
|
+
"ID or slug of the parent collection to nest under; omit for a top-level collection"
|
|
2958
|
+
)
|
|
2889
2959
|
},
|
|
2890
2960
|
getCollection: {
|
|
2891
2961
|
collection_id: z5.string().describe("Collection ID or slug to retrieve")
|
|
@@ -2902,7 +2972,7 @@ var COLLECTIONS_TOOL_SCHEMAS = {
|
|
|
2902
2972
|
function registerCollectionsTools(server, service) {
|
|
2903
2973
|
server.tool(
|
|
2904
2974
|
"list_collections",
|
|
2905
|
-
"List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
|
|
2975
|
+
"List prompt collections in the workspace, optionally filtering by name or workspace. Returns ids, names, slugs, parent collection ids, and timestamps so you can choose a collection_id before create_prompt, get_collection, or list_prompts.",
|
|
2906
2976
|
COLLECTIONS_TOOL_SCHEMAS.listCollections,
|
|
2907
2977
|
async (params) => {
|
|
2908
2978
|
const collections = await service.collections.listCollections(params);
|
|
@@ -2913,6 +2983,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2913
2983
|
name: collection.name,
|
|
2914
2984
|
slug: collection.slug,
|
|
2915
2985
|
workspace_id: collection.workspace_id,
|
|
2986
|
+
parent_collection_id: collection.parent_collection_id,
|
|
2916
2987
|
created_at: collection.created_at,
|
|
2917
2988
|
last_updated_at: collection.last_updated_at
|
|
2918
2989
|
}))
|
|
@@ -2921,7 +2992,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2921
2992
|
);
|
|
2922
2993
|
server.tool(
|
|
2923
2994
|
"create_collection",
|
|
2924
|
-
"Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt;
|
|
2995
|
+
"Create a new prompt collection for organizing prompts by app. Use this when you need a new namespace before create_prompt; set parent_collection_id to nest it under an existing collection. Returns the collection id and slug, and does not move any prompts.",
|
|
2925
2996
|
COLLECTIONS_TOOL_SCHEMAS.createCollection,
|
|
2926
2997
|
async (params) => {
|
|
2927
2998
|
const result = await service.collections.createCollection(params);
|
|
@@ -2934,7 +3005,7 @@ function registerCollectionsTools(server, service) {
|
|
|
2934
3005
|
);
|
|
2935
3006
|
server.tool(
|
|
2936
3007
|
"get_collection",
|
|
2937
|
-
"Fetch one collection by id or slug and return its name, slug, workspace, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
|
|
3008
|
+
"Fetch one collection by id or slug and return its name, slug, workspace, parent collection id, child collections with prompt counts, and timestamps. Use list_collections when browsing and get_collection when you already know the target.",
|
|
2938
3009
|
COLLECTIONS_TOOL_SCHEMAS.getCollection,
|
|
2939
3010
|
async (params) => {
|
|
2940
3011
|
const collection = await service.collections.getCollection(
|
|
@@ -2945,6 +3016,8 @@ function registerCollectionsTools(server, service) {
|
|
|
2945
3016
|
name: collection.name,
|
|
2946
3017
|
slug: collection.slug,
|
|
2947
3018
|
workspace_id: collection.workspace_id,
|
|
3019
|
+
parent_collection_id: collection.parent_collection_id,
|
|
3020
|
+
child_collections: collection.child_collections,
|
|
2948
3021
|
created_at: collection.created_at,
|
|
2949
3022
|
last_updated_at: collection.last_updated_at
|
|
2950
3023
|
});
|
|
@@ -3202,66 +3275,73 @@ function registerConfigsTools(server, service) {
|
|
|
3202
3275
|
}
|
|
3203
3276
|
|
|
3204
3277
|
// src/tools/deployments.tools.ts
|
|
3278
|
+
import { z as z8 } from "zod";
|
|
3279
|
+
|
|
3280
|
+
// src/tools/tags.schemas.ts
|
|
3205
3281
|
import { z as z7 } from "zod";
|
|
3206
|
-
var
|
|
3207
|
-
var deploymentTypeSchema = z7.enum(["production", "non_production"]);
|
|
3208
|
-
var deploymentStatusSchema = z7.enum(["active", "archived"]);
|
|
3209
|
-
var deploymentTagsSchema = z7.record(
|
|
3282
|
+
var resourceTagsSchema = z7.record(
|
|
3210
3283
|
z7.string().regex(
|
|
3211
3284
|
/^[a-zA-Z0-9_-]+$/,
|
|
3212
3285
|
"Tag keys may contain only letters, numbers, underscores, and hyphens"
|
|
3213
3286
|
),
|
|
3214
3287
|
z7.string()
|
|
3215
3288
|
);
|
|
3289
|
+
var integrationTagsSchema = z7.record(z7.string(), z7.string());
|
|
3290
|
+
|
|
3291
|
+
// src/tools/deployments.tools.ts
|
|
3292
|
+
var binaryFlagSchema = z8.union([z8.literal(0), z8.literal(1)]);
|
|
3293
|
+
var deploymentTypeSchema = z8.enum(["production", "non_production"]);
|
|
3294
|
+
var deploymentStatusSchema = z8.enum(["active", "archived"]);
|
|
3295
|
+
var deploymentTagsSchema = resourceTagsSchema;
|
|
3216
3296
|
var authSettingsSchema = {
|
|
3217
|
-
gateway_base_url:
|
|
3218
|
-
mcp_gateway_base_url:
|
|
3297
|
+
gateway_base_url: z8.url().optional().describe("Self-hosted Gateway base URL"),
|
|
3298
|
+
mcp_gateway_base_url: z8.url().optional().describe("MCP Gateway base URL"),
|
|
3219
3299
|
is_dataservice_hosted: binaryFlagSchema.optional().describe("Whether the deployment hosts its own data service"),
|
|
3220
3300
|
is_playground_proxy_allowed: binaryFlagSchema.optional().describe("Whether Playground proxy traffic is allowed"),
|
|
3221
|
-
workspaces_allowed:
|
|
3222
|
-
jwt_subs_allowed:
|
|
3223
|
-
jwt_sub_workspace_mapping:
|
|
3301
|
+
workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs this deployment may serve; empty allows all"),
|
|
3302
|
+
jwt_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values allowed to use the deployment"),
|
|
3303
|
+
jwt_sub_workspace_mapping: z8.record(z8.string(), z8.string()).optional().describe("JWT subject to workspace-slug mapping")
|
|
3224
3304
|
};
|
|
3225
3305
|
var DEPLOYMENTS_TOOL_SCHEMAS = {
|
|
3226
3306
|
listDeployments: {
|
|
3227
|
-
organisation_id:
|
|
3307
|
+
organisation_id: z8.string().optional().describe("Filter by organisation UUID"),
|
|
3228
3308
|
status: deploymentStatusSchema.optional().describe("Filter by deployment status"),
|
|
3229
3309
|
type: deploymentTypeSchema.optional().describe("Filter by deployment type"),
|
|
3230
|
-
workspace_slug:
|
|
3231
|
-
search:
|
|
3310
|
+
workspace_slug: z8.array(z8.string()).optional().describe("Filter by one or more workspace slugs"),
|
|
3311
|
+
search: z8.string().optional().describe("Search deployment names"),
|
|
3232
3312
|
tags: deploymentTagsSchema.optional().describe("Match deployments with all supplied tags")
|
|
3233
3313
|
},
|
|
3234
3314
|
registerDeployment: {
|
|
3235
|
-
name:
|
|
3236
|
-
organisation_id:
|
|
3237
|
-
slug:
|
|
3315
|
+
name: z8.string().min(1).describe("Deployment display name"),
|
|
3316
|
+
organisation_id: z8.string().optional().describe("Owning organisation UUID"),
|
|
3317
|
+
slug: z8.string().min(1).max(50).optional().describe("Optional deployment slug"),
|
|
3238
3318
|
type: deploymentTypeSchema.optional().describe("Production or non-production deployment type"),
|
|
3239
|
-
deployment_config:
|
|
3240
|
-
is_default:
|
|
3319
|
+
deployment_config: z8.record(z8.string(), z8.unknown()).optional().describe("Gateway deployment configuration"),
|
|
3320
|
+
is_default: z8.boolean().optional().describe("Make this the default deployment"),
|
|
3241
3321
|
tags: deploymentTagsSchema.nullable().optional().describe("Deployment tags, or null to create without tags"),
|
|
3242
3322
|
...authSettingsSchema
|
|
3243
3323
|
},
|
|
3244
3324
|
getDeployment: {
|
|
3245
|
-
id:
|
|
3246
|
-
organisation_id:
|
|
3325
|
+
id: z8.string().min(1).describe("Deployment UUID or self"),
|
|
3326
|
+
organisation_id: z8.string().optional().describe("Organisation UUID scope")
|
|
3247
3327
|
},
|
|
3248
3328
|
updateDeployment: {
|
|
3249
|
-
id:
|
|
3250
|
-
name:
|
|
3329
|
+
id: z8.string().min(1).describe("Deployment UUID"),
|
|
3330
|
+
name: z8.string().optional().describe("Replacement display name"),
|
|
3251
3331
|
type: deploymentTypeSchema.optional().describe("Replacement deployment type"),
|
|
3252
3332
|
status: deploymentStatusSchema.optional().describe("Replacement deployment status"),
|
|
3253
|
-
deployment_config:
|
|
3254
|
-
is_default:
|
|
3255
|
-
rotate_auth:
|
|
3256
|
-
override_existing:
|
|
3333
|
+
deployment_config: z8.record(z8.string(), z8.unknown()).nullable().optional().describe("Replacement Gateway configuration, or null to clear it"),
|
|
3334
|
+
is_default: z8.boolean().optional().describe("Whether this is the default deployment"),
|
|
3335
|
+
rotate_auth: z8.boolean().optional().describe("Rotate the one-time deployment authentication secret"),
|
|
3336
|
+
override_existing: z8.boolean().optional().describe("Allow replacement of existing deployment settings"),
|
|
3257
3337
|
tags: deploymentTagsSchema.nullable().optional().describe("Replacement deployment tags, or null to clear all tags"),
|
|
3258
3338
|
...authSettingsSchema,
|
|
3259
|
-
allow_all_workspaces:
|
|
3260
|
-
remove_workspaces_allowed:
|
|
3261
|
-
remove_subs_allowed:
|
|
3339
|
+
allow_all_workspaces: z8.boolean().optional().describe("Clear workspace restrictions and allow every workspace"),
|
|
3340
|
+
remove_workspaces_allowed: z8.array(z8.string()).optional().describe("Workspace slugs to remove from the allowlist"),
|
|
3341
|
+
remove_subs_allowed: z8.array(z8.string()).optional().describe("JWT subject values to remove from the allowlist")
|
|
3262
3342
|
},
|
|
3263
3343
|
archiveDeployment: {
|
|
3264
|
-
id:
|
|
3344
|
+
id: z8.string().min(1).describe("Deployment UUID to archive")
|
|
3265
3345
|
}
|
|
3266
3346
|
};
|
|
3267
3347
|
function compact(value) {
|
|
@@ -3371,100 +3451,100 @@ function registerDeploymentsTools(server, service) {
|
|
|
3371
3451
|
}
|
|
3372
3452
|
|
|
3373
3453
|
// src/tools/guardrails.tools.ts
|
|
3374
|
-
import { z as
|
|
3375
|
-
var guardrailCheckSchema =
|
|
3376
|
-
id:
|
|
3377
|
-
name:
|
|
3378
|
-
is_enabled:
|
|
3379
|
-
parameters:
|
|
3454
|
+
import { z as z9 } from "zod";
|
|
3455
|
+
var guardrailCheckSchema = z9.object({
|
|
3456
|
+
id: z9.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
|
|
3457
|
+
name: z9.string().optional().describe("Display name for the check"),
|
|
3458
|
+
is_enabled: z9.boolean().optional().describe("Whether the check is enabled"),
|
|
3459
|
+
parameters: z9.record(z9.string(), z9.unknown()).optional().describe(
|
|
3380
3460
|
"Check-specific configuration. Supported examples include requestParametersCheck and parameters.forwardHeaders; forwarded headers can expose sensitive values, so allow only the minimum required names."
|
|
3381
3461
|
)
|
|
3382
3462
|
});
|
|
3383
|
-
var guardrailFeedbackSchema =
|
|
3384
|
-
value:
|
|
3385
|
-
weight:
|
|
3386
|
-
metadata:
|
|
3463
|
+
var guardrailFeedbackSchema = z9.object({
|
|
3464
|
+
value: z9.coerce.number().optional().describe("Feedback value"),
|
|
3465
|
+
weight: z9.coerce.number().optional().describe("Feedback weight"),
|
|
3466
|
+
metadata: z9.record(z9.string(), z9.unknown()).optional().describe("Additional metadata")
|
|
3387
3467
|
});
|
|
3388
|
-
var guardrailActionSchema =
|
|
3389
|
-
deny:
|
|
3390
|
-
async:
|
|
3468
|
+
var guardrailActionSchema = z9.object({
|
|
3469
|
+
deny: z9.boolean().optional().describe("Whether to deny the request on check failure"),
|
|
3470
|
+
async: z9.boolean().optional().describe("Whether to run checks asynchronously"),
|
|
3391
3471
|
on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
|
|
3392
3472
|
on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
|
|
3393
|
-
on_fail_action:
|
|
3394
|
-
message:
|
|
3473
|
+
on_fail_action: z9.string().optional().describe("Simple action on failure (e.g., 'block')"),
|
|
3474
|
+
message: z9.string().optional().describe("Message to return when guardrail triggers")
|
|
3395
3475
|
});
|
|
3396
|
-
var workspaceGuardrailExclusionSchema =
|
|
3397
|
-
workspace_id:
|
|
3398
|
-
excluded:
|
|
3476
|
+
var workspaceGuardrailExclusionSchema = z9.object({
|
|
3477
|
+
workspace_id: z9.string().describe("Workspace ID whose exclusion state changes"),
|
|
3478
|
+
excluded: z9.boolean().describe("True to exclude this workspace; false to restore enforcement")
|
|
3399
3479
|
});
|
|
3400
|
-
var guardrailTargetSchema =
|
|
3480
|
+
var guardrailTargetSchema = z9.enum(["llm", "mcp_tools"]);
|
|
3401
3481
|
var guardrailMcpServerMappingConfigShape = {
|
|
3402
|
-
run_on:
|
|
3403
|
-
mcp_integration_capability_ids:
|
|
3482
|
+
run_on: z9.array(z9.enum(["input", "output"])).min(1).default(["input", "output"]).describe("Guardrail phases to run for this MCP server"),
|
|
3483
|
+
mcp_integration_capability_ids: z9.array(z9.string().uuid()).optional().describe("MCP integration capability UUIDs covered by this mapping")
|
|
3404
3484
|
};
|
|
3405
|
-
var guardrailMcpServerMappingConfigSchema =
|
|
3485
|
+
var guardrailMcpServerMappingConfigSchema = z9.object(
|
|
3406
3486
|
guardrailMcpServerMappingConfigShape
|
|
3407
3487
|
);
|
|
3408
3488
|
var GUARDRAILS_TOOL_SCHEMAS = {
|
|
3409
3489
|
getOrganisationDefaults: {},
|
|
3410
3490
|
listGuardrails: {
|
|
3411
|
-
workspace_id:
|
|
3412
|
-
organisation_id:
|
|
3491
|
+
workspace_id: z9.string().optional().describe("Filter guardrails by workspace ID"),
|
|
3492
|
+
organisation_id: z9.string().optional().describe("Filter guardrails by organization ID"),
|
|
3413
3493
|
page_size: PageSizeSchema.describe(
|
|
3414
3494
|
"Number of items per page (1-100, default: 100)"
|
|
3415
3495
|
),
|
|
3416
3496
|
current_page: CurrentPageSchema
|
|
3417
3497
|
},
|
|
3418
3498
|
getGuardrail: {
|
|
3419
|
-
guardrail_id:
|
|
3499
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
|
|
3420
3500
|
},
|
|
3421
3501
|
createGuardrail: {
|
|
3422
|
-
name:
|
|
3502
|
+
name: z9.string().describe("Name of the guardrail"),
|
|
3423
3503
|
target: guardrailTargetSchema.optional().describe("LLM traffic by default, or MCP tool calls"),
|
|
3424
|
-
checks:
|
|
3504
|
+
checks: z9.array(guardrailCheckSchema).min(1).optional().describe(
|
|
3425
3505
|
"Checks to apply; at least one entry. Required when target is llm."
|
|
3426
3506
|
),
|
|
3427
3507
|
actions: guardrailActionSchema.optional().describe("Actions to take when guardrail checks pass or fail"),
|
|
3428
|
-
workspace_id:
|
|
3429
|
-
organisation_id:
|
|
3508
|
+
workspace_id: z9.string().optional().describe("Workspace ID to create the guardrail in"),
|
|
3509
|
+
organisation_id: z9.string().optional().describe("Organisation ID (required if workspace_id not provided)")
|
|
3430
3510
|
},
|
|
3431
3511
|
updateGuardrail: {
|
|
3432
|
-
guardrail_id:
|
|
3433
|
-
name:
|
|
3434
|
-
checks:
|
|
3512
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug to update"),
|
|
3513
|
+
name: z9.string().optional().describe("New name for the guardrail"),
|
|
3514
|
+
checks: z9.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
|
|
3435
3515
|
actions: guardrailActionSchema.optional().describe("Updated actions configuration")
|
|
3436
3516
|
},
|
|
3437
3517
|
deleteGuardrail: {
|
|
3438
|
-
guardrail_id:
|
|
3518
|
+
guardrail_id: z9.string().describe("The guardrail UUID or slug to delete")
|
|
3439
3519
|
},
|
|
3440
3520
|
updateOrganisationDefaults: {
|
|
3441
|
-
input_guardrails:
|
|
3442
|
-
output_guardrails:
|
|
3521
|
+
input_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model input"),
|
|
3522
|
+
output_guardrails: z9.array(z9.string()).optional().describe("Ordered guardrail IDs or slugs to enforce on model output")
|
|
3443
3523
|
},
|
|
3444
3524
|
listWorkspaceExclusions: {
|
|
3445
|
-
organisation_id:
|
|
3525
|
+
organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be listed")
|
|
3446
3526
|
},
|
|
3447
3527
|
updateWorkspaceExclusions: {
|
|
3448
|
-
organisation_id:
|
|
3449
|
-
workspaces:
|
|
3450
|
-
override_existing:
|
|
3528
|
+
organisation_id: z9.string().describe("Organisation ID whose workspace exclusions should be updated"),
|
|
3529
|
+
workspaces: z9.array(workspaceGuardrailExclusionSchema).min(1).describe("Workspace exclusion states to apply"),
|
|
3530
|
+
override_existing: z9.boolean().optional().describe("Replace existing exclusion states instead of merging changes")
|
|
3451
3531
|
},
|
|
3452
3532
|
listGuardrailMcpServerMappings: {
|
|
3453
|
-
guardrail_id:
|
|
3533
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug")
|
|
3454
3534
|
},
|
|
3455
3535
|
replaceGuardrailMcpServerMappings: {
|
|
3456
|
-
guardrail_id:
|
|
3457
|
-
mcp_servers:
|
|
3536
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
|
|
3537
|
+
mcp_servers: z9.record(z9.string().uuid(), guardrailMcpServerMappingConfigSchema).describe(
|
|
3458
3538
|
"Complete MCP-server mapping set keyed by server UUID; an empty object clears every mapping"
|
|
3459
3539
|
)
|
|
3460
3540
|
},
|
|
3461
3541
|
upsertGuardrailMcpServerMapping: {
|
|
3462
|
-
guardrail_id:
|
|
3463
|
-
mcp_server_id:
|
|
3542
|
+
guardrail_id: z9.string().min(1).describe("Guardrail UUID or slug"),
|
|
3543
|
+
mcp_server_id: z9.string().uuid().describe("MCP server UUID"),
|
|
3464
3544
|
...guardrailMcpServerMappingConfigShape
|
|
3465
3545
|
}
|
|
3466
3546
|
};
|
|
3467
|
-
var createGuardrailSchema =
|
|
3547
|
+
var createGuardrailSchema = z9.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).superRefine((value, context) => {
|
|
3468
3548
|
if ((value.target ?? "llm") === "llm" && (!value.checks || !value.actions)) {
|
|
3469
3549
|
context.addIssue({
|
|
3470
3550
|
code: "custom",
|
|
@@ -3473,10 +3553,10 @@ var createGuardrailSchema = z8.object(GUARDRAILS_TOOL_SCHEMAS.createGuardrail).s
|
|
|
3473
3553
|
});
|
|
3474
3554
|
}
|
|
3475
3555
|
});
|
|
3476
|
-
var replaceGuardrailMcpServerMappingsSchema =
|
|
3556
|
+
var replaceGuardrailMcpServerMappingsSchema = z9.object(
|
|
3477
3557
|
GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings
|
|
3478
3558
|
);
|
|
3479
|
-
var upsertGuardrailMcpServerMappingSchema =
|
|
3559
|
+
var upsertGuardrailMcpServerMappingSchema = z9.object(
|
|
3480
3560
|
GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping
|
|
3481
3561
|
);
|
|
3482
3562
|
var GET_ORGANISATION_DEFAULTS_ANNOTATIONS = {
|
|
@@ -3641,7 +3721,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3641
3721
|
);
|
|
3642
3722
|
server.tool(
|
|
3643
3723
|
"list_guardrail_mcp_servers",
|
|
3644
|
-
"List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
|
|
3724
|
+
"List every MCP-server mapping for one guardrail, including the input/output phases and mapped capability IDs. Requires a guardrail with target mcp_tools. Use this before replace_guardrail_mcp_servers because replacement removes every mapping omitted from its request.",
|
|
3645
3725
|
GUARDRAILS_TOOL_SCHEMAS.listGuardrailMcpServerMappings,
|
|
3646
3726
|
{
|
|
3647
3727
|
title: "List Guardrail MCP Servers",
|
|
@@ -3656,7 +3736,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3656
3736
|
);
|
|
3657
3737
|
server.tool(
|
|
3658
3738
|
"replace_guardrail_mcp_servers",
|
|
3659
|
-
"Replace the complete MCP-server mapping set for one guardrail. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
|
|
3739
|
+
"Replace the complete MCP-server mapping set for one guardrail. Requires a guardrail with target mcp_tools. Any existing server omitted from mcp_servers is removed, and an empty object clears all mappings. Read list_guardrail_mcp_servers first. Repeating the same complete map is safe.",
|
|
3660
3740
|
GUARDRAILS_TOOL_SCHEMAS.replaceGuardrailMcpServerMappings,
|
|
3661
3741
|
{
|
|
3662
3742
|
title: "Replace Guardrail MCP Servers",
|
|
@@ -3677,7 +3757,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3677
3757
|
);
|
|
3678
3758
|
server.tool(
|
|
3679
3759
|
"upsert_guardrail_mcp_server",
|
|
3680
|
-
"Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
|
|
3760
|
+
"Create or replace one guardrail mapping for one MCP server without changing mappings for other servers. Requires a guardrail with target mcp_tools. run_on defaults to both input and output. Use list_guardrail_mcp_servers to inspect the current mapping set first. Repeating the same mapping is safe.",
|
|
3681
3761
|
GUARDRAILS_TOOL_SCHEMAS.upsertGuardrailMcpServerMapping,
|
|
3682
3762
|
{
|
|
3683
3763
|
title: "Upsert Guardrail MCP Server",
|
|
@@ -3741,7 +3821,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3741
3821
|
}
|
|
3742
3822
|
|
|
3743
3823
|
// src/tools/integrations.tools.ts
|
|
3744
|
-
import { z as
|
|
3824
|
+
import { z as z11 } from "zod";
|
|
3745
3825
|
|
|
3746
3826
|
// src/lib/limits.ts
|
|
3747
3827
|
var PERIODIC_RESET_DEFAULT = "monthly";
|
|
@@ -3784,25 +3864,25 @@ function buildRateLimits(params) {
|
|
|
3784
3864
|
}
|
|
3785
3865
|
|
|
3786
3866
|
// src/tools/secret-mapping.schemas.ts
|
|
3787
|
-
import { z as
|
|
3867
|
+
import { z as z10 } from "zod";
|
|
3788
3868
|
function createSecretMappingSchema({
|
|
3789
3869
|
allowKeyTarget,
|
|
3790
3870
|
targetFieldDescription,
|
|
3791
3871
|
secretReferenceDescription,
|
|
3792
3872
|
valueFormatDescription
|
|
3793
3873
|
}) {
|
|
3794
|
-
return
|
|
3795
|
-
target_field:
|
|
3874
|
+
return z10.object({
|
|
3875
|
+
target_field: z10.string().refine(
|
|
3796
3876
|
(value) => allowKeyTarget && value === "key" || value.startsWith("configurations."),
|
|
3797
3877
|
allowKeyTarget ? "target_field must be 'key' or start with 'configurations.'" : "target_field must start with 'configurations.'"
|
|
3798
3878
|
).describe(targetFieldDescription),
|
|
3799
|
-
secret_reference_id:
|
|
3800
|
-
secret_key:
|
|
3801
|
-
value_format:
|
|
3879
|
+
secret_reference_id: z10.string().describe(secretReferenceDescription),
|
|
3880
|
+
secret_key: z10.string().nullable().optional().describe("Optional key to select from a multi-value secret"),
|
|
3881
|
+
value_format: z10.enum(["string", "json"]).nullable().optional().describe(valueFormatDescription)
|
|
3802
3882
|
});
|
|
3803
3883
|
}
|
|
3804
3884
|
function uniqueSecretMappingsSchema(itemSchema) {
|
|
3805
|
-
return
|
|
3885
|
+
return z10.array(itemSchema).superRefine((mappings, context) => {
|
|
3806
3886
|
const firstIndexByTarget = /* @__PURE__ */ new Map();
|
|
3807
3887
|
for (const [index, mapping] of mappings.entries()) {
|
|
3808
3888
|
const firstIndex = firstIndexByTarget.get(mapping.target_field);
|
|
@@ -3829,8 +3909,8 @@ var integrationSecretMappingSchema = createSecretMappingSchema({
|
|
|
3829
3909
|
var integrationSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
3830
3910
|
integrationSecretMappingSchema
|
|
3831
3911
|
);
|
|
3832
|
-
var nullableMultiplier = (description) =>
|
|
3833
|
-
var pricingMultiplierSchema =
|
|
3912
|
+
var nullableMultiplier = (description) => z11.coerce.number().nonnegative().nullable().optional().describe(description);
|
|
3913
|
+
var pricingMultiplierSchema = z11.object({
|
|
3834
3914
|
default: nullableMultiplier(
|
|
3835
3915
|
"Fallback multiplier for pricing units; 1 is unchanged, 0.8 is a 20% discount"
|
|
3836
3916
|
),
|
|
@@ -3874,175 +3954,178 @@ var pricingMultiplierSchema = z10.object({
|
|
|
3874
3954
|
cache_write_image_input_token: nullableMultiplier(
|
|
3875
3955
|
"Cache-write image input token price multiplier"
|
|
3876
3956
|
),
|
|
3877
|
-
image:
|
|
3957
|
+
image: z11.object({
|
|
3878
3958
|
default: nullableMultiplier("Default image-generation price multiplier")
|
|
3879
3959
|
}).nullable().optional().describe("Image-generation pricing multipliers"),
|
|
3880
|
-
additional_units:
|
|
3960
|
+
additional_units: z11.record(z11.string(), z11.coerce.number().nonnegative().nullable()).nullable().optional().describe(
|
|
3881
3961
|
"Multipliers keyed by Portkey pricing unit, such as web_search or file_search"
|
|
3882
3962
|
)
|
|
3883
3963
|
});
|
|
3884
|
-
var pricingAdjustmentsSchema =
|
|
3964
|
+
var pricingAdjustmentsSchema = z11.object({
|
|
3885
3965
|
multiplier: pricingMultiplierSchema.optional().describe("Per-unit multipliers applied over Portkey catalog pricing")
|
|
3886
3966
|
}).nullable();
|
|
3887
|
-
var modelConfigurationsSchema =
|
|
3888
|
-
custom_host:
|
|
3889
|
-
custom_headers:
|
|
3967
|
+
var modelConfigurationsSchema = z11.object({
|
|
3968
|
+
custom_host: z11.string().url().optional().describe("Custom upstream URL used only for this model"),
|
|
3969
|
+
custom_headers: z11.record(z11.string(), z11.string()).optional().describe("Headers sent only for this model; values may contain secrets")
|
|
3890
3970
|
});
|
|
3891
|
-
var tokenPricingSchema =
|
|
3892
|
-
price:
|
|
3971
|
+
var tokenPricingSchema = z11.object({
|
|
3972
|
+
price: z11.coerce.number().nonnegative().describe("Static price per token in the integration pricing unit")
|
|
3893
3973
|
});
|
|
3894
|
-
var integrationModelPricingSchema =
|
|
3895
|
-
type:
|
|
3896
|
-
pay_as_you_go:
|
|
3974
|
+
var integrationModelPricingSchema = z11.object({
|
|
3975
|
+
type: z11.literal("static").describe("Static per-token pricing configuration"),
|
|
3976
|
+
pay_as_you_go: z11.object({
|
|
3897
3977
|
request_token: tokenPricingSchema.optional().describe("Input token pricing"),
|
|
3898
3978
|
response_token: tokenPricingSchema.optional().describe("Output token pricing")
|
|
3899
3979
|
}).optional().describe("Pay-as-you-go rates for this integration model")
|
|
3900
3980
|
});
|
|
3901
3981
|
var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
3902
3982
|
getModelPricing: {
|
|
3903
|
-
provider:
|
|
3983
|
+
provider: z11.string().describe(
|
|
3904
3984
|
"Lowercase Portkey provider identifier, such as openai, anthropic, bedrock, or x-ai"
|
|
3905
3985
|
),
|
|
3906
|
-
model:
|
|
3986
|
+
model: z11.string().describe("Exact provider model identifier, such as gpt-4o")
|
|
3907
3987
|
},
|
|
3908
3988
|
listIntegrations: {
|
|
3909
3989
|
current_page: CurrentPageSchema,
|
|
3910
3990
|
page_size: PageSizeSchema.describe(
|
|
3911
3991
|
"Number of results per page (default 100, max 100)"
|
|
3912
3992
|
),
|
|
3913
|
-
workspace_id:
|
|
3914
|
-
type:
|
|
3993
|
+
workspace_id: z11.string().optional().describe("Filter integrations accessible by a specific workspace"),
|
|
3994
|
+
type: z11.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
3915
3995
|
"Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
|
|
3916
|
-
)
|
|
3996
|
+
),
|
|
3997
|
+
tags: integrationTagsSchema.optional().describe("Match integrations that carry all supplied tags")
|
|
3917
3998
|
},
|
|
3918
3999
|
createIntegration: {
|
|
3919
|
-
name:
|
|
3920
|
-
ai_provider_id:
|
|
4000
|
+
name: z11.string().describe("Human-readable name for the integration"),
|
|
4001
|
+
ai_provider_id: z11.string().describe(
|
|
3921
4002
|
"ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
|
|
3922
4003
|
),
|
|
3923
|
-
slug:
|
|
4004
|
+
slug: z11.string().optional().describe(
|
|
3924
4005
|
"URL-friendly identifier (auto-generated from name if not provided)"
|
|
3925
4006
|
),
|
|
3926
|
-
key:
|
|
3927
|
-
description:
|
|
3928
|
-
workspace_id:
|
|
3929
|
-
api_version:
|
|
3930
|
-
resource_name:
|
|
3931
|
-
deployment_name:
|
|
3932
|
-
aws_region:
|
|
3933
|
-
aws_access_key_id:
|
|
3934
|
-
aws_secret_access_key:
|
|
3935
|
-
vertex_project_id:
|
|
3936
|
-
vertex_region:
|
|
3937
|
-
custom_host:
|
|
3938
|
-
create_default_provider:
|
|
4007
|
+
key: z11.string().optional().describe("API key for the provider (if required)"),
|
|
4008
|
+
description: z11.string().optional().describe("Optional description of the integration"),
|
|
4009
|
+
workspace_id: z11.string().optional().describe("Workspace ID for workspace-scoped integrations"),
|
|
4010
|
+
api_version: z11.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4011
|
+
resource_name: z11.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4012
|
+
deployment_name: z11.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4013
|
+
aws_region: z11.string().optional().describe("AWS region (for AWS Bedrock)"),
|
|
4014
|
+
aws_access_key_id: z11.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
|
|
4015
|
+
aws_secret_access_key: z11.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
|
|
4016
|
+
vertex_project_id: z11.string().optional().describe("GCP project ID (for Vertex AI)"),
|
|
4017
|
+
vertex_region: z11.string().optional().describe("GCP region (for Vertex AI)"),
|
|
4018
|
+
custom_host: z11.string().optional().describe("Custom base URL for the provider"),
|
|
4019
|
+
create_default_provider: z11.boolean().optional().describe(
|
|
3939
4020
|
"Create a provider automatically for a workspace-scoped integration; defaults to true"
|
|
3940
4021
|
),
|
|
3941
|
-
default_provider_slug:
|
|
4022
|
+
default_provider_slug: z11.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Custom slug for the automatically created workspace provider"),
|
|
3942
4023
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3943
4024
|
"Unique runtime Secret Reference mappings; mapping key allows the key field to be omitted"
|
|
3944
4025
|
),
|
|
3945
4026
|
pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
|
|
3946
4027
|
"Negotiated discount or markup multipliers for cost accounting"
|
|
3947
|
-
)
|
|
4028
|
+
),
|
|
4029
|
+
tags: integrationTagsSchema.nullable().optional().describe("Integration tags, or null to create without tags")
|
|
3948
4030
|
},
|
|
3949
4031
|
getIntegration: {
|
|
3950
|
-
slug:
|
|
4032
|
+
slug: z11.string().describe("The unique slug identifier of the integration to retrieve")
|
|
3951
4033
|
},
|
|
3952
4034
|
updateIntegration: {
|
|
3953
|
-
slug:
|
|
3954
|
-
name:
|
|
3955
|
-
key:
|
|
3956
|
-
description:
|
|
3957
|
-
api_version:
|
|
3958
|
-
resource_name:
|
|
3959
|
-
deployment_name:
|
|
3960
|
-
aws_region:
|
|
3961
|
-
aws_access_key_id:
|
|
3962
|
-
aws_secret_access_key:
|
|
3963
|
-
vertex_project_id:
|
|
3964
|
-
vertex_region:
|
|
3965
|
-
custom_host:
|
|
4035
|
+
slug: z11.string().describe("The slug of the integration to update"),
|
|
4036
|
+
name: z11.string().optional().describe("New human-readable name for the integration"),
|
|
4037
|
+
key: z11.string().optional().describe("New API key for the provider"),
|
|
4038
|
+
description: z11.string().optional().describe("New description for the integration"),
|
|
4039
|
+
api_version: z11.string().optional().describe("New API version (for Azure OpenAI)"),
|
|
4040
|
+
resource_name: z11.string().optional().describe("New resource name (for Azure OpenAI)"),
|
|
4041
|
+
deployment_name: z11.string().optional().describe("New deployment name (for Azure OpenAI)"),
|
|
4042
|
+
aws_region: z11.string().optional().describe("New AWS region (for AWS Bedrock)"),
|
|
4043
|
+
aws_access_key_id: z11.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
|
|
4044
|
+
aws_secret_access_key: z11.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
|
|
4045
|
+
vertex_project_id: z11.string().optional().describe("New GCP project ID (for Vertex AI)"),
|
|
4046
|
+
vertex_region: z11.string().optional().describe("New GCP region (for Vertex AI)"),
|
|
4047
|
+
custom_host: z11.string().optional().describe("New custom base URL for the provider"),
|
|
3966
4048
|
secret_mappings: integrationSecretMappingsSchema.optional().describe(
|
|
3967
4049
|
"Replacement runtime Secret Reference mappings; each target_field must be unique"
|
|
3968
4050
|
),
|
|
3969
4051
|
pricing_adjustments: pricingAdjustmentsSchema.optional().describe(
|
|
3970
4052
|
"Replacement cost multiplier configuration, or null to clear adjustments"
|
|
3971
|
-
)
|
|
4053
|
+
),
|
|
4054
|
+
tags: integrationTagsSchema.nullable().optional().describe("Replacement integration tags, or null to clear all tags")
|
|
3972
4055
|
},
|
|
3973
4056
|
deleteIntegration: {
|
|
3974
|
-
slug:
|
|
4057
|
+
slug: z11.string().describe("The slug of the integration to delete")
|
|
3975
4058
|
},
|
|
3976
4059
|
listIntegrationModels: {
|
|
3977
|
-
slug:
|
|
4060
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
3978
4061
|
current_page: CurrentPageSchema,
|
|
3979
4062
|
page_size: PageSizeSchema.describe("Number of results per page")
|
|
3980
4063
|
},
|
|
3981
4064
|
updateIntegrationModels: {
|
|
3982
|
-
slug:
|
|
3983
|
-
allow_all_models:
|
|
4065
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4066
|
+
allow_all_models: z11.boolean().optional().describe(
|
|
3984
4067
|
"Whether newly available provider models are enabled by default"
|
|
3985
4068
|
),
|
|
3986
|
-
models:
|
|
3987
|
-
|
|
3988
|
-
slug:
|
|
3989
|
-
model_name:
|
|
4069
|
+
models: z11.array(
|
|
4070
|
+
z11.object({
|
|
4071
|
+
slug: z11.string().describe("The model slug identifier"),
|
|
4072
|
+
model_name: z11.string().optional().describe(
|
|
3990
4073
|
"Display name for the model (required for custom models)"
|
|
3991
4074
|
),
|
|
3992
|
-
enabled:
|
|
3993
|
-
is_custom:
|
|
3994
|
-
is_finetune:
|
|
3995
|
-
base_model_slug:
|
|
4075
|
+
enabled: z11.boolean().describe("Whether the model is enabled"),
|
|
4076
|
+
is_custom: z11.boolean().optional().describe("Whether this is a custom model (default: false)"),
|
|
4077
|
+
is_finetune: z11.boolean().optional().describe("Whether this entry is a fine-tuned model"),
|
|
4078
|
+
base_model_slug: z11.string().optional().describe("Base model slug for a fine-tuned model"),
|
|
3996
4079
|
configurations: modelConfigurationsSchema.optional().describe("Per-model custom upstream host and headers"),
|
|
3997
4080
|
pricing_config: integrationModelPricingSchema.optional().describe("Static custom pricing for this integration model")
|
|
3998
4081
|
})
|
|
3999
4082
|
).describe("Array of model configurations to update")
|
|
4000
4083
|
},
|
|
4001
4084
|
deleteIntegrationModel: {
|
|
4002
|
-
slug:
|
|
4003
|
-
model_slug:
|
|
4085
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4086
|
+
model_slug: z11.string().describe("The slug of the model to delete")
|
|
4004
4087
|
},
|
|
4005
4088
|
listIntegrationWorkspaces: {
|
|
4006
|
-
slug:
|
|
4089
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4007
4090
|
current_page: CurrentPageSchema,
|
|
4008
4091
|
page_size: PageSizeSchema.describe("Number of results per page")
|
|
4009
4092
|
},
|
|
4010
4093
|
updateIntegrationWorkspaces: {
|
|
4011
|
-
slug:
|
|
4012
|
-
workspaces:
|
|
4013
|
-
|
|
4014
|
-
id:
|
|
4015
|
-
enabled:
|
|
4016
|
-
credit_limit:
|
|
4017
|
-
alert_threshold:
|
|
4018
|
-
rate_limit_rpm:
|
|
4019
|
-
reset_usage:
|
|
4020
|
-
create_default_provider:
|
|
4094
|
+
slug: z11.string().describe("The slug of the integration"),
|
|
4095
|
+
workspaces: z11.array(
|
|
4096
|
+
z11.object({
|
|
4097
|
+
id: z11.string().describe("The workspace ID"),
|
|
4098
|
+
enabled: z11.boolean().describe("Whether the workspace has access to this integration"),
|
|
4099
|
+
credit_limit: z11.coerce.number().positive().optional().describe("Credit limit for this workspace"),
|
|
4100
|
+
alert_threshold: z11.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4101
|
+
rate_limit_rpm: z11.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4102
|
+
reset_usage: z11.boolean().optional().describe("Reset exhausted usage status to active"),
|
|
4103
|
+
create_default_provider: z11.boolean().optional().describe(
|
|
4021
4104
|
"Override whether a provider is auto-created for this workspace"
|
|
4022
4105
|
),
|
|
4023
|
-
default_provider_slug:
|
|
4106
|
+
default_provider_slug: z11.string().optional().describe(
|
|
4024
4107
|
"Override the auto-created provider slug for this workspace"
|
|
4025
4108
|
)
|
|
4026
4109
|
})
|
|
4027
4110
|
).describe("Array of workspace configurations to update"),
|
|
4028
|
-
global_workspace_access_enabled:
|
|
4111
|
+
global_workspace_access_enabled: z11.boolean().optional().describe(
|
|
4029
4112
|
"Enable or disable access for all current and future workspaces"
|
|
4030
4113
|
),
|
|
4031
|
-
global_credit_limit:
|
|
4114
|
+
global_credit_limit: z11.coerce.number().positive().optional().describe(
|
|
4032
4115
|
"Global cost credit limit applied with global workspace access"
|
|
4033
4116
|
),
|
|
4034
|
-
global_alert_threshold:
|
|
4035
|
-
global_rate_limit_rpm:
|
|
4036
|
-
override_existing_workspace_access:
|
|
4037
|
-
create_default_provider:
|
|
4038
|
-
default_provider_slug:
|
|
4117
|
+
global_alert_threshold: z11.coerce.number().nonnegative().max(100).optional().describe("Global cost alert threshold applied to workspace access"),
|
|
4118
|
+
global_rate_limit_rpm: z11.coerce.number().positive().optional().describe("Global requests-per-minute limit for workspace access"),
|
|
4119
|
+
override_existing_workspace_access: z11.boolean().optional().describe("Apply global settings over existing per-workspace access"),
|
|
4120
|
+
create_default_provider: z11.boolean().optional().describe("Auto-create providers when granting workspace access"),
|
|
4121
|
+
default_provider_slug: z11.string().optional().describe("Default slug for providers auto-created in workspaces")
|
|
4039
4122
|
}
|
|
4040
4123
|
};
|
|
4041
|
-
var updateIntegrationWorkspacesSchema =
|
|
4124
|
+
var updateIntegrationWorkspacesSchema = z11.object(INTEGRATIONS_TOOL_SCHEMAS.updateIntegrationWorkspaces).superRefine((value, ctx) => {
|
|
4042
4125
|
const hasGlobalLimits = value.global_credit_limit !== void 0 || value.global_alert_threshold !== void 0 || value.global_rate_limit_rpm !== void 0;
|
|
4043
4126
|
if (hasGlobalLimits && value.global_workspace_access_enabled === void 0) {
|
|
4044
4127
|
ctx.addIssue({
|
|
4045
|
-
code:
|
|
4128
|
+
code: z11.ZodIssueCode.custom,
|
|
4046
4129
|
path: ["global_workspace_access_enabled"],
|
|
4047
4130
|
message: "global_workspace_access_enabled is required when setting global limits."
|
|
4048
4131
|
});
|
|
@@ -4091,14 +4174,15 @@ function registerIntegrationsTools(server, service) {
|
|
|
4091
4174
|
);
|
|
4092
4175
|
server.tool(
|
|
4093
4176
|
"list_integrations",
|
|
4094
|
-
"List org-level AI provider connections with optional workspace or
|
|
4177
|
+
"List org-level AI provider connections with optional workspace, type, or tag filters. Use this to find integration slugs before model or workspace updates. Returns total plus id, name, slug, provider, status, description, workspace counts, and config summary.",
|
|
4095
4178
|
INTEGRATIONS_TOOL_SCHEMAS.listIntegrations,
|
|
4096
4179
|
async (params) => {
|
|
4097
4180
|
const integrations = await service.integrations.listIntegrations({
|
|
4098
4181
|
current_page: params.current_page,
|
|
4099
4182
|
page_size: params.page_size,
|
|
4100
4183
|
workspace_id: params.workspace_id,
|
|
4101
|
-
type: params.type
|
|
4184
|
+
type: params.type,
|
|
4185
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4102
4186
|
});
|
|
4103
4187
|
return jsonResult({
|
|
4104
4188
|
total: integrations.total,
|
|
@@ -4118,7 +4202,7 @@ function registerIntegrationsTools(server, service) {
|
|
|
4118
4202
|
);
|
|
4119
4203
|
server.tool(
|
|
4120
4204
|
"create_integration",
|
|
4121
|
-
"Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
|
|
4205
|
+
"Create an AI-provider integration that becomes the source for workspace providers. ai_provider_id identifies the backend; provider-specific fields configure Azure, Bedrock, Vertex, or custom hosts. For workspace-scoped integrations, create_default_provider controls automatic provider creation. key is write-only, but secret_mappings can resolve it or configuration fields from Secret References at runtime. pricing_adjustments apply negotiated discounts or markups to cost accounting; tags attach key-value labels that list_integrations can filter on. Use update_integration_models and update_integration_workspaces after creation; returns the new integration id and slug.",
|
|
4122
4206
|
INTEGRATIONS_TOOL_SCHEMAS.createIntegration,
|
|
4123
4207
|
{
|
|
4124
4208
|
title: "Create AI Provider Integration",
|
|
@@ -4139,7 +4223,8 @@ function registerIntegrationsTools(server, service) {
|
|
|
4139
4223
|
...params.create_default_provider !== void 0 ? { create_default_provider: params.create_default_provider } : {},
|
|
4140
4224
|
...params.default_provider_slug !== void 0 ? { default_provider_slug: params.default_provider_slug } : {},
|
|
4141
4225
|
...params.secret_mappings !== void 0 ? { secret_mappings: params.secret_mappings } : {},
|
|
4142
|
-
...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {}
|
|
4226
|
+
...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {},
|
|
4227
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4143
4228
|
});
|
|
4144
4229
|
return jsonResult({
|
|
4145
4230
|
message: `Successfully created integration "${params.name}"`,
|
|
@@ -4178,7 +4263,7 @@ function registerIntegrationsTools(server, service) {
|
|
|
4178
4263
|
);
|
|
4179
4264
|
server.tool(
|
|
4180
4265
|
"update_integration",
|
|
4181
|
-
"Update an integration's name, description, API key, provider config, Secret Reference mappings,
|
|
4266
|
+
"Update an integration's name, description, API key, provider config, Secret Reference mappings, pricing adjustments, or tags by slug. Only provided fields change; tags replaces the whole map and null clears it; key, secret mapping, and config changes take effect immediately and can disrupt dependent providers or live requests, while pricing multipliers change cost analytics and budget accounting. Review get_integration first. Model availability and workspace access remain separate in update_integration_models and update_integration_workspaces.",
|
|
4182
4267
|
INTEGRATIONS_TOOL_SCHEMAS.updateIntegration,
|
|
4183
4268
|
{
|
|
4184
4269
|
title: "Update AI Provider Integration",
|
|
@@ -4194,7 +4279,8 @@ function registerIntegrationsTools(server, service) {
|
|
|
4194
4279
|
description: params.description,
|
|
4195
4280
|
configurations: buildIntegrationConfigurations(params),
|
|
4196
4281
|
secret_mappings: params.secret_mappings,
|
|
4197
|
-
pricing_adjustments: params.pricing_adjustments
|
|
4282
|
+
pricing_adjustments: params.pricing_adjustments,
|
|
4283
|
+
...params.tags !== void 0 ? { tags: params.tags } : {}
|
|
4198
4284
|
});
|
|
4199
4285
|
return jsonResult({
|
|
4200
4286
|
message: `Successfully updated integration "${params.slug}"`,
|
|
@@ -4374,31 +4460,31 @@ function registerIntegrationsTools(server, service) {
|
|
|
4374
4460
|
}
|
|
4375
4461
|
|
|
4376
4462
|
// src/tools/keys.tools.ts
|
|
4377
|
-
import { z as
|
|
4378
|
-
var virtualKeySecretMappingSchema =
|
|
4379
|
-
target_field:
|
|
4463
|
+
import { z as z12 } from "zod";
|
|
4464
|
+
var virtualKeySecretMappingSchema = z12.object({
|
|
4465
|
+
target_field: z12.string().refine(
|
|
4380
4466
|
(value) => value === "key" || value.startsWith("model_config."),
|
|
4381
4467
|
"target_field must be 'key' or start with 'model_config.'"
|
|
4382
4468
|
).describe("Virtual Key field populated from the Secret Reference"),
|
|
4383
|
-
secret_reference_id:
|
|
4384
|
-
secret_key:
|
|
4385
|
-
value_format:
|
|
4469
|
+
secret_reference_id: z12.string().describe("Secret Reference ID that owns the external secret"),
|
|
4470
|
+
secret_key: z12.string().nullable().optional().describe("Optional key selected from a structured external secret"),
|
|
4471
|
+
value_format: z12.enum(["json", "string"]).nullable().optional().describe("Whether Portkey reads the mapped value as JSON or a string")
|
|
4386
4472
|
});
|
|
4387
|
-
var virtualKeyDeploymentSchema =
|
|
4388
|
-
api_version:
|
|
4389
|
-
deployment_name:
|
|
4390
|
-
alias:
|
|
4391
|
-
is_default:
|
|
4473
|
+
var virtualKeyDeploymentSchema = z12.object({
|
|
4474
|
+
api_version: z12.string().min(1).describe("Azure OpenAI API version"),
|
|
4475
|
+
deployment_name: z12.string().min(1).describe("Azure deployment name"),
|
|
4476
|
+
alias: z12.string().optional().describe("Optional model alias for the deployment"),
|
|
4477
|
+
is_default: z12.boolean().optional().describe("Whether this is the default Azure deployment")
|
|
4392
4478
|
});
|
|
4393
|
-
var apiKeyRateLimitSchema =
|
|
4394
|
-
type:
|
|
4395
|
-
unit:
|
|
4396
|
-
value:
|
|
4479
|
+
var apiKeyRateLimitSchema = z12.object({
|
|
4480
|
+
type: z12.enum(["requests", "tokens"]).describe("Whether the limit counts requests or tokens"),
|
|
4481
|
+
unit: z12.enum(["rpd", "rph", "rpm", "rps", "rpw"]).describe("Rate window unit for the request or token count"),
|
|
4482
|
+
value: z12.coerce.number().int().nonnegative().describe("Maximum count in the selected rate window")
|
|
4397
4483
|
});
|
|
4398
|
-
var rotationPolicySchema =
|
|
4399
|
-
rotation_period:
|
|
4400
|
-
next_rotation_at:
|
|
4401
|
-
key_transition_period_ms:
|
|
4484
|
+
var rotationPolicySchema = z12.object({
|
|
4485
|
+
rotation_period: z12.enum(["weekly", "monthly"]).nullable().optional().describe("Built-in weekly or monthly automatic rotation cadence"),
|
|
4486
|
+
next_rotation_at: z12.iso.datetime({ offset: true }).nullable().optional().describe("Explicit next rotation timestamp in ISO 8601 format"),
|
|
4487
|
+
key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe("Overlap in milliseconds before the previous key expires")
|
|
4402
4488
|
}).superRefine((value, context) => {
|
|
4403
4489
|
if (value.rotation_period && value.next_rotation_at) {
|
|
4404
4490
|
context.addIssue({
|
|
@@ -4414,108 +4500,108 @@ var KEYS_TOOL_SCHEMAS = {
|
|
|
4414
4500
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
4415
4501
|
},
|
|
4416
4502
|
createVirtualKey: {
|
|
4417
|
-
name:
|
|
4418
|
-
provider:
|
|
4503
|
+
name: z12.string().describe("Display name for the virtual key"),
|
|
4504
|
+
provider: z12.string().describe(
|
|
4419
4505
|
"Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
|
|
4420
4506
|
),
|
|
4421
|
-
key:
|
|
4422
|
-
note:
|
|
4423
|
-
workspace_id:
|
|
4424
|
-
api_version:
|
|
4425
|
-
resource_name:
|
|
4426
|
-
deployment_name:
|
|
4427
|
-
deployment_configurations:
|
|
4507
|
+
key: z12.string().optional().describe("Provider API key; omit when secret_mappings supplies key"),
|
|
4508
|
+
note: z12.string().optional().describe("Optional note or description for this key"),
|
|
4509
|
+
workspace_id: z12.string().optional().describe("Workspace ID to create the key in"),
|
|
4510
|
+
api_version: z12.string().optional().describe("API version (for Azure OpenAI)"),
|
|
4511
|
+
resource_name: z12.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
4512
|
+
deployment_name: z12.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
4513
|
+
deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe(
|
|
4428
4514
|
"Azure deployment configurations with API versions and aliases"
|
|
4429
4515
|
),
|
|
4430
|
-
expires_at:
|
|
4431
|
-
secret_mappings:
|
|
4432
|
-
credit_limit:
|
|
4433
|
-
alert_threshold:
|
|
4516
|
+
expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration in ISO 8601 format"),
|
|
4517
|
+
secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Secret Reference mappings for key or model_config fields"),
|
|
4518
|
+
credit_limit: z12.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
|
|
4519
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe(
|
|
4434
4520
|
"Percentage of credit_limit at which to send alert emails (0-100)"
|
|
4435
4521
|
),
|
|
4436
|
-
rate_limit_rpm:
|
|
4522
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("Requests per minute limit")
|
|
4437
4523
|
},
|
|
4438
4524
|
getVirtualKey: {
|
|
4439
|
-
slug:
|
|
4525
|
+
slug: z12.string().describe("The unique slug identifier of the virtual key to retrieve")
|
|
4440
4526
|
},
|
|
4441
4527
|
updateVirtualKey: {
|
|
4442
|
-
slug:
|
|
4443
|
-
name:
|
|
4444
|
-
key:
|
|
4445
|
-
note:
|
|
4446
|
-
credit_limit:
|
|
4447
|
-
alert_threshold:
|
|
4448
|
-
rate_limit_rpm:
|
|
4449
|
-
deployment_configurations:
|
|
4450
|
-
secret_mappings:
|
|
4528
|
+
slug: z12.string().describe("The slug of the virtual key to update"),
|
|
4529
|
+
name: z12.string().optional().describe("New display name for the key"),
|
|
4530
|
+
key: z12.string().optional().describe("New provider API key value"),
|
|
4531
|
+
note: z12.string().optional().describe("New note or description"),
|
|
4532
|
+
credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4533
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4534
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4535
|
+
deployment_configurations: z12.array(virtualKeyDeploymentSchema).optional().describe("Replacement Azure deployment configurations"),
|
|
4536
|
+
secret_mappings: z12.array(virtualKeySecretMappingSchema).optional().describe("Replacement Secret Reference mappings")
|
|
4451
4537
|
},
|
|
4452
4538
|
deleteVirtualKey: {
|
|
4453
|
-
slug:
|
|
4539
|
+
slug: z12.string().describe("The slug of the virtual key to delete")
|
|
4454
4540
|
},
|
|
4455
4541
|
createApiKey: {
|
|
4456
|
-
type:
|
|
4542
|
+
type: z12.enum(["organisation", "workspace"]).describe(
|
|
4457
4543
|
"Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
|
|
4458
4544
|
),
|
|
4459
|
-
sub_type:
|
|
4545
|
+
sub_type: z12.enum(["user", "service"]).describe(
|
|
4460
4546
|
"Sub-type: 'user' for user-associated keys or 'service' for service accounts"
|
|
4461
4547
|
),
|
|
4462
|
-
name:
|
|
4463
|
-
description:
|
|
4464
|
-
organisation_id:
|
|
4465
|
-
workspace_id:
|
|
4466
|
-
user_id:
|
|
4467
|
-
scopes:
|
|
4548
|
+
name: z12.string().describe("Display name for the API key"),
|
|
4549
|
+
description: z12.string().optional().describe("Optional description for the key"),
|
|
4550
|
+
organisation_id: z12.string().optional().describe("Organisation UUID"),
|
|
4551
|
+
workspace_id: z12.string().optional().describe("Workspace ID (required for workspace-type keys)"),
|
|
4552
|
+
user_id: z12.string().optional().describe("User ID (required for user sub-type keys)"),
|
|
4553
|
+
scopes: z12.array(z12.string()).describe(
|
|
4468
4554
|
"Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
|
|
4469
4555
|
),
|
|
4470
|
-
credit_limit:
|
|
4471
|
-
alert_threshold:
|
|
4472
|
-
rate_limit_rpm:
|
|
4473
|
-
rate_limits:
|
|
4474
|
-
default_config_id:
|
|
4475
|
-
default_metadata:
|
|
4476
|
-
default_allow_config_override:
|
|
4477
|
-
alert_emails:
|
|
4478
|
-
expires_at:
|
|
4556
|
+
credit_limit: z12.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
4557
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
4558
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
4559
|
+
rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Request or token rate limits, or null to clear them"),
|
|
4560
|
+
default_config_id: z12.string().optional().describe("Default configuration ID to use with this key"),
|
|
4561
|
+
default_metadata: z12.record(z12.string(), z12.string()).optional().describe("Default metadata key-value pairs"),
|
|
4562
|
+
default_allow_config_override: z12.boolean().optional().describe("Allow callers to override the default config"),
|
|
4563
|
+
alert_emails: z12.array(z12.string()).optional().describe("Email addresses for alerts"),
|
|
4564
|
+
expires_at: z12.iso.datetime({ offset: true }).optional().describe("Expiration date in ISO 8601 format"),
|
|
4479
4565
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Automatic API-key rotation policy, or null to disable it")
|
|
4480
4566
|
},
|
|
4481
4567
|
listApiKeys: {
|
|
4482
4568
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
4483
4569
|
current_page: CurrentPageSchema,
|
|
4484
|
-
workspace_id:
|
|
4570
|
+
workspace_id: z12.string().optional().describe("Filter by workspace ID")
|
|
4485
4571
|
},
|
|
4486
4572
|
getApiKey: {
|
|
4487
|
-
id:
|
|
4573
|
+
id: z12.string().uuid().describe("The UUID of the API key to retrieve")
|
|
4488
4574
|
},
|
|
4489
4575
|
updateApiKey: {
|
|
4490
|
-
id:
|
|
4491
|
-
name:
|
|
4492
|
-
description:
|
|
4493
|
-
scopes:
|
|
4494
|
-
credit_limit:
|
|
4495
|
-
alert_threshold:
|
|
4496
|
-
rate_limit_rpm:
|
|
4497
|
-
rate_limits:
|
|
4498
|
-
reset_usage:
|
|
4499
|
-
default_config_id:
|
|
4500
|
-
default_metadata:
|
|
4501
|
-
default_allow_config_override:
|
|
4502
|
-
alert_emails:
|
|
4503
|
-
expires_at:
|
|
4576
|
+
id: z12.string().uuid().describe("The UUID of the API key to update"),
|
|
4577
|
+
name: z12.string().optional().describe("New display name for the key"),
|
|
4578
|
+
description: z12.string().optional().describe("New description for the key"),
|
|
4579
|
+
scopes: z12.array(z12.string()).optional().describe("New permission scopes for the key"),
|
|
4580
|
+
credit_limit: z12.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
4581
|
+
alert_threshold: z12.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
4582
|
+
rate_limit_rpm: z12.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
4583
|
+
rate_limits: z12.array(apiKeyRateLimitSchema).nullable().optional().describe("Replacement request or token rate limits, or null to clear"),
|
|
4584
|
+
reset_usage: z12.coerce.number().nonnegative().optional().describe("Set to a nonnegative acknowledgement value to reset usage"),
|
|
4585
|
+
default_config_id: z12.string().optional().describe("New default configuration ID"),
|
|
4586
|
+
default_metadata: z12.record(z12.string(), z12.string()).optional().describe("New default metadata key-value pairs"),
|
|
4587
|
+
default_allow_config_override: z12.boolean().optional().describe("Whether callers may override the key's default config"),
|
|
4588
|
+
alert_emails: z12.array(z12.string()).optional().describe("New email addresses for alerts"),
|
|
4589
|
+
expires_at: z12.iso.datetime({ offset: true }).nullable().optional().describe(
|
|
4504
4590
|
"New expiration date in ISO 8601 format, or null to remove expiration"
|
|
4505
4591
|
),
|
|
4506
4592
|
rotation_policy: rotationPolicySchema.nullable().optional().describe("Replacement rotation policy, or null to disable it")
|
|
4507
4593
|
},
|
|
4508
4594
|
rotateApiKey: {
|
|
4509
|
-
id:
|
|
4510
|
-
key_transition_period_ms:
|
|
4595
|
+
id: z12.string().uuid().describe("API key UUID obtained from list_api_keys"),
|
|
4596
|
+
key_transition_period_ms: z12.coerce.number().int().min(18e5).optional().describe(
|
|
4511
4597
|
"Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
|
|
4512
4598
|
)
|
|
4513
4599
|
},
|
|
4514
4600
|
deleteApiKey: {
|
|
4515
|
-
id:
|
|
4601
|
+
id: z12.string().uuid().describe("The UUID of the API key to delete")
|
|
4516
4602
|
}
|
|
4517
4603
|
};
|
|
4518
|
-
var createVirtualKeySchema =
|
|
4604
|
+
var createVirtualKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createVirtualKey).superRefine((value, context) => {
|
|
4519
4605
|
if (value.key === void 0 && !value.secret_mappings?.some((mapping) => mapping.target_field === "key")) {
|
|
4520
4606
|
context.addIssue({
|
|
4521
4607
|
code: "custom",
|
|
@@ -4524,17 +4610,17 @@ var createVirtualKeySchema = z11.object(KEYS_TOOL_SCHEMAS.createVirtualKey).supe
|
|
|
4524
4610
|
});
|
|
4525
4611
|
}
|
|
4526
4612
|
});
|
|
4527
|
-
var createApiKeySchema =
|
|
4613
|
+
var createApiKeySchema = z12.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
|
|
4528
4614
|
if (value.type === "workspace" && !value.workspace_id) {
|
|
4529
4615
|
ctx.addIssue({
|
|
4530
|
-
code:
|
|
4616
|
+
code: z12.ZodIssueCode.custom,
|
|
4531
4617
|
path: ["workspace_id"],
|
|
4532
4618
|
message: "workspace_id is required when type is 'workspace'"
|
|
4533
4619
|
});
|
|
4534
4620
|
}
|
|
4535
4621
|
if (value.sub_type === "user" && !value.user_id) {
|
|
4536
4622
|
ctx.addIssue({
|
|
4537
|
-
code:
|
|
4623
|
+
code: z12.ZodIssueCode.custom,
|
|
4538
4624
|
path: ["user_id"],
|
|
4539
4625
|
message: "user_id is required when sub_type is 'user'"
|
|
4540
4626
|
});
|
|
@@ -4857,43 +4943,43 @@ function registerKeysTools(server, service) {
|
|
|
4857
4943
|
}
|
|
4858
4944
|
|
|
4859
4945
|
// src/tools/labels.tools.ts
|
|
4860
|
-
import { z as
|
|
4946
|
+
import { z as z13 } from "zod";
|
|
4861
4947
|
var LABELS_TOOL_SCHEMAS = {
|
|
4862
4948
|
createPromptLabel: {
|
|
4863
|
-
name:
|
|
4864
|
-
organisation_id:
|
|
4865
|
-
workspace_id:
|
|
4866
|
-
description:
|
|
4867
|
-
color_code:
|
|
4949
|
+
name: z13.string().describe("Name of the label"),
|
|
4950
|
+
organisation_id: z13.string().optional().describe("Organisation ID to create the label in"),
|
|
4951
|
+
workspace_id: z13.string().optional().describe("Workspace ID to create the label in"),
|
|
4952
|
+
description: z13.string().optional().describe("Description of the label"),
|
|
4953
|
+
color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
|
|
4868
4954
|
"Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
|
|
4869
4955
|
)
|
|
4870
4956
|
},
|
|
4871
4957
|
listPromptLabels: {
|
|
4872
|
-
organisation_id:
|
|
4873
|
-
workspace_id:
|
|
4874
|
-
search:
|
|
4958
|
+
organisation_id: z13.string().optional().describe("Filter by organisation ID"),
|
|
4959
|
+
workspace_id: z13.string().optional().describe("Filter by workspace ID"),
|
|
4960
|
+
search: z13.string().optional().describe("Search labels by name"),
|
|
4875
4961
|
current_page: CurrentPageSchema,
|
|
4876
4962
|
page_size: PageSizeSchema
|
|
4877
4963
|
},
|
|
4878
4964
|
getPromptLabel: {
|
|
4879
|
-
label_id:
|
|
4880
|
-
organisation_id:
|
|
4881
|
-
workspace_id:
|
|
4965
|
+
label_id: z13.string().describe("Label ID to retrieve"),
|
|
4966
|
+
organisation_id: z13.string().optional().describe("Organisation ID for filtering"),
|
|
4967
|
+
workspace_id: z13.string().optional().describe("Workspace ID for filtering")
|
|
4882
4968
|
},
|
|
4883
4969
|
updatePromptLabel: {
|
|
4884
|
-
label_id:
|
|
4885
|
-
name:
|
|
4886
|
-
description:
|
|
4887
|
-
color_code:
|
|
4970
|
+
label_id: z13.string().describe("Label ID to update"),
|
|
4971
|
+
name: z13.string().optional().describe("New name for the label"),
|
|
4972
|
+
description: z13.string().optional().describe("New description"),
|
|
4973
|
+
color_code: z13.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
|
|
4888
4974
|
},
|
|
4889
4975
|
deletePromptLabel: {
|
|
4890
|
-
label_id:
|
|
4976
|
+
label_id: z13.string().describe("Label ID to delete")
|
|
4891
4977
|
}
|
|
4892
4978
|
};
|
|
4893
|
-
var createPromptLabelSchema =
|
|
4979
|
+
var createPromptLabelSchema = z13.object(LABELS_TOOL_SCHEMAS.createPromptLabel).superRefine((value, ctx) => {
|
|
4894
4980
|
if (!value.organisation_id && !value.workspace_id) {
|
|
4895
4981
|
ctx.addIssue({
|
|
4896
|
-
code:
|
|
4982
|
+
code: z13.ZodIssueCode.custom,
|
|
4897
4983
|
message: "Either organisation_id or workspace_id is required"
|
|
4898
4984
|
});
|
|
4899
4985
|
}
|
|
@@ -4990,13 +5076,13 @@ function registerLabelsTools(server, service) {
|
|
|
4990
5076
|
}
|
|
4991
5077
|
|
|
4992
5078
|
// src/tools/limits.tools.ts
|
|
4993
|
-
import { z as
|
|
4994
|
-
var statusSchema =
|
|
4995
|
-
var rateUnitSchema =
|
|
4996
|
-
var rateTargetSchema =
|
|
4997
|
-
var conditionValueSchema =
|
|
4998
|
-
var conditionSchema =
|
|
4999
|
-
key:
|
|
5079
|
+
import { z as z14 } from "zod";
|
|
5080
|
+
var statusSchema = z14.enum(["active", "archived"]);
|
|
5081
|
+
var rateUnitSchema = z14.enum(["rpm", "rph", "rpd", "rpw"]);
|
|
5082
|
+
var rateTargetSchema = z14.enum(["llm", "mcp_tools"]);
|
|
5083
|
+
var conditionValueSchema = z14.union([z14.string(), z14.array(z14.string()).min(1)]);
|
|
5084
|
+
var conditionSchema = z14.object({
|
|
5085
|
+
key: z14.string().min(1).describe(
|
|
5000
5086
|
"Match key such as api_key, virtual_key, provider, config, prompt, model, endpoint_type, mcp_server, mcp_tool, workspace_id, or metadata.*"
|
|
5001
5087
|
),
|
|
5002
5088
|
value: conditionValueSchema.describe(
|
|
@@ -5004,8 +5090,8 @@ var conditionSchema = z13.object({
|
|
|
5004
5090
|
),
|
|
5005
5091
|
excludes: conditionValueSchema.optional().describe("Values to exclude")
|
|
5006
5092
|
});
|
|
5007
|
-
var groupBySchema =
|
|
5008
|
-
key:
|
|
5093
|
+
var groupBySchema = z14.object({
|
|
5094
|
+
key: z14.string().min(1).describe(
|
|
5009
5095
|
"Counter grouping key such as api_key, workspace_id, virtual_key, provider, config, prompt, model, mcp_server, mcp_tool, or metadata.*"
|
|
5010
5096
|
)
|
|
5011
5097
|
});
|
|
@@ -5015,88 +5101,88 @@ var paginationSchema = {
|
|
|
5015
5101
|
};
|
|
5016
5102
|
var LIMITS_TOOL_SCHEMAS = {
|
|
5017
5103
|
listRateLimits: {
|
|
5018
|
-
workspace_id:
|
|
5104
|
+
workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
|
|
5019
5105
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
5020
|
-
type:
|
|
5106
|
+
type: z14.enum(["requests", "tokens"]).optional().describe("Filter by counter type"),
|
|
5021
5107
|
unit: rateUnitSchema.optional().describe("Filter by reset interval"),
|
|
5022
5108
|
target: rateTargetSchema.optional().describe("Filter by LLM or MCP-tool target"),
|
|
5023
5109
|
...paginationSchema
|
|
5024
5110
|
},
|
|
5025
5111
|
getRateLimit: {
|
|
5026
|
-
id:
|
|
5112
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID"),
|
|
5027
5113
|
status: statusSchema.optional().describe("Include an archived policy by status")
|
|
5028
5114
|
},
|
|
5029
5115
|
createRateLimit: {
|
|
5030
|
-
conditions:
|
|
5031
|
-
group_by:
|
|
5032
|
-
type:
|
|
5116
|
+
conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
5117
|
+
group_by: z14.array(groupBySchema).min(1).describe("Counter grouping dimensions"),
|
|
5118
|
+
type: z14.enum(["requests", "tokens"]).describe("Counter type"),
|
|
5033
5119
|
unit: rateUnitSchema.describe("Counter reset interval"),
|
|
5034
|
-
value:
|
|
5035
|
-
name:
|
|
5120
|
+
value: z14.coerce.number().nonnegative().describe("Maximum requests or tokens"),
|
|
5121
|
+
name: z14.string().optional().describe("Optional policy display name"),
|
|
5036
5122
|
target: rateTargetSchema.optional().describe("LLM or MCP-tool enforcement target"),
|
|
5037
|
-
workspace_id:
|
|
5038
|
-
organisation_id:
|
|
5123
|
+
workspace_id: z14.string().optional().describe("Workspace UUID scope"),
|
|
5124
|
+
organisation_id: z14.string().optional().describe("Organisation UUID scope")
|
|
5039
5125
|
},
|
|
5040
5126
|
updateRateLimit: {
|
|
5041
|
-
id:
|
|
5042
|
-
name:
|
|
5127
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID"),
|
|
5128
|
+
name: z14.string().optional().describe("Replacement display name"),
|
|
5043
5129
|
unit: rateUnitSchema.optional().describe("Replacement reset interval"),
|
|
5044
|
-
value:
|
|
5045
|
-
conditions:
|
|
5130
|
+
value: z14.coerce.number().nonnegative().optional().describe("Replacement maximum"),
|
|
5131
|
+
conditions: z14.array(conditionSchema).min(1).optional().describe("Replacement conditions")
|
|
5046
5132
|
},
|
|
5047
5133
|
deleteRateLimit: {
|
|
5048
|
-
id:
|
|
5134
|
+
id: z14.string().min(1).describe("Rate-limit policy UUID to delete")
|
|
5049
5135
|
},
|
|
5050
5136
|
listUsageLimits: {
|
|
5051
|
-
workspace_id:
|
|
5137
|
+
workspace_id: z14.string().optional().describe("Filter by workspace UUID"),
|
|
5052
5138
|
status: statusSchema.optional().describe("Filter by active or archived status"),
|
|
5053
|
-
type:
|
|
5139
|
+
type: z14.enum(["cost", "tokens"]).optional().describe("Filter by budget type"),
|
|
5054
5140
|
...paginationSchema
|
|
5055
5141
|
},
|
|
5056
5142
|
getUsageLimit: {
|
|
5057
|
-
id:
|
|
5143
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5058
5144
|
status: statusSchema.optional().describe("Include an archived policy by status"),
|
|
5059
|
-
include_usage:
|
|
5145
|
+
include_usage: z14.boolean().optional().describe("Include per-value usage counters")
|
|
5060
5146
|
},
|
|
5061
5147
|
createUsageLimit: {
|
|
5062
|
-
conditions:
|
|
5063
|
-
group_by:
|
|
5064
|
-
type:
|
|
5065
|
-
credit_limit:
|
|
5066
|
-
name:
|
|
5067
|
-
alert_threshold:
|
|
5068
|
-
periodic_reset:
|
|
5069
|
-
workspace_id:
|
|
5070
|
-
organisation_id:
|
|
5148
|
+
conditions: z14.array(conditionSchema).min(1).describe("Policy match conditions"),
|
|
5149
|
+
group_by: z14.array(groupBySchema).min(1).describe("Usage grouping dimensions"),
|
|
5150
|
+
type: z14.enum(["cost", "tokens"]).describe("Budget type"),
|
|
5151
|
+
credit_limit: z14.coerce.number().nonnegative().describe("Maximum cumulative usage"),
|
|
5152
|
+
name: z14.string().optional().describe("Optional policy display name"),
|
|
5153
|
+
alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Optional alert threshold"),
|
|
5154
|
+
periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Optional reset schedule"),
|
|
5155
|
+
workspace_id: z14.string().optional().describe("Workspace UUID scope"),
|
|
5156
|
+
organisation_id: z14.string().optional().describe("Organisation UUID scope")
|
|
5071
5157
|
},
|
|
5072
5158
|
updateUsageLimit: {
|
|
5073
|
-
id:
|
|
5074
|
-
name:
|
|
5075
|
-
description:
|
|
5076
|
-
conditions:
|
|
5077
|
-
credit_limit:
|
|
5078
|
-
alert_threshold:
|
|
5079
|
-
periodic_reset:
|
|
5080
|
-
periodic_reset_days:
|
|
5081
|
-
next_usage_reset_at:
|
|
5082
|
-
reset_usage_for_value:
|
|
5159
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5160
|
+
name: z14.string().max(255).optional().describe("Replacement display name"),
|
|
5161
|
+
description: z14.string().max(500).nullable().optional().describe("Replacement description, or null to clear it"),
|
|
5162
|
+
conditions: z14.array(conditionSchema).min(1).optional().describe("Complete replacement condition set"),
|
|
5163
|
+
credit_limit: z14.coerce.number().nonnegative().optional().describe("Replacement cumulative maximum"),
|
|
5164
|
+
alert_threshold: z14.coerce.number().nonnegative().nullable().optional().describe("Replacement alert threshold"),
|
|
5165
|
+
periodic_reset: z14.enum(["monthly", "weekly"]).nullable().optional().describe("Replacement reset schedule"),
|
|
5166
|
+
periodic_reset_days: z14.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset interval in days, or null to clear it"),
|
|
5167
|
+
next_usage_reset_at: z14.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format, or null to clear it"),
|
|
5168
|
+
reset_usage_for_value: z14.string().optional().describe("Grouped value whose usage should reset")
|
|
5083
5169
|
},
|
|
5084
5170
|
deleteUsageLimit: {
|
|
5085
|
-
id:
|
|
5171
|
+
id: z14.string().min(1).describe("Usage-limit policy UUID to archive")
|
|
5086
5172
|
},
|
|
5087
5173
|
listUsageLimitEntities: {
|
|
5088
|
-
limit_id:
|
|
5089
|
-
status:
|
|
5090
|
-
search:
|
|
5174
|
+
limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5175
|
+
status: z14.enum(["active", "exhausted"]).optional().describe("Filter by enforcement state"),
|
|
5176
|
+
search: z14.string().optional().describe("Search tracked values"),
|
|
5091
5177
|
page_size: PageSizeSchema.describe("Number of entities per page"),
|
|
5092
5178
|
current_page: CurrentPageSchema.describe("Zero-based page number")
|
|
5093
5179
|
},
|
|
5094
5180
|
resetUsageLimitEntity: {
|
|
5095
|
-
limit_id:
|
|
5096
|
-
entity_id:
|
|
5181
|
+
limit_id: z14.string().min(1).describe("Usage-limit policy UUID"),
|
|
5182
|
+
entity_id: z14.string().min(1).describe("Tracked entity UUID to reset")
|
|
5097
5183
|
}
|
|
5098
5184
|
};
|
|
5099
|
-
var updateUsageLimitSchema =
|
|
5185
|
+
var updateUsageLimitSchema = z14.object(LIMITS_TOOL_SCHEMAS.updateUsageLimit).superRefine((value, context) => {
|
|
5100
5186
|
if (value.periodic_reset != null && value.periodic_reset_days != null) {
|
|
5101
5187
|
context.addIssue({
|
|
5102
5188
|
code: "custom",
|
|
@@ -5236,8 +5322,8 @@ function registerLimitsTools(server, service) {
|
|
|
5236
5322
|
}
|
|
5237
5323
|
|
|
5238
5324
|
// src/tools/logging.tools.ts
|
|
5239
|
-
import { z as
|
|
5240
|
-
var logExportFieldSchema =
|
|
5325
|
+
import { z as z15 } from "zod";
|
|
5326
|
+
var logExportFieldSchema = z15.enum([
|
|
5241
5327
|
"id",
|
|
5242
5328
|
"trace_id",
|
|
5243
5329
|
"created_at",
|
|
@@ -5260,12 +5346,12 @@ var logExportFieldSchema = z14.enum([
|
|
|
5260
5346
|
"metadata"
|
|
5261
5347
|
]);
|
|
5262
5348
|
var getLogShape = {
|
|
5263
|
-
log_id:
|
|
5264
|
-
path_format:
|
|
5265
|
-
created_at:
|
|
5266
|
-
type:
|
|
5349
|
+
log_id: z15.string().describe("Gateway log ID to retrieve"),
|
|
5350
|
+
path_format: z15.enum(["v1", "v2"]).optional().describe("Log storage path format; defaults to v1"),
|
|
5351
|
+
created_at: z15.iso.datetime({ offset: true }).optional().describe("Log creation timestamp in ISO 8601 format; required for v2"),
|
|
5352
|
+
type: z15.enum(["hooks"]).optional().describe("Set to hooks when retrieving a hook execution log")
|
|
5267
5353
|
};
|
|
5268
|
-
var getLogSchema =
|
|
5354
|
+
var getLogSchema = z15.object(getLogShape).superRefine((input, context) => {
|
|
5269
5355
|
if (input.path_format === "v2" && input.created_at === void 0) {
|
|
5270
5356
|
context.addIssue({
|
|
5271
5357
|
code: "custom",
|
|
@@ -5276,67 +5362,67 @@ var getLogSchema = z14.object(getLogShape).superRefine((input, context) => {
|
|
|
5276
5362
|
});
|
|
5277
5363
|
var LOGGING_TOOL_SCHEMAS = {
|
|
5278
5364
|
getLogExportFieldRestrictions: {
|
|
5279
|
-
workspace_id:
|
|
5365
|
+
workspace_id: z15.string().describe("Workspace ID whose export field restrictions should be read")
|
|
5280
5366
|
},
|
|
5281
5367
|
insertLog: {
|
|
5282
|
-
request_url:
|
|
5283
|
-
request_provider:
|
|
5284
|
-
request_method:
|
|
5285
|
-
request_headers:
|
|
5286
|
-
request_body:
|
|
5287
|
-
response_status:
|
|
5288
|
-
response_headers:
|
|
5289
|
-
response_body:
|
|
5290
|
-
response_time:
|
|
5291
|
-
streaming_mode:
|
|
5292
|
-
metadata_organization:
|
|
5293
|
-
metadata_user:
|
|
5294
|
-
metadata_trace_id:
|
|
5295
|
-
metadata_span_id:
|
|
5296
|
-
metadata_span_name:
|
|
5297
|
-
metadata_parent_span_id:
|
|
5298
|
-
metadata_custom:
|
|
5368
|
+
request_url: z15.string().optional().describe("The endpoint URL being called"),
|
|
5369
|
+
request_provider: z15.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
|
|
5370
|
+
request_method: z15.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
|
|
5371
|
+
request_headers: z15.record(z15.string(), z15.string()).optional().describe("Request headers as key-value pairs"),
|
|
5372
|
+
request_body: z15.record(z15.string(), z15.unknown()).optional().describe("Request payload/body"),
|
|
5373
|
+
response_status: z15.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
|
|
5374
|
+
response_headers: z15.record(z15.string(), z15.string()).optional().describe("Response headers as key-value pairs"),
|
|
5375
|
+
response_body: z15.record(z15.string(), z15.unknown()).optional().describe("Response payload/body"),
|
|
5376
|
+
response_time: z15.coerce.number().optional().describe("Response latency in milliseconds"),
|
|
5377
|
+
streaming_mode: z15.boolean().optional().default(false).describe("Whether the response was streamed"),
|
|
5378
|
+
metadata_organization: z15.string().optional().describe("Organization identifier for the log"),
|
|
5379
|
+
metadata_user: z15.string().optional().describe("User identifier for the log"),
|
|
5380
|
+
metadata_trace_id: z15.string().optional().describe("Trace ID for distributed tracing"),
|
|
5381
|
+
metadata_span_id: z15.string().optional().describe("Span ID for tracing"),
|
|
5382
|
+
metadata_span_name: z15.string().optional().describe("Span name for tracing"),
|
|
5383
|
+
metadata_parent_span_id: z15.string().optional().describe("Parent span ID for tracing"),
|
|
5384
|
+
metadata_custom: z15.record(z15.string(), z15.unknown()).optional().describe("Additional custom metadata key-value pairs")
|
|
5299
5385
|
},
|
|
5300
5386
|
createLogExport: {
|
|
5301
|
-
workspace_id:
|
|
5302
|
-
description:
|
|
5303
|
-
time_min:
|
|
5387
|
+
workspace_id: z15.string().optional().describe("Workspace ID for the export"),
|
|
5388
|
+
description: z15.string().optional().describe("Human-readable description for the export job"),
|
|
5389
|
+
time_min: z15.string().describe(
|
|
5304
5390
|
"Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
|
|
5305
5391
|
),
|
|
5306
|
-
time_max:
|
|
5392
|
+
time_max: z15.string().describe(
|
|
5307
5393
|
"Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
|
|
5308
5394
|
),
|
|
5309
|
-
cost_min:
|
|
5310
|
-
cost_max:
|
|
5311
|
-
total_units_min:
|
|
5312
|
-
total_units_max:
|
|
5313
|
-
ai_model:
|
|
5314
|
-
requested_fields:
|
|
5395
|
+
cost_min: z15.coerce.number().optional().describe("Minimum cost filter"),
|
|
5396
|
+
cost_max: z15.coerce.number().optional().describe("Maximum cost filter"),
|
|
5397
|
+
total_units_min: z15.coerce.number().optional().describe("Minimum total units (tokens) filter"),
|
|
5398
|
+
total_units_max: z15.coerce.number().optional().describe("Maximum total units (tokens) filter"),
|
|
5399
|
+
ai_model: z15.array(z15.string()).optional().describe("Filter by specific AI model names"),
|
|
5400
|
+
requested_fields: z15.array(logExportFieldSchema).describe(
|
|
5315
5401
|
"Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
|
|
5316
5402
|
)
|
|
5317
5403
|
},
|
|
5318
5404
|
listLogExports: {
|
|
5319
|
-
workspace_id:
|
|
5405
|
+
workspace_id: z15.string().describe("Workspace ID to list exports for (required)")
|
|
5320
5406
|
},
|
|
5321
5407
|
getLogExport: {
|
|
5322
|
-
export_id:
|
|
5408
|
+
export_id: z15.string().describe("The unique ID of the log export")
|
|
5323
5409
|
},
|
|
5324
5410
|
startLogExport: {
|
|
5325
|
-
export_id:
|
|
5411
|
+
export_id: z15.string().describe("The unique ID of the log export to start")
|
|
5326
5412
|
},
|
|
5327
5413
|
cancelLogExport: {
|
|
5328
|
-
export_id:
|
|
5414
|
+
export_id: z15.string().describe("The unique ID of the log export to cancel")
|
|
5329
5415
|
},
|
|
5330
5416
|
downloadLogExport: {
|
|
5331
|
-
export_id:
|
|
5417
|
+
export_id: z15.string().describe("The unique ID of the log export to download")
|
|
5332
5418
|
},
|
|
5333
5419
|
updateLogExport: {
|
|
5334
|
-
export_id:
|
|
5335
|
-
workspace_id:
|
|
5336
|
-
time_of_generation_max:
|
|
5420
|
+
export_id: z15.string().describe("The unique ID of the log export to update"),
|
|
5421
|
+
workspace_id: z15.string().optional().describe("Workspace ID for the export"),
|
|
5422
|
+
time_of_generation_max: z15.string().optional().describe(
|
|
5337
5423
|
"Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
|
|
5338
5424
|
),
|
|
5339
|
-
requested_fields:
|
|
5425
|
+
requested_fields: z15.array(logExportFieldSchema).optional().describe(
|
|
5340
5426
|
"Fields to include in export: id, trace_id, created_at, request, response, is_success, ai_org, ai_model, req_units, res_units, total_units, request_url, cost, cost_currency, response_time, response_status_code, mode, config, prompt_slug, metadata"
|
|
5341
5427
|
)
|
|
5342
5428
|
}
|
|
@@ -5562,7 +5648,7 @@ function registerLoggingTools(server, service) {
|
|
|
5562
5648
|
}
|
|
5563
5649
|
|
|
5564
5650
|
// src/tools/mcp-integrations.tools.ts
|
|
5565
|
-
import { z as
|
|
5651
|
+
import { z as z16 } from "zod";
|
|
5566
5652
|
var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
5567
5653
|
allowKeyTarget: false,
|
|
5568
5654
|
targetFieldDescription: "Configuration field resolved at runtime, such as configurations.oauth_metadata",
|
|
@@ -5572,10 +5658,10 @@ var mcpSecretMappingSchema = createSecretMappingSchema({
|
|
|
5572
5658
|
var mcpSecretMappingsSchema = uniqueSecretMappingsSchema(
|
|
5573
5659
|
mcpSecretMappingSchema
|
|
5574
5660
|
);
|
|
5575
|
-
var mcpConfigurationsSchema =
|
|
5661
|
+
var mcpConfigurationsSchema = z16.record(z16.string(), z16.unknown()).superRefine((value, ctx) => {
|
|
5576
5662
|
if ("custom_headers" in value && !isStringRecord(value.custom_headers)) {
|
|
5577
5663
|
ctx.addIssue({
|
|
5578
|
-
code:
|
|
5664
|
+
code: z16.ZodIssueCode.custom,
|
|
5579
5665
|
path: ["custom_headers"],
|
|
5580
5666
|
message: "configurations.custom_headers must be a string-to-string record"
|
|
5581
5667
|
});
|
|
@@ -5587,31 +5673,31 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5587
5673
|
page_size: pageSizeSchema(1e3).describe(
|
|
5588
5674
|
"Number of results per page (max 1000)"
|
|
5589
5675
|
),
|
|
5590
|
-
workspace_id:
|
|
5591
|
-
organisation_id:
|
|
5592
|
-
type:
|
|
5676
|
+
workspace_id: z16.string().optional().describe("Filter by workspace ID"),
|
|
5677
|
+
organisation_id: z16.string().optional().describe("Filter by organisation UUID"),
|
|
5678
|
+
type: z16.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
5593
5679
|
"Filter by workspace, organisation, or all integration ownership"
|
|
5594
5680
|
),
|
|
5595
|
-
search:
|
|
5681
|
+
search: z16.string().optional().describe("Search integrations by name")
|
|
5596
5682
|
},
|
|
5597
5683
|
createMcpIntegration: {
|
|
5598
|
-
name:
|
|
5599
|
-
url:
|
|
5600
|
-
auth_type:
|
|
5684
|
+
name: z16.string().describe("Display name for the MCP integration"),
|
|
5685
|
+
url: z16.string().describe("URL endpoint of the MCP server to integrate"),
|
|
5686
|
+
auth_type: z16.string().min(1).describe(
|
|
5601
5687
|
"Authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5602
5688
|
),
|
|
5603
|
-
transport:
|
|
5689
|
+
transport: z16.enum(["http", "sse"]).describe(
|
|
5604
5690
|
"MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
|
|
5605
5691
|
),
|
|
5606
|
-
slug:
|
|
5607
|
-
description:
|
|
5608
|
-
custom_headers:
|
|
5692
|
+
slug: z16.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5693
|
+
description: z16.string().optional().describe("Description of the MCP integration"),
|
|
5694
|
+
custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
|
|
5609
5695
|
'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
|
|
5610
5696
|
),
|
|
5611
5697
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
5612
5698
|
"Additional documented or forward-compatible configuration fields. For headers auth, configurations.custom_headers is a string-to-string header map."
|
|
5613
5699
|
),
|
|
5614
|
-
workspace_id:
|
|
5700
|
+
workspace_id: z16.string().optional().describe(
|
|
5615
5701
|
"Workspace ID \u2014 required when using organization admin API keys"
|
|
5616
5702
|
),
|
|
5617
5703
|
secret_mappings: mcpSecretMappingsSchema.optional().describe(
|
|
@@ -5619,18 +5705,18 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5619
5705
|
)
|
|
5620
5706
|
},
|
|
5621
5707
|
getMcpIntegration: {
|
|
5622
|
-
id:
|
|
5708
|
+
id: z16.string().describe("The MCP integration ID or slug to retrieve")
|
|
5623
5709
|
},
|
|
5624
5710
|
updateMcpIntegration: {
|
|
5625
|
-
id:
|
|
5626
|
-
name:
|
|
5627
|
-
description:
|
|
5628
|
-
url:
|
|
5629
|
-
auth_type:
|
|
5711
|
+
id: z16.string().describe("The MCP integration ID or slug to update"),
|
|
5712
|
+
name: z16.string().optional().describe("New display name"),
|
|
5713
|
+
description: z16.string().optional().describe("New description"),
|
|
5714
|
+
url: z16.string().optional().describe("New URL endpoint"),
|
|
5715
|
+
auth_type: z16.string().min(1).optional().describe(
|
|
5630
5716
|
"New authentication type. Current examples are 'none', 'headers' (custom headers), and 'oauth_auto' (OAuth); Portkey may accept additional values."
|
|
5631
5717
|
),
|
|
5632
|
-
transport:
|
|
5633
|
-
custom_headers:
|
|
5718
|
+
transport: z16.enum(["http", "sse"]).optional().describe("New transport protocol"),
|
|
5719
|
+
custom_headers: z16.record(z16.string(), z16.string()).optional().describe(
|
|
5634
5720
|
"New custom headers for authentication. Sent via configurations.custom_headers"
|
|
5635
5721
|
),
|
|
5636
5722
|
configurations: mcpConfigurationsSchema.optional().describe(
|
|
@@ -5641,50 +5727,50 @@ var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
|
5641
5727
|
)
|
|
5642
5728
|
},
|
|
5643
5729
|
deleteMcpIntegration: {
|
|
5644
|
-
id:
|
|
5730
|
+
id: z16.string().describe("The MCP integration ID or slug to delete")
|
|
5645
5731
|
},
|
|
5646
5732
|
getMcpIntegrationMetadata: {
|
|
5647
|
-
id:
|
|
5733
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5648
5734
|
},
|
|
5649
5735
|
listMcpIntegrationCapabilities: {
|
|
5650
|
-
id:
|
|
5736
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5651
5737
|
},
|
|
5652
5738
|
updateMcpIntegrationCapabilities: {
|
|
5653
|
-
id:
|
|
5654
|
-
capabilities:
|
|
5655
|
-
|
|
5656
|
-
name:
|
|
5657
|
-
type:
|
|
5658
|
-
enabled:
|
|
5739
|
+
id: z16.string().describe("The MCP integration ID or slug"),
|
|
5740
|
+
capabilities: z16.array(
|
|
5741
|
+
z16.object({
|
|
5742
|
+
name: z16.string().describe("Capability name"),
|
|
5743
|
+
type: z16.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5744
|
+
enabled: z16.boolean().describe("Whether to enable the capability")
|
|
5659
5745
|
})
|
|
5660
5746
|
).min(1).describe("Array of capability updates")
|
|
5661
5747
|
},
|
|
5662
5748
|
listMcpIntegrationWorkspaces: {
|
|
5663
|
-
id:
|
|
5749
|
+
id: z16.string().describe("The MCP integration ID or slug")
|
|
5664
5750
|
},
|
|
5665
5751
|
updateMcpIntegrationWorkspaces: {
|
|
5666
|
-
id:
|
|
5667
|
-
workspaces:
|
|
5668
|
-
|
|
5669
|
-
id:
|
|
5670
|
-
enabled:
|
|
5752
|
+
id: z16.string().describe("The MCP integration ID or slug"),
|
|
5753
|
+
workspaces: z16.array(
|
|
5754
|
+
z16.object({
|
|
5755
|
+
id: z16.string().describe("Workspace ID"),
|
|
5756
|
+
enabled: z16.boolean().describe("Whether workspace has access")
|
|
5671
5757
|
})
|
|
5672
5758
|
).min(1).describe("Array of workspace access updates")
|
|
5673
5759
|
}
|
|
5674
5760
|
};
|
|
5675
|
-
var createMcpIntegrationSchema =
|
|
5761
|
+
var createMcpIntegrationSchema = z16.object(MCP_INTEGRATIONS_TOOL_SCHEMAS.createMcpIntegration).superRefine((value, ctx) => {
|
|
5676
5762
|
const configuredHeaders = value.configurations?.custom_headers;
|
|
5677
5763
|
if (value.auth_type === "headers" && (!value.custom_headers || Object.keys(value.custom_headers).length === 0) && (!isStringRecord(configuredHeaders) || Object.keys(configuredHeaders).length === 0) && !value.secret_mappings?.some(
|
|
5678
5764
|
(mapping) => mapping.target_field === "configurations.custom_headers"
|
|
5679
5765
|
)) {
|
|
5680
5766
|
ctx.addIssue({
|
|
5681
|
-
code:
|
|
5767
|
+
code: z16.ZodIssueCode.custom,
|
|
5682
5768
|
path: [],
|
|
5683
5769
|
message: "custom_headers, configurations.custom_headers, or secret_mappings targeting configurations.custom_headers must be provided when auth_type is 'headers'"
|
|
5684
5770
|
});
|
|
5685
5771
|
}
|
|
5686
5772
|
});
|
|
5687
|
-
var updateMcpIntegrationSchema =
|
|
5773
|
+
var updateMcpIntegrationSchema = z16.object(
|
|
5688
5774
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.updateMcpIntegration
|
|
5689
5775
|
);
|
|
5690
5776
|
function isRecord2(value) {
|
|
@@ -5925,68 +6011,68 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5925
6011
|
}
|
|
5926
6012
|
|
|
5927
6013
|
// src/tools/mcp-servers.tools.ts
|
|
5928
|
-
import { z as
|
|
6014
|
+
import { z as z17 } from "zod";
|
|
5929
6015
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5930
6016
|
listMcpServers: {
|
|
5931
6017
|
current_page: CurrentPageSchema,
|
|
5932
6018
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
5933
|
-
workspace_id:
|
|
6019
|
+
workspace_id: z17.string().optional().describe("Filter by workspace ID")
|
|
5934
6020
|
},
|
|
5935
6021
|
createMcpServer: {
|
|
5936
|
-
name:
|
|
5937
|
-
mcp_integration_id:
|
|
5938
|
-
slug:
|
|
5939
|
-
description:
|
|
6022
|
+
name: z17.string().describe("Display name for the MCP server"),
|
|
6023
|
+
mcp_integration_id: z17.string().describe("ID or slug of the MCP integration this server belongs to"),
|
|
6024
|
+
slug: z17.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
6025
|
+
description: z17.string().optional().describe("Description of the MCP server")
|
|
5940
6026
|
},
|
|
5941
6027
|
getMcpServer: {
|
|
5942
|
-
id:
|
|
6028
|
+
id: z17.string().describe("The MCP server ID or slug to retrieve")
|
|
5943
6029
|
},
|
|
5944
6030
|
updateMcpServer: {
|
|
5945
|
-
id:
|
|
5946
|
-
name:
|
|
5947
|
-
description:
|
|
6031
|
+
id: z17.string().describe("The MCP server ID or slug to update"),
|
|
6032
|
+
name: z17.string().optional().describe("New display name"),
|
|
6033
|
+
description: z17.string().optional().describe("New description")
|
|
5948
6034
|
},
|
|
5949
6035
|
deleteMcpServer: {
|
|
5950
|
-
id:
|
|
6036
|
+
id: z17.string().describe("The MCP server ID or slug to delete")
|
|
5951
6037
|
},
|
|
5952
6038
|
testMcpServer: {
|
|
5953
|
-
id:
|
|
6039
|
+
id: z17.string().describe("The MCP server ID or slug to test")
|
|
5954
6040
|
},
|
|
5955
6041
|
listMcpServerCapabilities: {
|
|
5956
|
-
id:
|
|
6042
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
5957
6043
|
current_page: CurrentPageSchema,
|
|
5958
6044
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5959
6045
|
},
|
|
5960
6046
|
updateMcpServerCapabilities: {
|
|
5961
|
-
id:
|
|
5962
|
-
capabilities:
|
|
5963
|
-
|
|
5964
|
-
name:
|
|
5965
|
-
type:
|
|
5966
|
-
enabled:
|
|
6047
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
6048
|
+
capabilities: z17.array(
|
|
6049
|
+
z17.object({
|
|
6050
|
+
name: z17.string().describe("Capability name"),
|
|
6051
|
+
type: z17.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
6052
|
+
enabled: z17.boolean().describe("Whether to enable the capability")
|
|
5967
6053
|
})
|
|
5968
6054
|
).min(1).describe("Array of capability updates")
|
|
5969
6055
|
},
|
|
5970
6056
|
listMcpServerUserAccess: {
|
|
5971
|
-
id:
|
|
6057
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
5972
6058
|
current_page: CurrentPageSchema,
|
|
5973
6059
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
5974
6060
|
},
|
|
5975
6061
|
updateMcpServerUserAccess: {
|
|
5976
|
-
id:
|
|
5977
|
-
users:
|
|
5978
|
-
|
|
5979
|
-
user_id:
|
|
5980
|
-
enabled:
|
|
6062
|
+
id: z17.string().describe("The MCP server ID or slug"),
|
|
6063
|
+
users: z17.array(
|
|
6064
|
+
z17.object({
|
|
6065
|
+
user_id: z17.string().describe("User ID"),
|
|
6066
|
+
enabled: z17.boolean().describe("Whether user has access")
|
|
5981
6067
|
})
|
|
5982
6068
|
).min(1).describe("Array of user access updates")
|
|
5983
6069
|
},
|
|
5984
6070
|
listMcpServerConnections: {
|
|
5985
|
-
id:
|
|
5986
|
-
user_id:
|
|
6071
|
+
id: z17.string().describe("MCP server ID or slug whose connections to list"),
|
|
6072
|
+
user_id: z17.string().uuid().optional().describe(
|
|
5987
6073
|
"User UUID to filter; user-scoped keys default to their own user when omitted"
|
|
5988
6074
|
),
|
|
5989
|
-
workspace_id:
|
|
6075
|
+
workspace_id: z17.string().optional().describe(
|
|
5990
6076
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
5991
6077
|
),
|
|
5992
6078
|
current_page: CurrentPageSchema.describe(
|
|
@@ -5997,11 +6083,11 @@ var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
|
5997
6083
|
)
|
|
5998
6084
|
},
|
|
5999
6085
|
disconnectMcpServerConnection: {
|
|
6000
|
-
id:
|
|
6001
|
-
user_id:
|
|
6086
|
+
id: z17.string().describe("MCP server ID or slug containing the active connection"),
|
|
6087
|
+
user_id: z17.string().uuid().optional().describe(
|
|
6002
6088
|
"User UUID to disconnect; required with service keys and derived from user keys when omitted"
|
|
6003
6089
|
),
|
|
6004
|
-
workspace_id:
|
|
6090
|
+
workspace_id: z17.string().optional().describe(
|
|
6005
6091
|
"Workspace ID or slug; required with an organisation admin API key"
|
|
6006
6092
|
)
|
|
6007
6093
|
}
|
|
@@ -6228,40 +6314,40 @@ function registerMcpServersTools(server, service) {
|
|
|
6228
6314
|
}
|
|
6229
6315
|
|
|
6230
6316
|
// src/tools/partials.tools.ts
|
|
6231
|
-
import { z as
|
|
6317
|
+
import { z as z18 } from "zod";
|
|
6232
6318
|
var PARTIALS_TOOL_SCHEMAS = {
|
|
6233
6319
|
createPromptPartial: {
|
|
6234
|
-
name:
|
|
6235
|
-
string:
|
|
6236
|
-
workspace_id:
|
|
6320
|
+
name: z18.string().describe("Display name for the partial"),
|
|
6321
|
+
string: z18.string().describe("The partial content/template string"),
|
|
6322
|
+
workspace_id: z18.string().optional().describe(
|
|
6237
6323
|
"Workspace ID to create partial in (required for org-level API keys)"
|
|
6238
6324
|
),
|
|
6239
|
-
version_description:
|
|
6325
|
+
version_description: z18.string().optional().describe("Description for this version")
|
|
6240
6326
|
},
|
|
6241
6327
|
listPromptPartials: {
|
|
6242
|
-
collection_id:
|
|
6328
|
+
collection_id: z18.string().optional().describe(
|
|
6243
6329
|
"Filter by collection ID. Optional \u2014 omit to list all partials across collections"
|
|
6244
6330
|
)
|
|
6245
6331
|
},
|
|
6246
6332
|
getPromptPartial: {
|
|
6247
|
-
prompt_partial_id:
|
|
6333
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to retrieve")
|
|
6248
6334
|
},
|
|
6249
6335
|
updatePromptPartial: {
|
|
6250
|
-
prompt_partial_id:
|
|
6251
|
-
name:
|
|
6252
|
-
string:
|
|
6253
|
-
description:
|
|
6254
|
-
status:
|
|
6336
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to update"),
|
|
6337
|
+
name: z18.string().optional().describe("New display name for the partial"),
|
|
6338
|
+
string: z18.string().optional().describe("New content for the partial"),
|
|
6339
|
+
description: z18.string().optional().describe("Description for this version"),
|
|
6340
|
+
status: z18.enum(["active", "archived"]).optional().describe("New status for the partial")
|
|
6255
6341
|
},
|
|
6256
6342
|
deletePromptPartial: {
|
|
6257
|
-
prompt_partial_id:
|
|
6343
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to delete")
|
|
6258
6344
|
},
|
|
6259
6345
|
listPartialVersions: {
|
|
6260
|
-
prompt_partial_id:
|
|
6346
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug to list versions for")
|
|
6261
6347
|
},
|
|
6262
6348
|
publishPartial: {
|
|
6263
|
-
prompt_partial_id:
|
|
6264
|
-
version:
|
|
6349
|
+
prompt_partial_id: z18.string().describe("Prompt partial ID or slug"),
|
|
6350
|
+
version: z18.coerce.number().positive().describe("Version number to publish as default")
|
|
6265
6351
|
}
|
|
6266
6352
|
};
|
|
6267
6353
|
function registerPartialsTools(server, service) {
|
|
@@ -6398,101 +6484,101 @@ function registerPartialsTools(server, service) {
|
|
|
6398
6484
|
}
|
|
6399
6485
|
|
|
6400
6486
|
// src/tools/prompts.tools.ts
|
|
6401
|
-
import { z as
|
|
6402
|
-
var PROMPT_VARIABLES_SCHEMA =
|
|
6403
|
-
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA =
|
|
6404
|
-
type:
|
|
6405
|
-
text:
|
|
6487
|
+
import { z as z19 } from "zod";
|
|
6488
|
+
var PROMPT_VARIABLES_SCHEMA = z19.record(z19.string(), z19.union([z19.string(), z19.number(), z19.boolean()])).describe("Variable values to substitute into the template");
|
|
6489
|
+
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z19.object({
|
|
6490
|
+
type: z19.string().describe("Content block type"),
|
|
6491
|
+
text: z19.string().optional().describe("Text content for text-based blocks")
|
|
6406
6492
|
}).passthrough().describe("Content block within a structured chat message");
|
|
6407
|
-
var PROMPT_TEMPLATE_MESSAGE_SCHEMA =
|
|
6408
|
-
role:
|
|
6409
|
-
content:
|
|
6493
|
+
var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z19.object({
|
|
6494
|
+
role: z19.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
|
|
6495
|
+
content: z19.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
|
|
6410
6496
|
}).passthrough().describe("Structured chat message in a prompt template");
|
|
6411
6497
|
var PROMPTS_TOOL_SCHEMAS = {
|
|
6412
6498
|
createPrompt: {
|
|
6413
|
-
name:
|
|
6414
|
-
collection_id:
|
|
6499
|
+
name: z19.string().describe("Display name for the prompt"),
|
|
6500
|
+
collection_id: z19.string().describe(
|
|
6415
6501
|
"Collection ID to organize the prompt in (use list_collections to find)"
|
|
6416
6502
|
),
|
|
6417
|
-
string:
|
|
6503
|
+
string: z19.string().optional().describe(
|
|
6418
6504
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
6419
6505
|
),
|
|
6420
|
-
messages:
|
|
6506
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6421
6507
|
"Structured chat template alias. Serialized to the legacy string format before creation."
|
|
6422
6508
|
),
|
|
6423
|
-
parameters:
|
|
6424
|
-
virtual_key:
|
|
6425
|
-
model:
|
|
6509
|
+
parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
|
|
6510
|
+
virtual_key: z19.string().describe("Virtual key slug for model access"),
|
|
6511
|
+
model: z19.string().optional().describe(
|
|
6426
6512
|
"Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
|
|
6427
6513
|
),
|
|
6428
|
-
ai_model_id:
|
|
6514
|
+
ai_model_id: z19.string().optional().describe(
|
|
6429
6515
|
"AI model ID (alternative to model). Required unless model or finetune_id is provided"
|
|
6430
6516
|
),
|
|
6431
|
-
finetune_id:
|
|
6517
|
+
finetune_id: z19.string().optional().describe(
|
|
6432
6518
|
"Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
|
|
6433
6519
|
),
|
|
6434
|
-
version_description:
|
|
6435
|
-
template_metadata:
|
|
6436
|
-
functions:
|
|
6437
|
-
tools:
|
|
6520
|
+
version_description: z19.string().optional().describe("Description for this prompt version"),
|
|
6521
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
|
|
6522
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
|
|
6523
|
+
tools: z19.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
|
|
6438
6524
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
6439
|
-
is_raw_template:
|
|
6440
|
-
dry_run:
|
|
6525
|
+
is_raw_template: z19.boolean().optional().describe("Render the stored template as a raw structural template"),
|
|
6526
|
+
dry_run: z19.boolean().optional().describe("When true, validate without creating")
|
|
6441
6527
|
},
|
|
6442
6528
|
listPrompts: {
|
|
6443
|
-
collection_id:
|
|
6529
|
+
collection_id: z19.string().optional().describe(
|
|
6444
6530
|
"Filter by collection ID (recommended for app-specific prompts)"
|
|
6445
6531
|
),
|
|
6446
|
-
workspace_id:
|
|
6447
|
-
search:
|
|
6532
|
+
workspace_id: z19.string().optional().describe("Filter by workspace ID"),
|
|
6533
|
+
search: z19.string().optional().describe("Search prompts by name"),
|
|
6448
6534
|
current_page: CurrentPageSchema,
|
|
6449
6535
|
page_size: PageSizeSchema
|
|
6450
6536
|
},
|
|
6451
6537
|
getPrompt: {
|
|
6452
|
-
prompt_id:
|
|
6538
|
+
prompt_id: z19.string().describe("Prompt ID or slug to retrieve")
|
|
6453
6539
|
},
|
|
6454
6540
|
updatePrompt: {
|
|
6455
|
-
prompt_id:
|
|
6456
|
-
name:
|
|
6457
|
-
collection_id:
|
|
6458
|
-
string:
|
|
6541
|
+
prompt_id: z19.string().describe("Prompt ID or slug to update"),
|
|
6542
|
+
name: z19.string().optional().describe("New display name for the prompt"),
|
|
6543
|
+
collection_id: z19.string().optional().describe("Move to a different collection"),
|
|
6544
|
+
string: z19.string().optional().describe(
|
|
6459
6545
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
6460
6546
|
),
|
|
6461
|
-
messages:
|
|
6547
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6462
6548
|
"Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
|
|
6463
6549
|
),
|
|
6464
|
-
parameters:
|
|
6465
|
-
model:
|
|
6466
|
-
virtual_key:
|
|
6467
|
-
version_description:
|
|
6468
|
-
template_metadata:
|
|
6469
|
-
functions:
|
|
6470
|
-
tools:
|
|
6550
|
+
parameters: z19.record(z19.string(), z19.unknown()).optional().describe("New default values for template variables"),
|
|
6551
|
+
model: z19.string().optional().describe("New model identifier"),
|
|
6552
|
+
virtual_key: z19.string().optional().describe("New virtual key slug"),
|
|
6553
|
+
version_description: z19.string().optional().describe("Description for this version"),
|
|
6554
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("New metadata"),
|
|
6555
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("New function definitions"),
|
|
6556
|
+
tools: z19.array(PromptToolSchema).optional().describe("New tool definitions"),
|
|
6471
6557
|
tool_choice: ToolChoiceSchema.optional().describe(
|
|
6472
6558
|
"New tool choice strategy"
|
|
6473
6559
|
),
|
|
6474
|
-
is_raw_template:
|
|
6475
|
-
dry_run:
|
|
6560
|
+
is_raw_template: z19.boolean().optional().describe("Enable or disable raw structural-template rendering"),
|
|
6561
|
+
dry_run: z19.boolean().optional().describe("When true, validate without updating")
|
|
6476
6562
|
},
|
|
6477
6563
|
deletePrompt: {
|
|
6478
|
-
prompt_id:
|
|
6564
|
+
prompt_id: z19.string().describe("Prompt ID or slug to delete")
|
|
6479
6565
|
},
|
|
6480
6566
|
publishPrompt: {
|
|
6481
|
-
prompt_id:
|
|
6482
|
-
version:
|
|
6567
|
+
prompt_id: z19.string().describe("Prompt ID or slug to publish"),
|
|
6568
|
+
version: z19.coerce.number().positive().describe("Version number to publish as the default")
|
|
6483
6569
|
},
|
|
6484
6570
|
listPromptVersions: {
|
|
6485
|
-
prompt_id:
|
|
6571
|
+
prompt_id: z19.string().describe("Prompt ID or slug to list versions for")
|
|
6486
6572
|
},
|
|
6487
6573
|
renderPrompt: {
|
|
6488
|
-
prompt_id:
|
|
6574
|
+
prompt_id: z19.string().describe("Prompt ID or slug to render"),
|
|
6489
6575
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
6490
6576
|
hyperparameters: HyperparametersSchema.optional().describe(
|
|
6491
6577
|
"Override default hyperparameters"
|
|
6492
6578
|
)
|
|
6493
6579
|
},
|
|
6494
6580
|
runPromptCompletion: {
|
|
6495
|
-
prompt_id:
|
|
6581
|
+
prompt_id: z19.string().describe("Prompt ID or slug to execute"),
|
|
6496
6582
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
6497
6583
|
metadata: BillingMetadataSchema.describe(
|
|
6498
6584
|
"Billing metadata - client_id, app, env are REQUIRED for cost attribution"
|
|
@@ -6502,77 +6588,77 @@ var PROMPTS_TOOL_SCHEMAS = {
|
|
|
6502
6588
|
)
|
|
6503
6589
|
},
|
|
6504
6590
|
migratePrompt: {
|
|
6505
|
-
name:
|
|
6591
|
+
name: z19.string().describe("Prompt name to create or find for update"),
|
|
6506
6592
|
app: PromptAppIdentifierSchema,
|
|
6507
6593
|
env: PromptEnvironmentIdentifierSchema,
|
|
6508
|
-
collection_id:
|
|
6509
|
-
string:
|
|
6594
|
+
collection_id: z19.string().describe("Collection ID to search in and create under"),
|
|
6595
|
+
string: z19.string().optional().describe(
|
|
6510
6596
|
"Legacy prompt template string with {{variable}} mustache syntax."
|
|
6511
6597
|
),
|
|
6512
|
-
messages:
|
|
6598
|
+
messages: z19.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
6513
6599
|
"Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
|
|
6514
6600
|
),
|
|
6515
|
-
parameters:
|
|
6516
|
-
virtual_key:
|
|
6517
|
-
model:
|
|
6518
|
-
version_description:
|
|
6519
|
-
template_metadata:
|
|
6520
|
-
functions:
|
|
6521
|
-
tools:
|
|
6601
|
+
parameters: z19.record(z19.string(), z19.unknown()).describe("Default values for template variables"),
|
|
6602
|
+
virtual_key: z19.string().describe("Virtual key slug for model access"),
|
|
6603
|
+
model: z19.string().optional().describe("Model identifier"),
|
|
6604
|
+
version_description: z19.string().optional().describe("Description for this version"),
|
|
6605
|
+
template_metadata: z19.record(z19.string(), z19.unknown()).optional().describe("Additional custom metadata"),
|
|
6606
|
+
functions: z19.array(PromptFunctionSchema).optional().describe("Function definitions"),
|
|
6607
|
+
tools: z19.array(PromptToolSchema).optional().describe("Tool definitions"),
|
|
6522
6608
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
6523
|
-
is_raw_template:
|
|
6524
|
-
dry_run:
|
|
6609
|
+
is_raw_template: z19.boolean().optional().describe("Preserve raw structural-template rendering semantics"),
|
|
6610
|
+
dry_run: z19.boolean().optional().describe(
|
|
6525
6611
|
"When true, only check what action would be taken without making changes"
|
|
6526
6612
|
)
|
|
6527
6613
|
},
|
|
6528
6614
|
promotePrompt: {
|
|
6529
|
-
source_prompt_id:
|
|
6530
|
-
target_collection_id:
|
|
6531
|
-
target_name:
|
|
6615
|
+
source_prompt_id: z19.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
|
|
6616
|
+
target_collection_id: z19.string().describe("Target collection ID for the promoted prompt"),
|
|
6617
|
+
target_name: z19.string().optional().describe(
|
|
6532
6618
|
"Target prompt name (defaults to source name with env suffix replaced)"
|
|
6533
6619
|
),
|
|
6534
6620
|
target_env: PromptEnvironmentIdentifierSchema,
|
|
6535
|
-
virtual_key:
|
|
6621
|
+
virtual_key: z19.string().optional().describe(
|
|
6536
6622
|
"Virtual key ID to use (defaults to source prompt's virtual_key)"
|
|
6537
6623
|
)
|
|
6538
6624
|
},
|
|
6539
6625
|
validateCompletionMetadata: {
|
|
6540
|
-
client_id:
|
|
6626
|
+
client_id: z19.string().optional().describe("Client ID for billing attribution"),
|
|
6541
6627
|
app: PromptAppIdentifierSchema.optional(),
|
|
6542
6628
|
env: PromptEnvironmentIdentifierSchema.optional(),
|
|
6543
|
-
project_id:
|
|
6544
|
-
feature:
|
|
6629
|
+
project_id: z19.string().optional().describe("Project ID for granular billing"),
|
|
6630
|
+
feature: z19.string().optional().describe("Feature name for tracking")
|
|
6545
6631
|
},
|
|
6546
6632
|
getPromptVersion: {
|
|
6547
|
-
prompt_id:
|
|
6548
|
-
version_id:
|
|
6633
|
+
prompt_id: z19.string().describe("Prompt ID or slug"),
|
|
6634
|
+
version_id: z19.string().describe("Version UUID to retrieve")
|
|
6549
6635
|
},
|
|
6550
6636
|
updatePromptVersion: {
|
|
6551
|
-
prompt_id:
|
|
6552
|
-
version_id:
|
|
6553
|
-
label_id:
|
|
6637
|
+
prompt_id: z19.string().describe("Prompt ID or slug"),
|
|
6638
|
+
version_id: z19.string().describe("Version UUID to update"),
|
|
6639
|
+
label_id: z19.string().nullable().describe(
|
|
6554
6640
|
"Label ID to assign to this version, or null to remove the label"
|
|
6555
6641
|
)
|
|
6556
6642
|
}
|
|
6557
6643
|
};
|
|
6558
|
-
var createPromptSchema =
|
|
6644
|
+
var createPromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.createPrompt).superRefine((value, ctx) => {
|
|
6559
6645
|
if (!value.model && !value.ai_model_id && !value.finetune_id) {
|
|
6560
6646
|
ctx.addIssue({
|
|
6561
|
-
code:
|
|
6647
|
+
code: z19.ZodIssueCode.custom,
|
|
6562
6648
|
message: "At least one of model, ai_model_id, or finetune_id must be provided"
|
|
6563
6649
|
});
|
|
6564
6650
|
}
|
|
6565
6651
|
if (value.string === void 0 && value.messages === void 0) {
|
|
6566
6652
|
ctx.addIssue({
|
|
6567
|
-
code:
|
|
6653
|
+
code: z19.ZodIssueCode.custom,
|
|
6568
6654
|
message: "Provide either string or messages"
|
|
6569
6655
|
});
|
|
6570
6656
|
}
|
|
6571
6657
|
});
|
|
6572
|
-
var migratePromptSchema =
|
|
6658
|
+
var migratePromptSchema = z19.object(PROMPTS_TOOL_SCHEMAS.migratePrompt).superRefine((value, ctx) => {
|
|
6573
6659
|
if (value.string === void 0 && value.messages === void 0) {
|
|
6574
6660
|
ctx.addIssue({
|
|
6575
|
-
code:
|
|
6661
|
+
code: z19.ZodIssueCode.custom,
|
|
6576
6662
|
message: "Provide either string or messages"
|
|
6577
6663
|
});
|
|
6578
6664
|
}
|
|
@@ -7025,70 +7111,70 @@ function registerPromptsTools(server, service) {
|
|
|
7025
7111
|
}
|
|
7026
7112
|
|
|
7027
7113
|
// src/tools/providers.tools.ts
|
|
7028
|
-
import { z as
|
|
7114
|
+
import { z as z20 } from "zod";
|
|
7029
7115
|
var PROVIDERS_TOOL_SCHEMAS = {
|
|
7030
7116
|
listProviders: {
|
|
7031
7117
|
current_page: CurrentPageSchema,
|
|
7032
7118
|
page_size: PageSizeSchema.describe(
|
|
7033
7119
|
"Number of results per page (max 100, default 50)"
|
|
7034
7120
|
),
|
|
7035
|
-
workspace_id:
|
|
7121
|
+
workspace_id: z20.string().optional().describe(
|
|
7036
7122
|
"Workspace ID - required when using organization admin keys, optional with workspace API keys"
|
|
7037
7123
|
)
|
|
7038
7124
|
},
|
|
7039
7125
|
createProvider: {
|
|
7040
|
-
name:
|
|
7041
|
-
integration_id:
|
|
7126
|
+
name: z20.string().describe("Display name for the provider"),
|
|
7127
|
+
integration_id: z20.string().describe(
|
|
7042
7128
|
"Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
|
|
7043
7129
|
),
|
|
7044
|
-
workspace_id:
|
|
7130
|
+
workspace_id: z20.string().optional().describe(
|
|
7045
7131
|
"Workspace ID - required when using organization admin API keys"
|
|
7046
7132
|
),
|
|
7047
|
-
slug:
|
|
7133
|
+
slug: z20.string().optional().describe(
|
|
7048
7134
|
"Custom slug for the provider. Auto-generated with random suffix if omitted"
|
|
7049
7135
|
),
|
|
7050
|
-
note:
|
|
7051
|
-
credit_limit:
|
|
7052
|
-
alert_threshold:
|
|
7053
|
-
usage_limit_type:
|
|
7136
|
+
note: z20.string().optional().describe("Optional note or description for the provider"),
|
|
7137
|
+
credit_limit: z20.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
7138
|
+
alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
7139
|
+
usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
|
|
7054
7140
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
7055
7141
|
),
|
|
7056
|
-
periodic_reset:
|
|
7142
|
+
periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
|
|
7057
7143
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
7058
7144
|
),
|
|
7059
|
-
rate_limit_value:
|
|
7060
|
-
rate_limit_unit:
|
|
7145
|
+
rate_limit_value: z20.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
|
|
7146
|
+
rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
7061
7147
|
"Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
|
|
7062
7148
|
),
|
|
7063
|
-
expires_at:
|
|
7149
|
+
expires_at: z20.string().optional().describe("Expiration date in ISO 8601 format")
|
|
7064
7150
|
},
|
|
7065
7151
|
getProvider: {
|
|
7066
|
-
slug:
|
|
7067
|
-
workspace_id:
|
|
7152
|
+
slug: z20.string().describe("The unique slug identifier of the provider to retrieve"),
|
|
7153
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
7068
7154
|
},
|
|
7069
7155
|
updateProvider: {
|
|
7070
|
-
slug:
|
|
7071
|
-
workspace_id:
|
|
7072
|
-
name:
|
|
7073
|
-
note:
|
|
7074
|
-
credit_limit:
|
|
7075
|
-
alert_threshold:
|
|
7076
|
-
usage_limit_type:
|
|
7156
|
+
slug: z20.string().describe("The slug of the provider to update"),
|
|
7157
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys"),
|
|
7158
|
+
name: z20.string().optional().describe("New display name for the provider"),
|
|
7159
|
+
note: z20.string().optional().describe("New note or description for the provider"),
|
|
7160
|
+
credit_limit: z20.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
7161
|
+
alert_threshold: z20.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
7162
|
+
usage_limit_type: z20.enum(["cost", "tokens"]).optional().describe(
|
|
7077
7163
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
7078
7164
|
),
|
|
7079
|
-
periodic_reset:
|
|
7165
|
+
periodic_reset: z20.enum(["monthly", "weekly"]).optional().describe(
|
|
7080
7166
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
7081
7167
|
),
|
|
7082
|
-
rate_limit_value:
|
|
7083
|
-
rate_limit_unit:
|
|
7168
|
+
rate_limit_value: z20.coerce.number().positive().optional().describe("New rate limit value"),
|
|
7169
|
+
rate_limit_unit: z20.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
7084
7170
|
"Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
|
|
7085
7171
|
),
|
|
7086
|
-
expires_at:
|
|
7087
|
-
reset_usage:
|
|
7172
|
+
expires_at: z20.string().optional().describe("New expiration date in ISO 8601 format"),
|
|
7173
|
+
reset_usage: z20.boolean().optional().describe("Set to true to reset accumulated usage metrics")
|
|
7088
7174
|
},
|
|
7089
7175
|
deleteProvider: {
|
|
7090
|
-
slug:
|
|
7091
|
-
workspace_id:
|
|
7176
|
+
slug: z20.string().describe("The slug of the provider to delete"),
|
|
7177
|
+
workspace_id: z20.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
7092
7178
|
}
|
|
7093
7179
|
};
|
|
7094
7180
|
function registerProvidersTools(server, service) {
|
|
@@ -7235,73 +7321,73 @@ function registerProvidersTools(server, service) {
|
|
|
7235
7321
|
}
|
|
7236
7322
|
|
|
7237
7323
|
// src/tools/secret-references.tools.ts
|
|
7238
|
-
import { z as
|
|
7324
|
+
import { z as z21 } from "zod";
|
|
7239
7325
|
var authFields = {
|
|
7240
|
-
aws_auth_type:
|
|
7326
|
+
aws_auth_type: z21.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
|
|
7241
7327
|
"AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
|
|
7242
7328
|
),
|
|
7243
|
-
aws_access_key_id:
|
|
7244
|
-
aws_secret_access_key:
|
|
7329
|
+
aws_access_key_id: z21.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
|
|
7330
|
+
aws_secret_access_key: z21.string().min(1).describe(
|
|
7245
7331
|
"AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
|
|
7246
7332
|
),
|
|
7247
|
-
aws_region:
|
|
7248
|
-
aws_role_arn:
|
|
7333
|
+
aws_region: z21.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
|
|
7334
|
+
aws_role_arn: z21.string().min(1).describe(
|
|
7249
7335
|
"IAM role ARN to assume; required when aws_auth_type is assumedRole"
|
|
7250
7336
|
),
|
|
7251
|
-
aws_external_id:
|
|
7252
|
-
azure_auth_mode:
|
|
7337
|
+
aws_external_id: z21.string().nullable().describe("Optional external ID required by the target IAM role"),
|
|
7338
|
+
azure_auth_mode: z21.enum(["entra", "managed", "default"]).describe(
|
|
7253
7339
|
"Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
|
|
7254
7340
|
),
|
|
7255
|
-
azure_entra_tenant_id:
|
|
7256
|
-
azure_entra_client_id:
|
|
7341
|
+
azure_entra_tenant_id: z21.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
|
|
7342
|
+
azure_entra_client_id: z21.string().min(1).describe(
|
|
7257
7343
|
"Microsoft Entra application client ID; required for entra authentication"
|
|
7258
7344
|
),
|
|
7259
|
-
azure_entra_client_secret:
|
|
7345
|
+
azure_entra_client_secret: z21.string().min(1).describe(
|
|
7260
7346
|
"Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
|
|
7261
7347
|
),
|
|
7262
|
-
azure_managed_client_id:
|
|
7348
|
+
azure_managed_client_id: z21.string().min(1).describe(
|
|
7263
7349
|
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
7264
7350
|
),
|
|
7265
|
-
azure_vault_url:
|
|
7351
|
+
azure_vault_url: z21.url().describe(
|
|
7266
7352
|
"Azure Key Vault URL, for example https://example.vault.azure.net"
|
|
7267
7353
|
),
|
|
7268
|
-
vault_auth_type:
|
|
7354
|
+
vault_auth_type: z21.enum(["token", "approle", "kubernetes"]).describe(
|
|
7269
7355
|
"HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
|
|
7270
7356
|
),
|
|
7271
|
-
vault_addr:
|
|
7272
|
-
vault_token:
|
|
7357
|
+
vault_addr: z21.url().describe("Base URL of the HashiCorp Vault server"),
|
|
7358
|
+
vault_token: z21.string().min(1).describe(
|
|
7273
7359
|
"HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
|
|
7274
7360
|
),
|
|
7275
|
-
vault_namespace:
|
|
7276
|
-
vault_role_id:
|
|
7361
|
+
vault_namespace: z21.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
7362
|
+
vault_role_id: z21.string().min(1).describe(
|
|
7277
7363
|
"HashiCorp Vault AppRole role ID; required for approle authentication"
|
|
7278
7364
|
),
|
|
7279
|
-
vault_secret_id:
|
|
7365
|
+
vault_secret_id: z21.string().min(1).describe(
|
|
7280
7366
|
"HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
|
|
7281
7367
|
),
|
|
7282
|
-
vault_role:
|
|
7368
|
+
vault_role: z21.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
|
|
7283
7369
|
};
|
|
7284
|
-
var authConfigSchema =
|
|
7285
|
-
|
|
7286
|
-
aws_auth_type:
|
|
7370
|
+
var authConfigSchema = z21.union([
|
|
7371
|
+
z21.object({
|
|
7372
|
+
aws_auth_type: z21.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
|
|
7287
7373
|
aws_access_key_id: authFields.aws_access_key_id,
|
|
7288
7374
|
aws_secret_access_key: authFields.aws_secret_access_key,
|
|
7289
7375
|
aws_region: authFields.aws_region
|
|
7290
7376
|
}).strict(),
|
|
7291
|
-
|
|
7292
|
-
aws_auth_type:
|
|
7377
|
+
z21.object({
|
|
7378
|
+
aws_auth_type: z21.literal("assumedRole").describe("Assume the specified AWS IAM role"),
|
|
7293
7379
|
aws_role_arn: authFields.aws_role_arn,
|
|
7294
7380
|
aws_external_id: authFields.aws_external_id.optional(),
|
|
7295
7381
|
aws_region: authFields.aws_region
|
|
7296
7382
|
}).strict(),
|
|
7297
|
-
|
|
7298
|
-
aws_auth_type:
|
|
7299
|
-
aws_region:
|
|
7383
|
+
z21.object({
|
|
7384
|
+
aws_auth_type: z21.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
|
|
7385
|
+
aws_region: z21.string().optional().describe(
|
|
7300
7386
|
"Optional AWS region containing the secret, for example us-east-1"
|
|
7301
7387
|
)
|
|
7302
7388
|
}).strict(),
|
|
7303
|
-
|
|
7304
|
-
azure_auth_mode:
|
|
7389
|
+
z21.object({
|
|
7390
|
+
azure_auth_mode: z21.literal("entra").describe(
|
|
7305
7391
|
"Authenticate with a Microsoft Entra application client secret"
|
|
7306
7392
|
),
|
|
7307
7393
|
azure_entra_tenant_id: authFields.azure_entra_tenant_id,
|
|
@@ -7309,30 +7395,30 @@ var authConfigSchema = z20.union([
|
|
|
7309
7395
|
azure_entra_client_secret: authFields.azure_entra_client_secret,
|
|
7310
7396
|
azure_vault_url: authFields.azure_vault_url
|
|
7311
7397
|
}).strict(),
|
|
7312
|
-
|
|
7313
|
-
azure_auth_mode:
|
|
7398
|
+
z21.object({
|
|
7399
|
+
azure_auth_mode: z21.literal("managed").describe("Authenticate with an Azure managed identity"),
|
|
7314
7400
|
azure_managed_client_id: authFields.azure_managed_client_id.optional(),
|
|
7315
7401
|
azure_vault_url: authFields.azure_vault_url
|
|
7316
7402
|
}).strict(),
|
|
7317
|
-
|
|
7318
|
-
azure_auth_mode:
|
|
7403
|
+
z21.object({
|
|
7404
|
+
azure_auth_mode: z21.literal("default").describe("Use Azure's default runtime credential chain"),
|
|
7319
7405
|
azure_vault_url: authFields.azure_vault_url
|
|
7320
7406
|
}).strict(),
|
|
7321
|
-
|
|
7322
|
-
vault_auth_type:
|
|
7407
|
+
z21.object({
|
|
7408
|
+
vault_auth_type: z21.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
|
|
7323
7409
|
vault_addr: authFields.vault_addr,
|
|
7324
7410
|
vault_token: authFields.vault_token,
|
|
7325
7411
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7326
7412
|
}).strict(),
|
|
7327
|
-
|
|
7328
|
-
vault_auth_type:
|
|
7413
|
+
z21.object({
|
|
7414
|
+
vault_auth_type: z21.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
|
|
7329
7415
|
vault_addr: authFields.vault_addr,
|
|
7330
7416
|
vault_role_id: authFields.vault_role_id,
|
|
7331
7417
|
vault_secret_id: authFields.vault_secret_id,
|
|
7332
7418
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7333
7419
|
}).strict(),
|
|
7334
|
-
|
|
7335
|
-
vault_auth_type:
|
|
7420
|
+
z21.object({
|
|
7421
|
+
vault_auth_type: z21.literal("kubernetes").describe(
|
|
7336
7422
|
"Authenticate to HashiCorp Vault with a Kubernetes service account"
|
|
7337
7423
|
),
|
|
7338
7424
|
vault_addr: authFields.vault_addr,
|
|
@@ -7340,61 +7426,61 @@ var authConfigSchema = z20.union([
|
|
|
7340
7426
|
vault_namespace: authFields.vault_namespace.optional()
|
|
7341
7427
|
}).strict()
|
|
7342
7428
|
]);
|
|
7343
|
-
var updateAuthConfigSchema =
|
|
7344
|
-
|
|
7429
|
+
var updateAuthConfigSchema = z21.union([
|
|
7430
|
+
z21.object({
|
|
7345
7431
|
aws_auth_type: authFields.aws_auth_type.optional(),
|
|
7346
7432
|
aws_access_key_id: authFields.aws_access_key_id.optional(),
|
|
7347
7433
|
aws_secret_access_key: authFields.aws_secret_access_key.optional(),
|
|
7348
|
-
aws_region:
|
|
7434
|
+
aws_region: z21.string().optional().describe("AWS region containing the secret, for example us-east-1"),
|
|
7349
7435
|
aws_role_arn: authFields.aws_role_arn.optional(),
|
|
7350
7436
|
aws_external_id: authFields.aws_external_id.optional()
|
|
7351
7437
|
}).strict(),
|
|
7352
|
-
|
|
7438
|
+
z21.object({
|
|
7353
7439
|
azure_auth_mode: authFields.azure_auth_mode.optional(),
|
|
7354
7440
|
azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
|
|
7355
7441
|
azure_entra_client_id: authFields.azure_entra_client_id.optional(),
|
|
7356
7442
|
azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
|
|
7357
|
-
azure_managed_client_id:
|
|
7443
|
+
azure_managed_client_id: z21.string().optional().describe(
|
|
7358
7444
|
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
7359
7445
|
),
|
|
7360
7446
|
azure_vault_url: authFields.azure_vault_url.optional()
|
|
7361
7447
|
}).strict(),
|
|
7362
|
-
|
|
7448
|
+
z21.object({
|
|
7363
7449
|
vault_auth_type: authFields.vault_auth_type.optional(),
|
|
7364
7450
|
vault_addr: authFields.vault_addr.optional(),
|
|
7365
7451
|
vault_token: authFields.vault_token.optional(),
|
|
7366
|
-
vault_namespace:
|
|
7452
|
+
vault_namespace: z21.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
7367
7453
|
vault_role_id: authFields.vault_role_id.optional(),
|
|
7368
7454
|
vault_secret_id: authFields.vault_secret_id.optional(),
|
|
7369
7455
|
vault_role: authFields.vault_role.optional()
|
|
7370
7456
|
}).strict()
|
|
7371
7457
|
]);
|
|
7372
|
-
var managerTypeSchema =
|
|
7458
|
+
var managerTypeSchema = z21.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
|
|
7373
7459
|
"External secret manager: aws_sm for AWS Secrets Manager, azure_kv for Azure Key Vault, or hashicorp_vault for HashiCorp Vault; must match the auth_config field family"
|
|
7374
7460
|
);
|
|
7375
|
-
var tagsSchema =
|
|
7461
|
+
var tagsSchema = z21.record(z21.string(), z21.string()).describe("Tag filters or metadata as string key-value pairs");
|
|
7376
7462
|
var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
7377
7463
|
create: {
|
|
7378
|
-
name:
|
|
7464
|
+
name: z21.string().min(1).max(255).describe("Human-readable name"),
|
|
7379
7465
|
manager_type: managerTypeSchema,
|
|
7380
7466
|
auth_config: authConfigSchema.describe(
|
|
7381
7467
|
"Choose exactly one documented authentication shape matching manager_type. Credentials are sent to Portkey and visible in the MCP transcript; prefer workload identity or short-lived credentials when available."
|
|
7382
7468
|
),
|
|
7383
|
-
secret_path:
|
|
7384
|
-
organisation_id:
|
|
7469
|
+
secret_path: z21.string().max(1024).describe("Path of the secret in the external secret manager"),
|
|
7470
|
+
organisation_id: z21.string().uuid().optional().describe(
|
|
7385
7471
|
"Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
|
|
7386
7472
|
),
|
|
7387
|
-
slug:
|
|
7473
|
+
slug: z21.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
|
|
7388
7474
|
"Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
|
|
7389
7475
|
),
|
|
7390
|
-
description:
|
|
7391
|
-
secret_key:
|
|
7476
|
+
description: z21.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
|
|
7477
|
+
secret_key: z21.string().max(255).nullable().optional().describe(
|
|
7392
7478
|
"Optional key within a structured external secret; null uses the whole secret value"
|
|
7393
7479
|
),
|
|
7394
|
-
allow_all_workspaces:
|
|
7480
|
+
allow_all_workspaces: z21.boolean().optional().describe(
|
|
7395
7481
|
"Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
|
|
7396
7482
|
),
|
|
7397
|
-
allowed_workspaces:
|
|
7483
|
+
allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
|
|
7398
7484
|
"Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
|
|
7399
7485
|
),
|
|
7400
7486
|
tags: tagsSchema.nullable().optional().describe(
|
|
@@ -7406,7 +7492,7 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7406
7492
|
"Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
|
|
7407
7493
|
),
|
|
7408
7494
|
tags: tagsSchema.optional().describe("Return references matching these tags"),
|
|
7409
|
-
search:
|
|
7495
|
+
search: z21.string().min(1).max(255).optional().describe("Search references by name"),
|
|
7410
7496
|
current_page: CurrentPageSchema.describe(
|
|
7411
7497
|
"Zero-based page number; defaults to 0"
|
|
7412
7498
|
),
|
|
@@ -7415,29 +7501,29 @@ var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
|
7415
7501
|
)
|
|
7416
7502
|
},
|
|
7417
7503
|
get: {
|
|
7418
|
-
id:
|
|
7504
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug")
|
|
7419
7505
|
},
|
|
7420
7506
|
update: {
|
|
7421
|
-
id:
|
|
7422
|
-
name:
|
|
7423
|
-
description:
|
|
7507
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug"),
|
|
7508
|
+
name: z21.string().min(1).max(255).optional().describe("New human-readable name"),
|
|
7509
|
+
description: z21.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
|
|
7424
7510
|
auth_config: updateAuthConfigSchema.optional().describe(
|
|
7425
7511
|
"Provide at least one changed authentication field to merge into the existing configuration; choose one AWS, Azure, or HashiCorp field family and do not mix families"
|
|
7426
7512
|
),
|
|
7427
|
-
secret_path:
|
|
7428
|
-
secret_key:
|
|
7513
|
+
secret_path: z21.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
|
|
7514
|
+
secret_key: z21.string().max(255).nullable().optional().describe(
|
|
7429
7515
|
"New key within a structured secret, or null to use the whole value"
|
|
7430
7516
|
),
|
|
7431
|
-
allow_all_workspaces:
|
|
7517
|
+
allow_all_workspaces: z21.boolean().optional().describe(
|
|
7432
7518
|
"Whether every workspace may use this reference; cannot be true with allowed_workspaces"
|
|
7433
7519
|
),
|
|
7434
|
-
allowed_workspaces:
|
|
7520
|
+
allowed_workspaces: z21.array(z21.string()).min(1).optional().describe(
|
|
7435
7521
|
"Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
|
|
7436
7522
|
),
|
|
7437
7523
|
tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
|
|
7438
7524
|
},
|
|
7439
7525
|
delete: {
|
|
7440
|
-
id:
|
|
7526
|
+
id: z21.string().min(1).describe("Secret Reference UUID or slug")
|
|
7441
7527
|
}
|
|
7442
7528
|
};
|
|
7443
7529
|
function validateWorkspaceAccess(value) {
|
|
@@ -7601,29 +7687,29 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7601
7687
|
}
|
|
7602
7688
|
|
|
7603
7689
|
// src/tools/tracing.tools.ts
|
|
7604
|
-
import { z as
|
|
7690
|
+
import { z as z22 } from "zod";
|
|
7605
7691
|
var TRACING_TOOL_SCHEMAS = {
|
|
7606
7692
|
createFeedback: {
|
|
7607
|
-
trace_id:
|
|
7693
|
+
trace_id: z22.string().describe(
|
|
7608
7694
|
"The trace ID to associate the feedback with. This links feedback to a specific request/generation."
|
|
7609
7695
|
),
|
|
7610
|
-
value:
|
|
7696
|
+
value: z22.coerce.number().describe(
|
|
7611
7697
|
"Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
|
|
7612
7698
|
),
|
|
7613
|
-
weight:
|
|
7699
|
+
weight: z22.coerce.number().positive().optional().describe(
|
|
7614
7700
|
"Optional weighting factor for the feedback. Use to give more importance to certain feedback."
|
|
7615
7701
|
),
|
|
7616
|
-
metadata:
|
|
7702
|
+
metadata: z22.record(z22.string(), z22.unknown()).optional().describe(
|
|
7617
7703
|
"Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
|
|
7618
7704
|
)
|
|
7619
7705
|
},
|
|
7620
7706
|
updateFeedback: {
|
|
7621
|
-
id:
|
|
7622
|
-
value:
|
|
7707
|
+
id: z22.string().describe("The unique identifier of the feedback to update"),
|
|
7708
|
+
value: z22.coerce.number().optional().describe(
|
|
7623
7709
|
"New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
|
|
7624
7710
|
),
|
|
7625
|
-
weight:
|
|
7626
|
-
metadata:
|
|
7711
|
+
weight: z22.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
|
|
7712
|
+
metadata: z22.record(z22.string(), z22.unknown()).optional().describe("New or updated custom metadata for the feedback")
|
|
7627
7713
|
}
|
|
7628
7714
|
};
|
|
7629
7715
|
function registerTracingTools(server, service) {
|
|
@@ -7665,82 +7751,82 @@ function registerTracingTools(server, service) {
|
|
|
7665
7751
|
}
|
|
7666
7752
|
|
|
7667
7753
|
// src/tools/users.tools.ts
|
|
7668
|
-
import { z as
|
|
7754
|
+
import { z as z23 } from "zod";
|
|
7669
7755
|
var USERS_TOOL_SCHEMAS = {
|
|
7670
7756
|
listAllUsers: {
|
|
7671
7757
|
current_page: CurrentPageSchema,
|
|
7672
7758
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7673
|
-
role:
|
|
7674
|
-
email:
|
|
7759
|
+
role: z23.enum(["admin", "member", "owner"]).optional().describe("Filter by organisation role"),
|
|
7760
|
+
email: z23.string().email().optional().describe("Filter by exact email")
|
|
7675
7761
|
},
|
|
7676
7762
|
inviteUser: {
|
|
7677
|
-
email:
|
|
7678
|
-
role:
|
|
7763
|
+
email: z23.string().email().describe("Email address of the user to invite"),
|
|
7764
|
+
role: z23.enum(["admin", "member"]).describe(
|
|
7679
7765
|
"Organization-level role: 'admin' for full access, 'member' for limited access"
|
|
7680
7766
|
),
|
|
7681
|
-
first_name:
|
|
7682
|
-
last_name:
|
|
7683
|
-
workspaces:
|
|
7684
|
-
|
|
7685
|
-
id:
|
|
7767
|
+
first_name: z23.string().optional().describe("User's first name"),
|
|
7768
|
+
last_name: z23.string().optional().describe("User's last name"),
|
|
7769
|
+
workspaces: z23.array(
|
|
7770
|
+
z23.object({
|
|
7771
|
+
id: z23.string().describe(
|
|
7686
7772
|
"Workspace ID/slug where the user will be granted access"
|
|
7687
7773
|
),
|
|
7688
|
-
role:
|
|
7774
|
+
role: z23.enum(["admin", "member", "manager"]).describe(
|
|
7689
7775
|
"Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
|
|
7690
7776
|
)
|
|
7691
7777
|
})
|
|
7692
7778
|
).describe(
|
|
7693
7779
|
"List of workspaces and corresponding roles to grant to the user"
|
|
7694
7780
|
),
|
|
7695
|
-
workspace_api_key_details:
|
|
7696
|
-
name:
|
|
7697
|
-
expiry:
|
|
7698
|
-
metadata:
|
|
7699
|
-
scopes:
|
|
7781
|
+
workspace_api_key_details: z23.object({
|
|
7782
|
+
name: z23.string().optional().describe("Name of the API key to be created"),
|
|
7783
|
+
expiry: z23.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
|
|
7784
|
+
metadata: z23.record(z23.string(), z23.string()).optional().describe("Additional metadata key-value pairs for the API key"),
|
|
7785
|
+
scopes: z23.array(z23.string()).describe("List of permission scopes for the API key")
|
|
7700
7786
|
}).optional().describe("Optional API key to be created for the user")
|
|
7701
7787
|
},
|
|
7702
7788
|
getUserStats: {
|
|
7703
|
-
time_of_generation_min:
|
|
7789
|
+
time_of_generation_min: z23.string().describe(
|
|
7704
7790
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
7705
7791
|
),
|
|
7706
|
-
time_of_generation_max:
|
|
7792
|
+
time_of_generation_max: z23.string().describe(
|
|
7707
7793
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
7708
7794
|
),
|
|
7709
|
-
total_units_min:
|
|
7710
|
-
total_units_max:
|
|
7711
|
-
cost_min:
|
|
7712
|
-
cost_max:
|
|
7713
|
-
status_code:
|
|
7714
|
-
virtual_keys:
|
|
7795
|
+
total_units_min: z23.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
|
|
7796
|
+
total_units_max: z23.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
|
|
7797
|
+
cost_min: z23.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
|
|
7798
|
+
cost_max: z23.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
7799
|
+
status_code: z23.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
|
|
7800
|
+
virtual_keys: z23.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
|
|
7715
7801
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)")
|
|
7716
7802
|
},
|
|
7717
7803
|
getUser: {
|
|
7718
|
-
user_id:
|
|
7804
|
+
user_id: z23.string().describe("The user ID to retrieve")
|
|
7719
7805
|
},
|
|
7720
7806
|
updateUser: {
|
|
7721
|
-
user_id:
|
|
7722
|
-
first_name:
|
|
7723
|
-
last_name:
|
|
7724
|
-
role:
|
|
7807
|
+
user_id: z23.string().describe("The user ID to update"),
|
|
7808
|
+
first_name: z23.string().optional().describe("New first name"),
|
|
7809
|
+
last_name: z23.string().optional().describe("New last name"),
|
|
7810
|
+
role: z23.enum(["admin", "member"]).optional().describe("New organization-level role")
|
|
7725
7811
|
},
|
|
7726
7812
|
deleteUser: {
|
|
7727
|
-
user_id:
|
|
7813
|
+
user_id: z23.string().describe("The user ID to delete")
|
|
7728
7814
|
},
|
|
7729
7815
|
listUserInvites: {
|
|
7730
7816
|
current_page: CurrentPageSchema,
|
|
7731
7817
|
page_size: PageSizeSchema.describe("Number of results per page (max 100)"),
|
|
7732
|
-
role:
|
|
7733
|
-
email:
|
|
7734
|
-
status:
|
|
7818
|
+
role: z23.enum(["admin", "member"]).optional().describe("Filter invitations by organisation role"),
|
|
7819
|
+
email: z23.string().email().optional().describe("Filter by invited email"),
|
|
7820
|
+
status: z23.enum(["pending", "cancelled", "accepted", "expired"]).optional().describe("Filter invitations by lifecycle status")
|
|
7735
7821
|
},
|
|
7736
7822
|
getUserInvite: {
|
|
7737
|
-
invite_id:
|
|
7823
|
+
invite_id: z23.string().describe("The invite ID to retrieve")
|
|
7738
7824
|
},
|
|
7739
7825
|
deleteUserInvite: {
|
|
7740
|
-
invite_id:
|
|
7826
|
+
invite_id: z23.string().describe("The invite ID to delete")
|
|
7741
7827
|
},
|
|
7742
7828
|
resendUserInvite: {
|
|
7743
|
-
invite_id:
|
|
7829
|
+
invite_id: z23.string().describe("The invite ID to resend")
|
|
7744
7830
|
}
|
|
7745
7831
|
};
|
|
7746
7832
|
function formatUser(user) {
|
|
@@ -7901,34 +7987,34 @@ function registerUsersTools(server, service) {
|
|
|
7901
7987
|
}
|
|
7902
7988
|
|
|
7903
7989
|
// src/tools/workspaces.tools.ts
|
|
7904
|
-
import { z as
|
|
7990
|
+
import { z as z24 } from "zod";
|
|
7905
7991
|
var scimWorkspaceMappingBaseShape = {
|
|
7906
|
-
workspace_id:
|
|
7907
|
-
role:
|
|
7992
|
+
workspace_id: z24.string().describe("Portkey workspace ID that the SCIM group should access"),
|
|
7993
|
+
role: z24.enum(["admin", "member", "manager"]).describe("Workspace role automatically granted to group members")
|
|
7908
7994
|
};
|
|
7909
7995
|
var createScimWorkspaceMappingShape = {
|
|
7910
7996
|
...scimWorkspaceMappingBaseShape,
|
|
7911
|
-
scim_group_id:
|
|
7997
|
+
scim_group_id: z24.string().min(1).optional().describe(
|
|
7912
7998
|
"Existing identity-provider SCIM group ID; provide this or scim_group_name, but not both"
|
|
7913
7999
|
),
|
|
7914
|
-
scim_group_name:
|
|
8000
|
+
scim_group_name: z24.string().min(1).optional().describe(
|
|
7915
8001
|
"Existing SCIM group display name; provide this or scim_group_id, but not both"
|
|
7916
8002
|
)
|
|
7917
8003
|
};
|
|
7918
|
-
var workspaceUsageLimitSchema =
|
|
7919
|
-
credit_limit:
|
|
7920
|
-
type:
|
|
7921
|
-
alert_threshold:
|
|
7922
|
-
periodic_reset:
|
|
7923
|
-
periodic_reset_days:
|
|
7924
|
-
next_usage_reset_at:
|
|
8004
|
+
var workspaceUsageLimitSchema = z24.object({
|
|
8005
|
+
credit_limit: z24.coerce.number().positive().optional().describe("Maximum cost or token usage for the workspace"),
|
|
8006
|
+
type: z24.enum(["cost", "tokens"]).optional().describe("Whether the limit measures cost or tokens"),
|
|
8007
|
+
alert_threshold: z24.coerce.number().positive().optional().describe("Percentage of the limit that triggers an alert"),
|
|
8008
|
+
periodic_reset: z24.enum(["monthly", "weekly"]).nullable().optional().describe("Built-in weekly or monthly reset cadence"),
|
|
8009
|
+
periodic_reset_days: z24.coerce.number().int().min(1).max(365).nullable().optional().describe("Custom reset cadence in days, from 1 through 365"),
|
|
8010
|
+
next_usage_reset_at: z24.iso.datetime({ offset: true }).nullable().optional().describe("Next reset timestamp in ISO 8601 format")
|
|
7925
8011
|
});
|
|
7926
|
-
var workspaceRateLimitSchema =
|
|
7927
|
-
type:
|
|
7928
|
-
unit:
|
|
7929
|
-
value:
|
|
8012
|
+
var workspaceRateLimitSchema = z24.object({
|
|
8013
|
+
type: z24.enum(["requests", "tokens"]).optional().describe("Whether the limit counts requests or tokens"),
|
|
8014
|
+
unit: z24.enum(["rpd", "rph", "rpm"]).optional().describe("Rate window: requests per day, hour, or minute"),
|
|
8015
|
+
value: z24.coerce.number().int().nonnegative().optional().describe("Maximum count in the selected rate window")
|
|
7930
8016
|
});
|
|
7931
|
-
var createScimWorkspaceMappingSchema =
|
|
8017
|
+
var createScimWorkspaceMappingSchema = z24.object(createScimWorkspaceMappingShape).superRefine((input, context) => {
|
|
7932
8018
|
if (Boolean(input.scim_group_id) === Boolean(input.scim_group_name)) {
|
|
7933
8019
|
context.addIssue({
|
|
7934
8020
|
code: "custom",
|
|
@@ -7943,99 +8029,99 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
7943
8029
|
"Number of workspaces to return per page (max 100)"
|
|
7944
8030
|
),
|
|
7945
8031
|
current_page: CurrentPageSchema,
|
|
7946
|
-
name:
|
|
7947
|
-
exact_name:
|
|
7948
|
-
status:
|
|
8032
|
+
name: z24.string().optional().describe("Case-sensitive name filter"),
|
|
8033
|
+
exact_name: z24.string().optional().describe("Exact workspace name filter"),
|
|
8034
|
+
status: z24.enum(["active", "archived"]).optional().describe("Filter by workspace lifecycle status")
|
|
7949
8035
|
},
|
|
7950
8036
|
getWorkspace: {
|
|
7951
|
-
workspace_id:
|
|
8037
|
+
workspace_id: z24.string().describe(
|
|
7952
8038
|
"The unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response"
|
|
7953
8039
|
)
|
|
7954
8040
|
},
|
|
7955
8041
|
createWorkspace: {
|
|
7956
|
-
name:
|
|
7957
|
-
slug:
|
|
7958
|
-
description:
|
|
7959
|
-
is_default:
|
|
7960
|
-
metadata:
|
|
7961
|
-
users:
|
|
7962
|
-
usage_limits:
|
|
7963
|
-
rate_limits:
|
|
8042
|
+
name: z24.string().describe("Name of the workspace"),
|
|
8043
|
+
slug: z24.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
|
|
8044
|
+
description: z24.string().optional().describe("Description of the workspace"),
|
|
8045
|
+
is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
8046
|
+
metadata: z24.record(z24.string(), z24.string()).optional().describe("Custom metadata key-value pairs"),
|
|
8047
|
+
users: z24.array(z24.string()).optional().describe("Existing user IDs to add"),
|
|
8048
|
+
usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Initial workspace usage-limit settings"),
|
|
8049
|
+
rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Initial workspace rate-limit settings")
|
|
7964
8050
|
},
|
|
7965
8051
|
updateWorkspace: {
|
|
7966
|
-
workspace_id:
|
|
7967
|
-
name:
|
|
7968
|
-
slug:
|
|
7969
|
-
description:
|
|
7970
|
-
is_default:
|
|
7971
|
-
metadata:
|
|
7972
|
-
input_guardrails:
|
|
7973
|
-
output_guardrails:
|
|
7974
|
-
user_api_key_config:
|
|
8052
|
+
workspace_id: z24.string().describe("The workspace ID to update"),
|
|
8053
|
+
name: z24.string().optional().describe("New name for the workspace"),
|
|
8054
|
+
slug: z24.string().optional().describe("New slug for the workspace"),
|
|
8055
|
+
description: z24.string().optional().describe("New description"),
|
|
8056
|
+
is_default: z24.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
8057
|
+
metadata: z24.record(z24.string(), z24.string()).optional().describe("New metadata key-value pairs"),
|
|
8058
|
+
input_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model inputs"),
|
|
8059
|
+
output_guardrails: z24.array(z24.string()).optional().describe("Guardrail IDs applied to workspace model outputs"),
|
|
8060
|
+
user_api_key_config: z24.string().nullable().optional().describe(
|
|
7975
8061
|
"Default config slug for workspace-user API keys, or null to clear"
|
|
7976
8062
|
),
|
|
7977
|
-
usage_limits:
|
|
7978
|
-
rate_limits:
|
|
8063
|
+
usage_limits: z24.array(workspaceUsageLimitSchema).optional().describe("Replacement workspace usage-limit settings"),
|
|
8064
|
+
rate_limits: z24.array(workspaceRateLimitSchema).optional().describe("Replacement workspace rate-limit settings")
|
|
7979
8065
|
},
|
|
7980
8066
|
deleteWorkspace: {
|
|
7981
|
-
workspace_id:
|
|
8067
|
+
workspace_id: z24.string().describe("The workspace ID to delete")
|
|
7982
8068
|
},
|
|
7983
8069
|
addWorkspaceMember: {
|
|
7984
|
-
workspace_id:
|
|
7985
|
-
user_id:
|
|
8070
|
+
workspace_id: z24.string().describe("The workspace ID to add the member to"),
|
|
8071
|
+
user_id: z24.string().uuid(
|
|
7986
8072
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
7987
8073
|
).describe(
|
|
7988
8074
|
"The user ID to add (must be a valid UUID from list_all_users, not an email address)"
|
|
7989
8075
|
),
|
|
7990
|
-
role:
|
|
8076
|
+
role: z24.enum(["admin", "member", "manager"]).describe("Role in the workspace")
|
|
7991
8077
|
},
|
|
7992
8078
|
listWorkspaceMembers: {
|
|
7993
|
-
workspace_id:
|
|
8079
|
+
workspace_id: z24.string().describe("The workspace ID to list members for"),
|
|
7994
8080
|
current_page: CurrentPageSchema.describe("Zero-based page number"),
|
|
7995
8081
|
page_size: PageSizeSchema.describe("Number of members per page"),
|
|
7996
|
-
role:
|
|
7997
|
-
email:
|
|
8082
|
+
role: z24.enum(["admin", "manager", "member"]).optional().describe("Filter by workspace role"),
|
|
8083
|
+
email: z24.string().email().optional().describe("Filter by member email")
|
|
7998
8084
|
},
|
|
7999
8085
|
getWorkspaceMember: {
|
|
8000
|
-
workspace_id:
|
|
8001
|
-
user_id:
|
|
8086
|
+
workspace_id: z24.string().describe("The workspace ID"),
|
|
8087
|
+
user_id: z24.string().uuid(
|
|
8002
8088
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8003
8089
|
).describe(
|
|
8004
8090
|
"The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
|
|
8005
8091
|
)
|
|
8006
8092
|
},
|
|
8007
8093
|
updateWorkspaceMember: {
|
|
8008
|
-
workspace_id:
|
|
8009
|
-
user_id:
|
|
8094
|
+
workspace_id: z24.string().describe("The workspace ID"),
|
|
8095
|
+
user_id: z24.string().uuid(
|
|
8010
8096
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
8011
8097
|
).describe(
|
|
8012
8098
|
"The user ID to update (must be a valid UUID from list_all_users, not an email address)"
|
|
8013
8099
|
),
|
|
8014
|
-
role:
|
|
8100
|
+
role: z24.enum(["admin", "member", "manager"]).describe("New role in the workspace")
|
|
8015
8101
|
},
|
|
8016
8102
|
removeWorkspaceMember: {
|
|
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("The user ID to remove")
|
|
8021
8107
|
},
|
|
8022
8108
|
listScimWorkspaceMappings: {
|
|
8023
|
-
workspace_id:
|
|
8024
|
-
scim_group_id:
|
|
8109
|
+
workspace_id: z24.string().optional().describe("Return only mappings for this Portkey workspace ID"),
|
|
8110
|
+
scim_group_id: z24.string().optional().describe(
|
|
8025
8111
|
"Return only mappings for this identity-provider SCIM group ID"
|
|
8026
8112
|
),
|
|
8027
|
-
role:
|
|
8028
|
-
page:
|
|
8113
|
+
role: z24.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
|
|
8114
|
+
page: z24.coerce.number().int().nonnegative().optional().describe(
|
|
8029
8115
|
"Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
|
|
8030
8116
|
),
|
|
8031
8117
|
page_size: PageSizeSchema.describe("Mappings per page, from 1 through 100")
|
|
8032
8118
|
},
|
|
8033
8119
|
deleteScimWorkspaceMapping: {
|
|
8034
|
-
mapping_id:
|
|
8120
|
+
mapping_id: z24.string().describe("SCIM workspace mapping ID from list_scim_workspace_mappings")
|
|
8035
8121
|
},
|
|
8036
8122
|
listScimGroups: {
|
|
8037
|
-
search:
|
|
8038
|
-
page:
|
|
8123
|
+
search: z24.string().optional().describe("Case-insensitive text to match against SCIM group names"),
|
|
8124
|
+
page: z24.coerce.number().int().nonnegative().optional().describe(
|
|
8039
8125
|
"Zero-based results page to retrieve; the first page is 0. These SCIM tools name the parameter page, not the current_page used by other list tools."
|
|
8040
8126
|
),
|
|
8041
8127
|
page_size: PageSizeSchema.describe(
|
|
@@ -8426,6 +8512,9 @@ var ENTERPRISE_GATED_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
8426
8512
|
"get_analytics_group_models",
|
|
8427
8513
|
"get_analytics_group_metadata",
|
|
8428
8514
|
"get_analytics_group_providers",
|
|
8515
|
+
"get_analytics_group_mcp",
|
|
8516
|
+
"get_analytics_group_a2a",
|
|
8517
|
+
"get_analytics_group_workspaces",
|
|
8429
8518
|
"list_deployments",
|
|
8430
8519
|
"register_deployment",
|
|
8431
8520
|
"get_deployment",
|
|
@@ -8522,7 +8611,7 @@ function escapeRegExp(value) {
|
|
|
8522
8611
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8523
8612
|
}
|
|
8524
8613
|
function getToolErrorMessage(error) {
|
|
8525
|
-
if (error instanceof
|
|
8614
|
+
if (error instanceof z25.ZodError) {
|
|
8526
8615
|
return formatZodIssues(error);
|
|
8527
8616
|
}
|
|
8528
8617
|
if (error instanceof Error && error.message) {
|
|
@@ -8531,71 +8620,71 @@ function getToolErrorMessage(error) {
|
|
|
8531
8620
|
return String(error);
|
|
8532
8621
|
}
|
|
8533
8622
|
var STANDARD_TOOL_OUTPUT_SCHEMA = {
|
|
8534
|
-
ok:
|
|
8535
|
-
data:
|
|
8536
|
-
error:
|
|
8537
|
-
message:
|
|
8538
|
-
details:
|
|
8623
|
+
ok: z25.boolean().describe("Whether the tool call succeeded and returned structured data"),
|
|
8624
|
+
data: z25.unknown().optional().describe("Structured success payload when ok is true"),
|
|
8625
|
+
error: z25.object({
|
|
8626
|
+
message: z25.string().describe("Human-readable error message"),
|
|
8627
|
+
details: z25.unknown().optional().describe("Optional structured error details")
|
|
8539
8628
|
}).optional().describe("Structured error payload when ok is false")
|
|
8540
8629
|
};
|
|
8541
8630
|
var TOOL_SUCCESS_DATA_SCHEMAS = {
|
|
8542
|
-
rotate_api_key:
|
|
8543
|
-
message:
|
|
8544
|
-
warning:
|
|
8545
|
-
id:
|
|
8546
|
-
key:
|
|
8547
|
-
key_transition_expires_at:
|
|
8631
|
+
rotate_api_key: z25.object({
|
|
8632
|
+
message: z25.string().describe("Rotation confirmation"),
|
|
8633
|
+
warning: z25.string().describe("Required handling guidance for the one-time secret"),
|
|
8634
|
+
id: z25.string().uuid().describe("Rotated API key UUID"),
|
|
8635
|
+
key: z25.string().describe("New API key secret, returned only once"),
|
|
8636
|
+
key_transition_expires_at: z25.iso.datetime().describe("Time when the previous key stops working")
|
|
8548
8637
|
}),
|
|
8549
|
-
create_secret_reference:
|
|
8550
|
-
message:
|
|
8551
|
-
id:
|
|
8552
|
-
slug:
|
|
8638
|
+
create_secret_reference: z25.object({
|
|
8639
|
+
message: z25.string().describe("Creation confirmation"),
|
|
8640
|
+
id: z25.string().uuid().describe("New Secret Reference UUID"),
|
|
8641
|
+
slug: z25.string().describe("New Secret Reference slug")
|
|
8553
8642
|
}),
|
|
8554
|
-
list_secret_references:
|
|
8555
|
-
total:
|
|
8556
|
-
secret_references:
|
|
8557
|
-
|
|
8558
|
-
id:
|
|
8559
|
-
name:
|
|
8560
|
-
slug:
|
|
8643
|
+
list_secret_references: z25.object({
|
|
8644
|
+
total: z25.number().int().nonnegative().describe("Total matching references"),
|
|
8645
|
+
secret_references: z25.array(
|
|
8646
|
+
z25.object({
|
|
8647
|
+
id: z25.string().uuid().describe("Secret Reference UUID"),
|
|
8648
|
+
name: z25.string().describe("Human-readable name"),
|
|
8649
|
+
slug: z25.string().describe("Stable Secret Reference slug"),
|
|
8561
8650
|
manager_type: SecretManagerTypeSchema.describe(
|
|
8562
8651
|
"External secret manager type"
|
|
8563
8652
|
),
|
|
8564
|
-
status:
|
|
8565
|
-
created_at:
|
|
8566
|
-
last_updated_at:
|
|
8653
|
+
status: z25.literal("ACTIVE").describe("Current reference status"),
|
|
8654
|
+
created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8655
|
+
last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp")
|
|
8567
8656
|
})
|
|
8568
8657
|
).describe(
|
|
8569
8658
|
"Current page of Secret References without authentication values"
|
|
8570
8659
|
)
|
|
8571
8660
|
}),
|
|
8572
|
-
get_secret_reference:
|
|
8573
|
-
id:
|
|
8574
|
-
organisation_id:
|
|
8575
|
-
name:
|
|
8576
|
-
slug:
|
|
8577
|
-
description:
|
|
8661
|
+
get_secret_reference: z25.object({
|
|
8662
|
+
id: z25.string().uuid().describe("Secret Reference UUID"),
|
|
8663
|
+
organisation_id: z25.string().uuid().describe("Owning organisation UUID"),
|
|
8664
|
+
name: z25.string().describe("Human-readable name"),
|
|
8665
|
+
slug: z25.string().describe("Stable Secret Reference slug"),
|
|
8666
|
+
description: z25.string().nullable().describe("Reference description"),
|
|
8578
8667
|
manager_type: SecretManagerTypeSchema.describe(
|
|
8579
8668
|
"External secret manager type"
|
|
8580
8669
|
),
|
|
8581
|
-
secret_path:
|
|
8582
|
-
secret_key:
|
|
8583
|
-
allow_all_workspaces:
|
|
8584
|
-
tags:
|
|
8585
|
-
status:
|
|
8586
|
-
created_by:
|
|
8587
|
-
created_at:
|
|
8588
|
-
last_updated_at:
|
|
8589
|
-
auth_config:
|
|
8590
|
-
object:
|
|
8670
|
+
secret_path: z25.string().describe("Path in the external secret manager"),
|
|
8671
|
+
secret_key: z25.string().nullable().describe("Selected key within a structured secret"),
|
|
8672
|
+
allow_all_workspaces: z25.boolean().describe("Whether all workspaces may use the reference"),
|
|
8673
|
+
tags: z25.record(z25.string(), z25.string()).nullable().describe("String metadata tags"),
|
|
8674
|
+
status: z25.literal("ACTIVE").describe("Current reference status"),
|
|
8675
|
+
created_by: z25.string().describe("Creator identifier"),
|
|
8676
|
+
created_at: z25.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8677
|
+
last_updated_at: z25.iso.datetime().describe("ISO 8601 last-update timestamp"),
|
|
8678
|
+
auth_config: z25.record(z25.string(), z25.unknown()).describe("Authentication configuration with sensitive values redacted"),
|
|
8679
|
+
object: z25.literal("secret-reference").describe("Portkey object type")
|
|
8591
8680
|
}),
|
|
8592
|
-
update_secret_reference:
|
|
8593
|
-
message:
|
|
8594
|
-
success:
|
|
8681
|
+
update_secret_reference: z25.object({
|
|
8682
|
+
message: z25.string().describe("Update confirmation"),
|
|
8683
|
+
success: z25.literal(true).describe("Whether the update succeeded")
|
|
8595
8684
|
}),
|
|
8596
|
-
delete_secret_reference:
|
|
8597
|
-
message:
|
|
8598
|
-
success:
|
|
8685
|
+
delete_secret_reference: z25.object({
|
|
8686
|
+
message: z25.string().describe("Deletion confirmation"),
|
|
8687
|
+
success: z25.literal(true).describe("Whether the deletion succeeded")
|
|
8599
8688
|
})
|
|
8600
8689
|
};
|
|
8601
8690
|
function getToolOutputSchema(toolName) {
|
|
@@ -8671,7 +8760,7 @@ function wrapToolCallback(toolName, callback) {
|
|
|
8671
8760
|
return normalizeToolResult(await callback(...args));
|
|
8672
8761
|
} catch (error) {
|
|
8673
8762
|
const message = getToolErrorMessage(error);
|
|
8674
|
-
const isValidationError = error instanceof
|
|
8763
|
+
const isValidationError = error instanceof z25.ZodError;
|
|
8675
8764
|
const text = isValidationError ? `Invalid arguments for "${toolName}": ${message}` : `Tool "${toolName}" failed: ${message}`;
|
|
8676
8765
|
Logger.error("Tool callback failed", {
|
|
8677
8766
|
error: message,
|
|
@@ -8889,8 +8978,8 @@ function registerServerPromptsAndResources(server) {
|
|
|
8889
8978
|
title: "Plan Portkey Admin Workflow",
|
|
8890
8979
|
description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
|
|
8891
8980
|
argsSchema: {
|
|
8892
|
-
task:
|
|
8893
|
-
area:
|
|
8981
|
+
task: z26.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
|
|
8982
|
+
area: z26.string().max(80).optional().describe(
|
|
8894
8983
|
"Optional Portkey area, such as prompts, analytics, configs, or users"
|
|
8895
8984
|
)
|
|
8896
8985
|
}
|