@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/records.js
CHANGED
|
@@ -15,28 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.registerRecordTools = registerRecordTools;
|
|
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
|
*/
|
|
@@ -90,7 +69,7 @@ function createRecordsClient(sdk, centraliUrl, workspaceId, recordSlug) {
|
|
|
90
69
|
return client;
|
|
91
70
|
}
|
|
92
71
|
function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
93
|
-
|
|
72
|
+
(0, _register_js_1.registerTool)(server, "query_records", "Query records from a collection with optional filters, sorting, pagination, and date range filtering. Filters use 'data.' prefix for custom fields and bracket notation for operators (e.g., 'data.status': 'active', 'data.price[lte]': 100). Use dateWindow for date range queries.", {
|
|
94
73
|
recordSlug: zod_1.z
|
|
95
74
|
.string()
|
|
96
75
|
.describe("The collection's record slug (e.g., 'orders')"),
|
|
@@ -150,14 +129,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
150
129
|
content: [
|
|
151
130
|
{
|
|
152
131
|
type: "text",
|
|
153
|
-
text: formatError(error, `querying records from '${recordSlug}'`),
|
|
132
|
+
text: (0, _register_js_1.formatError)(error, `querying records from '${recordSlug}'`),
|
|
154
133
|
},
|
|
155
134
|
],
|
|
156
135
|
isError: true,
|
|
157
136
|
};
|
|
158
137
|
}
|
|
159
138
|
}));
|
|
160
|
-
|
|
139
|
+
(0, _register_js_1.registerTool)(server, "get_record", "Get a single record by its ID from a collection. Optionally expand reference fields.", {
|
|
161
140
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
162
141
|
id: zod_1.z.string().describe("The record ID (UUID)"),
|
|
163
142
|
expand: zod_1.z
|
|
@@ -179,14 +158,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
179
158
|
content: [
|
|
180
159
|
{
|
|
181
160
|
type: "text",
|
|
182
|
-
text: formatError(error, `getting record '${id}' from '${recordSlug}'`),
|
|
161
|
+
text: (0, _register_js_1.formatError)(error, `getting record '${id}' from '${recordSlug}'`),
|
|
183
162
|
},
|
|
184
163
|
],
|
|
185
164
|
isError: true,
|
|
186
165
|
};
|
|
187
166
|
}
|
|
188
167
|
}));
|
|
189
|
-
|
|
168
|
+
(0, _register_js_1.registerTool)(server, "create_record", "Create a new record in a collection. Pass the record data as a JSON object with field names matching the collection's properties.", {
|
|
190
169
|
recordSlug: zod_1.z
|
|
191
170
|
.string()
|
|
192
171
|
.describe("The collection's record slug (e.g., 'orders')"),
|
|
@@ -207,14 +186,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
207
186
|
content: [
|
|
208
187
|
{
|
|
209
188
|
type: "text",
|
|
210
|
-
text: formatError(error, `creating record in '${recordSlug}'`),
|
|
189
|
+
text: (0, _register_js_1.formatError)(error, `creating record in '${recordSlug}'`),
|
|
211
190
|
},
|
|
212
191
|
],
|
|
213
192
|
isError: true,
|
|
214
193
|
};
|
|
215
194
|
}
|
|
216
195
|
}));
|
|
217
|
-
|
|
196
|
+
(0, _register_js_1.registerTool)(server, "update_record", "Update an existing record by ID. Only include the fields you want to change.", {
|
|
218
197
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
219
198
|
id: zod_1.z.string().describe("The record ID (UUID) to update"),
|
|
220
199
|
data: zod_1.z
|
|
@@ -234,14 +213,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
234
213
|
content: [
|
|
235
214
|
{
|
|
236
215
|
type: "text",
|
|
237
|
-
text: formatError(error, `updating record '${id}' in '${recordSlug}'`),
|
|
216
|
+
text: (0, _register_js_1.formatError)(error, `updating record '${id}' in '${recordSlug}'`),
|
|
238
217
|
},
|
|
239
218
|
],
|
|
240
219
|
isError: true,
|
|
241
220
|
};
|
|
242
221
|
}
|
|
243
222
|
}));
|
|
244
|
-
|
|
223
|
+
(0, _register_js_1.registerTool)(server, "delete_record", "Delete a record by ID. Performs a soft delete by default (can be restored). Set hard=true for permanent deletion.", {
|
|
245
224
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
246
225
|
id: zod_1.z.string().describe("The record ID (UUID) to delete"),
|
|
247
226
|
hard: zod_1.z
|
|
@@ -267,14 +246,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
267
246
|
content: [
|
|
268
247
|
{
|
|
269
248
|
type: "text",
|
|
270
|
-
text: formatError(error, `deleting record '${id}' from '${recordSlug}'`),
|
|
249
|
+
text: (0, _register_js_1.formatError)(error, `deleting record '${id}' from '${recordSlug}'`),
|
|
271
250
|
},
|
|
272
251
|
],
|
|
273
252
|
isError: true,
|
|
274
253
|
};
|
|
275
254
|
}
|
|
276
255
|
}));
|
|
277
|
-
|
|
256
|
+
(0, _register_js_1.registerTool)(server, "upsert_record", "Create or update a record atomically. Matches on the provided fields to find an existing record — updates it if found, creates it if not. Returns the record and whether it was 'created' or 'updated'.", {
|
|
278
257
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
279
258
|
match: zod_1.z
|
|
280
259
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
@@ -297,13 +276,13 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
297
276
|
catch (error) {
|
|
298
277
|
return {
|
|
299
278
|
content: [
|
|
300
|
-
{ type: "text", text: formatError(error, `upserting record in '${recordSlug}'`) },
|
|
279
|
+
{ type: "text", text: (0, _register_js_1.formatError)(error, `upserting record in '${recordSlug}'`) },
|
|
301
280
|
],
|
|
302
281
|
isError: true,
|
|
303
282
|
};
|
|
304
283
|
}
|
|
305
284
|
}));
|
|
306
|
-
|
|
285
|
+
(0, _register_js_1.registerTool)(server, "get_records_by_ids", "Fetch multiple records by their IDs in a single request. Returns an array of records.", {
|
|
307
286
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
308
287
|
ids: zod_1.z.array(zod_1.z.string()).describe("Array of record IDs (UUIDs) to fetch"),
|
|
309
288
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ recordSlug, ids }) {
|
|
@@ -316,13 +295,13 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
316
295
|
catch (error) {
|
|
317
296
|
return {
|
|
318
297
|
content: [
|
|
319
|
-
{ type: "text", text: formatError(error, `fetching records by IDs from '${recordSlug}'`) },
|
|
298
|
+
{ type: "text", text: (0, _register_js_1.formatError)(error, `fetching records by IDs from '${recordSlug}'`) },
|
|
320
299
|
],
|
|
321
300
|
isError: true,
|
|
322
301
|
};
|
|
323
302
|
}
|
|
324
303
|
}));
|
|
325
|
-
|
|
304
|
+
(0, _register_js_1.registerTool)(server, "restore_record", "Restore a soft-deleted record by ID. Only works on records deleted without hard=true.", {
|
|
326
305
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
327
306
|
id: zod_1.z.string().describe("The record ID (UUID) to restore"),
|
|
328
307
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ recordSlug, id }) {
|
|
@@ -337,14 +316,14 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
337
316
|
catch (error) {
|
|
338
317
|
return {
|
|
339
318
|
content: [
|
|
340
|
-
{ type: "text", text: formatError(error, `restoring record '${id}' in '${recordSlug}'`) },
|
|
319
|
+
{ type: "text", text: (0, _register_js_1.formatError)(error, `restoring record '${id}' in '${recordSlug}'`) },
|
|
341
320
|
],
|
|
342
321
|
isError: true,
|
|
343
322
|
};
|
|
344
323
|
}
|
|
345
324
|
}));
|
|
346
325
|
// ── Bulk Operations (1 aggregate event per operation) ───────────────
|
|
347
|
-
|
|
326
|
+
(0, _register_js_1.registerTool)(server, "bulk_create_records", `Bulk create multiple records in a collection. All records are created in a single transaction. Publishes ONE aggregate 'records_bulk_created' event (not one per record). Use this when downstream triggers should process all records together as a batch. Max 1000 records per call. For individual events per record, use batch_create_records instead.`, {
|
|
348
327
|
recordSlug: zod_1.z.string().describe("The collection's record slug (e.g., 'orders')"),
|
|
349
328
|
records: zod_1.z
|
|
350
329
|
.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any()))
|
|
@@ -359,12 +338,12 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
359
338
|
}
|
|
360
339
|
catch (error) {
|
|
361
340
|
return {
|
|
362
|
-
content: [{ type: "text", text: formatError(error, `bulk creating records in '${recordSlug}'`) }],
|
|
341
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `bulk creating records in '${recordSlug}'`) }],
|
|
363
342
|
isError: true,
|
|
364
343
|
};
|
|
365
344
|
}
|
|
366
345
|
}));
|
|
367
|
-
|
|
346
|
+
(0, _register_js_1.registerTool)(server, "bulk_update_records", `Bulk update multiple records with the same data. All records are updated in a single transaction. Publishes ONE aggregate 'records_bulk_updated' event (not one per record). Use this when all records need the same change and downstream triggers should process them together. For different data per record or individual events, use batch_update_records instead.`, {
|
|
368
347
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
369
348
|
ids: zod_1.z.array(zod_1.z.string()).describe("Array of record IDs (UUIDs) to update"),
|
|
370
349
|
data: zod_1.z
|
|
@@ -380,12 +359,12 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
380
359
|
}
|
|
381
360
|
catch (error) {
|
|
382
361
|
return {
|
|
383
|
-
content: [{ type: "text", text: formatError(error, `bulk updating records in '${recordSlug}'`) }],
|
|
362
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `bulk updating records in '${recordSlug}'`) }],
|
|
384
363
|
isError: true,
|
|
385
364
|
};
|
|
386
365
|
}
|
|
387
366
|
}));
|
|
388
|
-
|
|
367
|
+
(0, _register_js_1.registerTool)(server, "bulk_delete_records", `Bulk delete multiple records. All records are deleted in a single transaction. Publishes ONE aggregate 'records_bulk_deleted' event (not one per record). Use this when downstream triggers should process all deletions together. For individual events per deletion, use batch_delete_records instead.`, {
|
|
389
368
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
390
369
|
ids: zod_1.z.array(zod_1.z.string()).describe("Array of record IDs (UUIDs) to delete"),
|
|
391
370
|
hard: zod_1.z
|
|
@@ -411,13 +390,13 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
411
390
|
}
|
|
412
391
|
catch (error) {
|
|
413
392
|
return {
|
|
414
|
-
content: [{ type: "text", text: formatError(error, `bulk deleting records from '${recordSlug}'`) }],
|
|
393
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `bulk deleting records from '${recordSlug}'`) }],
|
|
415
394
|
isError: true,
|
|
416
395
|
};
|
|
417
396
|
}
|
|
418
397
|
}));
|
|
419
398
|
// ── Batch Operations (1 event per record) ──────────────────────────
|
|
420
|
-
|
|
399
|
+
(0, _register_js_1.registerTool)(server, "batch_create_records", `Create multiple records individually. Each record gets its own 'record_created' event. Use this when downstream triggers (functions, webhooks, orchestrations) should process each record separately. Supports partial failure — some records can succeed even if others fail. For a single aggregate event, use bulk_create_records instead.`, {
|
|
421
400
|
recordSlug: zod_1.z.string().describe("The collection's record slug (e.g., 'orders')"),
|
|
422
401
|
records: zod_1.z
|
|
423
402
|
.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any()))
|
|
@@ -439,12 +418,12 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
439
418
|
}
|
|
440
419
|
catch (error) {
|
|
441
420
|
return {
|
|
442
|
-
content: [{ type: "text", text: formatError(error, `batch creating records in '${recordSlug}'`) }],
|
|
421
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `batch creating records in '${recordSlug}'`) }],
|
|
443
422
|
isError: true,
|
|
444
423
|
};
|
|
445
424
|
}
|
|
446
425
|
}));
|
|
447
|
-
|
|
426
|
+
(0, _register_js_1.registerTool)(server, "batch_update_records", `Update multiple records individually with different data per record. Each record gets its own 'record_updated' event. Use this when each record needs different changes and downstream triggers should process each update separately. For the same change applied to all records with a single event, use bulk_update_records instead.`, {
|
|
448
427
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
449
428
|
updates: zod_1.z
|
|
450
429
|
.array(zod_1.z.object({
|
|
@@ -464,12 +443,12 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
464
443
|
}
|
|
465
444
|
catch (error) {
|
|
466
445
|
return {
|
|
467
|
-
content: [{ type: "text", text: formatError(error, `batch updating records in '${recordSlug}'`) }],
|
|
446
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `batch updating records in '${recordSlug}'`) }],
|
|
468
447
|
isError: true,
|
|
469
448
|
};
|
|
470
449
|
}
|
|
471
450
|
}));
|
|
472
|
-
|
|
451
|
+
(0, _register_js_1.registerTool)(server, "batch_delete_records", `Delete multiple records individually. Each record gets its own 'record_deleted' event. Use this when downstream triggers should process each deletion separately. For a single aggregate event, use bulk_delete_records instead.`, {
|
|
473
452
|
recordSlug: zod_1.z.string().describe("The collection's record slug"),
|
|
474
453
|
ids: zod_1.z.array(zod_1.z.string()).describe("Array of record IDs (UUIDs) to delete"),
|
|
475
454
|
}, (_a) => __awaiter(this, [_a], void 0, function* ({ recordSlug, ids }) {
|
|
@@ -487,7 +466,7 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
487
466
|
}
|
|
488
467
|
catch (error) {
|
|
489
468
|
return {
|
|
490
|
-
content: [{ type: "text", text: formatError(error, `batch deleting records from '${recordSlug}'`) }],
|
|
469
|
+
content: [{ type: "text", text: (0, _register_js_1.formatError)(error, `batch deleting records from '${recordSlug}'`) }],
|
|
491
470
|
isError: true,
|
|
492
471
|
};
|
|
493
472
|
}
|
package/dist/tools/search.js
CHANGED
|
@@ -11,30 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.registerSearchTools = registerSearchTools;
|
|
13
13
|
const zod_1 = require("zod");
|
|
14
|
-
|
|
15
|
-
var _a, _b;
|
|
16
|
-
if (error && typeof error === 'object') {
|
|
17
|
-
const e = error;
|
|
18
|
-
if ('message' in e) {
|
|
19
|
-
let msg = `Error ${context}`;
|
|
20
|
-
if ('code' in e || 'status' in e) {
|
|
21
|
-
msg += `: [${(_b = (_a = e.code) !== null && _a !== void 0 ? _a : e.status) !== null && _b !== void 0 ? _b : 'ERROR'}] ${e.message}`;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
msg += `: ${e.message}`;
|
|
25
|
-
}
|
|
26
|
-
if (Array.isArray(e.fieldErrors) && e.fieldErrors.length > 0) {
|
|
27
|
-
msg += '\nField errors:\n' + e.fieldErrors
|
|
28
|
-
.map(f => ` ${f.field}: ${f.message}`)
|
|
29
|
-
.join('\n');
|
|
30
|
-
}
|
|
31
|
-
return msg;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return `Error ${context}: ${error instanceof Error ? error.message : String(error)}`;
|
|
35
|
-
}
|
|
14
|
+
const _register_js_1 = require("./_register.js");
|
|
36
15
|
function registerSearchTools(server, sdk) {
|
|
37
|
-
|
|
16
|
+
(0, _register_js_1.registerTool)(server, "search_records", "Full-text search across records in the workspace. Powered by Meilisearch. Optionally filter by collection(s) and limit results.", {
|
|
38
17
|
query: zod_1.z.string().describe("The search query string"),
|
|
39
18
|
collections: zod_1.z
|
|
40
19
|
.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())])
|
|
@@ -64,7 +43,7 @@ function registerSearchTools(server, sdk) {
|
|
|
64
43
|
content: [
|
|
65
44
|
{
|
|
66
45
|
type: "text",
|
|
67
|
-
text: formatError(error, "searching records"),
|
|
46
|
+
text: (0, _register_js_1.formatError)(error, "searching records"),
|
|
68
47
|
},
|
|
69
48
|
],
|
|
70
49
|
isError: true,
|