@centrali-io/centrali-mcp 5.2.0 → 5.4.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 +15 -0
- package/dist/index.js +2 -0
- package/dist/tools/_register.d.ts +24 -0
- package/dist/tools/_register.js +44 -0
- package/dist/tools/auth-providers.js +15 -30
- package/dist/tools/compute.js +48 -69
- package/dist/tools/describe.js +174 -21
- package/dist/tools/insights.js +13 -36
- package/dist/tools/orchestrations.js +21 -44
- package/dist/tools/pages.js +39 -61
- package/dist/tools/records.js +29 -50
- package/dist/tools/search.js +3 -24
- package/dist/tools/service-accounts.js +93 -108
- package/dist/tools/smart-queries.js +15 -36
- package/dist/tools/structures.js +23 -61
- package/dist/tools/validation.js +11 -34
- package/dist/tools/webhook-subscriptions.d.ts +3 -0
- package/dist/tools/webhook-subscriptions.js +292 -0
- package/package.json +5 -6
- package/src/index.ts +2 -0
- package/src/tools/_register.ts +53 -0
- package/src/tools/auth-providers.ts +8 -24
- package/src/tools/compute.ts +25 -46
- package/src/tools/describe.ts +200 -21
- package/src/tools/insights.ts +19 -28
- package/src/tools/orchestrations.ts +11 -34
- package/src/tools/pages.ts +20 -41
- package/src/tools/records.ts +15 -36
- package/src/tools/search.ts +7 -22
- package/src/tools/service-accounts.ts +47 -63
- package/src/tools/smart-queries.ts +8 -29
- package/src/tools/structures.ts +12 -50
- package/src/tools/validation.ts +21 -27
- package/src/tools/webhook-subscriptions.ts +363 -0
package/dist/tools/compute.js
CHANGED
|
@@ -15,28 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.registerComputeTools = registerComputeTools;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const zod_1 = require("zod");
|
|
18
|
-
|
|
19
|
-
var _a, _b;
|
|
20
|
-
if (error && typeof error === 'object') {
|
|
21
|
-
const e = error;
|
|
22
|
-
if ('message' in e) {
|
|
23
|
-
let msg = `Error ${context}`;
|
|
24
|
-
if ('code' in e || 'status' in e) {
|
|
25
|
-
msg += `: [${(_b = (_a = e.code) !== null && _a !== void 0 ? _a : e.status) !== null && _b !== void 0 ? _b : 'ERROR'}] ${e.message}`;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
msg += `: ${e.message}`;
|
|
29
|
-
}
|
|
30
|
-
if (Array.isArray(e.fieldErrors) && e.fieldErrors.length > 0) {
|
|
31
|
-
msg += '\nField errors:\n' + e.fieldErrors
|
|
32
|
-
.map(f => ` ${f.field}: ${f.message}`)
|
|
33
|
-
.join('\n');
|
|
34
|
-
}
|
|
35
|
-
return msg;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return `Error ${context}: ${error instanceof Error ? error.message : String(error)}`;
|
|
39
|
-
}
|
|
18
|
+
const _register_js_1 = require("./_register.js");
|
|
40
19
|
/**
|
|
41
20
|
* Ensures the SDK has a valid token.
|
|
42
21
|
*/
|
|
@@ -53,7 +32,7 @@ function ensureToken(sdk) {
|
|
|
53
32
|
});
|
|
54
33
|
}
|
|
55
34
|
function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
56
|
-
|
|
35
|
+
(0, _register_js_1.registerTool)(server, "list_functions", "List all compute functions in the workspace. Compute functions are JavaScript code blocks that run server-side.", {
|
|
57
36
|
page: zod_1.z.number().optional().describe("Page number"),
|
|
58
37
|
limit: zod_1.z.number().optional().describe("Results per page"),
|
|
59
38
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ page, limit }) {
|
|
@@ -75,14 +54,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
75
54
|
content: [
|
|
76
55
|
{
|
|
77
56
|
type: "text",
|
|
78
|
-
text: formatError(error, "listing functions"),
|
|
57
|
+
text: (0, _register_js_1.formatError)(error, "listing functions"),
|
|
79
58
|
},
|
|
80
59
|
],
|
|
81
60
|
isError: true,
|
|
82
61
|
};
|
|
83
62
|
}
|
|
84
63
|
}));
|
|
85
|
-
|
|
64
|
+
(0, _register_js_1.registerTool)(server, "list_triggers", "List function triggers in the workspace. Triggers define how and when compute functions are executed (on-demand, event-driven, scheduled, http-trigger, endpoint).", {
|
|
86
65
|
executionType: zod_1.z
|
|
87
66
|
.enum(["on-demand", "event-driven", "scheduled", "http-trigger", "endpoint"])
|
|
88
67
|
.optional()
|
|
@@ -110,14 +89,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
110
89
|
content: [
|
|
111
90
|
{
|
|
112
91
|
type: "text",
|
|
113
|
-
text: formatError(error, "listing triggers"),
|
|
92
|
+
text: (0, _register_js_1.formatError)(error, "listing triggers"),
|
|
114
93
|
},
|
|
115
94
|
],
|
|
116
95
|
isError: true,
|
|
117
96
|
};
|
|
118
97
|
}
|
|
119
98
|
}));
|
|
120
|
-
|
|
99
|
+
(0, _register_js_1.registerTool)(server, "invoke_trigger", "Invoke an on-demand function trigger by ID. Optionally pass a custom payload. Returns the queued job ID.", {
|
|
121
100
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID) to invoke"),
|
|
122
101
|
payload: zod_1.z
|
|
123
102
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
@@ -145,14 +124,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
145
124
|
content: [
|
|
146
125
|
{
|
|
147
126
|
type: "text",
|
|
148
|
-
text: formatError(error, `invoking trigger '${triggerId}'`),
|
|
127
|
+
text: (0, _register_js_1.formatError)(error, `invoking trigger '${triggerId}'`),
|
|
149
128
|
},
|
|
150
129
|
],
|
|
151
130
|
isError: true,
|
|
152
131
|
};
|
|
153
132
|
}
|
|
154
133
|
}));
|
|
155
|
-
|
|
134
|
+
(0, _register_js_1.registerTool)(server, "get_compute_job_status", "Check the status of an async compute job by job ID. Returns the current state (queued, running, completed, failed), the return value on success, or the failure reason on error. Use this after invoke_trigger to poll for results.", {
|
|
156
135
|
jobId: zod_1.z.string().describe("The job ID returned by invoke_trigger"),
|
|
157
136
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ jobId }) {
|
|
158
137
|
try {
|
|
@@ -176,7 +155,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
176
155
|
content: [
|
|
177
156
|
{
|
|
178
157
|
type: "text",
|
|
179
|
-
text: formatError(error, `getting job status for '${jobId}'`),
|
|
158
|
+
text: (0, _register_js_1.formatError)(error, `getting job status for '${jobId}'`),
|
|
180
159
|
},
|
|
181
160
|
],
|
|
182
161
|
isError: true,
|
|
@@ -184,7 +163,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
184
163
|
}
|
|
185
164
|
}));
|
|
186
165
|
// ── Function CRUD tools ──────────────────────────────────────────
|
|
187
|
-
|
|
166
|
+
(0, _register_js_1.registerTool)(server, "get_function", "Get a compute function by ID. Returns the full function definition including code.", {
|
|
188
167
|
functionId: zod_1.z.string().describe("The compute function ID (UUID)"),
|
|
189
168
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ functionId }) {
|
|
190
169
|
try {
|
|
@@ -200,14 +179,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
200
179
|
content: [
|
|
201
180
|
{
|
|
202
181
|
type: "text",
|
|
203
|
-
text: formatError(error, `getting function '${functionId}'`),
|
|
182
|
+
text: (0, _register_js_1.formatError)(error, `getting function '${functionId}'`),
|
|
204
183
|
},
|
|
205
184
|
],
|
|
206
185
|
isError: true,
|
|
207
186
|
};
|
|
208
187
|
}
|
|
209
188
|
}));
|
|
210
|
-
|
|
189
|
+
(0, _register_js_1.registerTool)(server, "create_function", "Create a new compute function. Compute functions are JavaScript code blocks that run server-side.", {
|
|
211
190
|
name: zod_1.z.string().describe("Display name for the function"),
|
|
212
191
|
code: zod_1.z.string().describe("JavaScript source code. Must define 'async function run() { ... }'. Globals: api, triggerParams, executionParams. Do NOT use module.exports."),
|
|
213
192
|
description: zod_1.z.string().optional().describe("Optional description of what the function does"),
|
|
@@ -242,14 +221,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
242
221
|
content: [
|
|
243
222
|
{
|
|
244
223
|
type: "text",
|
|
245
|
-
text: formatError(error, `creating function '${name}'`),
|
|
224
|
+
text: (0, _register_js_1.formatError)(error, `creating function '${name}'`),
|
|
246
225
|
},
|
|
247
226
|
],
|
|
248
227
|
isError: true,
|
|
249
228
|
};
|
|
250
229
|
}
|
|
251
230
|
}));
|
|
252
|
-
|
|
231
|
+
(0, _register_js_1.registerTool)(server, "update_function", "Update an existing compute function by ID. Only include the fields you want to change.", {
|
|
253
232
|
functionId: zod_1.z.string().describe("The compute function ID (UUID) to update"),
|
|
254
233
|
name: zod_1.z.string().optional().describe("Updated display name"),
|
|
255
234
|
description: zod_1.z.string().optional().describe("Updated description"),
|
|
@@ -289,14 +268,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
289
268
|
content: [
|
|
290
269
|
{
|
|
291
270
|
type: "text",
|
|
292
|
-
text: formatError(error, `updating function '${functionId}'`),
|
|
271
|
+
text: (0, _register_js_1.formatError)(error, `updating function '${functionId}'`),
|
|
293
272
|
},
|
|
294
273
|
],
|
|
295
274
|
isError: true,
|
|
296
275
|
};
|
|
297
276
|
}
|
|
298
277
|
}));
|
|
299
|
-
|
|
278
|
+
(0, _register_js_1.registerTool)(server, "delete_function", "Delete a compute function by ID.", {
|
|
300
279
|
functionId: zod_1.z.string().describe("The compute function ID (UUID) to delete"),
|
|
301
280
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ functionId }) {
|
|
302
281
|
try {
|
|
@@ -315,14 +294,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
315
294
|
content: [
|
|
316
295
|
{
|
|
317
296
|
type: "text",
|
|
318
|
-
text: formatError(error, `deleting function '${functionId}'`),
|
|
297
|
+
text: (0, _register_js_1.formatError)(error, `deleting function '${functionId}'`),
|
|
319
298
|
},
|
|
320
299
|
],
|
|
321
300
|
isError: true,
|
|
322
301
|
};
|
|
323
302
|
}
|
|
324
303
|
}));
|
|
325
|
-
|
|
304
|
+
(0, _register_js_1.registerTool)(server, "test_function", "Test execute code without saving it as a function. Useful for validating function code before creating or updating.", {
|
|
326
305
|
code: zod_1.z.string().describe("JavaScript code to test. Must define 'async function run() { ... }'. Globals: api, triggerParams, executionParams. Do NOT use module.exports."),
|
|
327
306
|
params: zod_1.z
|
|
328
307
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
@@ -359,7 +338,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
359
338
|
content: [
|
|
360
339
|
{
|
|
361
340
|
type: "text",
|
|
362
|
-
text: formatError(error, "test-executing function"),
|
|
341
|
+
text: (0, _register_js_1.formatError)(error, "test-executing function"),
|
|
363
342
|
},
|
|
364
343
|
],
|
|
365
344
|
isError: true,
|
|
@@ -367,7 +346,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
367
346
|
}
|
|
368
347
|
}));
|
|
369
348
|
// ── Trigger CRUD tools ───────────────────────────────────────────
|
|
370
|
-
|
|
349
|
+
(0, _register_js_1.registerTool)(server, "get_trigger", "Get a function trigger by ID. Returns full trigger details including execution type and metadata.", {
|
|
371
350
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID)"),
|
|
372
351
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ triggerId }) {
|
|
373
352
|
try {
|
|
@@ -383,14 +362,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
383
362
|
content: [
|
|
384
363
|
{
|
|
385
364
|
type: "text",
|
|
386
|
-
text: formatError(error, `getting trigger '${triggerId}'`),
|
|
365
|
+
text: (0, _register_js_1.formatError)(error, `getting trigger '${triggerId}'`),
|
|
387
366
|
},
|
|
388
367
|
],
|
|
389
368
|
isError: true,
|
|
390
369
|
};
|
|
391
370
|
}
|
|
392
371
|
}));
|
|
393
|
-
|
|
372
|
+
(0, _register_js_1.registerTool)(server, "create_trigger", "Create a new function trigger. Triggers define how and when a compute function is executed.", {
|
|
394
373
|
name: zod_1.z.string().describe("Display name for the trigger"),
|
|
395
374
|
functionId: zod_1.z.string().describe("The compute function ID (UUID) to execute"),
|
|
396
375
|
executionType: zod_1.z
|
|
@@ -400,7 +379,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
400
379
|
triggerMetadata: zod_1.z
|
|
401
380
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
402
381
|
.optional()
|
|
403
|
-
.describe("Type-specific configuration. For event-driven: { eventType, recordSlug }. For scheduled: { scheduleType, cronExpression, timezone }. For http-trigger: auto-generated URL. For endpoint: { path, allowedMethods?, timeoutMs?, auth? } where path is URL-safe (e.g., 'create-order'), allowedMethods defaults to ['POST'], timeoutMs 1000-30000 (default 30000), auth is { mode: 'bearer'|'public'|'apiKey'|'hmac' }."),
|
|
382
|
+
.describe("Type-specific configuration. For event-driven: { eventType, recordSlug }. For scheduled: { scheduleType, cronExpression, timezone }. For http-trigger: auto-generated URL. For endpoint: { path, allowedMethods?, timeoutMs?, auth? } where path is URL-safe (e.g., 'create-order'), allowedMethods defaults to ['POST'], timeoutMs 1000-30000 (default 30000), auth is { mode: 'bearer'|'public'|'apiKey'|'hmac' }. All trigger types accept params: a dictionary of static values passed to the function as triggerParams. Mark any secret with { value: 'plaintext', encrypt: true } to store it AES-256-GCM-encrypted at rest; it arrives as plaintext in triggerParams at execution time."),
|
|
404
383
|
enabled: zod_1.z.boolean().optional().describe("Whether the trigger is enabled (default: true)"),
|
|
405
384
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ name, functionId, executionType, description, triggerMetadata, enabled }) {
|
|
406
385
|
try {
|
|
@@ -423,14 +402,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
423
402
|
content: [
|
|
424
403
|
{
|
|
425
404
|
type: "text",
|
|
426
|
-
text: formatError(error, `creating trigger '${name}'`),
|
|
405
|
+
text: (0, _register_js_1.formatError)(error, `creating trigger '${name}'`),
|
|
427
406
|
},
|
|
428
407
|
],
|
|
429
408
|
isError: true,
|
|
430
409
|
};
|
|
431
410
|
}
|
|
432
411
|
}));
|
|
433
|
-
|
|
412
|
+
(0, _register_js_1.registerTool)(server, "update_trigger", "Update an existing function trigger by ID. Only include the fields you want to change.", {
|
|
434
413
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID) to update"),
|
|
435
414
|
name: zod_1.z.string().optional().describe("Updated display name"),
|
|
436
415
|
description: zod_1.z.string().optional().describe("Updated description"),
|
|
@@ -438,7 +417,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
438
417
|
triggerMetadata: zod_1.z
|
|
439
418
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
440
419
|
.optional()
|
|
441
|
-
.describe("Updated type-specific configuration"),
|
|
420
|
+
.describe("Updated type-specific configuration. To rotate an encrypted params value, send params: { KEY: { value: 'new-plaintext', encrypt: true } }. To preserve an existing encrypted value without rotating, echo back the stored shape: params: { KEY: { value: '********', encrypted: true, keyVersion: N } } (use get_trigger to read the current shape). Omit a key from params entirely to remove it."),
|
|
442
421
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ triggerId, name, description, enabled, triggerMetadata }) {
|
|
443
422
|
try {
|
|
444
423
|
const input = {};
|
|
@@ -462,14 +441,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
462
441
|
content: [
|
|
463
442
|
{
|
|
464
443
|
type: "text",
|
|
465
|
-
text: formatError(error, `updating trigger '${triggerId}'`),
|
|
444
|
+
text: (0, _register_js_1.formatError)(error, `updating trigger '${triggerId}'`),
|
|
466
445
|
},
|
|
467
446
|
],
|
|
468
447
|
isError: true,
|
|
469
448
|
};
|
|
470
449
|
}
|
|
471
450
|
}));
|
|
472
|
-
|
|
451
|
+
(0, _register_js_1.registerTool)(server, "delete_trigger", "Delete a function trigger by ID.", {
|
|
473
452
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID) to delete"),
|
|
474
453
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ triggerId }) {
|
|
475
454
|
try {
|
|
@@ -488,14 +467,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
488
467
|
content: [
|
|
489
468
|
{
|
|
490
469
|
type: "text",
|
|
491
|
-
text: formatError(error, `deleting trigger '${triggerId}'`),
|
|
470
|
+
text: (0, _register_js_1.formatError)(error, `deleting trigger '${triggerId}'`),
|
|
492
471
|
},
|
|
493
472
|
],
|
|
494
473
|
isError: true,
|
|
495
474
|
};
|
|
496
475
|
}
|
|
497
476
|
}));
|
|
498
|
-
|
|
477
|
+
(0, _register_js_1.registerTool)(server, "pause_trigger", "Pause a function trigger. Paused triggers will not fire until resumed.", {
|
|
499
478
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID) to pause"),
|
|
500
479
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ triggerId }) {
|
|
501
480
|
try {
|
|
@@ -511,14 +490,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
511
490
|
content: [
|
|
512
491
|
{
|
|
513
492
|
type: "text",
|
|
514
|
-
text: formatError(error, `pausing trigger '${triggerId}'`),
|
|
493
|
+
text: (0, _register_js_1.formatError)(error, `pausing trigger '${triggerId}'`),
|
|
515
494
|
},
|
|
516
495
|
],
|
|
517
496
|
isError: true,
|
|
518
497
|
};
|
|
519
498
|
}
|
|
520
499
|
}));
|
|
521
|
-
|
|
500
|
+
(0, _register_js_1.registerTool)(server, "resume_trigger", "Resume a paused function trigger. The trigger will start firing again on matching events or schedules.", {
|
|
522
501
|
triggerId: zod_1.z.string().describe("The trigger ID (UUID) to resume"),
|
|
523
502
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ triggerId }) {
|
|
524
503
|
try {
|
|
@@ -534,7 +513,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
534
513
|
content: [
|
|
535
514
|
{
|
|
536
515
|
type: "text",
|
|
537
|
-
text: formatError(error, `resuming trigger '${triggerId}'`),
|
|
516
|
+
text: (0, _register_js_1.formatError)(error, `resuming trigger '${triggerId}'`),
|
|
538
517
|
},
|
|
539
518
|
],
|
|
540
519
|
isError: true,
|
|
@@ -542,7 +521,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
542
521
|
}
|
|
543
522
|
}));
|
|
544
523
|
// ── Function Runs tools ────────────────────────────────────────────
|
|
545
|
-
|
|
524
|
+
(0, _register_js_1.registerTool)(server, "get_function_run", "Get a function run by ID. Returns status, output, error, timing, and execution metadata. Use this to check the result of an async trigger invocation or test execution.", {
|
|
546
525
|
runId: zod_1.z.string().describe("The function run ID (UUID)"),
|
|
547
526
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ runId }) {
|
|
548
527
|
try {
|
|
@@ -558,14 +537,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
558
537
|
content: [
|
|
559
538
|
{
|
|
560
539
|
type: "text",
|
|
561
|
-
text: formatError(error, `getting function run '${runId}'`),
|
|
540
|
+
text: (0, _register_js_1.formatError)(error, `getting function run '${runId}'`),
|
|
562
541
|
},
|
|
563
542
|
],
|
|
564
543
|
isError: true,
|
|
565
544
|
};
|
|
566
545
|
}
|
|
567
546
|
}));
|
|
568
|
-
|
|
547
|
+
(0, _register_js_1.registerTool)(server, "list_function_runs", "List function runs filtered by trigger ID or function ID. Returns execution history with status, timing, and errors. Useful for checking whether a trigger invocation completed and what it returned.", {
|
|
569
548
|
triggerId: zod_1.z.string().optional().describe("Filter runs by trigger ID (UUID)"),
|
|
570
549
|
functionId: zod_1.z.string().optional().describe("Filter runs by function ID (UUID)"),
|
|
571
550
|
status: zod_1.z
|
|
@@ -609,7 +588,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
609
588
|
content: [
|
|
610
589
|
{
|
|
611
590
|
type: "text",
|
|
612
|
-
text: formatError(error, `listing function runs`),
|
|
591
|
+
text: (0, _register_js_1.formatError)(error, `listing function runs`),
|
|
613
592
|
},
|
|
614
593
|
],
|
|
615
594
|
isError: true,
|
|
@@ -617,7 +596,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
617
596
|
}
|
|
618
597
|
}));
|
|
619
598
|
// ── Endpoint Trigger (Sync Execution) ─────────────────────────────
|
|
620
|
-
|
|
599
|
+
(0, _register_js_1.registerTool)(server, "invoke_endpoint", "Invoke a compute endpoint trigger by path. The function executes synchronously — Centrali waits for the function to complete and returns its output directly in the response. No polling needed. Max execution time: 30 seconds (configurable via triggerMetadata.timeoutMs, range 1–30s). If the function exceeds the timeout, returns 504. Endpoint triggers must be created first with executionType='endpoint'. Use this for real-time API responses; use invoke_trigger for long-running background work that doesn't need an immediate response.", {
|
|
621
600
|
path: zod_1.z.string().describe("The endpoint path (e.g., 'create-order', 'webhook/shipments'). This is set in the trigger's triggerMetadata.path."),
|
|
622
601
|
method: zod_1.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().describe("HTTP method (default: POST). Must be in the trigger's allowedMethods."),
|
|
623
602
|
payload: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Request body payload (sent as JSON)"),
|
|
@@ -659,13 +638,13 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
659
638
|
}
|
|
660
639
|
catch (error) {
|
|
661
640
|
return {
|
|
662
|
-
content: [{ type: "text", text: formatError(error, `invoking endpoint '${path}'`) }],
|
|
641
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `invoking endpoint '${path}'`) }],
|
|
663
642
|
isError: true,
|
|
664
643
|
};
|
|
665
644
|
}
|
|
666
645
|
}));
|
|
667
646
|
// ── Allowed Domains tools ──────────────────────────────────────────
|
|
668
|
-
|
|
647
|
+
(0, _register_js_1.registerTool)(server, "list_allowed_domains", "List all allowed domains for compute function HTTP requests. Functions can only call external APIs on domains in this allowlist.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
669
648
|
try {
|
|
670
649
|
const result = yield sdk.allowedDomains.list();
|
|
671
650
|
return {
|
|
@@ -679,14 +658,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
679
658
|
content: [
|
|
680
659
|
{
|
|
681
660
|
type: "text",
|
|
682
|
-
text: formatError(error, "listing allowed domains"),
|
|
661
|
+
text: (0, _register_js_1.formatError)(error, "listing allowed domains"),
|
|
683
662
|
},
|
|
684
663
|
],
|
|
685
664
|
isError: true,
|
|
686
665
|
};
|
|
687
666
|
}
|
|
688
667
|
}));
|
|
689
|
-
|
|
668
|
+
(0, _register_js_1.registerTool)(server, "add_allowed_domain", "Add a domain to the allowlist so compute functions can make HTTP requests to it. Supports wildcards (e.g., '*.example.com').", {
|
|
690
669
|
domain: zod_1.z.string().describe("Domain to allow (e.g., 'api.stripe.com' or '*.googleapis.com')"),
|
|
691
670
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ domain }) {
|
|
692
671
|
try {
|
|
@@ -702,14 +681,14 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
702
681
|
content: [
|
|
703
682
|
{
|
|
704
683
|
type: "text",
|
|
705
|
-
text: formatError(error, `adding allowed domain '${domain}'`),
|
|
684
|
+
text: (0, _register_js_1.formatError)(error, `adding allowed domain '${domain}'`),
|
|
706
685
|
},
|
|
707
686
|
],
|
|
708
687
|
isError: true,
|
|
709
688
|
};
|
|
710
689
|
}
|
|
711
690
|
}));
|
|
712
|
-
|
|
691
|
+
(0, _register_js_1.registerTool)(server, "remove_allowed_domain", "Remove a domain from the allowlist. Compute functions will no longer be able to call this domain.", {
|
|
713
692
|
domainId: zod_1.z.string().describe("The allowed domain ID (UUID) to remove"),
|
|
714
693
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ domainId }) {
|
|
715
694
|
try {
|
|
@@ -728,7 +707,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
728
707
|
content: [
|
|
729
708
|
{
|
|
730
709
|
type: "text",
|
|
731
|
-
text: formatError(error, `removing allowed domain '${domainId}'`),
|
|
710
|
+
text: (0, _register_js_1.formatError)(error, `removing allowed domain '${domainId}'`),
|
|
732
711
|
},
|
|
733
712
|
],
|
|
734
713
|
isError: true,
|
|
@@ -736,7 +715,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
736
715
|
}
|
|
737
716
|
}));
|
|
738
717
|
// ── Scaffold (function + trigger in one step) ─────────────────────
|
|
739
|
-
|
|
718
|
+
(0, _register_js_1.registerTool)(server, "scaffold_function", "Create a compute function with boilerplate code and optionally wire a trigger — all in one step. The function uses the required `async function run()` pattern with `api.*` globals, `triggerParams`, and `executionParams` available.", {
|
|
740
719
|
name: zod_1.z.string().describe("Function name"),
|
|
741
720
|
description: zod_1.z.string().optional().describe("Function description"),
|
|
742
721
|
code: zod_1.z.string().describe("Function code. Must use `async function run() { ... }` pattern. Has access to `api` (data operations), `triggerParams` (static config), and `executionParams` (runtime parameters)."),
|
|
@@ -846,7 +825,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
846
825
|
` ID: ${fnId}`,
|
|
847
826
|
` Name: ${name}`,
|
|
848
827
|
``,
|
|
849
|
-
formatError(triggerError, "creating trigger"),
|
|
828
|
+
(0, _register_js_1.formatError)(triggerError, "creating trigger"),
|
|
850
829
|
``,
|
|
851
830
|
`The function was created successfully but the trigger failed. You can retry with create_trigger using functionId '${fnId}'.`,
|
|
852
831
|
].join("\n"),
|
|
@@ -895,7 +874,7 @@ function registerComputeTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
895
874
|
content: [
|
|
896
875
|
{
|
|
897
876
|
type: "text",
|
|
898
|
-
text: formatError(error, `scaffolding function '${name}'`),
|
|
877
|
+
text: (0, _register_js_1.formatError)(error, `scaffolding function '${name}'`),
|
|
899
878
|
},
|
|
900
879
|
],
|
|
901
880
|
isError: true,
|