@vectros-ai/mcp-server 0.16.0 → 0.17.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/CHANGELOG.md +161 -0
- package/README.md +83 -10
- package/dist/cli-http.js +1390 -302
- package/dist/cli-http.js.map +1 -1
- package/dist/cli-http.mjs +1401 -313
- package/dist/cli-http.mjs.map +1 -1
- package/dist/cli.js +1390 -302
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1401 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1390 -302
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1401 -313
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
42
42
|
// src/server.ts
|
|
43
43
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
44
44
|
|
|
45
|
-
// node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
45
|
+
// ../../node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
46
46
|
var __defProp2 = Object.defineProperty;
|
|
47
47
|
var __export2 = (target, all) => {
|
|
48
48
|
for (var name in all)
|
|
@@ -76,6 +76,7 @@ __export2(api_exports, {
|
|
|
76
76
|
FieldDef: () => FieldDef,
|
|
77
77
|
FileUploadRequest: () => FileUploadRequest,
|
|
78
78
|
ForbiddenError: () => ForbiddenError,
|
|
79
|
+
GatewayTimeoutError: () => GatewayTimeoutError,
|
|
79
80
|
IdentityLookupRequest: () => IdentityLookupRequest,
|
|
80
81
|
IndexFailure: () => IndexFailure,
|
|
81
82
|
InternalServerError: () => InternalServerError,
|
|
@@ -100,9 +101,12 @@ __export2(api_exports, {
|
|
|
100
101
|
SearchRequest: () => SearchRequest,
|
|
101
102
|
SearchResult: () => SearchResult,
|
|
102
103
|
SearchResultsEvent: () => SearchResultsEvent,
|
|
104
|
+
ServiceUnavailableError: () => ServiceUnavailableError,
|
|
103
105
|
TooManyRequestsError: () => TooManyRequestsError,
|
|
106
|
+
TriggerFailureResponse: () => TriggerFailureResponse,
|
|
104
107
|
TruncationWarningEvent: () => TruncationWarningEvent,
|
|
105
108
|
UnauthorizedError: () => UnauthorizedError,
|
|
109
|
+
UnprocessableEntityError: () => UnprocessableEntityError,
|
|
106
110
|
UserExistsResponse: () => UserExistsResponse,
|
|
107
111
|
UserRequest: () => UserRequest,
|
|
108
112
|
UserResponse: () => UserResponse,
|
|
@@ -114,7 +118,9 @@ __export2(api_exports, {
|
|
|
114
118
|
inference: () => inference_exports,
|
|
115
119
|
records: () => records_exports,
|
|
116
120
|
schemas: () => schemas_exports,
|
|
117
|
-
|
|
121
|
+
scripts: () => scripts_exports,
|
|
122
|
+
search: () => search_exports,
|
|
123
|
+
triggers: () => triggers_exports
|
|
118
124
|
});
|
|
119
125
|
var toJson = (value, replacer, space) => {
|
|
120
126
|
return JSON.stringify(value, replacer, space);
|
|
@@ -234,6 +240,21 @@ var ForbiddenError = class extends VectrosError {
|
|
|
234
240
|
this.name = this.constructor.name;
|
|
235
241
|
}
|
|
236
242
|
};
|
|
243
|
+
var GatewayTimeoutError = class extends VectrosError {
|
|
244
|
+
constructor(body, rawResponse) {
|
|
245
|
+
super({
|
|
246
|
+
message: "GatewayTimeoutError",
|
|
247
|
+
statusCode: 504,
|
|
248
|
+
body,
|
|
249
|
+
rawResponse
|
|
250
|
+
});
|
|
251
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
252
|
+
if (Error.captureStackTrace) {
|
|
253
|
+
Error.captureStackTrace(this, this.constructor);
|
|
254
|
+
}
|
|
255
|
+
this.name = this.constructor.name;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
237
258
|
var InternalServerError = class extends VectrosError {
|
|
238
259
|
constructor(body, rawResponse) {
|
|
239
260
|
super({
|
|
@@ -294,6 +315,21 @@ var PaymentRequiredError = class extends VectrosError {
|
|
|
294
315
|
this.name = this.constructor.name;
|
|
295
316
|
}
|
|
296
317
|
};
|
|
318
|
+
var ServiceUnavailableError = class extends VectrosError {
|
|
319
|
+
constructor(body, rawResponse) {
|
|
320
|
+
super({
|
|
321
|
+
message: "ServiceUnavailableError",
|
|
322
|
+
statusCode: 503,
|
|
323
|
+
body,
|
|
324
|
+
rawResponse
|
|
325
|
+
});
|
|
326
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
327
|
+
if (Error.captureStackTrace) {
|
|
328
|
+
Error.captureStackTrace(this, this.constructor);
|
|
329
|
+
}
|
|
330
|
+
this.name = this.constructor.name;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
297
333
|
var TooManyRequestsError = class extends VectrosError {
|
|
298
334
|
constructor(body, rawResponse) {
|
|
299
335
|
super({
|
|
@@ -324,6 +360,21 @@ var UnauthorizedError = class extends VectrosError {
|
|
|
324
360
|
this.name = this.constructor.name;
|
|
325
361
|
}
|
|
326
362
|
};
|
|
363
|
+
var UnprocessableEntityError = class extends VectrosError {
|
|
364
|
+
constructor(body, rawResponse) {
|
|
365
|
+
super({
|
|
366
|
+
message: "UnprocessableEntityError",
|
|
367
|
+
statusCode: 422,
|
|
368
|
+
body,
|
|
369
|
+
rawResponse
|
|
370
|
+
});
|
|
371
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
372
|
+
if (Error.captureStackTrace) {
|
|
373
|
+
Error.captureStackTrace(this, this.constructor);
|
|
374
|
+
}
|
|
375
|
+
this.name = this.constructor.name;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
327
378
|
var auth_exports = {};
|
|
328
379
|
var ErasureRequest;
|
|
329
380
|
((ErasureRequest2) => {
|
|
@@ -413,6 +464,7 @@ var LookupRecordsRequestOrder = {
|
|
|
413
464
|
Desc: "desc"
|
|
414
465
|
};
|
|
415
466
|
var schemas_exports = {};
|
|
467
|
+
var scripts_exports = {};
|
|
416
468
|
var SearchRequest;
|
|
417
469
|
((SearchRequest2) => {
|
|
418
470
|
SearchRequest2.Mode = {
|
|
@@ -438,6 +490,7 @@ var search_exports = {};
|
|
|
438
490
|
__export2(search_exports, {
|
|
439
491
|
SearchRequest: () => SearchRequest
|
|
440
492
|
});
|
|
493
|
+
var triggers_exports = {};
|
|
441
494
|
var AccessProfileRequest;
|
|
442
495
|
((AccessProfileRequest2) => {
|
|
443
496
|
AccessProfileRequest2.Status = {
|
|
@@ -467,7 +520,9 @@ var BatchWriteResult;
|
|
|
467
520
|
Created: "created",
|
|
468
521
|
Updated: "updated",
|
|
469
522
|
Conflict: "conflict",
|
|
470
|
-
Invalid: "invalid"
|
|
523
|
+
Invalid: "invalid",
|
|
524
|
+
Forbidden: "forbidden",
|
|
525
|
+
NotCommitted: "not_committed"
|
|
471
526
|
};
|
|
472
527
|
})(BatchWriteResult || (BatchWriteResult = {}));
|
|
473
528
|
var ChatMessage;
|
|
@@ -771,13 +826,23 @@ var SearchResultsEvent;
|
|
|
771
826
|
SearchResults: "search_results"
|
|
772
827
|
};
|
|
773
828
|
})(SearchResultsEvent || (SearchResultsEvent = {}));
|
|
829
|
+
var TriggerFailureResponse;
|
|
830
|
+
((TriggerFailureResponse2) => {
|
|
831
|
+
TriggerFailureResponse2.Event = {
|
|
832
|
+
Create: "CREATE",
|
|
833
|
+
Update: "UPDATE",
|
|
834
|
+
Delete: "DELETE"
|
|
835
|
+
};
|
|
836
|
+
})(TriggerFailureResponse || (TriggerFailureResponse = {}));
|
|
774
837
|
var TruncationWarningEvent;
|
|
775
838
|
((TruncationWarningEvent2) => {
|
|
776
839
|
TruncationWarningEvent2.Event = {
|
|
777
840
|
TruncationWarning: "truncation_warning"
|
|
778
841
|
};
|
|
779
842
|
TruncationWarningEvent2.Reason = {
|
|
780
|
-
ContextWindowBudget: "context_window_budget"
|
|
843
|
+
ContextWindowBudget: "context_window_budget",
|
|
844
|
+
NoGroundableContent: "no_groundable_content",
|
|
845
|
+
ContextWindowBudgetAndNoContent: "context_window_budget_and_no_content"
|
|
781
846
|
};
|
|
782
847
|
})(TruncationWarningEvent || (TruncationWarningEvent = {}));
|
|
783
848
|
var UserExistsResponse;
|
|
@@ -792,8 +857,7 @@ var UserRequest;
|
|
|
792
857
|
((UserRequest2) => {
|
|
793
858
|
UserRequest2.Status = {
|
|
794
859
|
Active: "ACTIVE",
|
|
795
|
-
Suspended: "SUSPENDED"
|
|
796
|
-
Pending: "PENDING"
|
|
860
|
+
Suspended: "SUSPENDED"
|
|
797
861
|
};
|
|
798
862
|
UserRequest2.Type = {
|
|
799
863
|
Human: "HUMAN",
|
|
@@ -2261,6 +2325,16 @@ function mergeHeaders(...headersArray) {
|
|
|
2261
2325
|
}
|
|
2262
2326
|
return result;
|
|
2263
2327
|
}
|
|
2328
|
+
function mergeOnlyDefinedHeaders(...headersArray) {
|
|
2329
|
+
const result = {};
|
|
2330
|
+
for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
|
|
2331
|
+
const insensitiveKey = key.toLowerCase();
|
|
2332
|
+
if (value != null) {
|
|
2333
|
+
result[insensitiveKey] = value;
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
return result;
|
|
2337
|
+
}
|
|
2264
2338
|
function normalizeClientOptions(options) {
|
|
2265
2339
|
const headers = mergeHeaders(
|
|
2266
2340
|
{
|
|
@@ -2531,7 +2605,7 @@ var AuthClient = class {
|
|
|
2531
2605
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
|
|
2532
2606
|
}
|
|
2533
2607
|
/**
|
|
2534
|
-
* Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. Minting a key bound to your OWN principal needs nothing further; minting one bound to a DIFFERENT principal additionally requires the `delegate-mint` capability (`granted_capabilities`) on your credential — without it the request is refused. A root API key (`sk_`) is exempt from all three bounds.
|
|
2608
|
+
* Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. Minting a key bound to your OWN principal needs nothing further; minting one bound to a DIFFERENT principal additionally requires the `delegate-mint` capability (`granted_capabilities`) on your credential — without it the request is refused. A root API key (`sk_`) is exempt from all three bounds. The profile you name must be `active` AND the user you name must not be `SUSPENDED`: either is refused with `409`, and no root exemption applies to that. Both refusals stop ISSUANCE only. Suspending the profile additionally stops credentials already bound to it, within about five minutes; suspending the user does not stop their existing keys at all. A `PENDING` user is fine.
|
|
2535
2609
|
*
|
|
2536
2610
|
* @param {Vectros.CreateScopedKeyRequest} request
|
|
2537
2611
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2539,6 +2613,7 @@ var AuthClient = class {
|
|
|
2539
2613
|
* @throws {@link Vectros.BadRequestError}
|
|
2540
2614
|
* @throws {@link Vectros.ForbiddenError}
|
|
2541
2615
|
* @throws {@link Vectros.NotFoundError}
|
|
2616
|
+
* @throws {@link Vectros.ConflictError}
|
|
2542
2617
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
2543
2618
|
*
|
|
2544
2619
|
* @example
|
|
@@ -2587,6 +2662,8 @@ var AuthClient = class {
|
|
|
2587
2662
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2588
2663
|
case 404:
|
|
2589
2664
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
2665
|
+
case 409:
|
|
2666
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
2590
2667
|
case 429:
|
|
2591
2668
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
2592
2669
|
default:
|
|
@@ -2998,7 +3075,7 @@ var AuthClient = class {
|
|
|
2998
3075
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts");
|
|
2999
3076
|
}
|
|
3000
3077
|
/**
|
|
3001
|
-
* Creates a new app context. This call is idempotent by `contextId`: if an app context with the same `contextId` already exists, the existing app context is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing context was returned) tells the two apart. To overwrite an existing context's `name`/`description` instead of returning it unchanged, set `?upsert=true` (this also requires the `app-contexts:u` scope). The reserved `contextId` value `vectros-admin` cannot be created through this endpoint; it is provisioned automatically for your account. Requires the `app-contexts:c` scope.
|
|
3078
|
+
* Creates a new app context. This call is idempotent by `contextId`: if an app context with the same `contextId` already exists, the existing app context is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing context was returned) tells the two apart. To overwrite an existing context's `name`/`description`/`companyName` instead of returning it unchanged, set `?upsert=true` (this also requires the `app-contexts:u` scope). The reserved `contextId` value `vectros-admin` cannot be created through this endpoint; it is provisioned automatically for your account. Requires the `app-contexts:c` scope.
|
|
3002
3079
|
*
|
|
3003
3080
|
* @param {Vectros.CreateAppContextRequest} request
|
|
3004
3081
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3482,7 +3559,7 @@ var AuthClient = class {
|
|
|
3482
3559
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts/{contextId}");
|
|
3483
3560
|
}
|
|
3484
3561
|
/**
|
|
3485
|
-
* Updates the name and/or
|
|
3562
|
+
* Updates the name, description, and/or companyName of an app context. This is a partial update: any field you omit (or send as null) keeps its existing value. The `contextId` is immutable and is taken from the URL path, so any `contextId` in the request body is ignored. Requires the `app-contexts:u` scope.
|
|
3486
3563
|
*
|
|
3487
3564
|
* @param {Vectros.UpdateAppContextRequest} request
|
|
3488
3565
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3964,7 +4041,7 @@ var AuthClient = class {
|
|
|
3964
4041
|
);
|
|
3965
4042
|
}
|
|
3966
4043
|
/**
|
|
3967
|
-
* Returns full usage detail for the requested calendar month, broken down by category (search, documents, and
|
|
4044
|
+
* Returns full usage detail for the requested calendar month, broken down by category (search, documents, records, and trigger-script execution time) with per-category credit estimates and a split between your live and test environments. Defaults to the current month when `year` and `month` are omitted. Requires the `billing:r` scope on scoped tokens; API keys always have access. **A token confined to a single app context sees only that context's usage**: totals, the environment split, and the `contexts` breakdown narrow to it, and the environment your context is not bound to is omitted (`null`), not zeroed. Only a token with cross-context reach sees your full account-wide totals. Two exceptions to the narrowing, since they have no per-context breakdown to narrow to: `reads.calls.used`/`reads.dataOut.bytes` (metered per account, not per context) read as `0` for a confined token rather than a narrowed figure — the corresponding overage-credit charge fields narrow correctly; and `credits.limit` stays your whole plan's ceiling, so `credits.remaining` may overstate the account's true remaining room. The `execution` section narrows correctly for a confined token, like the other per-context charge fields — but note its credits carry sub-credit remainders forward across your whole account for the period, so compare `execution.creditsMilli` against your account-wide figure rather than recomputing it from one context's `billableMillis`.
|
|
3968
4045
|
*
|
|
3969
4046
|
* @param {Vectros.GetUsageRequest} request
|
|
3970
4047
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4532,7 +4609,7 @@ var AuthClient = class {
|
|
|
4532
4609
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token");
|
|
4533
4610
|
}
|
|
4534
4611
|
/**
|
|
4535
|
-
* Invite a new member to one of your app contexts by email
|
|
4612
|
+
* Invite a new member to one of your app contexts by email, OR grant an existing member access to an additional app context by inviting their same email again. Idempotent on the combination of context and email: re-inviting the same email into the SAME context rotates the token and resends the invitation rather than creating a duplicate — this requires the `users:r` and `users:u` scopes in addition to `users:c`, because resending rotates a credential on an existing invitation and invalidates any link already sent. Without them the collision returns 409 instead, with no invitation details and no change to the outstanding invitation. Inviting the SAME email into a DIFFERENT app context in this tenant, where that email already resolves to an existing member: if that member is active AND already has (or, once accepted, will have) a credential that works for the new context's own identity provider, this immediately grants them access to the new context (no email is sent — there is nothing to accept, `emailSent` is false) — this additionally requires the `users:r` scope (no `users:u`, since nothing is mutated), because the response names the existing member's userId, a fact about them your credential could not otherwise learn through this endpoint. If that active member's ONLY existing credential is for a DIFFERENT identity provider than the one the new context uses, a normal, independent invitation is created instead (its own new member id, a real token/accept link) — attaching them silently would leave no way for them to ever actually sign in to that context. If the existing member's original invitation is still pending, this attaches the new context's access to that same outstanding invitation and rotates its token (`users:r`+`users:u`, same as an ordinary resend — both the disclosure and the credential rotation apply here). A SUSPENDED member's email does not get new-context access this way — reactivate them explicitly first. Returns HTTP 201 in every one of those cases. Returns 409 if that email already belongs to an active or suspended member of THIS specific app context, already has a PENDING invitation for THIS specific app context, or resolves to an existing member elsewhere in the tenant and your token lacks the additional scope the grant/attach requires (`users:r`, or `users:r`+`users:u` for the still-pending case). An email that already has an identity in your OTHER tenant (test vs. live) is not a collision either — it creates an additional, independent membership in this tenant for that same identity. When `sendEmail` is false, the response includes the raw token and a ready-to-use accept link so you can deliver the invitation through your own email provider. Requires the `users:c` scope — or, for a credential scoped to a single app context, the `member-lifecycle` capability plus the matching `profiles:c`/`profiles:r`/`profiles:u` grant(s) in that context, as an equally sufficient alternative to every `users:c`/`users:r`/`users:u` requirement in this description.
|
|
4536
4613
|
*
|
|
4537
4614
|
* @param {Vectros.CreateInviteRequest} request
|
|
4538
4615
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4603,7 +4680,7 @@ var AuthClient = class {
|
|
|
4603
4680
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite");
|
|
4604
4681
|
}
|
|
4605
4682
|
/**
|
|
4606
|
-
* Resend an outstanding invitation, identified by its email and app context. Rotates the invitation token and extends its expiry, then (when `sendEmail` is true) re-delivers the email. Rotating the token invalidates any previously issued link for this invitation, so only the newest link works. The invitee's pending permissions are left unchanged. Because this rotates a credential on an existing invitation, it requires the `users:c`, `users:r` and `users:u` scopes.
|
|
4683
|
+
* Resend an outstanding invitation, identified by its email and app context. Rotates the invitation token and extends its expiry, then (when `sendEmail` is true) re-delivers the email. Rotating the token invalidates any previously issued link for this invitation, so only the newest link works. The invitee's pending permissions are left unchanged. Because this rotates a credential on an existing invitation, it requires the `users:c`, `users:r` and `users:u` scopes — or, for a credential scoped to a single app context, the `member-lifecycle` capability plus the matching `profiles:c`/`profiles:r`/`profiles:u` grant(s) in that context.
|
|
4607
4684
|
*
|
|
4608
4685
|
* @param {Vectros.CreateInviteRequest} request
|
|
4609
4686
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5476,7 +5553,21 @@ var DocumentsClient = class {
|
|
|
5476
5553
|
return HttpResponsePromise.fromPromise(this.__lookupDocuments(request, requestOptions));
|
|
5477
5554
|
}
|
|
5478
5555
|
async __lookupDocuments(request, requestOptions) {
|
|
5479
|
-
const {
|
|
5556
|
+
const {
|
|
5557
|
+
type: type_,
|
|
5558
|
+
field,
|
|
5559
|
+
value,
|
|
5560
|
+
from: from_,
|
|
5561
|
+
to,
|
|
5562
|
+
prefix,
|
|
5563
|
+
sortFrom,
|
|
5564
|
+
sortTo,
|
|
5565
|
+
startFrom,
|
|
5566
|
+
limit,
|
|
5567
|
+
order,
|
|
5568
|
+
userId,
|
|
5569
|
+
scope
|
|
5570
|
+
} = request;
|
|
5480
5571
|
const _queryParams = {
|
|
5481
5572
|
type: type_,
|
|
5482
5573
|
field,
|
|
@@ -5484,6 +5575,8 @@ var DocumentsClient = class {
|
|
|
5484
5575
|
from: from_,
|
|
5485
5576
|
to,
|
|
5486
5577
|
prefix,
|
|
5578
|
+
sortFrom,
|
|
5579
|
+
sortTo,
|
|
5487
5580
|
startFrom,
|
|
5488
5581
|
limit,
|
|
5489
5582
|
order: order != null ? order : void 0,
|
|
@@ -6082,7 +6175,7 @@ var FoldersClient = class {
|
|
|
6082
6175
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/folders/{id}");
|
|
6083
6176
|
}
|
|
6084
6177
|
/**
|
|
6085
|
-
* Permanently deletes a folder. The folder must be empty
|
|
6178
|
+
* Permanently deletes a folder. The folder must be empty — it must contain no documents, no records, and no sub-folders — and must not be protected. Your context's root folder is protected and cannot be deleted. Requires the `folders:d` scope.
|
|
6086
6179
|
*
|
|
6087
6180
|
* @param {Vectros.DeleteFolderRequest} request
|
|
6088
6181
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6491,11 +6584,12 @@ var IdentityClient = class {
|
|
|
6491
6584
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6492
6585
|
}
|
|
6493
6586
|
/**
|
|
6494
|
-
* Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Requires the `entities:u:<namespace>` scope.
|
|
6587
|
+
* Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Supplying a different `externalId` re-points the entity's identifier; it must still be unused in this namespace and app context. Requires the `entities:u:<namespace>` scope.
|
|
6495
6588
|
*
|
|
6496
6589
|
* @param {Vectros.UpdateEntityRequest} request
|
|
6497
6590
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6498
6591
|
*
|
|
6592
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6499
6593
|
* @throws {@link Vectros.NotFoundError}
|
|
6500
6594
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6501
6595
|
*
|
|
@@ -6545,6 +6639,8 @@ var IdentityClient = class {
|
|
|
6545
6639
|
}
|
|
6546
6640
|
if (_response.error.reason === "status-code") {
|
|
6547
6641
|
switch (_response.error.statusCode) {
|
|
6642
|
+
case 400:
|
|
6643
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6548
6644
|
case 404:
|
|
6549
6645
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6550
6646
|
case 429:
|
|
@@ -7769,7 +7865,7 @@ var InferenceClient = class {
|
|
|
7769
7865
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/documents/{id}/ask");
|
|
7770
7866
|
}
|
|
7771
7867
|
/**
|
|
7772
|
-
* Runs hybrid search over your indexed content, then streams a model answer grounded in the top results. The SSE stream emits a `search_results` event first (carrying the matched results and their metadata), an optional `truncation_warning` if
|
|
7868
|
+
* Runs hybrid search over your indexed content, then streams a model answer grounded in the top results. The SSE stream emits a `search_results` event first (carrying the matched results and their metadata), an optional `truncation_warning` if some retrieved results were dropped before the prompt was built — either because they didn't fit the model's context window or because a result had no groundable text to include — then `content_delta` chunks, and finally a terminal `done` event. Requires the `inference:r` scope.
|
|
7773
7869
|
*/
|
|
7774
7870
|
ragInference(request, requestOptions) {
|
|
7775
7871
|
return HttpResponsePromise.fromPromise(this.__ragInference(request, requestOptions));
|
|
@@ -7964,14 +8060,18 @@ var RecordsClient = class {
|
|
|
7964
8060
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup/batch");
|
|
7965
8061
|
}
|
|
7966
8062
|
/**
|
|
7967
|
-
*
|
|
8063
|
+
* Writes up to 50 records (or 50 with `atomicity: all_or_nothing`) in a single request. Each item in `items` has exactly the same shape, and goes through exactly the same validation, authorization and idempotency rules, as the body of a single `POST /v1/records` — including schema validation, `externalId` idempotency, unique-field enforcement, and the `records:c:<type>` scope check, which is applied per item against that item's own record type. A batch is not a way to write a type your credential could not write one at a time.
|
|
8064
|
+
*
|
|
8065
|
+
* `atomicity` selects how the batch commits. `best_effort` (the default) writes each item independently: some can succeed while others fail, and each item's own outcome is reported. `all_or_nothing` commits every item in one transaction — if any item fails, no record is created or updated at all, and every item that was itself fine reports `not_committed` while the ones that failed report why. Because the transaction is bounded by the number of underlying storage rows rather than by the number of records, a large `all_or_nothing` batch can be refused as too large to commit atomically even when it is within the item limit; the error says so, and nothing is written when it happens.
|
|
8066
|
+
*
|
|
8067
|
+
* The response is HTTP 200 whenever the batch was processed at all — including when every item failed — so always inspect `results` rather than relying on the status code. Match each result to the item you sent using its `index`. Requires the `records:c` scope.
|
|
7968
8068
|
*
|
|
7969
8069
|
* @param {Vectros.BatchWriteRequest} request
|
|
7970
8070
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
7971
8071
|
*
|
|
8072
|
+
* @throws {@link Vectros.BadRequestError}
|
|
7972
8073
|
* @throws {@link Vectros.ForbiddenError}
|
|
7973
8074
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
7974
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
7975
8075
|
*
|
|
7976
8076
|
* @example
|
|
7977
8077
|
* await client.records.batchWriteRecords()
|
|
@@ -7980,6 +8080,11 @@ var RecordsClient = class {
|
|
|
7980
8080
|
return HttpResponsePromise.fromPromise(this.__batchWriteRecords(request, requestOptions));
|
|
7981
8081
|
}
|
|
7982
8082
|
async __batchWriteRecords(request = {}, requestOptions) {
|
|
8083
|
+
const { upsert, allowClear, ..._body } = request;
|
|
8084
|
+
const _queryParams = {
|
|
8085
|
+
upsert,
|
|
8086
|
+
allowClear
|
|
8087
|
+
};
|
|
7983
8088
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7984
8089
|
const _headers = mergeHeaders(
|
|
7985
8090
|
_authRequest.headers,
|
|
@@ -7994,9 +8099,9 @@ var RecordsClient = class {
|
|
|
7994
8099
|
method: "POST",
|
|
7995
8100
|
headers: _headers,
|
|
7996
8101
|
contentType: "application/json",
|
|
7997
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
8102
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
7998
8103
|
requestType: "json",
|
|
7999
|
-
body:
|
|
8104
|
+
body: _body,
|
|
8000
8105
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
8001
8106
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
8002
8107
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -8008,12 +8113,12 @@ var RecordsClient = class {
|
|
|
8008
8113
|
}
|
|
8009
8114
|
if (_response.error.reason === "status-code") {
|
|
8010
8115
|
switch (_response.error.statusCode) {
|
|
8116
|
+
case 400:
|
|
8117
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
8011
8118
|
case 403:
|
|
8012
8119
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8013
8120
|
case 429:
|
|
8014
8121
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8015
|
-
case 501:
|
|
8016
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
8017
8122
|
default:
|
|
8018
8123
|
throw new VectrosError({
|
|
8019
8124
|
statusCode: _response.error.statusCode,
|
|
@@ -8916,7 +9021,7 @@ var SchemasClient = class {
|
|
|
8916
9021
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}");
|
|
8917
9022
|
}
|
|
8918
9023
|
/**
|
|
8919
|
-
* Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Requires the `schemas:u` scope.
|
|
9024
|
+
* Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Because `capabilities` is replaced in full, omitting `triggersEnabled` clears it — the request is refused with 409 if that would disable triggers while trigger rules still fire off this schema, so delete those rules first. Requires the `schemas:u` scope.
|
|
8920
9025
|
*
|
|
8921
9026
|
* @param {Vectros.UpdateSchemaRequest} request
|
|
8922
9027
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8924,6 +9029,7 @@ var SchemasClient = class {
|
|
|
8924
9029
|
* @throws {@link Vectros.BadRequestError}
|
|
8925
9030
|
* @throws {@link Vectros.ForbiddenError}
|
|
8926
9031
|
* @throws {@link Vectros.NotFoundError}
|
|
9032
|
+
* @throws {@link Vectros.ConflictError}
|
|
8927
9033
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
8928
9034
|
*
|
|
8929
9035
|
* @example
|
|
@@ -8975,6 +9081,8 @@ var SchemasClient = class {
|
|
|
8975
9081
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8976
9082
|
case 404:
|
|
8977
9083
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9084
|
+
case 409:
|
|
9085
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
8978
9086
|
case 429:
|
|
8979
9087
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8980
9088
|
default:
|
|
@@ -8988,7 +9096,7 @@ var SchemasClient = class {
|
|
|
8988
9096
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/schemas/{id}");
|
|
8989
9097
|
}
|
|
8990
9098
|
/**
|
|
8991
|
-
* Permanently deletes a record schema. The request is refused with 409 if records of this type still exist — delete those records first, since every record must reference a live schema. A lineage base (a schema other schemas declare `basedOn`) also cannot be deleted while any such variant still exists — delete the variant schema(s) first. Requires the `schemas:d` scope.
|
|
9099
|
+
* Permanently deletes a record schema. The request is refused with 409 if records of this type still exist — delete those records first, since every record must reference a live schema. A lineage base (a schema other schemas declare `basedOn`) also cannot be deleted while any such variant still exists — delete the variant schema(s) first. It is likewise refused while any trigger rule fires off this schema — delete those trigger rules first. Requires the `schemas:d` scope.
|
|
8992
9100
|
*
|
|
8993
9101
|
* @param {Vectros.DeleteSchemaRequest} request
|
|
8994
9102
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -9110,46 +9218,70 @@ var SchemasClient = class {
|
|
|
9110
9218
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}/versions");
|
|
9111
9219
|
}
|
|
9112
9220
|
};
|
|
9113
|
-
var
|
|
9221
|
+
var ScriptsClient = class {
|
|
9114
9222
|
constructor(options) {
|
|
9115
9223
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
9116
9224
|
}
|
|
9117
9225
|
/**
|
|
9118
|
-
* Runs a
|
|
9226
|
+
* Runs a script you previously pushed to `POST /v1/scripts`, under your own credential, and returns what it returned. Every write the script makes is buffered and committed as ONE transaction after the script finishes: either all of them land or none do, and the response is sent only after they have committed — so everything in `result` is committed state or the script's own computation over it. On any failure the body is the standard error envelope and nothing the script staged is committed: its rows are written only when the transaction commits, and a document body or a large payload is DECIDED at that point and WRITTEN to storage only after the commit, so an aborted execution leaves nothing behind. The one residual sits after a successful commit, outside this response: if storing a body fails then, the row exists and the body does not until the platform's repair lands — so a `200` guarantees the rows, and a document's text should be read before it is relied on.
|
|
9119
9227
|
*
|
|
9120
|
-
*
|
|
9121
|
-
*
|
|
9228
|
+
* **Permission.** Requires the `scripts:x` scope — the permission to *execute* — separate from the `scripts:c` permission to push scripts. Bare `scripts:x` grants every script in the context; `scripts:x:<name>` grants exactly that script name, every version of it. Execution discloses no source, so `scripts:r` is not needed. Inside the script, every read and write is enforced by your credential's data scopes exactly as the equivalent REST call would be — `scripts:x` alone can read and write nothing.
|
|
9229
|
+
*
|
|
9230
|
+
* **Input.** Your script sees `input.event` (the literal `"execute"`), `input.userId` (your credential's user id, or null), and `input.params` (the `input` object you sent, verbatim). That is the same `input` grammar a trigger rule uses, so one script can serve both by branching on `input.event`. `params` is not validated — a script that needs a shape checks for it and throws; the script's `declaredInputContract` is documentation for readers and is not enforced.
|
|
9231
|
+
*
|
|
9232
|
+
* **Budget.** Seconds of useful work: the script has 15 s of wall clock (never more than 16) and a bounded number of statements and host calls; a runaway script is stopped early with `RESOURCE_LIMIT_EXCEEDED`. The transaction is bounded by the number of underlying storage rows it writes — 100 rows after merging — rather than by the number of entities: creating a folder costs 3 rows; creating a plain text document or a record costs 1 row plus one per range-indexed lookup field plus one per `reference` field. So "create a folder and file N documents" holds up to 97 plain documents, 48 with one range field or one reference, 32 with both; if a script exceeds the limit the error says so (`WRITE_BUFFER_CAP_EXCEEDED`, with `total` and `limit`) and nothing is committed. This request takes the write-path limits (burst, credit ceiling, principal quota) once, before the script runs — there is no free-read allowance here, so an account over its credit ceiling is refused even for a read-only script. Reads the script performs are metered as reads, writes as writes, and execution time beyond what those operations include is charged as script execution time (see `GET /v1/usage`).
|
|
9233
|
+
*
|
|
9234
|
+
* **Reads inside the script.** A `get` sees the script's own staged writes. A list, query or lookup never shows a row the script has deleted, shows a row it re-saved with the updated content, and does not yet show a row it created — you hold that row's id from `create()`.
|
|
9235
|
+
*
|
|
9236
|
+
* **Retries.** Send an optional `Idempotency-Key` header (1–128 characters of letters, digits, `.`, `_`, `:` or `-`) to make a retry safe: a request repeated under the same key within 24 hours receives the same response as the first attempt without executing again — when that first attempt SUCCEEDED (a duplicate still in flight is refused with `409 IDEMPOTENCY_IN_PROGRESS`; the same key on a different request is refused with `422 IDEMPOTENCY_KEY_REUSED`). A first attempt that FAILED with any other status is not remembered: the same key is free to try again, so a retry after a `400` or a `429` executes. If an execution's outcome cannot be determined — the script did not finish inside the budget while its writes may have committed — the response is `500 EXECUTION_OUTCOME_UNKNOWN` carrying `execution.id`, and a keyed retry receives that same answer: inspect what the script would have written, then use a NEW key for a new attempt. When a key is present the serialised `result` is capped at 16 KB instead of 256 KB. Without a key, a lost response cannot be distinguished from a failed one; re-read before retrying.
|
|
9237
|
+
*
|
|
9238
|
+
* @param {Vectros.ScriptExecuteRequest} request
|
|
9239
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9122
9240
|
*
|
|
9123
9241
|
* @throws {@link Vectros.BadRequestError}
|
|
9242
|
+
* @throws {@link Vectros.PaymentRequiredError}
|
|
9124
9243
|
* @throws {@link Vectros.ForbiddenError}
|
|
9244
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9245
|
+
* @throws {@link Vectros.ConflictError}
|
|
9246
|
+
* @throws {@link Vectros.ContentTooLargeError}
|
|
9247
|
+
* @throws {@link Vectros.UnprocessableEntityError}
|
|
9125
9248
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
9249
|
+
* @throws {@link Vectros.InternalServerError}
|
|
9250
|
+
* @throws {@link Vectros.ServiceUnavailableError}
|
|
9251
|
+
* @throws {@link Vectros.GatewayTimeoutError}
|
|
9126
9252
|
*
|
|
9127
9253
|
* @example
|
|
9128
|
-
* await client.
|
|
9129
|
-
*
|
|
9254
|
+
* await client.scripts.executeScript({
|
|
9255
|
+
* "Idempotency-Key": "order-8412-attempt",
|
|
9256
|
+
* scriptRef: {
|
|
9257
|
+
* name: "notify-assignee",
|
|
9258
|
+
* version: "3"
|
|
9259
|
+
* }
|
|
9130
9260
|
* })
|
|
9131
9261
|
*/
|
|
9132
|
-
|
|
9133
|
-
return HttpResponsePromise.fromPromise(this.
|
|
9262
|
+
executeScript(request, requestOptions) {
|
|
9263
|
+
return HttpResponsePromise.fromPromise(this.__executeScript(request, requestOptions));
|
|
9134
9264
|
}
|
|
9135
|
-
async
|
|
9265
|
+
async __executeScript(request, requestOptions) {
|
|
9266
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
9136
9267
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9137
9268
|
const _headers = mergeHeaders(
|
|
9138
9269
|
_authRequest.headers,
|
|
9139
9270
|
this._options?.headers,
|
|
9271
|
+
mergeOnlyDefinedHeaders({ "Idempotency-Key": idempotencyKey }),
|
|
9140
9272
|
requestOptions?.headers
|
|
9141
9273
|
);
|
|
9142
9274
|
const _response = await fetcher({
|
|
9143
9275
|
url: url_exports.join(
|
|
9144
9276
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9145
|
-
"v1/
|
|
9277
|
+
"v1/scripts/execute"
|
|
9146
9278
|
),
|
|
9147
9279
|
method: "POST",
|
|
9148
9280
|
headers: _headers,
|
|
9149
9281
|
contentType: "application/json",
|
|
9150
9282
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9151
9283
|
requestType: "json",
|
|
9152
|
-
body:
|
|
9284
|
+
body: _body,
|
|
9153
9285
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9154
9286
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9155
9287
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -9163,10 +9295,26 @@ var SearchClient = class {
|
|
|
9163
9295
|
switch (_response.error.statusCode) {
|
|
9164
9296
|
case 400:
|
|
9165
9297
|
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9298
|
+
case 402:
|
|
9299
|
+
throw new PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
9166
9300
|
case 403:
|
|
9167
9301
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9302
|
+
case 404:
|
|
9303
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9304
|
+
case 409:
|
|
9305
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9306
|
+
case 413:
|
|
9307
|
+
throw new ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
9308
|
+
case 422:
|
|
9309
|
+
throw new UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
9168
9310
|
case 429:
|
|
9169
9311
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9312
|
+
case 500:
|
|
9313
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
9314
|
+
case 503:
|
|
9315
|
+
throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
9316
|
+
case 504:
|
|
9317
|
+
throw new GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
9170
9318
|
default:
|
|
9171
9319
|
throw new VectrosError({
|
|
9172
9320
|
statusCode: _response.error.statusCode,
|
|
@@ -9175,98 +9323,861 @@ var SearchClient = class {
|
|
|
9175
9323
|
});
|
|
9176
9324
|
}
|
|
9177
9325
|
}
|
|
9178
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
9179
|
-
}
|
|
9180
|
-
};
|
|
9181
|
-
var VectrosClient = class {
|
|
9182
|
-
constructor(options) {
|
|
9183
|
-
this._options = normalizeClientOptionsWithAuth(options);
|
|
9184
|
-
}
|
|
9185
|
-
get auth() {
|
|
9186
|
-
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
9187
|
-
}
|
|
9188
|
-
get documents() {
|
|
9189
|
-
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
9190
|
-
}
|
|
9191
|
-
get identity() {
|
|
9192
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
9193
|
-
}
|
|
9194
|
-
get compliance() {
|
|
9195
|
-
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
9196
|
-
}
|
|
9197
|
-
get folders() {
|
|
9198
|
-
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
9199
|
-
}
|
|
9200
|
-
get inference() {
|
|
9201
|
-
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
9202
|
-
}
|
|
9203
|
-
get records() {
|
|
9204
|
-
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
9205
|
-
}
|
|
9206
|
-
get schemas() {
|
|
9207
|
-
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
9208
|
-
}
|
|
9209
|
-
get search() {
|
|
9210
|
-
return this._search ?? (this._search = new SearchClient(this._options));
|
|
9326
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts/execute");
|
|
9211
9327
|
}
|
|
9212
9328
|
/**
|
|
9213
|
-
*
|
|
9214
|
-
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
9215
|
-
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
9329
|
+
* Returns a paginated list of your scripts. Pass `name` to list every version of one script name (oldest first); omit it for a flat list across every name in your account (newest first). Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `scripts:r` scope.
|
|
9216
9330
|
*
|
|
9217
|
-
* @param {
|
|
9218
|
-
* @param {
|
|
9219
|
-
*
|
|
9220
|
-
* @
|
|
9331
|
+
* @param {Vectros.ListScriptsRequest} request
|
|
9332
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9333
|
+
*
|
|
9334
|
+
* @example
|
|
9335
|
+
* await client.scripts.listScripts({
|
|
9336
|
+
* name: "notify-assignee",
|
|
9337
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9338
|
+
* })
|
|
9221
9339
|
*/
|
|
9222
|
-
|
|
9223
|
-
return
|
|
9224
|
-
input,
|
|
9225
|
-
init,
|
|
9226
|
-
{
|
|
9227
|
-
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
9228
|
-
headers: this._options.headers,
|
|
9229
|
-
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
9230
|
-
maxRetries: this._options.maxRetries,
|
|
9231
|
-
fetch: this._options.fetch,
|
|
9232
|
-
logging: this._options.logging,
|
|
9233
|
-
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
9234
|
-
},
|
|
9235
|
-
requestOptions
|
|
9236
|
-
);
|
|
9237
|
-
}
|
|
9238
|
-
};
|
|
9239
|
-
var logging;
|
|
9240
|
-
((logging2) => {
|
|
9241
|
-
logging2.LogLevel = LogLevel;
|
|
9242
|
-
logging2.ConsoleLogger = ConsoleLogger;
|
|
9243
|
-
})(logging || (logging = {}));
|
|
9244
|
-
|
|
9245
|
-
// src/server.ts
|
|
9246
|
-
var import_types3 = require("@modelcontextprotocol/sdk/types.js");
|
|
9247
|
-
var import_zod23 = require("zod");
|
|
9248
|
-
|
|
9249
|
-
// src/auth.ts
|
|
9250
|
-
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
9251
|
-
var InvalidApiKeyError = class extends Error {
|
|
9252
|
-
constructor(reason) {
|
|
9253
|
-
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
9254
|
-
this.name = "InvalidApiKeyError";
|
|
9340
|
+
listScripts(request = {}, requestOptions) {
|
|
9341
|
+
return HttpResponsePromise.fromPromise(this.__listScripts(request, requestOptions));
|
|
9255
9342
|
}
|
|
9256
|
-
}
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9343
|
+
async __listScripts(request = {}, requestOptions) {
|
|
9344
|
+
const { name, startFrom, limit } = request;
|
|
9345
|
+
const _queryParams = {
|
|
9346
|
+
name,
|
|
9347
|
+
startFrom,
|
|
9348
|
+
limit
|
|
9349
|
+
};
|
|
9350
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9351
|
+
const _headers = mergeHeaders(
|
|
9352
|
+
_authRequest.headers,
|
|
9353
|
+
this._options?.headers,
|
|
9354
|
+
requestOptions?.headers
|
|
9261
9355
|
);
|
|
9356
|
+
const _response = await fetcher({
|
|
9357
|
+
url: url_exports.join(
|
|
9358
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9359
|
+
"v1/scripts"
|
|
9360
|
+
),
|
|
9361
|
+
method: "GET",
|
|
9362
|
+
headers: _headers,
|
|
9363
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9364
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9365
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9366
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9367
|
+
fetchFn: this._options?.fetch,
|
|
9368
|
+
logging: this._options.logging
|
|
9369
|
+
});
|
|
9370
|
+
if (_response.ok) {
|
|
9371
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9372
|
+
}
|
|
9373
|
+
if (_response.error.reason === "status-code") {
|
|
9374
|
+
throw new VectrosError({
|
|
9375
|
+
statusCode: _response.error.statusCode,
|
|
9376
|
+
body: _response.error.body,
|
|
9377
|
+
rawResponse: _response.rawResponse
|
|
9378
|
+
});
|
|
9379
|
+
}
|
|
9380
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts");
|
|
9262
9381
|
}
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9382
|
+
/**
|
|
9383
|
+
* Stores a new version of a script object. Every POST creates a genuinely new version — this is NOT idempotent-by-name: pushing `name` again always creates a new row with `scriptVersion` auto-incremented (the first version pushed for a name is 1). `source` is stored as-is: nothing parses or validates it at push time. A version runs when a trigger rule references it (`POST /v1/triggers`) or when `POST /v1/scripts/execute` names it. Requires the `scripts:c` scope.
|
|
9384
|
+
*
|
|
9385
|
+
* @param {Vectros.ScriptRequest} request
|
|
9386
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9387
|
+
*
|
|
9388
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9389
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9390
|
+
* @throws {@link Vectros.ConflictError}
|
|
9391
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9392
|
+
*
|
|
9393
|
+
* @example
|
|
9394
|
+
* await client.scripts.createScript({
|
|
9395
|
+
* name: "notify-assignee",
|
|
9396
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9397
|
+
* })
|
|
9398
|
+
*/
|
|
9399
|
+
createScript(request, requestOptions) {
|
|
9400
|
+
return HttpResponsePromise.fromPromise(this.__createScript(request, requestOptions));
|
|
9268
9401
|
}
|
|
9269
|
-
|
|
9402
|
+
async __createScript(request, requestOptions) {
|
|
9403
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9404
|
+
const _headers = mergeHeaders(
|
|
9405
|
+
_authRequest.headers,
|
|
9406
|
+
this._options?.headers,
|
|
9407
|
+
requestOptions?.headers
|
|
9408
|
+
);
|
|
9409
|
+
const _response = await fetcher({
|
|
9410
|
+
url: url_exports.join(
|
|
9411
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9412
|
+
"v1/scripts"
|
|
9413
|
+
),
|
|
9414
|
+
method: "POST",
|
|
9415
|
+
headers: _headers,
|
|
9416
|
+
contentType: "application/json",
|
|
9417
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9418
|
+
requestType: "json",
|
|
9419
|
+
body: request,
|
|
9420
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9421
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9422
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9423
|
+
fetchFn: this._options?.fetch,
|
|
9424
|
+
logging: this._options.logging
|
|
9425
|
+
});
|
|
9426
|
+
if (_response.ok) {
|
|
9427
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9428
|
+
}
|
|
9429
|
+
if (_response.error.reason === "status-code") {
|
|
9430
|
+
switch (_response.error.statusCode) {
|
|
9431
|
+
case 400:
|
|
9432
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9433
|
+
case 403:
|
|
9434
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9435
|
+
case 409:
|
|
9436
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9437
|
+
case 429:
|
|
9438
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9439
|
+
default:
|
|
9440
|
+
throw new VectrosError({
|
|
9441
|
+
statusCode: _response.error.statusCode,
|
|
9442
|
+
body: _response.error.body,
|
|
9443
|
+
rawResponse: _response.rawResponse
|
|
9444
|
+
});
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts");
|
|
9448
|
+
}
|
|
9449
|
+
/**
|
|
9450
|
+
* Retrieves a single script version by its ID. Requires the `scripts:r` scope.
|
|
9451
|
+
*
|
|
9452
|
+
* @param {Vectros.GetScriptRequest} request
|
|
9453
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9454
|
+
*
|
|
9455
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9456
|
+
*
|
|
9457
|
+
* @example
|
|
9458
|
+
* await client.scripts.getScript({
|
|
9459
|
+
* id: "id"
|
|
9460
|
+
* })
|
|
9461
|
+
*/
|
|
9462
|
+
getScript(request, requestOptions) {
|
|
9463
|
+
return HttpResponsePromise.fromPromise(this.__getScript(request, requestOptions));
|
|
9464
|
+
}
|
|
9465
|
+
async __getScript(request, requestOptions) {
|
|
9466
|
+
const { id } = request;
|
|
9467
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9468
|
+
const _headers = mergeHeaders(
|
|
9469
|
+
_authRequest.headers,
|
|
9470
|
+
this._options?.headers,
|
|
9471
|
+
requestOptions?.headers
|
|
9472
|
+
);
|
|
9473
|
+
const _response = await fetcher({
|
|
9474
|
+
url: url_exports.join(
|
|
9475
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9476
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9477
|
+
),
|
|
9478
|
+
method: "GET",
|
|
9479
|
+
headers: _headers,
|
|
9480
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9481
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9482
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9483
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9484
|
+
fetchFn: this._options?.fetch,
|
|
9485
|
+
logging: this._options.logging
|
|
9486
|
+
});
|
|
9487
|
+
if (_response.ok) {
|
|
9488
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9489
|
+
}
|
|
9490
|
+
if (_response.error.reason === "status-code") {
|
|
9491
|
+
switch (_response.error.statusCode) {
|
|
9492
|
+
case 404:
|
|
9493
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9494
|
+
default:
|
|
9495
|
+
throw new VectrosError({
|
|
9496
|
+
statusCode: _response.error.statusCode,
|
|
9497
|
+
body: _response.error.body,
|
|
9498
|
+
rawResponse: _response.rawResponse
|
|
9499
|
+
});
|
|
9500
|
+
}
|
|
9501
|
+
}
|
|
9502
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts/{id}");
|
|
9503
|
+
}
|
|
9504
|
+
/**
|
|
9505
|
+
* Scripts are immutable per version; this endpoint always returns a 400 regardless of scope or credential — push a new version via `POST /v1/scripts` instead.
|
|
9506
|
+
*
|
|
9507
|
+
* @param {Vectros.UpdateScriptRequest} request
|
|
9508
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9509
|
+
*
|
|
9510
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9511
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9512
|
+
*
|
|
9513
|
+
* @example
|
|
9514
|
+
* await client.scripts.updateScript({
|
|
9515
|
+
* id: "id",
|
|
9516
|
+
* body: {
|
|
9517
|
+
* name: "notify-assignee",
|
|
9518
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9519
|
+
* }
|
|
9520
|
+
* })
|
|
9521
|
+
*/
|
|
9522
|
+
updateScript(request, requestOptions) {
|
|
9523
|
+
return HttpResponsePromise.fromPromise(this.__updateScript(request, requestOptions));
|
|
9524
|
+
}
|
|
9525
|
+
async __updateScript(request, requestOptions) {
|
|
9526
|
+
const { id, body: _body } = request;
|
|
9527
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9528
|
+
const _headers = mergeHeaders(
|
|
9529
|
+
_authRequest.headers,
|
|
9530
|
+
this._options?.headers,
|
|
9531
|
+
requestOptions?.headers
|
|
9532
|
+
);
|
|
9533
|
+
const _response = await fetcher({
|
|
9534
|
+
url: url_exports.join(
|
|
9535
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9536
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9537
|
+
),
|
|
9538
|
+
method: "PUT",
|
|
9539
|
+
headers: _headers,
|
|
9540
|
+
contentType: "application/json",
|
|
9541
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9542
|
+
requestType: "json",
|
|
9543
|
+
body: _body,
|
|
9544
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9545
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9546
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9547
|
+
fetchFn: this._options?.fetch,
|
|
9548
|
+
logging: this._options.logging
|
|
9549
|
+
});
|
|
9550
|
+
if (_response.ok) {
|
|
9551
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9552
|
+
}
|
|
9553
|
+
if (_response.error.reason === "status-code") {
|
|
9554
|
+
switch (_response.error.statusCode) {
|
|
9555
|
+
case 400:
|
|
9556
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9557
|
+
case 429:
|
|
9558
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9559
|
+
default:
|
|
9560
|
+
throw new VectrosError({
|
|
9561
|
+
statusCode: _response.error.statusCode,
|
|
9562
|
+
body: _response.error.body,
|
|
9563
|
+
rawResponse: _response.rawResponse
|
|
9564
|
+
});
|
|
9565
|
+
}
|
|
9566
|
+
}
|
|
9567
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/scripts/{id}");
|
|
9568
|
+
}
|
|
9569
|
+
/**
|
|
9570
|
+
* Permanently deletes one script version by ID. Deleting one version does not affect any other version of the same name. Requires the `scripts:d` scope.
|
|
9571
|
+
*
|
|
9572
|
+
* @param {Vectros.DeleteScriptRequest} request
|
|
9573
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9574
|
+
*
|
|
9575
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9576
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9577
|
+
*
|
|
9578
|
+
* @example
|
|
9579
|
+
* await client.scripts.deleteScript({
|
|
9580
|
+
* id: "id"
|
|
9581
|
+
* })
|
|
9582
|
+
*/
|
|
9583
|
+
deleteScript(request, requestOptions) {
|
|
9584
|
+
return HttpResponsePromise.fromPromise(this.__deleteScript(request, requestOptions));
|
|
9585
|
+
}
|
|
9586
|
+
async __deleteScript(request, requestOptions) {
|
|
9587
|
+
const { id } = request;
|
|
9588
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9589
|
+
const _headers = mergeHeaders(
|
|
9590
|
+
_authRequest.headers,
|
|
9591
|
+
this._options?.headers,
|
|
9592
|
+
requestOptions?.headers
|
|
9593
|
+
);
|
|
9594
|
+
const _response = await fetcher({
|
|
9595
|
+
url: url_exports.join(
|
|
9596
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9597
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9598
|
+
),
|
|
9599
|
+
method: "DELETE",
|
|
9600
|
+
headers: _headers,
|
|
9601
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9602
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9603
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9604
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9605
|
+
fetchFn: this._options?.fetch,
|
|
9606
|
+
logging: this._options.logging
|
|
9607
|
+
});
|
|
9608
|
+
if (_response.ok) {
|
|
9609
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9610
|
+
}
|
|
9611
|
+
if (_response.error.reason === "status-code") {
|
|
9612
|
+
switch (_response.error.statusCode) {
|
|
9613
|
+
case 404:
|
|
9614
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9615
|
+
case 429:
|
|
9616
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9617
|
+
default:
|
|
9618
|
+
throw new VectrosError({
|
|
9619
|
+
statusCode: _response.error.statusCode,
|
|
9620
|
+
body: _response.error.body,
|
|
9621
|
+
rawResponse: _response.rawResponse
|
|
9622
|
+
});
|
|
9623
|
+
}
|
|
9624
|
+
}
|
|
9625
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/scripts/{id}");
|
|
9626
|
+
}
|
|
9627
|
+
};
|
|
9628
|
+
var SearchClient = class {
|
|
9629
|
+
constructor(options) {
|
|
9630
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9631
|
+
}
|
|
9632
|
+
/**
|
|
9633
|
+
* Runs a hybrid, semantic, or text search across the content you have indexed. By default it returns both documents and records in a single unified result set; pass `contentTypes` to narrow the results (for example `["documents"]`). Each result carries a `sourceType` discriminator (`PartnerDocument` or `GenericRecord`) so you can branch on the type. Requires the `search:r` scope.
|
|
9634
|
+
*
|
|
9635
|
+
* @param {Vectros.SearchRequest} request
|
|
9636
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9637
|
+
*
|
|
9638
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9639
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9640
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9641
|
+
*
|
|
9642
|
+
* @example
|
|
9643
|
+
* await client.search.content({
|
|
9644
|
+
* query: "patient intake form diabetes"
|
|
9645
|
+
* })
|
|
9646
|
+
*/
|
|
9647
|
+
content(request, requestOptions) {
|
|
9648
|
+
return HttpResponsePromise.fromPromise(this.__content(request, requestOptions));
|
|
9649
|
+
}
|
|
9650
|
+
async __content(request, requestOptions) {
|
|
9651
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9652
|
+
const _headers = mergeHeaders(
|
|
9653
|
+
_authRequest.headers,
|
|
9654
|
+
this._options?.headers,
|
|
9655
|
+
requestOptions?.headers
|
|
9656
|
+
);
|
|
9657
|
+
const _response = await fetcher({
|
|
9658
|
+
url: url_exports.join(
|
|
9659
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9660
|
+
"v1/search"
|
|
9661
|
+
),
|
|
9662
|
+
method: "POST",
|
|
9663
|
+
headers: _headers,
|
|
9664
|
+
contentType: "application/json",
|
|
9665
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9666
|
+
requestType: "json",
|
|
9667
|
+
body: request,
|
|
9668
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9669
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9670
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9671
|
+
fetchFn: this._options?.fetch,
|
|
9672
|
+
logging: this._options.logging
|
|
9673
|
+
});
|
|
9674
|
+
if (_response.ok) {
|
|
9675
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9676
|
+
}
|
|
9677
|
+
if (_response.error.reason === "status-code") {
|
|
9678
|
+
switch (_response.error.statusCode) {
|
|
9679
|
+
case 400:
|
|
9680
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9681
|
+
case 403:
|
|
9682
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9683
|
+
case 429:
|
|
9684
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9685
|
+
default:
|
|
9686
|
+
throw new VectrosError({
|
|
9687
|
+
statusCode: _response.error.statusCode,
|
|
9688
|
+
body: _response.error.body,
|
|
9689
|
+
rawResponse: _response.rawResponse
|
|
9690
|
+
});
|
|
9691
|
+
}
|
|
9692
|
+
}
|
|
9693
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/search");
|
|
9694
|
+
}
|
|
9695
|
+
};
|
|
9696
|
+
var TriggersClient = class {
|
|
9697
|
+
constructor(options) {
|
|
9698
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9699
|
+
}
|
|
9700
|
+
/**
|
|
9701
|
+
* Returns a page of trigger executions that failed — what went wrong, whether the platform will retry it, and which of your records and rules were involved. Use this to find automation that has stopped running.
|
|
9702
|
+
*
|
|
9703
|
+
* A record appears once per FIRING, not once per attempt: if the platform retries a retryable failure, the same record's `attempts` count rises rather than a new record appearing. **If a retry later succeeds, the record is removed** — so this endpoint describes what is currently broken, not a permanent history. Records also expire 30 days after the firing first failed.
|
|
9704
|
+
*
|
|
9705
|
+
* `detail` is safe to surface to your own users: it carries only your own content (a script's own thrown message) or public API vocabulary, never platform internals. For `INTERNAL_ERROR` it is absent and a `correlationId` is returned instead — quote that to support.
|
|
9706
|
+
*
|
|
9707
|
+
* Scoped to your account and app context, derived from your token — never from input. Requires the `triggers:r` scope.
|
|
9708
|
+
*
|
|
9709
|
+
* @param {Vectros.ListTriggerFailuresRequest} request
|
|
9710
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9711
|
+
*
|
|
9712
|
+
* @example
|
|
9713
|
+
* await client.triggers.listTriggerFailures({
|
|
9714
|
+
* ruleId: "3b1c9f2e7a5d8410f6c2e9a1b7d4038f5e6a91c2d7f0b3a4586c9e2f1d0a7b3c",
|
|
9715
|
+
* category: "SCRIPT_ERROR",
|
|
9716
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9717
|
+
* })
|
|
9718
|
+
*/
|
|
9719
|
+
listTriggerFailures(request = {}, requestOptions) {
|
|
9720
|
+
return HttpResponsePromise.fromPromise(this.__listTriggerFailures(request, requestOptions));
|
|
9721
|
+
}
|
|
9722
|
+
async __listTriggerFailures(request = {}, requestOptions) {
|
|
9723
|
+
const { ruleId, category, retryable, from: from_, to, startFrom, limit } = request;
|
|
9724
|
+
const _queryParams = {
|
|
9725
|
+
ruleId,
|
|
9726
|
+
category,
|
|
9727
|
+
retryable,
|
|
9728
|
+
from: from_,
|
|
9729
|
+
to,
|
|
9730
|
+
startFrom,
|
|
9731
|
+
limit
|
|
9732
|
+
};
|
|
9733
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9734
|
+
const _headers = mergeHeaders(
|
|
9735
|
+
_authRequest.headers,
|
|
9736
|
+
this._options?.headers,
|
|
9737
|
+
requestOptions?.headers
|
|
9738
|
+
);
|
|
9739
|
+
const _response = await fetcher({
|
|
9740
|
+
url: url_exports.join(
|
|
9741
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9742
|
+
"v1/trigger-failures"
|
|
9743
|
+
),
|
|
9744
|
+
method: "GET",
|
|
9745
|
+
headers: _headers,
|
|
9746
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9747
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9748
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9749
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9750
|
+
fetchFn: this._options?.fetch,
|
|
9751
|
+
logging: this._options.logging
|
|
9752
|
+
});
|
|
9753
|
+
if (_response.ok) {
|
|
9754
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9755
|
+
}
|
|
9756
|
+
if (_response.error.reason === "status-code") {
|
|
9757
|
+
throw new VectrosError({
|
|
9758
|
+
statusCode: _response.error.statusCode,
|
|
9759
|
+
body: _response.error.body,
|
|
9760
|
+
rawResponse: _response.rawResponse
|
|
9761
|
+
});
|
|
9762
|
+
}
|
|
9763
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/trigger-failures");
|
|
9764
|
+
}
|
|
9765
|
+
/**
|
|
9766
|
+
* Returns a paginated list of your trigger rules, newest first. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `triggers:r` scope.
|
|
9767
|
+
*
|
|
9768
|
+
* @param {Vectros.ListTriggersRequest} request
|
|
9769
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9770
|
+
*
|
|
9771
|
+
* @example
|
|
9772
|
+
* await client.triggers.listTriggers({
|
|
9773
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9774
|
+
* })
|
|
9775
|
+
*/
|
|
9776
|
+
listTriggers(request = {}, requestOptions) {
|
|
9777
|
+
return HttpResponsePromise.fromPromise(this.__listTriggers(request, requestOptions));
|
|
9778
|
+
}
|
|
9779
|
+
async __listTriggers(request = {}, requestOptions) {
|
|
9780
|
+
const { startFrom, limit } = request;
|
|
9781
|
+
const _queryParams = {
|
|
9782
|
+
startFrom,
|
|
9783
|
+
limit
|
|
9784
|
+
};
|
|
9785
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9786
|
+
const _headers = mergeHeaders(
|
|
9787
|
+
_authRequest.headers,
|
|
9788
|
+
this._options?.headers,
|
|
9789
|
+
requestOptions?.headers
|
|
9790
|
+
);
|
|
9791
|
+
const _response = await fetcher({
|
|
9792
|
+
url: url_exports.join(
|
|
9793
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9794
|
+
"v1/triggers"
|
|
9795
|
+
),
|
|
9796
|
+
method: "GET",
|
|
9797
|
+
headers: _headers,
|
|
9798
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9799
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9800
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9801
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9802
|
+
fetchFn: this._options?.fetch,
|
|
9803
|
+
logging: this._options.logging
|
|
9804
|
+
});
|
|
9805
|
+
if (_response.ok) {
|
|
9806
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9807
|
+
}
|
|
9808
|
+
if (_response.error.reason === "status-code") {
|
|
9809
|
+
throw new VectrosError({
|
|
9810
|
+
statusCode: _response.error.statusCode,
|
|
9811
|
+
body: _response.error.body,
|
|
9812
|
+
rawResponse: _response.rawResponse
|
|
9813
|
+
});
|
|
9814
|
+
}
|
|
9815
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers");
|
|
9816
|
+
}
|
|
9817
|
+
/**
|
|
9818
|
+
* Declares a new trigger rule, or (with `?upsert=true`) reconciles an existing one of the same name to the submitted shape. Once declared, the rule fires: a record write on the named schema dispatches the referenced script, which runs asynchronously under this rule's own grant. Because that grant is executed, a scoped credential may not declare a trigger whose grant exceeds its own — such a request is rejected with a `403`, and a `roleIds` entry that does not resolve in this context with a `400`. Requires the `triggers:c` scope (also `triggers:u` when `?upsert=true` matches an existing row).
|
|
9819
|
+
*
|
|
9820
|
+
* @param {Vectros.CreateTriggerRequest} request
|
|
9821
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9822
|
+
*
|
|
9823
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9824
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9825
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9826
|
+
*
|
|
9827
|
+
* @example
|
|
9828
|
+
* await client.triggers.createTrigger({
|
|
9829
|
+
* body: {
|
|
9830
|
+
* name: "on-intake-create",
|
|
9831
|
+
* firingSource: {
|
|
9832
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9833
|
+
* event: "CREATE"
|
|
9834
|
+
* },
|
|
9835
|
+
* scriptRef: {
|
|
9836
|
+
* name: "notify-assignee",
|
|
9837
|
+
* version: "3"
|
|
9838
|
+
* }
|
|
9839
|
+
* }
|
|
9840
|
+
* })
|
|
9841
|
+
*/
|
|
9842
|
+
createTrigger(request, requestOptions) {
|
|
9843
|
+
return HttpResponsePromise.fromPromise(this.__createTrigger(request, requestOptions));
|
|
9844
|
+
}
|
|
9845
|
+
async __createTrigger(request, requestOptions) {
|
|
9846
|
+
const { upsert, body: _body } = request;
|
|
9847
|
+
const _queryParams = {
|
|
9848
|
+
upsert
|
|
9849
|
+
};
|
|
9850
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9851
|
+
const _headers = mergeHeaders(
|
|
9852
|
+
_authRequest.headers,
|
|
9853
|
+
this._options?.headers,
|
|
9854
|
+
requestOptions?.headers
|
|
9855
|
+
);
|
|
9856
|
+
const _response = await fetcher({
|
|
9857
|
+
url: url_exports.join(
|
|
9858
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9859
|
+
"v1/triggers"
|
|
9860
|
+
),
|
|
9861
|
+
method: "POST",
|
|
9862
|
+
headers: _headers,
|
|
9863
|
+
contentType: "application/json",
|
|
9864
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9865
|
+
requestType: "json",
|
|
9866
|
+
body: _body,
|
|
9867
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9868
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9869
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9870
|
+
fetchFn: this._options?.fetch,
|
|
9871
|
+
logging: this._options.logging
|
|
9872
|
+
});
|
|
9873
|
+
if (_response.ok) {
|
|
9874
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9875
|
+
}
|
|
9876
|
+
if (_response.error.reason === "status-code") {
|
|
9877
|
+
switch (_response.error.statusCode) {
|
|
9878
|
+
case 400:
|
|
9879
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9880
|
+
case 403:
|
|
9881
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9882
|
+
case 429:
|
|
9883
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9884
|
+
default:
|
|
9885
|
+
throw new VectrosError({
|
|
9886
|
+
statusCode: _response.error.statusCode,
|
|
9887
|
+
body: _response.error.body,
|
|
9888
|
+
rawResponse: _response.rawResponse
|
|
9889
|
+
});
|
|
9890
|
+
}
|
|
9891
|
+
}
|
|
9892
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/triggers");
|
|
9893
|
+
}
|
|
9894
|
+
/**
|
|
9895
|
+
* Retrieves a single trigger rule by its ID. Requires the `triggers:r` scope.
|
|
9896
|
+
*
|
|
9897
|
+
* @param {Vectros.GetTriggerRequest} request
|
|
9898
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9899
|
+
*
|
|
9900
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9901
|
+
*
|
|
9902
|
+
* @example
|
|
9903
|
+
* await client.triggers.getTrigger({
|
|
9904
|
+
* id: "id"
|
|
9905
|
+
* })
|
|
9906
|
+
*/
|
|
9907
|
+
getTrigger(request, requestOptions) {
|
|
9908
|
+
return HttpResponsePromise.fromPromise(this.__getTrigger(request, requestOptions));
|
|
9909
|
+
}
|
|
9910
|
+
async __getTrigger(request, requestOptions) {
|
|
9911
|
+
const { id } = request;
|
|
9912
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9913
|
+
const _headers = mergeHeaders(
|
|
9914
|
+
_authRequest.headers,
|
|
9915
|
+
this._options?.headers,
|
|
9916
|
+
requestOptions?.headers
|
|
9917
|
+
);
|
|
9918
|
+
const _response = await fetcher({
|
|
9919
|
+
url: url_exports.join(
|
|
9920
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9921
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9922
|
+
),
|
|
9923
|
+
method: "GET",
|
|
9924
|
+
headers: _headers,
|
|
9925
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9926
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9927
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9928
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9929
|
+
fetchFn: this._options?.fetch,
|
|
9930
|
+
logging: this._options.logging
|
|
9931
|
+
});
|
|
9932
|
+
if (_response.ok) {
|
|
9933
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9934
|
+
}
|
|
9935
|
+
if (_response.error.reason === "status-code") {
|
|
9936
|
+
switch (_response.error.statusCode) {
|
|
9937
|
+
case 404:
|
|
9938
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9939
|
+
default:
|
|
9940
|
+
throw new VectrosError({
|
|
9941
|
+
statusCode: _response.error.statusCode,
|
|
9942
|
+
body: _response.error.body,
|
|
9943
|
+
rawResponse: _response.rawResponse
|
|
9944
|
+
});
|
|
9945
|
+
}
|
|
9946
|
+
}
|
|
9947
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers/{id}");
|
|
9948
|
+
}
|
|
9949
|
+
/**
|
|
9950
|
+
* Updates an existing trigger rule in place. The rule's resulting grant must be within your own granted scope — including a grant you did not change, because a trigger's other fields (its `scriptRef`, its `principalId`) determine what that grant executes. `name`, `principalId` and `provisionedBy` are immutable once set. Requires the `triggers:u` scope.
|
|
9951
|
+
*
|
|
9952
|
+
* @param {Vectros.UpdateTriggerRequest} request
|
|
9953
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9954
|
+
*
|
|
9955
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9956
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9957
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9958
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9959
|
+
*
|
|
9960
|
+
* @example
|
|
9961
|
+
* await client.triggers.updateTrigger({
|
|
9962
|
+
* id: "id",
|
|
9963
|
+
* body: {
|
|
9964
|
+
* name: "on-intake-create",
|
|
9965
|
+
* firingSource: {
|
|
9966
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9967
|
+
* event: "CREATE"
|
|
9968
|
+
* },
|
|
9969
|
+
* scriptRef: {
|
|
9970
|
+
* name: "notify-assignee",
|
|
9971
|
+
* version: "3"
|
|
9972
|
+
* }
|
|
9973
|
+
* }
|
|
9974
|
+
* })
|
|
9975
|
+
*/
|
|
9976
|
+
updateTrigger(request, requestOptions) {
|
|
9977
|
+
return HttpResponsePromise.fromPromise(this.__updateTrigger(request, requestOptions));
|
|
9978
|
+
}
|
|
9979
|
+
async __updateTrigger(request, requestOptions) {
|
|
9980
|
+
const { id, body: _body } = request;
|
|
9981
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9982
|
+
const _headers = mergeHeaders(
|
|
9983
|
+
_authRequest.headers,
|
|
9984
|
+
this._options?.headers,
|
|
9985
|
+
requestOptions?.headers
|
|
9986
|
+
);
|
|
9987
|
+
const _response = await fetcher({
|
|
9988
|
+
url: url_exports.join(
|
|
9989
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9990
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9991
|
+
),
|
|
9992
|
+
method: "PUT",
|
|
9993
|
+
headers: _headers,
|
|
9994
|
+
contentType: "application/json",
|
|
9995
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9996
|
+
requestType: "json",
|
|
9997
|
+
body: _body,
|
|
9998
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9999
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10000
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10001
|
+
fetchFn: this._options?.fetch,
|
|
10002
|
+
logging: this._options.logging
|
|
10003
|
+
});
|
|
10004
|
+
if (_response.ok) {
|
|
10005
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
10006
|
+
}
|
|
10007
|
+
if (_response.error.reason === "status-code") {
|
|
10008
|
+
switch (_response.error.statusCode) {
|
|
10009
|
+
case 400:
|
|
10010
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
10011
|
+
case 403:
|
|
10012
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
10013
|
+
case 404:
|
|
10014
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10015
|
+
case 429:
|
|
10016
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10017
|
+
default:
|
|
10018
|
+
throw new VectrosError({
|
|
10019
|
+
statusCode: _response.error.statusCode,
|
|
10020
|
+
body: _response.error.body,
|
|
10021
|
+
rawResponse: _response.rawResponse
|
|
10022
|
+
});
|
|
10023
|
+
}
|
|
10024
|
+
}
|
|
10025
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/triggers/{id}");
|
|
10026
|
+
}
|
|
10027
|
+
/**
|
|
10028
|
+
* Permanently deletes one trigger rule by ID. Requires the `triggers:d` scope.
|
|
10029
|
+
*
|
|
10030
|
+
* @param {Vectros.DeleteTriggerRequest} request
|
|
10031
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
10032
|
+
*
|
|
10033
|
+
* @throws {@link Vectros.NotFoundError}
|
|
10034
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
10035
|
+
*
|
|
10036
|
+
* @example
|
|
10037
|
+
* await client.triggers.deleteTrigger({
|
|
10038
|
+
* id: "id"
|
|
10039
|
+
* })
|
|
10040
|
+
*/
|
|
10041
|
+
deleteTrigger(request, requestOptions) {
|
|
10042
|
+
return HttpResponsePromise.fromPromise(this.__deleteTrigger(request, requestOptions));
|
|
10043
|
+
}
|
|
10044
|
+
async __deleteTrigger(request, requestOptions) {
|
|
10045
|
+
const { id } = request;
|
|
10046
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
10047
|
+
const _headers = mergeHeaders(
|
|
10048
|
+
_authRequest.headers,
|
|
10049
|
+
this._options?.headers,
|
|
10050
|
+
requestOptions?.headers
|
|
10051
|
+
);
|
|
10052
|
+
const _response = await fetcher({
|
|
10053
|
+
url: url_exports.join(
|
|
10054
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
10055
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
10056
|
+
),
|
|
10057
|
+
method: "DELETE",
|
|
10058
|
+
headers: _headers,
|
|
10059
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
10060
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
10061
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10062
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10063
|
+
fetchFn: this._options?.fetch,
|
|
10064
|
+
logging: this._options.logging
|
|
10065
|
+
});
|
|
10066
|
+
if (_response.ok) {
|
|
10067
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
10068
|
+
}
|
|
10069
|
+
if (_response.error.reason === "status-code") {
|
|
10070
|
+
switch (_response.error.statusCode) {
|
|
10071
|
+
case 404:
|
|
10072
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10073
|
+
case 429:
|
|
10074
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10075
|
+
default:
|
|
10076
|
+
throw new VectrosError({
|
|
10077
|
+
statusCode: _response.error.statusCode,
|
|
10078
|
+
body: _response.error.body,
|
|
10079
|
+
rawResponse: _response.rawResponse
|
|
10080
|
+
});
|
|
10081
|
+
}
|
|
10082
|
+
}
|
|
10083
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/triggers/{id}");
|
|
10084
|
+
}
|
|
10085
|
+
};
|
|
10086
|
+
var VectrosClient = class {
|
|
10087
|
+
constructor(options) {
|
|
10088
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
10089
|
+
}
|
|
10090
|
+
get auth() {
|
|
10091
|
+
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
10092
|
+
}
|
|
10093
|
+
get documents() {
|
|
10094
|
+
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
10095
|
+
}
|
|
10096
|
+
get identity() {
|
|
10097
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
10098
|
+
}
|
|
10099
|
+
get compliance() {
|
|
10100
|
+
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
10101
|
+
}
|
|
10102
|
+
get folders() {
|
|
10103
|
+
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
10104
|
+
}
|
|
10105
|
+
get inference() {
|
|
10106
|
+
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
10107
|
+
}
|
|
10108
|
+
get records() {
|
|
10109
|
+
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
10110
|
+
}
|
|
10111
|
+
get schemas() {
|
|
10112
|
+
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
10113
|
+
}
|
|
10114
|
+
get scripts() {
|
|
10115
|
+
return this._scripts ?? (this._scripts = new ScriptsClient(this._options));
|
|
10116
|
+
}
|
|
10117
|
+
get search() {
|
|
10118
|
+
return this._search ?? (this._search = new SearchClient(this._options));
|
|
10119
|
+
}
|
|
10120
|
+
get triggers() {
|
|
10121
|
+
return this._triggers ?? (this._triggers = new TriggersClient(this._options));
|
|
10122
|
+
}
|
|
10123
|
+
/**
|
|
10124
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
10125
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
10126
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
10127
|
+
*
|
|
10128
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
10129
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
10130
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
10131
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
10132
|
+
*/
|
|
10133
|
+
async fetch(input, init, requestOptions) {
|
|
10134
|
+
return makePassthroughRequest(
|
|
10135
|
+
input,
|
|
10136
|
+
init,
|
|
10137
|
+
{
|
|
10138
|
+
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
10139
|
+
headers: this._options.headers,
|
|
10140
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
10141
|
+
maxRetries: this._options.maxRetries,
|
|
10142
|
+
fetch: this._options.fetch,
|
|
10143
|
+
logging: this._options.logging,
|
|
10144
|
+
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
10145
|
+
},
|
|
10146
|
+
requestOptions
|
|
10147
|
+
);
|
|
10148
|
+
}
|
|
10149
|
+
};
|
|
10150
|
+
var logging;
|
|
10151
|
+
((logging2) => {
|
|
10152
|
+
logging2.LogLevel = LogLevel;
|
|
10153
|
+
logging2.ConsoleLogger = ConsoleLogger;
|
|
10154
|
+
})(logging || (logging = {}));
|
|
10155
|
+
|
|
10156
|
+
// src/server.ts
|
|
10157
|
+
var import_types3 = require("@modelcontextprotocol/sdk/types.js");
|
|
10158
|
+
var import_zod24 = require("zod");
|
|
10159
|
+
|
|
10160
|
+
// src/auth.ts
|
|
10161
|
+
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
10162
|
+
var InvalidApiKeyError = class extends Error {
|
|
10163
|
+
constructor(reason) {
|
|
10164
|
+
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
10165
|
+
this.name = "InvalidApiKeyError";
|
|
10166
|
+
}
|
|
10167
|
+
};
|
|
10168
|
+
function parseApiKey(raw) {
|
|
10169
|
+
if (!raw || raw.trim().length === 0) {
|
|
10170
|
+
throw new InvalidApiKeyError(
|
|
10171
|
+
"env var is missing or empty. Set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_... or ssk_test_...)."
|
|
10172
|
+
);
|
|
10173
|
+
}
|
|
10174
|
+
const match = raw.match(KEY_RE);
|
|
10175
|
+
if (!match) {
|
|
10176
|
+
throw new InvalidApiKeyError(
|
|
10177
|
+
`key must start with sk_, ssk_, or st_ followed by "live_" or "test_". Got prefix "${raw.slice(0, 12)}...".`
|
|
10178
|
+
);
|
|
10179
|
+
}
|
|
10180
|
+
return {
|
|
9270
10181
|
prefix: match[1],
|
|
9271
10182
|
env: match[2],
|
|
9272
10183
|
raw
|
|
@@ -9288,8 +10199,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
9288
10199
|
|
|
9289
10200
|
// src/build-info.ts
|
|
9290
10201
|
var BUILD_INFO = {
|
|
9291
|
-
mcpServer: true ? "0.
|
|
9292
|
-
sdk: true ? "0.
|
|
10202
|
+
mcpServer: true ? "0.17.0" : "dev",
|
|
10203
|
+
sdk: true ? "0.43.0" : "dev"
|
|
9293
10204
|
};
|
|
9294
10205
|
|
|
9295
10206
|
// src/log.ts
|
|
@@ -9597,11 +10508,18 @@ var inputSchema = {
|
|
|
9597
10508
|
// Ownership.
|
|
9598
10509
|
userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9599
10510
|
scope: import_zod.z.string().optional().describe(
|
|
9600
|
-
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
|
|
10511
|
+
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. Mutually exclusive with `scopeFilters` \u2014 use this for ONE dimension.'
|
|
10512
|
+
),
|
|
10513
|
+
scopeFilters: import_zod.z.array(import_zod.z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
10514
|
+
'Restrict to content matching ALL of these scope values \u2014 one per namespace \u2014 for a credential whose access spans more than one ownership dimension. e.g. ["org:<uuid>", "client:<uuid>"] narrows to one specific client WITHIN one specific org, which `scope` alone cannot express. Same `namespace:value` form as `scope`; naming the same namespace twice is rejected. Mutually exclusive with `scope` \u2014 use `scope` for a single dimension.'
|
|
9601
10515
|
),
|
|
9602
10516
|
// Date window.
|
|
9603
|
-
createdAfter: import_zod.z.string().optional().describe(
|
|
9604
|
-
|
|
10517
|
+
createdAfter: import_zod.z.string().optional().describe(
|
|
10518
|
+
"Restrict to content CREATED at/after this ISO 8601 UTC timestamp \u2014 the item's own creation time, which does NOT move when the item is later re-indexed. One bounded exception: an item matched on its FIRST index may be checked against the moment it was indexed instead, a small allowance for clock skew between creating and indexing it. Do not confuse this with a hit's returned `createdAt`, which is the index timestamp and can be later \u2014 see the tool description."
|
|
10519
|
+
),
|
|
10520
|
+
createdBefore: import_zod.z.string().optional().describe(
|
|
10521
|
+
"Restrict to content CREATED at/before this ISO 8601 UTC timestamp \u2014 same creation-time basis, and the same first-index allowance, as createdAfter."
|
|
10522
|
+
),
|
|
9605
10523
|
// Relevance tuning.
|
|
9606
10524
|
minSimilarity: import_zod.z.number().min(0).max(1).optional().describe("Minimum semantic similarity (0.0\u20131.0); results below are excluded."),
|
|
9607
10525
|
minTextRelevance: import_zod.z.number().min(0).max(1).optional().describe("Minimum relative keyword (BM25) relevance (0.0\u20131.0); the keyword-leg analogue of minSimilarity."),
|
|
@@ -9616,11 +10534,19 @@ var inputSchema = {
|
|
|
9616
10534
|
var hybridSearch = ({ client, log }) => ({
|
|
9617
10535
|
name: "hybrid_search",
|
|
9618
10536
|
title: "Hybrid search",
|
|
9619
|
-
description: 'Search your tenant\'s indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId
|
|
10537
|
+
description: 'Search your tenant\'s indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId, and scope for ONE ownership dimension or scopeFilters for several at once \u2014 e.g. one client within one org), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller\'s scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents AND records are excluded from results \u2014 fetch them by id via document_get/record_get, or restore them by setting status back to ACTIVE. One exception to know: an item archived before the platform enforced this can still be returned here until it is next written to, and nothing sweeps for those \u2014 if an archived item does come back as a hit, re-send status ARCHIVED on it (document_update / record_update) to re-assert the retraction. A hit\'s `createdAt` is when the item entered the search INDEX, which is the moment it was created in the common case but is later for anything re-indexed since \u2014 so do not report it to a user as the creation time; fetch the item with document_get/record_get and read its own createdAt for that. (The createdAfter/createdBefore filters are a separate thing and do filter on true creation time.) To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword (BM25) leg matched nothing (all textScores 0) \u2014 typically the default PHRASE mode finding no contiguous match for a long natural-language query. Loosen the keyword leg: shorten the query to its key terms, or set textMode "AND" (all terms, higher precision) or "OR" (any term, broad recall).',
|
|
9620
10538
|
inputSchema,
|
|
9621
10539
|
handler: async (args) => {
|
|
9622
10540
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
9623
10541
|
const mode = args.mode ?? "HYBRID";
|
|
10542
|
+
if (args.scope !== void 0 && args.scopeFilters !== void 0) {
|
|
10543
|
+
return toolError(
|
|
10544
|
+
"hybrid_search",
|
|
10545
|
+
new Error(
|
|
10546
|
+
"'scope' and 'scopeFilters' are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
10547
|
+
)
|
|
10548
|
+
);
|
|
10549
|
+
}
|
|
9624
10550
|
try {
|
|
9625
10551
|
const result = await client.search.content({
|
|
9626
10552
|
query: args.query,
|
|
@@ -9635,6 +10561,7 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9635
10561
|
filters: args.filters,
|
|
9636
10562
|
userId: args.userId,
|
|
9637
10563
|
scope: args.scope,
|
|
10564
|
+
scopeFilters: args.scopeFilters,
|
|
9638
10565
|
createdAfter: args.createdAfter,
|
|
9639
10566
|
createdBefore: args.createdBefore,
|
|
9640
10567
|
minSimilarity: args.minSimilarity,
|
|
@@ -9713,7 +10640,9 @@ async function drainPages(fetchPage) {
|
|
|
9713
10640
|
var MCP_DEFAULT_LIMIT2 = 3;
|
|
9714
10641
|
var MCP_MAX_LIMIT2 = 100;
|
|
9715
10642
|
var inputSchema2 = {
|
|
9716
|
-
type: import_zod2.z.string().min(1, "type
|
|
10643
|
+
type: import_zod2.z.string().min(1, "type must be non-empty when supplied").optional().describe(
|
|
10644
|
+
'Record type / schema name (e.g. "patient", "clinical_note"). REQUIRED for a lookup (`field`). In list mode it is one of three ways to choose what to list \u2014 supply `type`, `folderId`, or `recent` \u2014 and it may be combined with `folderId` to list one type within one folder.'
|
|
10645
|
+
),
|
|
9717
10646
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | values | from+to | prefix.
|
|
9718
10647
|
field: import_zod2.z.string().optional().describe(
|
|
9719
10648
|
'Lookup mode: name of the lookup-indexed field to query by. `externalId` is always queryable \u2014 e.g. `{type:"control", field:"externalId", value:"ctrl-scoped-key"}` finds the record you created under that externalId. (record_get / record_update also accept externalId directly.) For a SCHEMA-declared composite lookup \u2014 check list_schemas\' lookupFields for a fieldNames entry, not any two fields you pick \u2014 give those field names comma-joined in the declared order (e.g. "status,area"). Use `values` to match on several of those fields at once, or `value` to match on just the FIRST field named (equivalent to a one-element `values`); range/prefix are not valid on a composite field.'
|
|
@@ -9735,6 +10664,12 @@ var inputSchema2 = {
|
|
|
9735
10664
|
"Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc` \u2014 use `desc` with a range/prefix lookup to get the most-recent / highest values first (e.g. latest-N). Ignored in list mode."
|
|
9736
10665
|
),
|
|
9737
10666
|
// List-mode args:
|
|
10667
|
+
folderId: import_zod2.z.string().optional().describe(
|
|
10668
|
+
"List mode: list the records filed in this folder (a Vectros folder UUID), regardless of type \u2014 the record-side counterpart of document_query's folderId. Combine with `type` to list a single type within the folder. Use this to see what a folder holds before deleting it: folder_delete refuses a folder that still contains records."
|
|
10669
|
+
),
|
|
10670
|
+
recent: import_zod2.z.boolean().optional().describe(
|
|
10671
|
+
"List mode: return the account-wide recently-updated feed across ALL record types, newest first \u2014 a type-agnostic activity view, and the one way to read records without naming a type. Standalone: it cannot be combined with `type`, `folderId`, `userId` or `scope` (the API ignores them here, so this tool rejects the combination rather than silently returning something else). You still see only the record types your credential may read."
|
|
10672
|
+
),
|
|
9738
10673
|
userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9739
10674
|
scope: import_zod2.z.string().optional().describe(
|
|
9740
10675
|
'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
|
|
@@ -9747,11 +10682,13 @@ var inputSchema2 = {
|
|
|
9747
10682
|
var recordQuery = ({ client, log }) => ({
|
|
9748
10683
|
name: "record_query",
|
|
9749
10684
|
title: "Record query (list or lookup)",
|
|
9750
|
-
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `values` (exact, composite \u2014 one value per field; a single-element array is the same as `value`), `from`+`to` (range), or `prefix`. `values` with more than one entry, or a comma-joined `field`, ONLY works for a lookup the schema itself declared over several fields together \u2014 check list_schemas' lookupFields for a fieldNames entry, then pass those field names comma-joined as `field`; `from`/`to`/`prefix` are not valid there. Works on sensitive fields too. Optionally narrow an exact match to a window with `sortFrom`/`sortTo`.\n \u2022 List
|
|
10685
|
+
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `values` (exact, composite \u2014 one value per field; a single-element array is the same as `value`), `from`+`to` (range), or `prefix`. `values` with more than one entry, or a comma-joined `field`, ONLY works for a lookup the schema itself declared over several fields together \u2014 check list_schemas' lookupFields for a fieldNames entry, then pass those field names comma-joined as `field`; `from`/`to`/`prefix` are not valid there. Works on sensitive fields too. Optionally narrow an exact match to a window with `sortFrom`/`sortTo`.\n \u2022 List: omit `field`, then choose ONE of `type` (every record of a type), `folderId` (every record filed in a folder, any type \u2014 combine with `type` for one type within one folder), or `recent` (the account-wide recently-updated feed across every type, newest first \u2014 the only way to read records without naming a type, and standalone: no other filter applies to it). `userId`/`scope` further narrow the type and folder modes.\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. A composite lookup given fewer than its full field count returns records grouped by the unspecified fields, ordered within each group. Mode is auto-detected from the arguments present.",
|
|
9751
10686
|
inputSchema: inputSchema2,
|
|
9752
10687
|
handler: async (args) => {
|
|
9753
10688
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
9754
10689
|
const type = args.type;
|
|
10690
|
+
const folderId = args.folderId;
|
|
10691
|
+
const recent = args.recent;
|
|
9755
10692
|
const field = args.field;
|
|
9756
10693
|
const value = args.value;
|
|
9757
10694
|
const values = args.values;
|
|
@@ -9769,6 +10706,48 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9769
10706
|
)
|
|
9770
10707
|
);
|
|
9771
10708
|
}
|
|
10709
|
+
if (field && (folderId !== void 0 || recent !== void 0)) {
|
|
10710
|
+
return toolError(
|
|
10711
|
+
"record_query",
|
|
10712
|
+
new Error(
|
|
10713
|
+
"'folderId' and 'recent' are list-mode selectors and do not apply to a lookup ('field') \u2014 a lookup runs within one `type` and would ignore them. Drop `field` to list, or drop these to look up."
|
|
10714
|
+
)
|
|
10715
|
+
);
|
|
10716
|
+
}
|
|
10717
|
+
if (field && !type) {
|
|
10718
|
+
return toolError(
|
|
10719
|
+
"record_query",
|
|
10720
|
+
new Error(
|
|
10721
|
+
"a lookup ('field') is always within one record type \u2014 pass 'type'. To read across types, use list mode with 'folderId' or 'recent'."
|
|
10722
|
+
)
|
|
10723
|
+
);
|
|
10724
|
+
}
|
|
10725
|
+
if (!field) {
|
|
10726
|
+
if (recent && (type !== void 0 || folderId !== void 0)) {
|
|
10727
|
+
return toolError(
|
|
10728
|
+
"record_query",
|
|
10729
|
+
new Error(
|
|
10730
|
+
"'recent' is the account-wide feed across all types and cannot be narrowed \u2014 it is mutually exclusive with 'type' and 'folderId'. Drop 'recent' to list by type/folder."
|
|
10731
|
+
)
|
|
10732
|
+
);
|
|
10733
|
+
}
|
|
10734
|
+
if (recent && (args.userId !== void 0 || args.scope !== void 0)) {
|
|
10735
|
+
return toolError(
|
|
10736
|
+
"record_query",
|
|
10737
|
+
new Error(
|
|
10738
|
+
"'recent' ignores the owner filters \u2014 'userId'/'scope' would be silently dropped. List by 'type' or 'folderId' to filter by owner."
|
|
10739
|
+
)
|
|
10740
|
+
);
|
|
10741
|
+
}
|
|
10742
|
+
if (!recent && type === void 0 && folderId === void 0) {
|
|
10743
|
+
return toolError(
|
|
10744
|
+
"record_query",
|
|
10745
|
+
new Error(
|
|
10746
|
+
"list mode needs one of 'type' (records of a type), 'folderId' (records in a folder, any type), or 'recent' (the account-wide recently-updated feed). Add 'field' to run a lookup."
|
|
10747
|
+
)
|
|
10748
|
+
);
|
|
10749
|
+
}
|
|
10750
|
+
}
|
|
9772
10751
|
try {
|
|
9773
10752
|
let page;
|
|
9774
10753
|
if (field) {
|
|
@@ -9832,6 +10811,7 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9832
10811
|
}
|
|
9833
10812
|
}
|
|
9834
10813
|
page = await client.records.lookupRecordsByBody({
|
|
10814
|
+
// Non-null: the `field && !type` guard above returns before reaching lookup mode.
|
|
9835
10815
|
type,
|
|
9836
10816
|
field: normalizedField,
|
|
9837
10817
|
value,
|
|
@@ -9852,13 +10832,22 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9852
10832
|
} else {
|
|
9853
10833
|
page = await client.records.listRecords({
|
|
9854
10834
|
type,
|
|
10835
|
+
folderId,
|
|
10836
|
+
...recent ? { recent: "true" } : {},
|
|
9855
10837
|
userId: args.userId,
|
|
9856
10838
|
scope: args.scope,
|
|
9857
10839
|
startFrom,
|
|
9858
10840
|
limit
|
|
9859
10841
|
});
|
|
9860
10842
|
log.debug(
|
|
9861
|
-
{
|
|
10843
|
+
{
|
|
10844
|
+
tool: "record_query",
|
|
10845
|
+
mode: recent ? "list:recent" : folderId ? "list:folder" : "list:type",
|
|
10846
|
+
type,
|
|
10847
|
+
folderId,
|
|
10848
|
+
limit,
|
|
10849
|
+
returned: pageItems(page).length
|
|
10850
|
+
},
|
|
9862
10851
|
"record_query list ok"
|
|
9863
10852
|
);
|
|
9864
10853
|
}
|
|
@@ -10035,7 +11024,7 @@ var inputSchema5 = {
|
|
|
10035
11024
|
folderId: import_zod5.z.string().optional().describe("Group this record into a folder."),
|
|
10036
11025
|
userId: import_zod5.z.string().optional().describe("Owning user id."),
|
|
10037
11026
|
scopes: import_zod5.z.array(import_zod5.z.string()).optional().describe(
|
|
10038
|
-
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the record\'s COMPLETE scope declaration and
|
|
11027
|
+
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the record\'s COMPLETE scope declaration, and each entry must fall inside the `data_scope` of a single clause of your credential that also grants this write \u2014 your identity supplies the DEFAULT when you state none, it does not limit which value you may state. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
10039
11028
|
)
|
|
10040
11029
|
};
|
|
10041
11030
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -10068,19 +11057,101 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10068
11057
|
});
|
|
10069
11058
|
var record_create_default = recordCreate;
|
|
10070
11059
|
|
|
10071
|
-
// src/tools/
|
|
11060
|
+
// src/tools/record_batch_write.ts
|
|
10072
11061
|
var import_zod6 = require("zod");
|
|
10073
|
-
var
|
|
10074
|
-
|
|
11062
|
+
var MCP_MAX_ITEMS = 50;
|
|
11063
|
+
var itemSchema = import_zod6.z.strictObject({
|
|
11064
|
+
type: import_zod6.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
|
|
11065
|
+
fields: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).describe(
|
|
11066
|
+
"The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Same rules as record_create, including the signed 64-bit range on numbers (send a larger whole number as a STRING)."
|
|
11067
|
+
),
|
|
10075
11068
|
externalId: import_zod6.z.string().optional().describe(
|
|
11069
|
+
'Stable caller-supplied id, unique per type \u2014 supply it to make a batch safely retryable, since without one a re-submitted item creates a second record. Without `upsert`, an item whose externalId already matches a COMMITTED record comes back `updated` (the idempotent repeat \u2014 nothing was overwritten) if your credential can read that type; a create-only credential gets `conflict` instead, because it may not be shown the existing record. \u26A0\uFE0F Two items sharing ONE externalId WITHIN a single batch are only refused as a `conflict` under atomicity:"all_or_nothing". Under the DEFAULT best_effort each item is written independently, so the second matches what the first just wrote and reports `updated` \u2014 a duplicate key in your input silently collapses two rows into one, counted in `succeeded`, not in `failed`. De-duplicate by externalId before sending, or use all_or_nothing if you need the batch to refuse. A result returns the record\'s `id`, not the record itself; fetch that with record_get/record_batch_get.'
|
|
11070
|
+
),
|
|
11071
|
+
indexMode: import_zod6.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
11072
|
+
"Search-index strategy for this record, set at create only and NOT changeable later. HYBRID (BM25 + dense), SEMANTIC (dense only), TEXT (BM25 only), NONE (store-only \u2014 the record never appears in hybrid_search/rag_ask, though it stays retrievable by id and by structured-field lookup). Omit to inherit the type schema's default; if that default is NONE and you want these records searchable, set it here, because it cannot be fixed after the write."
|
|
11073
|
+
),
|
|
11074
|
+
status: import_zod6.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
11075
|
+
folderId: import_zod6.z.string().optional().describe("Group this record into a folder."),
|
|
11076
|
+
userId: import_zod6.z.string().optional().describe("Owning user id."),
|
|
11077
|
+
scopes: import_zod6.z.array(import_zod6.z.string()).optional().describe(
|
|
11078
|
+
"Scope ownership as `namespace:value` entries, at most 2 namespaces. When supplied this is the record's COMPLETE scope declaration, and each entry must fall inside the `data_scope` of a single clause of your credential that also grants this write \u2014 your identity supplies the DEFAULT when you state none, it does not limit which value you may state. `[]` creates a PRIVATE record owned by the calling user alone. Omit to inherit the credential's full identity."
|
|
11079
|
+
)
|
|
11080
|
+
});
|
|
11081
|
+
var inputSchema6 = {
|
|
11082
|
+
items: import_zod6.z.array(itemSchema).min(1).max(MCP_MAX_ITEMS).describe(
|
|
11083
|
+
`The records to write, 1-${MCP_MAX_ITEMS}. Each item is shaped like a record_create call (\`type\` + \`fields\`, plus the same optional externalId/indexMode/status/folderId/userId/scopes) and is validated and scope-checked individually against its OWN type \u2014 items may mix types.`
|
|
11084
|
+
),
|
|
11085
|
+
atomicity: import_zod6.z.enum(["best_effort", "all_or_nothing"]).optional().describe(
|
|
11086
|
+
'How the batch commits. "best_effort" (the default) writes each item independently \u2014 some can succeed while others fail. "all_or_nothing" commits every item in ONE transaction: if any item fails nothing is written at all, and the items that were themselves fine report status "not_committed". Choose all_or_nothing when the records are interdependent or a half-written set would be worse than none; note it can still be refused as too large to commit atomically even within the item limit, because that transaction is bounded by underlying storage rows rather than by item count (nothing is written when that happens).'
|
|
11087
|
+
),
|
|
11088
|
+
upsert: import_zod6.z.boolean().optional().describe(
|
|
11089
|
+
"Applies to every item: when true, an item whose `externalId` already exists OVERWRITES that record instead of returning it unchanged. Needs records:u:<type> in addition to records:c:<type>, checked per item. Default false."
|
|
11090
|
+
),
|
|
11091
|
+
allowClear: import_zod6.z.boolean().optional().describe(
|
|
11092
|
+
"Only meaningful with upsert:true, which overwrites as a FULL replacement. If an item's `fields` omits (or nulls) a stored field that only comes back as an indexed projection \u2014 a large record whose payload is stored externally \u2014 the overwrite is refused unless you set this to true to confirm you mean to clear those fields. Default false. To change some fields without clearing the omitted ones, use record_update instead of an upserting batch."
|
|
11093
|
+
)
|
|
11094
|
+
};
|
|
11095
|
+
var recordBatchWrite = ({ client, log }) => ({
|
|
11096
|
+
name: "record_batch_write",
|
|
11097
|
+
title: "Create or upsert multiple records in one call",
|
|
11098
|
+
description: 'Write up to 50 structured records in a single call \u2014 use this instead of N record_create calls when you hold several records (e.g. filing a parsed table, or seeding a set of tasks). Items may mix types; each one is schema-validated, externalId-idempotent and scope-checked individually against its own type (records:c:<type> per item), so a batch cannot write a type you could not write one at a time. `atomicity` chooses the commit shape: "best_effort" (default) writes each item independently; "all_or_nothing" commits every item in one transaction, writing nothing at all if any item fails \u2014 prefer it when a half-written set would be worse than none. IMPORTANT: this call reports success whenever the batch was PROCESSED, including when every item failed \u2014 so always read the per-item `results` and the `succeeded`/`failed` counts rather than treating a non-error result as "all written". This differs from record_create, where a failure is an error result. Results are NOT guaranteed to arrive in the order you submitted: match each one to its item by its `index` (zero-based, the position in your `items` array). A result carries the written record\'s `id` (null on failure) and, when it failed, an `error` with a machine-readable `code` and a human-readable `message` \u2014 read it before resubmitting. It does NOT carry the record itself; fetch that with record_get/record_batch_get. A per-item `status` is created (new record written), updated (an existing record matched \u2014 overwritten only if you passed upsert:true, otherwise returned unchanged, so this is not by itself evidence of a write), conflict (uniqueness or version), invalid (validation \u2014 read `error.message` for which field), forbidden (your credential lacks the scope or ownership that item needed \u2014 fix the credential, not the item), or not_committed (this item was fine but an all_or_nothing batch was aborted by a different item, so resubmitting with that one fixed writes this one unchanged).',
|
|
11099
|
+
inputSchema: inputSchema6,
|
|
11100
|
+
handler: async (args) => {
|
|
11101
|
+
const items = args.items;
|
|
11102
|
+
const atomicity = args.atomicity;
|
|
11103
|
+
try {
|
|
11104
|
+
const body = {
|
|
11105
|
+
items: items.map((item) => ({
|
|
11106
|
+
typeName: item.type,
|
|
11107
|
+
payload: item.fields,
|
|
11108
|
+
externalId: item.externalId,
|
|
11109
|
+
indexMode: item.indexMode,
|
|
11110
|
+
status: item.status,
|
|
11111
|
+
folderId: item.folderId,
|
|
11112
|
+
userId: item.userId,
|
|
11113
|
+
scopes: item.scopes
|
|
11114
|
+
})),
|
|
11115
|
+
atomicity,
|
|
11116
|
+
upsert: args.upsert,
|
|
11117
|
+
allowClear: args.allowClear
|
|
11118
|
+
};
|
|
11119
|
+
const response = await client.records.batchWriteRecords(body, { maxRetries: 0 });
|
|
11120
|
+
log.debug(
|
|
11121
|
+
{
|
|
11122
|
+
tool: "record_batch_write",
|
|
11123
|
+
submitted: items.length,
|
|
11124
|
+
atomicity: atomicity ?? "best_effort",
|
|
11125
|
+
succeeded: response.succeeded,
|
|
11126
|
+
failed: response.failed
|
|
11127
|
+
},
|
|
11128
|
+
"record_batch_write ok"
|
|
11129
|
+
);
|
|
11130
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
11131
|
+
} catch (err) {
|
|
11132
|
+
log.warn(
|
|
11133
|
+
{ tool: "record_batch_write", itemCount: items?.length, err: String(err) },
|
|
11134
|
+
"record_batch_write failed"
|
|
11135
|
+
);
|
|
11136
|
+
return toolError("record_batch_write", err);
|
|
11137
|
+
}
|
|
11138
|
+
}
|
|
11139
|
+
});
|
|
11140
|
+
var record_batch_write_default = recordBatchWrite;
|
|
11141
|
+
|
|
11142
|
+
// src/tools/record_update.ts
|
|
11143
|
+
var import_zod7 = require("zod");
|
|
11144
|
+
var inputSchema7 = {
|
|
11145
|
+
id: import_zod7.z.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
|
|
11146
|
+
externalId: import_zod7.z.string().optional().describe(
|
|
10076
11147
|
"Your caller-owned externalId \u2014 an alternative selector to `id` (requires `type`). Updates the record you created under that externalId without a manual record_query lookup first."
|
|
10077
11148
|
),
|
|
10078
|
-
type:
|
|
10079
|
-
fields:
|
|
11149
|
+
type: import_zod7.z.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11150
|
+
fields: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).describe(
|
|
10080
11151
|
"Field\u2192value changes DEEP-MERGED into the existing payload: keys you send overwrite (recursing into nested objects), a key set to `null` is deleted, and unspecified fields are preserved."
|
|
10081
11152
|
),
|
|
10082
|
-
status:
|
|
10083
|
-
expectedVersion:
|
|
11153
|
+
status: import_zod7.z.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
|
|
11154
|
+
expectedVersion: import_zod7.z.number().int().optional().describe(
|
|
10084
11155
|
"Optimistic concurrency: the version you last read. If the record changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10085
11156
|
)
|
|
10086
11157
|
};
|
|
@@ -10088,7 +11159,7 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10088
11159
|
name: "record_update",
|
|
10089
11160
|
title: "Update a record by id or externalId",
|
|
10090
11161
|
description: "Update a record \u2014 select it by its Vectros `id` OR by your own `externalId` + `type` (the same key you passed to record_create, resolved for you). The provided `fields` are DEEP-MERGED into the existing payload (unspecified fields are preserved; a field set to `null` is deleted). Pass `expectedVersion` (the version you last read) for safe concurrent edits \u2014 a stale update is refused (409). Use `status` to archive without deleting. Requires the key to allow records:u.",
|
|
10091
|
-
inputSchema:
|
|
11162
|
+
inputSchema: inputSchema7,
|
|
10092
11163
|
handler: async (args) => {
|
|
10093
11164
|
const id = args.id;
|
|
10094
11165
|
const externalId = args.externalId;
|
|
@@ -10114,15 +11185,15 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10114
11185
|
var record_update_default = recordUpdate;
|
|
10115
11186
|
|
|
10116
11187
|
// src/tools/record_delete.ts
|
|
10117
|
-
var
|
|
10118
|
-
var
|
|
10119
|
-
id:
|
|
11188
|
+
var import_zod8 = require("zod");
|
|
11189
|
+
var inputSchema8 = {
|
|
11190
|
+
id: import_zod8.z.string().min(1, "id is required").describe("The Vectros record id to delete.")
|
|
10120
11191
|
};
|
|
10121
11192
|
var recordDelete = ({ client, log }) => ({
|
|
10122
11193
|
name: "record_delete",
|
|
10123
11194
|
title: "Delete a record",
|
|
10124
11195
|
description: "Permanently delete a record by id (leaves a tombstone). Requires the key to allow records:d \u2014 a key without it gets a permission error. To archive without deleting, use record_update to set status instead.",
|
|
10125
|
-
inputSchema:
|
|
11196
|
+
inputSchema: inputSchema8,
|
|
10126
11197
|
handler: async (args) => {
|
|
10127
11198
|
const id = args.id;
|
|
10128
11199
|
try {
|
|
@@ -10138,49 +11209,63 @@ var recordDelete = ({ client, log }) => ({
|
|
|
10138
11209
|
var record_delete_default = recordDelete;
|
|
10139
11210
|
|
|
10140
11211
|
// src/tools/rag_ask.ts
|
|
10141
|
-
var
|
|
11212
|
+
var import_zod9 = require("zod");
|
|
10142
11213
|
var SEARCH_MCP_DEFAULT_LIMIT = 5;
|
|
10143
11214
|
var SEARCH_MCP_MAX_LIMIT = 50;
|
|
10144
|
-
var
|
|
10145
|
-
query:
|
|
10146
|
-
instructions:
|
|
11215
|
+
var inputSchema9 = {
|
|
11216
|
+
query: import_zod9.z.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
|
|
11217
|
+
instructions: import_zod9.z.string().optional().describe(
|
|
10147
11218
|
'System prompt that overrides the default for the generation step \u2014 e.g. "answer only from the provided context, cite sources, be concise". Default: a generic answer-from-context instruction.'
|
|
10148
11219
|
),
|
|
10149
|
-
model:
|
|
11220
|
+
model: import_zod9.z.string().optional().describe(
|
|
10150
11221
|
"Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-5, claude-opus-4-8). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
10151
11222
|
),
|
|
10152
|
-
search:
|
|
10153
|
-
mode:
|
|
10154
|
-
limit:
|
|
11223
|
+
search: import_zod9.z.object({
|
|
11224
|
+
mode: import_zod9.z.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
|
|
11225
|
+
limit: import_zod9.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
10155
11226
|
`Passages to retrieve before generating (the grounding-corpus size). Default ${SEARCH_MCP_DEFAULT_LIMIT}; raise up to ${SEARCH_MCP_MAX_LIMIT} (the RAG search API max) for a broader corpus when the extra grounding is worth the larger prompt.`
|
|
10156
11227
|
),
|
|
10157
11228
|
// Retrieval scoping — parity with hybrid_search so an agent can ground the
|
|
10158
11229
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
10159
11230
|
// whole-tenant corpus.
|
|
10160
|
-
userId:
|
|
10161
|
-
scope:
|
|
10162
|
-
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
|
|
11231
|
+
userId: import_zod9.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
11232
|
+
scope: import_zod9.z.string().optional().describe(
|
|
11233
|
+
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. Mutually exclusive with `scopeFilters` \u2014 use this for ONE dimension.'
|
|
11234
|
+
),
|
|
11235
|
+
scopeFilters: import_zod9.z.array(import_zod9.z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
11236
|
+
'Restrict retrieval to content matching ALL of these scope values \u2014 one per namespace \u2014 for a credential whose access spans more than one ownership dimension. e.g. ["org:<uuid>", "client:<uuid>"] grounds the answer on one specific client WITHIN one specific org, which `scope` alone cannot express. Naming the same namespace twice is rejected. Mutually exclusive with `scope`.'
|
|
10163
11237
|
),
|
|
10164
|
-
folderId:
|
|
10165
|
-
rootFolderId:
|
|
10166
|
-
typeName:
|
|
10167
|
-
contentTypes:
|
|
10168
|
-
filters:
|
|
11238
|
+
folderId: import_zod9.z.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
11239
|
+
rootFolderId: import_zod9.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
11240
|
+
typeName: import_zod9.z.string().optional().describe("Restrict record retrieval to this schema type."),
|
|
11241
|
+
contentTypes: import_zod9.z.array(import_zod9.z.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
|
|
11242
|
+
filters: import_zod9.z.record(import_zod9.z.unknown()).optional().describe(
|
|
10169
11243
|
'Field-level metadata filters (AND-combined). Value = scalar (equality), array (OR-set), or operator map ($eq/$ne/$gt/$gte/$lt/$lte, $in/$nin). e.g. {"status":"open"}.'
|
|
10170
11244
|
),
|
|
10171
|
-
createdAfter:
|
|
10172
|
-
|
|
10173
|
-
|
|
11245
|
+
createdAfter: import_zod9.z.string().optional().describe(
|
|
11246
|
+
"Restrict retrieval to content CREATED at/after this ISO 8601 UTC timestamp \u2014 the item's own creation time, which does not move when it is re-indexed. An item matched on its FIRST index may be checked against its index time instead, a bounded clock-skew allowance."
|
|
11247
|
+
),
|
|
11248
|
+
createdBefore: import_zod9.z.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
|
|
11249
|
+
requireComplete: import_zod9.z.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
|
|
10174
11250
|
}).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
|
|
10175
|
-
maxTokens:
|
|
10176
|
-
temperature:
|
|
11251
|
+
maxTokens: import_zod9.z.number().int().min(1).optional().describe("Max output tokens."),
|
|
11252
|
+
temperature: import_zod9.z.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
|
|
10177
11253
|
};
|
|
10178
11254
|
var ragAsk = ({ client, log }) => ({
|
|
10179
11255
|
name: "rag_ask",
|
|
10180
11256
|
title: "RAG ask (corpus-wide)",
|
|
10181
|
-
description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership, folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
|
|
10182
|
-
inputSchema:
|
|
11257
|
+
description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership \u2014 `scope` for one ownership dimension or `scopeFilters` for several at once, e.g. one client within one org \u2014 folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
|
|
11258
|
+
inputSchema: inputSchema9,
|
|
10183
11259
|
handler: async (args, extra) => {
|
|
11260
|
+
const rawSearch = args.search ?? {};
|
|
11261
|
+
if (rawSearch.scope !== void 0 && rawSearch.scopeFilters !== void 0) {
|
|
11262
|
+
return toolError(
|
|
11263
|
+
"rag_ask",
|
|
11264
|
+
new Error(
|
|
11265
|
+
"search.scope and search.scopeFilters are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
11266
|
+
)
|
|
11267
|
+
);
|
|
11268
|
+
}
|
|
10184
11269
|
try {
|
|
10185
11270
|
const searchArg = args.search ?? {};
|
|
10186
11271
|
const search = {
|
|
@@ -10188,6 +11273,7 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10188
11273
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
10189
11274
|
userId: searchArg.userId,
|
|
10190
11275
|
scope: searchArg.scope,
|
|
11276
|
+
scopeFilters: searchArg.scopeFilters,
|
|
10191
11277
|
folderId: searchArg.folderId,
|
|
10192
11278
|
rootFolderId: searchArg.rootFolderId,
|
|
10193
11279
|
typeName: searchArg.typeName,
|
|
@@ -10255,20 +11341,20 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10255
11341
|
var rag_ask_default = ragAsk;
|
|
10256
11342
|
|
|
10257
11343
|
// src/tools/document_ask.ts
|
|
10258
|
-
var
|
|
10259
|
-
var
|
|
10260
|
-
documentId:
|
|
10261
|
-
prompt:
|
|
10262
|
-
model:
|
|
11344
|
+
var import_zod10 = require("zod");
|
|
11345
|
+
var inputSchema10 = {
|
|
11346
|
+
documentId: import_zod10.z.string().min(1, "documentId is required").describe("ID of the document to ask against."),
|
|
11347
|
+
prompt: import_zod10.z.string().min(1, "prompt is required").describe("Question to ask about the document."),
|
|
11348
|
+
model: import_zod10.z.string().optional().describe(
|
|
10263
11349
|
"Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
10264
11350
|
),
|
|
10265
|
-
maxTokens:
|
|
11351
|
+
maxTokens: import_zod10.z.number().int().min(1).optional().describe("Max output tokens.")
|
|
10266
11352
|
};
|
|
10267
11353
|
var documentAsk = ({ client, log }) => ({
|
|
10268
11354
|
name: "document_ask",
|
|
10269
11355
|
title: "Document ask (single-document)",
|
|
10270
11356
|
description: "Ask a question against a single indexed document. Returns a grounded answer with the document context that informed it. For documents exceeding the input-token cap, the API returns a structured 413 with `estimatedTokens` and `limitTokens`. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
|
|
10271
|
-
inputSchema:
|
|
11357
|
+
inputSchema: inputSchema10,
|
|
10272
11358
|
handler: async (args, extra) => {
|
|
10273
11359
|
try {
|
|
10274
11360
|
const stream = await client.inference.documentAsk({
|
|
@@ -10327,18 +11413,18 @@ var documentAsk = ({ client, log }) => ({
|
|
|
10327
11413
|
var document_ask_default = documentAsk;
|
|
10328
11414
|
|
|
10329
11415
|
// src/tools/list_schemas.ts
|
|
10330
|
-
var
|
|
10331
|
-
var
|
|
10332
|
-
userId:
|
|
11416
|
+
var import_zod11 = require("zod");
|
|
11417
|
+
var inputSchema11 = {
|
|
11418
|
+
userId: import_zod11.z.string().optional().describe(
|
|
10333
11419
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
10334
11420
|
),
|
|
10335
|
-
scope:
|
|
11421
|
+
scope: import_zod11.z.string().optional().describe(
|
|
10336
11422
|
'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other. Optional; default returns all schemas the credential can see.'
|
|
10337
11423
|
),
|
|
10338
|
-
surface:
|
|
11424
|
+
surface: import_zod11.z.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
10339
11425
|
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. Identity entities in any namespace (org/client/one you registered) bind under the single `entity` surface; `user` and `entity` are account-wide. Optional."
|
|
10340
11426
|
),
|
|
10341
|
-
recordType:
|
|
11427
|
+
recordType: import_zod11.z.string().optional().describe(
|
|
10342
11428
|
'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
|
|
10343
11429
|
)
|
|
10344
11430
|
};
|
|
@@ -10346,7 +11432,7 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10346
11432
|
name: "list_schemas",
|
|
10347
11433
|
title: "List record schemas",
|
|
10348
11434
|
description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
|
|
10349
|
-
inputSchema:
|
|
11435
|
+
inputSchema: inputSchema11,
|
|
10350
11436
|
handler: async (args) => {
|
|
10351
11437
|
const userId = args.userId;
|
|
10352
11438
|
const scope = args.scope;
|
|
@@ -10372,18 +11458,18 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10372
11458
|
var list_schemas_default = listSchemas;
|
|
10373
11459
|
|
|
10374
11460
|
// src/tools/document_get.ts
|
|
10375
|
-
var
|
|
11461
|
+
var import_zod12 = require("zod");
|
|
10376
11462
|
var MAX_TEXT_CHARS = 32e3;
|
|
10377
|
-
var
|
|
10378
|
-
documentId:
|
|
10379
|
-
externalId:
|
|
11463
|
+
var inputSchema12 = {
|
|
11464
|
+
documentId: import_zod12.z.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
|
|
11465
|
+
externalId: import_zod12.z.string().optional().describe(
|
|
10380
11466
|
"Your caller-owned externalId \u2014 an alternative selector to `documentId` (requires `type`). Fetches the document you ingested under that externalId without a manual lookup first."
|
|
10381
11467
|
),
|
|
10382
|
-
type:
|
|
10383
|
-
includeText:
|
|
11468
|
+
type: import_zod12.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11469
|
+
includeText: import_zod12.z.boolean().optional().describe(
|
|
10384
11470
|
"If true, fetch and include the document text (capped at ~8K tokens, truncated: true flag if cut). Default false \u2014 metadata only. For larger documents, prefer `document_ask` over dumping text into context."
|
|
10385
11471
|
),
|
|
10386
|
-
includeDownloadUrl:
|
|
11472
|
+
includeDownloadUrl: import_zod12.z.boolean().optional().describe(
|
|
10387
11473
|
"If true, also return a short-lived presigned `downloadUrl` for the original file (file-backed documents only \u2014 the way to retrieve the raw bytes of a document ingested via file mode). Default false. Unavailable for text-only documents \u2014 `downloadAvailable: false` is set instead."
|
|
10388
11474
|
)
|
|
10389
11475
|
};
|
|
@@ -10400,7 +11486,7 @@ var documentGet = ({ client, log }) => ({
|
|
|
10400
11486
|
name: "document_get",
|
|
10401
11487
|
title: "Get document metadata (and optionally text)",
|
|
10402
11488
|
description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`. When `indexStatus` is FAILED the response also carries `indexFailure` with a machine-readable `code` telling you whether the content is still findable \u2014 e.g. TEXT_INDEX_FAILED / VECTOR_LIMIT_EXCEEDED (one leg still serves it) vs INDEXING_FAILED (not findable by search at all). Branch on `code`, not on the message.",
|
|
10403
|
-
inputSchema:
|
|
11489
|
+
inputSchema: inputSchema12,
|
|
10404
11490
|
handler: async (args) => {
|
|
10405
11491
|
const documentId = args.documentId;
|
|
10406
11492
|
const externalId = args.externalId;
|
|
@@ -10465,28 +11551,28 @@ var documentGet = ({ client, log }) => ({
|
|
|
10465
11551
|
var document_get_default = documentGet;
|
|
10466
11552
|
|
|
10467
11553
|
// src/tools/document_query.ts
|
|
10468
|
-
var
|
|
11554
|
+
var import_zod13 = require("zod");
|
|
10469
11555
|
var MCP_DEFAULT_LIMIT3 = 3;
|
|
10470
11556
|
var MCP_MAX_LIMIT3 = 100;
|
|
10471
|
-
var
|
|
11557
|
+
var inputSchema13 = {
|
|
10472
11558
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
10473
|
-
field:
|
|
10474
|
-
value:
|
|
10475
|
-
from:
|
|
10476
|
-
to:
|
|
10477
|
-
prefix:
|
|
10478
|
-
order:
|
|
11559
|
+
field: import_zod13.z.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
|
|
11560
|
+
value: import_zod13.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
|
|
11561
|
+
from: import_zod13.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
|
|
11562
|
+
to: import_zod13.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
11563
|
+
prefix: import_zod13.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
11564
|
+
order: import_zod13.z.enum(["asc", "desc"]).optional().describe(
|
|
10479
11565
|
"Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc` \u2014 use `desc` with a range/prefix lookup to get the most-recent / highest values first (e.g. latest-N). Ignored in list mode."
|
|
10480
11566
|
),
|
|
10481
|
-
type:
|
|
11567
|
+
type: import_zod13.z.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
|
|
10482
11568
|
// List-mode args:
|
|
10483
|
-
folderId:
|
|
10484
|
-
userId:
|
|
10485
|
-
scope:
|
|
11569
|
+
folderId: import_zod13.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
11570
|
+
userId: import_zod13.z.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
11571
|
+
scope: import_zod13.z.string().optional().describe(
|
|
10486
11572
|
'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
|
|
10487
11573
|
),
|
|
10488
|
-
startFrom:
|
|
10489
|
-
limit:
|
|
11574
|
+
startFrom: import_zod13.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
11575
|
+
limit: import_zod13.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
10490
11576
|
`Max documents per page. Defaults to a low ${MCP_DEFAULT_LIMIT3} to protect the agent context window; raise up to ${MCP_MAX_LIMIT3} (the documents API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
|
|
10491
11577
|
)
|
|
10492
11578
|
};
|
|
@@ -10494,7 +11580,7 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10494
11580
|
name: "document_query",
|
|
10495
11581
|
title: "Document query (list or lookup)",
|
|
10496
11582
|
description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
|
|
10497
|
-
inputSchema:
|
|
11583
|
+
inputSchema: inputSchema13,
|
|
10498
11584
|
handler: async (args) => {
|
|
10499
11585
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
10500
11586
|
const field = args.field;
|
|
@@ -10574,29 +11660,29 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10574
11660
|
var document_query_default = documentQuery;
|
|
10575
11661
|
|
|
10576
11662
|
// src/tools/document_update.ts
|
|
10577
|
-
var
|
|
10578
|
-
var
|
|
10579
|
-
documentId:
|
|
10580
|
-
externalId:
|
|
11663
|
+
var import_zod14 = require("zod");
|
|
11664
|
+
var inputSchema14 = {
|
|
11665
|
+
documentId: import_zod14.z.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
|
|
11666
|
+
externalId: import_zod14.z.string().optional().describe(
|
|
10581
11667
|
"Your caller-owned externalId \u2014 an alternative selector to `documentId` (requires `type`). Updates the document you ingested under that externalId without a manual lookup first."
|
|
10582
11668
|
),
|
|
10583
|
-
type:
|
|
10584
|
-
title:
|
|
10585
|
-
fields:
|
|
11669
|
+
type: import_zod14.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11670
|
+
title: import_zod14.z.string().optional().describe("New title. Omit to keep the current title."),
|
|
11671
|
+
fields: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.unknown()).optional().describe(
|
|
10586
11672
|
"Typed-payload field\u2192value changes DEEP-MERGED into the existing payload (a field set to `null` is deleted; unspecified fields preserved). Omit to leave the payload unchanged."
|
|
10587
11673
|
),
|
|
10588
|
-
text:
|
|
11674
|
+
text: import_zod14.z.string().optional().describe(
|
|
10589
11675
|
"New raw text body. Supplying it re-ingests the document body and re-queues it for indexing, so the search index reflects the edit (text-ingested documents only \u2014 not file-backed ones). Omit to leave the stored text unchanged. This is the in-place alternative to re-ingesting with upsert:true."
|
|
10590
11676
|
),
|
|
10591
|
-
folderId:
|
|
10592
|
-
status:
|
|
11677
|
+
folderId: import_zod14.z.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
|
|
11678
|
+
status: import_zod14.z.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
|
|
10593
11679
|
"Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
|
|
10594
11680
|
),
|
|
10595
|
-
userId:
|
|
10596
|
-
scopes:
|
|
11681
|
+
userId: import_zod14.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11682
|
+
scopes: import_zod14.z.array(import_zod14.z.string()).optional().describe(
|
|
10597
11683
|
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
10598
11684
|
),
|
|
10599
|
-
expectedVersion:
|
|
11685
|
+
expectedVersion: import_zod14.z.number().int().optional().describe(
|
|
10600
11686
|
"Optimistic concurrency: the version you last read. If the document changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10601
11687
|
)
|
|
10602
11688
|
};
|
|
@@ -10604,7 +11690,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10604
11690
|
name: "document_update",
|
|
10605
11691
|
title: "Update a document",
|
|
10606
11692
|
description: 'Update a document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). `fields` are DEEP-MERGED into the existing typed payload (unspecified fields preserved; a field set to `null` is deleted); title/folderId/status/ownership are updated when provided and preserved otherwise. Supply `text` to re-ingest and re-index the document body in place (text documents only). Set `status: "ARCHIVED"` to soft-retract a document (pulled from search, kept and recoverable) and `status: "ACTIVE"` to restore it. Pass `expectedVersion` (the version you last read) for safe concurrent edits \u2014 a stale update is refused (409). Requires the key to allow documents:u.',
|
|
10607
|
-
inputSchema:
|
|
11693
|
+
inputSchema: inputSchema14,
|
|
10608
11694
|
handler: async (args) => {
|
|
10609
11695
|
const documentId = args.documentId;
|
|
10610
11696
|
const externalId = args.externalId;
|
|
@@ -10644,15 +11730,15 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10644
11730
|
var document_update_default = documentUpdate;
|
|
10645
11731
|
|
|
10646
11732
|
// src/tools/document_delete.ts
|
|
10647
|
-
var
|
|
10648
|
-
var
|
|
10649
|
-
documentId:
|
|
11733
|
+
var import_zod15 = require("zod");
|
|
11734
|
+
var inputSchema15 = {
|
|
11735
|
+
documentId: import_zod15.z.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
|
|
10650
11736
|
};
|
|
10651
11737
|
var documentDelete = ({ client, log }) => ({
|
|
10652
11738
|
name: "document_delete",
|
|
10653
11739
|
title: "Delete a document",
|
|
10654
11740
|
description: 'Permanently delete a document by id (removes it and its indexed content). Requires the key to allow documents:d \u2014 a key without it gets a permission error. To archive without deleting, use document_update to set status: "ARCHIVED" instead (recoverable, and needs no delete authority).',
|
|
10655
|
-
inputSchema:
|
|
11741
|
+
inputSchema: inputSchema15,
|
|
10656
11742
|
handler: async (args) => {
|
|
10657
11743
|
const documentId = args.documentId;
|
|
10658
11744
|
try {
|
|
@@ -10670,18 +11756,18 @@ var documentDelete = ({ client, log }) => ({
|
|
|
10670
11756
|
var document_delete_default = documentDelete;
|
|
10671
11757
|
|
|
10672
11758
|
// src/tools/folder_query.ts
|
|
10673
|
-
var
|
|
11759
|
+
var import_zod16 = require("zod");
|
|
10674
11760
|
var MCP_DEFAULT_LIMIT4 = 10;
|
|
10675
11761
|
var MCP_MAX_LIMIT4 = 100;
|
|
10676
|
-
var
|
|
10677
|
-
id:
|
|
10678
|
-
parentId:
|
|
10679
|
-
userId:
|
|
10680
|
-
scope:
|
|
11762
|
+
var inputSchema16 = {
|
|
11763
|
+
id: import_zod16.z.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
11764
|
+
parentId: import_zod16.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
11765
|
+
userId: import_zod16.z.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
11766
|
+
scope: import_zod16.z.string().optional().describe(
|
|
10681
11767
|
'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
|
|
10682
11768
|
),
|
|
10683
|
-
startFrom:
|
|
10684
|
-
limit:
|
|
11769
|
+
startFrom: import_zod16.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
11770
|
+
limit: import_zod16.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10685
11771
|
`List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
|
|
10686
11772
|
)
|
|
10687
11773
|
};
|
|
@@ -10689,7 +11775,7 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10689
11775
|
name: "folder_query",
|
|
10690
11776
|
title: "Folder query (list or get)",
|
|
10691
11777
|
description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
|
|
10692
|
-
inputSchema:
|
|
11778
|
+
inputSchema: inputSchema16,
|
|
10693
11779
|
handler: async (args) => {
|
|
10694
11780
|
const id = args.id;
|
|
10695
11781
|
try {
|
|
@@ -10719,14 +11805,14 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10719
11805
|
var folder_query_default = folderQuery;
|
|
10720
11806
|
|
|
10721
11807
|
// src/tools/folder_create.ts
|
|
10722
|
-
var
|
|
10723
|
-
var
|
|
10724
|
-
name:
|
|
10725
|
-
description:
|
|
10726
|
-
parentId:
|
|
10727
|
-
slug:
|
|
10728
|
-
userId:
|
|
10729
|
-
scopes:
|
|
11808
|
+
var import_zod17 = require("zod");
|
|
11809
|
+
var inputSchema17 = {
|
|
11810
|
+
name: import_zod17.z.string().min(1, "name is required").describe("Folder display name."),
|
|
11811
|
+
description: import_zod17.z.string().optional().describe("Optional description of the folder's purpose."),
|
|
11812
|
+
parentId: import_zod17.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
11813
|
+
slug: import_zod17.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
|
|
11814
|
+
userId: import_zod17.z.string().optional().describe("Owning user (Vectros UUID)."),
|
|
11815
|
+
scopes: import_zod17.z.array(import_zod17.z.string()).optional().describe(
|
|
10730
11816
|
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
10731
11817
|
)
|
|
10732
11818
|
};
|
|
@@ -10734,7 +11820,7 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10734
11820
|
name: "folder_create",
|
|
10735
11821
|
title: "Create a folder",
|
|
10736
11822
|
description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c (and folders:r to receive the existing folder on a collision).",
|
|
10737
|
-
inputSchema:
|
|
11823
|
+
inputSchema: inputSchema17,
|
|
10738
11824
|
handler: async (args) => {
|
|
10739
11825
|
try {
|
|
10740
11826
|
const folder = await client.folders.createFolder({
|
|
@@ -10758,16 +11844,16 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10758
11844
|
var folder_create_default = folderCreate;
|
|
10759
11845
|
|
|
10760
11846
|
// src/tools/folder_update.ts
|
|
10761
|
-
var
|
|
10762
|
-
var
|
|
10763
|
-
id:
|
|
10764
|
-
name:
|
|
10765
|
-
description:
|
|
10766
|
-
userId:
|
|
10767
|
-
scopes:
|
|
11847
|
+
var import_zod18 = require("zod");
|
|
11848
|
+
var inputSchema18 = {
|
|
11849
|
+
id: import_zod18.z.string().min(1, "id is required").describe("The Vectros folder id to update."),
|
|
11850
|
+
name: import_zod18.z.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
11851
|
+
description: import_zod18.z.string().optional().describe("New description. Omit to leave unchanged."),
|
|
11852
|
+
userId: import_zod18.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11853
|
+
scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
|
|
10768
11854
|
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
10769
11855
|
),
|
|
10770
|
-
expectedVersion:
|
|
11856
|
+
expectedVersion: import_zod18.z.number().int().optional().describe(
|
|
10771
11857
|
"Optimistic concurrency: the version you last read. If the folder changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10772
11858
|
)
|
|
10773
11859
|
};
|
|
@@ -10775,7 +11861,7 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10775
11861
|
name: "folder_update",
|
|
10776
11862
|
title: "Update a folder",
|
|
10777
11863
|
description: "Update a folder's name / description / ownership by id (RFC-7386 merge \u2014 omitted fields preserved). Pass `expectedVersion` (the version you last read) for safe concurrent edits \u2014 a stale update is refused (409). Folders cannot be moved (re-parenting is not supported by the API). Requires the key to allow folders:u.",
|
|
10778
|
-
inputSchema:
|
|
11864
|
+
inputSchema: inputSchema18,
|
|
10779
11865
|
handler: async (args) => {
|
|
10780
11866
|
const id = args.id;
|
|
10781
11867
|
const name = args.name;
|
|
@@ -10802,15 +11888,15 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10802
11888
|
var folder_update_default = folderUpdate;
|
|
10803
11889
|
|
|
10804
11890
|
// src/tools/folder_delete.ts
|
|
10805
|
-
var
|
|
10806
|
-
var
|
|
10807
|
-
id:
|
|
11891
|
+
var import_zod19 = require("zod");
|
|
11892
|
+
var inputSchema19 = {
|
|
11893
|
+
id: import_zod19.z.string().min(1, "id is required").describe("The Vectros folder id to delete.")
|
|
10808
11894
|
};
|
|
10809
11895
|
var folderDelete = ({ client, log }) => ({
|
|
10810
11896
|
name: "folder_delete",
|
|
10811
11897
|
title: "Delete a folder",
|
|
10812
|
-
description:
|
|
10813
|
-
inputSchema:
|
|
11898
|
+
description: 'Permanently delete a folder by id. The folder must be EMPTY first \u2014 it must contain no documents, no records, and no sub-folders \u2014 and a non-empty folder is refused, which is the most common way this call fails. Use record_query with this folderId, and document_query, to see what is in it. Clearing it differs by content type: a document can be moved out (document_update with a different folderId) or deleted. A RECORD can also be re-filed into another folder \u2014 the API supports it \u2014 but THIS SERVER does not expose that yet: record_update has no folderId argument, so from here your only option is record_delete (needs records:d). Do NOT read that as "the record cannot be moved" and delete partner data on that basis: if the record should be kept, move it with the Vectros API/SDK directly rather than deleting it here. A sub-folder cannot be re-parented at all, so nested folders have to be emptied and deleted innermost-first. Note the emptiness check counts everything in the folder, INCLUDING items your credential cannot read \u2014 so a refusal you cannot account for from what you can list is expected behaviour, not a bug, and retrying will not clear it. Requires the key to allow folders:d \u2014 a key without it gets a permission error. Protected folders (e.g. a context root) cannot be deleted at all, however empty.',
|
|
11899
|
+
inputSchema: inputSchema19,
|
|
10814
11900
|
handler: async (args) => {
|
|
10815
11901
|
const id = args.id;
|
|
10816
11902
|
try {
|
|
@@ -10826,14 +11912,14 @@ var folderDelete = ({ client, log }) => ({
|
|
|
10826
11912
|
var folder_delete_default = folderDelete;
|
|
10827
11913
|
|
|
10828
11914
|
// src/tools/current_identity.ts
|
|
10829
|
-
var
|
|
11915
|
+
var inputSchema20 = {
|
|
10830
11916
|
// No args — current_identity describes the current credential.
|
|
10831
11917
|
};
|
|
10832
11918
|
var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
10833
11919
|
name: "current_identity",
|
|
10834
11920
|
title: "Current identity (tenant + principal scope)",
|
|
10835
|
-
description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's verb+ownership reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry
|
|
10836
|
-
inputSchema:
|
|
11921
|
+
description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's verb+ownership reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint, as of API 0.40.0, joined by delegate-principal-stamp in 0.42.0) \u2014 a separate reach dimension a scope clause can carry that /v1/ping does not report yet, so allowedActions+dataScope may understate a credential's true reach. Also reports mcpServerVersion (this server's own package version) and sdkVersion (the bundled @vectros-ai/sdk version) so a caller can tell what build it's talking to. Use this when the user asks 'what can you do here?', 'what tenant am I in?', or 'what version is this?'. Calls GET /v1/ping under the hood.",
|
|
11922
|
+
inputSchema: inputSchema20,
|
|
10837
11923
|
handler: async () => {
|
|
10838
11924
|
try {
|
|
10839
11925
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -10849,7 +11935,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
|
10849
11935
|
var current_identity_default = currentIdentity;
|
|
10850
11936
|
|
|
10851
11937
|
// src/tools/document_ingest.ts
|
|
10852
|
-
var
|
|
11938
|
+
var import_zod20 = require("zod");
|
|
10853
11939
|
var import_promises = require("fs/promises");
|
|
10854
11940
|
var import_node_path = require("path");
|
|
10855
11941
|
var IngestPathError = class extends Error {
|
|
@@ -10924,37 +12010,37 @@ function inferMimeType(filePath) {
|
|
|
10924
12010
|
const ext = (0, import_node_path.extname)(filePath).toLowerCase();
|
|
10925
12011
|
return EXT_TO_MIME[ext] ?? "application/octet-stream";
|
|
10926
12012
|
}
|
|
10927
|
-
var
|
|
10928
|
-
title:
|
|
10929
|
-
indexMode:
|
|
12013
|
+
var inputSchema21 = {
|
|
12014
|
+
title: import_zod20.z.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
|
|
12015
|
+
indexMode: import_zod20.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
10930
12016
|
"Index strategy. HYBRID (BM25 + dense, default; best for general retrieval), SEMANTIC (dense only; concept-driven queries), TEXT (BM25 only; exact-match / keyword), NONE (store-only / archival \u2014 retrievable by id and structured-field lookup but never in search results). Omit to inherit the bound schema's default."
|
|
10931
12017
|
),
|
|
10932
|
-
externalId:
|
|
12018
|
+
externalId: import_zod20.z.string().optional().describe(
|
|
10933
12019
|
'Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create. Receiving the existing document back is a read of it and needs documents:r in addition to documents:c; a create-only key gets an "already exists" error instead of the document.'
|
|
10934
12020
|
),
|
|
10935
|
-
upsert:
|
|
12021
|
+
upsert: import_zod20.z.boolean().optional().describe(
|
|
10936
12022
|
"When true, re-ingesting an existing externalId OVERWRITES that document and re-indexes the new body (text mode) / re-uploads and re-indexes the new file (file mode), instead of returning the existing one unchanged. This is the curation/re-sync primitive: edit a source, re-ingest with upsert:true, and the search index reflects the new content. Requires the documents:u scope. IMPORTANT: pass the SAME schemaId (and type) you used originally \u2014 externalId is unique WITHIN a type, so omitting schemaId resolves in the untyped namespace and mints a duplicate instead of updating. The response `created` flag confirms which happened (created:true = a new document was minted)."
|
|
10937
12023
|
),
|
|
10938
|
-
schemaId:
|
|
12024
|
+
schemaId: import_zod20.z.string().optional().describe(
|
|
10939
12025
|
"Bind this document to a record schema. When set, `payload` is validated against the schema and its lookup fields become directly queryable via document_query (records parity). Resolve a schema id from its type via list_schemas. Omit for an untyped document."
|
|
10940
12026
|
),
|
|
10941
|
-
payload:
|
|
12027
|
+
payload: import_zod20.z.record(import_zod20.z.string(), import_zod20.z.unknown()).optional().describe(
|
|
10942
12028
|
"The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata. Every number must fall within the signed 64-bit range \u2014 send a larger whole number as a STRING (stored exactly, exact-match lookup), else the ingest is refused with a 400 naming the field."
|
|
10943
12029
|
),
|
|
10944
12030
|
// Inline text mode (mutually exclusive with filePath):
|
|
10945
|
-
text:
|
|
10946
|
-
storeText:
|
|
12031
|
+
text: import_zod20.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
|
|
12032
|
+
storeText: import_zod20.z.boolean().optional().describe(
|
|
10947
12033
|
"FILE MODE ONLY. Whether the uploaded file's EXTRACTED text is retained after indexing (default true), fixed at ingest. true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards it once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable. NOT accepted with `text`: a text-ingested body is the document itself and is ALWAYS retained, so the backend has no storeText knob on the text path \u2014 passing it with `text` is rejected rather than silently ignored."
|
|
10948
12034
|
),
|
|
10949
12035
|
// File upload mode (mutually exclusive with text; stdio-transport-only):
|
|
10950
|
-
filePath:
|
|
12036
|
+
filePath: import_zod20.z.string().min(1).optional().describe(
|
|
10951
12037
|
"Local filesystem path to upload. Mutually exclusive with text. STDIO TRANSPORT ONLY \u2014 rejected on HTTP transport (remote MCP servers can't read your filesystem; use text mode or call the SDK's uploadDocument directly). Must resolve INSIDE the configured ingest root (VECTROS_MCP_INGEST_ROOT, else the server's working directory); paths that escape it (traversal/absolute/symlink) or match a sensitive pattern are rejected."
|
|
10952
12038
|
),
|
|
10953
|
-
fileType:
|
|
12039
|
+
fileType: import_zod20.z.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
|
|
10954
12040
|
// Common (both modes):
|
|
10955
|
-
folderId:
|
|
10956
|
-
userId:
|
|
10957
|
-
scopes:
|
|
12041
|
+
folderId: import_zod20.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
12042
|
+
userId: import_zod20.z.string().optional().describe("Owning user ID. Optional."),
|
|
12043
|
+
scopes: import_zod20.z.array(import_zod20.z.string()).optional().describe(
|
|
10958
12044
|
"TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
|
|
10959
12045
|
)
|
|
10960
12046
|
};
|
|
@@ -10962,7 +12048,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10962
12048
|
name: "document_ingest",
|
|
10963
12049
|
title: "Ingest a new document (text body or file upload)",
|
|
10964
12050
|
description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate \u2014 requires documents:r in addition to documents:c, since being handed the existing document is a read of it). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText is a FILE-MODE knob (default true): false discards the uploaded file's extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained, so storeText is not accepted with `text`.",
|
|
10965
|
-
inputSchema:
|
|
12051
|
+
inputSchema: inputSchema21,
|
|
10966
12052
|
handler: async (args) => {
|
|
10967
12053
|
const title = args.title;
|
|
10968
12054
|
const text = args.text;
|
|
@@ -11114,29 +12200,29 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11114
12200
|
var document_ingest_default = documentIngest;
|
|
11115
12201
|
|
|
11116
12202
|
// src/tools/lookup_principal.ts
|
|
11117
|
-
var
|
|
12203
|
+
var import_zod21 = require("zod");
|
|
11118
12204
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
11119
12205
|
var MCP_MAX_LIMIT5 = 100;
|
|
11120
|
-
var
|
|
11121
|
-
kind:
|
|
12206
|
+
var inputSchema22 = {
|
|
12207
|
+
kind: import_zod21.z.string().describe(
|
|
11122
12208
|
'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (reserved, registered like any other), or a namespace you registered.'
|
|
11123
12209
|
),
|
|
11124
|
-
externalId:
|
|
12210
|
+
externalId: import_zod21.z.string().optional().describe(
|
|
11125
12211
|
"Resolve mode: your own stable identifier for the principal. Returns the single matching principal (with its Vectros UUID), or an empty array if none. The fastest path to the UUID the ownership filters need. Takes precedence if both this and a `field` lookup are supplied."
|
|
11126
12212
|
),
|
|
11127
|
-
contextId:
|
|
12213
|
+
contextId: import_zod21.z.string().optional().describe(
|
|
11128
12214
|
"Entity kinds only (not `user`, which is always tenant-wide): the app context to look up entities in, for a namespace registered as context-owned rather than tenant-wide. A context-confined credential's own context is used automatically without this; supply it to name a context explicitly (required for an unconfined/root credential to reach a context-owned namespace). Rejected if the namespace turns out to be tenant-wide."
|
|
11129
12215
|
),
|
|
11130
12216
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
11131
|
-
type:
|
|
11132
|
-
field:
|
|
11133
|
-
value:
|
|
11134
|
-
from:
|
|
11135
|
-
to:
|
|
11136
|
-
prefix:
|
|
11137
|
-
order:
|
|
11138
|
-
startFrom:
|
|
11139
|
-
limit:
|
|
12217
|
+
type: import_zod21.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
|
|
12218
|
+
field: import_zod21.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
|
|
12219
|
+
value: import_zod21.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
|
|
12220
|
+
from: import_zod21.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
|
|
12221
|
+
to: import_zod21.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
12222
|
+
prefix: import_zod21.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
12223
|
+
order: import_zod21.z.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
|
|
12224
|
+
startFrom: import_zod21.z.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
12225
|
+
limit: import_zod21.z.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
|
|
11140
12226
|
`Max principals per page. Defaults to ${MCP_DEFAULT_LIMIT5}; raise up to ${MCP_MAX_LIMIT5} (the principals API max) in one call when you can accept the payload, or page with \`startFrom\`.`
|
|
11141
12227
|
)
|
|
11142
12228
|
};
|
|
@@ -11144,7 +12230,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11144
12230
|
name: "lookup_principal",
|
|
11145
12231
|
title: "Look up a user identity or a namespaced identity entity",
|
|
11146
12232
|
description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) For an entity kind, `contextId` names a specific app context when the namespace is context-owned rather than tenant-wide; a context-confined credential's own context is used automatically without it. Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
|
|
11147
|
-
inputSchema:
|
|
12233
|
+
inputSchema: inputSchema22,
|
|
11148
12234
|
handler: async (args) => {
|
|
11149
12235
|
const kind = args.kind;
|
|
11150
12236
|
const isUser = kind === "user";
|
|
@@ -11218,17 +12304,17 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11218
12304
|
var lookup_principal_default = lookupPrincipal;
|
|
11219
12305
|
|
|
11220
12306
|
// src/tools/version_history.ts
|
|
11221
|
-
var
|
|
11222
|
-
var
|
|
11223
|
-
resourceType:
|
|
11224
|
-
id:
|
|
11225
|
-
startFrom:
|
|
12307
|
+
var import_zod22 = require("zod");
|
|
12308
|
+
var inputSchema23 = {
|
|
12309
|
+
resourceType: import_zod22.z.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
|
|
12310
|
+
id: import_zod22.z.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
|
|
12311
|
+
startFrom: import_zod22.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
|
|
11226
12312
|
};
|
|
11227
12313
|
var versionHistory = ({ client, log }) => ({
|
|
11228
12314
|
name: "version_history",
|
|
11229
12315
|
title: "Version history (record or document)",
|
|
11230
12316
|
description: "Read the audit/version trail (CREATE/UPDATE/DELETE, with actor, timestamp, and diff) for a single record or document. Pass `resourceType` (record|document) and `id`. Returns `{ data, nextCursor }`; pass `nextCursor` back as `startFrom` to page through older entries. Entities without audit history (untyped) return an empty trail. Read-only.",
|
|
11231
|
-
inputSchema:
|
|
12317
|
+
inputSchema: inputSchema23,
|
|
11232
12318
|
handler: async (args) => {
|
|
11233
12319
|
const resourceType = args.resourceType;
|
|
11234
12320
|
const id = args.id;
|
|
@@ -11257,6 +12343,7 @@ var TOOL_NAMES = [
|
|
|
11257
12343
|
"record_get",
|
|
11258
12344
|
"record_batch_get",
|
|
11259
12345
|
"record_create",
|
|
12346
|
+
"record_batch_write",
|
|
11260
12347
|
"record_update",
|
|
11261
12348
|
"record_delete",
|
|
11262
12349
|
"rag_ask",
|
|
@@ -11283,6 +12370,7 @@ var ALL_TOOL_FACTORIES = {
|
|
|
11283
12370
|
record_get: record_get_default,
|
|
11284
12371
|
record_batch_get: record_batch_get_default,
|
|
11285
12372
|
record_create: record_create_default,
|
|
12373
|
+
record_batch_write: record_batch_write_default,
|
|
11286
12374
|
record_update: record_update_default,
|
|
11287
12375
|
record_delete: record_delete_default,
|
|
11288
12376
|
rag_ask: rag_ask_default,
|
|
@@ -11323,7 +12411,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
|
|
|
11323
12411
|
name: "identity",
|
|
11324
12412
|
uri: "vectros://identity",
|
|
11325
12413
|
title: "Current identity (tenant + principal scope)",
|
|
11326
|
-
description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry
|
|
12414
|
+
description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint, as of API 0.40.0, joined by delegate-principal-stamp in 0.42.0) \u2014 a separate reach dimension a scope clause can carry that /v1/ping does not report yet, so allowedActions+dataScope may understate a credential's true reach. Also reports mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
|
|
11327
12415
|
mimeType: "application/json",
|
|
11328
12416
|
read: async () => {
|
|
11329
12417
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -11342,7 +12430,7 @@ var ALL_RESOURCE_FACTORIES = {
|
|
|
11342
12430
|
};
|
|
11343
12431
|
|
|
11344
12432
|
// src/zod-to-json-schema.ts
|
|
11345
|
-
var
|
|
12433
|
+
var import_zod23 = require("zod");
|
|
11346
12434
|
function zodShapeToJsonSchema(shape) {
|
|
11347
12435
|
const properties = {};
|
|
11348
12436
|
const required = [];
|
|
@@ -11357,40 +12445,40 @@ function zodShapeToJsonSchema(shape) {
|
|
|
11357
12445
|
function zodTypeToJsonSchema(schema) {
|
|
11358
12446
|
const description = schema.description;
|
|
11359
12447
|
let current = schema;
|
|
11360
|
-
while (current instanceof
|
|
12448
|
+
while (current instanceof import_zod23.z.ZodOptional || current instanceof import_zod23.z.ZodDefault || current instanceof import_zod23.z.ZodNullable) {
|
|
11361
12449
|
current = current._def.innerType;
|
|
11362
12450
|
}
|
|
11363
12451
|
const base = description ? { description } : {};
|
|
11364
|
-
if (current instanceof
|
|
12452
|
+
if (current instanceof import_zod23.z.ZodString) {
|
|
11365
12453
|
return { ...base, type: "string" };
|
|
11366
12454
|
}
|
|
11367
|
-
if (current instanceof
|
|
12455
|
+
if (current instanceof import_zod23.z.ZodNumber) {
|
|
11368
12456
|
return { ...base, type: "number" };
|
|
11369
12457
|
}
|
|
11370
|
-
if (current instanceof
|
|
12458
|
+
if (current instanceof import_zod23.z.ZodBoolean) {
|
|
11371
12459
|
return { ...base, type: "boolean" };
|
|
11372
12460
|
}
|
|
11373
|
-
if (current instanceof
|
|
12461
|
+
if (current instanceof import_zod23.z.ZodEnum) {
|
|
11374
12462
|
return {
|
|
11375
12463
|
...base,
|
|
11376
12464
|
type: "string",
|
|
11377
12465
|
enum: current.options
|
|
11378
12466
|
};
|
|
11379
12467
|
}
|
|
11380
|
-
if (current instanceof
|
|
12468
|
+
if (current instanceof import_zod23.z.ZodArray) {
|
|
11381
12469
|
return {
|
|
11382
12470
|
...base,
|
|
11383
12471
|
type: "array",
|
|
11384
12472
|
items: zodTypeToJsonSchema(current.element)
|
|
11385
12473
|
};
|
|
11386
12474
|
}
|
|
11387
|
-
if (current instanceof
|
|
12475
|
+
if (current instanceof import_zod23.z.ZodObject) {
|
|
11388
12476
|
return {
|
|
11389
12477
|
...base,
|
|
11390
12478
|
...zodShapeToJsonSchema(current.shape)
|
|
11391
12479
|
};
|
|
11392
12480
|
}
|
|
11393
|
-
if (current instanceof
|
|
12481
|
+
if (current instanceof import_zod23.z.ZodRecord) {
|
|
11394
12482
|
const valueType = current._def.valueType;
|
|
11395
12483
|
return {
|
|
11396
12484
|
...base,
|
|
@@ -11514,7 +12602,7 @@ var VectrosMCPServer = class {
|
|
|
11514
12602
|
if (!tool) {
|
|
11515
12603
|
result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
|
|
11516
12604
|
} else {
|
|
11517
|
-
const parsed =
|
|
12605
|
+
const parsed = import_zod24.z.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
|
|
11518
12606
|
if (!parsed.success) {
|
|
11519
12607
|
result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
|
|
11520
12608
|
} else {
|