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