portkey-admin-mcp 0.4.2 → 0.6.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/README.md +89 -34
- package/build/index.js +1243 -638
- package/build/server.js +2275 -845
- package/package.json +18 -14
package/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
// src/lib/mcp-server.ts
|
|
7
7
|
import { readFileSync } from "node:fs";
|
|
8
8
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
-
import { z as
|
|
9
|
+
import { z as z23 } from "zod";
|
|
10
10
|
|
|
11
11
|
// src/services/base.service.ts
|
|
12
12
|
import crypto from "node:crypto";
|
|
@@ -120,6 +120,7 @@ var Logger = {
|
|
|
120
120
|
// src/services/base.service.ts
|
|
121
121
|
var DEFAULT_BASE_URL = "https://api.portkey.ai/v1";
|
|
122
122
|
var PRIVATE_BASE_URL_OVERRIDE_HINT = "Set PORTKEY_ALLOW_PRIVATE_BASE_URL=true to allow self-hosted gateways on loopback or private networks.";
|
|
123
|
+
var INSECURE_HTTP_OVERRIDE_HINT = "Set PORTKEY_ALLOW_INSECURE_HTTP=true only for a trusted self-hosted gateway when TLS is unavailable.";
|
|
123
124
|
function isPrivateOrLocalHost(hostname) {
|
|
124
125
|
const host = hostname.trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
125
126
|
if (host === "localhost" || host.endsWith(".localhost")) {
|
|
@@ -186,6 +187,14 @@ function validateUrl(url) {
|
|
|
186
187
|
`Refusing to use a loopback or private-network PORTKEY_BASE_URL host: ${parsed.hostname}. ${PRIVATE_BASE_URL_OVERRIDE_HINT}`
|
|
187
188
|
);
|
|
188
189
|
}
|
|
190
|
+
const allowInsecureHttp = /^(1|true|yes)$/i.test(
|
|
191
|
+
process.env.PORTKEY_ALLOW_INSECURE_HTTP?.trim() ?? ""
|
|
192
|
+
);
|
|
193
|
+
if (parsed.protocol === "http:" && !allowInsecureHttp) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
`Refusing insecure HTTP PORTKEY_BASE_URL: ${parsed.origin}. ${INSECURE_HTTP_OVERRIDE_HINT}`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
189
198
|
}
|
|
190
199
|
var BaseService = class {
|
|
191
200
|
apiKey;
|
|
@@ -197,13 +206,9 @@ var BaseService = class {
|
|
|
197
206
|
throw new Error("PORTKEY_API_KEY environment variable is not set");
|
|
198
207
|
}
|
|
199
208
|
this.apiKey = apiKey;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const baseUrl = process.env.PORTKEY_BASE_URL ?? DEFAULT_BASE_URL;
|
|
204
|
-
validateUrl(baseUrl);
|
|
205
|
-
this.baseUrl = baseUrl;
|
|
206
|
-
}
|
|
209
|
+
const baseUrl = baseUrlOverride ?? process.env.PORTKEY_BASE_URL ?? DEFAULT_BASE_URL;
|
|
210
|
+
validateUrl(baseUrl);
|
|
211
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
207
212
|
}
|
|
208
213
|
encodePathSegment(value) {
|
|
209
214
|
return encodeURIComponent(value);
|
|
@@ -239,6 +244,7 @@ var BaseService = class {
|
|
|
239
244
|
try {
|
|
240
245
|
const response = await fetchWithTimeout(url, {
|
|
241
246
|
method,
|
|
247
|
+
redirect: "manual",
|
|
242
248
|
headers: this.buildHeaders(method),
|
|
243
249
|
body: this.serializeBody(options.body),
|
|
244
250
|
timeout: this.timeout
|
|
@@ -767,6 +773,12 @@ var KeysService = class extends BaseService {
|
|
|
767
773
|
await this.put(`/api-keys/${this.encodePathSegment(id)}`, data);
|
|
768
774
|
return { success: true };
|
|
769
775
|
}
|
|
776
|
+
async rotateApiKey(id, data = {}) {
|
|
777
|
+
return this.post(
|
|
778
|
+
`/api-keys/${this.encodePathSegment(id)}/rotate`,
|
|
779
|
+
data
|
|
780
|
+
);
|
|
781
|
+
}
|
|
770
782
|
async deleteApiKey(id) {
|
|
771
783
|
await this.delete(`/api-keys/${this.encodePathSegment(id)}`);
|
|
772
784
|
return { success: true };
|
|
@@ -1476,6 +1488,31 @@ var ProvidersService = class extends BaseService {
|
|
|
1476
1488
|
}
|
|
1477
1489
|
};
|
|
1478
1490
|
|
|
1491
|
+
// src/services/secret-references.service.ts
|
|
1492
|
+
var SecretReferencesService = class extends BaseService {
|
|
1493
|
+
async createSecretReference(data) {
|
|
1494
|
+
return this.post("/secret-references", data);
|
|
1495
|
+
}
|
|
1496
|
+
async listSecretReferences(params) {
|
|
1497
|
+
return this.get("/secret-references", params);
|
|
1498
|
+
}
|
|
1499
|
+
async getSecretReference(id) {
|
|
1500
|
+
return this.get(
|
|
1501
|
+
`/secret-references/${this.encodePathSegment(id)}`
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
async updateSecretReference(id, data) {
|
|
1505
|
+
return this.put(
|
|
1506
|
+
`/secret-references/${this.encodePathSegment(id)}`,
|
|
1507
|
+
data
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
async deleteSecretReference(id) {
|
|
1511
|
+
await this.delete(`/secret-references/${this.encodePathSegment(id)}`);
|
|
1512
|
+
return { success: true };
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1479
1516
|
// src/services/tracing.service.ts
|
|
1480
1517
|
var TracingService = class extends BaseService {
|
|
1481
1518
|
// Feedback endpoints
|
|
@@ -1626,8 +1663,9 @@ var WorkspacesService = class extends BaseService {
|
|
|
1626
1663
|
};
|
|
1627
1664
|
|
|
1628
1665
|
// src/services/index.ts
|
|
1629
|
-
import
|
|
1666
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
1630
1667
|
var MISSING_API_KEY_PLACEHOLDER = "__PORTKEY_API_KEY_NOT_CONFIGURED__";
|
|
1668
|
+
var SERVICE_CACHE_HMAC_KEY = randomBytes(32);
|
|
1631
1669
|
function resolvePortkeyApiKey(apiKey) {
|
|
1632
1670
|
const resolvedApiKey = apiKey ?? process.env.PORTKEY_API_KEY;
|
|
1633
1671
|
if (!resolvedApiKey) {
|
|
@@ -1641,7 +1679,7 @@ function resolveSharedPortkeyApiKey(apiKey) {
|
|
|
1641
1679
|
return apiKey ?? process.env.PORTKEY_API_KEY ?? MISSING_API_KEY_PLACEHOLDER;
|
|
1642
1680
|
}
|
|
1643
1681
|
function getSharedServiceCacheKey(apiKey) {
|
|
1644
|
-
const keyDigest =
|
|
1682
|
+
const keyDigest = createHmac("sha256", SERVICE_CACHE_HMAC_KEY).update(apiKey).digest("hex");
|
|
1645
1683
|
return JSON.stringify({
|
|
1646
1684
|
apiKey: keyDigest,
|
|
1647
1685
|
baseUrl: process.env.PORTKEY_BASE_URL?.trim() || ""
|
|
@@ -1665,6 +1703,7 @@ var PortkeyService = class {
|
|
|
1665
1703
|
tracing;
|
|
1666
1704
|
logging;
|
|
1667
1705
|
providers;
|
|
1706
|
+
secretReferences;
|
|
1668
1707
|
mcpIntegrations;
|
|
1669
1708
|
mcpServers;
|
|
1670
1709
|
health;
|
|
@@ -1691,6 +1730,10 @@ var PortkeyService = class {
|
|
|
1691
1730
|
this.tracing = new TracingService(resolvedApiKey, resolvedBaseUrl);
|
|
1692
1731
|
this.logging = new LoggingService(resolvedApiKey, resolvedBaseUrl);
|
|
1693
1732
|
this.providers = new ProvidersService(resolvedApiKey, resolvedBaseUrl);
|
|
1733
|
+
this.secretReferences = new SecretReferencesService(
|
|
1734
|
+
resolvedApiKey,
|
|
1735
|
+
resolvedBaseUrl
|
|
1736
|
+
);
|
|
1694
1737
|
this.mcpIntegrations = new McpIntegrationsService(
|
|
1695
1738
|
resolvedApiKey,
|
|
1696
1739
|
resolvedBaseUrl
|
|
@@ -1712,52 +1755,92 @@ function getSharedPortkeyService(apiKey) {
|
|
|
1712
1755
|
}
|
|
1713
1756
|
|
|
1714
1757
|
// src/tools/index.ts
|
|
1715
|
-
import { z as
|
|
1758
|
+
import { z as z22 } from "zod";
|
|
1716
1759
|
|
|
1717
1760
|
// src/lib/type-guards.ts
|
|
1718
1761
|
function isRecord(value) {
|
|
1719
1762
|
return typeof value === "object" && value !== null;
|
|
1720
1763
|
}
|
|
1721
1764
|
|
|
1722
|
-
// src/
|
|
1765
|
+
// src/schemas/contracts/secret-references.contract.ts
|
|
1723
1766
|
import { z } from "zod";
|
|
1767
|
+
var SecretManagerTypeSchema = z.enum([
|
|
1768
|
+
"aws_sm",
|
|
1769
|
+
"azure_kv",
|
|
1770
|
+
"hashicorp_vault"
|
|
1771
|
+
]);
|
|
1772
|
+
var SecretReferenceListItemSchema = z.object({
|
|
1773
|
+
id: z.string().uuid(),
|
|
1774
|
+
name: z.string(),
|
|
1775
|
+
slug: z.string(),
|
|
1776
|
+
manager_type: SecretManagerTypeSchema,
|
|
1777
|
+
status: z.literal("ACTIVE"),
|
|
1778
|
+
created_at: z.iso.datetime(),
|
|
1779
|
+
last_updated_at: z.iso.datetime(),
|
|
1780
|
+
object: z.literal("secret-reference")
|
|
1781
|
+
});
|
|
1782
|
+
var ListSecretReferencesResponseSchema = z.object({
|
|
1783
|
+
object: z.literal("list"),
|
|
1784
|
+
total: z.number().int().nonnegative(),
|
|
1785
|
+
data: z.array(SecretReferenceListItemSchema)
|
|
1786
|
+
});
|
|
1787
|
+
var SecretReferenceDetailSchema = SecretReferenceListItemSchema.extend(
|
|
1788
|
+
{
|
|
1789
|
+
organisation_id: z.string().uuid(),
|
|
1790
|
+
description: z.string().nullable(),
|
|
1791
|
+
secret_path: z.string(),
|
|
1792
|
+
secret_key: z.string().nullable(),
|
|
1793
|
+
allow_all_workspaces: z.boolean(),
|
|
1794
|
+
tags: z.record(z.string(), z.string()).nullable(),
|
|
1795
|
+
created_by: z.string(),
|
|
1796
|
+
auth_config: z.record(z.string(), z.unknown())
|
|
1797
|
+
}
|
|
1798
|
+
);
|
|
1799
|
+
var CreateSecretReferenceResponseSchema = z.object({
|
|
1800
|
+
id: z.string().uuid(),
|
|
1801
|
+
slug: z.string(),
|
|
1802
|
+
object: z.literal("secret-reference")
|
|
1803
|
+
});
|
|
1804
|
+
|
|
1805
|
+
// src/tools/analytics.tools.ts
|
|
1806
|
+
import { z as z2 } from "zod";
|
|
1724
1807
|
var baseAnalyticsSchema = {
|
|
1725
|
-
time_of_generation_min:
|
|
1808
|
+
time_of_generation_min: z2.string().describe(
|
|
1726
1809
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
1727
1810
|
),
|
|
1728
|
-
time_of_generation_max:
|
|
1811
|
+
time_of_generation_max: z2.string().describe(
|
|
1729
1812
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
1730
1813
|
),
|
|
1731
|
-
total_units_min:
|
|
1732
|
-
total_units_max:
|
|
1733
|
-
cost_min:
|
|
1734
|
-
cost_max:
|
|
1735
|
-
prompt_token_min:
|
|
1736
|
-
prompt_token_max:
|
|
1737
|
-
completion_token_min:
|
|
1738
|
-
completion_token_max:
|
|
1739
|
-
status_code:
|
|
1814
|
+
total_units_min: z2.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
|
|
1815
|
+
total_units_max: z2.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
|
|
1816
|
+
cost_min: z2.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
|
|
1817
|
+
cost_max: z2.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
1818
|
+
prompt_token_min: z2.coerce.number().positive().optional().describe("Minimum number of prompt tokens"),
|
|
1819
|
+
prompt_token_max: z2.coerce.number().positive().optional().describe("Maximum number of prompt tokens"),
|
|
1820
|
+
completion_token_min: z2.coerce.number().positive().optional().describe("Minimum number of completion tokens"),
|
|
1821
|
+
completion_token_max: z2.coerce.number().positive().optional().describe("Maximum number of completion tokens"),
|
|
1822
|
+
status_code: z2.string().optional().describe(
|
|
1740
1823
|
"Legacy Portkey query param for HTTP status codes. Comma-separated string; prefer status_codes for structured inputs."
|
|
1741
1824
|
),
|
|
1742
|
-
weighted_feedback_min:
|
|
1743
|
-
weighted_feedback_max:
|
|
1744
|
-
virtual_keys:
|
|
1825
|
+
weighted_feedback_min: z2.coerce.number().min(-10).max(10).optional().describe("Minimum weighted feedback score (-10 to 10)"),
|
|
1826
|
+
weighted_feedback_max: z2.coerce.number().min(-10).max(10).optional().describe("Maximum weighted feedback score (-10 to 10)"),
|
|
1827
|
+
virtual_keys: z2.string().optional().describe(
|
|
1745
1828
|
"Legacy Portkey query param for virtual key slugs. Comma-separated string; prefer virtual_key_slugs for structured inputs."
|
|
1746
1829
|
),
|
|
1747
|
-
configs:
|
|
1830
|
+
configs: z2.string().optional().describe(
|
|
1748
1831
|
"Legacy Portkey query param for config slugs. Comma-separated string; prefer config_slugs for structured inputs."
|
|
1749
1832
|
),
|
|
1750
|
-
status_codes:
|
|
1833
|
+
status_codes: z2.array(z2.string()).optional().describe(
|
|
1751
1834
|
"Structured alias for status_code. Use an array of HTTP status codes; normalized to the legacy comma-separated Portkey query param."
|
|
1752
1835
|
),
|
|
1753
|
-
virtual_key_slugs:
|
|
1836
|
+
virtual_key_slugs: z2.array(z2.string()).optional().describe(
|
|
1754
1837
|
"Structured alias for virtual_keys. Use an array of virtual key slugs; normalized to the legacy comma-separated Portkey query param."
|
|
1755
1838
|
),
|
|
1756
|
-
config_slugs:
|
|
1839
|
+
config_slugs: z2.array(z2.string()).optional().describe(
|
|
1757
1840
|
"Structured alias for configs. Use an array of config slugs; normalized to the legacy comma-separated Portkey query param."
|
|
1758
1841
|
),
|
|
1759
|
-
workspace_slug:
|
|
1760
|
-
api_key_ids:
|
|
1842
|
+
workspace_slug: z2.string().optional().describe("Filter by specific workspace"),
|
|
1843
|
+
api_key_ids: z2.preprocess((value) => {
|
|
1761
1844
|
if (value == null) {
|
|
1762
1845
|
return value;
|
|
1763
1846
|
}
|
|
@@ -1765,43 +1848,43 @@ var baseAnalyticsSchema = {
|
|
|
1765
1848
|
return value.map((item) => String(item)).join(",");
|
|
1766
1849
|
}
|
|
1767
1850
|
return value;
|
|
1768
|
-
},
|
|
1851
|
+
}, z2.string().optional()).describe(
|
|
1769
1852
|
"Legacy Portkey query param for API key UUIDs. Comma-separated string; request_analytics also accepts an array and normalizes it to this form."
|
|
1770
1853
|
),
|
|
1771
|
-
metadata:
|
|
1854
|
+
metadata: z2.string().optional().describe(
|
|
1772
1855
|
`Legacy Portkey query param for metadata filtering. Stringified JSON object, e.g. '{"env":"prod","app":"myapp"}'; prefer metadata_filter for structured inputs.`
|
|
1773
1856
|
),
|
|
1774
|
-
ai_org_model:
|
|
1857
|
+
ai_org_model: z2.string().optional().describe(
|
|
1775
1858
|
"Legacy Portkey query param for provider/model pairs. Format: 'provider__model' with double underscore, e.g. 'openai__gpt-4' or 'anthropic__claude-3-opus'. Comma-separated string; prefer provider_models for structured inputs."
|
|
1776
1859
|
),
|
|
1777
|
-
provider_models:
|
|
1860
|
+
provider_models: z2.array(z2.string()).optional().describe(
|
|
1778
1861
|
"Structured alias for ai_org_model. Use provider__model strings in an array; normalized to the legacy comma-separated Portkey query param."
|
|
1779
1862
|
),
|
|
1780
|
-
trace_id:
|
|
1863
|
+
trace_id: z2.string().optional().describe(
|
|
1781
1864
|
"Legacy Portkey query param for trace IDs. Comma-separated string; prefer trace_ids for structured inputs."
|
|
1782
1865
|
),
|
|
1783
|
-
trace_ids:
|
|
1866
|
+
trace_ids: z2.array(z2.string()).optional().describe(
|
|
1784
1867
|
"Structured alias for trace_id. Use an array of trace IDs; normalized to the legacy comma-separated Portkey query param."
|
|
1785
1868
|
),
|
|
1786
|
-
span_id:
|
|
1869
|
+
span_id: z2.string().optional().describe(
|
|
1787
1870
|
"Legacy Portkey query param for span IDs. Comma-separated string; prefer span_ids for structured inputs."
|
|
1788
1871
|
),
|
|
1789
|
-
span_ids:
|
|
1872
|
+
span_ids: z2.array(z2.string()).optional().describe(
|
|
1790
1873
|
"Structured alias for span_id. Use an array of span IDs; normalized to the legacy comma-separated Portkey query param."
|
|
1791
1874
|
),
|
|
1792
|
-
metadata_filter:
|
|
1875
|
+
metadata_filter: z2.record(z2.string(), z2.unknown()).optional().describe(
|
|
1793
1876
|
"Structured alias for metadata. Use an object such as { env: 'prod' }; normalized to a JSON string before the request is sent."
|
|
1794
1877
|
),
|
|
1795
|
-
prompt_slug:
|
|
1878
|
+
prompt_slug: z2.string().optional().describe("Filter by prompt slug")
|
|
1796
1879
|
};
|
|
1797
1880
|
var paginatedAnalyticsSchema = {
|
|
1798
1881
|
...baseAnalyticsSchema,
|
|
1799
|
-
current_page:
|
|
1800
|
-
page_size:
|
|
1882
|
+
current_page: z2.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
1883
|
+
page_size: z2.coerce.number().int().positive().max(100).optional().describe("Results per page (max 100)")
|
|
1801
1884
|
};
|
|
1802
1885
|
var analyticsGroupMetadataSchema = {
|
|
1803
1886
|
...paginatedAnalyticsSchema,
|
|
1804
|
-
metadata_key:
|
|
1887
|
+
metadata_key: z2.string().describe("The metadata key to group by (e.g., 'env', 'app', 'client_id')")
|
|
1805
1888
|
};
|
|
1806
1889
|
function formatGraphAnalytics(summary, dataPoints) {
|
|
1807
1890
|
return {
|
|
@@ -2384,26 +2467,26 @@ function registerAnalyticsTools(server, service) {
|
|
|
2384
2467
|
}
|
|
2385
2468
|
|
|
2386
2469
|
// src/tools/audit.tools.ts
|
|
2387
|
-
import { z as
|
|
2470
|
+
import { z as z3 } from "zod";
|
|
2388
2471
|
var AUDIT_TOOL_SCHEMAS = {
|
|
2389
2472
|
listAuditLogs: {
|
|
2390
|
-
workspace_id:
|
|
2391
|
-
actor_id:
|
|
2392
|
-
action:
|
|
2473
|
+
workspace_id: z3.string().optional().describe("Filter audit logs by workspace ID"),
|
|
2474
|
+
actor_id: z3.string().optional().describe("Filter by the user ID who performed the action"),
|
|
2475
|
+
action: z3.string().optional().describe(
|
|
2393
2476
|
"Filter by action type (e.g., 'create', 'update', 'delete', 'login')"
|
|
2394
2477
|
),
|
|
2395
|
-
resource_type:
|
|
2478
|
+
resource_type: z3.string().optional().describe(
|
|
2396
2479
|
"Filter by resource type (e.g., 'user', 'workspace', 'config', 'virtual_key')"
|
|
2397
2480
|
),
|
|
2398
|
-
resource_id:
|
|
2399
|
-
start_time:
|
|
2481
|
+
resource_id: z3.string().optional().describe("Filter by specific resource ID"),
|
|
2482
|
+
start_time: z3.string().optional().describe(
|
|
2400
2483
|
"Start of time range filter (ISO 8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
2401
2484
|
),
|
|
2402
|
-
end_time:
|
|
2485
|
+
end_time: z3.string().optional().describe(
|
|
2403
2486
|
"End of time range filter (ISO 8601 format, e.g., '2024-01-31T23:59:59Z')"
|
|
2404
2487
|
),
|
|
2405
|
-
current_page:
|
|
2406
|
-
page_size:
|
|
2488
|
+
current_page: z3.coerce.number().int().positive().optional().describe("Page number for pagination (starts at 1)"),
|
|
2489
|
+
page_size: z3.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
2407
2490
|
}
|
|
2408
2491
|
};
|
|
2409
2492
|
function registerAuditTools(server, service) {
|
|
@@ -2456,30 +2539,30 @@ function registerAuditTools(server, service) {
|
|
|
2456
2539
|
}
|
|
2457
2540
|
|
|
2458
2541
|
// src/tools/collections.tools.ts
|
|
2459
|
-
import { z as
|
|
2542
|
+
import { z as z4 } from "zod";
|
|
2460
2543
|
var COLLECTIONS_TOOL_SCHEMAS = {
|
|
2461
2544
|
listCollections: {
|
|
2462
|
-
workspace_id:
|
|
2463
|
-
search:
|
|
2464
|
-
current_page:
|
|
2465
|
-
page_size:
|
|
2545
|
+
workspace_id: z4.string().optional().describe("Filter by workspace ID"),
|
|
2546
|
+
search: z4.string().optional().describe("Search collections by name"),
|
|
2547
|
+
current_page: z4.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
2548
|
+
page_size: z4.coerce.number().int().positive().max(100).optional().describe("Results per page (max 100)")
|
|
2466
2549
|
},
|
|
2467
2550
|
createCollection: {
|
|
2468
|
-
name:
|
|
2551
|
+
name: z4.string().describe(
|
|
2469
2552
|
"Collection name (e.g., 'hourlink', 'apizone', 'research-pilot')"
|
|
2470
2553
|
),
|
|
2471
|
-
workspace_id:
|
|
2554
|
+
workspace_id: z4.string().optional().describe("Workspace ID to create collection in")
|
|
2472
2555
|
},
|
|
2473
2556
|
getCollection: {
|
|
2474
|
-
collection_id:
|
|
2557
|
+
collection_id: z4.string().describe("Collection ID or slug to retrieve")
|
|
2475
2558
|
},
|
|
2476
2559
|
updateCollection: {
|
|
2477
|
-
collection_id:
|
|
2478
|
-
name:
|
|
2479
|
-
description:
|
|
2560
|
+
collection_id: z4.string().describe("Collection ID to update"),
|
|
2561
|
+
name: z4.string().optional().describe("New name for the collection"),
|
|
2562
|
+
description: z4.string().optional().describe("New description for the collection")
|
|
2480
2563
|
},
|
|
2481
2564
|
deleteCollection: {
|
|
2482
|
-
collection_id:
|
|
2565
|
+
collection_id: z4.string().describe("Collection ID to delete")
|
|
2483
2566
|
}
|
|
2484
2567
|
};
|
|
2485
2568
|
function registerCollectionsTools(server, service) {
|
|
@@ -2600,69 +2683,69 @@ function registerCollectionsTools(server, service) {
|
|
|
2600
2683
|
}
|
|
2601
2684
|
|
|
2602
2685
|
// src/tools/configs.tools.ts
|
|
2603
|
-
import { z as
|
|
2686
|
+
import { z as z5 } from "zod";
|
|
2604
2687
|
var CONFIGS_TOOL_SCHEMAS = {
|
|
2605
2688
|
listConfigs: {
|
|
2606
|
-
current_page:
|
|
2607
|
-
page_size:
|
|
2689
|
+
current_page: z5.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
2690
|
+
page_size: z5.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
2608
2691
|
},
|
|
2609
2692
|
getConfig: {
|
|
2610
|
-
slug:
|
|
2693
|
+
slug: z5.string().describe(
|
|
2611
2694
|
"The unique identifier (slug) of the configuration to retrieve. This can be found in the configuration's URL or from the list_configs tool response"
|
|
2612
2695
|
)
|
|
2613
2696
|
},
|
|
2614
2697
|
createConfig: {
|
|
2615
|
-
name:
|
|
2616
|
-
workspace_id:
|
|
2617
|
-
cache_mode:
|
|
2618
|
-
cache_max_age:
|
|
2619
|
-
retry_attempts:
|
|
2620
|
-
retry_on_status_codes:
|
|
2621
|
-
strategy_mode:
|
|
2622
|
-
targets:
|
|
2623
|
-
|
|
2624
|
-
provider:
|
|
2625
|
-
virtual_key:
|
|
2698
|
+
name: z5.string().describe("Name for the new configuration"),
|
|
2699
|
+
workspace_id: z5.string().optional().describe("Workspace ID to create config in"),
|
|
2700
|
+
cache_mode: z5.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
2701
|
+
cache_max_age: z5.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
2702
|
+
retry_attempts: z5.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
2703
|
+
retry_on_status_codes: z5.array(z5.coerce.number()).optional().describe("HTTP status codes to retry on (e.g., [429, 500, 502, 503])"),
|
|
2704
|
+
strategy_mode: z5.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy: 'loadbalance' or 'fallback'"),
|
|
2705
|
+
targets: z5.array(
|
|
2706
|
+
z5.object({
|
|
2707
|
+
provider: z5.string().optional(),
|
|
2708
|
+
virtual_key: z5.string().optional()
|
|
2626
2709
|
}).refine((t) => t.provider || t.virtual_key, {
|
|
2627
2710
|
message: "Each target must have at least provider or virtual_key"
|
|
2628
2711
|
})
|
|
2629
2712
|
).optional().describe("Array of target providers with virtual keys")
|
|
2630
2713
|
},
|
|
2631
2714
|
updateConfig: {
|
|
2632
|
-
slug:
|
|
2633
|
-
name:
|
|
2634
|
-
status:
|
|
2635
|
-
cache_mode:
|
|
2636
|
-
cache_max_age:
|
|
2637
|
-
retry_attempts:
|
|
2638
|
-
retry_on_status_codes:
|
|
2639
|
-
strategy_mode:
|
|
2640
|
-
targets:
|
|
2641
|
-
|
|
2642
|
-
provider:
|
|
2643
|
-
virtual_key:
|
|
2715
|
+
slug: z5.string().describe("Configuration slug to update"),
|
|
2716
|
+
name: z5.string().optional().describe("New name for the configuration"),
|
|
2717
|
+
status: z5.enum(["active", "inactive"]).optional().describe("Configuration status"),
|
|
2718
|
+
cache_mode: z5.enum(["simple", "semantic"]).optional().describe("Cache mode: 'simple' or 'semantic'"),
|
|
2719
|
+
cache_max_age: z5.coerce.number().positive().optional().describe("Cache max age in seconds"),
|
|
2720
|
+
retry_attempts: z5.coerce.number().positive().max(5).optional().describe("Number of retry attempts (1-5)"),
|
|
2721
|
+
retry_on_status_codes: z5.array(z5.coerce.number()).optional().describe("HTTP status codes to retry on"),
|
|
2722
|
+
strategy_mode: z5.enum(["loadbalance", "fallback"]).optional().describe("Routing strategy"),
|
|
2723
|
+
targets: z5.array(
|
|
2724
|
+
z5.object({
|
|
2725
|
+
provider: z5.string().optional(),
|
|
2726
|
+
virtual_key: z5.string().optional()
|
|
2644
2727
|
}).refine((t) => t.provider || t.virtual_key, {
|
|
2645
2728
|
message: "Each target must have at least provider or virtual_key"
|
|
2646
2729
|
})
|
|
2647
2730
|
).optional().describe("Array of target providers")
|
|
2648
2731
|
},
|
|
2649
2732
|
deleteConfig: {
|
|
2650
|
-
slug:
|
|
2733
|
+
slug: z5.string().describe("Configuration slug to delete")
|
|
2651
2734
|
},
|
|
2652
2735
|
listConfigVersions: {
|
|
2653
|
-
slug:
|
|
2736
|
+
slug: z5.string().describe("Configuration slug to list versions for")
|
|
2654
2737
|
}
|
|
2655
2738
|
};
|
|
2656
|
-
var configPayloadSchema =
|
|
2657
|
-
cache_mode:
|
|
2658
|
-
cache_max_age:
|
|
2659
|
-
retry_attempts:
|
|
2660
|
-
retry_on_status_codes:
|
|
2661
|
-
strategy_mode:
|
|
2662
|
-
targets:
|
|
2663
|
-
|
|
2664
|
-
provider:
|
|
2665
|
-
virtual_key:
|
|
2739
|
+
var configPayloadSchema = z5.object({
|
|
2740
|
+
cache_mode: z5.enum(["simple", "semantic"]).optional(),
|
|
2741
|
+
cache_max_age: z5.coerce.number().positive().optional(),
|
|
2742
|
+
retry_attempts: z5.coerce.number().positive().max(5).optional(),
|
|
2743
|
+
retry_on_status_codes: z5.array(z5.coerce.number()).optional(),
|
|
2744
|
+
strategy_mode: z5.enum(["loadbalance", "fallback"]).optional(),
|
|
2745
|
+
targets: z5.array(
|
|
2746
|
+
z5.object({
|
|
2747
|
+
provider: z5.string().optional(),
|
|
2748
|
+
virtual_key: z5.string().optional()
|
|
2666
2749
|
})
|
|
2667
2750
|
).optional()
|
|
2668
2751
|
});
|
|
@@ -2879,53 +2962,53 @@ function registerConfigsTools(server, service) {
|
|
|
2879
2962
|
}
|
|
2880
2963
|
|
|
2881
2964
|
// src/tools/guardrails.tools.ts
|
|
2882
|
-
import { z as
|
|
2883
|
-
var guardrailCheckSchema =
|
|
2884
|
-
id:
|
|
2885
|
-
name:
|
|
2886
|
-
is_enabled:
|
|
2887
|
-
parameters:
|
|
2965
|
+
import { z as z6 } from "zod";
|
|
2966
|
+
var guardrailCheckSchema = z6.object({
|
|
2967
|
+
id: z6.string().describe("Check identifier (e.g., 'default.jwt', 'default.pii')"),
|
|
2968
|
+
name: z6.string().optional().describe("Display name for the check"),
|
|
2969
|
+
is_enabled: z6.boolean().optional().describe("Whether the check is enabled"),
|
|
2970
|
+
parameters: z6.record(z6.string(), z6.unknown()).optional().describe("Check-specific configuration parameters")
|
|
2888
2971
|
});
|
|
2889
|
-
var guardrailFeedbackSchema =
|
|
2890
|
-
value:
|
|
2891
|
-
weight:
|
|
2892
|
-
metadata:
|
|
2972
|
+
var guardrailFeedbackSchema = z6.object({
|
|
2973
|
+
value: z6.coerce.number().optional().describe("Feedback value"),
|
|
2974
|
+
weight: z6.coerce.number().optional().describe("Feedback weight"),
|
|
2975
|
+
metadata: z6.record(z6.string(), z6.unknown()).optional().describe("Additional metadata")
|
|
2893
2976
|
});
|
|
2894
|
-
var guardrailActionSchema =
|
|
2895
|
-
deny:
|
|
2896
|
-
async:
|
|
2977
|
+
var guardrailActionSchema = z6.object({
|
|
2978
|
+
deny: z6.boolean().optional().describe("Whether to deny the request on check failure"),
|
|
2979
|
+
async: z6.boolean().optional().describe("Whether to run checks asynchronously"),
|
|
2897
2980
|
on_success: guardrailFeedbackSchema.optional().describe("Feedback configuration for successful checks"),
|
|
2898
2981
|
on_fail: guardrailFeedbackSchema.optional().describe("Feedback configuration for failed checks"),
|
|
2899
|
-
on_fail_action:
|
|
2900
|
-
message:
|
|
2982
|
+
on_fail_action: z6.string().optional().describe("Simple action on failure (e.g., 'block')"),
|
|
2983
|
+
message: z6.string().optional().describe("Message to return when guardrail triggers")
|
|
2901
2984
|
});
|
|
2902
2985
|
var GUARDRAILS_TOOL_SCHEMAS = {
|
|
2903
2986
|
listGuardrails: {
|
|
2904
|
-
workspace_id:
|
|
2905
|
-
organisation_id:
|
|
2906
|
-
page_size:
|
|
2907
|
-
current_page:
|
|
2987
|
+
workspace_id: z6.string().optional().describe("Filter guardrails by workspace ID"),
|
|
2988
|
+
organisation_id: z6.string().optional().describe("Filter guardrails by organization ID"),
|
|
2989
|
+
page_size: z6.coerce.number().int().min(1).max(100).optional().describe("Number of items per page (1-100, default: 100)"),
|
|
2990
|
+
current_page: z6.coerce.number().int().positive().optional().describe("Page number for pagination")
|
|
2908
2991
|
},
|
|
2909
2992
|
getGuardrail: {
|
|
2910
|
-
guardrail_id:
|
|
2993
|
+
guardrail_id: z6.string().describe("The guardrail UUID or slug (with guard_ prefix) to retrieve")
|
|
2911
2994
|
},
|
|
2912
2995
|
createGuardrail: {
|
|
2913
|
-
name:
|
|
2914
|
-
checks:
|
|
2996
|
+
name: z6.string().describe("Name of the guardrail"),
|
|
2997
|
+
checks: z6.array(guardrailCheckSchema).min(1).describe("Array of checks to apply (at least one required)"),
|
|
2915
2998
|
actions: guardrailActionSchema.describe(
|
|
2916
2999
|
"Actions to take when guardrail checks pass or fail"
|
|
2917
3000
|
),
|
|
2918
|
-
workspace_id:
|
|
2919
|
-
organisation_id:
|
|
3001
|
+
workspace_id: z6.string().optional().describe("Workspace ID to create the guardrail in"),
|
|
3002
|
+
organisation_id: z6.string().optional().describe("Organisation ID (required if workspace_id not provided)")
|
|
2920
3003
|
},
|
|
2921
3004
|
updateGuardrail: {
|
|
2922
|
-
guardrail_id:
|
|
2923
|
-
name:
|
|
2924
|
-
checks:
|
|
3005
|
+
guardrail_id: z6.string().describe("The guardrail UUID or slug to update"),
|
|
3006
|
+
name: z6.string().optional().describe("New name for the guardrail"),
|
|
3007
|
+
checks: z6.array(guardrailCheckSchema).min(1).optional().describe("Updated array of checks to apply"),
|
|
2925
3008
|
actions: guardrailActionSchema.optional().describe("Updated actions configuration")
|
|
2926
3009
|
},
|
|
2927
3010
|
deleteGuardrail: {
|
|
2928
|
-
guardrail_id:
|
|
3011
|
+
guardrail_id: z6.string().describe("The guardrail UUID or slug to delete")
|
|
2929
3012
|
}
|
|
2930
3013
|
};
|
|
2931
3014
|
function registerGuardrailsTools(server, service) {
|
|
@@ -3075,7 +3158,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3075
3158
|
}
|
|
3076
3159
|
|
|
3077
3160
|
// src/tools/integrations.tools.ts
|
|
3078
|
-
import { z as
|
|
3161
|
+
import { z as z7 } from "zod";
|
|
3079
3162
|
|
|
3080
3163
|
// src/lib/limits.ts
|
|
3081
3164
|
var PERIODIC_RESET_DEFAULT = "monthly";
|
|
@@ -3120,91 +3203,91 @@ function buildRateLimits(params) {
|
|
|
3120
3203
|
// src/tools/integrations.tools.ts
|
|
3121
3204
|
var INTEGRATIONS_TOOL_SCHEMAS = {
|
|
3122
3205
|
listIntegrations: {
|
|
3123
|
-
current_page:
|
|
3124
|
-
page_size:
|
|
3125
|
-
workspace_id:
|
|
3126
|
-
type:
|
|
3206
|
+
current_page: z7.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
3207
|
+
page_size: z7.coerce.number().int().positive().max(100).optional().describe("Number of results per page (default 100, max 100)"),
|
|
3208
|
+
workspace_id: z7.string().optional().describe("Filter integrations accessible by a specific workspace"),
|
|
3209
|
+
type: z7.enum(["workspace", "organisation", "all"]).optional().describe(
|
|
3127
3210
|
"Filter by integration type: 'workspace', 'organisation', or 'all' (default)"
|
|
3128
3211
|
)
|
|
3129
3212
|
},
|
|
3130
3213
|
createIntegration: {
|
|
3131
|
-
name:
|
|
3132
|
-
ai_provider_id:
|
|
3214
|
+
name: z7.string().describe("Human-readable name for the integration"),
|
|
3215
|
+
ai_provider_id: z7.string().describe(
|
|
3133
3216
|
"ID of the AI provider (e.g., 'openai', 'anthropic', 'azure-openai', 'aws-bedrock', 'vertex-ai')"
|
|
3134
3217
|
),
|
|
3135
|
-
slug:
|
|
3218
|
+
slug: z7.string().optional().describe(
|
|
3136
3219
|
"URL-friendly identifier (auto-generated from name if not provided)"
|
|
3137
3220
|
),
|
|
3138
|
-
key:
|
|
3139
|
-
description:
|
|
3140
|
-
workspace_id:
|
|
3141
|
-
api_version:
|
|
3142
|
-
resource_name:
|
|
3143
|
-
deployment_name:
|
|
3144
|
-
aws_region:
|
|
3145
|
-
aws_access_key_id:
|
|
3146
|
-
aws_secret_access_key:
|
|
3147
|
-
vertex_project_id:
|
|
3148
|
-
vertex_region:
|
|
3149
|
-
custom_host:
|
|
3221
|
+
key: z7.string().optional().describe("API key for the provider (if required)"),
|
|
3222
|
+
description: z7.string().optional().describe("Optional description of the integration"),
|
|
3223
|
+
workspace_id: z7.string().optional().describe("Workspace ID for workspace-scoped integrations"),
|
|
3224
|
+
api_version: z7.string().optional().describe("API version (for Azure OpenAI)"),
|
|
3225
|
+
resource_name: z7.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
3226
|
+
deployment_name: z7.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
3227
|
+
aws_region: z7.string().optional().describe("AWS region (for AWS Bedrock)"),
|
|
3228
|
+
aws_access_key_id: z7.string().optional().describe("AWS access key ID (for AWS Bedrock)"),
|
|
3229
|
+
aws_secret_access_key: z7.string().optional().describe("AWS secret access key (for AWS Bedrock)"),
|
|
3230
|
+
vertex_project_id: z7.string().optional().describe("GCP project ID (for Vertex AI)"),
|
|
3231
|
+
vertex_region: z7.string().optional().describe("GCP region (for Vertex AI)"),
|
|
3232
|
+
custom_host: z7.string().optional().describe("Custom base URL for the provider")
|
|
3150
3233
|
},
|
|
3151
3234
|
getIntegration: {
|
|
3152
|
-
slug:
|
|
3235
|
+
slug: z7.string().describe("The unique slug identifier of the integration to retrieve")
|
|
3153
3236
|
},
|
|
3154
3237
|
updateIntegration: {
|
|
3155
|
-
slug:
|
|
3156
|
-
name:
|
|
3157
|
-
key:
|
|
3158
|
-
description:
|
|
3159
|
-
api_version:
|
|
3160
|
-
resource_name:
|
|
3161
|
-
deployment_name:
|
|
3162
|
-
aws_region:
|
|
3163
|
-
aws_access_key_id:
|
|
3164
|
-
aws_secret_access_key:
|
|
3165
|
-
vertex_project_id:
|
|
3166
|
-
vertex_region:
|
|
3167
|
-
custom_host:
|
|
3238
|
+
slug: z7.string().describe("The slug of the integration to update"),
|
|
3239
|
+
name: z7.string().optional().describe("New human-readable name for the integration"),
|
|
3240
|
+
key: z7.string().optional().describe("New API key for the provider"),
|
|
3241
|
+
description: z7.string().optional().describe("New description for the integration"),
|
|
3242
|
+
api_version: z7.string().optional().describe("New API version (for Azure OpenAI)"),
|
|
3243
|
+
resource_name: z7.string().optional().describe("New resource name (for Azure OpenAI)"),
|
|
3244
|
+
deployment_name: z7.string().optional().describe("New deployment name (for Azure OpenAI)"),
|
|
3245
|
+
aws_region: z7.string().optional().describe("New AWS region (for AWS Bedrock)"),
|
|
3246
|
+
aws_access_key_id: z7.string().optional().describe("New AWS access key ID (for AWS Bedrock)"),
|
|
3247
|
+
aws_secret_access_key: z7.string().optional().describe("New AWS secret access key (for AWS Bedrock)"),
|
|
3248
|
+
vertex_project_id: z7.string().optional().describe("New GCP project ID (for Vertex AI)"),
|
|
3249
|
+
vertex_region: z7.string().optional().describe("New GCP region (for Vertex AI)"),
|
|
3250
|
+
custom_host: z7.string().optional().describe("New custom base URL for the provider")
|
|
3168
3251
|
},
|
|
3169
3252
|
deleteIntegration: {
|
|
3170
|
-
slug:
|
|
3253
|
+
slug: z7.string().describe("The slug of the integration to delete")
|
|
3171
3254
|
},
|
|
3172
3255
|
listIntegrationModels: {
|
|
3173
|
-
slug:
|
|
3174
|
-
current_page:
|
|
3175
|
-
page_size:
|
|
3256
|
+
slug: z7.string().describe("The slug of the integration"),
|
|
3257
|
+
current_page: z7.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
3258
|
+
page_size: z7.coerce.number().int().positive().max(100).optional().describe("Number of results per page")
|
|
3176
3259
|
},
|
|
3177
3260
|
updateIntegrationModels: {
|
|
3178
|
-
slug:
|
|
3179
|
-
models:
|
|
3180
|
-
|
|
3181
|
-
slug:
|
|
3182
|
-
model_name:
|
|
3261
|
+
slug: z7.string().describe("The slug of the integration"),
|
|
3262
|
+
models: z7.array(
|
|
3263
|
+
z7.object({
|
|
3264
|
+
slug: z7.string().describe("The model slug identifier"),
|
|
3265
|
+
model_name: z7.string().optional().describe(
|
|
3183
3266
|
"Display name for the model (required for custom models)"
|
|
3184
3267
|
),
|
|
3185
|
-
enabled:
|
|
3186
|
-
is_custom:
|
|
3268
|
+
enabled: z7.boolean().describe("Whether the model is enabled"),
|
|
3269
|
+
is_custom: z7.boolean().optional().describe("Whether this is a custom model (default: false)")
|
|
3187
3270
|
})
|
|
3188
3271
|
).describe("Array of model configurations to update")
|
|
3189
3272
|
},
|
|
3190
3273
|
deleteIntegrationModel: {
|
|
3191
|
-
slug:
|
|
3192
|
-
model_slug:
|
|
3274
|
+
slug: z7.string().describe("The slug of the integration"),
|
|
3275
|
+
model_slug: z7.string().describe("The slug of the model to delete")
|
|
3193
3276
|
},
|
|
3194
3277
|
listIntegrationWorkspaces: {
|
|
3195
|
-
slug:
|
|
3196
|
-
current_page:
|
|
3197
|
-
page_size:
|
|
3278
|
+
slug: z7.string().describe("The slug of the integration"),
|
|
3279
|
+
current_page: z7.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
3280
|
+
page_size: z7.coerce.number().int().positive().max(100).optional().describe("Number of results per page")
|
|
3198
3281
|
},
|
|
3199
3282
|
updateIntegrationWorkspaces: {
|
|
3200
|
-
slug:
|
|
3201
|
-
workspaces:
|
|
3202
|
-
|
|
3203
|
-
id:
|
|
3204
|
-
enabled:
|
|
3205
|
-
credit_limit:
|
|
3206
|
-
alert_threshold:
|
|
3207
|
-
rate_limit_rpm:
|
|
3283
|
+
slug: z7.string().describe("The slug of the integration"),
|
|
3284
|
+
workspaces: z7.array(
|
|
3285
|
+
z7.object({
|
|
3286
|
+
id: z7.string().describe("The workspace ID"),
|
|
3287
|
+
enabled: z7.boolean().describe("Whether the workspace has access to this integration"),
|
|
3288
|
+
credit_limit: z7.coerce.number().positive().optional().describe("Credit limit for this workspace"),
|
|
3289
|
+
alert_threshold: z7.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
3290
|
+
rate_limit_rpm: z7.coerce.number().positive().optional().describe("Rate limit in requests per minute")
|
|
3208
3291
|
})
|
|
3209
3292
|
).describe("Array of workspace configurations to update")
|
|
3210
3293
|
}
|
|
@@ -3537,104 +3620,110 @@ function registerIntegrationsTools(server, service) {
|
|
|
3537
3620
|
}
|
|
3538
3621
|
|
|
3539
3622
|
// src/tools/keys.tools.ts
|
|
3540
|
-
import { z as
|
|
3623
|
+
import { z as z8 } from "zod";
|
|
3541
3624
|
var KEYS_TOOL_SCHEMAS = {
|
|
3542
3625
|
listVirtualKeys: {
|
|
3543
|
-
current_page:
|
|
3544
|
-
page_size:
|
|
3626
|
+
current_page: z8.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
3627
|
+
page_size: z8.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
3545
3628
|
},
|
|
3546
3629
|
createVirtualKey: {
|
|
3547
|
-
name:
|
|
3548
|
-
provider:
|
|
3630
|
+
name: z8.string().describe("Display name for the virtual key"),
|
|
3631
|
+
provider: z8.string().describe(
|
|
3549
3632
|
"Provider slug (e.g., 'openai', 'anthropic', 'azure-openai', 'google')"
|
|
3550
3633
|
),
|
|
3551
|
-
key:
|
|
3552
|
-
note:
|
|
3553
|
-
workspace_id:
|
|
3554
|
-
api_version:
|
|
3555
|
-
resource_name:
|
|
3556
|
-
deployment_name:
|
|
3557
|
-
credit_limit:
|
|
3558
|
-
alert_threshold:
|
|
3634
|
+
key: z8.string().describe("The actual provider API key to store"),
|
|
3635
|
+
note: z8.string().optional().describe("Optional note or description for this key"),
|
|
3636
|
+
workspace_id: z8.string().optional().describe("Workspace ID to create the key in"),
|
|
3637
|
+
api_version: z8.string().optional().describe("API version (for Azure OpenAI)"),
|
|
3638
|
+
resource_name: z8.string().optional().describe("Resource name (for Azure OpenAI)"),
|
|
3639
|
+
deployment_name: z8.string().optional().describe("Deployment name (for Azure OpenAI)"),
|
|
3640
|
+
credit_limit: z8.coerce.number().positive().optional().describe("Maximum usage cost threshold"),
|
|
3641
|
+
alert_threshold: z8.coerce.number().min(0).max(100).optional().describe(
|
|
3559
3642
|
"Percentage of credit_limit at which to send alert emails (0-100)"
|
|
3560
3643
|
),
|
|
3561
|
-
rate_limit_rpm:
|
|
3644
|
+
rate_limit_rpm: z8.coerce.number().positive().optional().describe("Requests per minute limit")
|
|
3562
3645
|
},
|
|
3563
3646
|
getVirtualKey: {
|
|
3564
|
-
slug:
|
|
3647
|
+
slug: z8.string().describe("The unique slug identifier of the virtual key to retrieve")
|
|
3565
3648
|
},
|
|
3566
3649
|
updateVirtualKey: {
|
|
3567
|
-
slug:
|
|
3568
|
-
name:
|
|
3569
|
-
key:
|
|
3570
|
-
note:
|
|
3571
|
-
credit_limit:
|
|
3572
|
-
alert_threshold:
|
|
3573
|
-
rate_limit_rpm:
|
|
3650
|
+
slug: z8.string().describe("The slug of the virtual key to update"),
|
|
3651
|
+
name: z8.string().optional().describe("New display name for the key"),
|
|
3652
|
+
key: z8.string().optional().describe("New provider API key value"),
|
|
3653
|
+
note: z8.string().optional().describe("New note or description"),
|
|
3654
|
+
credit_limit: z8.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
3655
|
+
alert_threshold: z8.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
3656
|
+
rate_limit_rpm: z8.coerce.number().positive().optional().describe("New rate limit in requests per minute")
|
|
3574
3657
|
},
|
|
3575
3658
|
deleteVirtualKey: {
|
|
3576
|
-
slug:
|
|
3659
|
+
slug: z8.string().describe("The slug of the virtual key to delete")
|
|
3577
3660
|
},
|
|
3578
3661
|
createApiKey: {
|
|
3579
|
-
type:
|
|
3662
|
+
type: z8.enum(["organisation", "workspace"]).describe(
|
|
3580
3663
|
"Key type: 'organisation' for org-wide access or 'workspace' for workspace-scoped"
|
|
3581
3664
|
),
|
|
3582
|
-
sub_type:
|
|
3665
|
+
sub_type: z8.enum(["user", "service"]).describe(
|
|
3583
3666
|
"Sub-type: 'user' for user-associated keys or 'service' for service accounts"
|
|
3584
3667
|
),
|
|
3585
|
-
name:
|
|
3586
|
-
description:
|
|
3587
|
-
workspace_id:
|
|
3588
|
-
user_id:
|
|
3589
|
-
scopes:
|
|
3668
|
+
name: z8.string().describe("Display name for the API key"),
|
|
3669
|
+
description: z8.string().optional().describe("Optional description for the key"),
|
|
3670
|
+
workspace_id: z8.string().optional().describe("Workspace ID (required for workspace-type keys)"),
|
|
3671
|
+
user_id: z8.string().optional().describe("User ID (required for user sub-type keys)"),
|
|
3672
|
+
scopes: z8.array(z8.string()).describe(
|
|
3590
3673
|
"Permission scopes for the key (e.g., ['logs.read', 'analytics.read'])"
|
|
3591
3674
|
),
|
|
3592
|
-
credit_limit:
|
|
3593
|
-
alert_threshold:
|
|
3594
|
-
rate_limit_rpm:
|
|
3595
|
-
default_config_id:
|
|
3596
|
-
default_metadata:
|
|
3597
|
-
alert_emails:
|
|
3598
|
-
expires_at:
|
|
3675
|
+
credit_limit: z8.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
3676
|
+
alert_threshold: z8.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
3677
|
+
rate_limit_rpm: z8.coerce.number().positive().optional().describe("Rate limit in requests per minute"),
|
|
3678
|
+
default_config_id: z8.string().optional().describe("Default configuration ID to use with this key"),
|
|
3679
|
+
default_metadata: z8.record(z8.string(), z8.string()).optional().describe("Default metadata key-value pairs"),
|
|
3680
|
+
alert_emails: z8.array(z8.string()).optional().describe("Email addresses for alerts"),
|
|
3681
|
+
expires_at: z8.string().optional().describe("Expiration date in ISO 8601 format")
|
|
3599
3682
|
},
|
|
3600
3683
|
listApiKeys: {
|
|
3601
|
-
page_size:
|
|
3602
|
-
current_page:
|
|
3603
|
-
workspace_id:
|
|
3684
|
+
page_size: z8.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)"),
|
|
3685
|
+
current_page: z8.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
3686
|
+
workspace_id: z8.string().optional().describe("Filter by workspace ID")
|
|
3604
3687
|
},
|
|
3605
3688
|
getApiKey: {
|
|
3606
|
-
id:
|
|
3689
|
+
id: z8.string().uuid().describe("The UUID of the API key to retrieve")
|
|
3607
3690
|
},
|
|
3608
3691
|
updateApiKey: {
|
|
3609
|
-
id:
|
|
3610
|
-
name:
|
|
3611
|
-
description:
|
|
3612
|
-
scopes:
|
|
3613
|
-
credit_limit:
|
|
3614
|
-
alert_threshold:
|
|
3615
|
-
rate_limit_rpm:
|
|
3616
|
-
default_config_id:
|
|
3617
|
-
default_metadata:
|
|
3618
|
-
alert_emails:
|
|
3619
|
-
expires_at:
|
|
3692
|
+
id: z8.string().uuid().describe("The UUID of the API key to update"),
|
|
3693
|
+
name: z8.string().optional().describe("New display name for the key"),
|
|
3694
|
+
description: z8.string().optional().describe("New description for the key"),
|
|
3695
|
+
scopes: z8.array(z8.string()).optional().describe("New permission scopes for the key"),
|
|
3696
|
+
credit_limit: z8.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
3697
|
+
alert_threshold: z8.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
3698
|
+
rate_limit_rpm: z8.coerce.number().positive().optional().describe("New rate limit in requests per minute"),
|
|
3699
|
+
default_config_id: z8.string().optional().describe("New default configuration ID"),
|
|
3700
|
+
default_metadata: z8.record(z8.string(), z8.string()).optional().describe("New default metadata key-value pairs"),
|
|
3701
|
+
alert_emails: z8.array(z8.string()).optional().describe("New email addresses for alerts"),
|
|
3702
|
+
expires_at: z8.string().nullable().optional().describe(
|
|
3620
3703
|
"New expiration date in ISO 8601 format, or null to remove expiration"
|
|
3621
3704
|
)
|
|
3622
3705
|
},
|
|
3706
|
+
rotateApiKey: {
|
|
3707
|
+
id: z8.string().uuid().describe("API key UUID obtained from list_api_keys"),
|
|
3708
|
+
key_transition_period_ms: z8.coerce.number().int().min(18e5).optional().describe(
|
|
3709
|
+
"Overlap in milliseconds while the previous key remains valid; minimum 1,800,000 (30 minutes), for example 3,600,000 for 1 hour"
|
|
3710
|
+
)
|
|
3711
|
+
},
|
|
3623
3712
|
deleteApiKey: {
|
|
3624
|
-
id:
|
|
3713
|
+
id: z8.string().uuid().describe("The UUID of the API key to delete")
|
|
3625
3714
|
}
|
|
3626
3715
|
};
|
|
3627
|
-
var createApiKeySchema =
|
|
3716
|
+
var createApiKeySchema = z8.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((value, ctx) => {
|
|
3628
3717
|
if (value.type === "workspace" && !value.workspace_id) {
|
|
3629
3718
|
ctx.addIssue({
|
|
3630
|
-
code:
|
|
3719
|
+
code: z8.ZodIssueCode.custom,
|
|
3631
3720
|
path: ["workspace_id"],
|
|
3632
3721
|
message: "workspace_id is required when type is 'workspace'"
|
|
3633
3722
|
});
|
|
3634
3723
|
}
|
|
3635
3724
|
if (value.sub_type === "user" && !value.user_id) {
|
|
3636
3725
|
ctx.addIssue({
|
|
3637
|
-
code:
|
|
3726
|
+
code: z8.ZodIssueCode.custom,
|
|
3638
3727
|
path: ["user_id"],
|
|
3639
3728
|
message: "user_id is required when sub_type is 'user'"
|
|
3640
3729
|
});
|
|
@@ -3990,40 +4079,71 @@ function registerKeysTools(server, service) {
|
|
|
3990
4079
|
};
|
|
3991
4080
|
}
|
|
3992
4081
|
);
|
|
4082
|
+
server.tool(
|
|
4083
|
+
"rotate_api_key",
|
|
4084
|
+
"Rotate an API key without changing its identity or scopes. The new secret is returned once and exposed to this MCP transcript, while the previous secret remains valid until key_transition_expires_at. Store the new key securely, update callers during the transition window, and never log either secret.",
|
|
4085
|
+
KEYS_TOOL_SCHEMAS.rotateApiKey,
|
|
4086
|
+
{
|
|
4087
|
+
title: "Rotate API Key",
|
|
4088
|
+
readOnlyHint: false,
|
|
4089
|
+
destructiveHint: true,
|
|
4090
|
+
idempotentHint: false,
|
|
4091
|
+
openWorldHint: true
|
|
4092
|
+
},
|
|
4093
|
+
async (params) => {
|
|
4094
|
+
const result = await service.keys.rotateApiKey(params.id, {
|
|
4095
|
+
key_transition_period_ms: params.key_transition_period_ms
|
|
4096
|
+
});
|
|
4097
|
+
return {
|
|
4098
|
+
content: [
|
|
4099
|
+
{
|
|
4100
|
+
type: "text",
|
|
4101
|
+
text: JSON.stringify({
|
|
4102
|
+
message: `Successfully rotated API key "${result.id}"`,
|
|
4103
|
+
warning: "Copy this new key now; it is returned only once. Replace callers before key_transition_expires_at and never log either key.",
|
|
4104
|
+
id: result.id,
|
|
4105
|
+
key: result.key,
|
|
4106
|
+
key_transition_expires_at: result.key_transition_expires_at
|
|
4107
|
+
})
|
|
4108
|
+
}
|
|
4109
|
+
]
|
|
4110
|
+
};
|
|
4111
|
+
}
|
|
4112
|
+
);
|
|
3993
4113
|
}
|
|
3994
4114
|
|
|
3995
4115
|
// src/tools/labels.tools.ts
|
|
3996
|
-
import { z as
|
|
4116
|
+
import { z as z9 } from "zod";
|
|
3997
4117
|
var LABELS_TOOL_SCHEMAS = {
|
|
3998
4118
|
createPromptLabel: {
|
|
3999
|
-
name:
|
|
4000
|
-
organisation_id:
|
|
4001
|
-
workspace_id:
|
|
4002
|
-
description:
|
|
4003
|
-
color_code:
|
|
4119
|
+
name: z9.string().describe("Name of the label"),
|
|
4120
|
+
organisation_id: z9.string().optional().describe("Organisation ID to create the label in"),
|
|
4121
|
+
workspace_id: z9.string().optional().describe("Workspace ID to create the label in"),
|
|
4122
|
+
description: z9.string().optional().describe("Description of the label"),
|
|
4123
|
+
color_code: z9.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(
|
|
4004
4124
|
"Hex format, e.g. '#FF5733'. Optional \u2014 omit for default color."
|
|
4005
4125
|
)
|
|
4006
4126
|
},
|
|
4007
4127
|
listPromptLabels: {
|
|
4008
|
-
organisation_id:
|
|
4009
|
-
workspace_id:
|
|
4010
|
-
search:
|
|
4011
|
-
current_page:
|
|
4012
|
-
page_size:
|
|
4128
|
+
organisation_id: z9.string().optional().describe("Filter by organisation ID"),
|
|
4129
|
+
workspace_id: z9.string().optional().describe("Filter by workspace ID"),
|
|
4130
|
+
search: z9.string().optional().describe("Search labels by name"),
|
|
4131
|
+
current_page: z9.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
4132
|
+
page_size: z9.coerce.number().int().positive().max(100).optional().describe("Results per page (max 100)")
|
|
4013
4133
|
},
|
|
4014
4134
|
getPromptLabel: {
|
|
4015
|
-
label_id:
|
|
4016
|
-
organisation_id:
|
|
4017
|
-
workspace_id:
|
|
4135
|
+
label_id: z9.string().describe("Label ID to retrieve"),
|
|
4136
|
+
organisation_id: z9.string().optional().describe("Organisation ID for filtering"),
|
|
4137
|
+
workspace_id: z9.string().optional().describe("Workspace ID for filtering")
|
|
4018
4138
|
},
|
|
4019
4139
|
updatePromptLabel: {
|
|
4020
|
-
label_id:
|
|
4021
|
-
name:
|
|
4022
|
-
description:
|
|
4023
|
-
color_code:
|
|
4140
|
+
label_id: z9.string().describe("Label ID to update"),
|
|
4141
|
+
name: z9.string().optional().describe("New name for the label"),
|
|
4142
|
+
description: z9.string().optional().describe("New description"),
|
|
4143
|
+
color_code: z9.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("New hex color code (e.g., '#FF5733')")
|
|
4024
4144
|
},
|
|
4025
4145
|
deletePromptLabel: {
|
|
4026
|
-
label_id:
|
|
4146
|
+
label_id: z9.string().describe("Label ID to delete")
|
|
4027
4147
|
}
|
|
4028
4148
|
};
|
|
4029
4149
|
function registerLabelsTools(server, service) {
|
|
@@ -4163,86 +4283,86 @@ function registerLabelsTools(server, service) {
|
|
|
4163
4283
|
}
|
|
4164
4284
|
|
|
4165
4285
|
// src/tools/limits.tools.ts
|
|
4166
|
-
import { z as
|
|
4167
|
-
var conditionSchema =
|
|
4168
|
-
field:
|
|
4286
|
+
import { z as z10 } from "zod";
|
|
4287
|
+
var conditionSchema = z10.object({
|
|
4288
|
+
field: z10.string().describe(
|
|
4169
4289
|
"The field to match on (e.g., 'virtual_key', 'api_key', 'user_id', 'metadata.key')"
|
|
4170
4290
|
),
|
|
4171
|
-
operator:
|
|
4172
|
-
value:
|
|
4291
|
+
operator: z10.string().describe("The comparison operator (e.g., 'is', 'contains', 'is_not')"),
|
|
4292
|
+
value: z10.string().describe("The value to match against")
|
|
4173
4293
|
});
|
|
4174
4294
|
var LIMITS_TOOL_SCHEMAS = {
|
|
4175
4295
|
listRateLimits: {
|
|
4176
|
-
workspace_id:
|
|
4296
|
+
workspace_id: z10.string().optional().describe("Filter rate limits by workspace ID")
|
|
4177
4297
|
},
|
|
4178
4298
|
getRateLimit: {
|
|
4179
|
-
id:
|
|
4299
|
+
id: z10.string().describe("The unique identifier of the rate limit")
|
|
4180
4300
|
},
|
|
4181
4301
|
createRateLimit: {
|
|
4182
|
-
conditions:
|
|
4302
|
+
conditions: z10.array(conditionSchema).describe(
|
|
4183
4303
|
"Array of conditions that determine which requests this rate limit applies to"
|
|
4184
4304
|
),
|
|
4185
|
-
group_by:
|
|
4305
|
+
group_by: z10.array(z10.string()).describe(
|
|
4186
4306
|
"Array of fields to group the rate limit by (e.g., ['virtual_key'], ['api_key', 'user_id'])"
|
|
4187
4307
|
),
|
|
4188
|
-
type:
|
|
4189
|
-
unit:
|
|
4308
|
+
type: z10.enum(["requests", "tokens"]).describe("What to rate limit: 'requests' or 'tokens'"),
|
|
4309
|
+
unit: z10.enum(["rpm", "rph", "rpd"]).describe(
|
|
4190
4310
|
"Time unit: 'rpm' (per minute), 'rph' (per hour), or 'rpd' (per day)"
|
|
4191
4311
|
),
|
|
4192
|
-
value:
|
|
4193
|
-
name:
|
|
4194
|
-
workspace_id:
|
|
4195
|
-
organisation_id:
|
|
4312
|
+
value: z10.coerce.number().positive().describe("The maximum allowed value per unit (e.g., 100 rpm)"),
|
|
4313
|
+
name: z10.string().optional().describe("Optional name for the rate limit"),
|
|
4314
|
+
workspace_id: z10.string().optional().describe("Workspace ID to scope the limit to"),
|
|
4315
|
+
organisation_id: z10.string().optional().describe("Organisation ID to scope the limit to")
|
|
4196
4316
|
},
|
|
4197
4317
|
updateRateLimit: {
|
|
4198
|
-
id:
|
|
4199
|
-
name:
|
|
4200
|
-
unit:
|
|
4318
|
+
id: z10.string().describe("The unique identifier of the rate limit"),
|
|
4319
|
+
name: z10.string().optional().describe("New name for the rate limit"),
|
|
4320
|
+
unit: z10.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
4201
4321
|
"New time unit: 'rpm' (per minute), 'rph' (per hour), or 'rpd' (per day)"
|
|
4202
4322
|
),
|
|
4203
|
-
value:
|
|
4323
|
+
value: z10.coerce.number().positive().optional().describe("New maximum allowed value per unit")
|
|
4204
4324
|
},
|
|
4205
4325
|
deleteRateLimit: {
|
|
4206
|
-
id:
|
|
4326
|
+
id: z10.string().describe("The unique identifier of the rate limit")
|
|
4207
4327
|
},
|
|
4208
4328
|
listUsageLimits: {
|
|
4209
|
-
workspace_id:
|
|
4329
|
+
workspace_id: z10.string().optional().describe("Filter usage limits by workspace ID")
|
|
4210
4330
|
},
|
|
4211
4331
|
getUsageLimit: {
|
|
4212
|
-
id:
|
|
4332
|
+
id: z10.string().describe("The unique identifier of the usage limit")
|
|
4213
4333
|
},
|
|
4214
4334
|
createUsageLimit: {
|
|
4215
|
-
conditions:
|
|
4335
|
+
conditions: z10.array(conditionSchema).describe(
|
|
4216
4336
|
"Array of conditions that determine which requests this usage limit applies to"
|
|
4217
4337
|
),
|
|
4218
|
-
group_by:
|
|
4338
|
+
group_by: z10.array(z10.string()).describe(
|
|
4219
4339
|
"Array of fields to group the usage limit by (e.g., ['virtual_key'], ['api_key', 'user_id'])"
|
|
4220
4340
|
),
|
|
4221
|
-
type:
|
|
4222
|
-
credit_limit:
|
|
4223
|
-
name:
|
|
4224
|
-
alert_threshold:
|
|
4225
|
-
periodic_reset:
|
|
4226
|
-
workspace_id:
|
|
4227
|
-
organisation_id:
|
|
4341
|
+
type: z10.enum(["cost", "tokens"]).describe("What to limit: 'cost' (in dollars) or 'tokens'"),
|
|
4342
|
+
credit_limit: z10.coerce.number().positive().describe("The maximum allowed usage (cost in dollars or token count)"),
|
|
4343
|
+
name: z10.string().optional().describe("Optional name for the usage limit"),
|
|
4344
|
+
alert_threshold: z10.coerce.number().optional().describe("Percentage threshold (0-100) at which to send an alert"),
|
|
4345
|
+
periodic_reset: z10.enum(["monthly", "weekly"]).optional().describe("Automatically reset usage counters on this schedule"),
|
|
4346
|
+
workspace_id: z10.string().optional().describe("Workspace ID to scope the limit to"),
|
|
4347
|
+
organisation_id: z10.string().optional().describe("Organisation ID to scope the limit to")
|
|
4228
4348
|
},
|
|
4229
4349
|
updateUsageLimit: {
|
|
4230
|
-
id:
|
|
4231
|
-
name:
|
|
4232
|
-
credit_limit:
|
|
4233
|
-
alert_threshold:
|
|
4234
|
-
periodic_reset:
|
|
4235
|
-
reset_usage_for_value:
|
|
4350
|
+
id: z10.string().describe("The unique identifier of the usage limit"),
|
|
4351
|
+
name: z10.string().optional().describe("New name for the usage limit"),
|
|
4352
|
+
credit_limit: z10.coerce.number().positive().optional().describe("New maximum allowed usage value"),
|
|
4353
|
+
alert_threshold: z10.coerce.number().optional().describe("New alert threshold percentage (0-100)"),
|
|
4354
|
+
periodic_reset: z10.enum(["monthly", "weekly"]).optional().describe("New periodic reset schedule"),
|
|
4355
|
+
reset_usage_for_value: z10.string().optional().describe("Reset usage counters for a specific group_by value")
|
|
4236
4356
|
},
|
|
4237
4357
|
deleteUsageLimit: {
|
|
4238
|
-
id:
|
|
4358
|
+
id: z10.string().describe("The unique identifier of the usage limit")
|
|
4239
4359
|
},
|
|
4240
4360
|
listUsageLimitEntities: {
|
|
4241
|
-
limit_id:
|
|
4361
|
+
limit_id: z10.string().describe("Usage limit policy ID")
|
|
4242
4362
|
},
|
|
4243
4363
|
resetUsageLimitEntity: {
|
|
4244
|
-
limit_id:
|
|
4245
|
-
entity_id:
|
|
4364
|
+
limit_id: z10.string().describe("Usage limit policy ID"),
|
|
4365
|
+
entity_id: z10.string().describe("Entity ID to reset usage for")
|
|
4246
4366
|
}
|
|
4247
4367
|
};
|
|
4248
4368
|
function formatRateLimit(limit) {
|
|
@@ -4548,8 +4668,8 @@ function registerLimitsTools(server, service) {
|
|
|
4548
4668
|
}
|
|
4549
4669
|
|
|
4550
4670
|
// src/tools/logging.tools.ts
|
|
4551
|
-
import { z as
|
|
4552
|
-
var logExportFieldSchema =
|
|
4671
|
+
import { z as z11 } from "zod";
|
|
4672
|
+
var logExportFieldSchema = z11.enum([
|
|
4553
4673
|
"id",
|
|
4554
4674
|
"trace_id",
|
|
4555
4675
|
"created_at",
|
|
@@ -4573,64 +4693,64 @@ var logExportFieldSchema = z10.enum([
|
|
|
4573
4693
|
]);
|
|
4574
4694
|
var LOGGING_TOOL_SCHEMAS = {
|
|
4575
4695
|
insertLog: {
|
|
4576
|
-
request_url:
|
|
4577
|
-
request_provider:
|
|
4578
|
-
request_method:
|
|
4579
|
-
request_headers:
|
|
4580
|
-
request_body:
|
|
4581
|
-
response_status:
|
|
4582
|
-
response_headers:
|
|
4583
|
-
response_body:
|
|
4584
|
-
response_time:
|
|
4585
|
-
streaming_mode:
|
|
4586
|
-
metadata_organization:
|
|
4587
|
-
metadata_user:
|
|
4588
|
-
metadata_trace_id:
|
|
4589
|
-
metadata_span_id:
|
|
4590
|
-
metadata_span_name:
|
|
4591
|
-
metadata_parent_span_id:
|
|
4592
|
-
metadata_custom:
|
|
4696
|
+
request_url: z11.string().optional().describe("The endpoint URL being called"),
|
|
4697
|
+
request_provider: z11.string().optional().describe("AI provider name (e.g., 'openai', 'anthropic')"),
|
|
4698
|
+
request_method: z11.string().optional().default("post").describe("HTTP method used (defaults to 'post')"),
|
|
4699
|
+
request_headers: z11.record(z11.string(), z11.string()).optional().describe("Request headers as key-value pairs"),
|
|
4700
|
+
request_body: z11.record(z11.string(), z11.unknown()).optional().describe("Request payload/body"),
|
|
4701
|
+
response_status: z11.coerce.number().optional().default(200).describe("HTTP response status code (defaults to 200)"),
|
|
4702
|
+
response_headers: z11.record(z11.string(), z11.string()).optional().describe("Response headers as key-value pairs"),
|
|
4703
|
+
response_body: z11.record(z11.string(), z11.unknown()).optional().describe("Response payload/body"),
|
|
4704
|
+
response_time: z11.coerce.number().optional().describe("Response latency in milliseconds"),
|
|
4705
|
+
streaming_mode: z11.boolean().optional().default(false).describe("Whether the response was streamed"),
|
|
4706
|
+
metadata_organization: z11.string().optional().describe("Organization identifier for the log"),
|
|
4707
|
+
metadata_user: z11.string().optional().describe("User identifier for the log"),
|
|
4708
|
+
metadata_trace_id: z11.string().optional().describe("Trace ID for distributed tracing"),
|
|
4709
|
+
metadata_span_id: z11.string().optional().describe("Span ID for tracing"),
|
|
4710
|
+
metadata_span_name: z11.string().optional().describe("Span name for tracing"),
|
|
4711
|
+
metadata_parent_span_id: z11.string().optional().describe("Parent span ID for tracing"),
|
|
4712
|
+
metadata_custom: z11.record(z11.string(), z11.unknown()).optional().describe("Additional custom metadata key-value pairs")
|
|
4593
4713
|
},
|
|
4594
4714
|
createLogExport: {
|
|
4595
|
-
workspace_id:
|
|
4596
|
-
description:
|
|
4597
|
-
time_min:
|
|
4715
|
+
workspace_id: z11.string().optional().describe("Workspace ID for the export"),
|
|
4716
|
+
description: z11.string().optional().describe("Human-readable description for the export job"),
|
|
4717
|
+
time_min: z11.string().describe(
|
|
4598
4718
|
"Minimum time filter in date format (e.g., '2024-01-01' or ISO 8601)"
|
|
4599
4719
|
),
|
|
4600
|
-
time_max:
|
|
4720
|
+
time_max: z11.string().describe(
|
|
4601
4721
|
"Maximum time filter in date format (e.g., '2024-01-31' or ISO 8601)"
|
|
4602
4722
|
),
|
|
4603
|
-
cost_min:
|
|
4604
|
-
cost_max:
|
|
4605
|
-
total_units_min:
|
|
4606
|
-
total_units_max:
|
|
4607
|
-
ai_model:
|
|
4608
|
-
requested_fields:
|
|
4723
|
+
cost_min: z11.coerce.number().optional().describe("Minimum cost filter"),
|
|
4724
|
+
cost_max: z11.coerce.number().optional().describe("Maximum cost filter"),
|
|
4725
|
+
total_units_min: z11.coerce.number().optional().describe("Minimum total units (tokens) filter"),
|
|
4726
|
+
total_units_max: z11.coerce.number().optional().describe("Maximum total units (tokens) filter"),
|
|
4727
|
+
ai_model: z11.array(z11.string()).optional().describe("Filter by specific AI model names"),
|
|
4728
|
+
requested_fields: z11.array(logExportFieldSchema).describe(
|
|
4609
4729
|
"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"
|
|
4610
4730
|
)
|
|
4611
4731
|
},
|
|
4612
4732
|
listLogExports: {
|
|
4613
|
-
workspace_id:
|
|
4733
|
+
workspace_id: z11.string().describe("Workspace ID to list exports for (required)")
|
|
4614
4734
|
},
|
|
4615
4735
|
getLogExport: {
|
|
4616
|
-
export_id:
|
|
4736
|
+
export_id: z11.string().describe("The unique ID of the log export")
|
|
4617
4737
|
},
|
|
4618
4738
|
startLogExport: {
|
|
4619
|
-
export_id:
|
|
4739
|
+
export_id: z11.string().describe("The unique ID of the log export to start")
|
|
4620
4740
|
},
|
|
4621
4741
|
cancelLogExport: {
|
|
4622
|
-
export_id:
|
|
4742
|
+
export_id: z11.string().describe("The unique ID of the log export to cancel")
|
|
4623
4743
|
},
|
|
4624
4744
|
downloadLogExport: {
|
|
4625
|
-
export_id:
|
|
4745
|
+
export_id: z11.string().describe("The unique ID of the log export to download")
|
|
4626
4746
|
},
|
|
4627
4747
|
updateLogExport: {
|
|
4628
|
-
export_id:
|
|
4629
|
-
workspace_id:
|
|
4630
|
-
time_of_generation_max:
|
|
4748
|
+
export_id: z11.string().describe("The unique ID of the log export to update"),
|
|
4749
|
+
workspace_id: z11.string().optional().describe("Workspace ID for the export"),
|
|
4750
|
+
time_of_generation_max: z11.string().optional().describe(
|
|
4631
4751
|
"Maximum time filter in date format (e.g., '2024-07-25' or ISO 8601)"
|
|
4632
4752
|
),
|
|
4633
|
-
requested_fields:
|
|
4753
|
+
requested_fields: z11.array(logExportFieldSchema).optional().describe(
|
|
4634
4754
|
"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"
|
|
4635
4755
|
)
|
|
4636
4756
|
}
|
|
@@ -4871,73 +4991,73 @@ function registerLoggingTools(server, service) {
|
|
|
4871
4991
|
}
|
|
4872
4992
|
|
|
4873
4993
|
// src/tools/mcp-integrations.tools.ts
|
|
4874
|
-
import { z as
|
|
4994
|
+
import { z as z12 } from "zod";
|
|
4875
4995
|
var MCP_INTEGRATIONS_TOOL_SCHEMAS = {
|
|
4876
4996
|
listMcpIntegrations: {
|
|
4877
|
-
current_page:
|
|
4878
|
-
page_size:
|
|
4879
|
-
workspace_id:
|
|
4997
|
+
current_page: z12.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
4998
|
+
page_size: z12.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)"),
|
|
4999
|
+
workspace_id: z12.string().optional().describe("Filter by workspace ID")
|
|
4880
5000
|
},
|
|
4881
5001
|
createMcpIntegration: {
|
|
4882
|
-
name:
|
|
4883
|
-
url:
|
|
4884
|
-
auth_type:
|
|
5002
|
+
name: z12.string().describe("Display name for the MCP integration"),
|
|
5003
|
+
url: z12.string().describe("URL endpoint of the MCP server to integrate"),
|
|
5004
|
+
auth_type: z12.enum(["oauth_auto", "headers", "none"]).describe(
|
|
4885
5005
|
"Authentication type: 'none', 'headers' (custom headers), or 'oauth_auto' (OAuth)"
|
|
4886
5006
|
),
|
|
4887
|
-
transport:
|
|
5007
|
+
transport: z12.enum(["http", "sse"]).describe(
|
|
4888
5008
|
"MCP transport protocol: 'http' (streamable HTTP) or 'sse' (server-sent events)"
|
|
4889
5009
|
),
|
|
4890
|
-
slug:
|
|
4891
|
-
description:
|
|
4892
|
-
custom_headers:
|
|
5010
|
+
slug: z12.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5011
|
+
description: z12.string().optional().describe("Description of the MCP integration"),
|
|
5012
|
+
custom_headers: z12.record(z12.string(), z12.string()).optional().describe(
|
|
4893
5013
|
'Custom headers for authentication (e.g. { "Authorization": "Bearer xxx" }). Sent via configurations.custom_headers'
|
|
4894
5014
|
),
|
|
4895
|
-
workspace_id:
|
|
5015
|
+
workspace_id: z12.string().optional().describe(
|
|
4896
5016
|
"Workspace ID \u2014 required when using organization admin API keys"
|
|
4897
5017
|
)
|
|
4898
5018
|
},
|
|
4899
5019
|
getMcpIntegration: {
|
|
4900
|
-
id:
|
|
5020
|
+
id: z12.string().describe("The MCP integration ID or slug to retrieve")
|
|
4901
5021
|
},
|
|
4902
5022
|
updateMcpIntegration: {
|
|
4903
|
-
id:
|
|
4904
|
-
name:
|
|
4905
|
-
description:
|
|
4906
|
-
url:
|
|
4907
|
-
auth_type:
|
|
4908
|
-
transport:
|
|
4909
|
-
custom_headers:
|
|
5023
|
+
id: z12.string().describe("The MCP integration ID or slug to update"),
|
|
5024
|
+
name: z12.string().optional().describe("New display name"),
|
|
5025
|
+
description: z12.string().optional().describe("New description"),
|
|
5026
|
+
url: z12.string().optional().describe("New URL endpoint"),
|
|
5027
|
+
auth_type: z12.enum(["oauth_auto", "headers", "none"]).optional().describe("New authentication type"),
|
|
5028
|
+
transport: z12.enum(["http", "sse"]).optional().describe("New transport protocol"),
|
|
5029
|
+
custom_headers: z12.record(z12.string(), z12.string()).optional().describe(
|
|
4910
5030
|
"New custom headers for authentication. Sent via configurations.custom_headers"
|
|
4911
5031
|
)
|
|
4912
5032
|
},
|
|
4913
5033
|
deleteMcpIntegration: {
|
|
4914
|
-
id:
|
|
5034
|
+
id: z12.string().describe("The MCP integration ID or slug to delete")
|
|
4915
5035
|
},
|
|
4916
5036
|
getMcpIntegrationMetadata: {
|
|
4917
|
-
id:
|
|
5037
|
+
id: z12.string().describe("The MCP integration ID or slug")
|
|
4918
5038
|
},
|
|
4919
5039
|
listMcpIntegrationCapabilities: {
|
|
4920
|
-
id:
|
|
5040
|
+
id: z12.string().describe("The MCP integration ID or slug")
|
|
4921
5041
|
},
|
|
4922
5042
|
updateMcpIntegrationCapabilities: {
|
|
4923
|
-
id:
|
|
4924
|
-
capabilities:
|
|
4925
|
-
|
|
4926
|
-
name:
|
|
4927
|
-
type:
|
|
4928
|
-
enabled:
|
|
5043
|
+
id: z12.string().describe("The MCP integration ID or slug"),
|
|
5044
|
+
capabilities: z12.array(
|
|
5045
|
+
z12.object({
|
|
5046
|
+
name: z12.string().describe("Capability name"),
|
|
5047
|
+
type: z12.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5048
|
+
enabled: z12.boolean().describe("Whether to enable the capability")
|
|
4929
5049
|
})
|
|
4930
5050
|
).min(1).describe("Array of capability updates")
|
|
4931
5051
|
},
|
|
4932
5052
|
listMcpIntegrationWorkspaces: {
|
|
4933
|
-
id:
|
|
5053
|
+
id: z12.string().describe("The MCP integration ID or slug")
|
|
4934
5054
|
},
|
|
4935
5055
|
updateMcpIntegrationWorkspaces: {
|
|
4936
|
-
id:
|
|
4937
|
-
workspaces:
|
|
4938
|
-
|
|
4939
|
-
id:
|
|
4940
|
-
enabled:
|
|
5056
|
+
id: z12.string().describe("The MCP integration ID or slug"),
|
|
5057
|
+
workspaces: z12.array(
|
|
5058
|
+
z12.object({
|
|
5059
|
+
id: z12.string().describe("Workspace ID"),
|
|
5060
|
+
enabled: z12.boolean().describe("Whether workspace has access")
|
|
4941
5061
|
})
|
|
4942
5062
|
).min(1).describe("Array of workspace access updates")
|
|
4943
5063
|
}
|
|
@@ -5229,7 +5349,7 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5229
5349
|
}
|
|
5230
5350
|
|
|
5231
5351
|
// src/tools/mcp-servers.tools.ts
|
|
5232
|
-
import { z as
|
|
5352
|
+
import { z as z13 } from "zod";
|
|
5233
5353
|
|
|
5234
5354
|
// src/tools/utils.ts
|
|
5235
5355
|
function formatFullName(firstName, lastName) {
|
|
@@ -5239,56 +5359,56 @@ function formatFullName(firstName, lastName) {
|
|
|
5239
5359
|
// src/tools/mcp-servers.tools.ts
|
|
5240
5360
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5241
5361
|
listMcpServers: {
|
|
5242
|
-
current_page:
|
|
5243
|
-
page_size:
|
|
5244
|
-
workspace_id:
|
|
5362
|
+
current_page: z13.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
5363
|
+
page_size: z13.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)"),
|
|
5364
|
+
workspace_id: z13.string().optional().describe("Filter by workspace ID")
|
|
5245
5365
|
},
|
|
5246
5366
|
createMcpServer: {
|
|
5247
|
-
name:
|
|
5248
|
-
mcp_integration_id:
|
|
5249
|
-
slug:
|
|
5250
|
-
description:
|
|
5367
|
+
name: z13.string().describe("Display name for the MCP server"),
|
|
5368
|
+
mcp_integration_id: z13.string().describe("ID or slug of the MCP integration this server belongs to"),
|
|
5369
|
+
slug: z13.string().optional().describe("Custom slug. Auto-generated if omitted"),
|
|
5370
|
+
description: z13.string().optional().describe("Description of the MCP server")
|
|
5251
5371
|
},
|
|
5252
5372
|
getMcpServer: {
|
|
5253
|
-
id:
|
|
5373
|
+
id: z13.string().describe("The MCP server ID or slug to retrieve")
|
|
5254
5374
|
},
|
|
5255
5375
|
updateMcpServer: {
|
|
5256
|
-
id:
|
|
5257
|
-
name:
|
|
5258
|
-
description:
|
|
5376
|
+
id: z13.string().describe("The MCP server ID or slug to update"),
|
|
5377
|
+
name: z13.string().optional().describe("New display name"),
|
|
5378
|
+
description: z13.string().optional().describe("New description")
|
|
5259
5379
|
},
|
|
5260
5380
|
deleteMcpServer: {
|
|
5261
|
-
id:
|
|
5381
|
+
id: z13.string().describe("The MCP server ID or slug to delete")
|
|
5262
5382
|
},
|
|
5263
5383
|
testMcpServer: {
|
|
5264
|
-
id:
|
|
5384
|
+
id: z13.string().describe("The MCP server ID or slug to test")
|
|
5265
5385
|
},
|
|
5266
5386
|
listMcpServerCapabilities: {
|
|
5267
|
-
id:
|
|
5268
|
-
current_page:
|
|
5269
|
-
page_size:
|
|
5387
|
+
id: z13.string().describe("The MCP server ID or slug"),
|
|
5388
|
+
current_page: z13.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
5389
|
+
page_size: z13.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
5270
5390
|
},
|
|
5271
5391
|
updateMcpServerCapabilities: {
|
|
5272
|
-
id:
|
|
5273
|
-
capabilities:
|
|
5274
|
-
|
|
5275
|
-
name:
|
|
5276
|
-
type:
|
|
5277
|
-
enabled:
|
|
5392
|
+
id: z13.string().describe("The MCP server ID or slug"),
|
|
5393
|
+
capabilities: z13.array(
|
|
5394
|
+
z13.object({
|
|
5395
|
+
name: z13.string().describe("Capability name"),
|
|
5396
|
+
type: z13.enum(["tool", "prompt", "resource"]).describe("Capability type"),
|
|
5397
|
+
enabled: z13.boolean().describe("Whether to enable the capability")
|
|
5278
5398
|
})
|
|
5279
5399
|
).min(1).describe("Array of capability updates")
|
|
5280
5400
|
},
|
|
5281
5401
|
listMcpServerUserAccess: {
|
|
5282
|
-
id:
|
|
5283
|
-
current_page:
|
|
5284
|
-
page_size:
|
|
5402
|
+
id: z13.string().describe("The MCP server ID or slug"),
|
|
5403
|
+
current_page: z13.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
5404
|
+
page_size: z13.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
5285
5405
|
},
|
|
5286
5406
|
updateMcpServerUserAccess: {
|
|
5287
|
-
id:
|
|
5288
|
-
users:
|
|
5289
|
-
|
|
5290
|
-
user_id:
|
|
5291
|
-
enabled:
|
|
5407
|
+
id: z13.string().describe("The MCP server ID or slug"),
|
|
5408
|
+
users: z13.array(
|
|
5409
|
+
z13.object({
|
|
5410
|
+
user_id: z13.string().describe("User ID"),
|
|
5411
|
+
enabled: z13.boolean().describe("Whether user has access")
|
|
5292
5412
|
})
|
|
5293
5413
|
).min(1).describe("Array of user access updates")
|
|
5294
5414
|
}
|
|
@@ -5532,40 +5652,40 @@ function registerMcpServersTools(server, service) {
|
|
|
5532
5652
|
}
|
|
5533
5653
|
|
|
5534
5654
|
// src/tools/partials.tools.ts
|
|
5535
|
-
import { z as
|
|
5655
|
+
import { z as z14 } from "zod";
|
|
5536
5656
|
var PARTIALS_TOOL_SCHEMAS = {
|
|
5537
5657
|
createPromptPartial: {
|
|
5538
|
-
name:
|
|
5539
|
-
string:
|
|
5540
|
-
workspace_id:
|
|
5658
|
+
name: z14.string().describe("Display name for the partial"),
|
|
5659
|
+
string: z14.string().describe("The partial content/template string"),
|
|
5660
|
+
workspace_id: z14.string().optional().describe(
|
|
5541
5661
|
"Workspace ID to create partial in (required for org-level API keys)"
|
|
5542
5662
|
),
|
|
5543
|
-
version_description:
|
|
5663
|
+
version_description: z14.string().optional().describe("Description for this version")
|
|
5544
5664
|
},
|
|
5545
5665
|
listPromptPartials: {
|
|
5546
|
-
collection_id:
|
|
5666
|
+
collection_id: z14.string().optional().describe(
|
|
5547
5667
|
"Filter by collection ID. Optional \u2014 omit to list all partials across collections"
|
|
5548
5668
|
)
|
|
5549
5669
|
},
|
|
5550
5670
|
getPromptPartial: {
|
|
5551
|
-
prompt_partial_id:
|
|
5671
|
+
prompt_partial_id: z14.string().describe("Prompt partial ID or slug to retrieve")
|
|
5552
5672
|
},
|
|
5553
5673
|
updatePromptPartial: {
|
|
5554
|
-
prompt_partial_id:
|
|
5555
|
-
name:
|
|
5556
|
-
string:
|
|
5557
|
-
description:
|
|
5558
|
-
status:
|
|
5674
|
+
prompt_partial_id: z14.string().describe("Prompt partial ID or slug to update"),
|
|
5675
|
+
name: z14.string().optional().describe("New display name for the partial"),
|
|
5676
|
+
string: z14.string().optional().describe("New content for the partial"),
|
|
5677
|
+
description: z14.string().optional().describe("Description for this version"),
|
|
5678
|
+
status: z14.enum(["active", "archived"]).optional().describe("New status for the partial")
|
|
5559
5679
|
},
|
|
5560
5680
|
deletePromptPartial: {
|
|
5561
|
-
prompt_partial_id:
|
|
5681
|
+
prompt_partial_id: z14.string().describe("Prompt partial ID or slug to delete")
|
|
5562
5682
|
},
|
|
5563
5683
|
listPartialVersions: {
|
|
5564
|
-
prompt_partial_id:
|
|
5684
|
+
prompt_partial_id: z14.string().describe("Prompt partial ID or slug to list versions for")
|
|
5565
5685
|
},
|
|
5566
5686
|
publishPartial: {
|
|
5567
|
-
prompt_partial_id:
|
|
5568
|
-
version:
|
|
5687
|
+
prompt_partial_id: z14.string().describe("Prompt partial ID or slug"),
|
|
5688
|
+
version: z14.coerce.number().positive().describe("Version number to publish as default")
|
|
5569
5689
|
}
|
|
5570
5690
|
};
|
|
5571
5691
|
function registerPartialsTools(server, service) {
|
|
@@ -5751,57 +5871,57 @@ function registerPartialsTools(server, service) {
|
|
|
5751
5871
|
}
|
|
5752
5872
|
|
|
5753
5873
|
// src/tools/prompts.tools.ts
|
|
5754
|
-
import { z as
|
|
5874
|
+
import { z as z16 } from "zod";
|
|
5755
5875
|
|
|
5756
5876
|
// src/lib/schemas.ts
|
|
5757
|
-
import { z as
|
|
5758
|
-
var PromptFunctionSchema =
|
|
5759
|
-
name:
|
|
5760
|
-
description:
|
|
5761
|
-
parameters:
|
|
5877
|
+
import { z as z15 } from "zod";
|
|
5878
|
+
var PromptFunctionSchema = z15.object({
|
|
5879
|
+
name: z15.string().describe("Function name"),
|
|
5880
|
+
description: z15.string().optional().describe("Function description"),
|
|
5881
|
+
parameters: z15.record(z15.string(), z15.unknown()).optional().describe("Function parameters schema")
|
|
5762
5882
|
});
|
|
5763
|
-
var PromptToolSchema =
|
|
5764
|
-
type:
|
|
5883
|
+
var PromptToolSchema = z15.object({
|
|
5884
|
+
type: z15.literal("function").describe("Tool type"),
|
|
5765
5885
|
function: PromptFunctionSchema.describe("Function definition")
|
|
5766
5886
|
});
|
|
5767
|
-
var HyperparametersSchema =
|
|
5768
|
-
max_tokens:
|
|
5769
|
-
temperature:
|
|
5770
|
-
top_p:
|
|
5771
|
-
top_k:
|
|
5772
|
-
presence_penalty:
|
|
5773
|
-
frequency_penalty:
|
|
5774
|
-
stop:
|
|
5887
|
+
var HyperparametersSchema = z15.object({
|
|
5888
|
+
max_tokens: z15.coerce.number().positive().optional().describe("Maximum tokens to generate"),
|
|
5889
|
+
temperature: z15.coerce.number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
5890
|
+
top_p: z15.coerce.number().min(0).max(1).optional().describe("Top-p sampling (0-1)"),
|
|
5891
|
+
top_k: z15.coerce.number().positive().optional().describe("Top-k sampling"),
|
|
5892
|
+
presence_penalty: z15.coerce.number().min(-2).max(2).optional().describe("Presence penalty (-2 to 2)"),
|
|
5893
|
+
frequency_penalty: z15.coerce.number().min(-2).max(2).optional().describe("Frequency penalty (-2 to 2)"),
|
|
5894
|
+
stop: z15.array(z15.string()).optional().describe("Stop sequences")
|
|
5775
5895
|
});
|
|
5776
|
-
var PromptAppIdentifierSchema =
|
|
5896
|
+
var PromptAppIdentifierSchema = z15.string().min(1).describe(
|
|
5777
5897
|
"App identifier (REQUIRED). Use your deployed app name, for example 'hourlink' or 'support-console'."
|
|
5778
5898
|
);
|
|
5779
|
-
var PromptEnvironmentIdentifierSchema =
|
|
5899
|
+
var PromptEnvironmentIdentifierSchema = z15.string().min(1).describe(
|
|
5780
5900
|
"Environment identifier (REQUIRED). Use your environment name, for example 'dev', 'staging', 'prod', or 'qa'."
|
|
5781
5901
|
);
|
|
5782
|
-
var BillingMetadataSchema =
|
|
5783
|
-
client_id:
|
|
5902
|
+
var BillingMetadataSchema = z15.object({
|
|
5903
|
+
client_id: z15.string().describe("Client ID for billing attribution (REQUIRED)"),
|
|
5784
5904
|
app: PromptAppIdentifierSchema,
|
|
5785
5905
|
env: PromptEnvironmentIdentifierSchema,
|
|
5786
|
-
project_id:
|
|
5787
|
-
feature:
|
|
5906
|
+
project_id: z15.string().optional().describe("Project ID for granular billing"),
|
|
5907
|
+
feature: z15.string().optional().describe("Feature name for tracking")
|
|
5788
5908
|
});
|
|
5789
|
-
var ToolChoiceSchema =
|
|
5790
|
-
mode:
|
|
5909
|
+
var ToolChoiceSchema = z15.object({
|
|
5910
|
+
mode: z15.enum(["auto", "none", "function"]).describe(
|
|
5791
5911
|
"Tool choice mode: auto lets the model decide, none disables tool use, function forces one function by name"
|
|
5792
5912
|
),
|
|
5793
|
-
function_name:
|
|
5913
|
+
function_name: z15.string().optional().describe("Required when mode is 'function'; ignored otherwise")
|
|
5794
5914
|
}).superRefine((value, ctx) => {
|
|
5795
5915
|
if (value.mode === "function" && !value.function_name) {
|
|
5796
5916
|
ctx.addIssue({
|
|
5797
|
-
code:
|
|
5917
|
+
code: z15.ZodIssueCode.custom,
|
|
5798
5918
|
path: ["function_name"],
|
|
5799
5919
|
message: "function_name is required when mode is 'function'"
|
|
5800
5920
|
});
|
|
5801
5921
|
}
|
|
5802
5922
|
if (value.mode !== "function" && value.function_name !== void 0) {
|
|
5803
5923
|
ctx.addIssue({
|
|
5804
|
-
code:
|
|
5924
|
+
code: z15.ZodIssueCode.custom,
|
|
5805
5925
|
path: ["function_name"],
|
|
5806
5926
|
message: "function_name is only allowed when mode is 'function'"
|
|
5807
5927
|
});
|
|
@@ -5823,98 +5943,98 @@ function toPromptToolChoice(toolChoice) {
|
|
|
5823
5943
|
}
|
|
5824
5944
|
|
|
5825
5945
|
// src/tools/prompts.tools.ts
|
|
5826
|
-
var PROMPT_VARIABLES_SCHEMA =
|
|
5827
|
-
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA =
|
|
5828
|
-
type:
|
|
5829
|
-
text:
|
|
5946
|
+
var PROMPT_VARIABLES_SCHEMA = z16.record(z16.string(), z16.union([z16.string(), z16.coerce.number(), z16.boolean()])).describe("Variable values to substitute into the template");
|
|
5947
|
+
var PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA = z16.object({
|
|
5948
|
+
type: z16.string().describe("Content block type"),
|
|
5949
|
+
text: z16.string().optional().describe("Text content for text-based blocks")
|
|
5830
5950
|
}).passthrough().describe("Content block within a structured chat message");
|
|
5831
|
-
var PROMPT_TEMPLATE_MESSAGE_SCHEMA =
|
|
5832
|
-
role:
|
|
5833
|
-
content:
|
|
5951
|
+
var PROMPT_TEMPLATE_MESSAGE_SCHEMA = z16.object({
|
|
5952
|
+
role: z16.enum(["system", "user", "assistant"]).describe("Message role in the chat template"),
|
|
5953
|
+
content: z16.array(PROMPT_TEMPLATE_CONTENT_BLOCK_SCHEMA).describe("Message content blocks")
|
|
5834
5954
|
}).passthrough().describe("Structured chat message in a prompt template");
|
|
5835
5955
|
var PROMPTS_TOOL_SCHEMAS = {
|
|
5836
5956
|
createPrompt: {
|
|
5837
|
-
name:
|
|
5838
|
-
collection_id:
|
|
5957
|
+
name: z16.string().describe("Display name for the prompt"),
|
|
5958
|
+
collection_id: z16.string().describe(
|
|
5839
5959
|
"Collection ID to organize the prompt in (use list_collections to find)"
|
|
5840
5960
|
),
|
|
5841
|
-
string:
|
|
5961
|
+
string: z16.string().optional().describe(
|
|
5842
5962
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
5843
5963
|
),
|
|
5844
|
-
messages:
|
|
5964
|
+
messages: z16.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
5845
5965
|
"Structured chat template alias. Serialized to the legacy string format before creation."
|
|
5846
5966
|
),
|
|
5847
|
-
parameters:
|
|
5848
|
-
virtual_key:
|
|
5849
|
-
model:
|
|
5967
|
+
parameters: z16.record(z16.string(), z16.unknown()).describe("Default values for template variables"),
|
|
5968
|
+
virtual_key: z16.string().describe("Virtual key slug for model access"),
|
|
5969
|
+
model: z16.string().optional().describe(
|
|
5850
5970
|
"Model identifier (e.g., 'gpt-4', 'claude-3-opus'). Required unless ai_model_id or finetune_id is provided"
|
|
5851
5971
|
),
|
|
5852
|
-
ai_model_id:
|
|
5972
|
+
ai_model_id: z16.string().optional().describe(
|
|
5853
5973
|
"AI model ID (alternative to model). Required unless model or finetune_id is provided"
|
|
5854
5974
|
),
|
|
5855
|
-
finetune_id:
|
|
5975
|
+
finetune_id: z16.string().optional().describe(
|
|
5856
5976
|
"Fine-tune ID (alternative to model). Required unless model or ai_model_id is provided"
|
|
5857
5977
|
),
|
|
5858
|
-
version_description:
|
|
5859
|
-
template_metadata:
|
|
5860
|
-
functions:
|
|
5861
|
-
tools:
|
|
5978
|
+
version_description: z16.string().optional().describe("Description for this prompt version"),
|
|
5979
|
+
template_metadata: z16.record(z16.string(), z16.unknown()).optional().describe("Custom metadata (app, env, source_file, etc.)"),
|
|
5980
|
+
functions: z16.array(PromptFunctionSchema).optional().describe("Function definitions for function calling"),
|
|
5981
|
+
tools: z16.array(PromptToolSchema).optional().describe("Tool definitions for tool use"),
|
|
5862
5982
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
5863
|
-
dry_run:
|
|
5983
|
+
dry_run: z16.boolean().optional().describe("When true, validate without creating")
|
|
5864
5984
|
},
|
|
5865
5985
|
listPrompts: {
|
|
5866
|
-
collection_id:
|
|
5986
|
+
collection_id: z16.string().optional().describe(
|
|
5867
5987
|
"Filter by collection ID (recommended for app-specific prompts)"
|
|
5868
5988
|
),
|
|
5869
|
-
workspace_id:
|
|
5870
|
-
search:
|
|
5871
|
-
current_page:
|
|
5872
|
-
page_size:
|
|
5989
|
+
workspace_id: z16.string().optional().describe("Filter by workspace ID"),
|
|
5990
|
+
search: z16.string().optional().describe("Search prompts by name"),
|
|
5991
|
+
current_page: z16.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
5992
|
+
page_size: z16.coerce.number().int().positive().max(100).optional().describe("Results per page (max 100)")
|
|
5873
5993
|
},
|
|
5874
5994
|
getPrompt: {
|
|
5875
|
-
prompt_id:
|
|
5995
|
+
prompt_id: z16.string().describe("Prompt ID or slug to retrieve")
|
|
5876
5996
|
},
|
|
5877
5997
|
updatePrompt: {
|
|
5878
|
-
prompt_id:
|
|
5879
|
-
name:
|
|
5880
|
-
collection_id:
|
|
5881
|
-
string:
|
|
5998
|
+
prompt_id: z16.string().describe("Prompt ID or slug to update"),
|
|
5999
|
+
name: z16.string().optional().describe("New display name for the prompt"),
|
|
6000
|
+
collection_id: z16.string().optional().describe("Move to a different collection"),
|
|
6001
|
+
string: z16.string().optional().describe(
|
|
5882
6002
|
"Legacy prompt template string. Use plain text for single-message prompts, or a JSON-encoded messages array string for multi-message chat prompts."
|
|
5883
6003
|
),
|
|
5884
|
-
messages:
|
|
6004
|
+
messages: z16.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
5885
6005
|
"Structured chat template alias for updates. Serialized to the legacy string format before the prompt is updated."
|
|
5886
6006
|
),
|
|
5887
|
-
parameters:
|
|
5888
|
-
model:
|
|
5889
|
-
virtual_key:
|
|
5890
|
-
version_description:
|
|
5891
|
-
template_metadata:
|
|
5892
|
-
functions:
|
|
5893
|
-
tools:
|
|
6007
|
+
parameters: z16.record(z16.string(), z16.unknown()).optional().describe("New default values for template variables"),
|
|
6008
|
+
model: z16.string().optional().describe("New model identifier"),
|
|
6009
|
+
virtual_key: z16.string().optional().describe("New virtual key slug"),
|
|
6010
|
+
version_description: z16.string().optional().describe("Description for this version"),
|
|
6011
|
+
template_metadata: z16.record(z16.string(), z16.unknown()).optional().describe("New metadata"),
|
|
6012
|
+
functions: z16.array(PromptFunctionSchema).optional().describe("New function definitions"),
|
|
6013
|
+
tools: z16.array(PromptToolSchema).optional().describe("New tool definitions"),
|
|
5894
6014
|
tool_choice: ToolChoiceSchema.optional().describe(
|
|
5895
6015
|
"New tool choice strategy"
|
|
5896
6016
|
),
|
|
5897
|
-
dry_run:
|
|
6017
|
+
dry_run: z16.boolean().optional().describe("When true, validate without updating")
|
|
5898
6018
|
},
|
|
5899
6019
|
deletePrompt: {
|
|
5900
|
-
prompt_id:
|
|
6020
|
+
prompt_id: z16.string().describe("Prompt ID or slug to delete")
|
|
5901
6021
|
},
|
|
5902
6022
|
publishPrompt: {
|
|
5903
|
-
prompt_id:
|
|
5904
|
-
version:
|
|
6023
|
+
prompt_id: z16.string().describe("Prompt ID or slug to publish"),
|
|
6024
|
+
version: z16.coerce.number().positive().describe("Version number to publish as the default")
|
|
5905
6025
|
},
|
|
5906
6026
|
listPromptVersions: {
|
|
5907
|
-
prompt_id:
|
|
6027
|
+
prompt_id: z16.string().describe("Prompt ID or slug to list versions for")
|
|
5908
6028
|
},
|
|
5909
6029
|
renderPrompt: {
|
|
5910
|
-
prompt_id:
|
|
6030
|
+
prompt_id: z16.string().describe("Prompt ID or slug to render"),
|
|
5911
6031
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
5912
6032
|
hyperparameters: HyperparametersSchema.optional().describe(
|
|
5913
6033
|
"Override default hyperparameters"
|
|
5914
6034
|
)
|
|
5915
6035
|
},
|
|
5916
6036
|
runPromptCompletion: {
|
|
5917
|
-
prompt_id:
|
|
6037
|
+
prompt_id: z16.string().describe("Prompt ID or slug to execute"),
|
|
5918
6038
|
variables: PROMPT_VARIABLES_SCHEMA,
|
|
5919
6039
|
metadata: BillingMetadataSchema.describe(
|
|
5920
6040
|
"Billing metadata - client_id, app, env are REQUIRED for cost attribution"
|
|
@@ -5924,54 +6044,54 @@ var PROMPTS_TOOL_SCHEMAS = {
|
|
|
5924
6044
|
)
|
|
5925
6045
|
},
|
|
5926
6046
|
migratePrompt: {
|
|
5927
|
-
name:
|
|
6047
|
+
name: z16.string().describe("Prompt name to create or find for update"),
|
|
5928
6048
|
app: PromptAppIdentifierSchema,
|
|
5929
6049
|
env: PromptEnvironmentIdentifierSchema,
|
|
5930
|
-
collection_id:
|
|
5931
|
-
string:
|
|
6050
|
+
collection_id: z16.string().describe("Collection ID to search in and create under"),
|
|
6051
|
+
string: z16.string().optional().describe(
|
|
5932
6052
|
"Legacy prompt template string with {{variable}} mustache syntax."
|
|
5933
6053
|
),
|
|
5934
|
-
messages:
|
|
6054
|
+
messages: z16.array(PROMPT_TEMPLATE_MESSAGE_SCHEMA).optional().describe(
|
|
5935
6055
|
"Structured chat template alias for migrations. Serialized to the legacy string format before the prompt is created or updated."
|
|
5936
6056
|
),
|
|
5937
|
-
parameters:
|
|
5938
|
-
virtual_key:
|
|
5939
|
-
model:
|
|
5940
|
-
version_description:
|
|
5941
|
-
template_metadata:
|
|
5942
|
-
functions:
|
|
5943
|
-
tools:
|
|
6057
|
+
parameters: z16.record(z16.string(), z16.unknown()).describe("Default values for template variables"),
|
|
6058
|
+
virtual_key: z16.string().describe("Virtual key slug for model access"),
|
|
6059
|
+
model: z16.string().optional().describe("Model identifier"),
|
|
6060
|
+
version_description: z16.string().optional().describe("Description for this version"),
|
|
6061
|
+
template_metadata: z16.record(z16.string(), z16.unknown()).optional().describe("Additional custom metadata"),
|
|
6062
|
+
functions: z16.array(PromptFunctionSchema).optional().describe("Function definitions"),
|
|
6063
|
+
tools: z16.array(PromptToolSchema).optional().describe("Tool definitions"),
|
|
5944
6064
|
tool_choice: ToolChoiceSchema.optional().describe("Tool choice strategy"),
|
|
5945
|
-
dry_run:
|
|
6065
|
+
dry_run: z16.boolean().optional().describe(
|
|
5946
6066
|
"When true, only check what action would be taken without making changes"
|
|
5947
6067
|
)
|
|
5948
6068
|
},
|
|
5949
6069
|
promotePrompt: {
|
|
5950
|
-
source_prompt_id:
|
|
5951
|
-
target_collection_id:
|
|
5952
|
-
target_name:
|
|
6070
|
+
source_prompt_id: z16.string().describe("Source prompt ID or slug (e.g., staging prompt)"),
|
|
6071
|
+
target_collection_id: z16.string().describe("Target collection ID for the promoted prompt"),
|
|
6072
|
+
target_name: z16.string().optional().describe(
|
|
5953
6073
|
"Target prompt name (defaults to source name with env suffix replaced)"
|
|
5954
6074
|
),
|
|
5955
6075
|
target_env: PromptEnvironmentIdentifierSchema,
|
|
5956
|
-
virtual_key:
|
|
6076
|
+
virtual_key: z16.string().optional().describe(
|
|
5957
6077
|
"Virtual key ID to use (defaults to source prompt's virtual_key)"
|
|
5958
6078
|
)
|
|
5959
6079
|
},
|
|
5960
6080
|
validateCompletionMetadata: {
|
|
5961
|
-
client_id:
|
|
6081
|
+
client_id: z16.string().optional().describe("Client ID for billing attribution"),
|
|
5962
6082
|
app: PromptAppIdentifierSchema.optional(),
|
|
5963
6083
|
env: PromptEnvironmentIdentifierSchema.optional(),
|
|
5964
|
-
project_id:
|
|
5965
|
-
feature:
|
|
6084
|
+
project_id: z16.string().optional().describe("Project ID for granular billing"),
|
|
6085
|
+
feature: z16.string().optional().describe("Feature name for tracking")
|
|
5966
6086
|
},
|
|
5967
6087
|
getPromptVersion: {
|
|
5968
|
-
prompt_id:
|
|
5969
|
-
version_id:
|
|
6088
|
+
prompt_id: z16.string().describe("Prompt ID or slug"),
|
|
6089
|
+
version_id: z16.string().describe("Version UUID to retrieve")
|
|
5970
6090
|
},
|
|
5971
6091
|
updatePromptVersion: {
|
|
5972
|
-
prompt_id:
|
|
5973
|
-
version_id:
|
|
5974
|
-
label_id:
|
|
6092
|
+
prompt_id: z16.string().describe("Prompt ID or slug"),
|
|
6093
|
+
version_id: z16.string().describe("Version UUID to update"),
|
|
6094
|
+
label_id: z16.string().nullable().describe(
|
|
5975
6095
|
"Label ID to assign to this version, or null to remove the label"
|
|
5976
6096
|
)
|
|
5977
6097
|
}
|
|
@@ -6561,68 +6681,68 @@ function registerPromptsTools(server, service) {
|
|
|
6561
6681
|
}
|
|
6562
6682
|
|
|
6563
6683
|
// src/tools/providers.tools.ts
|
|
6564
|
-
import { z as
|
|
6684
|
+
import { z as z17 } from "zod";
|
|
6565
6685
|
var PROVIDERS_TOOL_SCHEMAS = {
|
|
6566
6686
|
listProviders: {
|
|
6567
|
-
current_page:
|
|
6568
|
-
page_size:
|
|
6569
|
-
workspace_id:
|
|
6687
|
+
current_page: z17.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
6688
|
+
page_size: z17.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100, default 50)"),
|
|
6689
|
+
workspace_id: z17.string().optional().describe(
|
|
6570
6690
|
"Workspace ID - required when using organization admin keys, optional with workspace API keys"
|
|
6571
6691
|
)
|
|
6572
6692
|
},
|
|
6573
6693
|
createProvider: {
|
|
6574
|
-
name:
|
|
6575
|
-
integration_id:
|
|
6694
|
+
name: z17.string().describe("Display name for the provider"),
|
|
6695
|
+
integration_id: z17.string().describe(
|
|
6576
6696
|
"Integration slug for the provider (e.g., 'openai', 'anthropic', 'azure-openai')"
|
|
6577
6697
|
),
|
|
6578
|
-
workspace_id:
|
|
6698
|
+
workspace_id: z17.string().optional().describe(
|
|
6579
6699
|
"Workspace ID - required when using organization admin API keys"
|
|
6580
6700
|
),
|
|
6581
|
-
slug:
|
|
6701
|
+
slug: z17.string().optional().describe(
|
|
6582
6702
|
"Custom slug for the provider. Auto-generated with random suffix if omitted"
|
|
6583
6703
|
),
|
|
6584
|
-
note:
|
|
6585
|
-
credit_limit:
|
|
6586
|
-
alert_threshold:
|
|
6587
|
-
usage_limit_type:
|
|
6704
|
+
note: z17.string().optional().describe("Optional note or description for the provider"),
|
|
6705
|
+
credit_limit: z17.coerce.number().positive().optional().describe("Credit limit for usage"),
|
|
6706
|
+
alert_threshold: z17.coerce.number().min(0).max(100).optional().describe("Alert threshold percentage (0-100)"),
|
|
6707
|
+
usage_limit_type: z17.enum(["cost", "tokens"]).optional().describe(
|
|
6588
6708
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
6589
6709
|
),
|
|
6590
|
-
periodic_reset:
|
|
6710
|
+
periodic_reset: z17.enum(["monthly", "weekly"]).optional().describe(
|
|
6591
6711
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
6592
6712
|
),
|
|
6593
|
-
rate_limit_value:
|
|
6594
|
-
rate_limit_unit:
|
|
6713
|
+
rate_limit_value: z17.coerce.number().positive().optional().describe("Must be provided together with rate_limit_unit."),
|
|
6714
|
+
rate_limit_unit: z17.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
6595
6715
|
"Must be provided together with rate_limit_value. Values: 'rpm' (requests/min), 'rph' (requests/hour), or 'rpd' (requests/day)."
|
|
6596
6716
|
),
|
|
6597
|
-
expires_at:
|
|
6717
|
+
expires_at: z17.string().optional().describe("Expiration date in ISO 8601 format")
|
|
6598
6718
|
},
|
|
6599
6719
|
getProvider: {
|
|
6600
|
-
slug:
|
|
6601
|
-
workspace_id:
|
|
6720
|
+
slug: z17.string().describe("The unique slug identifier of the provider to retrieve"),
|
|
6721
|
+
workspace_id: z17.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
6602
6722
|
},
|
|
6603
6723
|
updateProvider: {
|
|
6604
|
-
slug:
|
|
6605
|
-
workspace_id:
|
|
6606
|
-
name:
|
|
6607
|
-
note:
|
|
6608
|
-
credit_limit:
|
|
6609
|
-
alert_threshold:
|
|
6610
|
-
usage_limit_type:
|
|
6724
|
+
slug: z17.string().describe("The slug of the provider to update"),
|
|
6725
|
+
workspace_id: z17.string().optional().describe("Workspace ID - required when using organization admin keys"),
|
|
6726
|
+
name: z17.string().optional().describe("New display name for the provider"),
|
|
6727
|
+
note: z17.string().optional().describe("New note or description for the provider"),
|
|
6728
|
+
credit_limit: z17.coerce.number().positive().optional().describe("New credit limit for usage"),
|
|
6729
|
+
alert_threshold: z17.coerce.number().min(0).max(100).optional().describe("New alert threshold percentage (0-100)"),
|
|
6730
|
+
usage_limit_type: z17.enum(["cost", "tokens"]).optional().describe(
|
|
6611
6731
|
"Type of usage limit: 'cost' (monetary) or 'tokens' (token count). Defaults to 'cost'."
|
|
6612
6732
|
),
|
|
6613
|
-
periodic_reset:
|
|
6733
|
+
periodic_reset: z17.enum(["monthly", "weekly"]).optional().describe(
|
|
6614
6734
|
"Period for resetting usage limits: 'monthly' or 'weekly'. Defaults to 'monthly'."
|
|
6615
6735
|
),
|
|
6616
|
-
rate_limit_value:
|
|
6617
|
-
rate_limit_unit:
|
|
6736
|
+
rate_limit_value: z17.coerce.number().positive().optional().describe("New rate limit value"),
|
|
6737
|
+
rate_limit_unit: z17.enum(["rpm", "rph", "rpd"]).optional().describe(
|
|
6618
6738
|
"Rate limit unit: 'rpm' (requests per minute), 'rph' (requests per hour), or 'rpd' (requests per day)"
|
|
6619
6739
|
),
|
|
6620
|
-
expires_at:
|
|
6621
|
-
reset_usage:
|
|
6740
|
+
expires_at: z17.string().optional().describe("New expiration date in ISO 8601 format"),
|
|
6741
|
+
reset_usage: z17.boolean().optional().describe("Set to true to reset accumulated usage metrics")
|
|
6622
6742
|
},
|
|
6623
6743
|
deleteProvider: {
|
|
6624
|
-
slug:
|
|
6625
|
-
workspace_id:
|
|
6744
|
+
slug: z17.string().describe("The slug of the provider to delete"),
|
|
6745
|
+
workspace_id: z17.string().optional().describe("Workspace ID - required when using organization admin keys")
|
|
6626
6746
|
}
|
|
6627
6747
|
};
|
|
6628
6748
|
function registerProvidersTools(server, service) {
|
|
@@ -6803,30 +6923,427 @@ function registerProvidersTools(server, service) {
|
|
|
6803
6923
|
);
|
|
6804
6924
|
}
|
|
6805
6925
|
|
|
6926
|
+
// src/tools/secret-references.tools.ts
|
|
6927
|
+
import { z as z18 } from "zod";
|
|
6928
|
+
var authFields = {
|
|
6929
|
+
aws_auth_type: z18.enum(["accessKey", "assumedRole", "serviceRole"]).describe(
|
|
6930
|
+
"AWS authentication mode: accessKey uses a key pair, assumedRole uses an IAM role, and serviceRole uses the runtime workload identity"
|
|
6931
|
+
),
|
|
6932
|
+
aws_access_key_id: z18.string().min(1).describe("AWS access key ID; required when aws_auth_type is accessKey"),
|
|
6933
|
+
aws_secret_access_key: z18.string().min(1).describe(
|
|
6934
|
+
"AWS secret access key; required when aws_auth_type is accessKey and exposed to the MCP transcript"
|
|
6935
|
+
),
|
|
6936
|
+
aws_region: z18.string().min(1).describe("AWS region containing the secret, for example us-east-1"),
|
|
6937
|
+
aws_role_arn: z18.string().min(1).describe(
|
|
6938
|
+
"IAM role ARN to assume; required when aws_auth_type is assumedRole"
|
|
6939
|
+
),
|
|
6940
|
+
aws_external_id: z18.string().nullable().describe("Optional external ID required by the target IAM role"),
|
|
6941
|
+
azure_auth_mode: z18.enum(["entra", "managed", "default"]).describe(
|
|
6942
|
+
"Azure authentication mode: entra uses a client secret, managed uses managed identity, and default uses the runtime credential chain"
|
|
6943
|
+
),
|
|
6944
|
+
azure_entra_tenant_id: z18.string().min(1).describe("Microsoft Entra tenant ID; required for entra authentication"),
|
|
6945
|
+
azure_entra_client_id: z18.string().min(1).describe(
|
|
6946
|
+
"Microsoft Entra application client ID; required for entra authentication"
|
|
6947
|
+
),
|
|
6948
|
+
azure_entra_client_secret: z18.string().min(1).describe(
|
|
6949
|
+
"Microsoft Entra client secret; required for entra authentication and exposed to the MCP transcript"
|
|
6950
|
+
),
|
|
6951
|
+
azure_managed_client_id: z18.string().min(1).describe(
|
|
6952
|
+
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
6953
|
+
),
|
|
6954
|
+
azure_vault_url: z18.url().describe(
|
|
6955
|
+
"Azure Key Vault URL, for example https://example.vault.azure.net"
|
|
6956
|
+
),
|
|
6957
|
+
vault_auth_type: z18.enum(["token", "approle", "kubernetes"]).describe(
|
|
6958
|
+
"HashiCorp Vault authentication mode: token, AppRole, or Kubernetes"
|
|
6959
|
+
),
|
|
6960
|
+
vault_addr: z18.url().describe("Base URL of the HashiCorp Vault server"),
|
|
6961
|
+
vault_token: z18.string().min(1).describe(
|
|
6962
|
+
"HashiCorp Vault token; required for token authentication and exposed to the MCP transcript"
|
|
6963
|
+
),
|
|
6964
|
+
vault_namespace: z18.string().min(1).describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
6965
|
+
vault_role_id: z18.string().min(1).describe(
|
|
6966
|
+
"HashiCorp Vault AppRole role ID; required for approle authentication"
|
|
6967
|
+
),
|
|
6968
|
+
vault_secret_id: z18.string().min(1).describe(
|
|
6969
|
+
"HashiCorp Vault AppRole secret ID; required for approle authentication and exposed to the MCP transcript"
|
|
6970
|
+
),
|
|
6971
|
+
vault_role: z18.string().min(1).describe("HashiCorp Vault Kubernetes auth role name")
|
|
6972
|
+
};
|
|
6973
|
+
var authConfigSchema = z18.union([
|
|
6974
|
+
z18.object({
|
|
6975
|
+
aws_auth_type: z18.literal("accessKey").describe("Use an AWS access key ID and secret access key"),
|
|
6976
|
+
aws_access_key_id: authFields.aws_access_key_id,
|
|
6977
|
+
aws_secret_access_key: authFields.aws_secret_access_key,
|
|
6978
|
+
aws_region: authFields.aws_region
|
|
6979
|
+
}).strict(),
|
|
6980
|
+
z18.object({
|
|
6981
|
+
aws_auth_type: z18.literal("assumedRole").describe("Assume the specified AWS IAM role"),
|
|
6982
|
+
aws_role_arn: authFields.aws_role_arn,
|
|
6983
|
+
aws_external_id: authFields.aws_external_id.optional(),
|
|
6984
|
+
aws_region: authFields.aws_region
|
|
6985
|
+
}).strict(),
|
|
6986
|
+
z18.object({
|
|
6987
|
+
aws_auth_type: z18.literal("serviceRole").describe("Use the AWS workload or service role available at runtime"),
|
|
6988
|
+
aws_region: z18.string().optional().describe(
|
|
6989
|
+
"Optional AWS region containing the secret, for example us-east-1"
|
|
6990
|
+
)
|
|
6991
|
+
}).strict(),
|
|
6992
|
+
z18.object({
|
|
6993
|
+
azure_auth_mode: z18.literal("entra").describe(
|
|
6994
|
+
"Authenticate with a Microsoft Entra application client secret"
|
|
6995
|
+
),
|
|
6996
|
+
azure_entra_tenant_id: authFields.azure_entra_tenant_id,
|
|
6997
|
+
azure_entra_client_id: authFields.azure_entra_client_id,
|
|
6998
|
+
azure_entra_client_secret: authFields.azure_entra_client_secret,
|
|
6999
|
+
azure_vault_url: authFields.azure_vault_url
|
|
7000
|
+
}).strict(),
|
|
7001
|
+
z18.object({
|
|
7002
|
+
azure_auth_mode: z18.literal("managed").describe("Authenticate with an Azure managed identity"),
|
|
7003
|
+
azure_managed_client_id: authFields.azure_managed_client_id.optional(),
|
|
7004
|
+
azure_vault_url: authFields.azure_vault_url
|
|
7005
|
+
}).strict(),
|
|
7006
|
+
z18.object({
|
|
7007
|
+
azure_auth_mode: z18.literal("default").describe("Use Azure's default runtime credential chain"),
|
|
7008
|
+
azure_vault_url: authFields.azure_vault_url
|
|
7009
|
+
}).strict(),
|
|
7010
|
+
z18.object({
|
|
7011
|
+
vault_auth_type: z18.literal("token").describe("Authenticate to HashiCorp Vault with a token"),
|
|
7012
|
+
vault_addr: authFields.vault_addr,
|
|
7013
|
+
vault_token: authFields.vault_token,
|
|
7014
|
+
vault_namespace: authFields.vault_namespace.optional()
|
|
7015
|
+
}).strict(),
|
|
7016
|
+
z18.object({
|
|
7017
|
+
vault_auth_type: z18.literal("approle").describe("Authenticate to HashiCorp Vault with AppRole credentials"),
|
|
7018
|
+
vault_addr: authFields.vault_addr,
|
|
7019
|
+
vault_role_id: authFields.vault_role_id,
|
|
7020
|
+
vault_secret_id: authFields.vault_secret_id,
|
|
7021
|
+
vault_namespace: authFields.vault_namespace.optional()
|
|
7022
|
+
}).strict(),
|
|
7023
|
+
z18.object({
|
|
7024
|
+
vault_auth_type: z18.literal("kubernetes").describe(
|
|
7025
|
+
"Authenticate to HashiCorp Vault with a Kubernetes service account"
|
|
7026
|
+
),
|
|
7027
|
+
vault_addr: authFields.vault_addr,
|
|
7028
|
+
vault_role: authFields.vault_role,
|
|
7029
|
+
vault_namespace: authFields.vault_namespace.optional()
|
|
7030
|
+
}).strict()
|
|
7031
|
+
]);
|
|
7032
|
+
var updateAuthConfigSchema = z18.union([
|
|
7033
|
+
z18.object({
|
|
7034
|
+
aws_auth_type: authFields.aws_auth_type.optional(),
|
|
7035
|
+
aws_access_key_id: authFields.aws_access_key_id.optional(),
|
|
7036
|
+
aws_secret_access_key: authFields.aws_secret_access_key.optional(),
|
|
7037
|
+
aws_region: z18.string().optional().describe("AWS region containing the secret, for example us-east-1"),
|
|
7038
|
+
aws_role_arn: authFields.aws_role_arn.optional(),
|
|
7039
|
+
aws_external_id: authFields.aws_external_id.optional()
|
|
7040
|
+
}).strict(),
|
|
7041
|
+
z18.object({
|
|
7042
|
+
azure_auth_mode: authFields.azure_auth_mode.optional(),
|
|
7043
|
+
azure_entra_tenant_id: authFields.azure_entra_tenant_id.optional(),
|
|
7044
|
+
azure_entra_client_id: authFields.azure_entra_client_id.optional(),
|
|
7045
|
+
azure_entra_client_secret: authFields.azure_entra_client_secret.optional(),
|
|
7046
|
+
azure_managed_client_id: z18.string().optional().describe(
|
|
7047
|
+
"Optional client ID of a user-assigned managed identity; omit for the system-assigned identity"
|
|
7048
|
+
),
|
|
7049
|
+
azure_vault_url: authFields.azure_vault_url.optional()
|
|
7050
|
+
}).strict(),
|
|
7051
|
+
z18.object({
|
|
7052
|
+
vault_auth_type: authFields.vault_auth_type.optional(),
|
|
7053
|
+
vault_addr: authFields.vault_addr.optional(),
|
|
7054
|
+
vault_token: authFields.vault_token.optional(),
|
|
7055
|
+
vault_namespace: z18.string().optional().describe("Optional HashiCorp Vault Enterprise namespace"),
|
|
7056
|
+
vault_role_id: authFields.vault_role_id.optional(),
|
|
7057
|
+
vault_secret_id: authFields.vault_secret_id.optional(),
|
|
7058
|
+
vault_role: authFields.vault_role.optional()
|
|
7059
|
+
}).strict()
|
|
7060
|
+
]);
|
|
7061
|
+
var managerTypeSchema = z18.enum(["aws_sm", "azure_kv", "hashicorp_vault"]).describe(
|
|
7062
|
+
"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"
|
|
7063
|
+
);
|
|
7064
|
+
var tagsSchema = z18.record(z18.string(), z18.string()).describe("Tag filters or metadata as string key-value pairs");
|
|
7065
|
+
var SECRET_REFERENCE_TOOL_SCHEMAS = {
|
|
7066
|
+
create: {
|
|
7067
|
+
name: z18.string().min(1).max(255).describe("Human-readable name"),
|
|
7068
|
+
manager_type: managerTypeSchema,
|
|
7069
|
+
auth_config: authConfigSchema.describe(
|
|
7070
|
+
"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."
|
|
7071
|
+
),
|
|
7072
|
+
secret_path: z18.string().max(1024).describe("Path of the secret in the external secret manager"),
|
|
7073
|
+
organisation_id: z18.string().uuid().optional().describe(
|
|
7074
|
+
"Organisation UUID; required when the MCP server is not authenticated with a Portkey API key"
|
|
7075
|
+
),
|
|
7076
|
+
slug: z18.string().max(255).regex(/^[a-zA-Z0-9_-]+$/).optional().describe(
|
|
7077
|
+
"Optional stable slug containing only letters, numbers, underscores, or hyphens; Portkey generates one when omitted"
|
|
7078
|
+
),
|
|
7079
|
+
description: z18.string().max(1024).nullable().optional().describe("Optional description; use null to leave it empty"),
|
|
7080
|
+
secret_key: z18.string().max(255).nullable().optional().describe(
|
|
7081
|
+
"Optional key within a structured external secret; null uses the whole secret value"
|
|
7082
|
+
),
|
|
7083
|
+
allow_all_workspaces: z18.boolean().optional().describe(
|
|
7084
|
+
"Whether every workspace may use this reference; defaults to true and cannot be true with allowed_workspaces"
|
|
7085
|
+
),
|
|
7086
|
+
allowed_workspaces: z18.array(z18.string()).min(1).optional().describe(
|
|
7087
|
+
"Workspace UUIDs or slugs allowed to use this reference; omit when allow_all_workspaces is true"
|
|
7088
|
+
),
|
|
7089
|
+
tags: tagsSchema.nullable().optional().describe(
|
|
7090
|
+
"Optional string key-value tags for filtering and organization"
|
|
7091
|
+
)
|
|
7092
|
+
},
|
|
7093
|
+
list: {
|
|
7094
|
+
manager_type: managerTypeSchema.optional().describe(
|
|
7095
|
+
"Filter by external secret manager: aws_sm, azure_kv, or hashicorp_vault"
|
|
7096
|
+
),
|
|
7097
|
+
tags: tagsSchema.optional().describe("Return references matching these tags"),
|
|
7098
|
+
search: z18.string().min(1).max(255).optional().describe("Search references by name"),
|
|
7099
|
+
current_page: z18.coerce.number().int().nonnegative().optional().describe("Zero-based page number; defaults to 0"),
|
|
7100
|
+
page_size: z18.coerce.number().int().min(1).max(100).optional().describe("References per page, from 1 to 100; defaults to 20")
|
|
7101
|
+
},
|
|
7102
|
+
get: {
|
|
7103
|
+
id: z18.string().min(1).describe("Secret Reference UUID or slug")
|
|
7104
|
+
},
|
|
7105
|
+
update: {
|
|
7106
|
+
id: z18.string().min(1).describe("Secret Reference UUID or slug"),
|
|
7107
|
+
name: z18.string().min(1).max(255).optional().describe("New human-readable name"),
|
|
7108
|
+
description: z18.string().max(1024).nullable().optional().describe("New description, or null to clear it"),
|
|
7109
|
+
auth_config: updateAuthConfigSchema.optional().describe(
|
|
7110
|
+
"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"
|
|
7111
|
+
),
|
|
7112
|
+
secret_path: z18.string().max(1024).optional().describe("New path of the secret in the external secret manager"),
|
|
7113
|
+
secret_key: z18.string().max(255).nullable().optional().describe(
|
|
7114
|
+
"New key within a structured secret, or null to use the whole value"
|
|
7115
|
+
),
|
|
7116
|
+
allow_all_workspaces: z18.boolean().optional().describe(
|
|
7117
|
+
"Whether every workspace may use this reference; cannot be true with allowed_workspaces"
|
|
7118
|
+
),
|
|
7119
|
+
allowed_workspaces: z18.array(z18.string()).min(1).optional().describe(
|
|
7120
|
+
"Replacement list of workspace UUIDs or slugs allowed to use this reference; supplying it sets allow_all_workspaces=false"
|
|
7121
|
+
),
|
|
7122
|
+
tags: tagsSchema.nullable().optional().describe("Replacement string key-value tags, or null to clear them")
|
|
7123
|
+
},
|
|
7124
|
+
delete: {
|
|
7125
|
+
id: z18.string().min(1).describe("Secret Reference UUID or slug")
|
|
7126
|
+
}
|
|
7127
|
+
};
|
|
7128
|
+
function validateWorkspaceAccess(value) {
|
|
7129
|
+
if (value.allow_all_workspaces === true && value.allowed_workspaces) {
|
|
7130
|
+
throw new Error(
|
|
7131
|
+
"allow_all_workspaces=true is mutually exclusive with allowed_workspaces"
|
|
7132
|
+
);
|
|
7133
|
+
}
|
|
7134
|
+
}
|
|
7135
|
+
function validateManagerAuth(managerType, authConfig) {
|
|
7136
|
+
const matches = managerType === "aws_sm" && "aws_auth_type" in authConfig || managerType === "azure_kv" && "azure_auth_mode" in authConfig || managerType === "hashicorp_vault" && "vault_auth_type" in authConfig;
|
|
7137
|
+
if (!matches) {
|
|
7138
|
+
throw new Error(`auth_config does not match manager_type ${managerType}`);
|
|
7139
|
+
}
|
|
7140
|
+
}
|
|
7141
|
+
function validateAuthUpdate(authConfig) {
|
|
7142
|
+
if (Object.keys(authConfig).length === 0) {
|
|
7143
|
+
throw new Error("auth_config update must contain at least one field");
|
|
7144
|
+
}
|
|
7145
|
+
const families = new Set(
|
|
7146
|
+
Object.keys(authConfig).map((key) => {
|
|
7147
|
+
if (key.startsWith("aws_")) return "AWS";
|
|
7148
|
+
if (key.startsWith("azure_")) return "Azure";
|
|
7149
|
+
if (key.startsWith("vault_")) return "HashiCorp Vault";
|
|
7150
|
+
return "unknown";
|
|
7151
|
+
})
|
|
7152
|
+
);
|
|
7153
|
+
if (families.size > 1) {
|
|
7154
|
+
throw new Error(
|
|
7155
|
+
"auth_config update must contain fields for exactly one secret-manager family"
|
|
7156
|
+
);
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
var SENSITIVE_AUTH_FIELD = /(?:secret|token|password|credential|access_key_id)/i;
|
|
7160
|
+
function redactAuthConfig(authConfig) {
|
|
7161
|
+
return Object.fromEntries(
|
|
7162
|
+
Object.entries(authConfig).map(([key, value]) => {
|
|
7163
|
+
if (SENSITIVE_AUTH_FIELD.test(key)) return [key, "[REDACTED]"];
|
|
7164
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
7165
|
+
return [key, redactAuthConfig(value)];
|
|
7166
|
+
}
|
|
7167
|
+
return [key, value];
|
|
7168
|
+
})
|
|
7169
|
+
);
|
|
7170
|
+
}
|
|
7171
|
+
function registerSecretReferencesTools(server, service) {
|
|
7172
|
+
server.tool(
|
|
7173
|
+
"create_secret_reference",
|
|
7174
|
+
"Create a reference to a secret stored in AWS Secrets Manager, Azure Key Vault, or HashiCorp Vault. Authentication credentials are sent to Portkey and exposed to this MCP transcript; use short-lived or workload identity modes when possible. Returns the new UUID and slug, never the resolved external secret.",
|
|
7175
|
+
SECRET_REFERENCE_TOOL_SCHEMAS.create,
|
|
7176
|
+
{
|
|
7177
|
+
title: "Create Secret Reference",
|
|
7178
|
+
readOnlyHint: false,
|
|
7179
|
+
destructiveHint: false,
|
|
7180
|
+
idempotentHint: false,
|
|
7181
|
+
openWorldHint: true
|
|
7182
|
+
},
|
|
7183
|
+
async (params) => {
|
|
7184
|
+
validateWorkspaceAccess(params);
|
|
7185
|
+
validateManagerAuth(params.manager_type, params.auth_config);
|
|
7186
|
+
const result = await service.secretReferences.createSecretReference(params);
|
|
7187
|
+
return {
|
|
7188
|
+
content: [
|
|
7189
|
+
{
|
|
7190
|
+
type: "text",
|
|
7191
|
+
text: JSON.stringify({
|
|
7192
|
+
message: `Successfully created Secret Reference "${result.slug}"`,
|
|
7193
|
+
id: result.id,
|
|
7194
|
+
slug: result.slug
|
|
7195
|
+
})
|
|
7196
|
+
}
|
|
7197
|
+
]
|
|
7198
|
+
};
|
|
7199
|
+
}
|
|
7200
|
+
);
|
|
7201
|
+
server.tool(
|
|
7202
|
+
"list_secret_references",
|
|
7203
|
+
"List Secret References without returning authentication configuration or resolved secret values. Filter by manager type, tags, or name and use a returned UUID or slug with get_secret_reference.",
|
|
7204
|
+
SECRET_REFERENCE_TOOL_SCHEMAS.list,
|
|
7205
|
+
{
|
|
7206
|
+
title: "List Secret References",
|
|
7207
|
+
readOnlyHint: true,
|
|
7208
|
+
destructiveHint: false,
|
|
7209
|
+
idempotentHint: true,
|
|
7210
|
+
openWorldHint: true
|
|
7211
|
+
},
|
|
7212
|
+
async (params) => {
|
|
7213
|
+
const result = await service.secretReferences.listSecretReferences({
|
|
7214
|
+
...params,
|
|
7215
|
+
tags: params.tags ? JSON.stringify(params.tags) : void 0
|
|
7216
|
+
});
|
|
7217
|
+
return {
|
|
7218
|
+
content: [
|
|
7219
|
+
{
|
|
7220
|
+
type: "text",
|
|
7221
|
+
text: JSON.stringify({
|
|
7222
|
+
total: result.total,
|
|
7223
|
+
secret_references: result.data.map((reference) => ({
|
|
7224
|
+
id: reference.id,
|
|
7225
|
+
name: reference.name,
|
|
7226
|
+
slug: reference.slug,
|
|
7227
|
+
manager_type: reference.manager_type,
|
|
7228
|
+
status: reference.status,
|
|
7229
|
+
created_at: reference.created_at,
|
|
7230
|
+
last_updated_at: reference.last_updated_at
|
|
7231
|
+
}))
|
|
7232
|
+
})
|
|
7233
|
+
}
|
|
7234
|
+
]
|
|
7235
|
+
};
|
|
7236
|
+
}
|
|
7237
|
+
);
|
|
7238
|
+
server.tool(
|
|
7239
|
+
"get_secret_reference",
|
|
7240
|
+
"Retrieve one Secret Reference by UUID or slug. Portkey masks sensitive authentication fields for non-system users; the tool returns metadata and the masked auth configuration, not the resolved external secret value.",
|
|
7241
|
+
SECRET_REFERENCE_TOOL_SCHEMAS.get,
|
|
7242
|
+
{
|
|
7243
|
+
title: "Get Secret Reference",
|
|
7244
|
+
readOnlyHint: true,
|
|
7245
|
+
destructiveHint: false,
|
|
7246
|
+
idempotentHint: true,
|
|
7247
|
+
openWorldHint: true
|
|
7248
|
+
},
|
|
7249
|
+
async ({ id }) => {
|
|
7250
|
+
const result = await service.secretReferences.getSecretReference(id);
|
|
7251
|
+
return {
|
|
7252
|
+
content: [
|
|
7253
|
+
{
|
|
7254
|
+
type: "text",
|
|
7255
|
+
text: JSON.stringify({
|
|
7256
|
+
...result,
|
|
7257
|
+
auth_config: redactAuthConfig(result.auth_config)
|
|
7258
|
+
})
|
|
7259
|
+
}
|
|
7260
|
+
]
|
|
7261
|
+
};
|
|
7262
|
+
}
|
|
7263
|
+
);
|
|
7264
|
+
server.tool(
|
|
7265
|
+
"update_secret_reference",
|
|
7266
|
+
"Update at least one selected field on a Secret Reference. auth_config is merged into the existing manager-specific configuration. allowed_workspaces replaces all workspace mappings and sets allow_all_workspaces=false; allow_all_workspaces=true removes workspace-specific mappings. Credential values are sent to Portkey and exposed to the MCP transcript.",
|
|
7267
|
+
SECRET_REFERENCE_TOOL_SCHEMAS.update,
|
|
7268
|
+
{
|
|
7269
|
+
title: "Update Secret Reference",
|
|
7270
|
+
readOnlyHint: false,
|
|
7271
|
+
destructiveHint: true,
|
|
7272
|
+
idempotentHint: true,
|
|
7273
|
+
openWorldHint: true
|
|
7274
|
+
},
|
|
7275
|
+
async ({ id, ...updates }) => {
|
|
7276
|
+
validateWorkspaceAccess(updates);
|
|
7277
|
+
if (Object.keys(updates).length === 0) {
|
|
7278
|
+
throw new Error("Provide at least one field to update");
|
|
7279
|
+
}
|
|
7280
|
+
if (updates.auth_config) validateAuthUpdate(updates.auth_config);
|
|
7281
|
+
await service.secretReferences.updateSecretReference(id, updates);
|
|
7282
|
+
return {
|
|
7283
|
+
content: [
|
|
7284
|
+
{
|
|
7285
|
+
type: "text",
|
|
7286
|
+
text: JSON.stringify({
|
|
7287
|
+
message: `Successfully updated Secret Reference "${id}"`,
|
|
7288
|
+
success: true
|
|
7289
|
+
})
|
|
7290
|
+
}
|
|
7291
|
+
]
|
|
7292
|
+
};
|
|
7293
|
+
}
|
|
7294
|
+
);
|
|
7295
|
+
server.tool(
|
|
7296
|
+
"delete_secret_reference",
|
|
7297
|
+
"Permanently delete a Secret Reference. This is irreversible and integrations or virtual keys using it can fail to resolve credentials immediately; confirm dependencies before deletion.",
|
|
7298
|
+
SECRET_REFERENCE_TOOL_SCHEMAS.delete,
|
|
7299
|
+
{
|
|
7300
|
+
title: "Delete Secret Reference",
|
|
7301
|
+
readOnlyHint: false,
|
|
7302
|
+
destructiveHint: true,
|
|
7303
|
+
idempotentHint: true,
|
|
7304
|
+
openWorldHint: true
|
|
7305
|
+
},
|
|
7306
|
+
async ({ id }) => {
|
|
7307
|
+
const result = await service.secretReferences.deleteSecretReference(id);
|
|
7308
|
+
return {
|
|
7309
|
+
content: [
|
|
7310
|
+
{
|
|
7311
|
+
type: "text",
|
|
7312
|
+
text: JSON.stringify({
|
|
7313
|
+
message: `Successfully deleted Secret Reference "${id}"`,
|
|
7314
|
+
success: result.success
|
|
7315
|
+
})
|
|
7316
|
+
}
|
|
7317
|
+
]
|
|
7318
|
+
};
|
|
7319
|
+
}
|
|
7320
|
+
);
|
|
7321
|
+
}
|
|
7322
|
+
|
|
6806
7323
|
// src/tools/tracing.tools.ts
|
|
6807
|
-
import { z as
|
|
7324
|
+
import { z as z19 } from "zod";
|
|
6808
7325
|
var TRACING_TOOL_SCHEMAS = {
|
|
6809
7326
|
createFeedback: {
|
|
6810
|
-
trace_id:
|
|
7327
|
+
trace_id: z19.string().describe(
|
|
6811
7328
|
"The trace ID to associate the feedback with. This links feedback to a specific request/generation."
|
|
6812
7329
|
),
|
|
6813
|
-
value:
|
|
7330
|
+
value: z19.coerce.number().describe(
|
|
6814
7331
|
"Feedback value/rating. Common patterns: 1 for positive (thumbs up), 0 for negative (thumbs down), or use a scale like 1-5."
|
|
6815
7332
|
),
|
|
6816
|
-
weight:
|
|
7333
|
+
weight: z19.coerce.number().positive().optional().describe(
|
|
6817
7334
|
"Optional weighting factor for the feedback. Use to give more importance to certain feedback."
|
|
6818
7335
|
),
|
|
6819
|
-
metadata:
|
|
7336
|
+
metadata: z19.record(z19.string(), z19.unknown()).optional().describe(
|
|
6820
7337
|
"Optional custom metadata for categorization and analysis (e.g., feedback_source, category, user_segment)."
|
|
6821
7338
|
)
|
|
6822
7339
|
},
|
|
6823
7340
|
updateFeedback: {
|
|
6824
|
-
id:
|
|
6825
|
-
value:
|
|
7341
|
+
id: z19.string().describe("The unique identifier of the feedback to update"),
|
|
7342
|
+
value: z19.coerce.number().optional().describe(
|
|
6826
7343
|
"New feedback value/rating. Common patterns: 1 for positive, 0 for negative."
|
|
6827
7344
|
),
|
|
6828
|
-
weight:
|
|
6829
|
-
metadata:
|
|
7345
|
+
weight: z19.coerce.number().positive().optional().describe("New weighting factor for the feedback"),
|
|
7346
|
+
metadata: z19.record(z19.string(), z19.unknown()).optional().describe("New or updated custom metadata for the feedback")
|
|
6830
7347
|
}
|
|
6831
7348
|
};
|
|
6832
7349
|
function registerTracingTools(server, service) {
|
|
@@ -6882,77 +7399,77 @@ function registerTracingTools(server, service) {
|
|
|
6882
7399
|
}
|
|
6883
7400
|
|
|
6884
7401
|
// src/tools/users.tools.ts
|
|
6885
|
-
import { z as
|
|
7402
|
+
import { z as z20 } from "zod";
|
|
6886
7403
|
var USERS_TOOL_SCHEMAS = {
|
|
6887
7404
|
listAllUsers: {
|
|
6888
|
-
current_page:
|
|
6889
|
-
page_size:
|
|
7405
|
+
current_page: z20.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
7406
|
+
page_size: z20.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
6890
7407
|
},
|
|
6891
7408
|
inviteUser: {
|
|
6892
|
-
email:
|
|
6893
|
-
role:
|
|
7409
|
+
email: z20.string().email().describe("Email address of the user to invite"),
|
|
7410
|
+
role: z20.enum(["admin", "member"]).describe(
|
|
6894
7411
|
"Organization-level role: 'admin' for full access, 'member' for limited access"
|
|
6895
7412
|
),
|
|
6896
|
-
first_name:
|
|
6897
|
-
last_name:
|
|
6898
|
-
workspaces:
|
|
6899
|
-
|
|
6900
|
-
id:
|
|
7413
|
+
first_name: z20.string().optional().describe("User's first name"),
|
|
7414
|
+
last_name: z20.string().optional().describe("User's last name"),
|
|
7415
|
+
workspaces: z20.array(
|
|
7416
|
+
z20.object({
|
|
7417
|
+
id: z20.string().describe(
|
|
6901
7418
|
"Workspace ID/slug where the user will be granted access"
|
|
6902
7419
|
),
|
|
6903
|
-
role:
|
|
7420
|
+
role: z20.enum(["admin", "member", "manager"]).describe(
|
|
6904
7421
|
"Workspace-level role: 'admin' for full access, 'manager' for workspace management, 'member' for basic access"
|
|
6905
7422
|
)
|
|
6906
7423
|
})
|
|
6907
7424
|
).describe(
|
|
6908
7425
|
"List of workspaces and corresponding roles to grant to the user"
|
|
6909
7426
|
),
|
|
6910
|
-
workspace_api_key_details:
|
|
6911
|
-
name:
|
|
6912
|
-
expiry:
|
|
6913
|
-
metadata:
|
|
6914
|
-
scopes:
|
|
7427
|
+
workspace_api_key_details: z20.object({
|
|
7428
|
+
name: z20.string().optional().describe("Name of the API key to be created"),
|
|
7429
|
+
expiry: z20.string().optional().describe("Expiration date for the API key (ISO8601 format)"),
|
|
7430
|
+
metadata: z20.record(z20.string(), z20.string()).optional().describe("Additional metadata key-value pairs for the API key"),
|
|
7431
|
+
scopes: z20.array(z20.string()).describe("List of permission scopes for the API key")
|
|
6915
7432
|
}).optional().describe("Optional API key to be created for the user")
|
|
6916
7433
|
},
|
|
6917
7434
|
getUserStats: {
|
|
6918
|
-
time_of_generation_min:
|
|
7435
|
+
time_of_generation_min: z20.string().describe(
|
|
6919
7436
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
6920
7437
|
),
|
|
6921
|
-
time_of_generation_max:
|
|
7438
|
+
time_of_generation_max: z20.string().describe(
|
|
6922
7439
|
"End time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')"
|
|
6923
7440
|
),
|
|
6924
|
-
total_units_min:
|
|
6925
|
-
total_units_max:
|
|
6926
|
-
cost_min:
|
|
6927
|
-
cost_max:
|
|
6928
|
-
status_code:
|
|
6929
|
-
virtual_keys:
|
|
6930
|
-
page_size:
|
|
7441
|
+
total_units_min: z20.coerce.number().positive().optional().describe("Minimum number of total tokens to filter by"),
|
|
7442
|
+
total_units_max: z20.coerce.number().positive().optional().describe("Maximum number of total tokens to filter by"),
|
|
7443
|
+
cost_min: z20.coerce.number().positive().optional().describe("Minimum cost in cents to filter by"),
|
|
7444
|
+
cost_max: z20.coerce.number().positive().optional().describe("Maximum cost in cents to filter by"),
|
|
7445
|
+
status_code: z20.string().optional().describe("Filter by specific HTTP status codes (comma-separated)"),
|
|
7446
|
+
virtual_keys: z20.string().optional().describe("Filter by specific virtual key slugs (comma-separated)"),
|
|
7447
|
+
page_size: z20.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
6931
7448
|
},
|
|
6932
7449
|
getUser: {
|
|
6933
|
-
user_id:
|
|
7450
|
+
user_id: z20.string().describe("The user ID to retrieve")
|
|
6934
7451
|
},
|
|
6935
7452
|
updateUser: {
|
|
6936
|
-
user_id:
|
|
6937
|
-
first_name:
|
|
6938
|
-
last_name:
|
|
6939
|
-
role:
|
|
7453
|
+
user_id: z20.string().describe("The user ID to update"),
|
|
7454
|
+
first_name: z20.string().optional().describe("New first name"),
|
|
7455
|
+
last_name: z20.string().optional().describe("New last name"),
|
|
7456
|
+
role: z20.enum(["admin", "member"]).optional().describe("New organization-level role")
|
|
6940
7457
|
},
|
|
6941
7458
|
deleteUser: {
|
|
6942
|
-
user_id:
|
|
7459
|
+
user_id: z20.string().describe("The user ID to delete")
|
|
6943
7460
|
},
|
|
6944
7461
|
listUserInvites: {
|
|
6945
|
-
current_page:
|
|
6946
|
-
page_size:
|
|
7462
|
+
current_page: z20.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
7463
|
+
page_size: z20.coerce.number().int().positive().max(100).optional().describe("Number of results per page (max 100)")
|
|
6947
7464
|
},
|
|
6948
7465
|
getUserInvite: {
|
|
6949
|
-
invite_id:
|
|
7466
|
+
invite_id: z20.string().describe("The invite ID to retrieve")
|
|
6950
7467
|
},
|
|
6951
7468
|
deleteUserInvite: {
|
|
6952
|
-
invite_id:
|
|
7469
|
+
invite_id: z20.string().describe("The invite ID to delete")
|
|
6953
7470
|
},
|
|
6954
7471
|
resendUserInvite: {
|
|
6955
|
-
invite_id:
|
|
7472
|
+
invite_id: z20.string().describe("The invite ID to resend")
|
|
6956
7473
|
}
|
|
6957
7474
|
};
|
|
6958
7475
|
function formatUser(user) {
|
|
@@ -7178,59 +7695,59 @@ function registerUsersTools(server, service) {
|
|
|
7178
7695
|
}
|
|
7179
7696
|
|
|
7180
7697
|
// src/tools/workspaces.tools.ts
|
|
7181
|
-
import { z as
|
|
7698
|
+
import { z as z21 } from "zod";
|
|
7182
7699
|
var WORKSPACES_TOOL_SCHEMAS = {
|
|
7183
7700
|
listWorkspaces: {
|
|
7184
|
-
page_size:
|
|
7185
|
-
current_page:
|
|
7701
|
+
page_size: z21.coerce.number().int().positive().max(100).optional().describe("Number of workspaces to return per page (max 100)"),
|
|
7702
|
+
current_page: z21.coerce.number().int().positive().optional().describe("Page number to retrieve when results are paginated")
|
|
7186
7703
|
},
|
|
7187
7704
|
getWorkspace: {
|
|
7188
|
-
workspace_id:
|
|
7705
|
+
workspace_id: z21.string().describe(
|
|
7189
7706
|
"The unique identifier of the workspace to retrieve. This can be found in the workspace's URL or from the list_workspaces tool response"
|
|
7190
7707
|
)
|
|
7191
7708
|
},
|
|
7192
7709
|
createWorkspace: {
|
|
7193
|
-
name:
|
|
7194
|
-
slug:
|
|
7195
|
-
description:
|
|
7196
|
-
is_default:
|
|
7197
|
-
metadata:
|
|
7710
|
+
name: z21.string().describe("Name of the workspace"),
|
|
7711
|
+
slug: z21.string().optional().describe("URL-friendly slug (auto-generated if not provided)"),
|
|
7712
|
+
description: z21.string().optional().describe("Description of the workspace"),
|
|
7713
|
+
is_default: z21.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
7714
|
+
metadata: z21.record(z21.string(), z21.string()).optional().describe("Custom metadata key-value pairs")
|
|
7198
7715
|
},
|
|
7199
7716
|
updateWorkspace: {
|
|
7200
|
-
workspace_id:
|
|
7201
|
-
name:
|
|
7202
|
-
slug:
|
|
7203
|
-
description:
|
|
7204
|
-
is_default:
|
|
7205
|
-
metadata:
|
|
7717
|
+
workspace_id: z21.string().describe("The workspace ID to update"),
|
|
7718
|
+
name: z21.string().optional().describe("New name for the workspace"),
|
|
7719
|
+
slug: z21.string().optional().describe("New slug for the workspace"),
|
|
7720
|
+
description: z21.string().optional().describe("New description"),
|
|
7721
|
+
is_default: z21.coerce.number().optional().describe("Set as default workspace (1 = yes, 0 = no)"),
|
|
7722
|
+
metadata: z21.record(z21.string(), z21.string()).optional().describe("New metadata key-value pairs")
|
|
7206
7723
|
},
|
|
7207
7724
|
deleteWorkspace: {
|
|
7208
|
-
workspace_id:
|
|
7725
|
+
workspace_id: z21.string().describe("The workspace ID to delete")
|
|
7209
7726
|
},
|
|
7210
7727
|
addWorkspaceMember: {
|
|
7211
|
-
workspace_id:
|
|
7212
|
-
user_id:
|
|
7728
|
+
workspace_id: z21.string().describe("The workspace ID to add the member to"),
|
|
7729
|
+
user_id: z21.string().uuid(
|
|
7213
7730
|
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
7214
7731
|
).describe(
|
|
7215
7732
|
"The user ID to add (must be a valid UUID from list_all_users, not an email address)"
|
|
7216
7733
|
),
|
|
7217
|
-
role:
|
|
7734
|
+
role: z21.enum(["admin", "member", "manager"]).describe("Role in the workspace")
|
|
7218
7735
|
},
|
|
7219
7736
|
listWorkspaceMembers: {
|
|
7220
|
-
workspace_id:
|
|
7737
|
+
workspace_id: z21.string().describe("The workspace ID to list members for")
|
|
7221
7738
|
},
|
|
7222
7739
|
getWorkspaceMember: {
|
|
7223
|
-
workspace_id:
|
|
7224
|
-
user_id:
|
|
7740
|
+
workspace_id: z21.string().describe("The workspace ID"),
|
|
7741
|
+
user_id: z21.string().describe("The user ID to retrieve")
|
|
7225
7742
|
},
|
|
7226
7743
|
updateWorkspaceMember: {
|
|
7227
|
-
workspace_id:
|
|
7228
|
-
user_id:
|
|
7229
|
-
role:
|
|
7744
|
+
workspace_id: z21.string().describe("The workspace ID"),
|
|
7745
|
+
user_id: z21.string().describe("The user ID to update"),
|
|
7746
|
+
role: z21.enum(["admin", "member", "manager"]).describe("New role in the workspace")
|
|
7230
7747
|
},
|
|
7231
7748
|
removeWorkspaceMember: {
|
|
7232
|
-
workspace_id:
|
|
7233
|
-
user_id:
|
|
7749
|
+
workspace_id: z21.string().describe("The workspace ID"),
|
|
7750
|
+
user_id: z21.string().describe("The user ID to remove")
|
|
7234
7751
|
}
|
|
7235
7752
|
};
|
|
7236
7753
|
function formatWorkspaceDefaults(defaults) {
|
|
@@ -7517,6 +8034,7 @@ var TOOL_DOMAIN_REGISTRARS = [
|
|
|
7517
8034
|
["tracing", registerTracingTools],
|
|
7518
8035
|
["logging", registerLoggingTools],
|
|
7519
8036
|
["providers", registerProvidersTools],
|
|
8037
|
+
["secret-references", registerSecretReferencesTools],
|
|
7520
8038
|
["integrations", registerIntegrationsTools],
|
|
7521
8039
|
["mcp-integrations", registerMcpIntegrationsTools],
|
|
7522
8040
|
["mcp-servers", registerMcpServersTools]
|
|
@@ -7639,13 +8157,81 @@ function getToolErrorMessage(error) {
|
|
|
7639
8157
|
return String(error);
|
|
7640
8158
|
}
|
|
7641
8159
|
var STANDARD_TOOL_OUTPUT_SCHEMA = {
|
|
7642
|
-
ok:
|
|
7643
|
-
data:
|
|
7644
|
-
error:
|
|
7645
|
-
message:
|
|
7646
|
-
details:
|
|
8160
|
+
ok: z22.boolean().describe("Whether the tool call succeeded and returned structured data"),
|
|
8161
|
+
data: z22.unknown().optional().describe("Structured success payload when ok is true"),
|
|
8162
|
+
error: z22.object({
|
|
8163
|
+
message: z22.string().describe("Human-readable error message"),
|
|
8164
|
+
details: z22.unknown().optional().describe("Optional structured error details")
|
|
7647
8165
|
}).optional().describe("Structured error payload when ok is false")
|
|
7648
8166
|
};
|
|
8167
|
+
var TOOL_SUCCESS_DATA_SCHEMAS = {
|
|
8168
|
+
rotate_api_key: z22.object({
|
|
8169
|
+
message: z22.string().describe("Rotation confirmation"),
|
|
8170
|
+
warning: z22.string().describe("Required handling guidance for the one-time secret"),
|
|
8171
|
+
id: z22.string().uuid().describe("Rotated API key UUID"),
|
|
8172
|
+
key: z22.string().describe("New API key secret, returned only once"),
|
|
8173
|
+
key_transition_expires_at: z22.iso.datetime().describe("Time when the previous key stops working")
|
|
8174
|
+
}),
|
|
8175
|
+
create_secret_reference: z22.object({
|
|
8176
|
+
message: z22.string().describe("Creation confirmation"),
|
|
8177
|
+
id: z22.string().uuid().describe("New Secret Reference UUID"),
|
|
8178
|
+
slug: z22.string().describe("New Secret Reference slug")
|
|
8179
|
+
}),
|
|
8180
|
+
list_secret_references: z22.object({
|
|
8181
|
+
total: z22.number().int().nonnegative().describe("Total matching references"),
|
|
8182
|
+
secret_references: z22.array(
|
|
8183
|
+
z22.object({
|
|
8184
|
+
id: z22.string().uuid().describe("Secret Reference UUID"),
|
|
8185
|
+
name: z22.string().describe("Human-readable name"),
|
|
8186
|
+
slug: z22.string().describe("Stable Secret Reference slug"),
|
|
8187
|
+
manager_type: SecretManagerTypeSchema.describe(
|
|
8188
|
+
"External secret manager type"
|
|
8189
|
+
),
|
|
8190
|
+
status: z22.literal("ACTIVE").describe("Current reference status"),
|
|
8191
|
+
created_at: z22.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8192
|
+
last_updated_at: z22.iso.datetime().describe("ISO 8601 last-update timestamp")
|
|
8193
|
+
})
|
|
8194
|
+
).describe(
|
|
8195
|
+
"Current page of Secret References without authentication values"
|
|
8196
|
+
)
|
|
8197
|
+
}),
|
|
8198
|
+
get_secret_reference: z22.object({
|
|
8199
|
+
id: z22.string().uuid().describe("Secret Reference UUID"),
|
|
8200
|
+
organisation_id: z22.string().uuid().describe("Owning organisation UUID"),
|
|
8201
|
+
name: z22.string().describe("Human-readable name"),
|
|
8202
|
+
slug: z22.string().describe("Stable Secret Reference slug"),
|
|
8203
|
+
description: z22.string().nullable().describe("Reference description"),
|
|
8204
|
+
manager_type: SecretManagerTypeSchema.describe(
|
|
8205
|
+
"External secret manager type"
|
|
8206
|
+
),
|
|
8207
|
+
secret_path: z22.string().describe("Path in the external secret manager"),
|
|
8208
|
+
secret_key: z22.string().nullable().describe("Selected key within a structured secret"),
|
|
8209
|
+
allow_all_workspaces: z22.boolean().describe("Whether all workspaces may use the reference"),
|
|
8210
|
+
tags: z22.record(z22.string(), z22.string()).nullable().describe("String metadata tags"),
|
|
8211
|
+
status: z22.literal("ACTIVE").describe("Current reference status"),
|
|
8212
|
+
created_by: z22.string().describe("Creator identifier"),
|
|
8213
|
+
created_at: z22.iso.datetime().describe("ISO 8601 creation timestamp"),
|
|
8214
|
+
last_updated_at: z22.iso.datetime().describe("ISO 8601 last-update timestamp"),
|
|
8215
|
+
auth_config: z22.record(z22.string(), z22.unknown()).describe("Authentication configuration with sensitive values redacted"),
|
|
8216
|
+
object: z22.literal("secret-reference").describe("Portkey object type")
|
|
8217
|
+
}),
|
|
8218
|
+
update_secret_reference: z22.object({
|
|
8219
|
+
message: z22.string().describe("Update confirmation"),
|
|
8220
|
+
success: z22.literal(true).describe("Whether the update succeeded")
|
|
8221
|
+
}),
|
|
8222
|
+
delete_secret_reference: z22.object({
|
|
8223
|
+
message: z22.string().describe("Deletion confirmation"),
|
|
8224
|
+
success: z22.literal(true).describe("Whether the deletion succeeded")
|
|
8225
|
+
})
|
|
8226
|
+
};
|
|
8227
|
+
function getToolOutputSchema(toolName) {
|
|
8228
|
+
const dataSchema = TOOL_SUCCESS_DATA_SCHEMAS[toolName];
|
|
8229
|
+
if (!dataSchema) return STANDARD_TOOL_OUTPUT_SCHEMA;
|
|
8230
|
+
return {
|
|
8231
|
+
...STANDARD_TOOL_OUTPUT_SCHEMA,
|
|
8232
|
+
data: dataSchema.optional().describe("Structured success payload when ok is true")
|
|
8233
|
+
};
|
|
8234
|
+
}
|
|
7649
8235
|
function isStandardToolEnvelope(value) {
|
|
7650
8236
|
if (!isRecord(value) || typeof value.ok !== "boolean") {
|
|
7651
8237
|
return false;
|
|
@@ -7792,7 +8378,7 @@ function createSafeToolServer(server) {
|
|
|
7792
8378
|
{
|
|
7793
8379
|
...registration.description ? { description: registration.description } : {},
|
|
7794
8380
|
...registration.inputSchema !== void 0 ? { inputSchema: registration.inputSchema } : {},
|
|
7795
|
-
outputSchema:
|
|
8381
|
+
outputSchema: getToolOutputSchema(name),
|
|
7796
8382
|
annotations: registration.annotations
|
|
7797
8383
|
},
|
|
7798
8384
|
registration.callback
|
|
@@ -7899,8 +8485,8 @@ function registerServerPromptsAndResources(server) {
|
|
|
7899
8485
|
title: "Plan Portkey Admin Workflow",
|
|
7900
8486
|
description: "Create a concise, safe plan for a Portkey Admin API task using this MCP server.",
|
|
7901
8487
|
argsSchema: {
|
|
7902
|
-
task:
|
|
7903
|
-
area:
|
|
8488
|
+
task: z23.string().min(1).max(500).describe("Portkey admin task to plan, such as promoting a prompt"),
|
|
8489
|
+
area: z23.string().max(80).optional().describe(
|
|
7904
8490
|
"Optional Portkey area, such as prompts, analytics, configs, or users"
|
|
7905
8491
|
)
|
|
7906
8492
|
}
|
|
@@ -7952,6 +8538,25 @@ function parseConfiguredToolDomains(rawValue = process.env.PORTKEY_TOOL_DOMAINS?
|
|
|
7952
8538
|
}
|
|
7953
8539
|
return normalizeToolDomains(requestedDomains);
|
|
7954
8540
|
}
|
|
8541
|
+
function resolveToolDomains(requestedDomains) {
|
|
8542
|
+
const configuredDomains = parseConfiguredToolDomains();
|
|
8543
|
+
if (!configuredDomains) {
|
|
8544
|
+
return requestedDomains ? normalizeToolDomains(requestedDomains) : void 0;
|
|
8545
|
+
}
|
|
8546
|
+
if (!requestedDomains) {
|
|
8547
|
+
return configuredDomains;
|
|
8548
|
+
}
|
|
8549
|
+
const configuredDomainSet = new Set(configuredDomains);
|
|
8550
|
+
const disallowedDomains = normalizeToolDomains(requestedDomains).filter(
|
|
8551
|
+
(domain) => !configuredDomainSet.has(domain)
|
|
8552
|
+
);
|
|
8553
|
+
if (disallowedDomains.length > 0) {
|
|
8554
|
+
throw new Error(
|
|
8555
|
+
`Requested tool domains are not allowed by PORTKEY_TOOL_DOMAINS: ${disallowedDomains.join(", ")}`
|
|
8556
|
+
);
|
|
8557
|
+
}
|
|
8558
|
+
return normalizeToolDomains(requestedDomains);
|
|
8559
|
+
}
|
|
7955
8560
|
function createMcpServer(options = {}) {
|
|
7956
8561
|
const service = getSharedPortkeyService();
|
|
7957
8562
|
const server = new McpServer(
|
|
@@ -7970,7 +8575,7 @@ function createMcpServer(options = {}) {
|
|
|
7970
8575
|
);
|
|
7971
8576
|
registerServerPromptsAndResources(server);
|
|
7972
8577
|
registerAllTools(server, service, {
|
|
7973
|
-
domains: options.toolDomains
|
|
8578
|
+
domains: resolveToolDomains(options.toolDomains)
|
|
7974
8579
|
});
|
|
7975
8580
|
return {
|
|
7976
8581
|
server,
|