portkey-admin-mcp 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/build/index.js +1209 -2415
- package/build/server.js +1412 -2512
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -197,6 +197,10 @@ function validateUrl(url) {
|
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
+
var NO_CONTENT = /* @__PURE__ */ Symbol("NoContent");
|
|
201
|
+
function isNoContent(value) {
|
|
202
|
+
return value === NO_CONTENT;
|
|
203
|
+
}
|
|
200
204
|
var BaseService = class {
|
|
201
205
|
apiKey;
|
|
202
206
|
baseUrl;
|
|
@@ -269,7 +273,7 @@ var BaseService = class {
|
|
|
269
273
|
duration_ms
|
|
270
274
|
});
|
|
271
275
|
if (options.allowNoContent && response.status === 204) {
|
|
272
|
-
return
|
|
276
|
+
return NO_CONTENT;
|
|
273
277
|
}
|
|
274
278
|
return await response.json();
|
|
275
279
|
} catch (error) {
|
|
@@ -286,23 +290,50 @@ var BaseService = class {
|
|
|
286
290
|
throw error;
|
|
287
291
|
}
|
|
288
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Asserts that a request known not to set `allowNoContent` never actually
|
|
295
|
+
* resolves to the {@link NoContent} sentinel. `get`/`post`/`put`/`getPublic`
|
|
296
|
+
* never pass `allowNoContent`, so `executeRequest` cannot take the 204
|
|
297
|
+
* branch for them — this only guards against that invariant breaking.
|
|
298
|
+
*/
|
|
299
|
+
rejectNoContent(result) {
|
|
300
|
+
if (isNoContent(result)) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
"Unexpected HTTP 204 No Content response for a request that did not allow it"
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return result;
|
|
306
|
+
}
|
|
289
307
|
async get(path, params) {
|
|
290
|
-
return this.
|
|
308
|
+
return this.rejectNoContent(
|
|
309
|
+
await this.executeRequest("GET", path, { params })
|
|
310
|
+
);
|
|
291
311
|
}
|
|
292
312
|
/** Read an unauthenticated Portkey public-catalog endpoint outside /v1. */
|
|
293
313
|
async getPublic(path, params) {
|
|
294
|
-
return this.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
314
|
+
return this.rejectNoContent(
|
|
315
|
+
await this.executeRequest("GET", path, {
|
|
316
|
+
params,
|
|
317
|
+
baseUrl: DEFAULT_PUBLIC_BASE_URL,
|
|
318
|
+
authenticate: false
|
|
319
|
+
})
|
|
320
|
+
);
|
|
299
321
|
}
|
|
300
322
|
async post(path, body) {
|
|
301
|
-
return this.
|
|
323
|
+
return this.rejectNoContent(
|
|
324
|
+
await this.executeRequest("POST", path, { body })
|
|
325
|
+
);
|
|
302
326
|
}
|
|
303
327
|
async put(path, body) {
|
|
304
|
-
return this.
|
|
328
|
+
return this.rejectNoContent(
|
|
329
|
+
await this.executeRequest("PUT", path, { body })
|
|
330
|
+
);
|
|
305
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* DELETE responses may legitimately come back as HTTP 204. Callers get
|
|
334
|
+
* `T | NoContent` back and must narrow with {@link isNoContent} instead of
|
|
335
|
+
* being handed a fabricated `{}` that silently claims to be a real `T`.
|
|
336
|
+
*/
|
|
306
337
|
async delete(path, params) {
|
|
307
338
|
return this.executeRequest("DELETE", path, {
|
|
308
339
|
params,
|
|
@@ -522,9 +553,10 @@ var CollectionsService = class extends BaseService {
|
|
|
522
553
|
);
|
|
523
554
|
}
|
|
524
555
|
async deleteCollection(collectionId) {
|
|
525
|
-
|
|
556
|
+
const result = await this.delete(
|
|
526
557
|
`/collections/${this.encodePathSegment(collectionId)}`
|
|
527
558
|
);
|
|
559
|
+
return isNoContent(result) ? { success: true } : result;
|
|
528
560
|
}
|
|
529
561
|
};
|
|
530
562
|
|
|
@@ -561,9 +593,10 @@ var ConfigsService = class extends BaseService {
|
|
|
561
593
|
return this.parseConfigResponse(response);
|
|
562
594
|
}
|
|
563
595
|
async deleteConfig(slug) {
|
|
564
|
-
|
|
596
|
+
const result = await this.delete(
|
|
565
597
|
`/configs/${this.encodePathSegment(slug)}`
|
|
566
598
|
);
|
|
599
|
+
return isNoContent(result) ? { success: true } : result;
|
|
567
600
|
}
|
|
568
601
|
async listConfigVersions(slug) {
|
|
569
602
|
return this.get(
|
|
@@ -861,9 +894,10 @@ var LabelsService = class extends BaseService {
|
|
|
861
894
|
);
|
|
862
895
|
}
|
|
863
896
|
async deleteLabel(labelId) {
|
|
864
|
-
|
|
897
|
+
const result = await this.delete(
|
|
865
898
|
`/labels/${this.encodePathSegment(labelId)}`
|
|
866
899
|
);
|
|
900
|
+
return isNoContent(result) ? {} : result;
|
|
867
901
|
}
|
|
868
902
|
};
|
|
869
903
|
|
|
@@ -899,9 +933,10 @@ var LimitsService = class extends BaseService {
|
|
|
899
933
|
if (!id?.trim()) {
|
|
900
934
|
throw new Error("Rate limit ID is required");
|
|
901
935
|
}
|
|
902
|
-
|
|
936
|
+
const result = await this.delete(
|
|
903
937
|
`/policies/rate-limits/${this.encodePathSegment(id)}`
|
|
904
938
|
);
|
|
939
|
+
return isNoContent(result) ? { success: true } : result;
|
|
905
940
|
}
|
|
906
941
|
// ── Usage Limits ──
|
|
907
942
|
async listUsageLimits(workspace_id) {
|
|
@@ -933,9 +968,10 @@ var LimitsService = class extends BaseService {
|
|
|
933
968
|
if (!id?.trim()) {
|
|
934
969
|
throw new Error("Usage limit ID is required");
|
|
935
970
|
}
|
|
936
|
-
|
|
971
|
+
const result = await this.delete(
|
|
937
972
|
`/policies/usage-limits/${this.encodePathSegment(id)}`
|
|
938
973
|
);
|
|
974
|
+
return isNoContent(result) ? { success: true } : result;
|
|
939
975
|
}
|
|
940
976
|
// ── Usage Limit Entities ──
|
|
941
977
|
async listUsageLimitEntities(limitId) {
|
|
@@ -1198,9 +1234,10 @@ var PartialsService = class extends BaseService {
|
|
|
1198
1234
|
);
|
|
1199
1235
|
}
|
|
1200
1236
|
async deletePromptPartial(promptPartialId) {
|
|
1201
|
-
|
|
1237
|
+
const result = await this.delete(
|
|
1202
1238
|
`/prompts/partials/${this.encodePathSegment(promptPartialId)}`
|
|
1203
1239
|
);
|
|
1240
|
+
return isNoContent(result) ? {} : result;
|
|
1204
1241
|
}
|
|
1205
1242
|
async listPartialVersions(promptPartialId) {
|
|
1206
1243
|
const response = await this.get(
|
|
@@ -1277,9 +1314,10 @@ var PromptsService = class extends BaseService {
|
|
|
1277
1314
|
);
|
|
1278
1315
|
}
|
|
1279
1316
|
async deletePrompt(promptId) {
|
|
1280
|
-
|
|
1317
|
+
const result = await this.delete(
|
|
1281
1318
|
`/prompts/${this.encodePathSegment(promptId)}`
|
|
1282
1319
|
);
|
|
1320
|
+
return isNoContent(result) ? {} : result;
|
|
1283
1321
|
}
|
|
1284
1322
|
async publishPrompt(promptId, data) {
|
|
1285
1323
|
return this.put(
|
|
@@ -1560,7 +1598,8 @@ var ProvidersService = class extends BaseService {
|
|
|
1560
1598
|
}
|
|
1561
1599
|
async deleteProvider(slug, workspaceId) {
|
|
1562
1600
|
const path = workspaceId ? `/providers/${this.encodePathSegment(slug)}?workspace_id=${encodeURIComponent(workspaceId)}` : `/providers/${this.encodePathSegment(slug)}`;
|
|
1563
|
-
|
|
1601
|
+
const result = await this.delete(path);
|
|
1602
|
+
return isNoContent(result) ? {} : result;
|
|
1564
1603
|
}
|
|
1565
1604
|
};
|
|
1566
1605
|
|
|
@@ -1896,6 +1935,20 @@ var CreateSecretReferenceResponseSchema = z.object({
|
|
|
1896
1935
|
|
|
1897
1936
|
// src/tools/analytics.tools.ts
|
|
1898
1937
|
import { z as z2 } from "zod";
|
|
1938
|
+
|
|
1939
|
+
// src/tools/utils.ts
|
|
1940
|
+
function formatFullName(firstName, lastName) {
|
|
1941
|
+
return [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
1942
|
+
}
|
|
1943
|
+
function jsonResult(data) {
|
|
1944
|
+
const serialized = JSON.stringify(data) ?? "null";
|
|
1945
|
+
return {
|
|
1946
|
+
content: [{ type: "text", text: serialized }],
|
|
1947
|
+
...isRecord(data) && !Array.isArray(data) ? { structuredContent: data } : {}
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// src/tools/analytics.tools.ts
|
|
1899
1952
|
var baseAnalyticsSchema = {
|
|
1900
1953
|
time_of_generation_min: z2.string().describe(
|
|
1901
1954
|
"Start time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')"
|
|
@@ -1988,6 +2041,48 @@ function formatGraphAnalytics(summary, dataPoints) {
|
|
|
1988
2041
|
function formatGenericGraphAnalytics(analytics) {
|
|
1989
2042
|
return formatGraphAnalytics(analytics.summary, analytics.data_points);
|
|
1990
2043
|
}
|
|
2044
|
+
var GENERIC_GRAPH_ANALYTICS_TOOLS = [
|
|
2045
|
+
{
|
|
2046
|
+
name: "get_error_stacks_analytics",
|
|
2047
|
+
description: "Get stacked error-series data grouped by HTTP status code over time, with summary and per-code series. Use this to see which error classes dominate; use get_error_status_codes_analytics for distinct-code distribution instead.",
|
|
2048
|
+
method: (analytics, params) => analytics.getErrorStacksAnalytics(params)
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
name: "get_error_status_codes_analytics",
|
|
2052
|
+
description: "Get HTTP error-code distribution time-series data with summary and per-code series. Use this to see which codes occur most often; use get_error_stacks_analytics for stacked or cumulative breakdowns.",
|
|
2053
|
+
method: (analytics, params) => analytics.getErrorStatusCodesAnalytics(params)
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
name: "get_user_requests_analytics",
|
|
2057
|
+
description: "Get per-user request-count time-series data with counts grouped by user. Use this to find heavy users and traffic concentration; use get_users_analytics for aggregate active and new user trends instead.",
|
|
2058
|
+
method: (analytics, params) => analytics.getUserRequestsAnalytics(params)
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
name: "get_rescued_requests_analytics",
|
|
2062
|
+
description: "Get rescued-request time-series data showing requests recovered by retry or fallback handling. Use this only when your configs include resilience features, and use it to measure how often recovery logic saved requests.",
|
|
2063
|
+
method: (analytics, params) => analytics.getRescuedRequestsAnalytics(params)
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
name: "get_feedback_analytics",
|
|
2067
|
+
description: "Get feedback-submission time-series data with summary totals and per-bucket counts. Use this as the top-level feedback trend view; use get_feedback_models_analytics, get_feedback_scores_analytics, or get_feedback_weighted_analytics for breakdowns.",
|
|
2068
|
+
method: (analytics, params) => analytics.getFeedbackAnalytics(params)
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
name: "get_feedback_models_analytics",
|
|
2072
|
+
description: "Get feedback time-series data grouped by model, with per-model counts over time. Use this to compare feedback volume and satisfaction across models; use get_feedback_analytics for the overall total instead.",
|
|
2073
|
+
method: (analytics, params) => analytics.getFeedbackModelsAnalytics(params)
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
name: "get_feedback_scores_analytics",
|
|
2077
|
+
description: "Get raw feedback-score distribution time-series data with per-score buckets. Use this to understand sentiment mix; use get_feedback_weighted_analytics for calibrated scores with weighting.",
|
|
2078
|
+
method: (analytics, params) => analytics.getFeedbackScoresAnalytics(params)
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
name: "get_feedback_weighted_analytics",
|
|
2082
|
+
description: "Get weighted feedback-score time-series data using the weight recorded at feedback creation. Use this for calibrated quality metrics; use get_feedback_scores_analytics for the raw unweighted distribution.",
|
|
2083
|
+
method: (analytics, params) => analytics.getFeedbackWeightedAnalytics(params)
|
|
2084
|
+
}
|
|
2085
|
+
];
|
|
1991
2086
|
function formatGroupedAnalytics(analytics, groupLabel) {
|
|
1992
2087
|
return {
|
|
1993
2088
|
total_groups: analytics.total,
|
|
@@ -2082,22 +2177,15 @@ function registerAnalyticsTools(server, service) {
|
|
|
2082
2177
|
total_cost: point.total,
|
|
2083
2178
|
average_cost: point.avg
|
|
2084
2179
|
}));
|
|
2085
|
-
return
|
|
2086
|
-
|
|
2180
|
+
return jsonResult(
|
|
2181
|
+
formatGraphAnalytics(
|
|
2087
2182
|
{
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
},
|
|
2095
|
-
dataPoints
|
|
2096
|
-
)
|
|
2097
|
-
)
|
|
2098
|
-
}
|
|
2099
|
-
]
|
|
2100
|
-
};
|
|
2183
|
+
total_cost: analytics.summary.total,
|
|
2184
|
+
average_cost_per_request: analytics.summary.avg
|
|
2185
|
+
},
|
|
2186
|
+
dataPoints
|
|
2187
|
+
)
|
|
2188
|
+
);
|
|
2101
2189
|
}
|
|
2102
2190
|
);
|
|
2103
2191
|
server.tool(
|
|
@@ -2114,23 +2202,16 @@ function registerAnalyticsTools(server, service) {
|
|
|
2114
2202
|
success: point.success,
|
|
2115
2203
|
failed: point.failed
|
|
2116
2204
|
}));
|
|
2117
|
-
return
|
|
2118
|
-
|
|
2119
|
-
{
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
},
|
|
2128
|
-
dataPoints
|
|
2129
|
-
)
|
|
2130
|
-
)
|
|
2131
|
-
}
|
|
2132
|
-
]
|
|
2133
|
-
};
|
|
2205
|
+
return jsonResult(
|
|
2206
|
+
formatGraphAnalytics(
|
|
2207
|
+
{
|
|
2208
|
+
total_requests: analytics.summary.total,
|
|
2209
|
+
successful_requests: analytics.summary.success,
|
|
2210
|
+
failed_requests: analytics.summary.failed
|
|
2211
|
+
},
|
|
2212
|
+
dataPoints
|
|
2213
|
+
)
|
|
2214
|
+
);
|
|
2134
2215
|
}
|
|
2135
2216
|
);
|
|
2136
2217
|
server.tool(
|
|
@@ -2147,23 +2228,16 @@ function registerAnalyticsTools(server, service) {
|
|
|
2147
2228
|
prompt: point.prompt,
|
|
2148
2229
|
completion: point.completion
|
|
2149
2230
|
}));
|
|
2150
|
-
return
|
|
2151
|
-
|
|
2152
|
-
{
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
},
|
|
2161
|
-
dataPoints
|
|
2162
|
-
)
|
|
2163
|
-
)
|
|
2164
|
-
}
|
|
2165
|
-
]
|
|
2166
|
-
};
|
|
2231
|
+
return jsonResult(
|
|
2232
|
+
formatGraphAnalytics(
|
|
2233
|
+
{
|
|
2234
|
+
total_tokens: analytics.summary.total,
|
|
2235
|
+
prompt_tokens: analytics.summary.prompt,
|
|
2236
|
+
completion_tokens: analytics.summary.completion
|
|
2237
|
+
},
|
|
2238
|
+
dataPoints
|
|
2239
|
+
)
|
|
2240
|
+
);
|
|
2167
2241
|
}
|
|
2168
2242
|
);
|
|
2169
2243
|
server.tool(
|
|
@@ -2181,24 +2255,17 @@ function registerAnalyticsTools(server, service) {
|
|
|
2181
2255
|
p90: point.p90,
|
|
2182
2256
|
p99: point.p99
|
|
2183
2257
|
}));
|
|
2184
|
-
return
|
|
2185
|
-
|
|
2186
|
-
{
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
},
|
|
2196
|
-
dataPoints
|
|
2197
|
-
)
|
|
2198
|
-
)
|
|
2199
|
-
}
|
|
2200
|
-
]
|
|
2201
|
-
};
|
|
2258
|
+
return jsonResult(
|
|
2259
|
+
formatGraphAnalytics(
|
|
2260
|
+
{
|
|
2261
|
+
avg_latency_ms: analytics.summary.avg,
|
|
2262
|
+
p50_latency_ms: analytics.summary.p50,
|
|
2263
|
+
p90_latency_ms: analytics.summary.p90,
|
|
2264
|
+
p99_latency_ms: analytics.summary.p99
|
|
2265
|
+
},
|
|
2266
|
+
dataPoints
|
|
2267
|
+
)
|
|
2268
|
+
);
|
|
2202
2269
|
}
|
|
2203
2270
|
);
|
|
2204
2271
|
server.tool(
|
|
@@ -2213,21 +2280,14 @@ function registerAnalyticsTools(server, service) {
|
|
|
2213
2280
|
timestamp: point.timestamp,
|
|
2214
2281
|
total_errors: point.total
|
|
2215
2282
|
}));
|
|
2216
|
-
return
|
|
2217
|
-
|
|
2283
|
+
return jsonResult(
|
|
2284
|
+
formatGraphAnalytics(
|
|
2218
2285
|
{
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
},
|
|
2225
|
-
dataPoints
|
|
2226
|
-
)
|
|
2227
|
-
)
|
|
2228
|
-
}
|
|
2229
|
-
]
|
|
2230
|
-
};
|
|
2286
|
+
total_errors: analytics.summary.total
|
|
2287
|
+
},
|
|
2288
|
+
dataPoints
|
|
2289
|
+
)
|
|
2290
|
+
);
|
|
2231
2291
|
}
|
|
2232
2292
|
);
|
|
2233
2293
|
server.tool(
|
|
@@ -2242,21 +2302,14 @@ function registerAnalyticsTools(server, service) {
|
|
|
2242
2302
|
timestamp: point.timestamp,
|
|
2243
2303
|
error_rate_percent: point.rate
|
|
2244
2304
|
}));
|
|
2245
|
-
return
|
|
2246
|
-
|
|
2305
|
+
return jsonResult(
|
|
2306
|
+
formatGraphAnalytics(
|
|
2247
2307
|
{
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
},
|
|
2254
|
-
dataPoints
|
|
2255
|
-
)
|
|
2256
|
-
)
|
|
2257
|
-
}
|
|
2258
|
-
]
|
|
2259
|
-
};
|
|
2308
|
+
error_rate_percent: analytics.summary.rate
|
|
2309
|
+
},
|
|
2310
|
+
dataPoints
|
|
2311
|
+
)
|
|
2312
|
+
);
|
|
2260
2313
|
}
|
|
2261
2314
|
);
|
|
2262
2315
|
server.tool(
|
|
@@ -2272,22 +2325,15 @@ function registerAnalyticsTools(server, service) {
|
|
|
2272
2325
|
total: point.total,
|
|
2273
2326
|
avg: point.avg
|
|
2274
2327
|
}));
|
|
2275
|
-
return
|
|
2276
|
-
|
|
2328
|
+
return jsonResult(
|
|
2329
|
+
formatGraphAnalytics(
|
|
2277
2330
|
{
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
},
|
|
2285
|
-
dataPoints
|
|
2286
|
-
)
|
|
2287
|
-
)
|
|
2288
|
-
}
|
|
2289
|
-
]
|
|
2290
|
-
};
|
|
2331
|
+
total_latency: analytics.summary.total,
|
|
2332
|
+
avg_latency: analytics.summary.avg
|
|
2333
|
+
},
|
|
2334
|
+
dataPoints
|
|
2335
|
+
)
|
|
2336
|
+
);
|
|
2291
2337
|
}
|
|
2292
2338
|
);
|
|
2293
2339
|
server.tool(
|
|
@@ -2304,23 +2350,16 @@ function registerAnalyticsTools(server, service) {
|
|
|
2304
2350
|
hits: point.hits,
|
|
2305
2351
|
misses: point.misses
|
|
2306
2352
|
}));
|
|
2307
|
-
return
|
|
2308
|
-
|
|
2309
|
-
{
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
},
|
|
2318
|
-
dataPoints
|
|
2319
|
-
)
|
|
2320
|
-
)
|
|
2321
|
-
}
|
|
2322
|
-
]
|
|
2323
|
-
};
|
|
2353
|
+
return jsonResult(
|
|
2354
|
+
formatGraphAnalytics(
|
|
2355
|
+
{
|
|
2356
|
+
hit_rate: analytics.summary.rate,
|
|
2357
|
+
total_hits: analytics.summary.total_hits,
|
|
2358
|
+
total_misses: analytics.summary.total_misses
|
|
2359
|
+
},
|
|
2360
|
+
dataPoints
|
|
2361
|
+
)
|
|
2362
|
+
);
|
|
2324
2363
|
}
|
|
2325
2364
|
);
|
|
2326
2365
|
server.tool(
|
|
@@ -2336,168 +2375,31 @@ function registerAnalyticsTools(server, service) {
|
|
|
2336
2375
|
active_users: point.active_users,
|
|
2337
2376
|
new_users: point.new_users
|
|
2338
2377
|
}));
|
|
2339
|
-
return
|
|
2340
|
-
|
|
2341
|
-
{
|
|
2342
|
-
type: "text",
|
|
2343
|
-
text: JSON.stringify(
|
|
2344
|
-
formatGraphAnalytics(
|
|
2345
|
-
{
|
|
2346
|
-
total_active_users: analytics.summary.total_active_users,
|
|
2347
|
-
total_new_users: analytics.summary.total_new_users
|
|
2348
|
-
},
|
|
2349
|
-
dataPoints
|
|
2350
|
-
)
|
|
2351
|
-
)
|
|
2352
|
-
}
|
|
2353
|
-
]
|
|
2354
|
-
};
|
|
2355
|
-
}
|
|
2356
|
-
);
|
|
2357
|
-
server.tool(
|
|
2358
|
-
"get_error_stacks_analytics",
|
|
2359
|
-
"Get stacked error-series data grouped by HTTP status code over time, with summary and per-code series. Use this to see which error classes dominate; use get_error_status_codes_analytics for distinct-code distribution instead.",
|
|
2360
|
-
baseAnalyticsSchema,
|
|
2361
|
-
async (params) => {
|
|
2362
|
-
const analytics = await service.analytics.getErrorStacksAnalytics(
|
|
2363
|
-
normalizeAnalyticsParams(params)
|
|
2364
|
-
);
|
|
2365
|
-
return {
|
|
2366
|
-
content: [
|
|
2367
|
-
{
|
|
2368
|
-
type: "text",
|
|
2369
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2370
|
-
}
|
|
2371
|
-
]
|
|
2372
|
-
};
|
|
2373
|
-
}
|
|
2374
|
-
);
|
|
2375
|
-
server.tool(
|
|
2376
|
-
"get_error_status_codes_analytics",
|
|
2377
|
-
"Get HTTP error-code distribution time-series data with summary and per-code series. Use this to see which codes occur most often; use get_error_stacks_analytics for stacked or cumulative breakdowns.",
|
|
2378
|
-
baseAnalyticsSchema,
|
|
2379
|
-
async (params) => {
|
|
2380
|
-
const analytics = await service.analytics.getErrorStatusCodesAnalytics(
|
|
2381
|
-
normalizeAnalyticsParams(params)
|
|
2382
|
-
);
|
|
2383
|
-
return {
|
|
2384
|
-
content: [
|
|
2385
|
-
{
|
|
2386
|
-
type: "text",
|
|
2387
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2388
|
-
}
|
|
2389
|
-
]
|
|
2390
|
-
};
|
|
2391
|
-
}
|
|
2392
|
-
);
|
|
2393
|
-
server.tool(
|
|
2394
|
-
"get_user_requests_analytics",
|
|
2395
|
-
"Get per-user request-count time-series data with counts grouped by user. Use this to find heavy users and traffic concentration; use get_users_analytics for aggregate active and new user trends instead.",
|
|
2396
|
-
baseAnalyticsSchema,
|
|
2397
|
-
async (params) => {
|
|
2398
|
-
const analytics = await service.analytics.getUserRequestsAnalytics(
|
|
2399
|
-
normalizeAnalyticsParams(params)
|
|
2400
|
-
);
|
|
2401
|
-
return {
|
|
2402
|
-
content: [
|
|
2403
|
-
{
|
|
2404
|
-
type: "text",
|
|
2405
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2406
|
-
}
|
|
2407
|
-
]
|
|
2408
|
-
};
|
|
2409
|
-
}
|
|
2410
|
-
);
|
|
2411
|
-
server.tool(
|
|
2412
|
-
"get_rescued_requests_analytics",
|
|
2413
|
-
"Get rescued-request time-series data showing requests recovered by retry or fallback handling. Use this only when your configs include resilience features, and use it to measure how often recovery logic saved requests.",
|
|
2414
|
-
baseAnalyticsSchema,
|
|
2415
|
-
async (params) => {
|
|
2416
|
-
const analytics = await service.analytics.getRescuedRequestsAnalytics(
|
|
2417
|
-
normalizeAnalyticsParams(params)
|
|
2418
|
-
);
|
|
2419
|
-
return {
|
|
2420
|
-
content: [
|
|
2421
|
-
{
|
|
2422
|
-
type: "text",
|
|
2423
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2424
|
-
}
|
|
2425
|
-
]
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
);
|
|
2429
|
-
server.tool(
|
|
2430
|
-
"get_feedback_analytics",
|
|
2431
|
-
"Get feedback-submission time-series data with summary totals and per-bucket counts. Use this as the top-level feedback trend view; use get_feedback_models_analytics, get_feedback_scores_analytics, or get_feedback_weighted_analytics for breakdowns.",
|
|
2432
|
-
baseAnalyticsSchema,
|
|
2433
|
-
async (params) => {
|
|
2434
|
-
const analytics = await service.analytics.getFeedbackAnalytics(
|
|
2435
|
-
normalizeAnalyticsParams(params)
|
|
2436
|
-
);
|
|
2437
|
-
return {
|
|
2438
|
-
content: [
|
|
2439
|
-
{
|
|
2440
|
-
type: "text",
|
|
2441
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2442
|
-
}
|
|
2443
|
-
]
|
|
2444
|
-
};
|
|
2445
|
-
}
|
|
2446
|
-
);
|
|
2447
|
-
server.tool(
|
|
2448
|
-
"get_feedback_models_analytics",
|
|
2449
|
-
"Get feedback time-series data grouped by model, with per-model counts over time. Use this to compare feedback volume and satisfaction across models; use get_feedback_analytics for the overall total instead.",
|
|
2450
|
-
baseAnalyticsSchema,
|
|
2451
|
-
async (params) => {
|
|
2452
|
-
const analytics = await service.analytics.getFeedbackModelsAnalytics(
|
|
2453
|
-
normalizeAnalyticsParams(params)
|
|
2454
|
-
);
|
|
2455
|
-
return {
|
|
2456
|
-
content: [
|
|
2457
|
-
{
|
|
2458
|
-
type: "text",
|
|
2459
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2460
|
-
}
|
|
2461
|
-
]
|
|
2462
|
-
};
|
|
2463
|
-
}
|
|
2464
|
-
);
|
|
2465
|
-
server.tool(
|
|
2466
|
-
"get_feedback_scores_analytics",
|
|
2467
|
-
"Get raw feedback-score distribution time-series data with per-score buckets. Use this to understand sentiment mix; use get_feedback_weighted_analytics for calibrated scores with weighting.",
|
|
2468
|
-
baseAnalyticsSchema,
|
|
2469
|
-
async (params) => {
|
|
2470
|
-
const analytics = await service.analytics.getFeedbackScoresAnalytics(
|
|
2471
|
-
normalizeAnalyticsParams(params)
|
|
2472
|
-
);
|
|
2473
|
-
return {
|
|
2474
|
-
content: [
|
|
2378
|
+
return jsonResult(
|
|
2379
|
+
formatGraphAnalytics(
|
|
2475
2380
|
{
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
}
|
|
2482
|
-
);
|
|
2483
|
-
server.tool(
|
|
2484
|
-
"get_feedback_weighted_analytics",
|
|
2485
|
-
"Get weighted feedback-score time-series data using the weight recorded at feedback creation. Use this for calibrated quality metrics; use get_feedback_scores_analytics for the raw unweighted distribution.",
|
|
2486
|
-
baseAnalyticsSchema,
|
|
2487
|
-
async (params) => {
|
|
2488
|
-
const analytics = await service.analytics.getFeedbackWeightedAnalytics(
|
|
2489
|
-
normalizeAnalyticsParams(params)
|
|
2381
|
+
total_active_users: analytics.summary.total_active_users,
|
|
2382
|
+
total_new_users: analytics.summary.total_new_users
|
|
2383
|
+
},
|
|
2384
|
+
dataPoints
|
|
2385
|
+
)
|
|
2490
2386
|
);
|
|
2491
|
-
return {
|
|
2492
|
-
content: [
|
|
2493
|
-
{
|
|
2494
|
-
type: "text",
|
|
2495
|
-
text: JSON.stringify(formatGenericGraphAnalytics(analytics))
|
|
2496
|
-
}
|
|
2497
|
-
]
|
|
2498
|
-
};
|
|
2499
2387
|
}
|
|
2500
2388
|
);
|
|
2389
|
+
for (const tool of GENERIC_GRAPH_ANALYTICS_TOOLS) {
|
|
2390
|
+
server.tool(
|
|
2391
|
+
tool.name,
|
|
2392
|
+
tool.description,
|
|
2393
|
+
baseAnalyticsSchema,
|
|
2394
|
+
async (params) => {
|
|
2395
|
+
const analytics = await tool.method(
|
|
2396
|
+
service.analytics,
|
|
2397
|
+
normalizeAnalyticsParams(params)
|
|
2398
|
+
);
|
|
2399
|
+
return jsonResult(formatGenericGraphAnalytics(analytics));
|
|
2400
|
+
}
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2501
2403
|
server.tool(
|
|
2502
2404
|
"get_analytics_group_users",
|
|
2503
2405
|
"Get a paginated per-user breakdown with total_groups, group_count, and a users array containing request count, cost, and token usage. Use this for billing, audits, or top-consumer analysis; use get_users_analytics for aggregate active and new user trends.",
|
|
@@ -2506,14 +2408,7 @@ function registerAnalyticsTools(server, service) {
|
|
|
2506
2408
|
const analytics = await service.analytics.getAnalyticsGroupUsers(
|
|
2507
2409
|
normalizeAnalyticsParams(params)
|
|
2508
2410
|
);
|
|
2509
|
-
return
|
|
2510
|
-
content: [
|
|
2511
|
-
{
|
|
2512
|
-
type: "text",
|
|
2513
|
-
text: JSON.stringify(formatGroupedAnalytics(analytics, "users"))
|
|
2514
|
-
}
|
|
2515
|
-
]
|
|
2516
|
-
};
|
|
2411
|
+
return jsonResult(formatGroupedAnalytics(analytics, "users"));
|
|
2517
2412
|
}
|
|
2518
2413
|
);
|
|
2519
2414
|
server.tool(
|
|
@@ -2524,14 +2419,7 @@ function registerAnalyticsTools(server, service) {
|
|
|
2524
2419
|
const analytics = await service.analytics.getAnalyticsGroupModels(
|
|
2525
2420
|
normalizeAnalyticsParams(params)
|
|
2526
2421
|
);
|
|
2527
|
-
return
|
|
2528
|
-
content: [
|
|
2529
|
-
{
|
|
2530
|
-
type: "text",
|
|
2531
|
-
text: JSON.stringify(formatGroupedAnalytics(analytics, "models"))
|
|
2532
|
-
}
|
|
2533
|
-
]
|
|
2534
|
-
};
|
|
2422
|
+
return jsonResult(formatGroupedAnalytics(analytics, "models"));
|
|
2535
2423
|
}
|
|
2536
2424
|
);
|
|
2537
2425
|
server.tool(
|
|
@@ -2544,16 +2432,7 @@ function registerAnalyticsTools(server, service) {
|
|
|
2544
2432
|
metadata_key,
|
|
2545
2433
|
normalizeAnalyticsParams(analyticsParams)
|
|
2546
2434
|
);
|
|
2547
|
-
return
|
|
2548
|
-
content: [
|
|
2549
|
-
{
|
|
2550
|
-
type: "text",
|
|
2551
|
-
text: JSON.stringify(
|
|
2552
|
-
formatGroupedAnalytics(analytics, "metadata_groups")
|
|
2553
|
-
)
|
|
2554
|
-
}
|
|
2555
|
-
]
|
|
2556
|
-
};
|
|
2435
|
+
return jsonResult(formatGroupedAnalytics(analytics, "metadata_groups"));
|
|
2557
2436
|
}
|
|
2558
2437
|
);
|
|
2559
2438
|
}
|
|
@@ -2598,34 +2477,27 @@ function registerAuditTools(server, service) {
|
|
|
2598
2477
|
current_page: params.current_page,
|
|
2599
2478
|
page_size: params.page_size
|
|
2600
2479
|
});
|
|
2601
|
-
return {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
user_agent: log.user_agent,
|
|
2623
|
-
created_at: log.created_at
|
|
2624
|
-
}))
|
|
2625
|
-
})
|
|
2626
|
-
}
|
|
2627
|
-
]
|
|
2628
|
-
};
|
|
2480
|
+
return jsonResult({
|
|
2481
|
+
total: result.total,
|
|
2482
|
+
current_page: result.current_page,
|
|
2483
|
+
page_size: result.page_size,
|
|
2484
|
+
audit_logs: result.data.map((log) => ({
|
|
2485
|
+
id: log.id,
|
|
2486
|
+
action: log.action,
|
|
2487
|
+
actor_id: log.actor_id,
|
|
2488
|
+
actor_email: log.actor_email,
|
|
2489
|
+
actor_name: log.actor_name,
|
|
2490
|
+
resource_type: log.resource_type,
|
|
2491
|
+
resource_id: log.resource_id,
|
|
2492
|
+
resource_name: log.resource_name,
|
|
2493
|
+
workspace_id: log.workspace_id,
|
|
2494
|
+
organisation_id: log.organisation_id,
|
|
2495
|
+
metadata: log.metadata,
|
|
2496
|
+
ip_address: log.ip_address,
|
|
2497
|
+
user_agent: log.user_agent,
|
|
2498
|
+
created_at: log.created_at
|
|
2499
|
+
}))
|
|
2500
|
+
});
|
|
2629
2501
|
}
|
|
2630
2502
|
);
|
|
2631
2503
|
}
|
|
@@ -2664,24 +2536,17 @@ function registerCollectionsTools(server, service) {
|
|
|
2664
2536
|
COLLECTIONS_TOOL_SCHEMAS.listCollections,
|
|
2665
2537
|
async (params) => {
|
|
2666
2538
|
const collections = await service.collections.listCollections(params);
|
|
2667
|
-
return {
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
created_at: collection.created_at,
|
|
2679
|
-
last_updated_at: collection.last_updated_at
|
|
2680
|
-
}))
|
|
2681
|
-
})
|
|
2682
|
-
}
|
|
2683
|
-
]
|
|
2684
|
-
};
|
|
2539
|
+
return jsonResult({
|
|
2540
|
+
total: collections.total,
|
|
2541
|
+
collections: collections.data.map((collection) => ({
|
|
2542
|
+
id: collection.id,
|
|
2543
|
+
name: collection.name,
|
|
2544
|
+
slug: collection.slug,
|
|
2545
|
+
workspace_id: collection.workspace_id,
|
|
2546
|
+
created_at: collection.created_at,
|
|
2547
|
+
last_updated_at: collection.last_updated_at
|
|
2548
|
+
}))
|
|
2549
|
+
});
|
|
2685
2550
|
}
|
|
2686
2551
|
);
|
|
2687
2552
|
server.tool(
|
|
@@ -2690,18 +2555,11 @@ function registerCollectionsTools(server, service) {
|
|
|
2690
2555
|
COLLECTIONS_TOOL_SCHEMAS.createCollection,
|
|
2691
2556
|
async (params) => {
|
|
2692
2557
|
const result = await service.collections.createCollection(params);
|
|
2693
|
-
return {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
message: `Successfully created collection "${params.name}"`,
|
|
2699
|
-
id: result.id,
|
|
2700
|
-
slug: result.slug
|
|
2701
|
-
})
|
|
2702
|
-
}
|
|
2703
|
-
]
|
|
2704
|
-
};
|
|
2558
|
+
return jsonResult({
|
|
2559
|
+
message: `Successfully created collection "${params.name}"`,
|
|
2560
|
+
id: result.id,
|
|
2561
|
+
slug: result.slug
|
|
2562
|
+
});
|
|
2705
2563
|
}
|
|
2706
2564
|
);
|
|
2707
2565
|
server.tool(
|
|
@@ -2712,21 +2570,14 @@ function registerCollectionsTools(server, service) {
|
|
|
2712
2570
|
const collection = await service.collections.getCollection(
|
|
2713
2571
|
params.collection_id
|
|
2714
2572
|
);
|
|
2715
|
-
return {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
workspace_id: collection.workspace_id,
|
|
2724
|
-
created_at: collection.created_at,
|
|
2725
|
-
last_updated_at: collection.last_updated_at
|
|
2726
|
-
})
|
|
2727
|
-
}
|
|
2728
|
-
]
|
|
2729
|
-
};
|
|
2573
|
+
return jsonResult({
|
|
2574
|
+
id: collection.id,
|
|
2575
|
+
name: collection.name,
|
|
2576
|
+
slug: collection.slug,
|
|
2577
|
+
workspace_id: collection.workspace_id,
|
|
2578
|
+
created_at: collection.created_at,
|
|
2579
|
+
last_updated_at: collection.last_updated_at
|
|
2580
|
+
});
|
|
2730
2581
|
}
|
|
2731
2582
|
);
|
|
2732
2583
|
server.tool(
|
|
@@ -2738,17 +2589,10 @@ function registerCollectionsTools(server, service) {
|
|
|
2738
2589
|
name: params.name,
|
|
2739
2590
|
description: params.description
|
|
2740
2591
|
});
|
|
2741
|
-
return {
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
text: JSON.stringify({
|
|
2746
|
-
message: `Successfully updated collection "${params.collection_id}"`,
|
|
2747
|
-
success: true
|
|
2748
|
-
})
|
|
2749
|
-
}
|
|
2750
|
-
]
|
|
2751
|
-
};
|
|
2592
|
+
return jsonResult({
|
|
2593
|
+
message: `Successfully updated collection "${params.collection_id}"`,
|
|
2594
|
+
success: true
|
|
2595
|
+
});
|
|
2752
2596
|
}
|
|
2753
2597
|
);
|
|
2754
2598
|
server.tool(
|
|
@@ -2759,17 +2603,10 @@ function registerCollectionsTools(server, service) {
|
|
|
2759
2603
|
const result = await service.collections.deleteCollection(
|
|
2760
2604
|
params.collection_id
|
|
2761
2605
|
);
|
|
2762
|
-
return {
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
text: JSON.stringify({
|
|
2767
|
-
message: `Successfully deleted collection "${params.collection_id}"`,
|
|
2768
|
-
success: result.success
|
|
2769
|
-
})
|
|
2770
|
-
}
|
|
2771
|
-
]
|
|
2772
|
-
};
|
|
2606
|
+
return jsonResult({
|
|
2607
|
+
message: `Successfully deleted collection "${params.collection_id}"`,
|
|
2608
|
+
success: result.success
|
|
2609
|
+
});
|
|
2773
2610
|
}
|
|
2774
2611
|
);
|
|
2775
2612
|
}
|
|
@@ -2857,28 +2694,21 @@ function registerConfigsTools(server, service) {
|
|
|
2857
2694
|
current_page: params.current_page,
|
|
2858
2695
|
page_size: params.page_size
|
|
2859
2696
|
});
|
|
2860
|
-
return {
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
owner_id: config.owner_id,
|
|
2876
|
-
updated_by: config.updated_by
|
|
2877
|
-
}))
|
|
2878
|
-
})
|
|
2879
|
-
}
|
|
2880
|
-
]
|
|
2881
|
-
};
|
|
2697
|
+
return jsonResult({
|
|
2698
|
+
total: configs.total,
|
|
2699
|
+
configurations: (configs.data ?? []).map((config) => ({
|
|
2700
|
+
id: config.id,
|
|
2701
|
+
name: config.name,
|
|
2702
|
+
slug: config.slug,
|
|
2703
|
+
workspace_id: config.workspace_id,
|
|
2704
|
+
status: config.status,
|
|
2705
|
+
is_default: config.is_default,
|
|
2706
|
+
created_at: config.created_at,
|
|
2707
|
+
last_updated_at: config.last_updated_at,
|
|
2708
|
+
owner_id: config.owner_id,
|
|
2709
|
+
updated_by: config.updated_by
|
|
2710
|
+
}))
|
|
2711
|
+
});
|
|
2882
2712
|
}
|
|
2883
2713
|
);
|
|
2884
2714
|
server.tool(
|
|
@@ -2887,38 +2717,31 @@ function registerConfigsTools(server, service) {
|
|
|
2887
2717
|
CONFIGS_TOOL_SCHEMAS.getConfig,
|
|
2888
2718
|
async (params) => {
|
|
2889
2719
|
const response = await service.configs.getConfig(params.slug);
|
|
2890
|
-
return {
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
targets: response.config.targets?.map(
|
|
2912
|
-
(target) => ({
|
|
2913
|
-
provider: target.provider,
|
|
2914
|
-
virtual_key: target.virtual_key
|
|
2915
|
-
})
|
|
2916
|
-
)
|
|
2917
|
-
}
|
|
2720
|
+
return jsonResult({
|
|
2721
|
+
id: response.id,
|
|
2722
|
+
slug: response.slug,
|
|
2723
|
+
name: response.name,
|
|
2724
|
+
status: response.status,
|
|
2725
|
+
config: {
|
|
2726
|
+
cache: response.config.cache && {
|
|
2727
|
+
mode: response.config.cache.mode,
|
|
2728
|
+
max_age: response.config.cache.max_age
|
|
2729
|
+
},
|
|
2730
|
+
retry: response.config.retry && {
|
|
2731
|
+
attempts: response.config.retry.attempts,
|
|
2732
|
+
on_status_codes: response.config.retry.on_status_codes
|
|
2733
|
+
},
|
|
2734
|
+
strategy: response.config.strategy && {
|
|
2735
|
+
mode: response.config.strategy.mode
|
|
2736
|
+
},
|
|
2737
|
+
targets: response.config.targets?.map(
|
|
2738
|
+
(target) => ({
|
|
2739
|
+
provider: target.provider,
|
|
2740
|
+
virtual_key: target.virtual_key
|
|
2918
2741
|
})
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
};
|
|
2742
|
+
)
|
|
2743
|
+
}
|
|
2744
|
+
});
|
|
2922
2745
|
}
|
|
2923
2746
|
);
|
|
2924
2747
|
server.tool(
|
|
@@ -2943,18 +2766,11 @@ function registerConfigsTools(server, service) {
|
|
|
2943
2766
|
config,
|
|
2944
2767
|
workspace_id: params.workspace_id
|
|
2945
2768
|
});
|
|
2946
|
-
return {
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
message: `Successfully created configuration "${params.name}"`,
|
|
2952
|
-
id: result.id,
|
|
2953
|
-
version_id: result.version_id
|
|
2954
|
-
})
|
|
2955
|
-
}
|
|
2956
|
-
]
|
|
2957
|
-
};
|
|
2769
|
+
return jsonResult({
|
|
2770
|
+
message: `Successfully created configuration "${params.name}"`,
|
|
2771
|
+
id: result.id,
|
|
2772
|
+
version_id: result.version_id
|
|
2773
|
+
});
|
|
2958
2774
|
}
|
|
2959
2775
|
);
|
|
2960
2776
|
server.tool(
|
|
@@ -2979,19 +2795,12 @@ function registerConfigsTools(server, service) {
|
|
|
2979
2795
|
params.slug,
|
|
2980
2796
|
updateData
|
|
2981
2797
|
);
|
|
2982
|
-
return {
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
id: result.id,
|
|
2989
|
-
slug: result.slug,
|
|
2990
|
-
config: result.config
|
|
2991
|
-
})
|
|
2992
|
-
}
|
|
2993
|
-
]
|
|
2994
|
-
};
|
|
2798
|
+
return jsonResult({
|
|
2799
|
+
message: `Successfully updated configuration "${params.slug}"`,
|
|
2800
|
+
id: result.id,
|
|
2801
|
+
slug: result.slug,
|
|
2802
|
+
config: result.config
|
|
2803
|
+
});
|
|
2995
2804
|
}
|
|
2996
2805
|
);
|
|
2997
2806
|
server.tool(
|
|
@@ -3000,17 +2809,10 @@ function registerConfigsTools(server, service) {
|
|
|
3000
2809
|
CONFIGS_TOOL_SCHEMAS.deleteConfig,
|
|
3001
2810
|
async (params) => {
|
|
3002
2811
|
const result = await service.configs.deleteConfig(params.slug);
|
|
3003
|
-
return {
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
text: JSON.stringify({
|
|
3008
|
-
message: `Successfully deleted configuration "${params.slug}"`,
|
|
3009
|
-
success: result.success
|
|
3010
|
-
})
|
|
3011
|
-
}
|
|
3012
|
-
]
|
|
3013
|
-
};
|
|
2812
|
+
return jsonResult({
|
|
2813
|
+
message: `Successfully deleted configuration "${params.slug}"`,
|
|
2814
|
+
success: result.success
|
|
2815
|
+
});
|
|
3014
2816
|
}
|
|
3015
2817
|
);
|
|
3016
2818
|
server.tool(
|
|
@@ -3019,23 +2821,16 @@ function registerConfigsTools(server, service) {
|
|
|
3019
2821
|
CONFIGS_TOOL_SCHEMAS.listConfigVersions,
|
|
3020
2822
|
async (params) => {
|
|
3021
2823
|
const result = await service.configs.listConfigVersions(params.slug);
|
|
3022
|
-
return {
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
created_at: version.created_at,
|
|
3033
|
-
created_by: version.created_by
|
|
3034
|
-
}))
|
|
3035
|
-
})
|
|
3036
|
-
}
|
|
3037
|
-
]
|
|
3038
|
-
};
|
|
2824
|
+
return jsonResult({
|
|
2825
|
+
total: result.total,
|
|
2826
|
+
versions: (result.data ?? []).map((version) => ({
|
|
2827
|
+
id: version.id,
|
|
2828
|
+
version: version.version,
|
|
2829
|
+
config: version.config,
|
|
2830
|
+
created_at: version.created_at,
|
|
2831
|
+
created_by: version.created_by
|
|
2832
|
+
}))
|
|
2833
|
+
});
|
|
3039
2834
|
}
|
|
3040
2835
|
);
|
|
3041
2836
|
}
|
|
@@ -3120,16 +2915,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3120
2915
|
"Get the organisation-wide input and output guardrails that workspaces inherit by default. Use this before update_organisation_defaults or when auditing baseline enforcement; it does not include per-workspace exclusions, which are available from the directional exclusion list tools. Requires an organisation service API key with organisation_settings.read scope.",
|
|
3121
2916
|
GUARDRAILS_TOOL_SCHEMAS.getOrganisationDefaults,
|
|
3122
2917
|
GET_ORGANISATION_DEFAULTS_ANNOTATIONS,
|
|
3123
|
-
async () => (
|
|
3124
|
-
content: [
|
|
3125
|
-
{
|
|
3126
|
-
type: "text",
|
|
3127
|
-
text: JSON.stringify(
|
|
3128
|
-
await service.guardrails.getOrganisationDefaults()
|
|
3129
|
-
)
|
|
3130
|
-
}
|
|
3131
|
-
]
|
|
3132
|
-
})
|
|
2918
|
+
async () => jsonResult(await service.guardrails.getOrganisationDefaults())
|
|
3133
2919
|
);
|
|
3134
2920
|
server.tool(
|
|
3135
2921
|
"update_organisation_defaults",
|
|
@@ -3142,16 +2928,7 @@ function registerGuardrailsTools(server, service) {
|
|
|
3142
2928
|
idempotentHint: true,
|
|
3143
2929
|
openWorldHint: true
|
|
3144
2930
|
},
|
|
3145
|
-
async (params) => (
|
|
3146
|
-
content: [
|
|
3147
|
-
{
|
|
3148
|
-
type: "text",
|
|
3149
|
-
text: JSON.stringify(
|
|
3150
|
-
await service.guardrails.updateOrganisationDefaults(params)
|
|
3151
|
-
)
|
|
3152
|
-
}
|
|
3153
|
-
]
|
|
3154
|
-
})
|
|
2931
|
+
async (params) => jsonResult(await service.guardrails.updateOrganisationDefaults(params))
|
|
3155
2932
|
);
|
|
3156
2933
|
server.tool(
|
|
3157
2934
|
"list_input_guardrail_workspace_exclusions",
|
|
@@ -3164,16 +2941,9 @@ function registerGuardrailsTools(server, service) {
|
|
|
3164
2941
|
idempotentHint: true,
|
|
3165
2942
|
openWorldHint: true
|
|
3166
2943
|
},
|
|
3167
|
-
async (params) => (
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
type: "text",
|
|
3171
|
-
text: JSON.stringify(
|
|
3172
|
-
await service.guardrails.listWorkspaceExclusions("input", params)
|
|
3173
|
-
)
|
|
3174
|
-
}
|
|
3175
|
-
]
|
|
3176
|
-
})
|
|
2944
|
+
async (params) => jsonResult(
|
|
2945
|
+
await service.guardrails.listWorkspaceExclusions("input", params)
|
|
2946
|
+
)
|
|
3177
2947
|
);
|
|
3178
2948
|
server.tool(
|
|
3179
2949
|
"update_input_guardrail_workspace_exclusions",
|
|
@@ -3186,16 +2956,9 @@ function registerGuardrailsTools(server, service) {
|
|
|
3186
2956
|
idempotentHint: true,
|
|
3187
2957
|
openWorldHint: true
|
|
3188
2958
|
},
|
|
3189
|
-
async (params) => (
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
type: "text",
|
|
3193
|
-
text: JSON.stringify(
|
|
3194
|
-
await service.guardrails.updateWorkspaceExclusions("input", params)
|
|
3195
|
-
)
|
|
3196
|
-
}
|
|
3197
|
-
]
|
|
3198
|
-
})
|
|
2959
|
+
async (params) => jsonResult(
|
|
2960
|
+
await service.guardrails.updateWorkspaceExclusions("input", params)
|
|
2961
|
+
)
|
|
3199
2962
|
);
|
|
3200
2963
|
server.tool(
|
|
3201
2964
|
"list_output_guardrail_workspace_exclusions",
|
|
@@ -3208,16 +2971,9 @@ function registerGuardrailsTools(server, service) {
|
|
|
3208
2971
|
idempotentHint: true,
|
|
3209
2972
|
openWorldHint: true
|
|
3210
2973
|
},
|
|
3211
|
-
async (params) => (
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
type: "text",
|
|
3215
|
-
text: JSON.stringify(
|
|
3216
|
-
await service.guardrails.listWorkspaceExclusions("output", params)
|
|
3217
|
-
)
|
|
3218
|
-
}
|
|
3219
|
-
]
|
|
3220
|
-
})
|
|
2974
|
+
async (params) => jsonResult(
|
|
2975
|
+
await service.guardrails.listWorkspaceExclusions("output", params)
|
|
2976
|
+
)
|
|
3221
2977
|
);
|
|
3222
2978
|
server.tool(
|
|
3223
2979
|
"update_output_guardrail_workspace_exclusions",
|
|
@@ -3230,19 +2986,9 @@ function registerGuardrailsTools(server, service) {
|
|
|
3230
2986
|
idempotentHint: true,
|
|
3231
2987
|
openWorldHint: true
|
|
3232
2988
|
},
|
|
3233
|
-
async (params) => (
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
type: "text",
|
|
3237
|
-
text: JSON.stringify(
|
|
3238
|
-
await service.guardrails.updateWorkspaceExclusions(
|
|
3239
|
-
"output",
|
|
3240
|
-
params
|
|
3241
|
-
)
|
|
3242
|
-
)
|
|
3243
|
-
}
|
|
3244
|
-
]
|
|
3245
|
-
})
|
|
2989
|
+
async (params) => jsonResult(
|
|
2990
|
+
await service.guardrails.updateWorkspaceExclusions("output", params)
|
|
2991
|
+
)
|
|
3246
2992
|
);
|
|
3247
2993
|
server.tool(
|
|
3248
2994
|
"list_guardrails",
|
|
@@ -3250,28 +2996,21 @@ function registerGuardrailsTools(server, service) {
|
|
|
3250
2996
|
GUARDRAILS_TOOL_SCHEMAS.listGuardrails,
|
|
3251
2997
|
async (params) => {
|
|
3252
2998
|
const result = await service.guardrails.listGuardrails(params);
|
|
3253
|
-
return {
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
owner_id: guardrail.owner_id,
|
|
3269
|
-
updated_by: guardrail.updated_by
|
|
3270
|
-
}))
|
|
3271
|
-
})
|
|
3272
|
-
}
|
|
3273
|
-
]
|
|
3274
|
-
};
|
|
2999
|
+
return jsonResult({
|
|
3000
|
+
total: result.total,
|
|
3001
|
+
guardrails: result.data.map((guardrail) => ({
|
|
3002
|
+
id: guardrail.id,
|
|
3003
|
+
name: guardrail.name,
|
|
3004
|
+
slug: guardrail.slug,
|
|
3005
|
+
status: guardrail.status,
|
|
3006
|
+
workspace_id: guardrail.workspace_id,
|
|
3007
|
+
organisation_id: guardrail.organisation_id,
|
|
3008
|
+
created_at: guardrail.created_at,
|
|
3009
|
+
last_updated_at: guardrail.last_updated_at,
|
|
3010
|
+
owner_id: guardrail.owner_id,
|
|
3011
|
+
updated_by: guardrail.updated_by
|
|
3012
|
+
}))
|
|
3013
|
+
});
|
|
3275
3014
|
}
|
|
3276
3015
|
);
|
|
3277
3016
|
server.tool(
|
|
@@ -3282,27 +3021,20 @@ function registerGuardrailsTools(server, service) {
|
|
|
3282
3021
|
const guardrail = await service.guardrails.getGuardrail(
|
|
3283
3022
|
params.guardrail_id
|
|
3284
3023
|
);
|
|
3285
|
-
return {
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
last_updated_at: guardrail.last_updated_at,
|
|
3300
|
-
owner_id: guardrail.owner_id,
|
|
3301
|
-
updated_by: guardrail.updated_by
|
|
3302
|
-
})
|
|
3303
|
-
}
|
|
3304
|
-
]
|
|
3305
|
-
};
|
|
3024
|
+
return jsonResult({
|
|
3025
|
+
id: guardrail.id,
|
|
3026
|
+
name: guardrail.name,
|
|
3027
|
+
slug: guardrail.slug,
|
|
3028
|
+
status: guardrail.status,
|
|
3029
|
+
workspace_id: guardrail.workspace_id,
|
|
3030
|
+
organisation_id: guardrail.organisation_id,
|
|
3031
|
+
checks: guardrail.checks,
|
|
3032
|
+
actions: guardrail.actions,
|
|
3033
|
+
created_at: guardrail.created_at,
|
|
3034
|
+
last_updated_at: guardrail.last_updated_at,
|
|
3035
|
+
owner_id: guardrail.owner_id,
|
|
3036
|
+
updated_by: guardrail.updated_by
|
|
3037
|
+
});
|
|
3306
3038
|
}
|
|
3307
3039
|
);
|
|
3308
3040
|
server.tool(
|
|
@@ -3317,19 +3049,12 @@ function registerGuardrailsTools(server, service) {
|
|
|
3317
3049
|
workspace_id: params.workspace_id,
|
|
3318
3050
|
organisation_id: params.organisation_id
|
|
3319
3051
|
});
|
|
3320
|
-
return {
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
id: result.id,
|
|
3327
|
-
slug: result.slug,
|
|
3328
|
-
version_id: result.version_id
|
|
3329
|
-
})
|
|
3330
|
-
}
|
|
3331
|
-
]
|
|
3332
|
-
};
|
|
3052
|
+
return jsonResult({
|
|
3053
|
+
message: `Successfully created guardrail "${params.name}"`,
|
|
3054
|
+
id: result.id,
|
|
3055
|
+
slug: result.slug,
|
|
3056
|
+
version_id: result.version_id
|
|
3057
|
+
});
|
|
3333
3058
|
}
|
|
3334
3059
|
);
|
|
3335
3060
|
server.tool(
|
|
@@ -3351,19 +3076,12 @@ function registerGuardrailsTools(server, service) {
|
|
|
3351
3076
|
params.guardrail_id,
|
|
3352
3077
|
updateData
|
|
3353
3078
|
);
|
|
3354
|
-
return {
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
id: result.id,
|
|
3361
|
-
slug: result.slug,
|
|
3362
|
-
version_id: result.version_id
|
|
3363
|
-
})
|
|
3364
|
-
}
|
|
3365
|
-
]
|
|
3366
|
-
};
|
|
3079
|
+
return jsonResult({
|
|
3080
|
+
message: `Successfully updated guardrail "${params.guardrail_id}"`,
|
|
3081
|
+
id: result.id,
|
|
3082
|
+
slug: result.slug,
|
|
3083
|
+
version_id: result.version_id
|
|
3084
|
+
});
|
|
3367
3085
|
}
|
|
3368
3086
|
);
|
|
3369
3087
|
server.tool(
|
|
@@ -3374,17 +3092,10 @@ function registerGuardrailsTools(server, service) {
|
|
|
3374
3092
|
const result = await service.guardrails.deleteGuardrail(
|
|
3375
3093
|
params.guardrail_id
|
|
3376
3094
|
);
|
|
3377
|
-
return {
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
text: JSON.stringify({
|
|
3382
|
-
message: `Successfully deleted guardrail "${params.guardrail_id}"`,
|
|
3383
|
-
success: result.success
|
|
3384
|
-
})
|
|
3385
|
-
}
|
|
3386
|
-
]
|
|
3387
|
-
};
|
|
3095
|
+
return jsonResult({
|
|
3096
|
+
message: `Successfully deleted guardrail "${params.guardrail_id}"`,
|
|
3097
|
+
success: result.success
|
|
3098
|
+
});
|
|
3388
3099
|
}
|
|
3389
3100
|
);
|
|
3390
3101
|
}
|
|
@@ -3719,19 +3430,12 @@ function registerIntegrationsTools(server, service) {
|
|
|
3719
3430
|
idempotentHint: true,
|
|
3720
3431
|
openWorldHint: true
|
|
3721
3432
|
},
|
|
3722
|
-
async (params) => (
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
params.provider,
|
|
3729
|
-
params.model
|
|
3730
|
-
)
|
|
3731
|
-
)
|
|
3732
|
-
}
|
|
3733
|
-
]
|
|
3734
|
-
})
|
|
3433
|
+
async (params) => jsonResult(
|
|
3434
|
+
await service.integrations.getModelPricing(
|
|
3435
|
+
params.provider,
|
|
3436
|
+
params.model
|
|
3437
|
+
)
|
|
3438
|
+
)
|
|
3735
3439
|
);
|
|
3736
3440
|
server.tool(
|
|
3737
3441
|
"list_integrations",
|
|
@@ -3744,27 +3448,20 @@ function registerIntegrationsTools(server, service) {
|
|
|
3744
3448
|
workspace_id: params.workspace_id,
|
|
3745
3449
|
type: params.type
|
|
3746
3450
|
});
|
|
3747
|
-
return {
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
created_at: integration.created_at,
|
|
3762
|
-
last_updated_at: integration.last_updated_at
|
|
3763
|
-
}))
|
|
3764
|
-
})
|
|
3765
|
-
}
|
|
3766
|
-
]
|
|
3767
|
-
};
|
|
3451
|
+
return jsonResult({
|
|
3452
|
+
total: integrations.total,
|
|
3453
|
+
integrations: integrations.data.map((integration) => ({
|
|
3454
|
+
id: integration.id,
|
|
3455
|
+
name: integration.name,
|
|
3456
|
+
slug: integration.slug,
|
|
3457
|
+
ai_provider_id: integration.ai_provider_id,
|
|
3458
|
+
status: integration.status,
|
|
3459
|
+
description: integration.description,
|
|
3460
|
+
organisation_id: integration.organisation_id,
|
|
3461
|
+
created_at: integration.created_at,
|
|
3462
|
+
last_updated_at: integration.last_updated_at
|
|
3463
|
+
}))
|
|
3464
|
+
});
|
|
3768
3465
|
}
|
|
3769
3466
|
);
|
|
3770
3467
|
server.tool(
|
|
@@ -3792,18 +3489,11 @@ function registerIntegrationsTools(server, service) {
|
|
|
3792
3489
|
...params.secret_mappings !== void 0 ? { secret_mappings: params.secret_mappings } : {},
|
|
3793
3490
|
...params.pricing_adjustments !== void 0 ? { pricing_adjustments: params.pricing_adjustments } : {}
|
|
3794
3491
|
});
|
|
3795
|
-
return {
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
message: `Successfully created integration "${params.name}"`,
|
|
3801
|
-
id: result.id,
|
|
3802
|
-
slug: result.slug
|
|
3803
|
-
})
|
|
3804
|
-
}
|
|
3805
|
-
]
|
|
3806
|
-
};
|
|
3492
|
+
return jsonResult({
|
|
3493
|
+
message: `Successfully created integration "${params.name}"`,
|
|
3494
|
+
id: result.id,
|
|
3495
|
+
slug: result.slug
|
|
3496
|
+
});
|
|
3807
3497
|
}
|
|
3808
3498
|
);
|
|
3809
3499
|
server.tool(
|
|
@@ -3814,31 +3504,24 @@ function registerIntegrationsTools(server, service) {
|
|
|
3814
3504
|
const integration = await service.integrations.getIntegration(
|
|
3815
3505
|
params.slug
|
|
3816
3506
|
);
|
|
3817
|
-
return {
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
pricing_adjustments: integration.pricing_adjustments,
|
|
3836
|
-
created_at: integration.created_at,
|
|
3837
|
-
last_updated_at: integration.last_updated_at
|
|
3838
|
-
})
|
|
3839
|
-
}
|
|
3840
|
-
]
|
|
3841
|
-
};
|
|
3507
|
+
return jsonResult({
|
|
3508
|
+
id: integration.id,
|
|
3509
|
+
name: integration.name,
|
|
3510
|
+
slug: integration.slug,
|
|
3511
|
+
ai_provider_id: integration.ai_provider_id,
|
|
3512
|
+
status: integration.status,
|
|
3513
|
+
description: integration.description,
|
|
3514
|
+
organisation_id: integration.organisation_id,
|
|
3515
|
+
masked_key: integration.masked_key,
|
|
3516
|
+
configurations: integration.configurations,
|
|
3517
|
+
global_workspace_access_settings: integration.global_workspace_access_settings,
|
|
3518
|
+
allow_all_models: integration.allow_all_models,
|
|
3519
|
+
workspace_count: integration.workspace_count,
|
|
3520
|
+
secret_mappings: integration.secret_mappings,
|
|
3521
|
+
pricing_adjustments: integration.pricing_adjustments,
|
|
3522
|
+
created_at: integration.created_at,
|
|
3523
|
+
last_updated_at: integration.last_updated_at
|
|
3524
|
+
});
|
|
3842
3525
|
}
|
|
3843
3526
|
);
|
|
3844
3527
|
server.tool(
|
|
@@ -3861,17 +3544,10 @@ function registerIntegrationsTools(server, service) {
|
|
|
3861
3544
|
secret_mappings: params.secret_mappings,
|
|
3862
3545
|
pricing_adjustments: params.pricing_adjustments
|
|
3863
3546
|
});
|
|
3864
|
-
return {
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
text: JSON.stringify({
|
|
3869
|
-
message: `Successfully updated integration "${params.slug}"`,
|
|
3870
|
-
success: result.success
|
|
3871
|
-
})
|
|
3872
|
-
}
|
|
3873
|
-
]
|
|
3874
|
-
};
|
|
3547
|
+
return jsonResult({
|
|
3548
|
+
message: `Successfully updated integration "${params.slug}"`,
|
|
3549
|
+
success: result.success
|
|
3550
|
+
});
|
|
3875
3551
|
}
|
|
3876
3552
|
);
|
|
3877
3553
|
server.tool(
|
|
@@ -3880,17 +3556,10 @@ function registerIntegrationsTools(server, service) {
|
|
|
3880
3556
|
INTEGRATIONS_TOOL_SCHEMAS.deleteIntegration,
|
|
3881
3557
|
async (params) => {
|
|
3882
3558
|
const result = await service.integrations.deleteIntegration(params.slug);
|
|
3883
|
-
return {
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
text: JSON.stringify({
|
|
3888
|
-
message: `Successfully deleted integration "${params.slug}"`,
|
|
3889
|
-
success: result.success
|
|
3890
|
-
})
|
|
3891
|
-
}
|
|
3892
|
-
]
|
|
3893
|
-
};
|
|
3559
|
+
return jsonResult({
|
|
3560
|
+
message: `Successfully deleted integration "${params.slug}"`,
|
|
3561
|
+
success: result.success
|
|
3562
|
+
});
|
|
3894
3563
|
}
|
|
3895
3564
|
);
|
|
3896
3565
|
server.tool(
|
|
@@ -3905,30 +3574,23 @@ function registerIntegrationsTools(server, service) {
|
|
|
3905
3574
|
page_size: params.page_size
|
|
3906
3575
|
}
|
|
3907
3576
|
);
|
|
3908
|
-
return {
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
created_at: model.created_at,
|
|
3926
|
-
last_updated_at: model.last_updated_at
|
|
3927
|
-
}))
|
|
3928
|
-
})
|
|
3929
|
-
}
|
|
3930
|
-
]
|
|
3931
|
-
};
|
|
3577
|
+
return jsonResult({
|
|
3578
|
+
total: models.total,
|
|
3579
|
+
integration_slug: params.slug,
|
|
3580
|
+
models: models.data.map((model) => ({
|
|
3581
|
+
id: model.id,
|
|
3582
|
+
slug: model.slug ?? model.model_id,
|
|
3583
|
+
name: model.name ?? model.model_name,
|
|
3584
|
+
enabled: model.enabled,
|
|
3585
|
+
is_custom: model.is_custom ?? model.custom,
|
|
3586
|
+
is_finetune: model.is_finetune,
|
|
3587
|
+
base_model_slug: model.base_model_slug,
|
|
3588
|
+
configurations: model.configurations,
|
|
3589
|
+
pricing_config: model.pricing_config,
|
|
3590
|
+
created_at: model.created_at,
|
|
3591
|
+
last_updated_at: model.last_updated_at
|
|
3592
|
+
}))
|
|
3593
|
+
});
|
|
3932
3594
|
}
|
|
3933
3595
|
);
|
|
3934
3596
|
server.tool(
|
|
@@ -3950,18 +3612,11 @@ function registerIntegrationsTools(server, service) {
|
|
|
3950
3612
|
allow_all_models: params.allow_all_models
|
|
3951
3613
|
}
|
|
3952
3614
|
);
|
|
3953
|
-
return {
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
message: `Successfully updated models for integration "${params.slug}"`,
|
|
3959
|
-
success: result.success,
|
|
3960
|
-
models_updated: params.models.length
|
|
3961
|
-
})
|
|
3962
|
-
}
|
|
3963
|
-
]
|
|
3964
|
-
};
|
|
3615
|
+
return jsonResult({
|
|
3616
|
+
message: `Successfully updated models for integration "${params.slug}"`,
|
|
3617
|
+
success: result.success,
|
|
3618
|
+
models_updated: params.models.length
|
|
3619
|
+
});
|
|
3965
3620
|
}
|
|
3966
3621
|
);
|
|
3967
3622
|
server.tool(
|
|
@@ -3973,17 +3628,10 @@ function registerIntegrationsTools(server, service) {
|
|
|
3973
3628
|
params.slug,
|
|
3974
3629
|
params.model_slug
|
|
3975
3630
|
);
|
|
3976
|
-
return {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
text: JSON.stringify({
|
|
3981
|
-
message: `Successfully deleted model "${params.model_slug}" from integration "${params.slug}"`,
|
|
3982
|
-
success: result.success
|
|
3983
|
-
})
|
|
3984
|
-
}
|
|
3985
|
-
]
|
|
3986
|
-
};
|
|
3631
|
+
return jsonResult({
|
|
3632
|
+
message: `Successfully deleted model "${params.model_slug}" from integration "${params.slug}"`,
|
|
3633
|
+
success: result.success
|
|
3634
|
+
});
|
|
3987
3635
|
}
|
|
3988
3636
|
);
|
|
3989
3637
|
server.tool(
|
|
@@ -3998,27 +3646,20 @@ function registerIntegrationsTools(server, service) {
|
|
|
3998
3646
|
page_size: params.page_size
|
|
3999
3647
|
}
|
|
4000
3648
|
);
|
|
4001
|
-
return {
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
created_at: ws.created_at,
|
|
4016
|
-
last_updated_at: ws.last_updated_at
|
|
4017
|
-
}))
|
|
4018
|
-
})
|
|
4019
|
-
}
|
|
4020
|
-
]
|
|
4021
|
-
};
|
|
3649
|
+
return jsonResult({
|
|
3650
|
+
total: workspaces.total,
|
|
3651
|
+
integration_slug: params.slug,
|
|
3652
|
+
workspaces: workspaces.data.map((ws) => ({
|
|
3653
|
+
id: ws.id,
|
|
3654
|
+
workspace_id: ws.workspace_id ?? ws.id,
|
|
3655
|
+
workspace_name: ws.workspace_name,
|
|
3656
|
+
enabled: ws.enabled,
|
|
3657
|
+
usage_limits: ws.usage_limits,
|
|
3658
|
+
rate_limits: ws.rate_limits,
|
|
3659
|
+
created_at: ws.created_at,
|
|
3660
|
+
last_updated_at: ws.last_updated_at
|
|
3661
|
+
}))
|
|
3662
|
+
});
|
|
4022
3663
|
}
|
|
4023
3664
|
);
|
|
4024
3665
|
server.tool(
|
|
@@ -4082,18 +3723,11 @@ function registerIntegrationsTools(server, service) {
|
|
|
4082
3723
|
default_provider_slug: params.default_provider_slug
|
|
4083
3724
|
}
|
|
4084
3725
|
);
|
|
4085
|
-
return {
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
message: `Successfully updated workspace access for integration "${params.slug}"`,
|
|
4091
|
-
success: result.success,
|
|
4092
|
-
workspaces_updated: params.workspaces.length
|
|
4093
|
-
})
|
|
4094
|
-
}
|
|
4095
|
-
]
|
|
4096
|
-
};
|
|
3726
|
+
return jsonResult({
|
|
3727
|
+
message: `Successfully updated workspace access for integration "${params.slug}"`,
|
|
3728
|
+
success: result.success,
|
|
3729
|
+
workspaces_updated: params.workspaces.length
|
|
3730
|
+
});
|
|
4097
3731
|
}
|
|
4098
3732
|
);
|
|
4099
3733
|
}
|
|
@@ -4208,6 +3842,76 @@ var createApiKeySchema = z9.object(KEYS_TOOL_SCHEMAS.createApiKey).superRefine((
|
|
|
4208
3842
|
});
|
|
4209
3843
|
}
|
|
4210
3844
|
});
|
|
3845
|
+
function formatKeyUsageLimits(limits) {
|
|
3846
|
+
return limits ? {
|
|
3847
|
+
credit_limit: limits.credit_limit,
|
|
3848
|
+
alert_threshold: limits.alert_threshold,
|
|
3849
|
+
periodic_reset: limits.periodic_reset
|
|
3850
|
+
} : null;
|
|
3851
|
+
}
|
|
3852
|
+
function formatKeyRateLimits(limits) {
|
|
3853
|
+
return limits?.map((limit) => ({
|
|
3854
|
+
type: limit.type,
|
|
3855
|
+
unit: limit.unit,
|
|
3856
|
+
value: limit.value
|
|
3857
|
+
})) ?? null;
|
|
3858
|
+
}
|
|
3859
|
+
function formatVirtualKey(key) {
|
|
3860
|
+
return {
|
|
3861
|
+
name: key.name,
|
|
3862
|
+
slug: key.slug,
|
|
3863
|
+
status: key.status,
|
|
3864
|
+
note: key.note,
|
|
3865
|
+
usage_limits: formatKeyUsageLimits(key.usage_limits),
|
|
3866
|
+
rate_limits: formatKeyRateLimits(key.rate_limits),
|
|
3867
|
+
reset_usage: key.reset_usage,
|
|
3868
|
+
created_at: key.created_at,
|
|
3869
|
+
model_config: key.model_config
|
|
3870
|
+
};
|
|
3871
|
+
}
|
|
3872
|
+
function formatApiKeySummary(apiKey) {
|
|
3873
|
+
return {
|
|
3874
|
+
id: apiKey.id,
|
|
3875
|
+
name: apiKey.name,
|
|
3876
|
+
description: apiKey.description,
|
|
3877
|
+
type: apiKey.type,
|
|
3878
|
+
status: apiKey.status,
|
|
3879
|
+
organisation_id: apiKey.organisation_id,
|
|
3880
|
+
workspace_id: apiKey.workspace_id,
|
|
3881
|
+
user_id: apiKey.user_id,
|
|
3882
|
+
scopes: apiKey.scopes,
|
|
3883
|
+
usage_limits: formatKeyUsageLimits(apiKey.usage_limits),
|
|
3884
|
+
rate_limits: formatKeyRateLimits(apiKey.rate_limits),
|
|
3885
|
+
defaults: apiKey.defaults,
|
|
3886
|
+
alert_emails: apiKey.alert_emails,
|
|
3887
|
+
expires_at: apiKey.expires_at,
|
|
3888
|
+
created_at: apiKey.created_at,
|
|
3889
|
+
last_updated_at: apiKey.last_updated_at,
|
|
3890
|
+
creation_mode: apiKey.creation_mode
|
|
3891
|
+
};
|
|
3892
|
+
}
|
|
3893
|
+
function formatApiKey(apiKey) {
|
|
3894
|
+
return {
|
|
3895
|
+
id: apiKey.id,
|
|
3896
|
+
name: apiKey.name,
|
|
3897
|
+
description: apiKey.description,
|
|
3898
|
+
type: apiKey.type,
|
|
3899
|
+
status: apiKey.status,
|
|
3900
|
+
organisation_id: apiKey.organisation_id,
|
|
3901
|
+
workspace_id: apiKey.workspace_id,
|
|
3902
|
+
user_id: apiKey.user_id,
|
|
3903
|
+
scopes: apiKey.scopes,
|
|
3904
|
+
usage_limits: formatKeyUsageLimits(apiKey.usage_limits),
|
|
3905
|
+
rate_limits: formatKeyRateLimits(apiKey.rate_limits),
|
|
3906
|
+
defaults: apiKey.defaults,
|
|
3907
|
+
alert_emails: apiKey.alert_emails,
|
|
3908
|
+
expires_at: apiKey.expires_at,
|
|
3909
|
+
reset_usage: apiKey.reset_usage,
|
|
3910
|
+
created_at: apiKey.created_at,
|
|
3911
|
+
last_updated_at: apiKey.last_updated_at,
|
|
3912
|
+
creation_mode: apiKey.creation_mode
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
4211
3915
|
function registerKeysTools(server, service) {
|
|
4212
3916
|
server.tool(
|
|
4213
3917
|
"list_virtual_keys",
|
|
@@ -4218,35 +3922,10 @@ function registerKeysTools(server, service) {
|
|
|
4218
3922
|
current_page: params.current_page,
|
|
4219
3923
|
page_size: params.page_size
|
|
4220
3924
|
});
|
|
4221
|
-
return {
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
text: JSON.stringify({
|
|
4226
|
-
total: virtualKeys.total,
|
|
4227
|
-
virtual_keys: virtualKeys.data.map((key) => ({
|
|
4228
|
-
name: key.name,
|
|
4229
|
-
slug: key.slug,
|
|
4230
|
-
status: key.status,
|
|
4231
|
-
note: key.note,
|
|
4232
|
-
usage_limits: key.usage_limits ? {
|
|
4233
|
-
credit_limit: key.usage_limits.credit_limit,
|
|
4234
|
-
alert_threshold: key.usage_limits.alert_threshold,
|
|
4235
|
-
periodic_reset: key.usage_limits.periodic_reset
|
|
4236
|
-
} : null,
|
|
4237
|
-
rate_limits: key.rate_limits?.map((limit) => ({
|
|
4238
|
-
type: limit.type,
|
|
4239
|
-
unit: limit.unit,
|
|
4240
|
-
value: limit.value
|
|
4241
|
-
})) ?? null,
|
|
4242
|
-
reset_usage: key.reset_usage,
|
|
4243
|
-
created_at: key.created_at,
|
|
4244
|
-
model_config: key.model_config
|
|
4245
|
-
}))
|
|
4246
|
-
})
|
|
4247
|
-
}
|
|
4248
|
-
]
|
|
4249
|
-
};
|
|
3925
|
+
return jsonResult({
|
|
3926
|
+
total: virtualKeys.total,
|
|
3927
|
+
virtual_keys: virtualKeys.data.map(formatVirtualKey)
|
|
3928
|
+
});
|
|
4250
3929
|
}
|
|
4251
3930
|
);
|
|
4252
3931
|
server.tool(
|
|
@@ -4270,18 +3949,11 @@ function registerKeysTools(server, service) {
|
|
|
4270
3949
|
rate_limits: buildRateLimitsRpm(params.rate_limit_rpm)
|
|
4271
3950
|
});
|
|
4272
3951
|
const slug = result.data?.slug ?? result.slug;
|
|
4273
|
-
return {
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
message: `Successfully created virtual key "${params.name}"`,
|
|
4279
|
-
success: result.success,
|
|
4280
|
-
slug
|
|
4281
|
-
})
|
|
4282
|
-
}
|
|
4283
|
-
]
|
|
4284
|
-
};
|
|
3952
|
+
return jsonResult({
|
|
3953
|
+
message: `Successfully created virtual key "${params.name}"`,
|
|
3954
|
+
success: result.success,
|
|
3955
|
+
slug
|
|
3956
|
+
});
|
|
4285
3957
|
}
|
|
4286
3958
|
);
|
|
4287
3959
|
server.tool(
|
|
@@ -4290,32 +3962,7 @@ function registerKeysTools(server, service) {
|
|
|
4290
3962
|
KEYS_TOOL_SCHEMAS.getVirtualKey,
|
|
4291
3963
|
async (params) => {
|
|
4292
3964
|
const virtualKey = await service.keys.getVirtualKey(params.slug);
|
|
4293
|
-
return
|
|
4294
|
-
content: [
|
|
4295
|
-
{
|
|
4296
|
-
type: "text",
|
|
4297
|
-
text: JSON.stringify({
|
|
4298
|
-
name: virtualKey.name,
|
|
4299
|
-
slug: virtualKey.slug,
|
|
4300
|
-
status: virtualKey.status,
|
|
4301
|
-
note: virtualKey.note,
|
|
4302
|
-
usage_limits: virtualKey.usage_limits ? {
|
|
4303
|
-
credit_limit: virtualKey.usage_limits.credit_limit,
|
|
4304
|
-
alert_threshold: virtualKey.usage_limits.alert_threshold,
|
|
4305
|
-
periodic_reset: virtualKey.usage_limits.periodic_reset
|
|
4306
|
-
} : null,
|
|
4307
|
-
rate_limits: virtualKey.rate_limits?.map((limit) => ({
|
|
4308
|
-
type: limit.type,
|
|
4309
|
-
unit: limit.unit,
|
|
4310
|
-
value: limit.value
|
|
4311
|
-
})) ?? null,
|
|
4312
|
-
reset_usage: virtualKey.reset_usage,
|
|
4313
|
-
created_at: virtualKey.created_at,
|
|
4314
|
-
model_config: virtualKey.model_config
|
|
4315
|
-
})
|
|
4316
|
-
}
|
|
4317
|
-
]
|
|
4318
|
-
};
|
|
3965
|
+
return jsonResult(formatVirtualKey(virtualKey));
|
|
4319
3966
|
}
|
|
4320
3967
|
);
|
|
4321
3968
|
server.tool(
|
|
@@ -4333,19 +3980,12 @@ function registerKeysTools(server, service) {
|
|
|
4333
3980
|
}),
|
|
4334
3981
|
rate_limits: buildRateLimitsRpm(params.rate_limit_rpm)
|
|
4335
3982
|
});
|
|
4336
|
-
return {
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
name: result.name,
|
|
4343
|
-
slug: result.slug,
|
|
4344
|
-
status: result.status
|
|
4345
|
-
})
|
|
4346
|
-
}
|
|
4347
|
-
]
|
|
4348
|
-
};
|
|
3983
|
+
return jsonResult({
|
|
3984
|
+
message: `Successfully updated virtual key "${params.slug}"`,
|
|
3985
|
+
name: result.name,
|
|
3986
|
+
slug: result.slug,
|
|
3987
|
+
status: result.status
|
|
3988
|
+
});
|
|
4349
3989
|
}
|
|
4350
3990
|
);
|
|
4351
3991
|
server.tool(
|
|
@@ -4354,17 +3994,10 @@ function registerKeysTools(server, service) {
|
|
|
4354
3994
|
KEYS_TOOL_SCHEMAS.deleteVirtualKey,
|
|
4355
3995
|
async (params) => {
|
|
4356
3996
|
const result = await service.keys.deleteVirtualKey(params.slug);
|
|
4357
|
-
return {
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
text: JSON.stringify({
|
|
4362
|
-
message: `Successfully deleted virtual key "${params.slug}"`,
|
|
4363
|
-
success: result.success
|
|
4364
|
-
})
|
|
4365
|
-
}
|
|
4366
|
-
]
|
|
4367
|
-
};
|
|
3997
|
+
return jsonResult({
|
|
3998
|
+
message: `Successfully deleted virtual key "${params.slug}"`,
|
|
3999
|
+
success: result.success
|
|
4000
|
+
});
|
|
4368
4001
|
}
|
|
4369
4002
|
);
|
|
4370
4003
|
server.tool(
|
|
@@ -4399,18 +4032,11 @@ function registerKeysTools(server, service) {
|
|
|
4399
4032
|
expires_at: validated.expires_at
|
|
4400
4033
|
}
|
|
4401
4034
|
);
|
|
4402
|
-
return {
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
message: `Successfully created API key "${validated.name}"`,
|
|
4408
|
-
id: result.id,
|
|
4409
|
-
key: result.key
|
|
4410
|
-
})
|
|
4411
|
-
}
|
|
4412
|
-
]
|
|
4413
|
-
};
|
|
4035
|
+
return jsonResult({
|
|
4036
|
+
message: `Successfully created API key "${validated.name}"`,
|
|
4037
|
+
id: result.id,
|
|
4038
|
+
key: result.key
|
|
4039
|
+
});
|
|
4414
4040
|
}
|
|
4415
4041
|
);
|
|
4416
4042
|
server.tool(
|
|
@@ -4423,43 +4049,10 @@ function registerKeysTools(server, service) {
|
|
|
4423
4049
|
current_page: params.current_page,
|
|
4424
4050
|
workspace_id: params.workspace_id
|
|
4425
4051
|
});
|
|
4426
|
-
return {
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
text: JSON.stringify({
|
|
4431
|
-
total: apiKeys.total,
|
|
4432
|
-
api_keys: apiKeys.data.map((key) => ({
|
|
4433
|
-
id: key.id,
|
|
4434
|
-
name: key.name,
|
|
4435
|
-
description: key.description,
|
|
4436
|
-
type: key.type,
|
|
4437
|
-
status: key.status,
|
|
4438
|
-
organisation_id: key.organisation_id,
|
|
4439
|
-
workspace_id: key.workspace_id,
|
|
4440
|
-
user_id: key.user_id,
|
|
4441
|
-
scopes: key.scopes,
|
|
4442
|
-
usage_limits: key.usage_limits ? {
|
|
4443
|
-
credit_limit: key.usage_limits.credit_limit,
|
|
4444
|
-
alert_threshold: key.usage_limits.alert_threshold,
|
|
4445
|
-
periodic_reset: key.usage_limits.periodic_reset
|
|
4446
|
-
} : null,
|
|
4447
|
-
rate_limits: key.rate_limits?.map((limit) => ({
|
|
4448
|
-
type: limit.type,
|
|
4449
|
-
unit: limit.unit,
|
|
4450
|
-
value: limit.value
|
|
4451
|
-
})) ?? null,
|
|
4452
|
-
defaults: key.defaults,
|
|
4453
|
-
alert_emails: key.alert_emails,
|
|
4454
|
-
expires_at: key.expires_at,
|
|
4455
|
-
created_at: key.created_at,
|
|
4456
|
-
last_updated_at: key.last_updated_at,
|
|
4457
|
-
creation_mode: key.creation_mode
|
|
4458
|
-
}))
|
|
4459
|
-
})
|
|
4460
|
-
}
|
|
4461
|
-
]
|
|
4462
|
-
};
|
|
4052
|
+
return jsonResult({
|
|
4053
|
+
total: apiKeys.total,
|
|
4054
|
+
api_keys: apiKeys.data.map(formatApiKeySummary)
|
|
4055
|
+
});
|
|
4463
4056
|
}
|
|
4464
4057
|
);
|
|
4465
4058
|
server.tool(
|
|
@@ -4468,41 +4061,7 @@ function registerKeysTools(server, service) {
|
|
|
4468
4061
|
KEYS_TOOL_SCHEMAS.getApiKey,
|
|
4469
4062
|
async (params) => {
|
|
4470
4063
|
const apiKey = await service.keys.getApiKey(params.id);
|
|
4471
|
-
return
|
|
4472
|
-
content: [
|
|
4473
|
-
{
|
|
4474
|
-
type: "text",
|
|
4475
|
-
text: JSON.stringify({
|
|
4476
|
-
id: apiKey.id,
|
|
4477
|
-
name: apiKey.name,
|
|
4478
|
-
description: apiKey.description,
|
|
4479
|
-
type: apiKey.type,
|
|
4480
|
-
status: apiKey.status,
|
|
4481
|
-
organisation_id: apiKey.organisation_id,
|
|
4482
|
-
workspace_id: apiKey.workspace_id,
|
|
4483
|
-
user_id: apiKey.user_id,
|
|
4484
|
-
scopes: apiKey.scopes,
|
|
4485
|
-
usage_limits: apiKey.usage_limits ? {
|
|
4486
|
-
credit_limit: apiKey.usage_limits.credit_limit,
|
|
4487
|
-
alert_threshold: apiKey.usage_limits.alert_threshold,
|
|
4488
|
-
periodic_reset: apiKey.usage_limits.periodic_reset
|
|
4489
|
-
} : null,
|
|
4490
|
-
rate_limits: apiKey.rate_limits?.map((limit) => ({
|
|
4491
|
-
type: limit.type,
|
|
4492
|
-
unit: limit.unit,
|
|
4493
|
-
value: limit.value
|
|
4494
|
-
})) ?? null,
|
|
4495
|
-
defaults: apiKey.defaults,
|
|
4496
|
-
alert_emails: apiKey.alert_emails,
|
|
4497
|
-
expires_at: apiKey.expires_at,
|
|
4498
|
-
reset_usage: apiKey.reset_usage,
|
|
4499
|
-
created_at: apiKey.created_at,
|
|
4500
|
-
last_updated_at: apiKey.last_updated_at,
|
|
4501
|
-
creation_mode: apiKey.creation_mode
|
|
4502
|
-
})
|
|
4503
|
-
}
|
|
4504
|
-
]
|
|
4505
|
-
};
|
|
4064
|
+
return jsonResult(formatApiKey(apiKey));
|
|
4506
4065
|
}
|
|
4507
4066
|
);
|
|
4508
4067
|
server.tool(
|
|
@@ -4526,17 +4085,10 @@ function registerKeysTools(server, service) {
|
|
|
4526
4085
|
alert_emails: params.alert_emails,
|
|
4527
4086
|
expires_at: params.expires_at
|
|
4528
4087
|
});
|
|
4529
|
-
return {
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
text: JSON.stringify({
|
|
4534
|
-
message: `Successfully updated API key "${params.id}"`,
|
|
4535
|
-
success: result.success
|
|
4536
|
-
})
|
|
4537
|
-
}
|
|
4538
|
-
]
|
|
4539
|
-
};
|
|
4088
|
+
return jsonResult({
|
|
4089
|
+
message: `Successfully updated API key "${params.id}"`,
|
|
4090
|
+
success: result.success
|
|
4091
|
+
});
|
|
4540
4092
|
}
|
|
4541
4093
|
);
|
|
4542
4094
|
server.tool(
|
|
@@ -4545,17 +4097,10 @@ function registerKeysTools(server, service) {
|
|
|
4545
4097
|
KEYS_TOOL_SCHEMAS.deleteApiKey,
|
|
4546
4098
|
async (params) => {
|
|
4547
4099
|
const result = await service.keys.deleteApiKey(params.id);
|
|
4548
|
-
return {
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
text: JSON.stringify({
|
|
4553
|
-
message: `Successfully deleted API key "${params.id}"`,
|
|
4554
|
-
success: result.success
|
|
4555
|
-
})
|
|
4556
|
-
}
|
|
4557
|
-
]
|
|
4558
|
-
};
|
|
4100
|
+
return jsonResult({
|
|
4101
|
+
message: `Successfully deleted API key "${params.id}"`,
|
|
4102
|
+
success: result.success
|
|
4103
|
+
});
|
|
4559
4104
|
}
|
|
4560
4105
|
);
|
|
4561
4106
|
server.tool(
|
|
@@ -4573,20 +4118,13 @@ function registerKeysTools(server, service) {
|
|
|
4573
4118
|
const result = await service.keys.rotateApiKey(params.id, {
|
|
4574
4119
|
key_transition_period_ms: params.key_transition_period_ms
|
|
4575
4120
|
});
|
|
4576
|
-
return {
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
id: result.id,
|
|
4584
|
-
key: result.key,
|
|
4585
|
-
key_transition_expires_at: result.key_transition_expires_at
|
|
4586
|
-
})
|
|
4587
|
-
}
|
|
4588
|
-
]
|
|
4589
|
-
};
|
|
4121
|
+
return jsonResult({
|
|
4122
|
+
message: `Successfully rotated API key "${result.id}"`,
|
|
4123
|
+
warning: "Copy this new key now; it is returned only once. Replace callers before key_transition_expires_at and never log either key.",
|
|
4124
|
+
id: result.id,
|
|
4125
|
+
key: result.key,
|
|
4126
|
+
key_transition_expires_at: result.key_transition_expires_at
|
|
4127
|
+
});
|
|
4590
4128
|
}
|
|
4591
4129
|
);
|
|
4592
4130
|
}
|
|
@@ -4649,17 +4187,10 @@ function registerLabelsTools(server, service) {
|
|
|
4649
4187
|
description: params.description,
|
|
4650
4188
|
color_code: params.color_code
|
|
4651
4189
|
});
|
|
4652
|
-
return {
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
text: JSON.stringify({
|
|
4657
|
-
message: `Successfully created label "${params.name}"`,
|
|
4658
|
-
id: result.id
|
|
4659
|
-
})
|
|
4660
|
-
}
|
|
4661
|
-
]
|
|
4662
|
-
};
|
|
4190
|
+
return jsonResult({
|
|
4191
|
+
message: `Successfully created label "${params.name}"`,
|
|
4192
|
+
id: result.id
|
|
4193
|
+
});
|
|
4663
4194
|
}
|
|
4664
4195
|
);
|
|
4665
4196
|
server.tool(
|
|
@@ -4668,26 +4199,19 @@ function registerLabelsTools(server, service) {
|
|
|
4668
4199
|
LABELS_TOOL_SCHEMAS.listPromptLabels,
|
|
4669
4200
|
async (params) => {
|
|
4670
4201
|
const result = await service.labels.listLabels(params);
|
|
4671
|
-
return {
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
created_at: label.created_at,
|
|
4685
|
-
last_updated_at: label.last_updated_at
|
|
4686
|
-
}))
|
|
4687
|
-
})
|
|
4688
|
-
}
|
|
4689
|
-
]
|
|
4690
|
-
};
|
|
4202
|
+
return jsonResult({
|
|
4203
|
+
total: result.total,
|
|
4204
|
+
labels: result.data.map((label) => ({
|
|
4205
|
+
id: label.id,
|
|
4206
|
+
name: label.name,
|
|
4207
|
+
description: label.description,
|
|
4208
|
+
color_code: label.color_code,
|
|
4209
|
+
is_universal: label.is_universal,
|
|
4210
|
+
status: label.status,
|
|
4211
|
+
created_at: label.created_at,
|
|
4212
|
+
last_updated_at: label.last_updated_at
|
|
4213
|
+
}))
|
|
4214
|
+
});
|
|
4691
4215
|
}
|
|
4692
4216
|
);
|
|
4693
4217
|
server.tool(
|
|
@@ -4699,25 +4223,18 @@ function registerLabelsTools(server, service) {
|
|
|
4699
4223
|
organisation_id: params.organisation_id,
|
|
4700
4224
|
workspace_id: params.workspace_id
|
|
4701
4225
|
});
|
|
4702
|
-
return {
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
status: label.status,
|
|
4715
|
-
created_at: label.created_at,
|
|
4716
|
-
last_updated_at: label.last_updated_at
|
|
4717
|
-
})
|
|
4718
|
-
}
|
|
4719
|
-
]
|
|
4720
|
-
};
|
|
4226
|
+
return jsonResult({
|
|
4227
|
+
id: label.id,
|
|
4228
|
+
name: label.name,
|
|
4229
|
+
description: label.description,
|
|
4230
|
+
color_code: label.color_code,
|
|
4231
|
+
organisation_id: label.organisation_id,
|
|
4232
|
+
workspace_id: label.workspace_id,
|
|
4233
|
+
is_universal: label.is_universal,
|
|
4234
|
+
status: label.status,
|
|
4235
|
+
created_at: label.created_at,
|
|
4236
|
+
last_updated_at: label.last_updated_at
|
|
4237
|
+
});
|
|
4721
4238
|
}
|
|
4722
4239
|
);
|
|
4723
4240
|
server.tool(
|
|
@@ -4727,17 +4244,10 @@ function registerLabelsTools(server, service) {
|
|
|
4727
4244
|
async (params) => {
|
|
4728
4245
|
const { label_id, ...updateData } = params;
|
|
4729
4246
|
await service.labels.updateLabel(label_id, updateData);
|
|
4730
|
-
return {
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
text: JSON.stringify({
|
|
4735
|
-
message: `Successfully updated label "${label_id}"`,
|
|
4736
|
-
success: true
|
|
4737
|
-
})
|
|
4738
|
-
}
|
|
4739
|
-
]
|
|
4740
|
-
};
|
|
4247
|
+
return jsonResult({
|
|
4248
|
+
message: `Successfully updated label "${label_id}"`,
|
|
4249
|
+
success: true
|
|
4250
|
+
});
|
|
4741
4251
|
}
|
|
4742
4252
|
);
|
|
4743
4253
|
server.tool(
|
|
@@ -4746,17 +4256,10 @@ function registerLabelsTools(server, service) {
|
|
|
4746
4256
|
LABELS_TOOL_SCHEMAS.deletePromptLabel,
|
|
4747
4257
|
async (params) => {
|
|
4748
4258
|
await service.labels.deleteLabel(params.label_id);
|
|
4749
|
-
return {
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
text: JSON.stringify({
|
|
4754
|
-
message: `Successfully deleted label "${params.label_id}"`,
|
|
4755
|
-
success: true
|
|
4756
|
-
})
|
|
4757
|
-
}
|
|
4758
|
-
]
|
|
4759
|
-
};
|
|
4259
|
+
return jsonResult({
|
|
4260
|
+
message: `Successfully deleted label "${params.label_id}"`,
|
|
4261
|
+
success: true
|
|
4262
|
+
});
|
|
4760
4263
|
}
|
|
4761
4264
|
);
|
|
4762
4265
|
}
|
|
@@ -4894,17 +4397,10 @@ function registerLimitsTools(server, service) {
|
|
|
4894
4397
|
LIMITS_TOOL_SCHEMAS.listRateLimits,
|
|
4895
4398
|
async (params) => {
|
|
4896
4399
|
const result = await service.limits.listRateLimits(params.workspace_id);
|
|
4897
|
-
return {
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
text: JSON.stringify({
|
|
4902
|
-
total: result.total,
|
|
4903
|
-
rate_limits: result.data.map(formatRateLimit)
|
|
4904
|
-
})
|
|
4905
|
-
}
|
|
4906
|
-
]
|
|
4907
|
-
};
|
|
4400
|
+
return jsonResult({
|
|
4401
|
+
total: result.total,
|
|
4402
|
+
rate_limits: result.data.map(formatRateLimit)
|
|
4403
|
+
});
|
|
4908
4404
|
}
|
|
4909
4405
|
);
|
|
4910
4406
|
server.tool(
|
|
@@ -4913,14 +4409,7 @@ function registerLimitsTools(server, service) {
|
|
|
4913
4409
|
LIMITS_TOOL_SCHEMAS.getRateLimit,
|
|
4914
4410
|
async (params) => {
|
|
4915
4411
|
const result = await service.limits.getRateLimit(params.id);
|
|
4916
|
-
return
|
|
4917
|
-
content: [
|
|
4918
|
-
{
|
|
4919
|
-
type: "text",
|
|
4920
|
-
text: JSON.stringify(formatRateLimit(result))
|
|
4921
|
-
}
|
|
4922
|
-
]
|
|
4923
|
-
};
|
|
4412
|
+
return jsonResult(formatRateLimit(result));
|
|
4924
4413
|
}
|
|
4925
4414
|
);
|
|
4926
4415
|
server.tool(
|
|
@@ -4938,17 +4427,10 @@ function registerLimitsTools(server, service) {
|
|
|
4938
4427
|
workspace_id: params.workspace_id,
|
|
4939
4428
|
organisation_id: params.organisation_id
|
|
4940
4429
|
});
|
|
4941
|
-
return {
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
text: JSON.stringify({
|
|
4946
|
-
message: `Successfully created rate limit${params.name ? ` "${params.name}"` : ""}`,
|
|
4947
|
-
rate_limit: formatRateLimit(result)
|
|
4948
|
-
})
|
|
4949
|
-
}
|
|
4950
|
-
]
|
|
4951
|
-
};
|
|
4430
|
+
return jsonResult({
|
|
4431
|
+
message: `Successfully created rate limit${params.name ? ` "${params.name}"` : ""}`,
|
|
4432
|
+
rate_limit: formatRateLimit(result)
|
|
4433
|
+
});
|
|
4952
4434
|
}
|
|
4953
4435
|
);
|
|
4954
4436
|
server.tool(
|
|
@@ -4961,17 +4443,10 @@ function registerLimitsTools(server, service) {
|
|
|
4961
4443
|
unit: params.unit,
|
|
4962
4444
|
value: params.value
|
|
4963
4445
|
});
|
|
4964
|
-
return {
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
text: JSON.stringify({
|
|
4969
|
-
message: `Successfully updated rate limit "${params.id}"`,
|
|
4970
|
-
rate_limit: formatRateLimit(result)
|
|
4971
|
-
})
|
|
4972
|
-
}
|
|
4973
|
-
]
|
|
4974
|
-
};
|
|
4446
|
+
return jsonResult({
|
|
4447
|
+
message: `Successfully updated rate limit "${params.id}"`,
|
|
4448
|
+
rate_limit: formatRateLimit(result)
|
|
4449
|
+
});
|
|
4975
4450
|
}
|
|
4976
4451
|
);
|
|
4977
4452
|
server.tool(
|
|
@@ -4980,17 +4455,10 @@ function registerLimitsTools(server, service) {
|
|
|
4980
4455
|
LIMITS_TOOL_SCHEMAS.deleteRateLimit,
|
|
4981
4456
|
async (params) => {
|
|
4982
4457
|
await service.limits.deleteRateLimit(params.id);
|
|
4983
|
-
return {
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
text: JSON.stringify({
|
|
4988
|
-
message: `Successfully deleted rate limit "${params.id}"`,
|
|
4989
|
-
success: true
|
|
4990
|
-
})
|
|
4991
|
-
}
|
|
4992
|
-
]
|
|
4993
|
-
};
|
|
4458
|
+
return jsonResult({
|
|
4459
|
+
message: `Successfully deleted rate limit "${params.id}"`,
|
|
4460
|
+
success: true
|
|
4461
|
+
});
|
|
4994
4462
|
}
|
|
4995
4463
|
);
|
|
4996
4464
|
server.tool(
|
|
@@ -4999,17 +4467,10 @@ function registerLimitsTools(server, service) {
|
|
|
4999
4467
|
LIMITS_TOOL_SCHEMAS.listUsageLimits,
|
|
5000
4468
|
async (params) => {
|
|
5001
4469
|
const result = await service.limits.listUsageLimits(params.workspace_id);
|
|
5002
|
-
return {
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
text: JSON.stringify({
|
|
5007
|
-
total: result.total,
|
|
5008
|
-
usage_limits: result.data.map(formatUsageLimit)
|
|
5009
|
-
})
|
|
5010
|
-
}
|
|
5011
|
-
]
|
|
5012
|
-
};
|
|
4470
|
+
return jsonResult({
|
|
4471
|
+
total: result.total,
|
|
4472
|
+
usage_limits: result.data.map(formatUsageLimit)
|
|
4473
|
+
});
|
|
5013
4474
|
}
|
|
5014
4475
|
);
|
|
5015
4476
|
server.tool(
|
|
@@ -5018,14 +4479,7 @@ function registerLimitsTools(server, service) {
|
|
|
5018
4479
|
LIMITS_TOOL_SCHEMAS.getUsageLimit,
|
|
5019
4480
|
async (params) => {
|
|
5020
4481
|
const result = await service.limits.getUsageLimit(params.id);
|
|
5021
|
-
return
|
|
5022
|
-
content: [
|
|
5023
|
-
{
|
|
5024
|
-
type: "text",
|
|
5025
|
-
text: JSON.stringify(formatUsageLimit(result))
|
|
5026
|
-
}
|
|
5027
|
-
]
|
|
5028
|
-
};
|
|
4482
|
+
return jsonResult(formatUsageLimit(result));
|
|
5029
4483
|
}
|
|
5030
4484
|
);
|
|
5031
4485
|
server.tool(
|
|
@@ -5044,17 +4498,10 @@ function registerLimitsTools(server, service) {
|
|
|
5044
4498
|
workspace_id: params.workspace_id,
|
|
5045
4499
|
organisation_id: params.organisation_id
|
|
5046
4500
|
});
|
|
5047
|
-
return {
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
text: JSON.stringify({
|
|
5052
|
-
message: `Successfully created usage limit${params.name ? ` "${params.name}"` : ""}`,
|
|
5053
|
-
usage_limit: formatUsageLimit(result)
|
|
5054
|
-
})
|
|
5055
|
-
}
|
|
5056
|
-
]
|
|
5057
|
-
};
|
|
4501
|
+
return jsonResult({
|
|
4502
|
+
message: `Successfully created usage limit${params.name ? ` "${params.name}"` : ""}`,
|
|
4503
|
+
usage_limit: formatUsageLimit(result)
|
|
4504
|
+
});
|
|
5058
4505
|
}
|
|
5059
4506
|
);
|
|
5060
4507
|
server.tool(
|
|
@@ -5069,17 +4516,10 @@ function registerLimitsTools(server, service) {
|
|
|
5069
4516
|
periodic_reset: params.periodic_reset,
|
|
5070
4517
|
reset_usage_for_value: params.reset_usage_for_value
|
|
5071
4518
|
});
|
|
5072
|
-
return {
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
text: JSON.stringify({
|
|
5077
|
-
message: `Successfully updated usage limit "${params.id}"`,
|
|
5078
|
-
usage_limit: formatUsageLimit(result)
|
|
5079
|
-
})
|
|
5080
|
-
}
|
|
5081
|
-
]
|
|
5082
|
-
};
|
|
4519
|
+
return jsonResult({
|
|
4520
|
+
message: `Successfully updated usage limit "${params.id}"`,
|
|
4521
|
+
usage_limit: formatUsageLimit(result)
|
|
4522
|
+
});
|
|
5083
4523
|
}
|
|
5084
4524
|
);
|
|
5085
4525
|
server.tool(
|
|
@@ -5088,17 +4528,10 @@ function registerLimitsTools(server, service) {
|
|
|
5088
4528
|
LIMITS_TOOL_SCHEMAS.deleteUsageLimit,
|
|
5089
4529
|
async (params) => {
|
|
5090
4530
|
await service.limits.deleteUsageLimit(params.id);
|
|
5091
|
-
return {
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
text: JSON.stringify({
|
|
5096
|
-
message: `Successfully deleted usage limit "${params.id}"`,
|
|
5097
|
-
success: true
|
|
5098
|
-
})
|
|
5099
|
-
}
|
|
5100
|
-
]
|
|
5101
|
-
};
|
|
4531
|
+
return jsonResult({
|
|
4532
|
+
message: `Successfully deleted usage limit "${params.id}"`,
|
|
4533
|
+
success: true
|
|
4534
|
+
});
|
|
5102
4535
|
}
|
|
5103
4536
|
);
|
|
5104
4537
|
server.tool(
|
|
@@ -5109,17 +4542,10 @@ function registerLimitsTools(server, service) {
|
|
|
5109
4542
|
const result = await service.limits.listUsageLimitEntities(
|
|
5110
4543
|
params.limit_id
|
|
5111
4544
|
);
|
|
5112
|
-
return {
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
text: JSON.stringify({
|
|
5117
|
-
total: result.total,
|
|
5118
|
-
entities: result.data.map(formatUsageLimitEntity)
|
|
5119
|
-
})
|
|
5120
|
-
}
|
|
5121
|
-
]
|
|
5122
|
-
};
|
|
4545
|
+
return jsonResult({
|
|
4546
|
+
total: result.total,
|
|
4547
|
+
entities: result.data.map(formatUsageLimitEntity)
|
|
4548
|
+
});
|
|
5123
4549
|
}
|
|
5124
4550
|
);
|
|
5125
4551
|
server.tool(
|
|
@@ -5131,17 +4557,10 @@ function registerLimitsTools(server, service) {
|
|
|
5131
4557
|
params.limit_id,
|
|
5132
4558
|
params.entity_id
|
|
5133
4559
|
);
|
|
5134
|
-
return {
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
text: JSON.stringify({
|
|
5139
|
-
message: `Successfully reset usage for entity "${params.entity_id}" on limit "${params.limit_id}"`,
|
|
5140
|
-
success: true
|
|
5141
|
-
})
|
|
5142
|
-
}
|
|
5143
|
-
]
|
|
5144
|
-
};
|
|
4560
|
+
return jsonResult({
|
|
4561
|
+
message: `Successfully reset usage for entity "${params.entity_id}" on limit "${params.limit_id}"`,
|
|
4562
|
+
success: true
|
|
4563
|
+
});
|
|
5145
4564
|
}
|
|
5146
4565
|
);
|
|
5147
4566
|
}
|
|
@@ -5271,9 +4690,7 @@ function registerLoggingTools(server, service) {
|
|
|
5271
4690
|
created_at: params.created_at,
|
|
5272
4691
|
type: params.type
|
|
5273
4692
|
});
|
|
5274
|
-
return
|
|
5275
|
-
content: [{ type: "text", text: JSON.stringify(result) }]
|
|
5276
|
-
};
|
|
4693
|
+
return jsonResult(result);
|
|
5277
4694
|
}
|
|
5278
4695
|
);
|
|
5279
4696
|
server.tool(
|
|
@@ -5291,9 +4708,7 @@ function registerLoggingTools(server, service) {
|
|
|
5291
4708
|
const result = await service.logging.getLogExportFieldRestrictions({
|
|
5292
4709
|
workspace_id: params.workspace_id
|
|
5293
4710
|
});
|
|
5294
|
-
return
|
|
5295
|
-
content: [{ type: "text", text: JSON.stringify(result) }]
|
|
5296
|
-
};
|
|
4711
|
+
return jsonResult(result);
|
|
5297
4712
|
}
|
|
5298
4713
|
);
|
|
5299
4714
|
server.tool(
|
|
@@ -5327,17 +4742,10 @@ function registerLoggingTools(server, service) {
|
|
|
5327
4742
|
}
|
|
5328
4743
|
};
|
|
5329
4744
|
const result = await service.logging.insertLog(entry);
|
|
5330
|
-
return {
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
text: JSON.stringify({
|
|
5335
|
-
message: "Successfully inserted log entry",
|
|
5336
|
-
success: result.success
|
|
5337
|
-
})
|
|
5338
|
-
}
|
|
5339
|
-
]
|
|
5340
|
-
};
|
|
4745
|
+
return jsonResult({
|
|
4746
|
+
message: "Successfully inserted log entry",
|
|
4747
|
+
success: result.success
|
|
4748
|
+
});
|
|
5341
4749
|
}
|
|
5342
4750
|
);
|
|
5343
4751
|
server.tool(
|
|
@@ -5359,19 +4767,12 @@ function registerLoggingTools(server, service) {
|
|
|
5359
4767
|
},
|
|
5360
4768
|
requested_data: params.requested_fields
|
|
5361
4769
|
});
|
|
5362
|
-
return {
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
id: result.id,
|
|
5369
|
-
total: result.total,
|
|
5370
|
-
object: result.object
|
|
5371
|
-
})
|
|
5372
|
-
}
|
|
5373
|
-
]
|
|
5374
|
-
};
|
|
4770
|
+
return jsonResult({
|
|
4771
|
+
message: "Successfully created log export",
|
|
4772
|
+
id: result.id,
|
|
4773
|
+
total: result.total,
|
|
4774
|
+
object: result.object
|
|
4775
|
+
});
|
|
5375
4776
|
}
|
|
5376
4777
|
);
|
|
5377
4778
|
server.tool(
|
|
@@ -5382,27 +4783,20 @@ function registerLoggingTools(server, service) {
|
|
|
5382
4783
|
const result = await service.logging.listLogExports({
|
|
5383
4784
|
workspace_id: params.workspace_id
|
|
5384
4785
|
});
|
|
5385
|
-
return {
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
last_updated_at: exp.last_updated_at,
|
|
5400
|
-
created_by: exp.created_by
|
|
5401
|
-
}))
|
|
5402
|
-
})
|
|
5403
|
-
}
|
|
5404
|
-
]
|
|
5405
|
-
};
|
|
4786
|
+
return jsonResult({
|
|
4787
|
+
total: result.total,
|
|
4788
|
+
exports: result.data.map((exp) => ({
|
|
4789
|
+
id: exp.id,
|
|
4790
|
+
status: exp.status,
|
|
4791
|
+
description: exp.description,
|
|
4792
|
+
filters: exp.filters,
|
|
4793
|
+
requested_data: exp.requested_data,
|
|
4794
|
+
workspace_id: exp.workspace_id,
|
|
4795
|
+
created_at: exp.created_at,
|
|
4796
|
+
last_updated_at: exp.last_updated_at,
|
|
4797
|
+
created_by: exp.created_by
|
|
4798
|
+
}))
|
|
4799
|
+
});
|
|
5406
4800
|
}
|
|
5407
4801
|
);
|
|
5408
4802
|
server.tool(
|
|
@@ -5411,25 +4805,18 @@ function registerLoggingTools(server, service) {
|
|
|
5411
4805
|
LOGGING_TOOL_SCHEMAS.getLogExport,
|
|
5412
4806
|
async (params) => {
|
|
5413
4807
|
const result = await service.logging.getLogExport(params.export_id);
|
|
5414
|
-
return {
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
created_at: result.created_at,
|
|
5427
|
-
last_updated_at: result.last_updated_at,
|
|
5428
|
-
created_by: result.created_by
|
|
5429
|
-
})
|
|
5430
|
-
}
|
|
5431
|
-
]
|
|
5432
|
-
};
|
|
4808
|
+
return jsonResult({
|
|
4809
|
+
id: result.id,
|
|
4810
|
+
status: result.status,
|
|
4811
|
+
description: result.description,
|
|
4812
|
+
filters: result.filters,
|
|
4813
|
+
requested_data: result.requested_data,
|
|
4814
|
+
organisation_id: result.organisation_id,
|
|
4815
|
+
workspace_id: result.workspace_id,
|
|
4816
|
+
created_at: result.created_at,
|
|
4817
|
+
last_updated_at: result.last_updated_at,
|
|
4818
|
+
created_by: result.created_by
|
|
4819
|
+
});
|
|
5433
4820
|
}
|
|
5434
4821
|
);
|
|
5435
4822
|
server.tool(
|
|
@@ -5438,18 +4825,11 @@ function registerLoggingTools(server, service) {
|
|
|
5438
4825
|
LOGGING_TOOL_SCHEMAS.startLogExport,
|
|
5439
4826
|
async (params) => {
|
|
5440
4827
|
const result = await service.logging.startLogExport(params.export_id);
|
|
5441
|
-
return {
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
message: result.message,
|
|
5447
|
-
export_id: params.export_id,
|
|
5448
|
-
status: "started"
|
|
5449
|
-
})
|
|
5450
|
-
}
|
|
5451
|
-
]
|
|
5452
|
-
};
|
|
4828
|
+
return jsonResult({
|
|
4829
|
+
message: result.message,
|
|
4830
|
+
export_id: params.export_id,
|
|
4831
|
+
status: "started"
|
|
4832
|
+
});
|
|
5453
4833
|
}
|
|
5454
4834
|
);
|
|
5455
4835
|
server.tool(
|
|
@@ -5458,18 +4838,11 @@ function registerLoggingTools(server, service) {
|
|
|
5458
4838
|
LOGGING_TOOL_SCHEMAS.cancelLogExport,
|
|
5459
4839
|
async (params) => {
|
|
5460
4840
|
const result = await service.logging.cancelLogExport(params.export_id);
|
|
5461
|
-
return {
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
message: result.message,
|
|
5467
|
-
export_id: params.export_id,
|
|
5468
|
-
status: "cancelled"
|
|
5469
|
-
})
|
|
5470
|
-
}
|
|
5471
|
-
]
|
|
5472
|
-
};
|
|
4841
|
+
return jsonResult({
|
|
4842
|
+
message: result.message,
|
|
4843
|
+
export_id: params.export_id,
|
|
4844
|
+
status: "cancelled"
|
|
4845
|
+
});
|
|
5473
4846
|
}
|
|
5474
4847
|
);
|
|
5475
4848
|
server.tool(
|
|
@@ -5478,18 +4851,11 @@ function registerLoggingTools(server, service) {
|
|
|
5478
4851
|
LOGGING_TOOL_SCHEMAS.downloadLogExport,
|
|
5479
4852
|
async (params) => {
|
|
5480
4853
|
const result = await service.logging.downloadLogExport(params.export_id);
|
|
5481
|
-
return {
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
message: "Download URL generated successfully",
|
|
5487
|
-
export_id: params.export_id,
|
|
5488
|
-
signed_url: result.signed_url
|
|
5489
|
-
})
|
|
5490
|
-
}
|
|
5491
|
-
]
|
|
5492
|
-
};
|
|
4854
|
+
return jsonResult({
|
|
4855
|
+
message: "Download URL generated successfully",
|
|
4856
|
+
export_id: params.export_id,
|
|
4857
|
+
signed_url: result.signed_url
|
|
4858
|
+
});
|
|
5493
4859
|
}
|
|
5494
4860
|
);
|
|
5495
4861
|
server.tool(
|
|
@@ -5513,19 +4879,12 @@ function registerLoggingTools(server, service) {
|
|
|
5513
4879
|
params.export_id,
|
|
5514
4880
|
updateData
|
|
5515
4881
|
);
|
|
5516
|
-
return {
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
id: result.id,
|
|
5523
|
-
total: result.total,
|
|
5524
|
-
object: result.object
|
|
5525
|
-
})
|
|
5526
|
-
}
|
|
5527
|
-
]
|
|
5528
|
-
};
|
|
4882
|
+
return jsonResult({
|
|
4883
|
+
message: "Successfully updated log export",
|
|
4884
|
+
id: result.id,
|
|
4885
|
+
total: result.total,
|
|
4886
|
+
object: result.object
|
|
4887
|
+
});
|
|
5529
4888
|
}
|
|
5530
4889
|
);
|
|
5531
4890
|
}
|
|
@@ -5677,18 +5036,11 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5677
5036
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.listMcpIntegrations,
|
|
5678
5037
|
async (params) => {
|
|
5679
5038
|
const result = await service.mcpIntegrations.listMcpIntegrations(params);
|
|
5680
|
-
return {
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
total: result.total,
|
|
5686
|
-
has_more: result.has_more,
|
|
5687
|
-
integrations: result.data.map(formatMcpIntegration)
|
|
5688
|
-
})
|
|
5689
|
-
}
|
|
5690
|
-
]
|
|
5691
|
-
};
|
|
5039
|
+
return jsonResult({
|
|
5040
|
+
total: result.total,
|
|
5041
|
+
has_more: result.has_more,
|
|
5042
|
+
integrations: result.data.map(formatMcpIntegration)
|
|
5043
|
+
});
|
|
5692
5044
|
}
|
|
5693
5045
|
);
|
|
5694
5046
|
server.tool(
|
|
@@ -5721,18 +5073,11 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5721
5073
|
...rest,
|
|
5722
5074
|
...custom_headers ? { configurations: { custom_headers } } : {}
|
|
5723
5075
|
});
|
|
5724
|
-
return {
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
message: `Successfully created MCP integration "${params.name}"`,
|
|
5730
|
-
id: result.id,
|
|
5731
|
-
slug: result.slug
|
|
5732
|
-
})
|
|
5733
|
-
}
|
|
5734
|
-
]
|
|
5735
|
-
};
|
|
5076
|
+
return jsonResult({
|
|
5077
|
+
message: `Successfully created MCP integration "${params.name}"`,
|
|
5078
|
+
id: result.id,
|
|
5079
|
+
slug: result.slug
|
|
5080
|
+
});
|
|
5736
5081
|
}
|
|
5737
5082
|
);
|
|
5738
5083
|
server.tool(
|
|
@@ -5743,14 +5088,7 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5743
5088
|
const integration = await service.mcpIntegrations.getMcpIntegration(
|
|
5744
5089
|
params.id
|
|
5745
5090
|
);
|
|
5746
|
-
return
|
|
5747
|
-
content: [
|
|
5748
|
-
{
|
|
5749
|
-
type: "text",
|
|
5750
|
-
text: JSON.stringify(formatMcpIntegration(integration))
|
|
5751
|
-
}
|
|
5752
|
-
]
|
|
5753
|
-
};
|
|
5091
|
+
return jsonResult(formatMcpIntegration(integration));
|
|
5754
5092
|
}
|
|
5755
5093
|
);
|
|
5756
5094
|
server.tool(
|
|
@@ -5770,17 +5108,10 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5770
5108
|
...rest,
|
|
5771
5109
|
...custom_headers ? { configurations: { custom_headers } } : {}
|
|
5772
5110
|
});
|
|
5773
|
-
return {
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
text: JSON.stringify({
|
|
5778
|
-
message: `Successfully updated MCP integration "${id}"`,
|
|
5779
|
-
success: true
|
|
5780
|
-
})
|
|
5781
|
-
}
|
|
5782
|
-
]
|
|
5783
|
-
};
|
|
5111
|
+
return jsonResult({
|
|
5112
|
+
message: `Successfully updated MCP integration "${id}"`,
|
|
5113
|
+
success: true
|
|
5114
|
+
});
|
|
5784
5115
|
}
|
|
5785
5116
|
);
|
|
5786
5117
|
server.tool(
|
|
@@ -5789,17 +5120,10 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5789
5120
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.deleteMcpIntegration,
|
|
5790
5121
|
async (params) => {
|
|
5791
5122
|
await service.mcpIntegrations.deleteMcpIntegration(params.id);
|
|
5792
|
-
return {
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
text: JSON.stringify({
|
|
5797
|
-
message: `Successfully deleted MCP integration "${params.id}"`,
|
|
5798
|
-
success: true
|
|
5799
|
-
})
|
|
5800
|
-
}
|
|
5801
|
-
]
|
|
5802
|
-
};
|
|
5123
|
+
return jsonResult({
|
|
5124
|
+
message: `Successfully deleted MCP integration "${params.id}"`,
|
|
5125
|
+
success: true
|
|
5126
|
+
});
|
|
5803
5127
|
}
|
|
5804
5128
|
);
|
|
5805
5129
|
server.tool(
|
|
@@ -5810,14 +5134,7 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5810
5134
|
const metadata = await service.mcpIntegrations.getMcpIntegrationMetadata(
|
|
5811
5135
|
params.id
|
|
5812
5136
|
);
|
|
5813
|
-
return
|
|
5814
|
-
content: [
|
|
5815
|
-
{
|
|
5816
|
-
type: "text",
|
|
5817
|
-
text: JSON.stringify(formatMcpIntegrationMetadata(metadata))
|
|
5818
|
-
}
|
|
5819
|
-
]
|
|
5820
|
-
};
|
|
5137
|
+
return jsonResult(formatMcpIntegrationMetadata(metadata));
|
|
5821
5138
|
}
|
|
5822
5139
|
);
|
|
5823
5140
|
server.tool(
|
|
@@ -5826,17 +5143,10 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5826
5143
|
MCP_INTEGRATIONS_TOOL_SCHEMAS.listMcpIntegrationCapabilities,
|
|
5827
5144
|
async (params) => {
|
|
5828
5145
|
const result = await service.mcpIntegrations.listMcpIntegrationCapabilities(params.id);
|
|
5829
|
-
return {
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
text: JSON.stringify({
|
|
5834
|
-
total: result.total,
|
|
5835
|
-
capabilities: result.data
|
|
5836
|
-
})
|
|
5837
|
-
}
|
|
5838
|
-
]
|
|
5839
|
-
};
|
|
5146
|
+
return jsonResult({
|
|
5147
|
+
total: result.total,
|
|
5148
|
+
capabilities: result.data
|
|
5149
|
+
});
|
|
5840
5150
|
}
|
|
5841
5151
|
);
|
|
5842
5152
|
server.tool(
|
|
@@ -5856,17 +5166,10 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5856
5166
|
capabilities: params.capabilities
|
|
5857
5167
|
}
|
|
5858
5168
|
);
|
|
5859
|
-
return {
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
text: JSON.stringify({
|
|
5864
|
-
message: `Successfully updated capabilities for MCP integration "${params.id}"`,
|
|
5865
|
-
success: true
|
|
5866
|
-
})
|
|
5867
|
-
}
|
|
5868
|
-
]
|
|
5869
|
-
};
|
|
5169
|
+
return jsonResult({
|
|
5170
|
+
message: `Successfully updated capabilities for MCP integration "${params.id}"`,
|
|
5171
|
+
success: true
|
|
5172
|
+
});
|
|
5870
5173
|
}
|
|
5871
5174
|
);
|
|
5872
5175
|
server.tool(
|
|
@@ -5877,18 +5180,11 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5877
5180
|
const result = await service.mcpIntegrations.listMcpIntegrationWorkspaces(
|
|
5878
5181
|
params.id
|
|
5879
5182
|
);
|
|
5880
|
-
return {
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
global_workspace_access: result.global_workspace_access,
|
|
5886
|
-
workspace_count: result.workspaces.length,
|
|
5887
|
-
workspaces: result.workspaces.map(formatMcpIntegrationWorkspace)
|
|
5888
|
-
})
|
|
5889
|
-
}
|
|
5890
|
-
]
|
|
5891
|
-
};
|
|
5183
|
+
return jsonResult({
|
|
5184
|
+
global_workspace_access: result.global_workspace_access,
|
|
5185
|
+
workspace_count: result.workspaces.length,
|
|
5186
|
+
workspaces: result.workspaces.map(formatMcpIntegrationWorkspace)
|
|
5187
|
+
});
|
|
5892
5188
|
}
|
|
5893
5189
|
);
|
|
5894
5190
|
server.tool(
|
|
@@ -5905,30 +5201,16 @@ function registerMcpIntegrationsTools(server, service) {
|
|
|
5905
5201
|
await service.mcpIntegrations.updateMcpIntegrationWorkspaces(params.id, {
|
|
5906
5202
|
workspaces: params.workspaces
|
|
5907
5203
|
});
|
|
5908
|
-
return {
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
text: JSON.stringify({
|
|
5913
|
-
message: `Successfully updated workspace access for MCP integration "${params.id}"`,
|
|
5914
|
-
success: true
|
|
5915
|
-
})
|
|
5916
|
-
}
|
|
5917
|
-
]
|
|
5918
|
-
};
|
|
5204
|
+
return jsonResult({
|
|
5205
|
+
message: `Successfully updated workspace access for MCP integration "${params.id}"`,
|
|
5206
|
+
success: true
|
|
5207
|
+
});
|
|
5919
5208
|
}
|
|
5920
5209
|
);
|
|
5921
5210
|
}
|
|
5922
5211
|
|
|
5923
5212
|
// src/tools/mcp-servers.tools.ts
|
|
5924
5213
|
import { z as z14 } from "zod";
|
|
5925
|
-
|
|
5926
|
-
// src/tools/utils.ts
|
|
5927
|
-
function formatFullName(firstName, lastName) {
|
|
5928
|
-
return [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
5929
|
-
}
|
|
5930
|
-
|
|
5931
|
-
// src/tools/mcp-servers.tools.ts
|
|
5932
5214
|
var MCP_SERVERS_TOOL_SCHEMAS = {
|
|
5933
5215
|
listMcpServers: {
|
|
5934
5216
|
current_page: z14.coerce.number().int().positive().optional().describe("Page number for pagination"),
|
|
@@ -6057,18 +5339,11 @@ function registerMcpServersTools(server, service) {
|
|
|
6057
5339
|
page_size: params.page_size
|
|
6058
5340
|
}
|
|
6059
5341
|
);
|
|
6060
|
-
return {
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
total: result.total,
|
|
6066
|
-
has_more: result.has_more,
|
|
6067
|
-
connections: result.data
|
|
6068
|
-
})
|
|
6069
|
-
}
|
|
6070
|
-
]
|
|
6071
|
-
};
|
|
5342
|
+
return jsonResult({
|
|
5343
|
+
total: result.total,
|
|
5344
|
+
has_more: result.has_more,
|
|
5345
|
+
connections: result.data
|
|
5346
|
+
});
|
|
6072
5347
|
}
|
|
6073
5348
|
);
|
|
6074
5349
|
server.tool(
|
|
@@ -6090,17 +5365,10 @@ function registerMcpServersTools(server, service) {
|
|
|
6090
5365
|
workspace_id: params.workspace_id
|
|
6091
5366
|
}
|
|
6092
5367
|
);
|
|
6093
|
-
return {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
text: JSON.stringify({
|
|
6098
|
-
message: `Disconnected MCP server connection for "${params.id}"`,
|
|
6099
|
-
...result
|
|
6100
|
-
})
|
|
6101
|
-
}
|
|
6102
|
-
]
|
|
6103
|
-
};
|
|
5368
|
+
return jsonResult({
|
|
5369
|
+
message: `Disconnected MCP server connection for "${params.id}"`,
|
|
5370
|
+
...result
|
|
5371
|
+
});
|
|
6104
5372
|
}
|
|
6105
5373
|
);
|
|
6106
5374
|
server.tool(
|
|
@@ -6109,17 +5377,10 @@ function registerMcpServersTools(server, service) {
|
|
|
6109
5377
|
MCP_SERVERS_TOOL_SCHEMAS.listMcpServers,
|
|
6110
5378
|
async (params) => {
|
|
6111
5379
|
const result = await service.mcpServers.listMcpServers(params);
|
|
6112
|
-
return {
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
text: JSON.stringify({
|
|
6117
|
-
total: result.total,
|
|
6118
|
-
servers: result.data.map(formatMcpServer)
|
|
6119
|
-
})
|
|
6120
|
-
}
|
|
6121
|
-
]
|
|
6122
|
-
};
|
|
5380
|
+
return jsonResult({
|
|
5381
|
+
total: result.total,
|
|
5382
|
+
servers: result.data.map(formatMcpServer)
|
|
5383
|
+
});
|
|
6123
5384
|
}
|
|
6124
5385
|
);
|
|
6125
5386
|
server.tool(
|
|
@@ -6128,18 +5389,11 @@ function registerMcpServersTools(server, service) {
|
|
|
6128
5389
|
MCP_SERVERS_TOOL_SCHEMAS.createMcpServer,
|
|
6129
5390
|
async (params) => {
|
|
6130
5391
|
const result = await service.mcpServers.createMcpServer(params);
|
|
6131
|
-
return {
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
message: `Successfully created MCP server "${params.name}"`,
|
|
6137
|
-
id: result.id,
|
|
6138
|
-
slug: result.slug
|
|
6139
|
-
})
|
|
6140
|
-
}
|
|
6141
|
-
]
|
|
6142
|
-
};
|
|
5392
|
+
return jsonResult({
|
|
5393
|
+
message: `Successfully created MCP server "${params.name}"`,
|
|
5394
|
+
id: result.id,
|
|
5395
|
+
slug: result.slug
|
|
5396
|
+
});
|
|
6143
5397
|
}
|
|
6144
5398
|
);
|
|
6145
5399
|
server.tool(
|
|
@@ -6148,14 +5402,7 @@ function registerMcpServersTools(server, service) {
|
|
|
6148
5402
|
MCP_SERVERS_TOOL_SCHEMAS.getMcpServer,
|
|
6149
5403
|
async (params) => {
|
|
6150
5404
|
const mcpServer = await service.mcpServers.getMcpServer(params.id);
|
|
6151
|
-
return
|
|
6152
|
-
content: [
|
|
6153
|
-
{
|
|
6154
|
-
type: "text",
|
|
6155
|
-
text: JSON.stringify(formatMcpServer(mcpServer))
|
|
6156
|
-
}
|
|
6157
|
-
]
|
|
6158
|
-
};
|
|
5405
|
+
return jsonResult(formatMcpServer(mcpServer));
|
|
6159
5406
|
}
|
|
6160
5407
|
);
|
|
6161
5408
|
server.tool(
|
|
@@ -6164,18 +5411,11 @@ function registerMcpServersTools(server, service) {
|
|
|
6164
5411
|
MCP_SERVERS_TOOL_SCHEMAS.updateMcpServer,
|
|
6165
5412
|
async (params) => {
|
|
6166
5413
|
const { id, ...data } = params;
|
|
6167
|
-
await service.mcpServers.updateMcpServer(id, data);
|
|
6168
|
-
return {
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
text: JSON.stringify({
|
|
6173
|
-
message: `Successfully updated MCP server "${id}"`,
|
|
6174
|
-
success: true
|
|
6175
|
-
})
|
|
6176
|
-
}
|
|
6177
|
-
]
|
|
6178
|
-
};
|
|
5414
|
+
await service.mcpServers.updateMcpServer(id, data);
|
|
5415
|
+
return jsonResult({
|
|
5416
|
+
message: `Successfully updated MCP server "${id}"`,
|
|
5417
|
+
success: true
|
|
5418
|
+
});
|
|
6179
5419
|
}
|
|
6180
5420
|
);
|
|
6181
5421
|
server.tool(
|
|
@@ -6184,17 +5424,10 @@ function registerMcpServersTools(server, service) {
|
|
|
6184
5424
|
MCP_SERVERS_TOOL_SCHEMAS.deleteMcpServer,
|
|
6185
5425
|
async (params) => {
|
|
6186
5426
|
await service.mcpServers.deleteMcpServer(params.id);
|
|
6187
|
-
return {
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
text: JSON.stringify({
|
|
6192
|
-
message: `Successfully deleted MCP server "${params.id}"`,
|
|
6193
|
-
success: true
|
|
6194
|
-
})
|
|
6195
|
-
}
|
|
6196
|
-
]
|
|
6197
|
-
};
|
|
5427
|
+
return jsonResult({
|
|
5428
|
+
message: `Successfully deleted MCP server "${params.id}"`,
|
|
5429
|
+
success: true
|
|
5430
|
+
});
|
|
6198
5431
|
}
|
|
6199
5432
|
);
|
|
6200
5433
|
server.tool(
|
|
@@ -6203,14 +5436,7 @@ function registerMcpServersTools(server, service) {
|
|
|
6203
5436
|
MCP_SERVERS_TOOL_SCHEMAS.testMcpServer,
|
|
6204
5437
|
async (params) => {
|
|
6205
5438
|
const result = await service.mcpServers.testMcpServer(params.id);
|
|
6206
|
-
return
|
|
6207
|
-
content: [
|
|
6208
|
-
{
|
|
6209
|
-
type: "text",
|
|
6210
|
-
text: JSON.stringify(formatMcpServerTest(result))
|
|
6211
|
-
}
|
|
6212
|
-
]
|
|
6213
|
-
};
|
|
5439
|
+
return jsonResult(formatMcpServerTest(result));
|
|
6214
5440
|
}
|
|
6215
5441
|
);
|
|
6216
5442
|
server.tool(
|
|
@@ -6225,18 +5451,11 @@ function registerMcpServersTools(server, service) {
|
|
|
6225
5451
|
page_size: params.page_size
|
|
6226
5452
|
}
|
|
6227
5453
|
);
|
|
6228
|
-
return {
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
total: result.total,
|
|
6234
|
-
has_more: result.has_more,
|
|
6235
|
-
capabilities: result.data
|
|
6236
|
-
})
|
|
6237
|
-
}
|
|
6238
|
-
]
|
|
6239
|
-
};
|
|
5454
|
+
return jsonResult({
|
|
5455
|
+
total: result.total,
|
|
5456
|
+
has_more: result.has_more,
|
|
5457
|
+
capabilities: result.data
|
|
5458
|
+
});
|
|
6240
5459
|
}
|
|
6241
5460
|
);
|
|
6242
5461
|
server.tool(
|
|
@@ -6247,17 +5466,10 @@ function registerMcpServersTools(server, service) {
|
|
|
6247
5466
|
await service.mcpServers.updateMcpServerCapabilities(params.id, {
|
|
6248
5467
|
capabilities: params.capabilities
|
|
6249
5468
|
});
|
|
6250
|
-
return {
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
text: JSON.stringify({
|
|
6255
|
-
message: `Successfully updated capabilities for MCP server "${params.id}"`,
|
|
6256
|
-
success: true
|
|
6257
|
-
})
|
|
6258
|
-
}
|
|
6259
|
-
]
|
|
6260
|
-
};
|
|
5469
|
+
return jsonResult({
|
|
5470
|
+
message: `Successfully updated capabilities for MCP server "${params.id}"`,
|
|
5471
|
+
success: true
|
|
5472
|
+
});
|
|
6261
5473
|
}
|
|
6262
5474
|
);
|
|
6263
5475
|
server.tool(
|
|
@@ -6272,19 +5484,12 @@ function registerMcpServersTools(server, service) {
|
|
|
6272
5484
|
page_size: params.page_size
|
|
6273
5485
|
}
|
|
6274
5486
|
);
|
|
6275
|
-
return {
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
total: result.total,
|
|
6282
|
-
has_more: result.has_more,
|
|
6283
|
-
users: result.data.map(formatMcpServerUserAccess)
|
|
6284
|
-
})
|
|
6285
|
-
}
|
|
6286
|
-
]
|
|
6287
|
-
};
|
|
5487
|
+
return jsonResult({
|
|
5488
|
+
default_user_access: result.default_user_access,
|
|
5489
|
+
total: result.total,
|
|
5490
|
+
has_more: result.has_more,
|
|
5491
|
+
users: result.data.map(formatMcpServerUserAccess)
|
|
5492
|
+
});
|
|
6288
5493
|
}
|
|
6289
5494
|
);
|
|
6290
5495
|
server.tool(
|
|
@@ -6295,17 +5500,10 @@ function registerMcpServersTools(server, service) {
|
|
|
6295
5500
|
await service.mcpServers.updateMcpServerUserAccess(params.id, {
|
|
6296
5501
|
user_access: params.users
|
|
6297
5502
|
});
|
|
6298
|
-
return {
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
text: JSON.stringify({
|
|
6303
|
-
message: `Successfully updated user access for MCP server "${params.id}"`,
|
|
6304
|
-
success: true
|
|
6305
|
-
})
|
|
6306
|
-
}
|
|
6307
|
-
]
|
|
6308
|
-
};
|
|
5503
|
+
return jsonResult({
|
|
5504
|
+
message: `Successfully updated user access for MCP server "${params.id}"`,
|
|
5505
|
+
success: true
|
|
5506
|
+
});
|
|
6309
5507
|
}
|
|
6310
5508
|
);
|
|
6311
5509
|
}
|
|
@@ -6359,19 +5557,12 @@ function registerPartialsTools(server, service) {
|
|
|
6359
5557
|
workspace_id: params.workspace_id,
|
|
6360
5558
|
version_description: params.version_description
|
|
6361
5559
|
});
|
|
6362
|
-
return {
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
id: result.id,
|
|
6369
|
-
slug: result.slug,
|
|
6370
|
-
version_id: result.version_id
|
|
6371
|
-
})
|
|
6372
|
-
}
|
|
6373
|
-
]
|
|
6374
|
-
};
|
|
5560
|
+
return jsonResult({
|
|
5561
|
+
message: `Successfully created prompt partial "${params.name}"`,
|
|
5562
|
+
id: result.id,
|
|
5563
|
+
slug: result.slug,
|
|
5564
|
+
version_id: result.version_id
|
|
5565
|
+
});
|
|
6375
5566
|
}
|
|
6376
5567
|
);
|
|
6377
5568
|
server.tool(
|
|
@@ -6380,25 +5571,18 @@ function registerPartialsTools(server, service) {
|
|
|
6380
5571
|
PARTIALS_TOOL_SCHEMAS.listPromptPartials,
|
|
6381
5572
|
async (params) => {
|
|
6382
5573
|
const partials = await service.partials.listPromptPartials(params);
|
|
6383
|
-
return {
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
created_at: p.created_at,
|
|
6396
|
-
last_updated_at: p.last_updated_at
|
|
6397
|
-
}))
|
|
6398
|
-
})
|
|
6399
|
-
}
|
|
6400
|
-
]
|
|
6401
|
-
};
|
|
5574
|
+
return jsonResult({
|
|
5575
|
+
total: partials.length,
|
|
5576
|
+
partials: partials.map((p) => ({
|
|
5577
|
+
id: p.id,
|
|
5578
|
+
slug: p.slug,
|
|
5579
|
+
name: p.name,
|
|
5580
|
+
collection_id: p.collection_id,
|
|
5581
|
+
status: p.status,
|
|
5582
|
+
created_at: p.created_at,
|
|
5583
|
+
last_updated_at: p.last_updated_at
|
|
5584
|
+
}))
|
|
5585
|
+
});
|
|
6402
5586
|
}
|
|
6403
5587
|
);
|
|
6404
5588
|
server.tool(
|
|
@@ -6409,26 +5593,19 @@ function registerPartialsTools(server, service) {
|
|
|
6409
5593
|
const partial = await service.partials.getPromptPartial(
|
|
6410
5594
|
params.prompt_partial_id
|
|
6411
5595
|
);
|
|
6412
|
-
return {
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
status: partial.status,
|
|
6426
|
-
created_at: partial.created_at,
|
|
6427
|
-
last_updated_at: partial.last_updated_at
|
|
6428
|
-
})
|
|
6429
|
-
}
|
|
6430
|
-
]
|
|
6431
|
-
};
|
|
5596
|
+
return jsonResult({
|
|
5597
|
+
id: partial.id,
|
|
5598
|
+
slug: partial.slug,
|
|
5599
|
+
name: partial.name,
|
|
5600
|
+
collection_id: partial.collection_id,
|
|
5601
|
+
string: partial.string,
|
|
5602
|
+
version: partial.version,
|
|
5603
|
+
version_description: partial.version_description,
|
|
5604
|
+
prompt_partial_version_id: partial.prompt_partial_version_id,
|
|
5605
|
+
status: partial.status,
|
|
5606
|
+
created_at: partial.created_at,
|
|
5607
|
+
last_updated_at: partial.last_updated_at
|
|
5608
|
+
});
|
|
6432
5609
|
}
|
|
6433
5610
|
);
|
|
6434
5611
|
server.tool(
|
|
@@ -6441,17 +5618,10 @@ function registerPartialsTools(server, service) {
|
|
|
6441
5618
|
prompt_partial_id,
|
|
6442
5619
|
updateData
|
|
6443
5620
|
);
|
|
6444
|
-
return {
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
text: JSON.stringify({
|
|
6449
|
-
message: `Successfully updated prompt partial "${prompt_partial_id}"`,
|
|
6450
|
-
prompt_partial_version_id: result.prompt_partial_version_id
|
|
6451
|
-
})
|
|
6452
|
-
}
|
|
6453
|
-
]
|
|
6454
|
-
};
|
|
5621
|
+
return jsonResult({
|
|
5622
|
+
message: `Successfully updated prompt partial "${prompt_partial_id}"`,
|
|
5623
|
+
prompt_partial_version_id: result.prompt_partial_version_id
|
|
5624
|
+
});
|
|
6455
5625
|
}
|
|
6456
5626
|
);
|
|
6457
5627
|
server.tool(
|
|
@@ -6460,17 +5630,10 @@ function registerPartialsTools(server, service) {
|
|
|
6460
5630
|
PARTIALS_TOOL_SCHEMAS.deletePromptPartial,
|
|
6461
5631
|
async (params) => {
|
|
6462
5632
|
await service.partials.deletePromptPartial(params.prompt_partial_id);
|
|
6463
|
-
return {
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
text: JSON.stringify({
|
|
6468
|
-
message: `Successfully deleted prompt partial "${params.prompt_partial_id}"`,
|
|
6469
|
-
success: true
|
|
6470
|
-
})
|
|
6471
|
-
}
|
|
6472
|
-
]
|
|
6473
|
-
};
|
|
5633
|
+
return jsonResult({
|
|
5634
|
+
message: `Successfully deleted prompt partial "${params.prompt_partial_id}"`,
|
|
5635
|
+
success: true
|
|
5636
|
+
});
|
|
6474
5637
|
}
|
|
6475
5638
|
);
|
|
6476
5639
|
server.tool(
|
|
@@ -6481,27 +5644,20 @@ function registerPartialsTools(server, service) {
|
|
|
6481
5644
|
const versions = await service.partials.listPartialVersions(
|
|
6482
5645
|
params.prompt_partial_id
|
|
6483
5646
|
);
|
|
6484
|
-
return {
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
created_at: v.created_at,
|
|
6499
|
-
content_preview: v.string.length > 200 ? `${v.string.substring(0, 200)}...` : v.string
|
|
6500
|
-
}))
|
|
6501
|
-
})
|
|
6502
|
-
}
|
|
6503
|
-
]
|
|
6504
|
-
};
|
|
5647
|
+
return jsonResult({
|
|
5648
|
+
prompt_partial_id: params.prompt_partial_id,
|
|
5649
|
+
total_versions: versions.length,
|
|
5650
|
+
versions: versions.map((v) => ({
|
|
5651
|
+
prompt_partial_id: v.prompt_partial_id,
|
|
5652
|
+
prompt_partial_version_id: v.prompt_partial_version_id,
|
|
5653
|
+
slug: v.slug,
|
|
5654
|
+
version: v.version,
|
|
5655
|
+
description: v.description,
|
|
5656
|
+
status: v.prompt_version_status,
|
|
5657
|
+
created_at: v.created_at,
|
|
5658
|
+
content_preview: v.string.length > 200 ? `${v.string.substring(0, 200)}...` : v.string
|
|
5659
|
+
}))
|
|
5660
|
+
});
|
|
6505
5661
|
}
|
|
6506
5662
|
);
|
|
6507
5663
|
server.tool(
|
|
@@ -6512,19 +5668,12 @@ function registerPartialsTools(server, service) {
|
|
|
6512
5668
|
await service.partials.publishPartial(params.prompt_partial_id, {
|
|
6513
5669
|
version: params.version
|
|
6514
5670
|
});
|
|
6515
|
-
return {
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
prompt_partial_id: params.prompt_partial_id,
|
|
6522
|
-
published_version: params.version,
|
|
6523
|
-
success: true
|
|
6524
|
-
})
|
|
6525
|
-
}
|
|
6526
|
-
]
|
|
6527
|
-
};
|
|
5671
|
+
return jsonResult({
|
|
5672
|
+
message: `Successfully published version ${params.version} as default for partial "${params.prompt_partial_id}"`,
|
|
5673
|
+
prompt_partial_id: params.prompt_partial_id,
|
|
5674
|
+
published_version: params.version,
|
|
5675
|
+
success: true
|
|
5676
|
+
});
|
|
6528
5677
|
}
|
|
6529
5678
|
);
|
|
6530
5679
|
}
|
|
@@ -6854,29 +6003,18 @@ function registerPromptsTools(server, service) {
|
|
|
6854
6003
|
};
|
|
6855
6004
|
}
|
|
6856
6005
|
if (params.dry_run) {
|
|
6857
|
-
return {
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
model: params.model,
|
|
6870
|
-
template_length: templateString.length,
|
|
6871
|
-
parameter_count: Object.keys(params.parameters ?? {}).length
|
|
6872
|
-
}
|
|
6873
|
-
},
|
|
6874
|
-
null,
|
|
6875
|
-
2
|
|
6876
|
-
)
|
|
6877
|
-
}
|
|
6878
|
-
]
|
|
6879
|
-
};
|
|
6006
|
+
return jsonResult({
|
|
6007
|
+
dry_run: true,
|
|
6008
|
+
action: "create",
|
|
6009
|
+
message: `Would create prompt "${params.name}" in collection ${params.collection_id}`,
|
|
6010
|
+
prompt_preview: {
|
|
6011
|
+
name: params.name,
|
|
6012
|
+
collection_id: params.collection_id,
|
|
6013
|
+
model: params.model,
|
|
6014
|
+
template_length: templateString.length,
|
|
6015
|
+
parameter_count: Object.keys(params.parameters ?? {}).length
|
|
6016
|
+
}
|
|
6017
|
+
});
|
|
6880
6018
|
}
|
|
6881
6019
|
const result = await service.prompts.createPrompt({
|
|
6882
6020
|
name: params.name,
|
|
@@ -6893,19 +6031,12 @@ function registerPromptsTools(server, service) {
|
|
|
6893
6031
|
...params.tools !== void 0 ? { tools: params.tools } : {},
|
|
6894
6032
|
...params.tool_choice !== void 0 ? { tool_choice: toPromptToolChoice(params.tool_choice) } : {}
|
|
6895
6033
|
});
|
|
6896
|
-
return {
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
id: result.id,
|
|
6903
|
-
slug: result.slug,
|
|
6904
|
-
version_id: result.version_id
|
|
6905
|
-
})
|
|
6906
|
-
}
|
|
6907
|
-
]
|
|
6908
|
-
};
|
|
6034
|
+
return jsonResult({
|
|
6035
|
+
message: `Successfully created prompt "${params.name}"`,
|
|
6036
|
+
id: result.id,
|
|
6037
|
+
slug: result.slug,
|
|
6038
|
+
version_id: result.version_id
|
|
6039
|
+
});
|
|
6909
6040
|
}
|
|
6910
6041
|
);
|
|
6911
6042
|
server.tool(
|
|
@@ -6914,14 +6045,7 @@ function registerPromptsTools(server, service) {
|
|
|
6914
6045
|
PROMPTS_TOOL_SCHEMAS.listPrompts,
|
|
6915
6046
|
async (params) => {
|
|
6916
6047
|
const prompts = await service.prompts.listPrompts(params);
|
|
6917
|
-
return
|
|
6918
|
-
content: [
|
|
6919
|
-
{
|
|
6920
|
-
type: "text",
|
|
6921
|
-
text: JSON.stringify(formatPromptListResponse(prompts, params))
|
|
6922
|
-
}
|
|
6923
|
-
]
|
|
6924
|
-
};
|
|
6048
|
+
return jsonResult(formatPromptListResponse(prompts, params));
|
|
6925
6049
|
}
|
|
6926
6050
|
);
|
|
6927
6051
|
server.tool(
|
|
@@ -6946,40 +6070,33 @@ function registerPromptsTools(server, service) {
|
|
|
6946
6070
|
}
|
|
6947
6071
|
}
|
|
6948
6072
|
}
|
|
6949
|
-
return {
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
description: v.version_description,
|
|
6977
|
-
created_at: v.created_at
|
|
6978
|
-
}))
|
|
6979
|
-
})
|
|
6980
|
-
}
|
|
6981
|
-
]
|
|
6982
|
-
};
|
|
6073
|
+
return jsonResult({
|
|
6074
|
+
id: prompt.id,
|
|
6075
|
+
name: prompt.name,
|
|
6076
|
+
slug: prompt.slug,
|
|
6077
|
+
collection_id: prompt.collection_id,
|
|
6078
|
+
created_at: prompt.created_at,
|
|
6079
|
+
last_updated_at: prompt.last_updated_at,
|
|
6080
|
+
current_version: prompt.current_version ? {
|
|
6081
|
+
id: prompt.current_version.id,
|
|
6082
|
+
version_number: prompt.current_version.version_number,
|
|
6083
|
+
description: prompt.current_version.version_description,
|
|
6084
|
+
model: prompt.current_version.model,
|
|
6085
|
+
template_format: templateFormat,
|
|
6086
|
+
template: templateString,
|
|
6087
|
+
parameters: prompt.current_version.parameters,
|
|
6088
|
+
metadata: prompt.current_version.template_metadata,
|
|
6089
|
+
has_tools: !!prompt.current_version.tools?.length,
|
|
6090
|
+
has_functions: !!prompt.current_version.functions?.length
|
|
6091
|
+
} : null,
|
|
6092
|
+
version_count: (prompt.versions || []).length,
|
|
6093
|
+
versions: (prompt.versions || []).map((v) => ({
|
|
6094
|
+
id: v.id,
|
|
6095
|
+
version_number: v.version_number,
|
|
6096
|
+
description: v.version_description,
|
|
6097
|
+
created_at: v.created_at
|
|
6098
|
+
}))
|
|
6099
|
+
});
|
|
6983
6100
|
}
|
|
6984
6101
|
);
|
|
6985
6102
|
server.tool(
|
|
@@ -6994,26 +6111,15 @@ function registerPromptsTools(server, service) {
|
|
|
6994
6111
|
});
|
|
6995
6112
|
if (dry_run) {
|
|
6996
6113
|
const current = await service.prompts.getPrompt(prompt_id);
|
|
6997
|
-
return {
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
current_version: current.current_version?.version_number ?? null,
|
|
7007
|
-
changes: Object.keys(updateData).filter(
|
|
7008
|
-
(k) => updateData[k] !== void 0
|
|
7009
|
-
)
|
|
7010
|
-
},
|
|
7011
|
-
null,
|
|
7012
|
-
2
|
|
7013
|
-
)
|
|
7014
|
-
}
|
|
7015
|
-
]
|
|
7016
|
-
};
|
|
6114
|
+
return jsonResult({
|
|
6115
|
+
dry_run: true,
|
|
6116
|
+
action: "update",
|
|
6117
|
+
message: `Would update prompt "${current.name}"`,
|
|
6118
|
+
current_version: current.current_version?.version_number ?? null,
|
|
6119
|
+
changes: Object.keys(updateData).filter(
|
|
6120
|
+
(k) => updateData[k] !== void 0
|
|
6121
|
+
)
|
|
6122
|
+
});
|
|
7017
6123
|
}
|
|
7018
6124
|
const result = await service.prompts.updatePrompt(prompt_id, {
|
|
7019
6125
|
...updateData.name !== void 0 ? { name: updateData.name } : {},
|
|
@@ -7028,19 +6134,12 @@ function registerPromptsTools(server, service) {
|
|
|
7028
6134
|
...updateData.tools !== void 0 ? { tools: updateData.tools } : {},
|
|
7029
6135
|
...updateData.tool_choice !== void 0 ? { tool_choice: toPromptToolChoice(updateData.tool_choice) } : {}
|
|
7030
6136
|
});
|
|
7031
|
-
return {
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
id: result.id,
|
|
7038
|
-
slug: result.slug,
|
|
7039
|
-
new_version_id: result.prompt_version_id
|
|
7040
|
-
})
|
|
7041
|
-
}
|
|
7042
|
-
]
|
|
7043
|
-
};
|
|
6137
|
+
return jsonResult({
|
|
6138
|
+
message: "Successfully updated prompt",
|
|
6139
|
+
id: result.id,
|
|
6140
|
+
slug: result.slug,
|
|
6141
|
+
new_version_id: result.prompt_version_id
|
|
6142
|
+
});
|
|
7044
6143
|
}
|
|
7045
6144
|
);
|
|
7046
6145
|
server.tool(
|
|
@@ -7049,17 +6148,10 @@ function registerPromptsTools(server, service) {
|
|
|
7049
6148
|
PROMPTS_TOOL_SCHEMAS.deletePrompt,
|
|
7050
6149
|
async (params) => {
|
|
7051
6150
|
await service.prompts.deletePrompt(params.prompt_id);
|
|
7052
|
-
return {
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
text: JSON.stringify({
|
|
7057
|
-
message: `Successfully deleted prompt "${params.prompt_id}"`,
|
|
7058
|
-
success: true
|
|
7059
|
-
})
|
|
7060
|
-
}
|
|
7061
|
-
]
|
|
7062
|
-
};
|
|
6151
|
+
return jsonResult({
|
|
6152
|
+
message: `Successfully deleted prompt "${params.prompt_id}"`,
|
|
6153
|
+
success: true
|
|
6154
|
+
});
|
|
7063
6155
|
}
|
|
7064
6156
|
);
|
|
7065
6157
|
server.tool(
|
|
@@ -7070,19 +6162,12 @@ function registerPromptsTools(server, service) {
|
|
|
7070
6162
|
await service.prompts.publishPrompt(params.prompt_id, {
|
|
7071
6163
|
version: params.version
|
|
7072
6164
|
});
|
|
7073
|
-
return {
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
prompt_id: params.prompt_id,
|
|
7080
|
-
published_version: params.version,
|
|
7081
|
-
success: true
|
|
7082
|
-
})
|
|
7083
|
-
}
|
|
7084
|
-
]
|
|
7085
|
-
};
|
|
6165
|
+
return jsonResult({
|
|
6166
|
+
message: `Successfully published version ${params.version} of prompt "${params.prompt_id}"`,
|
|
6167
|
+
prompt_id: params.prompt_id,
|
|
6168
|
+
published_version: params.version,
|
|
6169
|
+
success: true
|
|
6170
|
+
});
|
|
7086
6171
|
}
|
|
7087
6172
|
);
|
|
7088
6173
|
server.tool(
|
|
@@ -7093,30 +6178,23 @@ function registerPromptsTools(server, service) {
|
|
|
7093
6178
|
const versions = await service.prompts.listPromptVersions(
|
|
7094
6179
|
params.prompt_id
|
|
7095
6180
|
);
|
|
7096
|
-
return {
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
return str.substring(0, 200) + (str.length > 200 ? "..." : "");
|
|
7114
|
-
})()
|
|
7115
|
-
}))
|
|
7116
|
-
})
|
|
7117
|
-
}
|
|
7118
|
-
]
|
|
7119
|
-
};
|
|
6181
|
+
return jsonResult({
|
|
6182
|
+
prompt_id: params.prompt_id,
|
|
6183
|
+
total_versions: versions.length,
|
|
6184
|
+
versions: versions.map((v) => ({
|
|
6185
|
+
id: v.id,
|
|
6186
|
+
version_number: v.prompt_version,
|
|
6187
|
+
description: v.prompt_description,
|
|
6188
|
+
status: v.status,
|
|
6189
|
+
label_id: v.label_id,
|
|
6190
|
+
created_at: v.created_at,
|
|
6191
|
+
template_preview: (() => {
|
|
6192
|
+
const tmpl = v.prompt_template;
|
|
6193
|
+
const str = typeof tmpl === "string" ? tmpl : typeof tmpl === "object" && tmpl !== null && "string" in tmpl ? tmpl.string : JSON.stringify(tmpl);
|
|
6194
|
+
return str.substring(0, 200) + (str.length > 200 ? "..." : "");
|
|
6195
|
+
})()
|
|
6196
|
+
}))
|
|
6197
|
+
});
|
|
7120
6198
|
}
|
|
7121
6199
|
);
|
|
7122
6200
|
server.tool(
|
|
@@ -7128,23 +6206,16 @@ function registerPromptsTools(server, service) {
|
|
|
7128
6206
|
variables: params.variables,
|
|
7129
6207
|
hyperparameters: params.hyperparameters
|
|
7130
6208
|
});
|
|
7131
|
-
return {
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
temperature: result.data.temperature,
|
|
7142
|
-
top_p: result.data.top_p
|
|
7143
|
-
}
|
|
7144
|
-
})
|
|
7145
|
-
}
|
|
7146
|
-
]
|
|
7147
|
-
};
|
|
6209
|
+
return jsonResult({
|
|
6210
|
+
success: result.success,
|
|
6211
|
+
rendered_messages: result.data.messages,
|
|
6212
|
+
model: result.data.model,
|
|
6213
|
+
hyperparameters: {
|
|
6214
|
+
max_tokens: result.data.max_tokens,
|
|
6215
|
+
temperature: result.data.temperature,
|
|
6216
|
+
top_p: result.data.top_p
|
|
6217
|
+
}
|
|
6218
|
+
});
|
|
7148
6219
|
}
|
|
7149
6220
|
);
|
|
7150
6221
|
server.tool(
|
|
@@ -7162,24 +6233,17 @@ function registerPromptsTools(server, service) {
|
|
|
7162
6233
|
}
|
|
7163
6234
|
);
|
|
7164
6235
|
const choice = result.choices?.[0];
|
|
7165
|
-
return {
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
completion_tokens: result.usage.completion_tokens,
|
|
7177
|
-
total_tokens: result.usage.total_tokens
|
|
7178
|
-
} : null
|
|
7179
|
-
})
|
|
7180
|
-
}
|
|
7181
|
-
]
|
|
7182
|
-
};
|
|
6236
|
+
return jsonResult({
|
|
6237
|
+
id: result.id,
|
|
6238
|
+
model: result.model,
|
|
6239
|
+
response: choice?.message?.content ?? null,
|
|
6240
|
+
finish_reason: choice?.finish_reason ?? null,
|
|
6241
|
+
usage: result.usage ? {
|
|
6242
|
+
prompt_tokens: result.usage.prompt_tokens,
|
|
6243
|
+
completion_tokens: result.usage.completion_tokens,
|
|
6244
|
+
total_tokens: result.usage.total_tokens
|
|
6245
|
+
} : null
|
|
6246
|
+
});
|
|
7183
6247
|
}
|
|
7184
6248
|
);
|
|
7185
6249
|
server.tool(
|
|
@@ -7221,21 +6285,14 @@ function registerPromptsTools(server, service) {
|
|
|
7221
6285
|
...params.tool_choice !== void 0 ? { tool_choice: toPromptToolChoice(params.tool_choice) } : {},
|
|
7222
6286
|
...params.dry_run !== void 0 ? { dry_run: params.dry_run } : {}
|
|
7223
6287
|
});
|
|
7224
|
-
return {
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
prompt_id: result.prompt_id ?? void 0,
|
|
7233
|
-
slug: result.slug ?? void 0,
|
|
7234
|
-
version_id: result.version_id ?? void 0
|
|
7235
|
-
})
|
|
7236
|
-
}
|
|
7237
|
-
]
|
|
7238
|
-
};
|
|
6288
|
+
return jsonResult({
|
|
6289
|
+
action: result.action,
|
|
6290
|
+
dry_run: result.dry_run,
|
|
6291
|
+
message: result.message,
|
|
6292
|
+
prompt_id: result.prompt_id ?? void 0,
|
|
6293
|
+
slug: result.slug ?? void 0,
|
|
6294
|
+
version_id: result.version_id ?? void 0
|
|
6295
|
+
});
|
|
7239
6296
|
}
|
|
7240
6297
|
);
|
|
7241
6298
|
server.tool(
|
|
@@ -7250,26 +6307,19 @@ function registerPromptsTools(server, service) {
|
|
|
7250
6307
|
target_env: params.target_env,
|
|
7251
6308
|
virtual_key: params.virtual_key
|
|
7252
6309
|
});
|
|
7253
|
-
return {
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
action: result.action
|
|
7267
|
-
},
|
|
7268
|
-
promoted_at: result.promoted_at
|
|
7269
|
-
})
|
|
7270
|
-
}
|
|
7271
|
-
]
|
|
7272
|
-
};
|
|
6310
|
+
return jsonResult({
|
|
6311
|
+
message: `Successfully promoted prompt to ${params.target_env}`,
|
|
6312
|
+
source: {
|
|
6313
|
+
prompt_id: result.source_prompt_id,
|
|
6314
|
+
version_id: result.source_version_id
|
|
6315
|
+
},
|
|
6316
|
+
target: {
|
|
6317
|
+
prompt_id: result.target_prompt_id,
|
|
6318
|
+
version_id: result.target_version_id,
|
|
6319
|
+
action: result.action
|
|
6320
|
+
},
|
|
6321
|
+
promoted_at: result.promoted_at
|
|
6322
|
+
});
|
|
7273
6323
|
}
|
|
7274
6324
|
);
|
|
7275
6325
|
server.tool(
|
|
@@ -7278,19 +6328,12 @@ function registerPromptsTools(server, service) {
|
|
|
7278
6328
|
PROMPTS_TOOL_SCHEMAS.validateCompletionMetadata,
|
|
7279
6329
|
async (params) => {
|
|
7280
6330
|
const result = service.prompts.validateBillingMetadata(params);
|
|
7281
|
-
return {
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
errors: result.errors,
|
|
7288
|
-
warnings: result.warnings,
|
|
7289
|
-
metadata: params
|
|
7290
|
-
})
|
|
7291
|
-
}
|
|
7292
|
-
]
|
|
7293
|
-
};
|
|
6331
|
+
return jsonResult({
|
|
6332
|
+
valid: result.valid,
|
|
6333
|
+
errors: result.errors,
|
|
6334
|
+
warnings: result.warnings,
|
|
6335
|
+
metadata: params
|
|
6336
|
+
});
|
|
7294
6337
|
}
|
|
7295
6338
|
);
|
|
7296
6339
|
server.tool(
|
|
@@ -7302,14 +6345,7 @@ function registerPromptsTools(server, service) {
|
|
|
7302
6345
|
params.prompt_id,
|
|
7303
6346
|
params.version_id
|
|
7304
6347
|
);
|
|
7305
|
-
return
|
|
7306
|
-
content: [
|
|
7307
|
-
{
|
|
7308
|
-
type: "text",
|
|
7309
|
-
text: JSON.stringify(formatPromptVersion(version))
|
|
7310
|
-
}
|
|
7311
|
-
]
|
|
7312
|
-
};
|
|
6348
|
+
return jsonResult(formatPromptVersion(version));
|
|
7313
6349
|
}
|
|
7314
6350
|
);
|
|
7315
6351
|
server.tool(
|
|
@@ -7324,17 +6360,10 @@ function registerPromptsTools(server, service) {
|
|
|
7324
6360
|
label_id: params.label_id
|
|
7325
6361
|
}
|
|
7326
6362
|
);
|
|
7327
|
-
return {
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
text: JSON.stringify({
|
|
7332
|
-
message: `Successfully updated version "${params.version_id}" of prompt "${params.prompt_id}"`,
|
|
7333
|
-
success: true
|
|
7334
|
-
})
|
|
7335
|
-
}
|
|
7336
|
-
]
|
|
7337
|
-
};
|
|
6363
|
+
return jsonResult({
|
|
6364
|
+
message: `Successfully updated version "${params.version_id}" of prompt "${params.prompt_id}"`,
|
|
6365
|
+
success: true
|
|
6366
|
+
});
|
|
7338
6367
|
}
|
|
7339
6368
|
);
|
|
7340
6369
|
}
|
|
@@ -7415,36 +6444,29 @@ function registerProvidersTools(server, service) {
|
|
|
7415
6444
|
page_size: params.page_size,
|
|
7416
6445
|
workspace_id: params.workspace_id
|
|
7417
6446
|
});
|
|
7418
|
-
return {
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
expires_at: provider.expires_at,
|
|
7442
|
-
created_at: provider.created_at
|
|
7443
|
-
}))
|
|
7444
|
-
})
|
|
7445
|
-
}
|
|
7446
|
-
]
|
|
7447
|
-
};
|
|
6447
|
+
return jsonResult({
|
|
6448
|
+
total: providers.total,
|
|
6449
|
+
providers: providers.data.map((provider) => ({
|
|
6450
|
+
name: provider.name,
|
|
6451
|
+
slug: provider.slug,
|
|
6452
|
+
integration_id: provider.integration_id,
|
|
6453
|
+
status: provider.status,
|
|
6454
|
+
note: provider.note,
|
|
6455
|
+
usage_limits: provider.usage_limits ? {
|
|
6456
|
+
credit_limit: provider.usage_limits.credit_limit,
|
|
6457
|
+
alert_threshold: provider.usage_limits.alert_threshold,
|
|
6458
|
+
periodic_reset: provider.usage_limits.periodic_reset
|
|
6459
|
+
} : null,
|
|
6460
|
+
rate_limits: provider.rate_limits?.map((limit) => ({
|
|
6461
|
+
type: limit.type,
|
|
6462
|
+
unit: limit.unit,
|
|
6463
|
+
value: limit.value
|
|
6464
|
+
})) ?? null,
|
|
6465
|
+
reset_usage: provider.reset_usage,
|
|
6466
|
+
expires_at: provider.expires_at,
|
|
6467
|
+
created_at: provider.created_at
|
|
6468
|
+
}))
|
|
6469
|
+
});
|
|
7448
6470
|
}
|
|
7449
6471
|
);
|
|
7450
6472
|
server.tool(
|
|
@@ -7470,18 +6492,11 @@ function registerProvidersTools(server, service) {
|
|
|
7470
6492
|
}) : void 0,
|
|
7471
6493
|
expires_at: params.expires_at
|
|
7472
6494
|
});
|
|
7473
|
-
return {
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
message: `Successfully created provider "${params.name}"`,
|
|
7479
|
-
id: result.id,
|
|
7480
|
-
slug: result.slug
|
|
7481
|
-
})
|
|
7482
|
-
}
|
|
7483
|
-
]
|
|
7484
|
-
};
|
|
6495
|
+
return jsonResult({
|
|
6496
|
+
message: `Successfully created provider "${params.name}"`,
|
|
6497
|
+
id: result.id,
|
|
6498
|
+
slug: result.slug
|
|
6499
|
+
});
|
|
7485
6500
|
}
|
|
7486
6501
|
);
|
|
7487
6502
|
server.tool(
|
|
@@ -7493,33 +6508,26 @@ function registerProvidersTools(server, service) {
|
|
|
7493
6508
|
params.slug,
|
|
7494
6509
|
params.workspace_id
|
|
7495
6510
|
);
|
|
7496
|
-
return {
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
reset_usage: provider.reset_usage,
|
|
7517
|
-
expires_at: provider.expires_at,
|
|
7518
|
-
created_at: provider.created_at
|
|
7519
|
-
})
|
|
7520
|
-
}
|
|
7521
|
-
]
|
|
7522
|
-
};
|
|
6511
|
+
return jsonResult({
|
|
6512
|
+
name: provider.name,
|
|
6513
|
+
slug: provider.slug,
|
|
6514
|
+
integration_id: provider.integration_id,
|
|
6515
|
+
status: provider.status,
|
|
6516
|
+
note: provider.note,
|
|
6517
|
+
usage_limits: provider.usage_limits ? {
|
|
6518
|
+
credit_limit: provider.usage_limits.credit_limit,
|
|
6519
|
+
alert_threshold: provider.usage_limits.alert_threshold,
|
|
6520
|
+
periodic_reset: provider.usage_limits.periodic_reset
|
|
6521
|
+
} : null,
|
|
6522
|
+
rate_limits: provider.rate_limits?.map((limit) => ({
|
|
6523
|
+
type: limit.type,
|
|
6524
|
+
unit: limit.unit,
|
|
6525
|
+
value: limit.value
|
|
6526
|
+
})) ?? null,
|
|
6527
|
+
reset_usage: provider.reset_usage,
|
|
6528
|
+
expires_at: provider.expires_at,
|
|
6529
|
+
created_at: provider.created_at
|
|
6530
|
+
});
|
|
7523
6531
|
}
|
|
7524
6532
|
);
|
|
7525
6533
|
server.tool(
|
|
@@ -7547,18 +6555,11 @@ function registerProvidersTools(server, service) {
|
|
|
7547
6555
|
},
|
|
7548
6556
|
params.workspace_id
|
|
7549
6557
|
);
|
|
7550
|
-
return {
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
message: `Successfully updated provider "${params.slug}"`,
|
|
7556
|
-
id: result.id,
|
|
7557
|
-
slug: result.slug
|
|
7558
|
-
})
|
|
7559
|
-
}
|
|
7560
|
-
]
|
|
7561
|
-
};
|
|
6558
|
+
return jsonResult({
|
|
6559
|
+
message: `Successfully updated provider "${params.slug}"`,
|
|
6560
|
+
id: result.id,
|
|
6561
|
+
slug: result.slug
|
|
6562
|
+
});
|
|
7562
6563
|
}
|
|
7563
6564
|
);
|
|
7564
6565
|
server.tool(
|
|
@@ -7567,17 +6568,10 @@ function registerProvidersTools(server, service) {
|
|
|
7567
6568
|
PROVIDERS_TOOL_SCHEMAS.deleteProvider,
|
|
7568
6569
|
async (params) => {
|
|
7569
6570
|
await service.providers.deleteProvider(params.slug, params.workspace_id);
|
|
7570
|
-
return {
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
text: JSON.stringify({
|
|
7575
|
-
message: `Successfully deleted provider "${params.slug}"`,
|
|
7576
|
-
success: true
|
|
7577
|
-
})
|
|
7578
|
-
}
|
|
7579
|
-
]
|
|
7580
|
-
};
|
|
6571
|
+
return jsonResult({
|
|
6572
|
+
message: `Successfully deleted provider "${params.slug}"`,
|
|
6573
|
+
success: true
|
|
6574
|
+
});
|
|
7581
6575
|
}
|
|
7582
6576
|
);
|
|
7583
6577
|
}
|
|
@@ -7843,18 +6837,11 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7843
6837
|
validateWorkspaceAccess(params);
|
|
7844
6838
|
validateManagerAuth(params.manager_type, params.auth_config);
|
|
7845
6839
|
const result = await service.secretReferences.createSecretReference(params);
|
|
7846
|
-
return {
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
message: `Successfully created Secret Reference "${result.slug}"`,
|
|
7852
|
-
id: result.id,
|
|
7853
|
-
slug: result.slug
|
|
7854
|
-
})
|
|
7855
|
-
}
|
|
7856
|
-
]
|
|
7857
|
-
};
|
|
6840
|
+
return jsonResult({
|
|
6841
|
+
message: `Successfully created Secret Reference "${result.slug}"`,
|
|
6842
|
+
id: result.id,
|
|
6843
|
+
slug: result.slug
|
|
6844
|
+
});
|
|
7858
6845
|
}
|
|
7859
6846
|
);
|
|
7860
6847
|
server.tool(
|
|
@@ -7873,25 +6860,18 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7873
6860
|
...params,
|
|
7874
6861
|
tags: params.tags ? JSON.stringify(params.tags) : void 0
|
|
7875
6862
|
});
|
|
7876
|
-
return {
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
created_at: reference.created_at,
|
|
7889
|
-
last_updated_at: reference.last_updated_at
|
|
7890
|
-
}))
|
|
7891
|
-
})
|
|
7892
|
-
}
|
|
7893
|
-
]
|
|
7894
|
-
};
|
|
6863
|
+
return jsonResult({
|
|
6864
|
+
total: result.total,
|
|
6865
|
+
secret_references: result.data.map((reference) => ({
|
|
6866
|
+
id: reference.id,
|
|
6867
|
+
name: reference.name,
|
|
6868
|
+
slug: reference.slug,
|
|
6869
|
+
manager_type: reference.manager_type,
|
|
6870
|
+
status: reference.status,
|
|
6871
|
+
created_at: reference.created_at,
|
|
6872
|
+
last_updated_at: reference.last_updated_at
|
|
6873
|
+
}))
|
|
6874
|
+
});
|
|
7895
6875
|
}
|
|
7896
6876
|
);
|
|
7897
6877
|
server.tool(
|
|
@@ -7907,17 +6887,10 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7907
6887
|
},
|
|
7908
6888
|
async ({ id }) => {
|
|
7909
6889
|
const result = await service.secretReferences.getSecretReference(id);
|
|
7910
|
-
return {
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
text: JSON.stringify({
|
|
7915
|
-
...result,
|
|
7916
|
-
auth_config: redactAuthConfig(result.auth_config)
|
|
7917
|
-
})
|
|
7918
|
-
}
|
|
7919
|
-
]
|
|
7920
|
-
};
|
|
6890
|
+
return jsonResult({
|
|
6891
|
+
...result,
|
|
6892
|
+
auth_config: redactAuthConfig(result.auth_config)
|
|
6893
|
+
});
|
|
7921
6894
|
}
|
|
7922
6895
|
);
|
|
7923
6896
|
server.tool(
|
|
@@ -7938,17 +6911,10 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7938
6911
|
}
|
|
7939
6912
|
if (updates.auth_config) validateAuthUpdate(updates.auth_config);
|
|
7940
6913
|
await service.secretReferences.updateSecretReference(id, updates);
|
|
7941
|
-
return {
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
text: JSON.stringify({
|
|
7946
|
-
message: `Successfully updated Secret Reference "${id}"`,
|
|
7947
|
-
success: true
|
|
7948
|
-
})
|
|
7949
|
-
}
|
|
7950
|
-
]
|
|
7951
|
-
};
|
|
6914
|
+
return jsonResult({
|
|
6915
|
+
message: `Successfully updated Secret Reference "${id}"`,
|
|
6916
|
+
success: true
|
|
6917
|
+
});
|
|
7952
6918
|
}
|
|
7953
6919
|
);
|
|
7954
6920
|
server.tool(
|
|
@@ -7964,17 +6930,10 @@ function registerSecretReferencesTools(server, service) {
|
|
|
7964
6930
|
},
|
|
7965
6931
|
async ({ id }) => {
|
|
7966
6932
|
const result = await service.secretReferences.deleteSecretReference(id);
|
|
7967
|
-
return {
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
text: JSON.stringify({
|
|
7972
|
-
message: `Successfully deleted Secret Reference "${id}"`,
|
|
7973
|
-
success: result.success
|
|
7974
|
-
})
|
|
7975
|
-
}
|
|
7976
|
-
]
|
|
7977
|
-
};
|
|
6933
|
+
return jsonResult({
|
|
6934
|
+
message: `Successfully deleted Secret Reference "${id}"`,
|
|
6935
|
+
success: result.success
|
|
6936
|
+
});
|
|
7978
6937
|
}
|
|
7979
6938
|
);
|
|
7980
6939
|
}
|
|
@@ -8017,18 +6976,11 @@ function registerTracingTools(server, service) {
|
|
|
8017
6976
|
weight: params.weight,
|
|
8018
6977
|
metadata: params.metadata
|
|
8019
6978
|
});
|
|
8020
|
-
return {
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
message: `Successfully created feedback for trace "${params.trace_id}"`,
|
|
8026
|
-
status: result.status,
|
|
8027
|
-
feedback_ids: result.feedback_ids
|
|
8028
|
-
})
|
|
8029
|
-
}
|
|
8030
|
-
]
|
|
8031
|
-
};
|
|
6979
|
+
return jsonResult({
|
|
6980
|
+
message: `Successfully created feedback for trace "${params.trace_id}"`,
|
|
6981
|
+
status: result.status,
|
|
6982
|
+
feedback_ids: result.feedback_ids
|
|
6983
|
+
});
|
|
8032
6984
|
}
|
|
8033
6985
|
);
|
|
8034
6986
|
server.tool(
|
|
@@ -8041,18 +6993,11 @@ function registerTracingTools(server, service) {
|
|
|
8041
6993
|
weight: params.weight,
|
|
8042
6994
|
metadata: params.metadata
|
|
8043
6995
|
});
|
|
8044
|
-
return {
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
message: `Successfully updated feedback "${params.id}"`,
|
|
8050
|
-
status: result.status,
|
|
8051
|
-
feedback_ids: result.feedback_ids
|
|
8052
|
-
})
|
|
8053
|
-
}
|
|
8054
|
-
]
|
|
8055
|
-
};
|
|
6996
|
+
return jsonResult({
|
|
6997
|
+
message: `Successfully updated feedback "${params.id}"`,
|
|
6998
|
+
status: result.status,
|
|
6999
|
+
feedback_ids: result.feedback_ids
|
|
7000
|
+
});
|
|
8056
7001
|
}
|
|
8057
7002
|
);
|
|
8058
7003
|
}
|
|
@@ -8168,17 +7113,10 @@ function registerUsersTools(server, service) {
|
|
|
8168
7113
|
current_page: params.current_page,
|
|
8169
7114
|
page_size: params.page_size
|
|
8170
7115
|
});
|
|
8171
|
-
return {
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
text: JSON.stringify({
|
|
8176
|
-
total: users.total,
|
|
8177
|
-
users: users.data.map(formatUser)
|
|
8178
|
-
})
|
|
8179
|
-
}
|
|
8180
|
-
]
|
|
8181
|
-
};
|
|
7116
|
+
return jsonResult({
|
|
7117
|
+
total: users.total,
|
|
7118
|
+
users: users.data.map(formatUser)
|
|
7119
|
+
});
|
|
8182
7120
|
}
|
|
8183
7121
|
);
|
|
8184
7122
|
server.tool(
|
|
@@ -8187,18 +7125,11 @@ function registerUsersTools(server, service) {
|
|
|
8187
7125
|
USERS_TOOL_SCHEMAS.inviteUser,
|
|
8188
7126
|
async (params) => {
|
|
8189
7127
|
const result = await service.users.inviteUser(params);
|
|
8190
|
-
return {
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
message: `Successfully invited ${params.email} as ${params.role}`,
|
|
8196
|
-
invite_id: result.id,
|
|
8197
|
-
invite_link: result.invite_link
|
|
8198
|
-
})
|
|
8199
|
-
}
|
|
8200
|
-
]
|
|
8201
|
-
};
|
|
7128
|
+
return jsonResult({
|
|
7129
|
+
message: `Successfully invited ${params.email} as ${params.role}`,
|
|
7130
|
+
invite_id: result.id,
|
|
7131
|
+
invite_link: result.invite_link
|
|
7132
|
+
});
|
|
8202
7133
|
}
|
|
8203
7134
|
);
|
|
8204
7135
|
server.tool(
|
|
@@ -8207,17 +7138,10 @@ function registerUsersTools(server, service) {
|
|
|
8207
7138
|
USERS_TOOL_SCHEMAS.getUserStats,
|
|
8208
7139
|
async (params) => {
|
|
8209
7140
|
const stats = await service.users.getUserGroupedData(params);
|
|
8210
|
-
return {
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
text: JSON.stringify({
|
|
8215
|
-
total_users: stats.total,
|
|
8216
|
-
users: stats.data.map(formatUserAnalyticsGroup)
|
|
8217
|
-
})
|
|
8218
|
-
}
|
|
8219
|
-
]
|
|
8220
|
-
};
|
|
7141
|
+
return jsonResult({
|
|
7142
|
+
total_users: stats.total,
|
|
7143
|
+
users: stats.data.map(formatUserAnalyticsGroup)
|
|
7144
|
+
});
|
|
8221
7145
|
}
|
|
8222
7146
|
);
|
|
8223
7147
|
server.tool(
|
|
@@ -8226,14 +7150,7 @@ function registerUsersTools(server, service) {
|
|
|
8226
7150
|
USERS_TOOL_SCHEMAS.getUser,
|
|
8227
7151
|
async (params) => {
|
|
8228
7152
|
const user = await service.users.getUser(params.user_id);
|
|
8229
|
-
return
|
|
8230
|
-
content: [
|
|
8231
|
-
{
|
|
8232
|
-
type: "text",
|
|
8233
|
-
text: JSON.stringify(formatUser(user))
|
|
8234
|
-
}
|
|
8235
|
-
]
|
|
8236
|
-
};
|
|
7153
|
+
return jsonResult(formatUser(user));
|
|
8237
7154
|
}
|
|
8238
7155
|
);
|
|
8239
7156
|
server.tool(
|
|
@@ -8243,17 +7160,10 @@ function registerUsersTools(server, service) {
|
|
|
8243
7160
|
async (params) => {
|
|
8244
7161
|
const { user_id, ...updateData } = params;
|
|
8245
7162
|
const user = await service.users.updateUser(user_id, updateData);
|
|
8246
|
-
return {
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
text: JSON.stringify({
|
|
8251
|
-
message: "Successfully updated user",
|
|
8252
|
-
user: formatUser(user)
|
|
8253
|
-
})
|
|
8254
|
-
}
|
|
8255
|
-
]
|
|
8256
|
-
};
|
|
7163
|
+
return jsonResult({
|
|
7164
|
+
message: "Successfully updated user",
|
|
7165
|
+
user: formatUser(user)
|
|
7166
|
+
});
|
|
8257
7167
|
}
|
|
8258
7168
|
);
|
|
8259
7169
|
server.tool(
|
|
@@ -8262,17 +7172,10 @@ function registerUsersTools(server, service) {
|
|
|
8262
7172
|
USERS_TOOL_SCHEMAS.deleteUser,
|
|
8263
7173
|
async (params) => {
|
|
8264
7174
|
await service.users.deleteUser(params.user_id);
|
|
8265
|
-
return {
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
text: JSON.stringify({
|
|
8270
|
-
message: `Successfully deleted user ${params.user_id}`,
|
|
8271
|
-
success: true
|
|
8272
|
-
})
|
|
8273
|
-
}
|
|
8274
|
-
]
|
|
8275
|
-
};
|
|
7175
|
+
return jsonResult({
|
|
7176
|
+
message: `Successfully deleted user ${params.user_id}`,
|
|
7177
|
+
success: true
|
|
7178
|
+
});
|
|
8276
7179
|
}
|
|
8277
7180
|
);
|
|
8278
7181
|
server.tool(
|
|
@@ -8284,17 +7187,10 @@ function registerUsersTools(server, service) {
|
|
|
8284
7187
|
current_page: params.current_page,
|
|
8285
7188
|
page_size: params.page_size
|
|
8286
7189
|
});
|
|
8287
|
-
return {
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
text: JSON.stringify({
|
|
8292
|
-
total: invites.total,
|
|
8293
|
-
invites: invites.data.map(formatUserInvite)
|
|
8294
|
-
})
|
|
8295
|
-
}
|
|
8296
|
-
]
|
|
8297
|
-
};
|
|
7190
|
+
return jsonResult({
|
|
7191
|
+
total: invites.total,
|
|
7192
|
+
invites: invites.data.map(formatUserInvite)
|
|
7193
|
+
});
|
|
8298
7194
|
}
|
|
8299
7195
|
);
|
|
8300
7196
|
server.tool(
|
|
@@ -8303,14 +7199,7 @@ function registerUsersTools(server, service) {
|
|
|
8303
7199
|
USERS_TOOL_SCHEMAS.getUserInvite,
|
|
8304
7200
|
async (params) => {
|
|
8305
7201
|
const invite = await service.users.getUserInvite(params.invite_id);
|
|
8306
|
-
return
|
|
8307
|
-
content: [
|
|
8308
|
-
{
|
|
8309
|
-
type: "text",
|
|
8310
|
-
text: JSON.stringify(formatUserInvite(invite))
|
|
8311
|
-
}
|
|
8312
|
-
]
|
|
8313
|
-
};
|
|
7202
|
+
return jsonResult(formatUserInvite(invite));
|
|
8314
7203
|
}
|
|
8315
7204
|
);
|
|
8316
7205
|
server.tool(
|
|
@@ -8319,17 +7208,10 @@ function registerUsersTools(server, service) {
|
|
|
8319
7208
|
USERS_TOOL_SCHEMAS.deleteUserInvite,
|
|
8320
7209
|
async (params) => {
|
|
8321
7210
|
await service.users.deleteUserInvite(params.invite_id);
|
|
8322
|
-
return {
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
text: JSON.stringify({
|
|
8327
|
-
message: `Successfully deleted invite ${params.invite_id}`,
|
|
8328
|
-
success: true
|
|
8329
|
-
})
|
|
8330
|
-
}
|
|
8331
|
-
]
|
|
8332
|
-
};
|
|
7211
|
+
return jsonResult({
|
|
7212
|
+
message: `Successfully deleted invite ${params.invite_id}`,
|
|
7213
|
+
success: true
|
|
7214
|
+
});
|
|
8333
7215
|
}
|
|
8334
7216
|
);
|
|
8335
7217
|
server.tool(
|
|
@@ -8338,17 +7220,10 @@ function registerUsersTools(server, service) {
|
|
|
8338
7220
|
USERS_TOOL_SCHEMAS.resendUserInvite,
|
|
8339
7221
|
async (params) => {
|
|
8340
7222
|
await service.users.resendUserInvite(params.invite_id);
|
|
8341
|
-
return {
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
text: JSON.stringify({
|
|
8346
|
-
message: `Successfully resent invite ${params.invite_id}`,
|
|
8347
|
-
success: true
|
|
8348
|
-
})
|
|
8349
|
-
}
|
|
8350
|
-
]
|
|
8351
|
-
};
|
|
7223
|
+
return jsonResult({
|
|
7224
|
+
message: `Successfully resent invite ${params.invite_id}`,
|
|
7225
|
+
success: true
|
|
7226
|
+
});
|
|
8352
7227
|
}
|
|
8353
7228
|
);
|
|
8354
7229
|
}
|
|
@@ -8418,16 +7293,26 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
8418
7293
|
},
|
|
8419
7294
|
getWorkspaceMember: {
|
|
8420
7295
|
workspace_id: z22.string().describe("The workspace ID"),
|
|
8421
|
-
user_id: z22.string().
|
|
7296
|
+
user_id: z22.string().uuid(
|
|
7297
|
+
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
7298
|
+
).describe(
|
|
7299
|
+
"The user ID to retrieve (must be a valid UUID from list_all_users, not an email address)"
|
|
7300
|
+
)
|
|
8422
7301
|
},
|
|
8423
7302
|
updateWorkspaceMember: {
|
|
8424
7303
|
workspace_id: z22.string().describe("The workspace ID"),
|
|
8425
|
-
user_id: z22.string().
|
|
7304
|
+
user_id: z22.string().uuid(
|
|
7305
|
+
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
7306
|
+
).describe(
|
|
7307
|
+
"The user ID to update (must be a valid UUID from list_all_users, not an email address)"
|
|
7308
|
+
),
|
|
8426
7309
|
role: z22.enum(["admin", "member", "manager"]).describe("New role in the workspace")
|
|
8427
7310
|
},
|
|
8428
7311
|
removeWorkspaceMember: {
|
|
8429
7312
|
workspace_id: z22.string().describe("The workspace ID"),
|
|
8430
|
-
user_id: z22.string().
|
|
7313
|
+
user_id: z22.string().uuid(
|
|
7314
|
+
"user_id must be a valid UUID (use list_all_users to find user IDs)"
|
|
7315
|
+
).describe("The user ID to remove")
|
|
8431
7316
|
},
|
|
8432
7317
|
listScimWorkspaceMappings: {
|
|
8433
7318
|
workspace_id: z22.string().optional().describe("Return only mappings for this Portkey workspace ID"),
|
|
@@ -8435,7 +7320,9 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
8435
7320
|
"Return only mappings for this identity-provider SCIM group ID"
|
|
8436
7321
|
),
|
|
8437
7322
|
role: z22.enum(["admin", "member", "manager"]).optional().describe("Return only mappings that grant this workspace role"),
|
|
8438
|
-
page: z22.coerce.number().int().nonnegative().optional().describe(
|
|
7323
|
+
page: z22.coerce.number().int().nonnegative().optional().describe(
|
|
7324
|
+
"Zero-based results page to retrieve; the first page is 0. Unlike current_page used by other list tools in this API (which is 1-based), do not pass 1 for the first page here."
|
|
7325
|
+
),
|
|
8439
7326
|
page_size: z22.coerce.number().int().positive().max(100).optional().describe("Mappings per page, from 1 through 100")
|
|
8440
7327
|
},
|
|
8441
7328
|
deleteScimWorkspaceMapping: {
|
|
@@ -8443,7 +7330,9 @@ var WORKSPACES_TOOL_SCHEMAS = {
|
|
|
8443
7330
|
},
|
|
8444
7331
|
listScimGroups: {
|
|
8445
7332
|
search: z22.string().optional().describe("Case-insensitive text to match against SCIM group names"),
|
|
8446
|
-
page: z22.coerce.number().int().nonnegative().optional().describe(
|
|
7333
|
+
page: z22.coerce.number().int().nonnegative().optional().describe(
|
|
7334
|
+
"Zero-based results page to retrieve; the first page is 0. Unlike current_page used by other list tools in this API (which is 1-based), do not pass 1 for the first page here."
|
|
7335
|
+
),
|
|
8447
7336
|
page_size: z22.coerce.number().int().positive().max(100).optional().describe("SCIM groups per page, from 1 through 100")
|
|
8448
7337
|
}
|
|
8449
7338
|
};
|
|
@@ -8502,16 +7391,7 @@ function registerWorkspacesTools(server, service) {
|
|
|
8502
7391
|
idempotentHint: true,
|
|
8503
7392
|
openWorldHint: true
|
|
8504
7393
|
},
|
|
8505
|
-
async (params) => (
|
|
8506
|
-
content: [
|
|
8507
|
-
{
|
|
8508
|
-
type: "text",
|
|
8509
|
-
text: JSON.stringify(
|
|
8510
|
-
await service.workspaces.listScimWorkspaceMappings(params)
|
|
8511
|
-
)
|
|
8512
|
-
}
|
|
8513
|
-
]
|
|
8514
|
-
})
|
|
7394
|
+
async (params) => jsonResult(await service.workspaces.listScimWorkspaceMappings(params))
|
|
8515
7395
|
);
|
|
8516
7396
|
server.registerTool(
|
|
8517
7397
|
"create_scim_workspace_mapping",
|
|
@@ -8546,9 +7426,7 @@ function registerWorkspacesTools(server, service) {
|
|
|
8546
7426
|
);
|
|
8547
7427
|
}
|
|
8548
7428
|
const result = await service.workspaces.createScimWorkspaceMapping(request);
|
|
8549
|
-
return
|
|
8550
|
-
content: [{ type: "text", text: JSON.stringify(result) }]
|
|
8551
|
-
};
|
|
7429
|
+
return jsonResult(result);
|
|
8552
7430
|
}
|
|
8553
7431
|
);
|
|
8554
7432
|
server.tool(
|
|
@@ -8566,17 +7444,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8566
7444
|
const result = await service.workspaces.deleteScimWorkspaceMapping(
|
|
8567
7445
|
params.mapping_id
|
|
8568
7446
|
);
|
|
8569
|
-
return {
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
text: JSON.stringify({
|
|
8574
|
-
message: `Deleted SCIM workspace mapping "${params.mapping_id}"`,
|
|
8575
|
-
...result
|
|
8576
|
-
})
|
|
8577
|
-
}
|
|
8578
|
-
]
|
|
8579
|
-
};
|
|
7447
|
+
return jsonResult({
|
|
7448
|
+
message: `Deleted SCIM workspace mapping "${params.mapping_id}"`,
|
|
7449
|
+
...result
|
|
7450
|
+
});
|
|
8580
7451
|
}
|
|
8581
7452
|
);
|
|
8582
7453
|
server.tool(
|
|
@@ -8590,14 +7461,7 @@ function registerWorkspacesTools(server, service) {
|
|
|
8590
7461
|
idempotentHint: true,
|
|
8591
7462
|
openWorldHint: true
|
|
8592
7463
|
},
|
|
8593
|
-
async (params) => (
|
|
8594
|
-
content: [
|
|
8595
|
-
{
|
|
8596
|
-
type: "text",
|
|
8597
|
-
text: JSON.stringify(await service.workspaces.listScimGroups(params))
|
|
8598
|
-
}
|
|
8599
|
-
]
|
|
8600
|
-
})
|
|
7464
|
+
async (params) => jsonResult(await service.workspaces.listScimGroups(params))
|
|
8601
7465
|
);
|
|
8602
7466
|
server.tool(
|
|
8603
7467
|
"list_workspaces",
|
|
@@ -8605,17 +7469,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8605
7469
|
WORKSPACES_TOOL_SCHEMAS.listWorkspaces,
|
|
8606
7470
|
async (params) => {
|
|
8607
7471
|
const workspaces = await service.workspaces.listWorkspaces(params);
|
|
8608
|
-
return {
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
text: JSON.stringify({
|
|
8613
|
-
total: workspaces.total,
|
|
8614
|
-
workspaces: workspaces.data.map(formatWorkspaceSummary)
|
|
8615
|
-
})
|
|
8616
|
-
}
|
|
8617
|
-
]
|
|
8618
|
-
};
|
|
7472
|
+
return jsonResult({
|
|
7473
|
+
total: workspaces.total,
|
|
7474
|
+
workspaces: workspaces.data.map(formatWorkspaceSummary)
|
|
7475
|
+
});
|
|
8619
7476
|
}
|
|
8620
7477
|
);
|
|
8621
7478
|
server.tool(
|
|
@@ -8626,14 +7483,7 @@ function registerWorkspacesTools(server, service) {
|
|
|
8626
7483
|
const workspace = await service.workspaces.getWorkspace(
|
|
8627
7484
|
params.workspace_id
|
|
8628
7485
|
);
|
|
8629
|
-
return
|
|
8630
|
-
content: [
|
|
8631
|
-
{
|
|
8632
|
-
type: "text",
|
|
8633
|
-
text: JSON.stringify(formatWorkspaceDetail(workspace))
|
|
8634
|
-
}
|
|
8635
|
-
]
|
|
8636
|
-
};
|
|
7486
|
+
return jsonResult(formatWorkspaceDetail(workspace));
|
|
8637
7487
|
}
|
|
8638
7488
|
);
|
|
8639
7489
|
server.tool(
|
|
@@ -8650,17 +7500,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8650
7500
|
metadata: params.metadata
|
|
8651
7501
|
} : void 0
|
|
8652
7502
|
});
|
|
8653
|
-
return {
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
text: JSON.stringify({
|
|
8658
|
-
message: `Successfully created workspace "${params.name}"`,
|
|
8659
|
-
workspace: formatWorkspaceSummary(workspace)
|
|
8660
|
-
})
|
|
8661
|
-
}
|
|
8662
|
-
]
|
|
8663
|
-
};
|
|
7503
|
+
return jsonResult({
|
|
7504
|
+
message: `Successfully created workspace "${params.name}"`,
|
|
7505
|
+
workspace: formatWorkspaceSummary(workspace)
|
|
7506
|
+
});
|
|
8664
7507
|
}
|
|
8665
7508
|
);
|
|
8666
7509
|
server.tool(
|
|
@@ -8676,17 +7519,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8676
7519
|
...rest,
|
|
8677
7520
|
...Object.keys(defaults).length > 0 ? { defaults } : {}
|
|
8678
7521
|
});
|
|
8679
|
-
return {
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
text: JSON.stringify({
|
|
8684
|
-
message: "Successfully updated workspace",
|
|
8685
|
-
workspace: formatWorkspaceSummary(workspace)
|
|
8686
|
-
})
|
|
8687
|
-
}
|
|
8688
|
-
]
|
|
8689
|
-
};
|
|
7522
|
+
return jsonResult({
|
|
7523
|
+
message: "Successfully updated workspace",
|
|
7524
|
+
workspace: formatWorkspaceSummary(workspace)
|
|
7525
|
+
});
|
|
8690
7526
|
}
|
|
8691
7527
|
);
|
|
8692
7528
|
server.tool(
|
|
@@ -8695,17 +7531,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8695
7531
|
WORKSPACES_TOOL_SCHEMAS.deleteWorkspace,
|
|
8696
7532
|
async (params) => {
|
|
8697
7533
|
await service.workspaces.deleteWorkspace(params.workspace_id);
|
|
8698
|
-
return {
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
text: JSON.stringify({
|
|
8703
|
-
message: `Successfully deleted workspace ${params.workspace_id}`,
|
|
8704
|
-
success: true
|
|
8705
|
-
})
|
|
8706
|
-
}
|
|
8707
|
-
]
|
|
8708
|
-
};
|
|
7534
|
+
return jsonResult({
|
|
7535
|
+
message: `Successfully deleted workspace ${params.workspace_id}`,
|
|
7536
|
+
success: true
|
|
7537
|
+
});
|
|
8709
7538
|
}
|
|
8710
7539
|
);
|
|
8711
7540
|
server.tool(
|
|
@@ -8720,17 +7549,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8720
7549
|
role: params.role
|
|
8721
7550
|
}
|
|
8722
7551
|
);
|
|
8723
|
-
return {
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
text: JSON.stringify({
|
|
8728
|
-
message: `Successfully added user to workspace as ${params.role}`,
|
|
8729
|
-
member: formatWorkspaceMember(member)
|
|
8730
|
-
})
|
|
8731
|
-
}
|
|
8732
|
-
]
|
|
8733
|
-
};
|
|
7552
|
+
return jsonResult({
|
|
7553
|
+
message: `Successfully added user to workspace as ${params.role}`,
|
|
7554
|
+
member: formatWorkspaceMember(member)
|
|
7555
|
+
});
|
|
8734
7556
|
}
|
|
8735
7557
|
);
|
|
8736
7558
|
server.tool(
|
|
@@ -8741,17 +7563,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8741
7563
|
const members = await service.workspaces.listWorkspaceMembers(
|
|
8742
7564
|
params.workspace_id
|
|
8743
7565
|
);
|
|
8744
|
-
return {
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
text: JSON.stringify({
|
|
8749
|
-
total: members.total,
|
|
8750
|
-
members: members.data.map(formatWorkspaceMember)
|
|
8751
|
-
})
|
|
8752
|
-
}
|
|
8753
|
-
]
|
|
8754
|
-
};
|
|
7566
|
+
return jsonResult({
|
|
7567
|
+
total: members.total,
|
|
7568
|
+
members: members.data.map(formatWorkspaceMember)
|
|
7569
|
+
});
|
|
8755
7570
|
}
|
|
8756
7571
|
);
|
|
8757
7572
|
server.tool(
|
|
@@ -8763,14 +7578,7 @@ function registerWorkspacesTools(server, service) {
|
|
|
8763
7578
|
params.workspace_id,
|
|
8764
7579
|
params.user_id
|
|
8765
7580
|
);
|
|
8766
|
-
return
|
|
8767
|
-
content: [
|
|
8768
|
-
{
|
|
8769
|
-
type: "text",
|
|
8770
|
-
text: JSON.stringify(formatWorkspaceMember(member))
|
|
8771
|
-
}
|
|
8772
|
-
]
|
|
8773
|
-
};
|
|
7581
|
+
return jsonResult(formatWorkspaceMember(member));
|
|
8774
7582
|
}
|
|
8775
7583
|
);
|
|
8776
7584
|
server.tool(
|
|
@@ -8785,17 +7593,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8785
7593
|
role: params.role
|
|
8786
7594
|
}
|
|
8787
7595
|
);
|
|
8788
|
-
return {
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
text: JSON.stringify({
|
|
8793
|
-
message: `Successfully updated member role to ${params.role}`,
|
|
8794
|
-
member: formatWorkspaceMember(member)
|
|
8795
|
-
})
|
|
8796
|
-
}
|
|
8797
|
-
]
|
|
8798
|
-
};
|
|
7596
|
+
return jsonResult({
|
|
7597
|
+
message: `Successfully updated member role to ${params.role}`,
|
|
7598
|
+
member: formatWorkspaceMember(member)
|
|
7599
|
+
});
|
|
8799
7600
|
}
|
|
8800
7601
|
);
|
|
8801
7602
|
server.tool(
|
|
@@ -8807,17 +7608,10 @@ function registerWorkspacesTools(server, service) {
|
|
|
8807
7608
|
params.workspace_id,
|
|
8808
7609
|
params.user_id
|
|
8809
7610
|
);
|
|
8810
|
-
return {
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
text: JSON.stringify({
|
|
8815
|
-
message: `Successfully removed user from workspace`,
|
|
8816
|
-
success: true
|
|
8817
|
-
})
|
|
8818
|
-
}
|
|
8819
|
-
]
|
|
8820
|
-
};
|
|
7611
|
+
return jsonResult({
|
|
7612
|
+
message: `Successfully removed user from workspace`,
|
|
7613
|
+
success: true
|
|
7614
|
+
});
|
|
8821
7615
|
}
|
|
8822
7616
|
);
|
|
8823
7617
|
}
|
|
@@ -9106,7 +7900,7 @@ function normalizeToolResult(result) {
|
|
|
9106
7900
|
error: getErrorDetails(result)
|
|
9107
7901
|
} : {
|
|
9108
7902
|
ok: true,
|
|
9109
|
-
data: getSuccessData(result)
|
|
7903
|
+
data: result.structuredContent !== void 0 ? result.structuredContent : getSuccessData(result)
|
|
9110
7904
|
};
|
|
9111
7905
|
return {
|
|
9112
7906
|
...result,
|