@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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/server.ts
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
|
|
4
|
-
// node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
4
|
+
// ../../node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
@@ -35,6 +35,7 @@ __export(api_exports, {
|
|
|
35
35
|
FieldDef: () => FieldDef,
|
|
36
36
|
FileUploadRequest: () => FileUploadRequest,
|
|
37
37
|
ForbiddenError: () => ForbiddenError,
|
|
38
|
+
GatewayTimeoutError: () => GatewayTimeoutError,
|
|
38
39
|
IdentityLookupRequest: () => IdentityLookupRequest,
|
|
39
40
|
IndexFailure: () => IndexFailure,
|
|
40
41
|
InternalServerError: () => InternalServerError,
|
|
@@ -59,9 +60,12 @@ __export(api_exports, {
|
|
|
59
60
|
SearchRequest: () => SearchRequest,
|
|
60
61
|
SearchResult: () => SearchResult,
|
|
61
62
|
SearchResultsEvent: () => SearchResultsEvent,
|
|
63
|
+
ServiceUnavailableError: () => ServiceUnavailableError,
|
|
62
64
|
TooManyRequestsError: () => TooManyRequestsError,
|
|
65
|
+
TriggerFailureResponse: () => TriggerFailureResponse,
|
|
63
66
|
TruncationWarningEvent: () => TruncationWarningEvent,
|
|
64
67
|
UnauthorizedError: () => UnauthorizedError,
|
|
68
|
+
UnprocessableEntityError: () => UnprocessableEntityError,
|
|
65
69
|
UserExistsResponse: () => UserExistsResponse,
|
|
66
70
|
UserRequest: () => UserRequest,
|
|
67
71
|
UserResponse: () => UserResponse,
|
|
@@ -73,7 +77,9 @@ __export(api_exports, {
|
|
|
73
77
|
inference: () => inference_exports,
|
|
74
78
|
records: () => records_exports,
|
|
75
79
|
schemas: () => schemas_exports,
|
|
76
|
-
|
|
80
|
+
scripts: () => scripts_exports,
|
|
81
|
+
search: () => search_exports,
|
|
82
|
+
triggers: () => triggers_exports
|
|
77
83
|
});
|
|
78
84
|
var toJson = (value, replacer, space) => {
|
|
79
85
|
return JSON.stringify(value, replacer, space);
|
|
@@ -193,6 +199,21 @@ var ForbiddenError = class extends VectrosError {
|
|
|
193
199
|
this.name = this.constructor.name;
|
|
194
200
|
}
|
|
195
201
|
};
|
|
202
|
+
var GatewayTimeoutError = class extends VectrosError {
|
|
203
|
+
constructor(body, rawResponse) {
|
|
204
|
+
super({
|
|
205
|
+
message: "GatewayTimeoutError",
|
|
206
|
+
statusCode: 504,
|
|
207
|
+
body,
|
|
208
|
+
rawResponse
|
|
209
|
+
});
|
|
210
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
211
|
+
if (Error.captureStackTrace) {
|
|
212
|
+
Error.captureStackTrace(this, this.constructor);
|
|
213
|
+
}
|
|
214
|
+
this.name = this.constructor.name;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
196
217
|
var InternalServerError = class extends VectrosError {
|
|
197
218
|
constructor(body, rawResponse) {
|
|
198
219
|
super({
|
|
@@ -253,6 +274,21 @@ var PaymentRequiredError = class extends VectrosError {
|
|
|
253
274
|
this.name = this.constructor.name;
|
|
254
275
|
}
|
|
255
276
|
};
|
|
277
|
+
var ServiceUnavailableError = class extends VectrosError {
|
|
278
|
+
constructor(body, rawResponse) {
|
|
279
|
+
super({
|
|
280
|
+
message: "ServiceUnavailableError",
|
|
281
|
+
statusCode: 503,
|
|
282
|
+
body,
|
|
283
|
+
rawResponse
|
|
284
|
+
});
|
|
285
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
286
|
+
if (Error.captureStackTrace) {
|
|
287
|
+
Error.captureStackTrace(this, this.constructor);
|
|
288
|
+
}
|
|
289
|
+
this.name = this.constructor.name;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
256
292
|
var TooManyRequestsError = class extends VectrosError {
|
|
257
293
|
constructor(body, rawResponse) {
|
|
258
294
|
super({
|
|
@@ -283,6 +319,21 @@ var UnauthorizedError = class extends VectrosError {
|
|
|
283
319
|
this.name = this.constructor.name;
|
|
284
320
|
}
|
|
285
321
|
};
|
|
322
|
+
var UnprocessableEntityError = class extends VectrosError {
|
|
323
|
+
constructor(body, rawResponse) {
|
|
324
|
+
super({
|
|
325
|
+
message: "UnprocessableEntityError",
|
|
326
|
+
statusCode: 422,
|
|
327
|
+
body,
|
|
328
|
+
rawResponse
|
|
329
|
+
});
|
|
330
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
331
|
+
if (Error.captureStackTrace) {
|
|
332
|
+
Error.captureStackTrace(this, this.constructor);
|
|
333
|
+
}
|
|
334
|
+
this.name = this.constructor.name;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
286
337
|
var auth_exports = {};
|
|
287
338
|
var ErasureRequest;
|
|
288
339
|
((ErasureRequest2) => {
|
|
@@ -372,6 +423,7 @@ var LookupRecordsRequestOrder = {
|
|
|
372
423
|
Desc: "desc"
|
|
373
424
|
};
|
|
374
425
|
var schemas_exports = {};
|
|
426
|
+
var scripts_exports = {};
|
|
375
427
|
var SearchRequest;
|
|
376
428
|
((SearchRequest2) => {
|
|
377
429
|
SearchRequest2.Mode = {
|
|
@@ -397,6 +449,7 @@ var search_exports = {};
|
|
|
397
449
|
__export(search_exports, {
|
|
398
450
|
SearchRequest: () => SearchRequest
|
|
399
451
|
});
|
|
452
|
+
var triggers_exports = {};
|
|
400
453
|
var AccessProfileRequest;
|
|
401
454
|
((AccessProfileRequest2) => {
|
|
402
455
|
AccessProfileRequest2.Status = {
|
|
@@ -426,7 +479,9 @@ var BatchWriteResult;
|
|
|
426
479
|
Created: "created",
|
|
427
480
|
Updated: "updated",
|
|
428
481
|
Conflict: "conflict",
|
|
429
|
-
Invalid: "invalid"
|
|
482
|
+
Invalid: "invalid",
|
|
483
|
+
Forbidden: "forbidden",
|
|
484
|
+
NotCommitted: "not_committed"
|
|
430
485
|
};
|
|
431
486
|
})(BatchWriteResult || (BatchWriteResult = {}));
|
|
432
487
|
var ChatMessage;
|
|
@@ -730,13 +785,23 @@ var SearchResultsEvent;
|
|
|
730
785
|
SearchResults: "search_results"
|
|
731
786
|
};
|
|
732
787
|
})(SearchResultsEvent || (SearchResultsEvent = {}));
|
|
788
|
+
var TriggerFailureResponse;
|
|
789
|
+
((TriggerFailureResponse2) => {
|
|
790
|
+
TriggerFailureResponse2.Event = {
|
|
791
|
+
Create: "CREATE",
|
|
792
|
+
Update: "UPDATE",
|
|
793
|
+
Delete: "DELETE"
|
|
794
|
+
};
|
|
795
|
+
})(TriggerFailureResponse || (TriggerFailureResponse = {}));
|
|
733
796
|
var TruncationWarningEvent;
|
|
734
797
|
((TruncationWarningEvent2) => {
|
|
735
798
|
TruncationWarningEvent2.Event = {
|
|
736
799
|
TruncationWarning: "truncation_warning"
|
|
737
800
|
};
|
|
738
801
|
TruncationWarningEvent2.Reason = {
|
|
739
|
-
ContextWindowBudget: "context_window_budget"
|
|
802
|
+
ContextWindowBudget: "context_window_budget",
|
|
803
|
+
NoGroundableContent: "no_groundable_content",
|
|
804
|
+
ContextWindowBudgetAndNoContent: "context_window_budget_and_no_content"
|
|
740
805
|
};
|
|
741
806
|
})(TruncationWarningEvent || (TruncationWarningEvent = {}));
|
|
742
807
|
var UserExistsResponse;
|
|
@@ -751,8 +816,7 @@ var UserRequest;
|
|
|
751
816
|
((UserRequest2) => {
|
|
752
817
|
UserRequest2.Status = {
|
|
753
818
|
Active: "ACTIVE",
|
|
754
|
-
Suspended: "SUSPENDED"
|
|
755
|
-
Pending: "PENDING"
|
|
819
|
+
Suspended: "SUSPENDED"
|
|
756
820
|
};
|
|
757
821
|
UserRequest2.Type = {
|
|
758
822
|
Human: "HUMAN",
|
|
@@ -2220,6 +2284,16 @@ function mergeHeaders(...headersArray) {
|
|
|
2220
2284
|
}
|
|
2221
2285
|
return result;
|
|
2222
2286
|
}
|
|
2287
|
+
function mergeOnlyDefinedHeaders(...headersArray) {
|
|
2288
|
+
const result = {};
|
|
2289
|
+
for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
|
|
2290
|
+
const insensitiveKey = key.toLowerCase();
|
|
2291
|
+
if (value != null) {
|
|
2292
|
+
result[insensitiveKey] = value;
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
return result;
|
|
2296
|
+
}
|
|
2223
2297
|
function normalizeClientOptions(options) {
|
|
2224
2298
|
const headers = mergeHeaders(
|
|
2225
2299
|
{
|
|
@@ -2490,7 +2564,7 @@ var AuthClient = class {
|
|
|
2490
2564
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
|
|
2491
2565
|
}
|
|
2492
2566
|
/**
|
|
2493
|
-
* 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.
|
|
2567
|
+
* 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.
|
|
2494
2568
|
*
|
|
2495
2569
|
* @param {Vectros.CreateScopedKeyRequest} request
|
|
2496
2570
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2498,6 +2572,7 @@ var AuthClient = class {
|
|
|
2498
2572
|
* @throws {@link Vectros.BadRequestError}
|
|
2499
2573
|
* @throws {@link Vectros.ForbiddenError}
|
|
2500
2574
|
* @throws {@link Vectros.NotFoundError}
|
|
2575
|
+
* @throws {@link Vectros.ConflictError}
|
|
2501
2576
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
2502
2577
|
*
|
|
2503
2578
|
* @example
|
|
@@ -2546,6 +2621,8 @@ var AuthClient = class {
|
|
|
2546
2621
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2547
2622
|
case 404:
|
|
2548
2623
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
2624
|
+
case 409:
|
|
2625
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
2549
2626
|
case 429:
|
|
2550
2627
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
2551
2628
|
default:
|
|
@@ -2957,7 +3034,7 @@ var AuthClient = class {
|
|
|
2957
3034
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts");
|
|
2958
3035
|
}
|
|
2959
3036
|
/**
|
|
2960
|
-
* 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.
|
|
3037
|
+
* 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.
|
|
2961
3038
|
*
|
|
2962
3039
|
* @param {Vectros.CreateAppContextRequest} request
|
|
2963
3040
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3441,7 +3518,7 @@ var AuthClient = class {
|
|
|
3441
3518
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts/{contextId}");
|
|
3442
3519
|
}
|
|
3443
3520
|
/**
|
|
3444
|
-
* Updates the name and/or
|
|
3521
|
+
* 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.
|
|
3445
3522
|
*
|
|
3446
3523
|
* @param {Vectros.UpdateAppContextRequest} request
|
|
3447
3524
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3923,7 +4000,7 @@ var AuthClient = class {
|
|
|
3923
4000
|
);
|
|
3924
4001
|
}
|
|
3925
4002
|
/**
|
|
3926
|
-
* Returns full usage detail for the requested calendar month, broken down by category (search, documents, and
|
|
4003
|
+
* 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`.
|
|
3927
4004
|
*
|
|
3928
4005
|
* @param {Vectros.GetUsageRequest} request
|
|
3929
4006
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4491,7 +4568,7 @@ var AuthClient = class {
|
|
|
4491
4568
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token");
|
|
4492
4569
|
}
|
|
4493
4570
|
/**
|
|
4494
|
-
* Invite a new member to one of your app contexts by email
|
|
4571
|
+
* 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.
|
|
4495
4572
|
*
|
|
4496
4573
|
* @param {Vectros.CreateInviteRequest} request
|
|
4497
4574
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4562,7 +4639,7 @@ var AuthClient = class {
|
|
|
4562
4639
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite");
|
|
4563
4640
|
}
|
|
4564
4641
|
/**
|
|
4565
|
-
* 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.
|
|
4642
|
+
* 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.
|
|
4566
4643
|
*
|
|
4567
4644
|
* @param {Vectros.CreateInviteRequest} request
|
|
4568
4645
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5435,7 +5512,21 @@ var DocumentsClient = class {
|
|
|
5435
5512
|
return HttpResponsePromise.fromPromise(this.__lookupDocuments(request, requestOptions));
|
|
5436
5513
|
}
|
|
5437
5514
|
async __lookupDocuments(request, requestOptions) {
|
|
5438
|
-
const {
|
|
5515
|
+
const {
|
|
5516
|
+
type: type_,
|
|
5517
|
+
field,
|
|
5518
|
+
value,
|
|
5519
|
+
from: from_,
|
|
5520
|
+
to,
|
|
5521
|
+
prefix,
|
|
5522
|
+
sortFrom,
|
|
5523
|
+
sortTo,
|
|
5524
|
+
startFrom,
|
|
5525
|
+
limit,
|
|
5526
|
+
order,
|
|
5527
|
+
userId,
|
|
5528
|
+
scope
|
|
5529
|
+
} = request;
|
|
5439
5530
|
const _queryParams = {
|
|
5440
5531
|
type: type_,
|
|
5441
5532
|
field,
|
|
@@ -5443,6 +5534,8 @@ var DocumentsClient = class {
|
|
|
5443
5534
|
from: from_,
|
|
5444
5535
|
to,
|
|
5445
5536
|
prefix,
|
|
5537
|
+
sortFrom,
|
|
5538
|
+
sortTo,
|
|
5446
5539
|
startFrom,
|
|
5447
5540
|
limit,
|
|
5448
5541
|
order: order != null ? order : void 0,
|
|
@@ -6041,7 +6134,7 @@ var FoldersClient = class {
|
|
|
6041
6134
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/folders/{id}");
|
|
6042
6135
|
}
|
|
6043
6136
|
/**
|
|
6044
|
-
* Permanently deletes a folder. The folder must be empty
|
|
6137
|
+
* 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.
|
|
6045
6138
|
*
|
|
6046
6139
|
* @param {Vectros.DeleteFolderRequest} request
|
|
6047
6140
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6450,11 +6543,12 @@ var IdentityClient = class {
|
|
|
6450
6543
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6451
6544
|
}
|
|
6452
6545
|
/**
|
|
6453
|
-
* 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.
|
|
6546
|
+
* 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.
|
|
6454
6547
|
*
|
|
6455
6548
|
* @param {Vectros.UpdateEntityRequest} request
|
|
6456
6549
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6457
6550
|
*
|
|
6551
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6458
6552
|
* @throws {@link Vectros.NotFoundError}
|
|
6459
6553
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6460
6554
|
*
|
|
@@ -6504,6 +6598,8 @@ var IdentityClient = class {
|
|
|
6504
6598
|
}
|
|
6505
6599
|
if (_response.error.reason === "status-code") {
|
|
6506
6600
|
switch (_response.error.statusCode) {
|
|
6601
|
+
case 400:
|
|
6602
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6507
6603
|
case 404:
|
|
6508
6604
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6509
6605
|
case 429:
|
|
@@ -7728,7 +7824,7 @@ var InferenceClient = class {
|
|
|
7728
7824
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/documents/{id}/ask");
|
|
7729
7825
|
}
|
|
7730
7826
|
/**
|
|
7731
|
-
* 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
|
|
7827
|
+
* 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.
|
|
7732
7828
|
*/
|
|
7733
7829
|
ragInference(request, requestOptions) {
|
|
7734
7830
|
return HttpResponsePromise.fromPromise(this.__ragInference(request, requestOptions));
|
|
@@ -7923,14 +8019,18 @@ var RecordsClient = class {
|
|
|
7923
8019
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup/batch");
|
|
7924
8020
|
}
|
|
7925
8021
|
/**
|
|
7926
|
-
*
|
|
8022
|
+
* 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.
|
|
8023
|
+
*
|
|
8024
|
+
* `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.
|
|
8025
|
+
*
|
|
8026
|
+
* 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.
|
|
7927
8027
|
*
|
|
7928
8028
|
* @param {Vectros.BatchWriteRequest} request
|
|
7929
8029
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
7930
8030
|
*
|
|
8031
|
+
* @throws {@link Vectros.BadRequestError}
|
|
7931
8032
|
* @throws {@link Vectros.ForbiddenError}
|
|
7932
8033
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
7933
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
7934
8034
|
*
|
|
7935
8035
|
* @example
|
|
7936
8036
|
* await client.records.batchWriteRecords()
|
|
@@ -7939,6 +8039,11 @@ var RecordsClient = class {
|
|
|
7939
8039
|
return HttpResponsePromise.fromPromise(this.__batchWriteRecords(request, requestOptions));
|
|
7940
8040
|
}
|
|
7941
8041
|
async __batchWriteRecords(request = {}, requestOptions) {
|
|
8042
|
+
const { upsert, allowClear, ..._body } = request;
|
|
8043
|
+
const _queryParams = {
|
|
8044
|
+
upsert,
|
|
8045
|
+
allowClear
|
|
8046
|
+
};
|
|
7942
8047
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7943
8048
|
const _headers = mergeHeaders(
|
|
7944
8049
|
_authRequest.headers,
|
|
@@ -7953,9 +8058,9 @@ var RecordsClient = class {
|
|
|
7953
8058
|
method: "POST",
|
|
7954
8059
|
headers: _headers,
|
|
7955
8060
|
contentType: "application/json",
|
|
7956
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
8061
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
7957
8062
|
requestType: "json",
|
|
7958
|
-
body:
|
|
8063
|
+
body: _body,
|
|
7959
8064
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
7960
8065
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
7961
8066
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -7967,12 +8072,12 @@ var RecordsClient = class {
|
|
|
7967
8072
|
}
|
|
7968
8073
|
if (_response.error.reason === "status-code") {
|
|
7969
8074
|
switch (_response.error.statusCode) {
|
|
8075
|
+
case 400:
|
|
8076
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
7970
8077
|
case 403:
|
|
7971
8078
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
7972
8079
|
case 429:
|
|
7973
8080
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
7974
|
-
case 501:
|
|
7975
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
7976
8081
|
default:
|
|
7977
8082
|
throw new VectrosError({
|
|
7978
8083
|
statusCode: _response.error.statusCode,
|
|
@@ -8875,7 +8980,7 @@ var SchemasClient = class {
|
|
|
8875
8980
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}");
|
|
8876
8981
|
}
|
|
8877
8982
|
/**
|
|
8878
|
-
* 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.
|
|
8983
|
+
* 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.
|
|
8879
8984
|
*
|
|
8880
8985
|
* @param {Vectros.UpdateSchemaRequest} request
|
|
8881
8986
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8883,6 +8988,7 @@ var SchemasClient = class {
|
|
|
8883
8988
|
* @throws {@link Vectros.BadRequestError}
|
|
8884
8989
|
* @throws {@link Vectros.ForbiddenError}
|
|
8885
8990
|
* @throws {@link Vectros.NotFoundError}
|
|
8991
|
+
* @throws {@link Vectros.ConflictError}
|
|
8886
8992
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
8887
8993
|
*
|
|
8888
8994
|
* @example
|
|
@@ -8934,6 +9040,8 @@ var SchemasClient = class {
|
|
|
8934
9040
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8935
9041
|
case 404:
|
|
8936
9042
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9043
|
+
case 409:
|
|
9044
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
8937
9045
|
case 429:
|
|
8938
9046
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8939
9047
|
default:
|
|
@@ -8947,7 +9055,7 @@ var SchemasClient = class {
|
|
|
8947
9055
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/schemas/{id}");
|
|
8948
9056
|
}
|
|
8949
9057
|
/**
|
|
8950
|
-
* 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.
|
|
9058
|
+
* 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.
|
|
8951
9059
|
*
|
|
8952
9060
|
* @param {Vectros.DeleteSchemaRequest} request
|
|
8953
9061
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -9069,46 +9177,70 @@ var SchemasClient = class {
|
|
|
9069
9177
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}/versions");
|
|
9070
9178
|
}
|
|
9071
9179
|
};
|
|
9072
|
-
var
|
|
9180
|
+
var ScriptsClient = class {
|
|
9073
9181
|
constructor(options) {
|
|
9074
9182
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
9075
9183
|
}
|
|
9076
9184
|
/**
|
|
9077
|
-
* Runs a
|
|
9185
|
+
* 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.
|
|
9078
9186
|
*
|
|
9079
|
-
*
|
|
9080
|
-
*
|
|
9187
|
+
* **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.
|
|
9188
|
+
*
|
|
9189
|
+
* **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.
|
|
9190
|
+
*
|
|
9191
|
+
* **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`).
|
|
9192
|
+
*
|
|
9193
|
+
* **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()`.
|
|
9194
|
+
*
|
|
9195
|
+
* **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.
|
|
9196
|
+
*
|
|
9197
|
+
* @param {Vectros.ScriptExecuteRequest} request
|
|
9198
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9081
9199
|
*
|
|
9082
9200
|
* @throws {@link Vectros.BadRequestError}
|
|
9201
|
+
* @throws {@link Vectros.PaymentRequiredError}
|
|
9083
9202
|
* @throws {@link Vectros.ForbiddenError}
|
|
9203
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9204
|
+
* @throws {@link Vectros.ConflictError}
|
|
9205
|
+
* @throws {@link Vectros.ContentTooLargeError}
|
|
9206
|
+
* @throws {@link Vectros.UnprocessableEntityError}
|
|
9084
9207
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
9208
|
+
* @throws {@link Vectros.InternalServerError}
|
|
9209
|
+
* @throws {@link Vectros.ServiceUnavailableError}
|
|
9210
|
+
* @throws {@link Vectros.GatewayTimeoutError}
|
|
9085
9211
|
*
|
|
9086
9212
|
* @example
|
|
9087
|
-
* await client.
|
|
9088
|
-
*
|
|
9213
|
+
* await client.scripts.executeScript({
|
|
9214
|
+
* "Idempotency-Key": "order-8412-attempt",
|
|
9215
|
+
* scriptRef: {
|
|
9216
|
+
* name: "notify-assignee",
|
|
9217
|
+
* version: "3"
|
|
9218
|
+
* }
|
|
9089
9219
|
* })
|
|
9090
9220
|
*/
|
|
9091
|
-
|
|
9092
|
-
return HttpResponsePromise.fromPromise(this.
|
|
9221
|
+
executeScript(request, requestOptions) {
|
|
9222
|
+
return HttpResponsePromise.fromPromise(this.__executeScript(request, requestOptions));
|
|
9093
9223
|
}
|
|
9094
|
-
async
|
|
9224
|
+
async __executeScript(request, requestOptions) {
|
|
9225
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
9095
9226
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9096
9227
|
const _headers = mergeHeaders(
|
|
9097
9228
|
_authRequest.headers,
|
|
9098
9229
|
this._options?.headers,
|
|
9230
|
+
mergeOnlyDefinedHeaders({ "Idempotency-Key": idempotencyKey }),
|
|
9099
9231
|
requestOptions?.headers
|
|
9100
9232
|
);
|
|
9101
9233
|
const _response = await fetcher({
|
|
9102
9234
|
url: url_exports.join(
|
|
9103
9235
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9104
|
-
"v1/
|
|
9236
|
+
"v1/scripts/execute"
|
|
9105
9237
|
),
|
|
9106
9238
|
method: "POST",
|
|
9107
9239
|
headers: _headers,
|
|
9108
9240
|
contentType: "application/json",
|
|
9109
9241
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9110
9242
|
requestType: "json",
|
|
9111
|
-
body:
|
|
9243
|
+
body: _body,
|
|
9112
9244
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9113
9245
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9114
9246
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -9122,10 +9254,26 @@ var SearchClient = class {
|
|
|
9122
9254
|
switch (_response.error.statusCode) {
|
|
9123
9255
|
case 400:
|
|
9124
9256
|
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9257
|
+
case 402:
|
|
9258
|
+
throw new PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
9125
9259
|
case 403:
|
|
9126
9260
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9261
|
+
case 404:
|
|
9262
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9263
|
+
case 409:
|
|
9264
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9265
|
+
case 413:
|
|
9266
|
+
throw new ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
9267
|
+
case 422:
|
|
9268
|
+
throw new UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
9127
9269
|
case 429:
|
|
9128
9270
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9271
|
+
case 500:
|
|
9272
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
9273
|
+
case 503:
|
|
9274
|
+
throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
9275
|
+
case 504:
|
|
9276
|
+
throw new GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
9129
9277
|
default:
|
|
9130
9278
|
throw new VectrosError({
|
|
9131
9279
|
statusCode: _response.error.statusCode,
|
|
@@ -9134,108 +9282,871 @@ var SearchClient = class {
|
|
|
9134
9282
|
});
|
|
9135
9283
|
}
|
|
9136
9284
|
}
|
|
9137
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
9138
|
-
}
|
|
9139
|
-
};
|
|
9140
|
-
var VectrosClient = class {
|
|
9141
|
-
constructor(options) {
|
|
9142
|
-
this._options = normalizeClientOptionsWithAuth(options);
|
|
9143
|
-
}
|
|
9144
|
-
get auth() {
|
|
9145
|
-
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
9146
|
-
}
|
|
9147
|
-
get documents() {
|
|
9148
|
-
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
9149
|
-
}
|
|
9150
|
-
get identity() {
|
|
9151
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
9152
|
-
}
|
|
9153
|
-
get compliance() {
|
|
9154
|
-
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
9155
|
-
}
|
|
9156
|
-
get folders() {
|
|
9157
|
-
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
9158
|
-
}
|
|
9159
|
-
get inference() {
|
|
9160
|
-
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
9161
|
-
}
|
|
9162
|
-
get records() {
|
|
9163
|
-
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
9164
|
-
}
|
|
9165
|
-
get schemas() {
|
|
9166
|
-
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
9167
|
-
}
|
|
9168
|
-
get search() {
|
|
9169
|
-
return this._search ?? (this._search = new SearchClient(this._options));
|
|
9285
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts/execute");
|
|
9170
9286
|
}
|
|
9171
9287
|
/**
|
|
9172
|
-
*
|
|
9173
|
-
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
9174
|
-
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
9288
|
+
* 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.
|
|
9175
9289
|
*
|
|
9176
|
-
* @param {
|
|
9177
|
-
* @param {
|
|
9178
|
-
*
|
|
9179
|
-
* @
|
|
9290
|
+
* @param {Vectros.ListScriptsRequest} request
|
|
9291
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9292
|
+
*
|
|
9293
|
+
* @example
|
|
9294
|
+
* await client.scripts.listScripts({
|
|
9295
|
+
* name: "notify-assignee",
|
|
9296
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9297
|
+
* })
|
|
9180
9298
|
*/
|
|
9181
|
-
|
|
9182
|
-
return
|
|
9183
|
-
input,
|
|
9184
|
-
init,
|
|
9185
|
-
{
|
|
9186
|
-
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
9187
|
-
headers: this._options.headers,
|
|
9188
|
-
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
9189
|
-
maxRetries: this._options.maxRetries,
|
|
9190
|
-
fetch: this._options.fetch,
|
|
9191
|
-
logging: this._options.logging,
|
|
9192
|
-
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
9193
|
-
},
|
|
9194
|
-
requestOptions
|
|
9195
|
-
);
|
|
9196
|
-
}
|
|
9197
|
-
};
|
|
9198
|
-
var logging;
|
|
9199
|
-
((logging2) => {
|
|
9200
|
-
logging2.LogLevel = LogLevel;
|
|
9201
|
-
logging2.ConsoleLogger = ConsoleLogger;
|
|
9202
|
-
})(logging || (logging = {}));
|
|
9203
|
-
|
|
9204
|
-
// src/server.ts
|
|
9205
|
-
import {
|
|
9206
|
-
CallToolRequestSchema,
|
|
9207
|
-
ListResourcesRequestSchema,
|
|
9208
|
-
ListToolsRequestSchema,
|
|
9209
|
-
ReadResourceRequestSchema
|
|
9210
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
9211
|
-
import { z as z23 } from "zod";
|
|
9212
|
-
|
|
9213
|
-
// src/auth.ts
|
|
9214
|
-
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
9215
|
-
var InvalidApiKeyError = class extends Error {
|
|
9216
|
-
constructor(reason) {
|
|
9217
|
-
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
9218
|
-
this.name = "InvalidApiKeyError";
|
|
9219
|
-
}
|
|
9220
|
-
};
|
|
9221
|
-
function parseApiKey(raw) {
|
|
9222
|
-
if (!raw || raw.trim().length === 0) {
|
|
9223
|
-
throw new InvalidApiKeyError(
|
|
9224
|
-
"env var is missing or empty. Set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_... or ssk_test_...)."
|
|
9225
|
-
);
|
|
9299
|
+
listScripts(request = {}, requestOptions) {
|
|
9300
|
+
return HttpResponsePromise.fromPromise(this.__listScripts(request, requestOptions));
|
|
9226
9301
|
}
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9302
|
+
async __listScripts(request = {}, requestOptions) {
|
|
9303
|
+
const { name, startFrom, limit } = request;
|
|
9304
|
+
const _queryParams = {
|
|
9305
|
+
name,
|
|
9306
|
+
startFrom,
|
|
9307
|
+
limit
|
|
9308
|
+
};
|
|
9309
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9310
|
+
const _headers = mergeHeaders(
|
|
9311
|
+
_authRequest.headers,
|
|
9312
|
+
this._options?.headers,
|
|
9313
|
+
requestOptions?.headers
|
|
9231
9314
|
);
|
|
9315
|
+
const _response = await fetcher({
|
|
9316
|
+
url: url_exports.join(
|
|
9317
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9318
|
+
"v1/scripts"
|
|
9319
|
+
),
|
|
9320
|
+
method: "GET",
|
|
9321
|
+
headers: _headers,
|
|
9322
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9323
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9324
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9325
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9326
|
+
fetchFn: this._options?.fetch,
|
|
9327
|
+
logging: this._options.logging
|
|
9328
|
+
});
|
|
9329
|
+
if (_response.ok) {
|
|
9330
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9331
|
+
}
|
|
9332
|
+
if (_response.error.reason === "status-code") {
|
|
9333
|
+
throw new VectrosError({
|
|
9334
|
+
statusCode: _response.error.statusCode,
|
|
9335
|
+
body: _response.error.body,
|
|
9336
|
+
rawResponse: _response.rawResponse
|
|
9337
|
+
});
|
|
9338
|
+
}
|
|
9339
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts");
|
|
9232
9340
|
}
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9341
|
+
/**
|
|
9342
|
+
* 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.
|
|
9343
|
+
*
|
|
9344
|
+
* @param {Vectros.ScriptRequest} request
|
|
9345
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9346
|
+
*
|
|
9347
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9348
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9349
|
+
* @throws {@link Vectros.ConflictError}
|
|
9350
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9351
|
+
*
|
|
9352
|
+
* @example
|
|
9353
|
+
* await client.scripts.createScript({
|
|
9354
|
+
* name: "notify-assignee",
|
|
9355
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9356
|
+
* })
|
|
9357
|
+
*/
|
|
9358
|
+
createScript(request, requestOptions) {
|
|
9359
|
+
return HttpResponsePromise.fromPromise(this.__createScript(request, requestOptions));
|
|
9360
|
+
}
|
|
9361
|
+
async __createScript(request, requestOptions) {
|
|
9362
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9363
|
+
const _headers = mergeHeaders(
|
|
9364
|
+
_authRequest.headers,
|
|
9365
|
+
this._options?.headers,
|
|
9366
|
+
requestOptions?.headers
|
|
9367
|
+
);
|
|
9368
|
+
const _response = await fetcher({
|
|
9369
|
+
url: url_exports.join(
|
|
9370
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9371
|
+
"v1/scripts"
|
|
9372
|
+
),
|
|
9373
|
+
method: "POST",
|
|
9374
|
+
headers: _headers,
|
|
9375
|
+
contentType: "application/json",
|
|
9376
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9377
|
+
requestType: "json",
|
|
9378
|
+
body: request,
|
|
9379
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9380
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9381
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9382
|
+
fetchFn: this._options?.fetch,
|
|
9383
|
+
logging: this._options.logging
|
|
9384
|
+
});
|
|
9385
|
+
if (_response.ok) {
|
|
9386
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9387
|
+
}
|
|
9388
|
+
if (_response.error.reason === "status-code") {
|
|
9389
|
+
switch (_response.error.statusCode) {
|
|
9390
|
+
case 400:
|
|
9391
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9392
|
+
case 403:
|
|
9393
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9394
|
+
case 409:
|
|
9395
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9396
|
+
case 429:
|
|
9397
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9398
|
+
default:
|
|
9399
|
+
throw new VectrosError({
|
|
9400
|
+
statusCode: _response.error.statusCode,
|
|
9401
|
+
body: _response.error.body,
|
|
9402
|
+
rawResponse: _response.rawResponse
|
|
9403
|
+
});
|
|
9404
|
+
}
|
|
9405
|
+
}
|
|
9406
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts");
|
|
9407
|
+
}
|
|
9408
|
+
/**
|
|
9409
|
+
* Retrieves a single script version by its ID. Requires the `scripts:r` scope.
|
|
9410
|
+
*
|
|
9411
|
+
* @param {Vectros.GetScriptRequest} request
|
|
9412
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9413
|
+
*
|
|
9414
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9415
|
+
*
|
|
9416
|
+
* @example
|
|
9417
|
+
* await client.scripts.getScript({
|
|
9418
|
+
* id: "id"
|
|
9419
|
+
* })
|
|
9420
|
+
*/
|
|
9421
|
+
getScript(request, requestOptions) {
|
|
9422
|
+
return HttpResponsePromise.fromPromise(this.__getScript(request, requestOptions));
|
|
9423
|
+
}
|
|
9424
|
+
async __getScript(request, requestOptions) {
|
|
9425
|
+
const { id } = request;
|
|
9426
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9427
|
+
const _headers = mergeHeaders(
|
|
9428
|
+
_authRequest.headers,
|
|
9429
|
+
this._options?.headers,
|
|
9430
|
+
requestOptions?.headers
|
|
9431
|
+
);
|
|
9432
|
+
const _response = await fetcher({
|
|
9433
|
+
url: url_exports.join(
|
|
9434
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9435
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9436
|
+
),
|
|
9437
|
+
method: "GET",
|
|
9438
|
+
headers: _headers,
|
|
9439
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9440
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9441
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9442
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9443
|
+
fetchFn: this._options?.fetch,
|
|
9444
|
+
logging: this._options.logging
|
|
9445
|
+
});
|
|
9446
|
+
if (_response.ok) {
|
|
9447
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9448
|
+
}
|
|
9449
|
+
if (_response.error.reason === "status-code") {
|
|
9450
|
+
switch (_response.error.statusCode) {
|
|
9451
|
+
case 404:
|
|
9452
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9453
|
+
default:
|
|
9454
|
+
throw new VectrosError({
|
|
9455
|
+
statusCode: _response.error.statusCode,
|
|
9456
|
+
body: _response.error.body,
|
|
9457
|
+
rawResponse: _response.rawResponse
|
|
9458
|
+
});
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9461
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts/{id}");
|
|
9462
|
+
}
|
|
9463
|
+
/**
|
|
9464
|
+
* 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.
|
|
9465
|
+
*
|
|
9466
|
+
* @param {Vectros.UpdateScriptRequest} request
|
|
9467
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9468
|
+
*
|
|
9469
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9470
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9471
|
+
*
|
|
9472
|
+
* @example
|
|
9473
|
+
* await client.scripts.updateScript({
|
|
9474
|
+
* id: "id",
|
|
9475
|
+
* body: {
|
|
9476
|
+
* name: "notify-assignee",
|
|
9477
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9478
|
+
* }
|
|
9479
|
+
* })
|
|
9480
|
+
*/
|
|
9481
|
+
updateScript(request, requestOptions) {
|
|
9482
|
+
return HttpResponsePromise.fromPromise(this.__updateScript(request, requestOptions));
|
|
9483
|
+
}
|
|
9484
|
+
async __updateScript(request, requestOptions) {
|
|
9485
|
+
const { id, body: _body } = request;
|
|
9486
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9487
|
+
const _headers = mergeHeaders(
|
|
9488
|
+
_authRequest.headers,
|
|
9489
|
+
this._options?.headers,
|
|
9490
|
+
requestOptions?.headers
|
|
9491
|
+
);
|
|
9492
|
+
const _response = await fetcher({
|
|
9493
|
+
url: url_exports.join(
|
|
9494
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9495
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9496
|
+
),
|
|
9497
|
+
method: "PUT",
|
|
9498
|
+
headers: _headers,
|
|
9499
|
+
contentType: "application/json",
|
|
9500
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9501
|
+
requestType: "json",
|
|
9502
|
+
body: _body,
|
|
9503
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9504
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9505
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9506
|
+
fetchFn: this._options?.fetch,
|
|
9507
|
+
logging: this._options.logging
|
|
9508
|
+
});
|
|
9509
|
+
if (_response.ok) {
|
|
9510
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9511
|
+
}
|
|
9512
|
+
if (_response.error.reason === "status-code") {
|
|
9513
|
+
switch (_response.error.statusCode) {
|
|
9514
|
+
case 400:
|
|
9515
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9516
|
+
case 429:
|
|
9517
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9518
|
+
default:
|
|
9519
|
+
throw new VectrosError({
|
|
9520
|
+
statusCode: _response.error.statusCode,
|
|
9521
|
+
body: _response.error.body,
|
|
9522
|
+
rawResponse: _response.rawResponse
|
|
9523
|
+
});
|
|
9524
|
+
}
|
|
9525
|
+
}
|
|
9526
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/scripts/{id}");
|
|
9527
|
+
}
|
|
9528
|
+
/**
|
|
9529
|
+
* 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.
|
|
9530
|
+
*
|
|
9531
|
+
* @param {Vectros.DeleteScriptRequest} request
|
|
9532
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9533
|
+
*
|
|
9534
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9535
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9536
|
+
*
|
|
9537
|
+
* @example
|
|
9538
|
+
* await client.scripts.deleteScript({
|
|
9539
|
+
* id: "id"
|
|
9540
|
+
* })
|
|
9541
|
+
*/
|
|
9542
|
+
deleteScript(request, requestOptions) {
|
|
9543
|
+
return HttpResponsePromise.fromPromise(this.__deleteScript(request, requestOptions));
|
|
9544
|
+
}
|
|
9545
|
+
async __deleteScript(request, requestOptions) {
|
|
9546
|
+
const { id } = request;
|
|
9547
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9548
|
+
const _headers = mergeHeaders(
|
|
9549
|
+
_authRequest.headers,
|
|
9550
|
+
this._options?.headers,
|
|
9551
|
+
requestOptions?.headers
|
|
9552
|
+
);
|
|
9553
|
+
const _response = await fetcher({
|
|
9554
|
+
url: url_exports.join(
|
|
9555
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9556
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9557
|
+
),
|
|
9558
|
+
method: "DELETE",
|
|
9559
|
+
headers: _headers,
|
|
9560
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9561
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9562
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9563
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9564
|
+
fetchFn: this._options?.fetch,
|
|
9565
|
+
logging: this._options.logging
|
|
9566
|
+
});
|
|
9567
|
+
if (_response.ok) {
|
|
9568
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9569
|
+
}
|
|
9570
|
+
if (_response.error.reason === "status-code") {
|
|
9571
|
+
switch (_response.error.statusCode) {
|
|
9572
|
+
case 404:
|
|
9573
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9574
|
+
case 429:
|
|
9575
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9576
|
+
default:
|
|
9577
|
+
throw new VectrosError({
|
|
9578
|
+
statusCode: _response.error.statusCode,
|
|
9579
|
+
body: _response.error.body,
|
|
9580
|
+
rawResponse: _response.rawResponse
|
|
9581
|
+
});
|
|
9582
|
+
}
|
|
9583
|
+
}
|
|
9584
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/scripts/{id}");
|
|
9585
|
+
}
|
|
9586
|
+
};
|
|
9587
|
+
var SearchClient = class {
|
|
9588
|
+
constructor(options) {
|
|
9589
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9590
|
+
}
|
|
9591
|
+
/**
|
|
9592
|
+
* 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.
|
|
9593
|
+
*
|
|
9594
|
+
* @param {Vectros.SearchRequest} request
|
|
9595
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9596
|
+
*
|
|
9597
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9598
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9599
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9600
|
+
*
|
|
9601
|
+
* @example
|
|
9602
|
+
* await client.search.content({
|
|
9603
|
+
* query: "patient intake form diabetes"
|
|
9604
|
+
* })
|
|
9605
|
+
*/
|
|
9606
|
+
content(request, requestOptions) {
|
|
9607
|
+
return HttpResponsePromise.fromPromise(this.__content(request, requestOptions));
|
|
9608
|
+
}
|
|
9609
|
+
async __content(request, requestOptions) {
|
|
9610
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9611
|
+
const _headers = mergeHeaders(
|
|
9612
|
+
_authRequest.headers,
|
|
9613
|
+
this._options?.headers,
|
|
9614
|
+
requestOptions?.headers
|
|
9615
|
+
);
|
|
9616
|
+
const _response = await fetcher({
|
|
9617
|
+
url: url_exports.join(
|
|
9618
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9619
|
+
"v1/search"
|
|
9620
|
+
),
|
|
9621
|
+
method: "POST",
|
|
9622
|
+
headers: _headers,
|
|
9623
|
+
contentType: "application/json",
|
|
9624
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9625
|
+
requestType: "json",
|
|
9626
|
+
body: request,
|
|
9627
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9628
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9629
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9630
|
+
fetchFn: this._options?.fetch,
|
|
9631
|
+
logging: this._options.logging
|
|
9632
|
+
});
|
|
9633
|
+
if (_response.ok) {
|
|
9634
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9635
|
+
}
|
|
9636
|
+
if (_response.error.reason === "status-code") {
|
|
9637
|
+
switch (_response.error.statusCode) {
|
|
9638
|
+
case 400:
|
|
9639
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9640
|
+
case 403:
|
|
9641
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9642
|
+
case 429:
|
|
9643
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9644
|
+
default:
|
|
9645
|
+
throw new VectrosError({
|
|
9646
|
+
statusCode: _response.error.statusCode,
|
|
9647
|
+
body: _response.error.body,
|
|
9648
|
+
rawResponse: _response.rawResponse
|
|
9649
|
+
});
|
|
9650
|
+
}
|
|
9651
|
+
}
|
|
9652
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/search");
|
|
9653
|
+
}
|
|
9654
|
+
};
|
|
9655
|
+
var TriggersClient = class {
|
|
9656
|
+
constructor(options) {
|
|
9657
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9658
|
+
}
|
|
9659
|
+
/**
|
|
9660
|
+
* 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.
|
|
9661
|
+
*
|
|
9662
|
+
* 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.
|
|
9663
|
+
*
|
|
9664
|
+
* `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.
|
|
9665
|
+
*
|
|
9666
|
+
* Scoped to your account and app context, derived from your token — never from input. Requires the `triggers:r` scope.
|
|
9667
|
+
*
|
|
9668
|
+
* @param {Vectros.ListTriggerFailuresRequest} request
|
|
9669
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9670
|
+
*
|
|
9671
|
+
* @example
|
|
9672
|
+
* await client.triggers.listTriggerFailures({
|
|
9673
|
+
* ruleId: "3b1c9f2e7a5d8410f6c2e9a1b7d4038f5e6a91c2d7f0b3a4586c9e2f1d0a7b3c",
|
|
9674
|
+
* category: "SCRIPT_ERROR",
|
|
9675
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9676
|
+
* })
|
|
9677
|
+
*/
|
|
9678
|
+
listTriggerFailures(request = {}, requestOptions) {
|
|
9679
|
+
return HttpResponsePromise.fromPromise(this.__listTriggerFailures(request, requestOptions));
|
|
9680
|
+
}
|
|
9681
|
+
async __listTriggerFailures(request = {}, requestOptions) {
|
|
9682
|
+
const { ruleId, category, retryable, from: from_, to, startFrom, limit } = request;
|
|
9683
|
+
const _queryParams = {
|
|
9684
|
+
ruleId,
|
|
9685
|
+
category,
|
|
9686
|
+
retryable,
|
|
9687
|
+
from: from_,
|
|
9688
|
+
to,
|
|
9689
|
+
startFrom,
|
|
9690
|
+
limit
|
|
9691
|
+
};
|
|
9692
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9693
|
+
const _headers = mergeHeaders(
|
|
9694
|
+
_authRequest.headers,
|
|
9695
|
+
this._options?.headers,
|
|
9696
|
+
requestOptions?.headers
|
|
9697
|
+
);
|
|
9698
|
+
const _response = await fetcher({
|
|
9699
|
+
url: url_exports.join(
|
|
9700
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9701
|
+
"v1/trigger-failures"
|
|
9702
|
+
),
|
|
9703
|
+
method: "GET",
|
|
9704
|
+
headers: _headers,
|
|
9705
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9706
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9707
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9708
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9709
|
+
fetchFn: this._options?.fetch,
|
|
9710
|
+
logging: this._options.logging
|
|
9711
|
+
});
|
|
9712
|
+
if (_response.ok) {
|
|
9713
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9714
|
+
}
|
|
9715
|
+
if (_response.error.reason === "status-code") {
|
|
9716
|
+
throw new VectrosError({
|
|
9717
|
+
statusCode: _response.error.statusCode,
|
|
9718
|
+
body: _response.error.body,
|
|
9719
|
+
rawResponse: _response.rawResponse
|
|
9720
|
+
});
|
|
9721
|
+
}
|
|
9722
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/trigger-failures");
|
|
9723
|
+
}
|
|
9724
|
+
/**
|
|
9725
|
+
* 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.
|
|
9726
|
+
*
|
|
9727
|
+
* @param {Vectros.ListTriggersRequest} request
|
|
9728
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9729
|
+
*
|
|
9730
|
+
* @example
|
|
9731
|
+
* await client.triggers.listTriggers({
|
|
9732
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9733
|
+
* })
|
|
9734
|
+
*/
|
|
9735
|
+
listTriggers(request = {}, requestOptions) {
|
|
9736
|
+
return HttpResponsePromise.fromPromise(this.__listTriggers(request, requestOptions));
|
|
9737
|
+
}
|
|
9738
|
+
async __listTriggers(request = {}, requestOptions) {
|
|
9739
|
+
const { startFrom, limit } = request;
|
|
9740
|
+
const _queryParams = {
|
|
9741
|
+
startFrom,
|
|
9742
|
+
limit
|
|
9743
|
+
};
|
|
9744
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9745
|
+
const _headers = mergeHeaders(
|
|
9746
|
+
_authRequest.headers,
|
|
9747
|
+
this._options?.headers,
|
|
9748
|
+
requestOptions?.headers
|
|
9749
|
+
);
|
|
9750
|
+
const _response = await fetcher({
|
|
9751
|
+
url: url_exports.join(
|
|
9752
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9753
|
+
"v1/triggers"
|
|
9754
|
+
),
|
|
9755
|
+
method: "GET",
|
|
9756
|
+
headers: _headers,
|
|
9757
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9758
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9759
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9760
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9761
|
+
fetchFn: this._options?.fetch,
|
|
9762
|
+
logging: this._options.logging
|
|
9763
|
+
});
|
|
9764
|
+
if (_response.ok) {
|
|
9765
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9766
|
+
}
|
|
9767
|
+
if (_response.error.reason === "status-code") {
|
|
9768
|
+
throw new VectrosError({
|
|
9769
|
+
statusCode: _response.error.statusCode,
|
|
9770
|
+
body: _response.error.body,
|
|
9771
|
+
rawResponse: _response.rawResponse
|
|
9772
|
+
});
|
|
9773
|
+
}
|
|
9774
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers");
|
|
9775
|
+
}
|
|
9776
|
+
/**
|
|
9777
|
+
* 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).
|
|
9778
|
+
*
|
|
9779
|
+
* @param {Vectros.CreateTriggerRequest} request
|
|
9780
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9781
|
+
*
|
|
9782
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9783
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9784
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9785
|
+
*
|
|
9786
|
+
* @example
|
|
9787
|
+
* await client.triggers.createTrigger({
|
|
9788
|
+
* body: {
|
|
9789
|
+
* name: "on-intake-create",
|
|
9790
|
+
* firingSource: {
|
|
9791
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9792
|
+
* event: "CREATE"
|
|
9793
|
+
* },
|
|
9794
|
+
* scriptRef: {
|
|
9795
|
+
* name: "notify-assignee",
|
|
9796
|
+
* version: "3"
|
|
9797
|
+
* }
|
|
9798
|
+
* }
|
|
9799
|
+
* })
|
|
9800
|
+
*/
|
|
9801
|
+
createTrigger(request, requestOptions) {
|
|
9802
|
+
return HttpResponsePromise.fromPromise(this.__createTrigger(request, requestOptions));
|
|
9803
|
+
}
|
|
9804
|
+
async __createTrigger(request, requestOptions) {
|
|
9805
|
+
const { upsert, body: _body } = request;
|
|
9806
|
+
const _queryParams = {
|
|
9807
|
+
upsert
|
|
9808
|
+
};
|
|
9809
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9810
|
+
const _headers = mergeHeaders(
|
|
9811
|
+
_authRequest.headers,
|
|
9812
|
+
this._options?.headers,
|
|
9813
|
+
requestOptions?.headers
|
|
9814
|
+
);
|
|
9815
|
+
const _response = await fetcher({
|
|
9816
|
+
url: url_exports.join(
|
|
9817
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9818
|
+
"v1/triggers"
|
|
9819
|
+
),
|
|
9820
|
+
method: "POST",
|
|
9821
|
+
headers: _headers,
|
|
9822
|
+
contentType: "application/json",
|
|
9823
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9824
|
+
requestType: "json",
|
|
9825
|
+
body: _body,
|
|
9826
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9827
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9828
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9829
|
+
fetchFn: this._options?.fetch,
|
|
9830
|
+
logging: this._options.logging
|
|
9831
|
+
});
|
|
9832
|
+
if (_response.ok) {
|
|
9833
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9834
|
+
}
|
|
9835
|
+
if (_response.error.reason === "status-code") {
|
|
9836
|
+
switch (_response.error.statusCode) {
|
|
9837
|
+
case 400:
|
|
9838
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9839
|
+
case 403:
|
|
9840
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9841
|
+
case 429:
|
|
9842
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9843
|
+
default:
|
|
9844
|
+
throw new VectrosError({
|
|
9845
|
+
statusCode: _response.error.statusCode,
|
|
9846
|
+
body: _response.error.body,
|
|
9847
|
+
rawResponse: _response.rawResponse
|
|
9848
|
+
});
|
|
9849
|
+
}
|
|
9850
|
+
}
|
|
9851
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/triggers");
|
|
9852
|
+
}
|
|
9853
|
+
/**
|
|
9854
|
+
* Retrieves a single trigger rule by its ID. Requires the `triggers:r` scope.
|
|
9855
|
+
*
|
|
9856
|
+
* @param {Vectros.GetTriggerRequest} request
|
|
9857
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9858
|
+
*
|
|
9859
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9860
|
+
*
|
|
9861
|
+
* @example
|
|
9862
|
+
* await client.triggers.getTrigger({
|
|
9863
|
+
* id: "id"
|
|
9864
|
+
* })
|
|
9865
|
+
*/
|
|
9866
|
+
getTrigger(request, requestOptions) {
|
|
9867
|
+
return HttpResponsePromise.fromPromise(this.__getTrigger(request, requestOptions));
|
|
9868
|
+
}
|
|
9869
|
+
async __getTrigger(request, requestOptions) {
|
|
9870
|
+
const { id } = request;
|
|
9871
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9872
|
+
const _headers = mergeHeaders(
|
|
9873
|
+
_authRequest.headers,
|
|
9874
|
+
this._options?.headers,
|
|
9875
|
+
requestOptions?.headers
|
|
9876
|
+
);
|
|
9877
|
+
const _response = await fetcher({
|
|
9878
|
+
url: url_exports.join(
|
|
9879
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9880
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9881
|
+
),
|
|
9882
|
+
method: "GET",
|
|
9883
|
+
headers: _headers,
|
|
9884
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9885
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9886
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9887
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9888
|
+
fetchFn: this._options?.fetch,
|
|
9889
|
+
logging: this._options.logging
|
|
9890
|
+
});
|
|
9891
|
+
if (_response.ok) {
|
|
9892
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9893
|
+
}
|
|
9894
|
+
if (_response.error.reason === "status-code") {
|
|
9895
|
+
switch (_response.error.statusCode) {
|
|
9896
|
+
case 404:
|
|
9897
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9898
|
+
default:
|
|
9899
|
+
throw new VectrosError({
|
|
9900
|
+
statusCode: _response.error.statusCode,
|
|
9901
|
+
body: _response.error.body,
|
|
9902
|
+
rawResponse: _response.rawResponse
|
|
9903
|
+
});
|
|
9904
|
+
}
|
|
9905
|
+
}
|
|
9906
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers/{id}");
|
|
9907
|
+
}
|
|
9908
|
+
/**
|
|
9909
|
+
* 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.
|
|
9910
|
+
*
|
|
9911
|
+
* @param {Vectros.UpdateTriggerRequest} request
|
|
9912
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9913
|
+
*
|
|
9914
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9915
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9916
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9917
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9918
|
+
*
|
|
9919
|
+
* @example
|
|
9920
|
+
* await client.triggers.updateTrigger({
|
|
9921
|
+
* id: "id",
|
|
9922
|
+
* body: {
|
|
9923
|
+
* name: "on-intake-create",
|
|
9924
|
+
* firingSource: {
|
|
9925
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9926
|
+
* event: "CREATE"
|
|
9927
|
+
* },
|
|
9928
|
+
* scriptRef: {
|
|
9929
|
+
* name: "notify-assignee",
|
|
9930
|
+
* version: "3"
|
|
9931
|
+
* }
|
|
9932
|
+
* }
|
|
9933
|
+
* })
|
|
9934
|
+
*/
|
|
9935
|
+
updateTrigger(request, requestOptions) {
|
|
9936
|
+
return HttpResponsePromise.fromPromise(this.__updateTrigger(request, requestOptions));
|
|
9937
|
+
}
|
|
9938
|
+
async __updateTrigger(request, requestOptions) {
|
|
9939
|
+
const { id, body: _body } = request;
|
|
9940
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9941
|
+
const _headers = mergeHeaders(
|
|
9942
|
+
_authRequest.headers,
|
|
9943
|
+
this._options?.headers,
|
|
9944
|
+
requestOptions?.headers
|
|
9945
|
+
);
|
|
9946
|
+
const _response = await fetcher({
|
|
9947
|
+
url: url_exports.join(
|
|
9948
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9949
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9950
|
+
),
|
|
9951
|
+
method: "PUT",
|
|
9952
|
+
headers: _headers,
|
|
9953
|
+
contentType: "application/json",
|
|
9954
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9955
|
+
requestType: "json",
|
|
9956
|
+
body: _body,
|
|
9957
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9958
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9959
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9960
|
+
fetchFn: this._options?.fetch,
|
|
9961
|
+
logging: this._options.logging
|
|
9962
|
+
});
|
|
9963
|
+
if (_response.ok) {
|
|
9964
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9965
|
+
}
|
|
9966
|
+
if (_response.error.reason === "status-code") {
|
|
9967
|
+
switch (_response.error.statusCode) {
|
|
9968
|
+
case 400:
|
|
9969
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9970
|
+
case 403:
|
|
9971
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9972
|
+
case 404:
|
|
9973
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9974
|
+
case 429:
|
|
9975
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9976
|
+
default:
|
|
9977
|
+
throw new VectrosError({
|
|
9978
|
+
statusCode: _response.error.statusCode,
|
|
9979
|
+
body: _response.error.body,
|
|
9980
|
+
rawResponse: _response.rawResponse
|
|
9981
|
+
});
|
|
9982
|
+
}
|
|
9983
|
+
}
|
|
9984
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/triggers/{id}");
|
|
9985
|
+
}
|
|
9986
|
+
/**
|
|
9987
|
+
* Permanently deletes one trigger rule by ID. Requires the `triggers:d` scope.
|
|
9988
|
+
*
|
|
9989
|
+
* @param {Vectros.DeleteTriggerRequest} request
|
|
9990
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9991
|
+
*
|
|
9992
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9993
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9994
|
+
*
|
|
9995
|
+
* @example
|
|
9996
|
+
* await client.triggers.deleteTrigger({
|
|
9997
|
+
* id: "id"
|
|
9998
|
+
* })
|
|
9999
|
+
*/
|
|
10000
|
+
deleteTrigger(request, requestOptions) {
|
|
10001
|
+
return HttpResponsePromise.fromPromise(this.__deleteTrigger(request, requestOptions));
|
|
10002
|
+
}
|
|
10003
|
+
async __deleteTrigger(request, requestOptions) {
|
|
10004
|
+
const { id } = request;
|
|
10005
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
10006
|
+
const _headers = mergeHeaders(
|
|
10007
|
+
_authRequest.headers,
|
|
10008
|
+
this._options?.headers,
|
|
10009
|
+
requestOptions?.headers
|
|
10010
|
+
);
|
|
10011
|
+
const _response = await fetcher({
|
|
10012
|
+
url: url_exports.join(
|
|
10013
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
10014
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
10015
|
+
),
|
|
10016
|
+
method: "DELETE",
|
|
10017
|
+
headers: _headers,
|
|
10018
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
10019
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
10020
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10021
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10022
|
+
fetchFn: this._options?.fetch,
|
|
10023
|
+
logging: this._options.logging
|
|
10024
|
+
});
|
|
10025
|
+
if (_response.ok) {
|
|
10026
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
10027
|
+
}
|
|
10028
|
+
if (_response.error.reason === "status-code") {
|
|
10029
|
+
switch (_response.error.statusCode) {
|
|
10030
|
+
case 404:
|
|
10031
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10032
|
+
case 429:
|
|
10033
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10034
|
+
default:
|
|
10035
|
+
throw new VectrosError({
|
|
10036
|
+
statusCode: _response.error.statusCode,
|
|
10037
|
+
body: _response.error.body,
|
|
10038
|
+
rawResponse: _response.rawResponse
|
|
10039
|
+
});
|
|
10040
|
+
}
|
|
10041
|
+
}
|
|
10042
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/triggers/{id}");
|
|
10043
|
+
}
|
|
10044
|
+
};
|
|
10045
|
+
var VectrosClient = class {
|
|
10046
|
+
constructor(options) {
|
|
10047
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
10048
|
+
}
|
|
10049
|
+
get auth() {
|
|
10050
|
+
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
10051
|
+
}
|
|
10052
|
+
get documents() {
|
|
10053
|
+
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
10054
|
+
}
|
|
10055
|
+
get identity() {
|
|
10056
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
10057
|
+
}
|
|
10058
|
+
get compliance() {
|
|
10059
|
+
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
10060
|
+
}
|
|
10061
|
+
get folders() {
|
|
10062
|
+
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
10063
|
+
}
|
|
10064
|
+
get inference() {
|
|
10065
|
+
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
10066
|
+
}
|
|
10067
|
+
get records() {
|
|
10068
|
+
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
10069
|
+
}
|
|
10070
|
+
get schemas() {
|
|
10071
|
+
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
10072
|
+
}
|
|
10073
|
+
get scripts() {
|
|
10074
|
+
return this._scripts ?? (this._scripts = new ScriptsClient(this._options));
|
|
10075
|
+
}
|
|
10076
|
+
get search() {
|
|
10077
|
+
return this._search ?? (this._search = new SearchClient(this._options));
|
|
10078
|
+
}
|
|
10079
|
+
get triggers() {
|
|
10080
|
+
return this._triggers ?? (this._triggers = new TriggersClient(this._options));
|
|
10081
|
+
}
|
|
10082
|
+
/**
|
|
10083
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
10084
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
10085
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
10086
|
+
*
|
|
10087
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
10088
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
10089
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
10090
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
10091
|
+
*/
|
|
10092
|
+
async fetch(input, init, requestOptions) {
|
|
10093
|
+
return makePassthroughRequest(
|
|
10094
|
+
input,
|
|
10095
|
+
init,
|
|
10096
|
+
{
|
|
10097
|
+
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
10098
|
+
headers: this._options.headers,
|
|
10099
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
10100
|
+
maxRetries: this._options.maxRetries,
|
|
10101
|
+
fetch: this._options.fetch,
|
|
10102
|
+
logging: this._options.logging,
|
|
10103
|
+
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
10104
|
+
},
|
|
10105
|
+
requestOptions
|
|
10106
|
+
);
|
|
10107
|
+
}
|
|
10108
|
+
};
|
|
10109
|
+
var logging;
|
|
10110
|
+
((logging2) => {
|
|
10111
|
+
logging2.LogLevel = LogLevel;
|
|
10112
|
+
logging2.ConsoleLogger = ConsoleLogger;
|
|
10113
|
+
})(logging || (logging = {}));
|
|
10114
|
+
|
|
10115
|
+
// src/server.ts
|
|
10116
|
+
import {
|
|
10117
|
+
CallToolRequestSchema,
|
|
10118
|
+
ListResourcesRequestSchema,
|
|
10119
|
+
ListToolsRequestSchema,
|
|
10120
|
+
ReadResourceRequestSchema
|
|
10121
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
10122
|
+
import { z as z24 } from "zod";
|
|
10123
|
+
|
|
10124
|
+
// src/auth.ts
|
|
10125
|
+
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
10126
|
+
var InvalidApiKeyError = class extends Error {
|
|
10127
|
+
constructor(reason) {
|
|
10128
|
+
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
10129
|
+
this.name = "InvalidApiKeyError";
|
|
10130
|
+
}
|
|
10131
|
+
};
|
|
10132
|
+
function parseApiKey(raw) {
|
|
10133
|
+
if (!raw || raw.trim().length === 0) {
|
|
10134
|
+
throw new InvalidApiKeyError(
|
|
10135
|
+
"env var is missing or empty. Set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_... or ssk_test_...)."
|
|
10136
|
+
);
|
|
10137
|
+
}
|
|
10138
|
+
const match = raw.match(KEY_RE);
|
|
10139
|
+
if (!match) {
|
|
10140
|
+
throw new InvalidApiKeyError(
|
|
10141
|
+
`key must start with sk_, ssk_, or st_ followed by "live_" or "test_". Got prefix "${raw.slice(0, 12)}...".`
|
|
10142
|
+
);
|
|
10143
|
+
}
|
|
10144
|
+
return {
|
|
10145
|
+
prefix: match[1],
|
|
10146
|
+
env: match[2],
|
|
10147
|
+
raw
|
|
10148
|
+
};
|
|
10149
|
+
}
|
|
9239
10150
|
function warnOnSuboptimalKey(key, log) {
|
|
9240
10151
|
if (key.prefix === "sk") {
|
|
9241
10152
|
log.warn(
|
|
@@ -9252,8 +10163,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
9252
10163
|
|
|
9253
10164
|
// src/build-info.ts
|
|
9254
10165
|
var BUILD_INFO = {
|
|
9255
|
-
mcpServer: true ? "0.
|
|
9256
|
-
sdk: true ? "0.
|
|
10166
|
+
mcpServer: true ? "0.17.0" : "dev",
|
|
10167
|
+
sdk: true ? "0.43.0" : "dev"
|
|
9257
10168
|
};
|
|
9258
10169
|
|
|
9259
10170
|
// src/log.ts
|
|
@@ -9561,11 +10472,18 @@ var inputSchema = {
|
|
|
9561
10472
|
// Ownership.
|
|
9562
10473
|
userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9563
10474
|
scope: z.string().optional().describe(
|
|
9564
|
-
'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.'
|
|
10475
|
+
'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.'
|
|
10476
|
+
),
|
|
10477
|
+
scopeFilters: z.array(z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
10478
|
+
'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.'
|
|
9565
10479
|
),
|
|
9566
10480
|
// Date window.
|
|
9567
|
-
createdAfter: z.string().optional().describe(
|
|
9568
|
-
|
|
10481
|
+
createdAfter: z.string().optional().describe(
|
|
10482
|
+
"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."
|
|
10483
|
+
),
|
|
10484
|
+
createdBefore: z.string().optional().describe(
|
|
10485
|
+
"Restrict to content CREATED at/before this ISO 8601 UTC timestamp \u2014 same creation-time basis, and the same first-index allowance, as createdAfter."
|
|
10486
|
+
),
|
|
9569
10487
|
// Relevance tuning.
|
|
9570
10488
|
minSimilarity: z.number().min(0).max(1).optional().describe("Minimum semantic similarity (0.0\u20131.0); results below are excluded."),
|
|
9571
10489
|
minTextRelevance: z.number().min(0).max(1).optional().describe("Minimum relative keyword (BM25) relevance (0.0\u20131.0); the keyword-leg analogue of minSimilarity."),
|
|
@@ -9580,11 +10498,19 @@ var inputSchema = {
|
|
|
9580
10498
|
var hybridSearch = ({ client, log }) => ({
|
|
9581
10499
|
name: "hybrid_search",
|
|
9582
10500
|
title: "Hybrid search",
|
|
9583
|
-
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
|
|
10501
|
+
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).',
|
|
9584
10502
|
inputSchema,
|
|
9585
10503
|
handler: async (args) => {
|
|
9586
10504
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
9587
10505
|
const mode = args.mode ?? "HYBRID";
|
|
10506
|
+
if (args.scope !== void 0 && args.scopeFilters !== void 0) {
|
|
10507
|
+
return toolError(
|
|
10508
|
+
"hybrid_search",
|
|
10509
|
+
new Error(
|
|
10510
|
+
"'scope' and 'scopeFilters' are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
10511
|
+
)
|
|
10512
|
+
);
|
|
10513
|
+
}
|
|
9588
10514
|
try {
|
|
9589
10515
|
const result = await client.search.content({
|
|
9590
10516
|
query: args.query,
|
|
@@ -9599,6 +10525,7 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9599
10525
|
filters: args.filters,
|
|
9600
10526
|
userId: args.userId,
|
|
9601
10527
|
scope: args.scope,
|
|
10528
|
+
scopeFilters: args.scopeFilters,
|
|
9602
10529
|
createdAfter: args.createdAfter,
|
|
9603
10530
|
createdBefore: args.createdBefore,
|
|
9604
10531
|
minSimilarity: args.minSimilarity,
|
|
@@ -9677,7 +10604,9 @@ async function drainPages(fetchPage) {
|
|
|
9677
10604
|
var MCP_DEFAULT_LIMIT2 = 3;
|
|
9678
10605
|
var MCP_MAX_LIMIT2 = 100;
|
|
9679
10606
|
var inputSchema2 = {
|
|
9680
|
-
type: z2.string().min(1, "type
|
|
10607
|
+
type: z2.string().min(1, "type must be non-empty when supplied").optional().describe(
|
|
10608
|
+
'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.'
|
|
10609
|
+
),
|
|
9681
10610
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | values | from+to | prefix.
|
|
9682
10611
|
field: z2.string().optional().describe(
|
|
9683
10612
|
'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.'
|
|
@@ -9699,6 +10628,12 @@ var inputSchema2 = {
|
|
|
9699
10628
|
"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."
|
|
9700
10629
|
),
|
|
9701
10630
|
// List-mode args:
|
|
10631
|
+
folderId: z2.string().optional().describe(
|
|
10632
|
+
"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."
|
|
10633
|
+
),
|
|
10634
|
+
recent: z2.boolean().optional().describe(
|
|
10635
|
+
"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."
|
|
10636
|
+
),
|
|
9702
10637
|
userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9703
10638
|
scope: z2.string().optional().describe(
|
|
9704
10639
|
'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.'
|
|
@@ -9711,11 +10646,13 @@ var inputSchema2 = {
|
|
|
9711
10646
|
var recordQuery = ({ client, log }) => ({
|
|
9712
10647
|
name: "record_query",
|
|
9713
10648
|
title: "Record query (list or lookup)",
|
|
9714
|
-
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
|
|
10649
|
+
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.",
|
|
9715
10650
|
inputSchema: inputSchema2,
|
|
9716
10651
|
handler: async (args) => {
|
|
9717
10652
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
9718
10653
|
const type = args.type;
|
|
10654
|
+
const folderId = args.folderId;
|
|
10655
|
+
const recent = args.recent;
|
|
9719
10656
|
const field = args.field;
|
|
9720
10657
|
const value = args.value;
|
|
9721
10658
|
const values = args.values;
|
|
@@ -9733,6 +10670,48 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9733
10670
|
)
|
|
9734
10671
|
);
|
|
9735
10672
|
}
|
|
10673
|
+
if (field && (folderId !== void 0 || recent !== void 0)) {
|
|
10674
|
+
return toolError(
|
|
10675
|
+
"record_query",
|
|
10676
|
+
new Error(
|
|
10677
|
+
"'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."
|
|
10678
|
+
)
|
|
10679
|
+
);
|
|
10680
|
+
}
|
|
10681
|
+
if (field && !type) {
|
|
10682
|
+
return toolError(
|
|
10683
|
+
"record_query",
|
|
10684
|
+
new Error(
|
|
10685
|
+
"a lookup ('field') is always within one record type \u2014 pass 'type'. To read across types, use list mode with 'folderId' or 'recent'."
|
|
10686
|
+
)
|
|
10687
|
+
);
|
|
10688
|
+
}
|
|
10689
|
+
if (!field) {
|
|
10690
|
+
if (recent && (type !== void 0 || folderId !== void 0)) {
|
|
10691
|
+
return toolError(
|
|
10692
|
+
"record_query",
|
|
10693
|
+
new Error(
|
|
10694
|
+
"'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."
|
|
10695
|
+
)
|
|
10696
|
+
);
|
|
10697
|
+
}
|
|
10698
|
+
if (recent && (args.userId !== void 0 || args.scope !== void 0)) {
|
|
10699
|
+
return toolError(
|
|
10700
|
+
"record_query",
|
|
10701
|
+
new Error(
|
|
10702
|
+
"'recent' ignores the owner filters \u2014 'userId'/'scope' would be silently dropped. List by 'type' or 'folderId' to filter by owner."
|
|
10703
|
+
)
|
|
10704
|
+
);
|
|
10705
|
+
}
|
|
10706
|
+
if (!recent && type === void 0 && folderId === void 0) {
|
|
10707
|
+
return toolError(
|
|
10708
|
+
"record_query",
|
|
10709
|
+
new Error(
|
|
10710
|
+
"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."
|
|
10711
|
+
)
|
|
10712
|
+
);
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
9736
10715
|
try {
|
|
9737
10716
|
let page;
|
|
9738
10717
|
if (field) {
|
|
@@ -9796,6 +10775,7 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9796
10775
|
}
|
|
9797
10776
|
}
|
|
9798
10777
|
page = await client.records.lookupRecordsByBody({
|
|
10778
|
+
// Non-null: the `field && !type` guard above returns before reaching lookup mode.
|
|
9799
10779
|
type,
|
|
9800
10780
|
field: normalizedField,
|
|
9801
10781
|
value,
|
|
@@ -9816,13 +10796,22 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9816
10796
|
} else {
|
|
9817
10797
|
page = await client.records.listRecords({
|
|
9818
10798
|
type,
|
|
10799
|
+
folderId,
|
|
10800
|
+
...recent ? { recent: "true" } : {},
|
|
9819
10801
|
userId: args.userId,
|
|
9820
10802
|
scope: args.scope,
|
|
9821
10803
|
startFrom,
|
|
9822
10804
|
limit
|
|
9823
10805
|
});
|
|
9824
10806
|
log.debug(
|
|
9825
|
-
{
|
|
10807
|
+
{
|
|
10808
|
+
tool: "record_query",
|
|
10809
|
+
mode: recent ? "list:recent" : folderId ? "list:folder" : "list:type",
|
|
10810
|
+
type,
|
|
10811
|
+
folderId,
|
|
10812
|
+
limit,
|
|
10813
|
+
returned: pageItems(page).length
|
|
10814
|
+
},
|
|
9826
10815
|
"record_query list ok"
|
|
9827
10816
|
);
|
|
9828
10817
|
}
|
|
@@ -9999,7 +10988,7 @@ var inputSchema5 = {
|
|
|
9999
10988
|
folderId: z5.string().optional().describe("Group this record into a folder."),
|
|
10000
10989
|
userId: z5.string().optional().describe("Owning user id."),
|
|
10001
10990
|
scopes: z5.array(z5.string()).optional().describe(
|
|
10002
|
-
'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
|
|
10991
|
+
'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.'
|
|
10003
10992
|
)
|
|
10004
10993
|
};
|
|
10005
10994
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -10032,19 +11021,101 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10032
11021
|
});
|
|
10033
11022
|
var record_create_default = recordCreate;
|
|
10034
11023
|
|
|
10035
|
-
// src/tools/
|
|
11024
|
+
// src/tools/record_batch_write.ts
|
|
10036
11025
|
import { z as z6 } from "zod";
|
|
10037
|
-
var
|
|
10038
|
-
|
|
11026
|
+
var MCP_MAX_ITEMS = 50;
|
|
11027
|
+
var itemSchema = z6.strictObject({
|
|
11028
|
+
type: z6.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
|
|
11029
|
+
fields: z6.record(z6.string(), z6.unknown()).describe(
|
|
11030
|
+
"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)."
|
|
11031
|
+
),
|
|
10039
11032
|
externalId: z6.string().optional().describe(
|
|
11033
|
+
'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.'
|
|
11034
|
+
),
|
|
11035
|
+
indexMode: z6.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
11036
|
+
"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."
|
|
11037
|
+
),
|
|
11038
|
+
status: z6.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
11039
|
+
folderId: z6.string().optional().describe("Group this record into a folder."),
|
|
11040
|
+
userId: z6.string().optional().describe("Owning user id."),
|
|
11041
|
+
scopes: z6.array(z6.string()).optional().describe(
|
|
11042
|
+
"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."
|
|
11043
|
+
)
|
|
11044
|
+
});
|
|
11045
|
+
var inputSchema6 = {
|
|
11046
|
+
items: z6.array(itemSchema).min(1).max(MCP_MAX_ITEMS).describe(
|
|
11047
|
+
`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.`
|
|
11048
|
+
),
|
|
11049
|
+
atomicity: z6.enum(["best_effort", "all_or_nothing"]).optional().describe(
|
|
11050
|
+
'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).'
|
|
11051
|
+
),
|
|
11052
|
+
upsert: z6.boolean().optional().describe(
|
|
11053
|
+
"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."
|
|
11054
|
+
),
|
|
11055
|
+
allowClear: z6.boolean().optional().describe(
|
|
11056
|
+
"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."
|
|
11057
|
+
)
|
|
11058
|
+
};
|
|
11059
|
+
var recordBatchWrite = ({ client, log }) => ({
|
|
11060
|
+
name: "record_batch_write",
|
|
11061
|
+
title: "Create or upsert multiple records in one call",
|
|
11062
|
+
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).',
|
|
11063
|
+
inputSchema: inputSchema6,
|
|
11064
|
+
handler: async (args) => {
|
|
11065
|
+
const items = args.items;
|
|
11066
|
+
const atomicity = args.atomicity;
|
|
11067
|
+
try {
|
|
11068
|
+
const body = {
|
|
11069
|
+
items: items.map((item) => ({
|
|
11070
|
+
typeName: item.type,
|
|
11071
|
+
payload: item.fields,
|
|
11072
|
+
externalId: item.externalId,
|
|
11073
|
+
indexMode: item.indexMode,
|
|
11074
|
+
status: item.status,
|
|
11075
|
+
folderId: item.folderId,
|
|
11076
|
+
userId: item.userId,
|
|
11077
|
+
scopes: item.scopes
|
|
11078
|
+
})),
|
|
11079
|
+
atomicity,
|
|
11080
|
+
upsert: args.upsert,
|
|
11081
|
+
allowClear: args.allowClear
|
|
11082
|
+
};
|
|
11083
|
+
const response = await client.records.batchWriteRecords(body, { maxRetries: 0 });
|
|
11084
|
+
log.debug(
|
|
11085
|
+
{
|
|
11086
|
+
tool: "record_batch_write",
|
|
11087
|
+
submitted: items.length,
|
|
11088
|
+
atomicity: atomicity ?? "best_effort",
|
|
11089
|
+
succeeded: response.succeeded,
|
|
11090
|
+
failed: response.failed
|
|
11091
|
+
},
|
|
11092
|
+
"record_batch_write ok"
|
|
11093
|
+
);
|
|
11094
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
11095
|
+
} catch (err) {
|
|
11096
|
+
log.warn(
|
|
11097
|
+
{ tool: "record_batch_write", itemCount: items?.length, err: String(err) },
|
|
11098
|
+
"record_batch_write failed"
|
|
11099
|
+
);
|
|
11100
|
+
return toolError("record_batch_write", err);
|
|
11101
|
+
}
|
|
11102
|
+
}
|
|
11103
|
+
});
|
|
11104
|
+
var record_batch_write_default = recordBatchWrite;
|
|
11105
|
+
|
|
11106
|
+
// src/tools/record_update.ts
|
|
11107
|
+
import { z as z7 } from "zod";
|
|
11108
|
+
var inputSchema7 = {
|
|
11109
|
+
id: z7.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
|
|
11110
|
+
externalId: z7.string().optional().describe(
|
|
10040
11111
|
"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."
|
|
10041
11112
|
),
|
|
10042
|
-
type:
|
|
10043
|
-
fields:
|
|
11113
|
+
type: z7.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11114
|
+
fields: z7.record(z7.string(), z7.unknown()).describe(
|
|
10044
11115
|
"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."
|
|
10045
11116
|
),
|
|
10046
|
-
status:
|
|
10047
|
-
expectedVersion:
|
|
11117
|
+
status: z7.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
|
|
11118
|
+
expectedVersion: z7.number().int().optional().describe(
|
|
10048
11119
|
"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."
|
|
10049
11120
|
)
|
|
10050
11121
|
};
|
|
@@ -10052,7 +11123,7 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10052
11123
|
name: "record_update",
|
|
10053
11124
|
title: "Update a record by id or externalId",
|
|
10054
11125
|
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.",
|
|
10055
|
-
inputSchema:
|
|
11126
|
+
inputSchema: inputSchema7,
|
|
10056
11127
|
handler: async (args) => {
|
|
10057
11128
|
const id = args.id;
|
|
10058
11129
|
const externalId = args.externalId;
|
|
@@ -10078,15 +11149,15 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10078
11149
|
var record_update_default = recordUpdate;
|
|
10079
11150
|
|
|
10080
11151
|
// src/tools/record_delete.ts
|
|
10081
|
-
import { z as
|
|
10082
|
-
var
|
|
10083
|
-
id:
|
|
11152
|
+
import { z as z8 } from "zod";
|
|
11153
|
+
var inputSchema8 = {
|
|
11154
|
+
id: z8.string().min(1, "id is required").describe("The Vectros record id to delete.")
|
|
10084
11155
|
};
|
|
10085
11156
|
var recordDelete = ({ client, log }) => ({
|
|
10086
11157
|
name: "record_delete",
|
|
10087
11158
|
title: "Delete a record",
|
|
10088
11159
|
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.",
|
|
10089
|
-
inputSchema:
|
|
11160
|
+
inputSchema: inputSchema8,
|
|
10090
11161
|
handler: async (args) => {
|
|
10091
11162
|
const id = args.id;
|
|
10092
11163
|
try {
|
|
@@ -10102,49 +11173,63 @@ var recordDelete = ({ client, log }) => ({
|
|
|
10102
11173
|
var record_delete_default = recordDelete;
|
|
10103
11174
|
|
|
10104
11175
|
// src/tools/rag_ask.ts
|
|
10105
|
-
import { z as
|
|
11176
|
+
import { z as z9 } from "zod";
|
|
10106
11177
|
var SEARCH_MCP_DEFAULT_LIMIT = 5;
|
|
10107
11178
|
var SEARCH_MCP_MAX_LIMIT = 50;
|
|
10108
|
-
var
|
|
10109
|
-
query:
|
|
10110
|
-
instructions:
|
|
11179
|
+
var inputSchema9 = {
|
|
11180
|
+
query: z9.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
|
|
11181
|
+
instructions: z9.string().optional().describe(
|
|
10111
11182
|
'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.'
|
|
10112
11183
|
),
|
|
10113
|
-
model:
|
|
11184
|
+
model: z9.string().optional().describe(
|
|
10114
11185
|
"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."
|
|
10115
11186
|
),
|
|
10116
|
-
search:
|
|
10117
|
-
mode:
|
|
10118
|
-
limit:
|
|
11187
|
+
search: z9.object({
|
|
11188
|
+
mode: z9.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
|
|
11189
|
+
limit: z9.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
10119
11190
|
`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.`
|
|
10120
11191
|
),
|
|
10121
11192
|
// Retrieval scoping — parity with hybrid_search so an agent can ground the
|
|
10122
11193
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
10123
11194
|
// whole-tenant corpus.
|
|
10124
|
-
userId:
|
|
10125
|
-
scope:
|
|
10126
|
-
'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.'
|
|
11195
|
+
userId: z9.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
11196
|
+
scope: z9.string().optional().describe(
|
|
11197
|
+
'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.'
|
|
11198
|
+
),
|
|
11199
|
+
scopeFilters: z9.array(z9.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
11200
|
+
'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`.'
|
|
10127
11201
|
),
|
|
10128
|
-
folderId:
|
|
10129
|
-
rootFolderId:
|
|
10130
|
-
typeName:
|
|
10131
|
-
contentTypes:
|
|
10132
|
-
filters:
|
|
11202
|
+
folderId: z9.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
11203
|
+
rootFolderId: z9.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
11204
|
+
typeName: z9.string().optional().describe("Restrict record retrieval to this schema type."),
|
|
11205
|
+
contentTypes: z9.array(z9.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
|
|
11206
|
+
filters: z9.record(z9.unknown()).optional().describe(
|
|
10133
11207
|
'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"}.'
|
|
10134
11208
|
),
|
|
10135
|
-
createdAfter:
|
|
10136
|
-
|
|
10137
|
-
|
|
11209
|
+
createdAfter: z9.string().optional().describe(
|
|
11210
|
+
"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."
|
|
11211
|
+
),
|
|
11212
|
+
createdBefore: z9.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
|
|
11213
|
+
requireComplete: z9.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
|
|
10138
11214
|
}).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
|
|
10139
|
-
maxTokens:
|
|
10140
|
-
temperature:
|
|
11215
|
+
maxTokens: z9.number().int().min(1).optional().describe("Max output tokens."),
|
|
11216
|
+
temperature: z9.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
|
|
10141
11217
|
};
|
|
10142
11218
|
var ragAsk = ({ client, log }) => ({
|
|
10143
11219
|
name: "rag_ask",
|
|
10144
11220
|
title: "RAG ask (corpus-wide)",
|
|
10145
|
-
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.",
|
|
10146
|
-
inputSchema:
|
|
11221
|
+
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.",
|
|
11222
|
+
inputSchema: inputSchema9,
|
|
10147
11223
|
handler: async (args, extra) => {
|
|
11224
|
+
const rawSearch = args.search ?? {};
|
|
11225
|
+
if (rawSearch.scope !== void 0 && rawSearch.scopeFilters !== void 0) {
|
|
11226
|
+
return toolError(
|
|
11227
|
+
"rag_ask",
|
|
11228
|
+
new Error(
|
|
11229
|
+
"search.scope and search.scopeFilters are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
11230
|
+
)
|
|
11231
|
+
);
|
|
11232
|
+
}
|
|
10148
11233
|
try {
|
|
10149
11234
|
const searchArg = args.search ?? {};
|
|
10150
11235
|
const search = {
|
|
@@ -10152,6 +11237,7 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10152
11237
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
10153
11238
|
userId: searchArg.userId,
|
|
10154
11239
|
scope: searchArg.scope,
|
|
11240
|
+
scopeFilters: searchArg.scopeFilters,
|
|
10155
11241
|
folderId: searchArg.folderId,
|
|
10156
11242
|
rootFolderId: searchArg.rootFolderId,
|
|
10157
11243
|
typeName: searchArg.typeName,
|
|
@@ -10219,20 +11305,20 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10219
11305
|
var rag_ask_default = ragAsk;
|
|
10220
11306
|
|
|
10221
11307
|
// src/tools/document_ask.ts
|
|
10222
|
-
import { z as
|
|
10223
|
-
var
|
|
10224
|
-
documentId:
|
|
10225
|
-
prompt:
|
|
10226
|
-
model:
|
|
11308
|
+
import { z as z10 } from "zod";
|
|
11309
|
+
var inputSchema10 = {
|
|
11310
|
+
documentId: z10.string().min(1, "documentId is required").describe("ID of the document to ask against."),
|
|
11311
|
+
prompt: z10.string().min(1, "prompt is required").describe("Question to ask about the document."),
|
|
11312
|
+
model: z10.string().optional().describe(
|
|
10227
11313
|
"Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
10228
11314
|
),
|
|
10229
|
-
maxTokens:
|
|
11315
|
+
maxTokens: z10.number().int().min(1).optional().describe("Max output tokens.")
|
|
10230
11316
|
};
|
|
10231
11317
|
var documentAsk = ({ client, log }) => ({
|
|
10232
11318
|
name: "document_ask",
|
|
10233
11319
|
title: "Document ask (single-document)",
|
|
10234
11320
|
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.",
|
|
10235
|
-
inputSchema:
|
|
11321
|
+
inputSchema: inputSchema10,
|
|
10236
11322
|
handler: async (args, extra) => {
|
|
10237
11323
|
try {
|
|
10238
11324
|
const stream = await client.inference.documentAsk({
|
|
@@ -10291,18 +11377,18 @@ var documentAsk = ({ client, log }) => ({
|
|
|
10291
11377
|
var document_ask_default = documentAsk;
|
|
10292
11378
|
|
|
10293
11379
|
// src/tools/list_schemas.ts
|
|
10294
|
-
import { z as
|
|
10295
|
-
var
|
|
10296
|
-
userId:
|
|
11380
|
+
import { z as z11 } from "zod";
|
|
11381
|
+
var inputSchema11 = {
|
|
11382
|
+
userId: z11.string().optional().describe(
|
|
10297
11383
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
10298
11384
|
),
|
|
10299
|
-
scope:
|
|
11385
|
+
scope: z11.string().optional().describe(
|
|
10300
11386
|
'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.'
|
|
10301
11387
|
),
|
|
10302
|
-
surface:
|
|
11388
|
+
surface: z11.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
10303
11389
|
"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."
|
|
10304
11390
|
),
|
|
10305
|
-
recordType:
|
|
11391
|
+
recordType: z11.string().optional().describe(
|
|
10306
11392
|
'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.'
|
|
10307
11393
|
)
|
|
10308
11394
|
};
|
|
@@ -10310,7 +11396,7 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10310
11396
|
name: "list_schemas",
|
|
10311
11397
|
title: "List record schemas",
|
|
10312
11398
|
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.',
|
|
10313
|
-
inputSchema:
|
|
11399
|
+
inputSchema: inputSchema11,
|
|
10314
11400
|
handler: async (args) => {
|
|
10315
11401
|
const userId = args.userId;
|
|
10316
11402
|
const scope = args.scope;
|
|
@@ -10336,18 +11422,18 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10336
11422
|
var list_schemas_default = listSchemas;
|
|
10337
11423
|
|
|
10338
11424
|
// src/tools/document_get.ts
|
|
10339
|
-
import { z as
|
|
11425
|
+
import { z as z12 } from "zod";
|
|
10340
11426
|
var MAX_TEXT_CHARS = 32e3;
|
|
10341
|
-
var
|
|
10342
|
-
documentId:
|
|
10343
|
-
externalId:
|
|
11427
|
+
var inputSchema12 = {
|
|
11428
|
+
documentId: z12.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
|
|
11429
|
+
externalId: z12.string().optional().describe(
|
|
10344
11430
|
"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."
|
|
10345
11431
|
),
|
|
10346
|
-
type:
|
|
10347
|
-
includeText:
|
|
11432
|
+
type: z12.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11433
|
+
includeText: z12.boolean().optional().describe(
|
|
10348
11434
|
"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."
|
|
10349
11435
|
),
|
|
10350
|
-
includeDownloadUrl:
|
|
11436
|
+
includeDownloadUrl: z12.boolean().optional().describe(
|
|
10351
11437
|
"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."
|
|
10352
11438
|
)
|
|
10353
11439
|
};
|
|
@@ -10364,7 +11450,7 @@ var documentGet = ({ client, log }) => ({
|
|
|
10364
11450
|
name: "document_get",
|
|
10365
11451
|
title: "Get document metadata (and optionally text)",
|
|
10366
11452
|
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.",
|
|
10367
|
-
inputSchema:
|
|
11453
|
+
inputSchema: inputSchema12,
|
|
10368
11454
|
handler: async (args) => {
|
|
10369
11455
|
const documentId = args.documentId;
|
|
10370
11456
|
const externalId = args.externalId;
|
|
@@ -10429,28 +11515,28 @@ var documentGet = ({ client, log }) => ({
|
|
|
10429
11515
|
var document_get_default = documentGet;
|
|
10430
11516
|
|
|
10431
11517
|
// src/tools/document_query.ts
|
|
10432
|
-
import { z as
|
|
11518
|
+
import { z as z13 } from "zod";
|
|
10433
11519
|
var MCP_DEFAULT_LIMIT3 = 3;
|
|
10434
11520
|
var MCP_MAX_LIMIT3 = 100;
|
|
10435
|
-
var
|
|
11521
|
+
var inputSchema13 = {
|
|
10436
11522
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
10437
|
-
field:
|
|
10438
|
-
value:
|
|
10439
|
-
from:
|
|
10440
|
-
to:
|
|
10441
|
-
prefix:
|
|
10442
|
-
order:
|
|
11523
|
+
field: z13.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
|
|
11524
|
+
value: z13.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
|
|
11525
|
+
from: z13.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
|
|
11526
|
+
to: z13.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
11527
|
+
prefix: z13.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
11528
|
+
order: z13.enum(["asc", "desc"]).optional().describe(
|
|
10443
11529
|
"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."
|
|
10444
11530
|
),
|
|
10445
|
-
type:
|
|
11531
|
+
type: z13.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
|
|
10446
11532
|
// List-mode args:
|
|
10447
|
-
folderId:
|
|
10448
|
-
userId:
|
|
10449
|
-
scope:
|
|
11533
|
+
folderId: z13.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
11534
|
+
userId: z13.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
11535
|
+
scope: z13.string().optional().describe(
|
|
10450
11536
|
'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.'
|
|
10451
11537
|
),
|
|
10452
|
-
startFrom:
|
|
10453
|
-
limit:
|
|
11538
|
+
startFrom: z13.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
11539
|
+
limit: z13.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
10454
11540
|
`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.`
|
|
10455
11541
|
)
|
|
10456
11542
|
};
|
|
@@ -10458,7 +11544,7 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10458
11544
|
name: "document_query",
|
|
10459
11545
|
title: "Document query (list or lookup)",
|
|
10460
11546
|
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.",
|
|
10461
|
-
inputSchema:
|
|
11547
|
+
inputSchema: inputSchema13,
|
|
10462
11548
|
handler: async (args) => {
|
|
10463
11549
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
10464
11550
|
const field = args.field;
|
|
@@ -10538,29 +11624,29 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10538
11624
|
var document_query_default = documentQuery;
|
|
10539
11625
|
|
|
10540
11626
|
// src/tools/document_update.ts
|
|
10541
|
-
import { z as
|
|
10542
|
-
var
|
|
10543
|
-
documentId:
|
|
10544
|
-
externalId:
|
|
11627
|
+
import { z as z14 } from "zod";
|
|
11628
|
+
var inputSchema14 = {
|
|
11629
|
+
documentId: z14.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
|
|
11630
|
+
externalId: z14.string().optional().describe(
|
|
10545
11631
|
"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."
|
|
10546
11632
|
),
|
|
10547
|
-
type:
|
|
10548
|
-
title:
|
|
10549
|
-
fields:
|
|
11633
|
+
type: z14.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11634
|
+
title: z14.string().optional().describe("New title. Omit to keep the current title."),
|
|
11635
|
+
fields: z14.record(z14.string(), z14.unknown()).optional().describe(
|
|
10550
11636
|
"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."
|
|
10551
11637
|
),
|
|
10552
|
-
text:
|
|
11638
|
+
text: z14.string().optional().describe(
|
|
10553
11639
|
"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."
|
|
10554
11640
|
),
|
|
10555
|
-
folderId:
|
|
10556
|
-
status:
|
|
11641
|
+
folderId: z14.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
|
|
11642
|
+
status: z14.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
|
|
10557
11643
|
"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."
|
|
10558
11644
|
),
|
|
10559
|
-
userId:
|
|
10560
|
-
scopes:
|
|
11645
|
+
userId: z14.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11646
|
+
scopes: z14.array(z14.string()).optional().describe(
|
|
10561
11647
|
'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).'
|
|
10562
11648
|
),
|
|
10563
|
-
expectedVersion:
|
|
11649
|
+
expectedVersion: z14.number().int().optional().describe(
|
|
10564
11650
|
"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."
|
|
10565
11651
|
)
|
|
10566
11652
|
};
|
|
@@ -10568,7 +11654,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10568
11654
|
name: "document_update",
|
|
10569
11655
|
title: "Update a document",
|
|
10570
11656
|
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.',
|
|
10571
|
-
inputSchema:
|
|
11657
|
+
inputSchema: inputSchema14,
|
|
10572
11658
|
handler: async (args) => {
|
|
10573
11659
|
const documentId = args.documentId;
|
|
10574
11660
|
const externalId = args.externalId;
|
|
@@ -10608,15 +11694,15 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10608
11694
|
var document_update_default = documentUpdate;
|
|
10609
11695
|
|
|
10610
11696
|
// src/tools/document_delete.ts
|
|
10611
|
-
import { z as
|
|
10612
|
-
var
|
|
10613
|
-
documentId:
|
|
11697
|
+
import { z as z15 } from "zod";
|
|
11698
|
+
var inputSchema15 = {
|
|
11699
|
+
documentId: z15.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
|
|
10614
11700
|
};
|
|
10615
11701
|
var documentDelete = ({ client, log }) => ({
|
|
10616
11702
|
name: "document_delete",
|
|
10617
11703
|
title: "Delete a document",
|
|
10618
11704
|
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).',
|
|
10619
|
-
inputSchema:
|
|
11705
|
+
inputSchema: inputSchema15,
|
|
10620
11706
|
handler: async (args) => {
|
|
10621
11707
|
const documentId = args.documentId;
|
|
10622
11708
|
try {
|
|
@@ -10634,18 +11720,18 @@ var documentDelete = ({ client, log }) => ({
|
|
|
10634
11720
|
var document_delete_default = documentDelete;
|
|
10635
11721
|
|
|
10636
11722
|
// src/tools/folder_query.ts
|
|
10637
|
-
import { z as
|
|
11723
|
+
import { z as z16 } from "zod";
|
|
10638
11724
|
var MCP_DEFAULT_LIMIT4 = 10;
|
|
10639
11725
|
var MCP_MAX_LIMIT4 = 100;
|
|
10640
|
-
var
|
|
10641
|
-
id:
|
|
10642
|
-
parentId:
|
|
10643
|
-
userId:
|
|
10644
|
-
scope:
|
|
11726
|
+
var inputSchema16 = {
|
|
11727
|
+
id: z16.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
11728
|
+
parentId: z16.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
11729
|
+
userId: z16.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
11730
|
+
scope: z16.string().optional().describe(
|
|
10645
11731
|
'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.'
|
|
10646
11732
|
),
|
|
10647
|
-
startFrom:
|
|
10648
|
-
limit:
|
|
11733
|
+
startFrom: z16.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
11734
|
+
limit: z16.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10649
11735
|
`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\`.`
|
|
10650
11736
|
)
|
|
10651
11737
|
};
|
|
@@ -10653,7 +11739,7 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10653
11739
|
name: "folder_query",
|
|
10654
11740
|
title: "Folder query (list or get)",
|
|
10655
11741
|
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.",
|
|
10656
|
-
inputSchema:
|
|
11742
|
+
inputSchema: inputSchema16,
|
|
10657
11743
|
handler: async (args) => {
|
|
10658
11744
|
const id = args.id;
|
|
10659
11745
|
try {
|
|
@@ -10683,14 +11769,14 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10683
11769
|
var folder_query_default = folderQuery;
|
|
10684
11770
|
|
|
10685
11771
|
// src/tools/folder_create.ts
|
|
10686
|
-
import { z as
|
|
10687
|
-
var
|
|
10688
|
-
name:
|
|
10689
|
-
description:
|
|
10690
|
-
parentId:
|
|
10691
|
-
slug:
|
|
10692
|
-
userId:
|
|
10693
|
-
scopes:
|
|
11772
|
+
import { z as z17 } from "zod";
|
|
11773
|
+
var inputSchema17 = {
|
|
11774
|
+
name: z17.string().min(1, "name is required").describe("Folder display name."),
|
|
11775
|
+
description: z17.string().optional().describe("Optional description of the folder's purpose."),
|
|
11776
|
+
parentId: z17.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
11777
|
+
slug: z17.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
|
|
11778
|
+
userId: z17.string().optional().describe("Owning user (Vectros UUID)."),
|
|
11779
|
+
scopes: z17.array(z17.string()).optional().describe(
|
|
10694
11780
|
'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.'
|
|
10695
11781
|
)
|
|
10696
11782
|
};
|
|
@@ -10698,7 +11784,7 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10698
11784
|
name: "folder_create",
|
|
10699
11785
|
title: "Create a folder",
|
|
10700
11786
|
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).",
|
|
10701
|
-
inputSchema:
|
|
11787
|
+
inputSchema: inputSchema17,
|
|
10702
11788
|
handler: async (args) => {
|
|
10703
11789
|
try {
|
|
10704
11790
|
const folder = await client.folders.createFolder({
|
|
@@ -10722,16 +11808,16 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10722
11808
|
var folder_create_default = folderCreate;
|
|
10723
11809
|
|
|
10724
11810
|
// src/tools/folder_update.ts
|
|
10725
|
-
import { z as
|
|
10726
|
-
var
|
|
10727
|
-
id:
|
|
10728
|
-
name:
|
|
10729
|
-
description:
|
|
10730
|
-
userId:
|
|
10731
|
-
scopes:
|
|
11811
|
+
import { z as z18 } from "zod";
|
|
11812
|
+
var inputSchema18 = {
|
|
11813
|
+
id: z18.string().min(1, "id is required").describe("The Vectros folder id to update."),
|
|
11814
|
+
name: z18.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
11815
|
+
description: z18.string().optional().describe("New description. Omit to leave unchanged."),
|
|
11816
|
+
userId: z18.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11817
|
+
scopes: z18.array(z18.string()).optional().describe(
|
|
10732
11818
|
'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).'
|
|
10733
11819
|
),
|
|
10734
|
-
expectedVersion:
|
|
11820
|
+
expectedVersion: z18.number().int().optional().describe(
|
|
10735
11821
|
"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."
|
|
10736
11822
|
)
|
|
10737
11823
|
};
|
|
@@ -10739,7 +11825,7 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10739
11825
|
name: "folder_update",
|
|
10740
11826
|
title: "Update a folder",
|
|
10741
11827
|
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.",
|
|
10742
|
-
inputSchema:
|
|
11828
|
+
inputSchema: inputSchema18,
|
|
10743
11829
|
handler: async (args) => {
|
|
10744
11830
|
const id = args.id;
|
|
10745
11831
|
const name = args.name;
|
|
@@ -10766,15 +11852,15 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10766
11852
|
var folder_update_default = folderUpdate;
|
|
10767
11853
|
|
|
10768
11854
|
// src/tools/folder_delete.ts
|
|
10769
|
-
import { z as
|
|
10770
|
-
var
|
|
10771
|
-
id:
|
|
11855
|
+
import { z as z19 } from "zod";
|
|
11856
|
+
var inputSchema19 = {
|
|
11857
|
+
id: z19.string().min(1, "id is required").describe("The Vectros folder id to delete.")
|
|
10772
11858
|
};
|
|
10773
11859
|
var folderDelete = ({ client, log }) => ({
|
|
10774
11860
|
name: "folder_delete",
|
|
10775
11861
|
title: "Delete a folder",
|
|
10776
|
-
description:
|
|
10777
|
-
inputSchema:
|
|
11862
|
+
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.',
|
|
11863
|
+
inputSchema: inputSchema19,
|
|
10778
11864
|
handler: async (args) => {
|
|
10779
11865
|
const id = args.id;
|
|
10780
11866
|
try {
|
|
@@ -10790,14 +11876,14 @@ var folderDelete = ({ client, log }) => ({
|
|
|
10790
11876
|
var folder_delete_default = folderDelete;
|
|
10791
11877
|
|
|
10792
11878
|
// src/tools/current_identity.ts
|
|
10793
|
-
var
|
|
11879
|
+
var inputSchema20 = {
|
|
10794
11880
|
// No args — current_identity describes the current credential.
|
|
10795
11881
|
};
|
|
10796
11882
|
var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
10797
11883
|
name: "current_identity",
|
|
10798
11884
|
title: "Current identity (tenant + principal scope)",
|
|
10799
|
-
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
|
|
10800
|
-
inputSchema:
|
|
11885
|
+
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.",
|
|
11886
|
+
inputSchema: inputSchema20,
|
|
10801
11887
|
handler: async () => {
|
|
10802
11888
|
try {
|
|
10803
11889
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -10813,7 +11899,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
|
10813
11899
|
var current_identity_default = currentIdentity;
|
|
10814
11900
|
|
|
10815
11901
|
// src/tools/document_ingest.ts
|
|
10816
|
-
import { z as
|
|
11902
|
+
import { z as z20 } from "zod";
|
|
10817
11903
|
import { readFile, realpath } from "fs/promises";
|
|
10818
11904
|
import { basename, extname, resolve, relative, isAbsolute } from "path";
|
|
10819
11905
|
var IngestPathError = class extends Error {
|
|
@@ -10888,37 +11974,37 @@ function inferMimeType(filePath) {
|
|
|
10888
11974
|
const ext = extname(filePath).toLowerCase();
|
|
10889
11975
|
return EXT_TO_MIME[ext] ?? "application/octet-stream";
|
|
10890
11976
|
}
|
|
10891
|
-
var
|
|
10892
|
-
title:
|
|
10893
|
-
indexMode:
|
|
11977
|
+
var inputSchema21 = {
|
|
11978
|
+
title: z20.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
|
|
11979
|
+
indexMode: z20.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
10894
11980
|
"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."
|
|
10895
11981
|
),
|
|
10896
|
-
externalId:
|
|
11982
|
+
externalId: z20.string().optional().describe(
|
|
10897
11983
|
'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.'
|
|
10898
11984
|
),
|
|
10899
|
-
upsert:
|
|
11985
|
+
upsert: z20.boolean().optional().describe(
|
|
10900
11986
|
"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)."
|
|
10901
11987
|
),
|
|
10902
|
-
schemaId:
|
|
11988
|
+
schemaId: z20.string().optional().describe(
|
|
10903
11989
|
"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."
|
|
10904
11990
|
),
|
|
10905
|
-
payload:
|
|
11991
|
+
payload: z20.record(z20.string(), z20.unknown()).optional().describe(
|
|
10906
11992
|
"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."
|
|
10907
11993
|
),
|
|
10908
11994
|
// Inline text mode (mutually exclusive with filePath):
|
|
10909
|
-
text:
|
|
10910
|
-
storeText:
|
|
11995
|
+
text: z20.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
|
|
11996
|
+
storeText: z20.boolean().optional().describe(
|
|
10911
11997
|
"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."
|
|
10912
11998
|
),
|
|
10913
11999
|
// File upload mode (mutually exclusive with text; stdio-transport-only):
|
|
10914
|
-
filePath:
|
|
12000
|
+
filePath: z20.string().min(1).optional().describe(
|
|
10915
12001
|
"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."
|
|
10916
12002
|
),
|
|
10917
|
-
fileType:
|
|
12003
|
+
fileType: z20.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
|
|
10918
12004
|
// Common (both modes):
|
|
10919
|
-
folderId:
|
|
10920
|
-
userId:
|
|
10921
|
-
scopes:
|
|
12005
|
+
folderId: z20.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
12006
|
+
userId: z20.string().optional().describe("Owning user ID. Optional."),
|
|
12007
|
+
scopes: z20.array(z20.string()).optional().describe(
|
|
10922
12008
|
"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."
|
|
10923
12009
|
)
|
|
10924
12010
|
};
|
|
@@ -10926,7 +12012,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10926
12012
|
name: "document_ingest",
|
|
10927
12013
|
title: "Ingest a new document (text body or file upload)",
|
|
10928
12014
|
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`.",
|
|
10929
|
-
inputSchema:
|
|
12015
|
+
inputSchema: inputSchema21,
|
|
10930
12016
|
handler: async (args) => {
|
|
10931
12017
|
const title = args.title;
|
|
10932
12018
|
const text = args.text;
|
|
@@ -11078,29 +12164,29 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11078
12164
|
var document_ingest_default = documentIngest;
|
|
11079
12165
|
|
|
11080
12166
|
// src/tools/lookup_principal.ts
|
|
11081
|
-
import { z as
|
|
12167
|
+
import { z as z21 } from "zod";
|
|
11082
12168
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
11083
12169
|
var MCP_MAX_LIMIT5 = 100;
|
|
11084
|
-
var
|
|
11085
|
-
kind:
|
|
12170
|
+
var inputSchema22 = {
|
|
12171
|
+
kind: z21.string().describe(
|
|
11086
12172
|
'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.'
|
|
11087
12173
|
),
|
|
11088
|
-
externalId:
|
|
12174
|
+
externalId: z21.string().optional().describe(
|
|
11089
12175
|
"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."
|
|
11090
12176
|
),
|
|
11091
|
-
contextId:
|
|
12177
|
+
contextId: z21.string().optional().describe(
|
|
11092
12178
|
"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."
|
|
11093
12179
|
),
|
|
11094
12180
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
11095
|
-
type:
|
|
11096
|
-
field:
|
|
11097
|
-
value:
|
|
11098
|
-
from:
|
|
11099
|
-
to:
|
|
11100
|
-
prefix:
|
|
11101
|
-
order:
|
|
11102
|
-
startFrom:
|
|
11103
|
-
limit:
|
|
12181
|
+
type: z21.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
|
|
12182
|
+
field: z21.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
|
|
12183
|
+
value: z21.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
|
|
12184
|
+
from: z21.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
|
|
12185
|
+
to: z21.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
12186
|
+
prefix: z21.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
12187
|
+
order: z21.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
|
|
12188
|
+
startFrom: z21.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
12189
|
+
limit: z21.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
|
|
11104
12190
|
`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\`.`
|
|
11105
12191
|
)
|
|
11106
12192
|
};
|
|
@@ -11108,7 +12194,7 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11108
12194
|
name: "lookup_principal",
|
|
11109
12195
|
title: "Look up a user identity or a namespaced identity entity",
|
|
11110
12196
|
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.",
|
|
11111
|
-
inputSchema:
|
|
12197
|
+
inputSchema: inputSchema22,
|
|
11112
12198
|
handler: async (args) => {
|
|
11113
12199
|
const kind = args.kind;
|
|
11114
12200
|
const isUser = kind === "user";
|
|
@@ -11182,17 +12268,17 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11182
12268
|
var lookup_principal_default = lookupPrincipal;
|
|
11183
12269
|
|
|
11184
12270
|
// src/tools/version_history.ts
|
|
11185
|
-
import { z as
|
|
11186
|
-
var
|
|
11187
|
-
resourceType:
|
|
11188
|
-
id:
|
|
11189
|
-
startFrom:
|
|
12271
|
+
import { z as z22 } from "zod";
|
|
12272
|
+
var inputSchema23 = {
|
|
12273
|
+
resourceType: z22.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
|
|
12274
|
+
id: z22.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
|
|
12275
|
+
startFrom: z22.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
|
|
11190
12276
|
};
|
|
11191
12277
|
var versionHistory = ({ client, log }) => ({
|
|
11192
12278
|
name: "version_history",
|
|
11193
12279
|
title: "Version history (record or document)",
|
|
11194
12280
|
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.",
|
|
11195
|
-
inputSchema:
|
|
12281
|
+
inputSchema: inputSchema23,
|
|
11196
12282
|
handler: async (args) => {
|
|
11197
12283
|
const resourceType = args.resourceType;
|
|
11198
12284
|
const id = args.id;
|
|
@@ -11221,6 +12307,7 @@ var TOOL_NAMES = [
|
|
|
11221
12307
|
"record_get",
|
|
11222
12308
|
"record_batch_get",
|
|
11223
12309
|
"record_create",
|
|
12310
|
+
"record_batch_write",
|
|
11224
12311
|
"record_update",
|
|
11225
12312
|
"record_delete",
|
|
11226
12313
|
"rag_ask",
|
|
@@ -11247,6 +12334,7 @@ var ALL_TOOL_FACTORIES = {
|
|
|
11247
12334
|
record_get: record_get_default,
|
|
11248
12335
|
record_batch_get: record_batch_get_default,
|
|
11249
12336
|
record_create: record_create_default,
|
|
12337
|
+
record_batch_write: record_batch_write_default,
|
|
11250
12338
|
record_update: record_update_default,
|
|
11251
12339
|
record_delete: record_delete_default,
|
|
11252
12340
|
rag_ask: rag_ask_default,
|
|
@@ -11287,7 +12375,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
|
|
|
11287
12375
|
name: "identity",
|
|
11288
12376
|
uri: "vectros://identity",
|
|
11289
12377
|
title: "Current identity (tenant + principal scope)",
|
|
11290
|
-
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
|
|
12378
|
+
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.",
|
|
11291
12379
|
mimeType: "application/json",
|
|
11292
12380
|
read: async () => {
|
|
11293
12381
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -11306,7 +12394,7 @@ var ALL_RESOURCE_FACTORIES = {
|
|
|
11306
12394
|
};
|
|
11307
12395
|
|
|
11308
12396
|
// src/zod-to-json-schema.ts
|
|
11309
|
-
import { z as
|
|
12397
|
+
import { z as z23 } from "zod";
|
|
11310
12398
|
function zodShapeToJsonSchema(shape) {
|
|
11311
12399
|
const properties = {};
|
|
11312
12400
|
const required = [];
|
|
@@ -11321,40 +12409,40 @@ function zodShapeToJsonSchema(shape) {
|
|
|
11321
12409
|
function zodTypeToJsonSchema(schema) {
|
|
11322
12410
|
const description = schema.description;
|
|
11323
12411
|
let current = schema;
|
|
11324
|
-
while (current instanceof
|
|
12412
|
+
while (current instanceof z23.ZodOptional || current instanceof z23.ZodDefault || current instanceof z23.ZodNullable) {
|
|
11325
12413
|
current = current._def.innerType;
|
|
11326
12414
|
}
|
|
11327
12415
|
const base = description ? { description } : {};
|
|
11328
|
-
if (current instanceof
|
|
12416
|
+
if (current instanceof z23.ZodString) {
|
|
11329
12417
|
return { ...base, type: "string" };
|
|
11330
12418
|
}
|
|
11331
|
-
if (current instanceof
|
|
12419
|
+
if (current instanceof z23.ZodNumber) {
|
|
11332
12420
|
return { ...base, type: "number" };
|
|
11333
12421
|
}
|
|
11334
|
-
if (current instanceof
|
|
12422
|
+
if (current instanceof z23.ZodBoolean) {
|
|
11335
12423
|
return { ...base, type: "boolean" };
|
|
11336
12424
|
}
|
|
11337
|
-
if (current instanceof
|
|
12425
|
+
if (current instanceof z23.ZodEnum) {
|
|
11338
12426
|
return {
|
|
11339
12427
|
...base,
|
|
11340
12428
|
type: "string",
|
|
11341
12429
|
enum: current.options
|
|
11342
12430
|
};
|
|
11343
12431
|
}
|
|
11344
|
-
if (current instanceof
|
|
12432
|
+
if (current instanceof z23.ZodArray) {
|
|
11345
12433
|
return {
|
|
11346
12434
|
...base,
|
|
11347
12435
|
type: "array",
|
|
11348
12436
|
items: zodTypeToJsonSchema(current.element)
|
|
11349
12437
|
};
|
|
11350
12438
|
}
|
|
11351
|
-
if (current instanceof
|
|
12439
|
+
if (current instanceof z23.ZodObject) {
|
|
11352
12440
|
return {
|
|
11353
12441
|
...base,
|
|
11354
12442
|
...zodShapeToJsonSchema(current.shape)
|
|
11355
12443
|
};
|
|
11356
12444
|
}
|
|
11357
|
-
if (current instanceof
|
|
12445
|
+
if (current instanceof z23.ZodRecord) {
|
|
11358
12446
|
const valueType = current._def.valueType;
|
|
11359
12447
|
return {
|
|
11360
12448
|
...base,
|
|
@@ -11478,7 +12566,7 @@ var VectrosMCPServer = class {
|
|
|
11478
12566
|
if (!tool) {
|
|
11479
12567
|
result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
|
|
11480
12568
|
} else {
|
|
11481
|
-
const parsed =
|
|
12569
|
+
const parsed = z24.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
|
|
11482
12570
|
if (!parsed.success) {
|
|
11483
12571
|
result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
|
|
11484
12572
|
} else {
|