@vectros-ai/mcp-server 0.16.1 → 0.17.1
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 +240 -0
- package/README.md +116 -16
- package/dist/cli-http.js +1526 -317
- package/dist/cli-http.js.map +1 -1
- package/dist/cli-http.mjs +1526 -317
- package/dist/cli-http.mjs.map +1 -1
- package/dist/cli.js +1533 -325
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1533 -325
- 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 +1512 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1512 -310
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -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.
|
|
@@ -3323,6 +3400,7 @@ var AuthClient = class {
|
|
|
3323
3400
|
*
|
|
3324
3401
|
* @throws {@link Vectros.ForbiddenError}
|
|
3325
3402
|
* @throws {@link Vectros.NotFoundError}
|
|
3403
|
+
* @throws {@link Vectros.ConflictError}
|
|
3326
3404
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
3327
3405
|
*
|
|
3328
3406
|
* @example
|
|
@@ -3365,6 +3443,8 @@ var AuthClient = class {
|
|
|
3365
3443
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3366
3444
|
case 404:
|
|
3367
3445
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
3446
|
+
case 409:
|
|
3447
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
3368
3448
|
case 429:
|
|
3369
3449
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
3370
3450
|
default:
|
|
@@ -3441,7 +3521,7 @@ var AuthClient = class {
|
|
|
3441
3521
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts/{contextId}");
|
|
3442
3522
|
}
|
|
3443
3523
|
/**
|
|
3444
|
-
* Updates the name and/or
|
|
3524
|
+
* 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
3525
|
*
|
|
3446
3526
|
* @param {Vectros.UpdateAppContextRequest} request
|
|
3447
3527
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3509,7 +3589,7 @@ var AuthClient = class {
|
|
|
3509
3589
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/app-contexts/{contextId}");
|
|
3510
3590
|
}
|
|
3511
3591
|
/**
|
|
3512
|
-
* Permanently deletes an app context and everything in it — every record, document, folder, schema, role,
|
|
3592
|
+
* Permanently deletes an app context and everything in it — every record, document, folder, schema, role, access profile, and trusted-issuer registration belonging to the context. This is irreversible. The deletion runs asynchronously: the call returns 202 immediately and the context's data drains in the background. Poll the context's `status` field to observe when the teardown completes (`purging` while draining, then `deleted`). To guard against accidental deletion, you must echo the contextId back in the `confirm` query parameter (`?confirm={contextId}`). The reserved `default` and `vectros-admin` contexts cannot be deleted. This operation requires a root API key (one beginning with `sk_`): no scoped credential, not even one with full wildcard (`*`) scope, can trigger this teardown.
|
|
3513
3593
|
*
|
|
3514
3594
|
* @param {Vectros.DeleteAppContextRequest} request
|
|
3515
3595
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3923,7 +4003,7 @@ var AuthClient = class {
|
|
|
3923
4003
|
);
|
|
3924
4004
|
}
|
|
3925
4005
|
/**
|
|
3926
|
-
* Returns full usage detail for the requested calendar month, broken down by category (search, documents, and
|
|
4006
|
+
* 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
4007
|
*
|
|
3928
4008
|
* @param {Vectros.GetUsageRequest} request
|
|
3929
4009
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4044,7 +4124,7 @@ var AuthClient = class {
|
|
|
4044
4124
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
|
|
4045
4125
|
}
|
|
4046
4126
|
/**
|
|
4047
|
-
* Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `status` (`active`/`suspended` — a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
|
|
4127
|
+
* Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `userinfoUri`, `capturedClaims`, `restrictedToDomain` (a new non-blank value must already be a VERIFIED domain for your account; an empty string clears it back to domain-less; see `IssuerUpdateRequest.restrictedToDomain` for the full semantics), `status` (`active`/`suspended` — a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. **`subClaim` is identity-determining, not merely cosmetic**: it names which verified JWT claim is read as the federated user's identifier, so changing it on an issuer that already has bound users would silently re-identify (or, under self-signup, orphan) every one of them — changing it is therefore refused once any user has bound through this issuer, the same guard `DELETE` already applies, and is only free before the first real login. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
|
|
4048
4128
|
*
|
|
4049
4129
|
* @param {Vectros.IssuerUpdateRequest} request
|
|
4050
4130
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4111,7 +4191,7 @@ var AuthClient = class {
|
|
|
4111
4191
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/auth/issuers/{issuerId}");
|
|
4112
4192
|
}
|
|
4113
4193
|
/**
|
|
4114
|
-
* Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned.
|
|
4194
|
+
* Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned. This is unconditional on the affected users' `status`: suspending them first does not lift the refusal. **A bound registration cannot be replaced, self-service, within its own app context**: registering a replacement issuer under a different issuerId in the SAME context also fails, because the context's one-active-issuer claim is released only when THIS registration is deleted. Two real options: suspend this issuer (stops new exchanges immediately) and register a replacement under a DIFFERENT app context — note that targets a different context, so this context's existing users/roles/access profiles are not carried over; or contact your platform operator, who can force-release this registration so a replacement may be registered in the SAME context under a new issuerId. **The operator path is not a lighter-weight alternative to the first — it PERMANENTLY RETIRES this issuerId and leaves every bound user unable to ever exchange through it again; it does not preserve continuity for them any better than registering under a different context does.** An issuer that has never been used for an exchange (no bound users yet) can always be deregistered.
|
|
4115
4195
|
*
|
|
4116
4196
|
* @param {Vectros.DeleteIssuerRequest} request
|
|
4117
4197
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4237,7 +4317,7 @@ var AuthClient = class {
|
|
|
4237
4317
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
|
|
4238
4318
|
}
|
|
4239
4319
|
/**
|
|
4240
|
-
* Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`.
|
|
4320
|
+
* Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`. Optionally name `restrictedToDomain` to scope this registration's (issuer, audience) uniqueness to a specific VERIFIED domain rather than the bare pair — see that field's own description for the full contract, including why it does NOT protect a shared/consumer-IdP registration with no company-domain population.
|
|
4241
4321
|
*
|
|
4242
4322
|
* @param {Vectros.IssuerRequest} request
|
|
4243
4323
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5735,7 +5815,7 @@ var DocumentsClient = class {
|
|
|
5735
5815
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents/{id}/versions");
|
|
5736
5816
|
}
|
|
5737
5817
|
/**
|
|
5738
|
-
* Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly to `uploadUrl`; the document is then automatically queued for text extraction and asynchronous indexing. Supplying an `externalId` makes this idempotent — re-initiating an upload with the same `externalId` re-issues a fresh presigned URL
|
|
5818
|
+
* Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly to `uploadUrl`; the document is then automatically queued for text extraction and asynchronous indexing. Supplying an `externalId` makes this idempotent — re-initiating an upload with the same `externalId` re-issues a fresh presigned URL for the SAME existing document, targeting a newly-staged object rather than the document's current one — your PUT lands there first, and the document only adopts it once the upload is validated (so a re-upload inherently replaces the file body) rather than creating a duplicate. The response's `created` field (and the HTTP status — 201 when a new document was minted, 200 when an existing one was matched) tells the two apart. With `?upsert=true`, the submitted `payload`/`title` are also applied to the matched document (file-body divergence cannot be diffed at upload-init — the bytes have not arrived yet — so the re-upload itself replaces the body). Creating a NEW document requires the `documents:c` scope. Re-uploading over an EXISTING document overwrites (and re-indexes) its body, so it is an update: it requires the `documents:u` scope (as does `?upsert=true` for the metadata). **Your PUT to `uploadUrl` MUST include the header named in the response's `requiredHeaderName`, set to `requiredHeaderValue` exactly.** It is a signed part of the presigned request — the PUT never reaches this service either way, so neither failure uses this API's JSON error shape. Omitting it, or sending a different value, invalidates the request's signature and S3 rejects it with a 403 `SignatureDoesNotMatch`. Sending it correctly makes the URL single-use: `requiredHeaderName` is always `If-None-Match` and `requiredHeaderValue` is always `*` — a create, a recovery upload for a document whose earlier file is missing, and a re-upload ALL target a freshly-minted, never-written key, so the same S3 conditional-write precondition applies uniformly (S3's own documented conditional-write behavior): a replay after the object already exists (from your own completed PUT, or anyone else's) fails with `412 Precondition Failed`; a replay after the object was deleted and never re-created finds an absent key again and can succeed — single-use is a property of the object's existence, not a one-time token. **Either precondition can also fail with `409 Conflict` if your PUT genuinely races a concurrent delete on the same object.** Whichever of `412` or `409` you receive, the remedy is the same: call this endpoint again for a fresh URL rather than retrying the same PUT — a fresh call always targets a new key, so it is never subject to whatever raced the previous one.
|
|
5739
5819
|
*
|
|
5740
5820
|
* @param {Vectros.FileUploadRequest} request
|
|
5741
5821
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6057,7 +6137,7 @@ var FoldersClient = class {
|
|
|
6057
6137
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/folders/{id}");
|
|
6058
6138
|
}
|
|
6059
6139
|
/**
|
|
6060
|
-
* Permanently deletes a folder. The folder must be empty
|
|
6140
|
+
* 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.
|
|
6061
6141
|
*
|
|
6062
6142
|
* @param {Vectros.DeleteFolderRequest} request
|
|
6063
6143
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6466,11 +6546,12 @@ var IdentityClient = class {
|
|
|
6466
6546
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6467
6547
|
}
|
|
6468
6548
|
/**
|
|
6469
|
-
* 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.
|
|
6549
|
+
* 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.
|
|
6470
6550
|
*
|
|
6471
6551
|
* @param {Vectros.UpdateEntityRequest} request
|
|
6472
6552
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6473
6553
|
*
|
|
6554
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6474
6555
|
* @throws {@link Vectros.NotFoundError}
|
|
6475
6556
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6476
6557
|
*
|
|
@@ -6520,6 +6601,8 @@ var IdentityClient = class {
|
|
|
6520
6601
|
}
|
|
6521
6602
|
if (_response.error.reason === "status-code") {
|
|
6522
6603
|
switch (_response.error.statusCode) {
|
|
6604
|
+
case 400:
|
|
6605
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6523
6606
|
case 404:
|
|
6524
6607
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6525
6608
|
case 429:
|
|
@@ -7498,7 +7581,7 @@ var IdentityClient = class {
|
|
|
7498
7581
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/exists-by-email");
|
|
7499
7582
|
}
|
|
7500
7583
|
/**
|
|
7501
|
-
* Returns the audit trail of changes to a user, most recent first. Identity history is always recorded
|
|
7584
|
+
* Returns the audit trail of changes to a user, most recent first, including after the user has been deleted. Identity history is always recorded. Post-delete, this is readable by an account-level (root) API key only — a context-confined credential 404s after the delete, the same response it would get for a nonexistent id. Sensitive field values are redacted in every historical version. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope.
|
|
7502
7585
|
*
|
|
7503
7586
|
* @param {Vectros.GetUserVersionsRequest} request
|
|
7504
7587
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -7744,7 +7827,7 @@ var InferenceClient = class {
|
|
|
7744
7827
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/documents/{id}/ask");
|
|
7745
7828
|
}
|
|
7746
7829
|
/**
|
|
7747
|
-
* 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
|
|
7830
|
+
* 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.
|
|
7748
7831
|
*/
|
|
7749
7832
|
ragInference(request, requestOptions) {
|
|
7750
7833
|
return HttpResponsePromise.fromPromise(this.__ragInference(request, requestOptions));
|
|
@@ -7939,14 +8022,18 @@ var RecordsClient = class {
|
|
|
7939
8022
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup/batch");
|
|
7940
8023
|
}
|
|
7941
8024
|
/**
|
|
7942
|
-
*
|
|
8025
|
+
* 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.
|
|
8026
|
+
*
|
|
8027
|
+
* `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.
|
|
8028
|
+
*
|
|
8029
|
+
* 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.
|
|
7943
8030
|
*
|
|
7944
8031
|
* @param {Vectros.BatchWriteRequest} request
|
|
7945
8032
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
7946
8033
|
*
|
|
8034
|
+
* @throws {@link Vectros.BadRequestError}
|
|
7947
8035
|
* @throws {@link Vectros.ForbiddenError}
|
|
7948
8036
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
7949
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
7950
8037
|
*
|
|
7951
8038
|
* @example
|
|
7952
8039
|
* await client.records.batchWriteRecords()
|
|
@@ -7955,6 +8042,11 @@ var RecordsClient = class {
|
|
|
7955
8042
|
return HttpResponsePromise.fromPromise(this.__batchWriteRecords(request, requestOptions));
|
|
7956
8043
|
}
|
|
7957
8044
|
async __batchWriteRecords(request = {}, requestOptions) {
|
|
8045
|
+
const { upsert, allowClear, ..._body } = request;
|
|
8046
|
+
const _queryParams = {
|
|
8047
|
+
upsert,
|
|
8048
|
+
allowClear
|
|
8049
|
+
};
|
|
7958
8050
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7959
8051
|
const _headers = mergeHeaders(
|
|
7960
8052
|
_authRequest.headers,
|
|
@@ -7969,9 +8061,9 @@ var RecordsClient = class {
|
|
|
7969
8061
|
method: "POST",
|
|
7970
8062
|
headers: _headers,
|
|
7971
8063
|
contentType: "application/json",
|
|
7972
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
8064
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
7973
8065
|
requestType: "json",
|
|
7974
|
-
body:
|
|
8066
|
+
body: _body,
|
|
7975
8067
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
7976
8068
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
7977
8069
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -7983,12 +8075,12 @@ var RecordsClient = class {
|
|
|
7983
8075
|
}
|
|
7984
8076
|
if (_response.error.reason === "status-code") {
|
|
7985
8077
|
switch (_response.error.statusCode) {
|
|
8078
|
+
case 400:
|
|
8079
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
7986
8080
|
case 403:
|
|
7987
8081
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
7988
8082
|
case 429:
|
|
7989
8083
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
7990
|
-
case 501:
|
|
7991
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
7992
8084
|
default:
|
|
7993
8085
|
throw new VectrosError({
|
|
7994
8086
|
statusCode: _response.error.statusCode,
|
|
@@ -8559,7 +8651,7 @@ var RecordsClient = class {
|
|
|
8559
8651
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup");
|
|
8560
8652
|
}
|
|
8561
8653
|
/**
|
|
8562
|
-
* Returns the tombstone left behind when a record was hard-deleted, confirming the deletion and recording when it happened. Look it up using the deleted record's original ID. Requires the `records:r:<type>` scope.
|
|
8654
|
+
* Returns the tombstone left behind when a record was hard-deleted, confirming the deletion and recording when it happened. Look it up using the deleted record's original ID. Requires the `records:r:<type>` scope, granted without a `data_scope` restriction: the owner of a deleted record cannot be checked, so a credential confined to an ownership compartment (e.g. `data_scope: {scope:org: [org_A]}`) cannot read tombstones, including for records it owned.
|
|
8563
8655
|
*
|
|
8564
8656
|
* @param {Vectros.GetRecordTombstoneRequest} request
|
|
8565
8657
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8891,7 +8983,7 @@ var SchemasClient = class {
|
|
|
8891
8983
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}");
|
|
8892
8984
|
}
|
|
8893
8985
|
/**
|
|
8894
|
-
* 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.
|
|
8986
|
+
* 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.
|
|
8895
8987
|
*
|
|
8896
8988
|
* @param {Vectros.UpdateSchemaRequest} request
|
|
8897
8989
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8899,6 +8991,7 @@ var SchemasClient = class {
|
|
|
8899
8991
|
* @throws {@link Vectros.BadRequestError}
|
|
8900
8992
|
* @throws {@link Vectros.ForbiddenError}
|
|
8901
8993
|
* @throws {@link Vectros.NotFoundError}
|
|
8994
|
+
* @throws {@link Vectros.ConflictError}
|
|
8902
8995
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
8903
8996
|
*
|
|
8904
8997
|
* @example
|
|
@@ -8950,6 +9043,8 @@ var SchemasClient = class {
|
|
|
8950
9043
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8951
9044
|
case 404:
|
|
8952
9045
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9046
|
+
case 409:
|
|
9047
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
8953
9048
|
case 429:
|
|
8954
9049
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8955
9050
|
default:
|
|
@@ -8963,7 +9058,7 @@ var SchemasClient = class {
|
|
|
8963
9058
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/schemas/{id}");
|
|
8964
9059
|
}
|
|
8965
9060
|
/**
|
|
8966
|
-
* 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.
|
|
9061
|
+
* 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. The same applies to documents bound to this schema (for a schema declaring the `document` surface) — delete those documents first. 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.
|
|
8967
9062
|
*
|
|
8968
9063
|
* @param {Vectros.DeleteSchemaRequest} request
|
|
8969
9064
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -9085,46 +9180,70 @@ var SchemasClient = class {
|
|
|
9085
9180
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}/versions");
|
|
9086
9181
|
}
|
|
9087
9182
|
};
|
|
9088
|
-
var
|
|
9183
|
+
var ScriptsClient = class {
|
|
9089
9184
|
constructor(options) {
|
|
9090
9185
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
9091
9186
|
}
|
|
9092
9187
|
/**
|
|
9093
|
-
* Runs a
|
|
9188
|
+
* 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.
|
|
9094
9189
|
*
|
|
9095
|
-
*
|
|
9096
|
-
*
|
|
9190
|
+
* **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.
|
|
9191
|
+
*
|
|
9192
|
+
* **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.
|
|
9193
|
+
*
|
|
9194
|
+
* **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`).
|
|
9195
|
+
*
|
|
9196
|
+
* **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 show a row it created — you hold that row's id from `create()`.
|
|
9197
|
+
*
|
|
9198
|
+
* **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.
|
|
9199
|
+
*
|
|
9200
|
+
* @param {Vectros.ScriptExecuteRequest} request
|
|
9201
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9097
9202
|
*
|
|
9098
9203
|
* @throws {@link Vectros.BadRequestError}
|
|
9204
|
+
* @throws {@link Vectros.PaymentRequiredError}
|
|
9099
9205
|
* @throws {@link Vectros.ForbiddenError}
|
|
9206
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9207
|
+
* @throws {@link Vectros.ConflictError}
|
|
9208
|
+
* @throws {@link Vectros.ContentTooLargeError}
|
|
9209
|
+
* @throws {@link Vectros.UnprocessableEntityError}
|
|
9100
9210
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
9211
|
+
* @throws {@link Vectros.InternalServerError}
|
|
9212
|
+
* @throws {@link Vectros.ServiceUnavailableError}
|
|
9213
|
+
* @throws {@link Vectros.GatewayTimeoutError}
|
|
9101
9214
|
*
|
|
9102
9215
|
* @example
|
|
9103
|
-
* await client.
|
|
9104
|
-
*
|
|
9216
|
+
* await client.scripts.executeScript({
|
|
9217
|
+
* "Idempotency-Key": "order-8412-attempt",
|
|
9218
|
+
* scriptRef: {
|
|
9219
|
+
* name: "notify-assignee",
|
|
9220
|
+
* version: "3"
|
|
9221
|
+
* }
|
|
9105
9222
|
* })
|
|
9106
9223
|
*/
|
|
9107
|
-
|
|
9108
|
-
return HttpResponsePromise.fromPromise(this.
|
|
9224
|
+
executeScript(request, requestOptions) {
|
|
9225
|
+
return HttpResponsePromise.fromPromise(this.__executeScript(request, requestOptions));
|
|
9109
9226
|
}
|
|
9110
|
-
async
|
|
9227
|
+
async __executeScript(request, requestOptions) {
|
|
9228
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
9111
9229
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9112
9230
|
const _headers = mergeHeaders(
|
|
9113
9231
|
_authRequest.headers,
|
|
9114
9232
|
this._options?.headers,
|
|
9233
|
+
mergeOnlyDefinedHeaders({ "Idempotency-Key": idempotencyKey }),
|
|
9115
9234
|
requestOptions?.headers
|
|
9116
9235
|
);
|
|
9117
9236
|
const _response = await fetcher({
|
|
9118
9237
|
url: url_exports.join(
|
|
9119
9238
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9120
|
-
"v1/
|
|
9239
|
+
"v1/scripts/execute"
|
|
9121
9240
|
),
|
|
9122
9241
|
method: "POST",
|
|
9123
9242
|
headers: _headers,
|
|
9124
9243
|
contentType: "application/json",
|
|
9125
9244
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9126
9245
|
requestType: "json",
|
|
9127
|
-
body:
|
|
9246
|
+
body: _body,
|
|
9128
9247
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9129
9248
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9130
9249
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -9138,10 +9257,26 @@ var SearchClient = class {
|
|
|
9138
9257
|
switch (_response.error.statusCode) {
|
|
9139
9258
|
case 400:
|
|
9140
9259
|
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9260
|
+
case 402:
|
|
9261
|
+
throw new PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
9141
9262
|
case 403:
|
|
9142
9263
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9264
|
+
case 404:
|
|
9265
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9266
|
+
case 409:
|
|
9267
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9268
|
+
case 413:
|
|
9269
|
+
throw new ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
9270
|
+
case 422:
|
|
9271
|
+
throw new UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
9143
9272
|
case 429:
|
|
9144
9273
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9274
|
+
case 500:
|
|
9275
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
9276
|
+
case 503:
|
|
9277
|
+
throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
9278
|
+
case 504:
|
|
9279
|
+
throw new GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
9145
9280
|
default:
|
|
9146
9281
|
throw new VectrosError({
|
|
9147
9282
|
statusCode: _response.error.statusCode,
|
|
@@ -9150,101 +9285,879 @@ var SearchClient = class {
|
|
|
9150
9285
|
});
|
|
9151
9286
|
}
|
|
9152
9287
|
}
|
|
9153
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
9154
|
-
}
|
|
9155
|
-
};
|
|
9156
|
-
var VectrosClient = class {
|
|
9157
|
-
constructor(options) {
|
|
9158
|
-
this._options = normalizeClientOptionsWithAuth(options);
|
|
9159
|
-
}
|
|
9160
|
-
get auth() {
|
|
9161
|
-
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
9162
|
-
}
|
|
9163
|
-
get documents() {
|
|
9164
|
-
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
9165
|
-
}
|
|
9166
|
-
get identity() {
|
|
9167
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
9168
|
-
}
|
|
9169
|
-
get compliance() {
|
|
9170
|
-
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
9171
|
-
}
|
|
9172
|
-
get folders() {
|
|
9173
|
-
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
9174
|
-
}
|
|
9175
|
-
get inference() {
|
|
9176
|
-
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
9177
|
-
}
|
|
9178
|
-
get records() {
|
|
9179
|
-
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
9180
|
-
}
|
|
9181
|
-
get schemas() {
|
|
9182
|
-
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
9183
|
-
}
|
|
9184
|
-
get search() {
|
|
9185
|
-
return this._search ?? (this._search = new SearchClient(this._options));
|
|
9288
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts/execute");
|
|
9186
9289
|
}
|
|
9187
9290
|
/**
|
|
9188
|
-
*
|
|
9189
|
-
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
9190
|
-
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
9291
|
+
* 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. **Each row's `source` is omitted by default** (`sourceOmitted: true`) — scripts are immutable per version, so a name's version history can otherwise carry every version's complete source in one response. Pass `?includeSource=true` to get it back inline, or fetch one version's full source with a by-id GET. **`?name=<n>&latest=true`** answers "what is the current version of this name" in one bounded call — a single `ScriptResponse` object (not a page), instead of draining every page of the name's version history to find the newest yourself.
|
|
9191
9292
|
*
|
|
9192
|
-
* @param {
|
|
9193
|
-
* @param {
|
|
9194
|
-
*
|
|
9195
|
-
* @
|
|
9293
|
+
* @param {Vectros.ListScriptsRequest} request
|
|
9294
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9295
|
+
*
|
|
9296
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9297
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9298
|
+
*
|
|
9299
|
+
* @example
|
|
9300
|
+
* await client.scripts.listScripts({
|
|
9301
|
+
* name: "notify-assignee",
|
|
9302
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9303
|
+
* })
|
|
9196
9304
|
*/
|
|
9197
|
-
|
|
9198
|
-
return
|
|
9199
|
-
input,
|
|
9200
|
-
init,
|
|
9201
|
-
{
|
|
9202
|
-
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
9203
|
-
headers: this._options.headers,
|
|
9204
|
-
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
9205
|
-
maxRetries: this._options.maxRetries,
|
|
9206
|
-
fetch: this._options.fetch,
|
|
9207
|
-
logging: this._options.logging,
|
|
9208
|
-
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
9209
|
-
},
|
|
9210
|
-
requestOptions
|
|
9211
|
-
);
|
|
9212
|
-
}
|
|
9213
|
-
};
|
|
9214
|
-
var logging;
|
|
9215
|
-
((logging2) => {
|
|
9216
|
-
logging2.LogLevel = LogLevel;
|
|
9217
|
-
logging2.ConsoleLogger = ConsoleLogger;
|
|
9218
|
-
})(logging || (logging = {}));
|
|
9219
|
-
|
|
9220
|
-
// src/server.ts
|
|
9221
|
-
import {
|
|
9222
|
-
CallToolRequestSchema,
|
|
9223
|
-
ListResourcesRequestSchema,
|
|
9224
|
-
ListToolsRequestSchema,
|
|
9225
|
-
ReadResourceRequestSchema
|
|
9226
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
9227
|
-
import { z as z23 } from "zod";
|
|
9228
|
-
|
|
9229
|
-
// src/auth.ts
|
|
9230
|
-
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
9231
|
-
var InvalidApiKeyError = class extends Error {
|
|
9232
|
-
constructor(reason) {
|
|
9233
|
-
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
9234
|
-
this.name = "InvalidApiKeyError";
|
|
9305
|
+
listScripts(request = {}, requestOptions) {
|
|
9306
|
+
return HttpResponsePromise.fromPromise(this.__listScripts(request, requestOptions));
|
|
9235
9307
|
}
|
|
9236
|
-
}
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9308
|
+
async __listScripts(request = {}, requestOptions) {
|
|
9309
|
+
const { name, startFrom, limit, includeSource, latest } = request;
|
|
9310
|
+
const _queryParams = {
|
|
9311
|
+
name,
|
|
9312
|
+
startFrom,
|
|
9313
|
+
limit,
|
|
9314
|
+
includeSource,
|
|
9315
|
+
latest
|
|
9316
|
+
};
|
|
9317
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9318
|
+
const _headers = mergeHeaders(
|
|
9319
|
+
_authRequest.headers,
|
|
9320
|
+
this._options?.headers,
|
|
9321
|
+
requestOptions?.headers
|
|
9241
9322
|
);
|
|
9323
|
+
const _response = await fetcher({
|
|
9324
|
+
url: url_exports.join(
|
|
9325
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9326
|
+
"v1/scripts"
|
|
9327
|
+
),
|
|
9328
|
+
method: "GET",
|
|
9329
|
+
headers: _headers,
|
|
9330
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9331
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9332
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9333
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9334
|
+
fetchFn: this._options?.fetch,
|
|
9335
|
+
logging: this._options.logging
|
|
9336
|
+
});
|
|
9337
|
+
if (_response.ok) {
|
|
9338
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9339
|
+
}
|
|
9340
|
+
if (_response.error.reason === "status-code") {
|
|
9341
|
+
switch (_response.error.statusCode) {
|
|
9342
|
+
case 400:
|
|
9343
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9344
|
+
case 404:
|
|
9345
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9346
|
+
default:
|
|
9347
|
+
throw new VectrosError({
|
|
9348
|
+
statusCode: _response.error.statusCode,
|
|
9349
|
+
body: _response.error.body,
|
|
9350
|
+
rawResponse: _response.rawResponse
|
|
9351
|
+
});
|
|
9352
|
+
}
|
|
9353
|
+
}
|
|
9354
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts");
|
|
9242
9355
|
}
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9356
|
+
/**
|
|
9357
|
+
* 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. `provisionedBy` MAY BE SET ON ABSENT, NEVER CHANGED, evaluated against the CURRENT LATEST version of this `name` at push time: if the latest version has no marker recorded, this push may set any value; if the latest version already has one, an omitted value inherits it forward and a DIFFERENT value is refused — a live comparison against whichever version is newest at push time, not a value fixed for the name's whole history. Pushing onto an EXISTING name with no `provisionedBy` recorded on its current latest version additionally requires that you were the caller who pushed that latest version — a name carrying a `provisionedBy` marker is exempt from this check (proving you can supply or inherit the matching marker is itself the ownership proof there). Requires the `scripts:c` scope.
|
|
9358
|
+
*
|
|
9359
|
+
* @param {Vectros.ScriptRequest} request
|
|
9360
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9361
|
+
*
|
|
9362
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9363
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9364
|
+
* @throws {@link Vectros.ConflictError}
|
|
9365
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9366
|
+
*
|
|
9367
|
+
* @example
|
|
9368
|
+
* await client.scripts.createScript({
|
|
9369
|
+
* name: "notify-assignee",
|
|
9370
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9371
|
+
* })
|
|
9372
|
+
*/
|
|
9373
|
+
createScript(request, requestOptions) {
|
|
9374
|
+
return HttpResponsePromise.fromPromise(this.__createScript(request, requestOptions));
|
|
9375
|
+
}
|
|
9376
|
+
async __createScript(request, requestOptions) {
|
|
9377
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9378
|
+
const _headers = mergeHeaders(
|
|
9379
|
+
_authRequest.headers,
|
|
9380
|
+
this._options?.headers,
|
|
9381
|
+
requestOptions?.headers
|
|
9382
|
+
);
|
|
9383
|
+
const _response = await fetcher({
|
|
9384
|
+
url: url_exports.join(
|
|
9385
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9386
|
+
"v1/scripts"
|
|
9387
|
+
),
|
|
9388
|
+
method: "POST",
|
|
9389
|
+
headers: _headers,
|
|
9390
|
+
contentType: "application/json",
|
|
9391
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9392
|
+
requestType: "json",
|
|
9393
|
+
body: request,
|
|
9394
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9395
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9396
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9397
|
+
fetchFn: this._options?.fetch,
|
|
9398
|
+
logging: this._options.logging
|
|
9399
|
+
});
|
|
9400
|
+
if (_response.ok) {
|
|
9401
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9402
|
+
}
|
|
9403
|
+
if (_response.error.reason === "status-code") {
|
|
9404
|
+
switch (_response.error.statusCode) {
|
|
9405
|
+
case 400:
|
|
9406
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9407
|
+
case 403:
|
|
9408
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9409
|
+
case 409:
|
|
9410
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9411
|
+
case 429:
|
|
9412
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9413
|
+
default:
|
|
9414
|
+
throw new VectrosError({
|
|
9415
|
+
statusCode: _response.error.statusCode,
|
|
9416
|
+
body: _response.error.body,
|
|
9417
|
+
rawResponse: _response.rawResponse
|
|
9418
|
+
});
|
|
9419
|
+
}
|
|
9420
|
+
}
|
|
9421
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts");
|
|
9422
|
+
}
|
|
9423
|
+
/**
|
|
9424
|
+
* Retrieves a single script version by its ID. Requires the `scripts:r` scope.
|
|
9425
|
+
*
|
|
9426
|
+
* @param {Vectros.GetScriptRequest} request
|
|
9427
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9428
|
+
*
|
|
9429
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9430
|
+
*
|
|
9431
|
+
* @example
|
|
9432
|
+
* await client.scripts.getScript({
|
|
9433
|
+
* id: "id"
|
|
9434
|
+
* })
|
|
9435
|
+
*/
|
|
9436
|
+
getScript(request, requestOptions) {
|
|
9437
|
+
return HttpResponsePromise.fromPromise(this.__getScript(request, requestOptions));
|
|
9438
|
+
}
|
|
9439
|
+
async __getScript(request, requestOptions) {
|
|
9440
|
+
const { id } = request;
|
|
9441
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9442
|
+
const _headers = mergeHeaders(
|
|
9443
|
+
_authRequest.headers,
|
|
9444
|
+
this._options?.headers,
|
|
9445
|
+
requestOptions?.headers
|
|
9446
|
+
);
|
|
9447
|
+
const _response = await fetcher({
|
|
9448
|
+
url: url_exports.join(
|
|
9449
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9450
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9451
|
+
),
|
|
9452
|
+
method: "GET",
|
|
9453
|
+
headers: _headers,
|
|
9454
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9455
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9456
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9457
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9458
|
+
fetchFn: this._options?.fetch,
|
|
9459
|
+
logging: this._options.logging
|
|
9460
|
+
});
|
|
9461
|
+
if (_response.ok) {
|
|
9462
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9463
|
+
}
|
|
9464
|
+
if (_response.error.reason === "status-code") {
|
|
9465
|
+
switch (_response.error.statusCode) {
|
|
9466
|
+
case 404:
|
|
9467
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9468
|
+
default:
|
|
9469
|
+
throw new VectrosError({
|
|
9470
|
+
statusCode: _response.error.statusCode,
|
|
9471
|
+
body: _response.error.body,
|
|
9472
|
+
rawResponse: _response.rawResponse
|
|
9473
|
+
});
|
|
9474
|
+
}
|
|
9475
|
+
}
|
|
9476
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts/{id}");
|
|
9477
|
+
}
|
|
9478
|
+
/**
|
|
9479
|
+
* 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.
|
|
9480
|
+
*
|
|
9481
|
+
* @param {Vectros.UpdateScriptRequest} request
|
|
9482
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9483
|
+
*
|
|
9484
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9485
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9486
|
+
*
|
|
9487
|
+
* @example
|
|
9488
|
+
* await client.scripts.updateScript({
|
|
9489
|
+
* id: "id",
|
|
9490
|
+
* body: {
|
|
9491
|
+
* name: "notify-assignee",
|
|
9492
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9493
|
+
* }
|
|
9494
|
+
* })
|
|
9495
|
+
*/
|
|
9496
|
+
updateScript(request, requestOptions) {
|
|
9497
|
+
return HttpResponsePromise.fromPromise(this.__updateScript(request, requestOptions));
|
|
9498
|
+
}
|
|
9499
|
+
async __updateScript(request, requestOptions) {
|
|
9500
|
+
const { id, body: _body } = request;
|
|
9501
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9502
|
+
const _headers = mergeHeaders(
|
|
9503
|
+
_authRequest.headers,
|
|
9504
|
+
this._options?.headers,
|
|
9505
|
+
requestOptions?.headers
|
|
9506
|
+
);
|
|
9507
|
+
const _response = await fetcher({
|
|
9508
|
+
url: url_exports.join(
|
|
9509
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9510
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9511
|
+
),
|
|
9512
|
+
method: "PUT",
|
|
9513
|
+
headers: _headers,
|
|
9514
|
+
contentType: "application/json",
|
|
9515
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9516
|
+
requestType: "json",
|
|
9517
|
+
body: _body,
|
|
9518
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9519
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9520
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9521
|
+
fetchFn: this._options?.fetch,
|
|
9522
|
+
logging: this._options.logging
|
|
9523
|
+
});
|
|
9524
|
+
if (_response.ok) {
|
|
9525
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9526
|
+
}
|
|
9527
|
+
if (_response.error.reason === "status-code") {
|
|
9528
|
+
switch (_response.error.statusCode) {
|
|
9529
|
+
case 400:
|
|
9530
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9531
|
+
case 429:
|
|
9532
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9533
|
+
default:
|
|
9534
|
+
throw new VectrosError({
|
|
9535
|
+
statusCode: _response.error.statusCode,
|
|
9536
|
+
body: _response.error.body,
|
|
9537
|
+
rawResponse: _response.rawResponse
|
|
9538
|
+
});
|
|
9539
|
+
}
|
|
9540
|
+
}
|
|
9541
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/scripts/{id}");
|
|
9542
|
+
}
|
|
9543
|
+
/**
|
|
9544
|
+
* 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. Refused with 409 if a live trigger rule still references this version — either directly (a pinned `scriptRef`), or via `"latest"` when this IS the newest version of its name. Delete or re-point those rules first.
|
|
9545
|
+
*
|
|
9546
|
+
* @param {Vectros.DeleteScriptRequest} request
|
|
9547
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9548
|
+
*
|
|
9549
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9550
|
+
* @throws {@link Vectros.ConflictError}
|
|
9551
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9552
|
+
*
|
|
9553
|
+
* @example
|
|
9554
|
+
* await client.scripts.deleteScript({
|
|
9555
|
+
* id: "id"
|
|
9556
|
+
* })
|
|
9557
|
+
*/
|
|
9558
|
+
deleteScript(request, requestOptions) {
|
|
9559
|
+
return HttpResponsePromise.fromPromise(this.__deleteScript(request, requestOptions));
|
|
9560
|
+
}
|
|
9561
|
+
async __deleteScript(request, requestOptions) {
|
|
9562
|
+
const { id } = request;
|
|
9563
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9564
|
+
const _headers = mergeHeaders(
|
|
9565
|
+
_authRequest.headers,
|
|
9566
|
+
this._options?.headers,
|
|
9567
|
+
requestOptions?.headers
|
|
9568
|
+
);
|
|
9569
|
+
const _response = await fetcher({
|
|
9570
|
+
url: url_exports.join(
|
|
9571
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9572
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9573
|
+
),
|
|
9574
|
+
method: "DELETE",
|
|
9575
|
+
headers: _headers,
|
|
9576
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9577
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9578
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9579
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9580
|
+
fetchFn: this._options?.fetch,
|
|
9581
|
+
logging: this._options.logging
|
|
9582
|
+
});
|
|
9583
|
+
if (_response.ok) {
|
|
9584
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9585
|
+
}
|
|
9586
|
+
if (_response.error.reason === "status-code") {
|
|
9587
|
+
switch (_response.error.statusCode) {
|
|
9588
|
+
case 404:
|
|
9589
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9590
|
+
case 409:
|
|
9591
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9592
|
+
case 429:
|
|
9593
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9594
|
+
default:
|
|
9595
|
+
throw new VectrosError({
|
|
9596
|
+
statusCode: _response.error.statusCode,
|
|
9597
|
+
body: _response.error.body,
|
|
9598
|
+
rawResponse: _response.rawResponse
|
|
9599
|
+
});
|
|
9600
|
+
}
|
|
9601
|
+
}
|
|
9602
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/scripts/{id}");
|
|
9603
|
+
}
|
|
9604
|
+
};
|
|
9605
|
+
var SearchClient = class {
|
|
9606
|
+
constructor(options) {
|
|
9607
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9608
|
+
}
|
|
9609
|
+
/**
|
|
9610
|
+
* 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.
|
|
9611
|
+
*
|
|
9612
|
+
* @param {Vectros.SearchRequest} request
|
|
9613
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9614
|
+
*
|
|
9615
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9616
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9617
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9618
|
+
*
|
|
9619
|
+
* @example
|
|
9620
|
+
* await client.search.content({
|
|
9621
|
+
* query: "patient intake form diabetes"
|
|
9622
|
+
* })
|
|
9623
|
+
*/
|
|
9624
|
+
content(request, requestOptions) {
|
|
9625
|
+
return HttpResponsePromise.fromPromise(this.__content(request, requestOptions));
|
|
9626
|
+
}
|
|
9627
|
+
async __content(request, requestOptions) {
|
|
9628
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9629
|
+
const _headers = mergeHeaders(
|
|
9630
|
+
_authRequest.headers,
|
|
9631
|
+
this._options?.headers,
|
|
9632
|
+
requestOptions?.headers
|
|
9633
|
+
);
|
|
9634
|
+
const _response = await fetcher({
|
|
9635
|
+
url: url_exports.join(
|
|
9636
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9637
|
+
"v1/search"
|
|
9638
|
+
),
|
|
9639
|
+
method: "POST",
|
|
9640
|
+
headers: _headers,
|
|
9641
|
+
contentType: "application/json",
|
|
9642
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9643
|
+
requestType: "json",
|
|
9644
|
+
body: request,
|
|
9645
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9646
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9647
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9648
|
+
fetchFn: this._options?.fetch,
|
|
9649
|
+
logging: this._options.logging
|
|
9650
|
+
});
|
|
9651
|
+
if (_response.ok) {
|
|
9652
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9653
|
+
}
|
|
9654
|
+
if (_response.error.reason === "status-code") {
|
|
9655
|
+
switch (_response.error.statusCode) {
|
|
9656
|
+
case 400:
|
|
9657
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9658
|
+
case 403:
|
|
9659
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9660
|
+
case 429:
|
|
9661
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9662
|
+
default:
|
|
9663
|
+
throw new VectrosError({
|
|
9664
|
+
statusCode: _response.error.statusCode,
|
|
9665
|
+
body: _response.error.body,
|
|
9666
|
+
rawResponse: _response.rawResponse
|
|
9667
|
+
});
|
|
9668
|
+
}
|
|
9669
|
+
}
|
|
9670
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/search");
|
|
9671
|
+
}
|
|
9672
|
+
};
|
|
9673
|
+
var TriggersClient = class {
|
|
9674
|
+
constructor(options) {
|
|
9675
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9676
|
+
}
|
|
9677
|
+
/**
|
|
9678
|
+
* 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.
|
|
9679
|
+
*
|
|
9680
|
+
* 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.
|
|
9681
|
+
*
|
|
9682
|
+
* `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.
|
|
9683
|
+
*
|
|
9684
|
+
* Scoped to your account and app context, derived from your token — never from input. Requires the `triggers:r` scope.
|
|
9685
|
+
*
|
|
9686
|
+
* @param {Vectros.ListTriggerFailuresRequest} request
|
|
9687
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9688
|
+
*
|
|
9689
|
+
* @example
|
|
9690
|
+
* await client.triggers.listTriggerFailures({
|
|
9691
|
+
* ruleId: "3b1c9f2e7a5d8410f6c2e9a1b7d4038f5e6a91c2d7f0b3a4586c9e2f1d0a7b3c",
|
|
9692
|
+
* category: "SCRIPT_ERROR",
|
|
9693
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9694
|
+
* })
|
|
9695
|
+
*/
|
|
9696
|
+
listTriggerFailures(request = {}, requestOptions) {
|
|
9697
|
+
return HttpResponsePromise.fromPromise(this.__listTriggerFailures(request, requestOptions));
|
|
9698
|
+
}
|
|
9699
|
+
async __listTriggerFailures(request = {}, requestOptions) {
|
|
9700
|
+
const { ruleId, category, retryable, from: from_, to, startFrom, limit } = request;
|
|
9701
|
+
const _queryParams = {
|
|
9702
|
+
ruleId,
|
|
9703
|
+
category,
|
|
9704
|
+
retryable,
|
|
9705
|
+
from: from_,
|
|
9706
|
+
to,
|
|
9707
|
+
startFrom,
|
|
9708
|
+
limit
|
|
9709
|
+
};
|
|
9710
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9711
|
+
const _headers = mergeHeaders(
|
|
9712
|
+
_authRequest.headers,
|
|
9713
|
+
this._options?.headers,
|
|
9714
|
+
requestOptions?.headers
|
|
9715
|
+
);
|
|
9716
|
+
const _response = await fetcher({
|
|
9717
|
+
url: url_exports.join(
|
|
9718
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9719
|
+
"v1/trigger-failures"
|
|
9720
|
+
),
|
|
9721
|
+
method: "GET",
|
|
9722
|
+
headers: _headers,
|
|
9723
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9724
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9725
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9726
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9727
|
+
fetchFn: this._options?.fetch,
|
|
9728
|
+
logging: this._options.logging
|
|
9729
|
+
});
|
|
9730
|
+
if (_response.ok) {
|
|
9731
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9732
|
+
}
|
|
9733
|
+
if (_response.error.reason === "status-code") {
|
|
9734
|
+
throw new VectrosError({
|
|
9735
|
+
statusCode: _response.error.statusCode,
|
|
9736
|
+
body: _response.error.body,
|
|
9737
|
+
rawResponse: _response.rawResponse
|
|
9738
|
+
});
|
|
9739
|
+
}
|
|
9740
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/trigger-failures");
|
|
9741
|
+
}
|
|
9742
|
+
/**
|
|
9743
|
+
* 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.
|
|
9744
|
+
*
|
|
9745
|
+
* @param {Vectros.ListTriggersRequest} request
|
|
9746
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9747
|
+
*
|
|
9748
|
+
* @example
|
|
9749
|
+
* await client.triggers.listTriggers({
|
|
9750
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9751
|
+
* })
|
|
9752
|
+
*/
|
|
9753
|
+
listTriggers(request = {}, requestOptions) {
|
|
9754
|
+
return HttpResponsePromise.fromPromise(this.__listTriggers(request, requestOptions));
|
|
9755
|
+
}
|
|
9756
|
+
async __listTriggers(request = {}, requestOptions) {
|
|
9757
|
+
const { startFrom, limit } = request;
|
|
9758
|
+
const _queryParams = {
|
|
9759
|
+
startFrom,
|
|
9760
|
+
limit
|
|
9761
|
+
};
|
|
9762
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9763
|
+
const _headers = mergeHeaders(
|
|
9764
|
+
_authRequest.headers,
|
|
9765
|
+
this._options?.headers,
|
|
9766
|
+
requestOptions?.headers
|
|
9767
|
+
);
|
|
9768
|
+
const _response = await fetcher({
|
|
9769
|
+
url: url_exports.join(
|
|
9770
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9771
|
+
"v1/triggers"
|
|
9772
|
+
),
|
|
9773
|
+
method: "GET",
|
|
9774
|
+
headers: _headers,
|
|
9775
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9776
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9777
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9778
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9779
|
+
fetchFn: this._options?.fetch,
|
|
9780
|
+
logging: this._options.logging
|
|
9781
|
+
});
|
|
9782
|
+
if (_response.ok) {
|
|
9783
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9784
|
+
}
|
|
9785
|
+
if (_response.error.reason === "status-code") {
|
|
9786
|
+
throw new VectrosError({
|
|
9787
|
+
statusCode: _response.error.statusCode,
|
|
9788
|
+
body: _response.error.body,
|
|
9789
|
+
rawResponse: _response.rawResponse
|
|
9790
|
+
});
|
|
9791
|
+
}
|
|
9792
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers");
|
|
9793
|
+
}
|
|
9794
|
+
/**
|
|
9795
|
+
* 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).
|
|
9796
|
+
*
|
|
9797
|
+
* @param {Vectros.CreateTriggerRequest} request
|
|
9798
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9799
|
+
*
|
|
9800
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9801
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9802
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9803
|
+
*
|
|
9804
|
+
* @example
|
|
9805
|
+
* await client.triggers.createTrigger({
|
|
9806
|
+
* body: {
|
|
9807
|
+
* name: "on-intake-create",
|
|
9808
|
+
* firingSource: {
|
|
9809
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9810
|
+
* event: "CREATE"
|
|
9811
|
+
* },
|
|
9812
|
+
* scriptRef: {
|
|
9813
|
+
* name: "notify-assignee",
|
|
9814
|
+
* version: "3"
|
|
9815
|
+
* }
|
|
9816
|
+
* }
|
|
9817
|
+
* })
|
|
9818
|
+
*/
|
|
9819
|
+
createTrigger(request, requestOptions) {
|
|
9820
|
+
return HttpResponsePromise.fromPromise(this.__createTrigger(request, requestOptions));
|
|
9821
|
+
}
|
|
9822
|
+
async __createTrigger(request, requestOptions) {
|
|
9823
|
+
const { upsert, body: _body } = request;
|
|
9824
|
+
const _queryParams = {
|
|
9825
|
+
upsert
|
|
9826
|
+
};
|
|
9827
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9828
|
+
const _headers = mergeHeaders(
|
|
9829
|
+
_authRequest.headers,
|
|
9830
|
+
this._options?.headers,
|
|
9831
|
+
requestOptions?.headers
|
|
9832
|
+
);
|
|
9833
|
+
const _response = await fetcher({
|
|
9834
|
+
url: url_exports.join(
|
|
9835
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9836
|
+
"v1/triggers"
|
|
9837
|
+
),
|
|
9838
|
+
method: "POST",
|
|
9839
|
+
headers: _headers,
|
|
9840
|
+
contentType: "application/json",
|
|
9841
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9842
|
+
requestType: "json",
|
|
9843
|
+
body: _body,
|
|
9844
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9845
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9846
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9847
|
+
fetchFn: this._options?.fetch,
|
|
9848
|
+
logging: this._options.logging
|
|
9849
|
+
});
|
|
9850
|
+
if (_response.ok) {
|
|
9851
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9852
|
+
}
|
|
9853
|
+
if (_response.error.reason === "status-code") {
|
|
9854
|
+
switch (_response.error.statusCode) {
|
|
9855
|
+
case 400:
|
|
9856
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9857
|
+
case 403:
|
|
9858
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9859
|
+
case 429:
|
|
9860
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9861
|
+
default:
|
|
9862
|
+
throw new VectrosError({
|
|
9863
|
+
statusCode: _response.error.statusCode,
|
|
9864
|
+
body: _response.error.body,
|
|
9865
|
+
rawResponse: _response.rawResponse
|
|
9866
|
+
});
|
|
9867
|
+
}
|
|
9868
|
+
}
|
|
9869
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/triggers");
|
|
9870
|
+
}
|
|
9871
|
+
/**
|
|
9872
|
+
* Retrieves a single trigger rule by its ID. Requires the `triggers:r` scope.
|
|
9873
|
+
*
|
|
9874
|
+
* @param {Vectros.GetTriggerRequest} request
|
|
9875
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9876
|
+
*
|
|
9877
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9878
|
+
*
|
|
9879
|
+
* @example
|
|
9880
|
+
* await client.triggers.getTrigger({
|
|
9881
|
+
* id: "id"
|
|
9882
|
+
* })
|
|
9883
|
+
*/
|
|
9884
|
+
getTrigger(request, requestOptions) {
|
|
9885
|
+
return HttpResponsePromise.fromPromise(this.__getTrigger(request, requestOptions));
|
|
9886
|
+
}
|
|
9887
|
+
async __getTrigger(request, requestOptions) {
|
|
9888
|
+
const { id } = request;
|
|
9889
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9890
|
+
const _headers = mergeHeaders(
|
|
9891
|
+
_authRequest.headers,
|
|
9892
|
+
this._options?.headers,
|
|
9893
|
+
requestOptions?.headers
|
|
9894
|
+
);
|
|
9895
|
+
const _response = await fetcher({
|
|
9896
|
+
url: url_exports.join(
|
|
9897
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9898
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9899
|
+
),
|
|
9900
|
+
method: "GET",
|
|
9901
|
+
headers: _headers,
|
|
9902
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9903
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9904
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9905
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9906
|
+
fetchFn: this._options?.fetch,
|
|
9907
|
+
logging: this._options.logging
|
|
9908
|
+
});
|
|
9909
|
+
if (_response.ok) {
|
|
9910
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9911
|
+
}
|
|
9912
|
+
if (_response.error.reason === "status-code") {
|
|
9913
|
+
switch (_response.error.statusCode) {
|
|
9914
|
+
case 404:
|
|
9915
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9916
|
+
default:
|
|
9917
|
+
throw new VectrosError({
|
|
9918
|
+
statusCode: _response.error.statusCode,
|
|
9919
|
+
body: _response.error.body,
|
|
9920
|
+
rawResponse: _response.rawResponse
|
|
9921
|
+
});
|
|
9922
|
+
}
|
|
9923
|
+
}
|
|
9924
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers/{id}");
|
|
9925
|
+
}
|
|
9926
|
+
/**
|
|
9927
|
+
* 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.
|
|
9928
|
+
*
|
|
9929
|
+
* @param {Vectros.UpdateTriggerRequest} request
|
|
9930
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9931
|
+
*
|
|
9932
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9933
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9934
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9935
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9936
|
+
*
|
|
9937
|
+
* @example
|
|
9938
|
+
* await client.triggers.updateTrigger({
|
|
9939
|
+
* id: "id",
|
|
9940
|
+
* body: {
|
|
9941
|
+
* name: "on-intake-create",
|
|
9942
|
+
* firingSource: {
|
|
9943
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9944
|
+
* event: "CREATE"
|
|
9945
|
+
* },
|
|
9946
|
+
* scriptRef: {
|
|
9947
|
+
* name: "notify-assignee",
|
|
9948
|
+
* version: "3"
|
|
9949
|
+
* }
|
|
9950
|
+
* }
|
|
9951
|
+
* })
|
|
9952
|
+
*/
|
|
9953
|
+
updateTrigger(request, requestOptions) {
|
|
9954
|
+
return HttpResponsePromise.fromPromise(this.__updateTrigger(request, requestOptions));
|
|
9955
|
+
}
|
|
9956
|
+
async __updateTrigger(request, requestOptions) {
|
|
9957
|
+
const { id, body: _body } = request;
|
|
9958
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9959
|
+
const _headers = mergeHeaders(
|
|
9960
|
+
_authRequest.headers,
|
|
9961
|
+
this._options?.headers,
|
|
9962
|
+
requestOptions?.headers
|
|
9963
|
+
);
|
|
9964
|
+
const _response = await fetcher({
|
|
9965
|
+
url: url_exports.join(
|
|
9966
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9967
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9968
|
+
),
|
|
9969
|
+
method: "PUT",
|
|
9970
|
+
headers: _headers,
|
|
9971
|
+
contentType: "application/json",
|
|
9972
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9973
|
+
requestType: "json",
|
|
9974
|
+
body: _body,
|
|
9975
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9976
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9977
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9978
|
+
fetchFn: this._options?.fetch,
|
|
9979
|
+
logging: this._options.logging
|
|
9980
|
+
});
|
|
9981
|
+
if (_response.ok) {
|
|
9982
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9983
|
+
}
|
|
9984
|
+
if (_response.error.reason === "status-code") {
|
|
9985
|
+
switch (_response.error.statusCode) {
|
|
9986
|
+
case 400:
|
|
9987
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9988
|
+
case 403:
|
|
9989
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9990
|
+
case 404:
|
|
9991
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9992
|
+
case 429:
|
|
9993
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9994
|
+
default:
|
|
9995
|
+
throw new VectrosError({
|
|
9996
|
+
statusCode: _response.error.statusCode,
|
|
9997
|
+
body: _response.error.body,
|
|
9998
|
+
rawResponse: _response.rawResponse
|
|
9999
|
+
});
|
|
10000
|
+
}
|
|
10001
|
+
}
|
|
10002
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/triggers/{id}");
|
|
10003
|
+
}
|
|
10004
|
+
/**
|
|
10005
|
+
* Permanently deletes one trigger rule by ID. Requires the `triggers:d` scope.
|
|
10006
|
+
*
|
|
10007
|
+
* @param {Vectros.DeleteTriggerRequest} request
|
|
10008
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
10009
|
+
*
|
|
10010
|
+
* @throws {@link Vectros.NotFoundError}
|
|
10011
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
10012
|
+
*
|
|
10013
|
+
* @example
|
|
10014
|
+
* await client.triggers.deleteTrigger({
|
|
10015
|
+
* id: "id"
|
|
10016
|
+
* })
|
|
10017
|
+
*/
|
|
10018
|
+
deleteTrigger(request, requestOptions) {
|
|
10019
|
+
return HttpResponsePromise.fromPromise(this.__deleteTrigger(request, requestOptions));
|
|
10020
|
+
}
|
|
10021
|
+
async __deleteTrigger(request, requestOptions) {
|
|
10022
|
+
const { id } = request;
|
|
10023
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
10024
|
+
const _headers = mergeHeaders(
|
|
10025
|
+
_authRequest.headers,
|
|
10026
|
+
this._options?.headers,
|
|
10027
|
+
requestOptions?.headers
|
|
10028
|
+
);
|
|
10029
|
+
const _response = await fetcher({
|
|
10030
|
+
url: url_exports.join(
|
|
10031
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
10032
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
10033
|
+
),
|
|
10034
|
+
method: "DELETE",
|
|
10035
|
+
headers: _headers,
|
|
10036
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
10037
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
10038
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10039
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10040
|
+
fetchFn: this._options?.fetch,
|
|
10041
|
+
logging: this._options.logging
|
|
10042
|
+
});
|
|
10043
|
+
if (_response.ok) {
|
|
10044
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
10045
|
+
}
|
|
10046
|
+
if (_response.error.reason === "status-code") {
|
|
10047
|
+
switch (_response.error.statusCode) {
|
|
10048
|
+
case 404:
|
|
10049
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10050
|
+
case 429:
|
|
10051
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10052
|
+
default:
|
|
10053
|
+
throw new VectrosError({
|
|
10054
|
+
statusCode: _response.error.statusCode,
|
|
10055
|
+
body: _response.error.body,
|
|
10056
|
+
rawResponse: _response.rawResponse
|
|
10057
|
+
});
|
|
10058
|
+
}
|
|
10059
|
+
}
|
|
10060
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/triggers/{id}");
|
|
10061
|
+
}
|
|
10062
|
+
};
|
|
10063
|
+
var VectrosClient = class {
|
|
10064
|
+
constructor(options) {
|
|
10065
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
10066
|
+
}
|
|
10067
|
+
get auth() {
|
|
10068
|
+
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
10069
|
+
}
|
|
10070
|
+
get documents() {
|
|
10071
|
+
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
10072
|
+
}
|
|
10073
|
+
get identity() {
|
|
10074
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
10075
|
+
}
|
|
10076
|
+
get compliance() {
|
|
10077
|
+
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
10078
|
+
}
|
|
10079
|
+
get folders() {
|
|
10080
|
+
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
10081
|
+
}
|
|
10082
|
+
get inference() {
|
|
10083
|
+
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
10084
|
+
}
|
|
10085
|
+
get records() {
|
|
10086
|
+
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
10087
|
+
}
|
|
10088
|
+
get schemas() {
|
|
10089
|
+
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
10090
|
+
}
|
|
10091
|
+
get scripts() {
|
|
10092
|
+
return this._scripts ?? (this._scripts = new ScriptsClient(this._options));
|
|
10093
|
+
}
|
|
10094
|
+
get search() {
|
|
10095
|
+
return this._search ?? (this._search = new SearchClient(this._options));
|
|
10096
|
+
}
|
|
10097
|
+
get triggers() {
|
|
10098
|
+
return this._triggers ?? (this._triggers = new TriggersClient(this._options));
|
|
10099
|
+
}
|
|
10100
|
+
/**
|
|
10101
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
10102
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
10103
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
10104
|
+
*
|
|
10105
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
10106
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
10107
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
10108
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
10109
|
+
*/
|
|
10110
|
+
async fetch(input, init, requestOptions) {
|
|
10111
|
+
return makePassthroughRequest(
|
|
10112
|
+
input,
|
|
10113
|
+
init,
|
|
10114
|
+
{
|
|
10115
|
+
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
10116
|
+
headers: this._options.headers,
|
|
10117
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
10118
|
+
maxRetries: this._options.maxRetries,
|
|
10119
|
+
fetch: this._options.fetch,
|
|
10120
|
+
logging: this._options.logging,
|
|
10121
|
+
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
10122
|
+
},
|
|
10123
|
+
requestOptions
|
|
10124
|
+
);
|
|
10125
|
+
}
|
|
10126
|
+
};
|
|
10127
|
+
var logging;
|
|
10128
|
+
((logging2) => {
|
|
10129
|
+
logging2.LogLevel = LogLevel;
|
|
10130
|
+
logging2.ConsoleLogger = ConsoleLogger;
|
|
10131
|
+
})(logging || (logging = {}));
|
|
10132
|
+
|
|
10133
|
+
// src/server.ts
|
|
10134
|
+
import {
|
|
10135
|
+
CallToolRequestSchema,
|
|
10136
|
+
ListResourcesRequestSchema,
|
|
10137
|
+
ListToolsRequestSchema,
|
|
10138
|
+
ReadResourceRequestSchema
|
|
10139
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
10140
|
+
import { z as z24 } from "zod";
|
|
10141
|
+
|
|
10142
|
+
// src/auth.ts
|
|
10143
|
+
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
10144
|
+
var InvalidApiKeyError = class extends Error {
|
|
10145
|
+
constructor(reason) {
|
|
10146
|
+
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
10147
|
+
this.name = "InvalidApiKeyError";
|
|
10148
|
+
}
|
|
10149
|
+
};
|
|
10150
|
+
function parseApiKey(raw) {
|
|
10151
|
+
if (!raw || raw.trim().length === 0) {
|
|
10152
|
+
throw new InvalidApiKeyError(
|
|
10153
|
+
"env var is missing or empty. Set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_... or ssk_test_...)."
|
|
10154
|
+
);
|
|
10155
|
+
}
|
|
10156
|
+
const match = raw.match(KEY_RE);
|
|
10157
|
+
if (!match) {
|
|
10158
|
+
throw new InvalidApiKeyError(
|
|
10159
|
+
`key must start with sk_, ssk_, or st_ followed by "live_" or "test_". Got prefix "${raw.slice(0, 12)}...".`
|
|
10160
|
+
);
|
|
9248
10161
|
}
|
|
9249
10162
|
return {
|
|
9250
10163
|
prefix: match[1],
|
|
@@ -9268,8 +10181,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
9268
10181
|
|
|
9269
10182
|
// src/build-info.ts
|
|
9270
10183
|
var BUILD_INFO = {
|
|
9271
|
-
mcpServer: true ? "0.
|
|
9272
|
-
sdk: true ? "0.
|
|
10184
|
+
mcpServer: true ? "0.17.1" : "dev",
|
|
10185
|
+
sdk: true ? "0.44.0" : "dev"
|
|
9273
10186
|
};
|
|
9274
10187
|
|
|
9275
10188
|
// src/log.ts
|
|
@@ -9577,11 +10490,18 @@ var inputSchema = {
|
|
|
9577
10490
|
// Ownership.
|
|
9578
10491
|
userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9579
10492
|
scope: z.string().optional().describe(
|
|
9580
|
-
'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.'
|
|
10493
|
+
'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.'
|
|
10494
|
+
),
|
|
10495
|
+
scopeFilters: z.array(z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
10496
|
+
'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.'
|
|
9581
10497
|
),
|
|
9582
10498
|
// Date window.
|
|
9583
|
-
createdAfter: z.string().optional().describe(
|
|
9584
|
-
|
|
10499
|
+
createdAfter: z.string().optional().describe(
|
|
10500
|
+
"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."
|
|
10501
|
+
),
|
|
10502
|
+
createdBefore: z.string().optional().describe(
|
|
10503
|
+
"Restrict to content CREATED at/before this ISO 8601 UTC timestamp \u2014 same creation-time basis, and the same first-index allowance, as createdAfter."
|
|
10504
|
+
),
|
|
9585
10505
|
// Relevance tuning.
|
|
9586
10506
|
minSimilarity: z.number().min(0).max(1).optional().describe("Minimum semantic similarity (0.0\u20131.0); results below are excluded."),
|
|
9587
10507
|
minTextRelevance: z.number().min(0).max(1).optional().describe("Minimum relative keyword (BM25) relevance (0.0\u20131.0); the keyword-leg analogue of minSimilarity."),
|
|
@@ -9596,11 +10516,21 @@ var inputSchema = {
|
|
|
9596
10516
|
var hybridSearch = ({ client, log }) => ({
|
|
9597
10517
|
name: "hybrid_search",
|
|
9598
10518
|
title: "Hybrid search",
|
|
9599
|
-
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
|
|
10519
|
+
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).',
|
|
9600
10520
|
inputSchema,
|
|
10521
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10522
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9601
10523
|
handler: async (args) => {
|
|
9602
10524
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
9603
10525
|
const mode = args.mode ?? "HYBRID";
|
|
10526
|
+
if (args.scope !== void 0 && args.scopeFilters !== void 0) {
|
|
10527
|
+
return toolError(
|
|
10528
|
+
"hybrid_search",
|
|
10529
|
+
new Error(
|
|
10530
|
+
"'scope' and 'scopeFilters' are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
10531
|
+
)
|
|
10532
|
+
);
|
|
10533
|
+
}
|
|
9604
10534
|
try {
|
|
9605
10535
|
const result = await client.search.content({
|
|
9606
10536
|
query: args.query,
|
|
@@ -9615,6 +10545,7 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9615
10545
|
filters: args.filters,
|
|
9616
10546
|
userId: args.userId,
|
|
9617
10547
|
scope: args.scope,
|
|
10548
|
+
scopeFilters: args.scopeFilters,
|
|
9618
10549
|
createdAfter: args.createdAfter,
|
|
9619
10550
|
createdBefore: args.createdBefore,
|
|
9620
10551
|
minSimilarity: args.minSimilarity,
|
|
@@ -9693,7 +10624,9 @@ async function drainPages(fetchPage) {
|
|
|
9693
10624
|
var MCP_DEFAULT_LIMIT2 = 3;
|
|
9694
10625
|
var MCP_MAX_LIMIT2 = 100;
|
|
9695
10626
|
var inputSchema2 = {
|
|
9696
|
-
type: z2.string().min(1, "type
|
|
10627
|
+
type: z2.string().min(1, "type must be non-empty when supplied").optional().describe(
|
|
10628
|
+
'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.'
|
|
10629
|
+
),
|
|
9697
10630
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | values | from+to | prefix.
|
|
9698
10631
|
field: z2.string().optional().describe(
|
|
9699
10632
|
'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.'
|
|
@@ -9715,6 +10648,12 @@ var inputSchema2 = {
|
|
|
9715
10648
|
"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."
|
|
9716
10649
|
),
|
|
9717
10650
|
// List-mode args:
|
|
10651
|
+
folderId: z2.string().optional().describe(
|
|
10652
|
+
"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."
|
|
10653
|
+
),
|
|
10654
|
+
recent: z2.boolean().optional().describe(
|
|
10655
|
+
"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."
|
|
10656
|
+
),
|
|
9718
10657
|
userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9719
10658
|
scope: z2.string().optional().describe(
|
|
9720
10659
|
'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.'
|
|
@@ -9727,11 +10666,15 @@ var inputSchema2 = {
|
|
|
9727
10666
|
var recordQuery = ({ client, log }) => ({
|
|
9728
10667
|
name: "record_query",
|
|
9729
10668
|
title: "Record query (list or lookup)",
|
|
9730
|
-
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
|
|
10669
|
+
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.",
|
|
9731
10670
|
inputSchema: inputSchema2,
|
|
10671
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10672
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9732
10673
|
handler: async (args) => {
|
|
9733
10674
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
9734
10675
|
const type = args.type;
|
|
10676
|
+
const folderId = args.folderId;
|
|
10677
|
+
const recent = args.recent;
|
|
9735
10678
|
const field = args.field;
|
|
9736
10679
|
const value = args.value;
|
|
9737
10680
|
const values = args.values;
|
|
@@ -9749,6 +10692,48 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9749
10692
|
)
|
|
9750
10693
|
);
|
|
9751
10694
|
}
|
|
10695
|
+
if (field && (folderId !== void 0 || recent !== void 0)) {
|
|
10696
|
+
return toolError(
|
|
10697
|
+
"record_query",
|
|
10698
|
+
new Error(
|
|
10699
|
+
"'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."
|
|
10700
|
+
)
|
|
10701
|
+
);
|
|
10702
|
+
}
|
|
10703
|
+
if (field && !type) {
|
|
10704
|
+
return toolError(
|
|
10705
|
+
"record_query",
|
|
10706
|
+
new Error(
|
|
10707
|
+
"a lookup ('field') is always within one record type \u2014 pass 'type'. To read across types, use list mode with 'folderId' or 'recent'."
|
|
10708
|
+
)
|
|
10709
|
+
);
|
|
10710
|
+
}
|
|
10711
|
+
if (!field) {
|
|
10712
|
+
if (recent && (type !== void 0 || folderId !== void 0)) {
|
|
10713
|
+
return toolError(
|
|
10714
|
+
"record_query",
|
|
10715
|
+
new Error(
|
|
10716
|
+
"'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."
|
|
10717
|
+
)
|
|
10718
|
+
);
|
|
10719
|
+
}
|
|
10720
|
+
if (recent && (args.userId !== void 0 || args.scope !== void 0)) {
|
|
10721
|
+
return toolError(
|
|
10722
|
+
"record_query",
|
|
10723
|
+
new Error(
|
|
10724
|
+
"'recent' ignores the owner filters \u2014 'userId'/'scope' would be silently dropped. List by 'type' or 'folderId' to filter by owner."
|
|
10725
|
+
)
|
|
10726
|
+
);
|
|
10727
|
+
}
|
|
10728
|
+
if (!recent && type === void 0 && folderId === void 0) {
|
|
10729
|
+
return toolError(
|
|
10730
|
+
"record_query",
|
|
10731
|
+
new Error(
|
|
10732
|
+
"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."
|
|
10733
|
+
)
|
|
10734
|
+
);
|
|
10735
|
+
}
|
|
10736
|
+
}
|
|
9752
10737
|
try {
|
|
9753
10738
|
let page;
|
|
9754
10739
|
if (field) {
|
|
@@ -9812,6 +10797,7 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9812
10797
|
}
|
|
9813
10798
|
}
|
|
9814
10799
|
page = await client.records.lookupRecordsByBody({
|
|
10800
|
+
// Non-null: the `field && !type` guard above returns before reaching lookup mode.
|
|
9815
10801
|
type,
|
|
9816
10802
|
field: normalizedField,
|
|
9817
10803
|
value,
|
|
@@ -9832,13 +10818,22 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9832
10818
|
} else {
|
|
9833
10819
|
page = await client.records.listRecords({
|
|
9834
10820
|
type,
|
|
10821
|
+
folderId,
|
|
10822
|
+
...recent ? { recent: "true" } : {},
|
|
9835
10823
|
userId: args.userId,
|
|
9836
10824
|
scope: args.scope,
|
|
9837
10825
|
startFrom,
|
|
9838
10826
|
limit
|
|
9839
10827
|
});
|
|
9840
10828
|
log.debug(
|
|
9841
|
-
{
|
|
10829
|
+
{
|
|
10830
|
+
tool: "record_query",
|
|
10831
|
+
mode: recent ? "list:recent" : folderId ? "list:folder" : "list:type",
|
|
10832
|
+
type,
|
|
10833
|
+
folderId,
|
|
10834
|
+
limit,
|
|
10835
|
+
returned: pageItems(page).length
|
|
10836
|
+
},
|
|
9842
10837
|
"record_query list ok"
|
|
9843
10838
|
);
|
|
9844
10839
|
}
|
|
@@ -9920,6 +10915,8 @@ var recordGet = ({ client, log }) => ({
|
|
|
9920
10915
|
title: "Get a record by id or externalId",
|
|
9921
10916
|
description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window. The response carries the record's processing `indexStatus`; when it is FAILED an `indexFailure.code` explains whether the content is still searchable (e.g. VECTOR_LIMIT_EXCEEDED keeps keyword search vs INDEXING_FAILED = not findable at all) \u2014 branch on the `code`, not the message.",
|
|
9922
10917
|
inputSchema: inputSchema3,
|
|
10918
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10919
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9923
10920
|
handler: async (args) => {
|
|
9924
10921
|
const id = args.id;
|
|
9925
10922
|
const externalId = args.externalId;
|
|
@@ -9965,6 +10962,8 @@ var recordBatchGet = ({ client, log }) => ({
|
|
|
9965
10962
|
title: "Get multiple records by id in one call",
|
|
9966
10963
|
description: "Fetch several structured records by id in a single call (1-100 ids), each with its full payload \u2014 the same hydration record_get gives a single id. Use this instead of N record_get calls when you already hold several ids (e.g. a page of record_query/hybrid_search results). Any id you can't access is silently omitted from `data`; the response also returns `missingIds` \u2014 every requested id not present in `data` \u2014 so you can tell a partial result from a complete one. As with record_get, an oversized payload is truncated into a labelled `payloadPreview` rather than shipped whole.",
|
|
9967
10964
|
inputSchema: inputSchema4,
|
|
10965
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10966
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9968
10967
|
handler: async (args) => {
|
|
9969
10968
|
const ids = args.ids;
|
|
9970
10969
|
try {
|
|
@@ -10015,7 +11014,7 @@ var inputSchema5 = {
|
|
|
10015
11014
|
folderId: z5.string().optional().describe("Group this record into a folder."),
|
|
10016
11015
|
userId: z5.string().optional().describe("Owning user id."),
|
|
10017
11016
|
scopes: z5.array(z5.string()).optional().describe(
|
|
10018
|
-
'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
|
|
11017
|
+
'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.'
|
|
10019
11018
|
)
|
|
10020
11019
|
};
|
|
10021
11020
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -10023,6 +11022,13 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10023
11022
|
title: "Create a record",
|
|
10024
11023
|
description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c (and records:r to receive the existing record on a collision).",
|
|
10025
11024
|
inputSchema: inputSchema5,
|
|
11025
|
+
// Creates, never modifies or deletes an existing record. Idempotent ONLY when the caller
|
|
11026
|
+
// supplies `externalId` (optional, per the doc comment above) — re-creating with the same
|
|
11027
|
+
// one returns the existing record rather than duplicating it. `externalId` is not required,
|
|
11028
|
+
// so annotated for the less-safe default (omit it, and a retry creates a second record),
|
|
11029
|
+
// not the safer opt-in — same standard applied to record_batch_write, which has the
|
|
11030
|
+
// identical optional-externalId shape.
|
|
11031
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10026
11032
|
handler: async (args) => {
|
|
10027
11033
|
const type = args.type;
|
|
10028
11034
|
try {
|
|
@@ -10048,19 +11054,110 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10048
11054
|
});
|
|
10049
11055
|
var record_create_default = recordCreate;
|
|
10050
11056
|
|
|
10051
|
-
// src/tools/
|
|
11057
|
+
// src/tools/record_batch_write.ts
|
|
10052
11058
|
import { z as z6 } from "zod";
|
|
10053
|
-
var
|
|
10054
|
-
|
|
11059
|
+
var MCP_MAX_ITEMS = 50;
|
|
11060
|
+
var itemSchema = z6.strictObject({
|
|
11061
|
+
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.'),
|
|
11062
|
+
fields: z6.record(z6.string(), z6.unknown()).describe(
|
|
11063
|
+
"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)."
|
|
11064
|
+
),
|
|
10055
11065
|
externalId: z6.string().optional().describe(
|
|
11066
|
+
'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.'
|
|
11067
|
+
),
|
|
11068
|
+
indexMode: z6.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
11069
|
+
"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."
|
|
11070
|
+
),
|
|
11071
|
+
status: z6.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
11072
|
+
folderId: z6.string().optional().describe("Group this record into a folder."),
|
|
11073
|
+
userId: z6.string().optional().describe("Owning user id."),
|
|
11074
|
+
scopes: z6.array(z6.string()).optional().describe(
|
|
11075
|
+
"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."
|
|
11076
|
+
)
|
|
11077
|
+
});
|
|
11078
|
+
var inputSchema6 = {
|
|
11079
|
+
items: z6.array(itemSchema).min(1).max(MCP_MAX_ITEMS).describe(
|
|
11080
|
+
`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.`
|
|
11081
|
+
),
|
|
11082
|
+
atomicity: z6.enum(["best_effort", "all_or_nothing"]).optional().describe(
|
|
11083
|
+
'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).'
|
|
11084
|
+
),
|
|
11085
|
+
upsert: z6.boolean().optional().describe(
|
|
11086
|
+
"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."
|
|
11087
|
+
),
|
|
11088
|
+
allowClear: z6.boolean().optional().describe(
|
|
11089
|
+
"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."
|
|
11090
|
+
)
|
|
11091
|
+
};
|
|
11092
|
+
var recordBatchWrite = ({ client, log }) => ({
|
|
11093
|
+
name: "record_batch_write",
|
|
11094
|
+
title: "Create or upsert multiple records in one call",
|
|
11095
|
+
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).',
|
|
11096
|
+
inputSchema: inputSchema6,
|
|
11097
|
+
// Creates by default, and can overwrite existing records as a FULL replacement when
|
|
11098
|
+
// `upsert:true` is passed (destructive to whatever fields the old version carried and
|
|
11099
|
+
// this call omits). Idempotent ONLY when every item supplies `externalId` (optional,
|
|
11100
|
+
// per its own field doc above) — re-submitting then converges, with or without
|
|
11101
|
+
// `upsert:true`. `externalId` is not required, so annotated for the less-safe default:
|
|
11102
|
+
// an item with no `externalId` at all has no dedup key, and a resubmit creates a second
|
|
11103
|
+
// record for it regardless of `upsert`. Same standard applied to record_create/
|
|
11104
|
+
// document_ingest's identical optional-externalId shape.
|
|
11105
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
11106
|
+
handler: async (args) => {
|
|
11107
|
+
const items = args.items;
|
|
11108
|
+
const atomicity = args.atomicity;
|
|
11109
|
+
try {
|
|
11110
|
+
const body = {
|
|
11111
|
+
items: items.map((item) => ({
|
|
11112
|
+
typeName: item.type,
|
|
11113
|
+
payload: item.fields,
|
|
11114
|
+
externalId: item.externalId,
|
|
11115
|
+
indexMode: item.indexMode,
|
|
11116
|
+
status: item.status,
|
|
11117
|
+
folderId: item.folderId,
|
|
11118
|
+
userId: item.userId,
|
|
11119
|
+
scopes: item.scopes
|
|
11120
|
+
})),
|
|
11121
|
+
atomicity,
|
|
11122
|
+
upsert: args.upsert,
|
|
11123
|
+
allowClear: args.allowClear
|
|
11124
|
+
};
|
|
11125
|
+
const response = await client.records.batchWriteRecords(body, { maxRetries: 0 });
|
|
11126
|
+
log.debug(
|
|
11127
|
+
{
|
|
11128
|
+
tool: "record_batch_write",
|
|
11129
|
+
submitted: items.length,
|
|
11130
|
+
atomicity: atomicity ?? "best_effort",
|
|
11131
|
+
succeeded: response.succeeded,
|
|
11132
|
+
failed: response.failed
|
|
11133
|
+
},
|
|
11134
|
+
"record_batch_write ok"
|
|
11135
|
+
);
|
|
11136
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
11137
|
+
} catch (err) {
|
|
11138
|
+
log.warn(
|
|
11139
|
+
{ tool: "record_batch_write", itemCount: items?.length, err: String(err) },
|
|
11140
|
+
"record_batch_write failed"
|
|
11141
|
+
);
|
|
11142
|
+
return toolError("record_batch_write", err);
|
|
11143
|
+
}
|
|
11144
|
+
}
|
|
11145
|
+
});
|
|
11146
|
+
var record_batch_write_default = recordBatchWrite;
|
|
11147
|
+
|
|
11148
|
+
// src/tools/record_update.ts
|
|
11149
|
+
import { z as z7 } from "zod";
|
|
11150
|
+
var inputSchema7 = {
|
|
11151
|
+
id: z7.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
|
|
11152
|
+
externalId: z7.string().optional().describe(
|
|
10056
11153
|
"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."
|
|
10057
11154
|
),
|
|
10058
|
-
type:
|
|
10059
|
-
fields:
|
|
11155
|
+
type: z7.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11156
|
+
fields: z7.record(z7.string(), z7.unknown()).describe(
|
|
10060
11157
|
"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."
|
|
10061
11158
|
),
|
|
10062
|
-
status:
|
|
10063
|
-
expectedVersion:
|
|
11159
|
+
status: z7.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
|
|
11160
|
+
expectedVersion: z7.number().int().optional().describe(
|
|
10064
11161
|
"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."
|
|
10065
11162
|
)
|
|
10066
11163
|
};
|
|
@@ -10068,7 +11165,11 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10068
11165
|
name: "record_update",
|
|
10069
11166
|
title: "Update a record by id or externalId",
|
|
10070
11167
|
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.",
|
|
10071
|
-
inputSchema:
|
|
11168
|
+
inputSchema: inputSchema7,
|
|
11169
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11170
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11171
|
+
// same state, so it is idempotent.
|
|
11172
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10072
11173
|
handler: async (args) => {
|
|
10073
11174
|
const id = args.id;
|
|
10074
11175
|
const externalId = args.externalId;
|
|
@@ -10094,15 +11195,19 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10094
11195
|
var record_update_default = recordUpdate;
|
|
10095
11196
|
|
|
10096
11197
|
// src/tools/record_delete.ts
|
|
10097
|
-
import { z as
|
|
10098
|
-
var
|
|
10099
|
-
id:
|
|
11198
|
+
import { z as z8 } from "zod";
|
|
11199
|
+
var inputSchema8 = {
|
|
11200
|
+
id: z8.string().min(1, "id is required").describe("The Vectros record id to delete.")
|
|
10100
11201
|
};
|
|
10101
11202
|
var recordDelete = ({ client, log }) => ({
|
|
10102
11203
|
name: "record_delete",
|
|
10103
11204
|
title: "Delete a record",
|
|
10104
11205
|
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.",
|
|
10105
|
-
inputSchema:
|
|
11206
|
+
inputSchema: inputSchema8,
|
|
11207
|
+
// Deletes (leaves a tombstone server-side, but the record is gone from every normal
|
|
11208
|
+
// read path). Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11209
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11210
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10106
11211
|
handler: async (args) => {
|
|
10107
11212
|
const id = args.id;
|
|
10108
11213
|
try {
|
|
@@ -10118,49 +11223,72 @@ var recordDelete = ({ client, log }) => ({
|
|
|
10118
11223
|
var record_delete_default = recordDelete;
|
|
10119
11224
|
|
|
10120
11225
|
// src/tools/rag_ask.ts
|
|
10121
|
-
import { z as
|
|
11226
|
+
import { z as z9 } from "zod";
|
|
10122
11227
|
var SEARCH_MCP_DEFAULT_LIMIT = 5;
|
|
10123
11228
|
var SEARCH_MCP_MAX_LIMIT = 50;
|
|
10124
|
-
var
|
|
10125
|
-
query:
|
|
10126
|
-
instructions:
|
|
11229
|
+
var inputSchema9 = {
|
|
11230
|
+
query: z9.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
|
|
11231
|
+
instructions: z9.string().optional().describe(
|
|
10127
11232
|
'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.'
|
|
10128
11233
|
),
|
|
10129
|
-
model:
|
|
11234
|
+
model: z9.string().optional().describe(
|
|
10130
11235
|
"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."
|
|
10131
11236
|
),
|
|
10132
|
-
search:
|
|
10133
|
-
mode:
|
|
10134
|
-
limit:
|
|
11237
|
+
search: z9.object({
|
|
11238
|
+
mode: z9.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
|
|
11239
|
+
limit: z9.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
10135
11240
|
`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.`
|
|
10136
11241
|
),
|
|
10137
11242
|
// Retrieval scoping — parity with hybrid_search so an agent can ground the
|
|
10138
11243
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
10139
11244
|
// whole-tenant corpus.
|
|
10140
|
-
userId:
|
|
10141
|
-
scope:
|
|
10142
|
-
'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.'
|
|
11245
|
+
userId: z9.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
11246
|
+
scope: z9.string().optional().describe(
|
|
11247
|
+
'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.'
|
|
11248
|
+
),
|
|
11249
|
+
scopeFilters: z9.array(z9.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
11250
|
+
'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`.'
|
|
10143
11251
|
),
|
|
10144
|
-
folderId:
|
|
10145
|
-
rootFolderId:
|
|
10146
|
-
typeName:
|
|
10147
|
-
contentTypes:
|
|
10148
|
-
filters:
|
|
11252
|
+
folderId: z9.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
11253
|
+
rootFolderId: z9.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
11254
|
+
typeName: z9.string().optional().describe("Restrict record retrieval to this schema type."),
|
|
11255
|
+
contentTypes: z9.array(z9.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
|
|
11256
|
+
filters: z9.record(z9.unknown()).optional().describe(
|
|
10149
11257
|
'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"}.'
|
|
10150
11258
|
),
|
|
10151
|
-
createdAfter:
|
|
10152
|
-
|
|
10153
|
-
|
|
11259
|
+
createdAfter: z9.string().optional().describe(
|
|
11260
|
+
"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."
|
|
11261
|
+
),
|
|
11262
|
+
createdBefore: z9.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
|
|
11263
|
+
requireComplete: z9.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
|
|
10154
11264
|
}).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
|
|
10155
|
-
maxTokens:
|
|
10156
|
-
temperature:
|
|
11265
|
+
maxTokens: z9.number().int().min(1).optional().describe("Max output tokens."),
|
|
11266
|
+
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.")
|
|
10157
11267
|
};
|
|
10158
11268
|
var ragAsk = ({ client, log }) => ({
|
|
10159
11269
|
name: "rag_ask",
|
|
10160
11270
|
title: "RAG ask (corpus-wide)",
|
|
10161
|
-
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.",
|
|
10162
|
-
inputSchema:
|
|
11271
|
+
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.",
|
|
11272
|
+
inputSchema: inputSchema9,
|
|
11273
|
+
// NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
|
|
11274
|
+
// balance before generation starts, then debits it on completion — a real financial side
|
|
11275
|
+
// effect that can trigger a configured auto-recharge against the tenant's card.
|
|
11276
|
+
// `readOnlyHint:true` would let a host
|
|
11277
|
+
// skip a confirmation prompt on a call with real, unbounded-under-retry spend; ordinary reads
|
|
11278
|
+
// that merely meter usage stay `readOnlyHint:true` (hybrid_search has no inference-cost leg),
|
|
11279
|
+
// but a call that can debit a balance and possibly charge a card is a different class. Not
|
|
11280
|
+
// idempotent either: every repeat charges again, and generation is non-deterministic.
|
|
11281
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10163
11282
|
handler: async (args, extra) => {
|
|
11283
|
+
const rawSearch = args.search ?? {};
|
|
11284
|
+
if (rawSearch.scope !== void 0 && rawSearch.scopeFilters !== void 0) {
|
|
11285
|
+
return toolError(
|
|
11286
|
+
"rag_ask",
|
|
11287
|
+
new Error(
|
|
11288
|
+
"search.scope and search.scopeFilters are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
11289
|
+
)
|
|
11290
|
+
);
|
|
11291
|
+
}
|
|
10164
11292
|
try {
|
|
10165
11293
|
const searchArg = args.search ?? {};
|
|
10166
11294
|
const search = {
|
|
@@ -10168,6 +11296,7 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10168
11296
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
10169
11297
|
userId: searchArg.userId,
|
|
10170
11298
|
scope: searchArg.scope,
|
|
11299
|
+
scopeFilters: searchArg.scopeFilters,
|
|
10171
11300
|
folderId: searchArg.folderId,
|
|
10172
11301
|
rootFolderId: searchArg.rootFolderId,
|
|
10173
11302
|
typeName: searchArg.typeName,
|
|
@@ -10235,20 +11364,29 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10235
11364
|
var rag_ask_default = ragAsk;
|
|
10236
11365
|
|
|
10237
11366
|
// src/tools/document_ask.ts
|
|
10238
|
-
import { z as
|
|
10239
|
-
var
|
|
10240
|
-
documentId:
|
|
10241
|
-
prompt:
|
|
10242
|
-
model:
|
|
11367
|
+
import { z as z10 } from "zod";
|
|
11368
|
+
var inputSchema10 = {
|
|
11369
|
+
documentId: z10.string().min(1, "documentId is required").describe("ID of the document to ask against."),
|
|
11370
|
+
prompt: z10.string().min(1, "prompt is required").describe("Question to ask about the document."),
|
|
11371
|
+
model: z10.string().optional().describe(
|
|
10243
11372
|
"Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
10244
11373
|
),
|
|
10245
|
-
maxTokens:
|
|
11374
|
+
maxTokens: z10.number().int().min(1).optional().describe("Max output tokens.")
|
|
10246
11375
|
};
|
|
10247
11376
|
var documentAsk = ({ client, log }) => ({
|
|
10248
11377
|
name: "document_ask",
|
|
10249
11378
|
title: "Document ask (single-document)",
|
|
10250
11379
|
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.",
|
|
10251
|
-
inputSchema:
|
|
11380
|
+
inputSchema: inputSchema10,
|
|
11381
|
+
// NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
|
|
11382
|
+
// balance before generation starts, then debits it on completion — a real financial side
|
|
11383
|
+
// effect that can trigger a configured auto-recharge against the tenant's card.
|
|
11384
|
+
// `readOnlyHint:true` would let a host
|
|
11385
|
+
// skip a confirmation prompt on a call with real, unbounded-under-retry spend; ordinary reads
|
|
11386
|
+
// that merely meter usage stay `readOnlyHint:true` (hybrid_search has no inference-cost leg),
|
|
11387
|
+
// but a call that can debit a balance and possibly charge a card is a different class. Not
|
|
11388
|
+
// idempotent either: every repeat charges again, and generation is non-deterministic.
|
|
11389
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10252
11390
|
handler: async (args, extra) => {
|
|
10253
11391
|
try {
|
|
10254
11392
|
const stream = await client.inference.documentAsk({
|
|
@@ -10307,18 +11445,18 @@ var documentAsk = ({ client, log }) => ({
|
|
|
10307
11445
|
var document_ask_default = documentAsk;
|
|
10308
11446
|
|
|
10309
11447
|
// src/tools/list_schemas.ts
|
|
10310
|
-
import { z as
|
|
10311
|
-
var
|
|
10312
|
-
userId:
|
|
11448
|
+
import { z as z11 } from "zod";
|
|
11449
|
+
var inputSchema11 = {
|
|
11450
|
+
userId: z11.string().optional().describe(
|
|
10313
11451
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
10314
11452
|
),
|
|
10315
|
-
scope:
|
|
11453
|
+
scope: z11.string().optional().describe(
|
|
10316
11454
|
'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.'
|
|
10317
11455
|
),
|
|
10318
|
-
surface:
|
|
11456
|
+
surface: z11.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
10319
11457
|
"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."
|
|
10320
11458
|
),
|
|
10321
|
-
recordType:
|
|
11459
|
+
recordType: z11.string().optional().describe(
|
|
10322
11460
|
'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.'
|
|
10323
11461
|
)
|
|
10324
11462
|
};
|
|
@@ -10326,7 +11464,9 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10326
11464
|
name: "list_schemas",
|
|
10327
11465
|
title: "List record schemas",
|
|
10328
11466
|
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.',
|
|
10329
|
-
inputSchema:
|
|
11467
|
+
inputSchema: inputSchema11,
|
|
11468
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11469
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10330
11470
|
handler: async (args) => {
|
|
10331
11471
|
const userId = args.userId;
|
|
10332
11472
|
const scope = args.scope;
|
|
@@ -10352,18 +11492,18 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10352
11492
|
var list_schemas_default = listSchemas;
|
|
10353
11493
|
|
|
10354
11494
|
// src/tools/document_get.ts
|
|
10355
|
-
import { z as
|
|
11495
|
+
import { z as z12 } from "zod";
|
|
10356
11496
|
var MAX_TEXT_CHARS = 32e3;
|
|
10357
|
-
var
|
|
10358
|
-
documentId:
|
|
10359
|
-
externalId:
|
|
11497
|
+
var inputSchema12 = {
|
|
11498
|
+
documentId: z12.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
|
|
11499
|
+
externalId: z12.string().optional().describe(
|
|
10360
11500
|
"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."
|
|
10361
11501
|
),
|
|
10362
|
-
type:
|
|
10363
|
-
includeText:
|
|
11502
|
+
type: z12.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11503
|
+
includeText: z12.boolean().optional().describe(
|
|
10364
11504
|
"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."
|
|
10365
11505
|
),
|
|
10366
|
-
includeDownloadUrl:
|
|
11506
|
+
includeDownloadUrl: z12.boolean().optional().describe(
|
|
10367
11507
|
"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."
|
|
10368
11508
|
)
|
|
10369
11509
|
};
|
|
@@ -10380,7 +11520,9 @@ var documentGet = ({ client, log }) => ({
|
|
|
10380
11520
|
name: "document_get",
|
|
10381
11521
|
title: "Get document metadata (and optionally text)",
|
|
10382
11522
|
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.",
|
|
10383
|
-
inputSchema:
|
|
11523
|
+
inputSchema: inputSchema12,
|
|
11524
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11525
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10384
11526
|
handler: async (args) => {
|
|
10385
11527
|
const documentId = args.documentId;
|
|
10386
11528
|
const externalId = args.externalId;
|
|
@@ -10445,28 +11587,28 @@ var documentGet = ({ client, log }) => ({
|
|
|
10445
11587
|
var document_get_default = documentGet;
|
|
10446
11588
|
|
|
10447
11589
|
// src/tools/document_query.ts
|
|
10448
|
-
import { z as
|
|
11590
|
+
import { z as z13 } from "zod";
|
|
10449
11591
|
var MCP_DEFAULT_LIMIT3 = 3;
|
|
10450
11592
|
var MCP_MAX_LIMIT3 = 100;
|
|
10451
|
-
var
|
|
11593
|
+
var inputSchema13 = {
|
|
10452
11594
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
10453
|
-
field:
|
|
10454
|
-
value:
|
|
10455
|
-
from:
|
|
10456
|
-
to:
|
|
10457
|
-
prefix:
|
|
10458
|
-
order:
|
|
11595
|
+
field: z13.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
|
|
11596
|
+
value: z13.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
|
|
11597
|
+
from: z13.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
|
|
11598
|
+
to: z13.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
11599
|
+
prefix: z13.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
11600
|
+
order: z13.enum(["asc", "desc"]).optional().describe(
|
|
10459
11601
|
"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."
|
|
10460
11602
|
),
|
|
10461
|
-
type:
|
|
11603
|
+
type: z13.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
|
|
10462
11604
|
// List-mode args:
|
|
10463
|
-
folderId:
|
|
10464
|
-
userId:
|
|
10465
|
-
scope:
|
|
11605
|
+
folderId: z13.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
11606
|
+
userId: z13.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
11607
|
+
scope: z13.string().optional().describe(
|
|
10466
11608
|
'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.'
|
|
10467
11609
|
),
|
|
10468
|
-
startFrom:
|
|
10469
|
-
limit:
|
|
11610
|
+
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."),
|
|
11611
|
+
limit: z13.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
10470
11612
|
`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.`
|
|
10471
11613
|
)
|
|
10472
11614
|
};
|
|
@@ -10474,7 +11616,9 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10474
11616
|
name: "document_query",
|
|
10475
11617
|
title: "Document query (list or lookup)",
|
|
10476
11618
|
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.",
|
|
10477
|
-
inputSchema:
|
|
11619
|
+
inputSchema: inputSchema13,
|
|
11620
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11621
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10478
11622
|
handler: async (args) => {
|
|
10479
11623
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
10480
11624
|
const field = args.field;
|
|
@@ -10554,29 +11698,29 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10554
11698
|
var document_query_default = documentQuery;
|
|
10555
11699
|
|
|
10556
11700
|
// src/tools/document_update.ts
|
|
10557
|
-
import { z as
|
|
10558
|
-
var
|
|
10559
|
-
documentId:
|
|
10560
|
-
externalId:
|
|
11701
|
+
import { z as z14 } from "zod";
|
|
11702
|
+
var inputSchema14 = {
|
|
11703
|
+
documentId: z14.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
|
|
11704
|
+
externalId: z14.string().optional().describe(
|
|
10561
11705
|
"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."
|
|
10562
11706
|
),
|
|
10563
|
-
type:
|
|
10564
|
-
title:
|
|
10565
|
-
fields:
|
|
11707
|
+
type: z14.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11708
|
+
title: z14.string().optional().describe("New title. Omit to keep the current title."),
|
|
11709
|
+
fields: z14.record(z14.string(), z14.unknown()).optional().describe(
|
|
10566
11710
|
"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."
|
|
10567
11711
|
),
|
|
10568
|
-
text:
|
|
11712
|
+
text: z14.string().optional().describe(
|
|
10569
11713
|
"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."
|
|
10570
11714
|
),
|
|
10571
|
-
folderId:
|
|
10572
|
-
status:
|
|
11715
|
+
folderId: z14.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
|
|
11716
|
+
status: z14.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
|
|
10573
11717
|
"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."
|
|
10574
11718
|
),
|
|
10575
|
-
userId:
|
|
10576
|
-
scopes:
|
|
11719
|
+
userId: z14.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11720
|
+
scopes: z14.array(z14.string()).optional().describe(
|
|
10577
11721
|
'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).'
|
|
10578
11722
|
),
|
|
10579
|
-
expectedVersion:
|
|
11723
|
+
expectedVersion: z14.number().int().optional().describe(
|
|
10580
11724
|
"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."
|
|
10581
11725
|
)
|
|
10582
11726
|
};
|
|
@@ -10584,7 +11728,11 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10584
11728
|
name: "document_update",
|
|
10585
11729
|
title: "Update a document",
|
|
10586
11730
|
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.',
|
|
10587
|
-
inputSchema:
|
|
11731
|
+
inputSchema: inputSchema14,
|
|
11732
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11733
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11734
|
+
// same state, so it is idempotent.
|
|
11735
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10588
11736
|
handler: async (args) => {
|
|
10589
11737
|
const documentId = args.documentId;
|
|
10590
11738
|
const externalId = args.externalId;
|
|
@@ -10624,15 +11772,18 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10624
11772
|
var document_update_default = documentUpdate;
|
|
10625
11773
|
|
|
10626
11774
|
// src/tools/document_delete.ts
|
|
10627
|
-
import { z as
|
|
10628
|
-
var
|
|
10629
|
-
documentId:
|
|
11775
|
+
import { z as z15 } from "zod";
|
|
11776
|
+
var inputSchema15 = {
|
|
11777
|
+
documentId: z15.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
|
|
10630
11778
|
};
|
|
10631
11779
|
var documentDelete = ({ client, log }) => ({
|
|
10632
11780
|
name: "document_delete",
|
|
10633
11781
|
title: "Delete a document",
|
|
10634
11782
|
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).',
|
|
10635
|
-
inputSchema:
|
|
11783
|
+
inputSchema: inputSchema15,
|
|
11784
|
+
// Deletes. Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11785
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11786
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10636
11787
|
handler: async (args) => {
|
|
10637
11788
|
const documentId = args.documentId;
|
|
10638
11789
|
try {
|
|
@@ -10650,18 +11801,18 @@ var documentDelete = ({ client, log }) => ({
|
|
|
10650
11801
|
var document_delete_default = documentDelete;
|
|
10651
11802
|
|
|
10652
11803
|
// src/tools/folder_query.ts
|
|
10653
|
-
import { z as
|
|
11804
|
+
import { z as z16 } from "zod";
|
|
10654
11805
|
var MCP_DEFAULT_LIMIT4 = 10;
|
|
10655
11806
|
var MCP_MAX_LIMIT4 = 100;
|
|
10656
|
-
var
|
|
10657
|
-
id:
|
|
10658
|
-
parentId:
|
|
10659
|
-
userId:
|
|
10660
|
-
scope:
|
|
11807
|
+
var inputSchema16 = {
|
|
11808
|
+
id: z16.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
11809
|
+
parentId: z16.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
11810
|
+
userId: z16.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
11811
|
+
scope: z16.string().optional().describe(
|
|
10661
11812
|
'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.'
|
|
10662
11813
|
),
|
|
10663
|
-
startFrom:
|
|
10664
|
-
limit:
|
|
11814
|
+
startFrom: z16.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
11815
|
+
limit: z16.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10665
11816
|
`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\`.`
|
|
10666
11817
|
)
|
|
10667
11818
|
};
|
|
@@ -10669,7 +11820,9 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10669
11820
|
name: "folder_query",
|
|
10670
11821
|
title: "Folder query (list or get)",
|
|
10671
11822
|
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.",
|
|
10672
|
-
inputSchema:
|
|
11823
|
+
inputSchema: inputSchema16,
|
|
11824
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11825
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10673
11826
|
handler: async (args) => {
|
|
10674
11827
|
const id = args.id;
|
|
10675
11828
|
try {
|
|
@@ -10699,22 +11852,34 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10699
11852
|
var folder_query_default = folderQuery;
|
|
10700
11853
|
|
|
10701
11854
|
// src/tools/folder_create.ts
|
|
10702
|
-
import { z as
|
|
10703
|
-
var
|
|
10704
|
-
name:
|
|
10705
|
-
description:
|
|
10706
|
-
parentId:
|
|
10707
|
-
slug:
|
|
10708
|
-
|
|
10709
|
-
|
|
11855
|
+
import { z as z17 } from "zod";
|
|
11856
|
+
var inputSchema17 = {
|
|
11857
|
+
name: z17.string().min(1, "name is required").describe("Folder display name."),
|
|
11858
|
+
description: z17.string().optional().describe("Optional description of the folder's purpose."),
|
|
11859
|
+
parentId: z17.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
11860
|
+
slug: z17.string().optional().describe(
|
|
11861
|
+
"Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. SUPPLY THIS to make a retry safe \u2014 if omitted, a derived slug is only ever a freshly-proved-free one, so a redelivered call creates a new sibling folder every time rather than matching the first."
|
|
11862
|
+
),
|
|
11863
|
+
userId: z17.string().optional().describe("Owning user (Vectros UUID)."),
|
|
11864
|
+
scopes: z17.array(z17.string()).optional().describe(
|
|
10710
11865
|
'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.'
|
|
10711
11866
|
)
|
|
10712
11867
|
};
|
|
10713
11868
|
var folderCreate = ({ client, log }) => ({
|
|
10714
11869
|
name: "folder_create",
|
|
10715
11870
|
title: "Create a folder",
|
|
10716
|
-
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).",
|
|
10717
|
-
inputSchema:
|
|
11871
|
+
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 ONLY when you pass `slug` explicitly \u2014 omitting it derives a fresh, always-free slug on every call, so a retry creates a new sibling folder rather than matching the first. Requires the key to allow folders:c (and folders:r to receive the existing folder on a collision).",
|
|
11872
|
+
inputSchema: inputSchema17,
|
|
11873
|
+
// Idempotent ONLY when the caller supplies `slug` explicitly (see the doc comment above): an
|
|
11874
|
+
// omitted slug is derived through a collision-probing suffix loop that returns only a
|
|
11875
|
+
// freshly-proved-free value, so the idempotency check running after that derivation can never
|
|
11876
|
+
// match on the default path. `slug` is optional, so this is annotated for the less-safe default —
|
|
11877
|
+
// the same standard applied to record_create/document_ingest/record_batch_write's identical
|
|
11878
|
+
// optional-dedupe-key shape. (A prior version of this annotation claimed unconditional
|
|
11879
|
+
// idempotency, reasoning that the derived slug made this tool "genuinely structurally different"
|
|
11880
|
+
// from the optional-externalId tools — that reasoning was wrong: the derivation is unconditional,
|
|
11881
|
+
// but it is unconditionally NON-colliding by construction, which is the opposite property.)
|
|
11882
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10718
11883
|
handler: async (args) => {
|
|
10719
11884
|
try {
|
|
10720
11885
|
const folder = await client.folders.createFolder({
|
|
@@ -10738,16 +11903,16 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10738
11903
|
var folder_create_default = folderCreate;
|
|
10739
11904
|
|
|
10740
11905
|
// src/tools/folder_update.ts
|
|
10741
|
-
import { z as
|
|
10742
|
-
var
|
|
10743
|
-
id:
|
|
10744
|
-
name:
|
|
10745
|
-
description:
|
|
10746
|
-
userId:
|
|
10747
|
-
scopes:
|
|
11906
|
+
import { z as z18 } from "zod";
|
|
11907
|
+
var inputSchema18 = {
|
|
11908
|
+
id: z18.string().min(1, "id is required").describe("The Vectros folder id to update."),
|
|
11909
|
+
name: z18.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
11910
|
+
description: z18.string().optional().describe("New description. Omit to leave unchanged."),
|
|
11911
|
+
userId: z18.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11912
|
+
scopes: z18.array(z18.string()).optional().describe(
|
|
10748
11913
|
'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).'
|
|
10749
11914
|
),
|
|
10750
|
-
expectedVersion:
|
|
11915
|
+
expectedVersion: z18.number().int().optional().describe(
|
|
10751
11916
|
"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."
|
|
10752
11917
|
)
|
|
10753
11918
|
};
|
|
@@ -10755,7 +11920,11 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10755
11920
|
name: "folder_update",
|
|
10756
11921
|
title: "Update a folder",
|
|
10757
11922
|
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.",
|
|
10758
|
-
inputSchema:
|
|
11923
|
+
inputSchema: inputSchema18,
|
|
11924
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11925
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11926
|
+
// same state, so it is idempotent.
|
|
11927
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10759
11928
|
handler: async (args) => {
|
|
10760
11929
|
const id = args.id;
|
|
10761
11930
|
const name = args.name;
|
|
@@ -10782,15 +11951,18 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10782
11951
|
var folder_update_default = folderUpdate;
|
|
10783
11952
|
|
|
10784
11953
|
// src/tools/folder_delete.ts
|
|
10785
|
-
import { z as
|
|
10786
|
-
var
|
|
10787
|
-
id:
|
|
11954
|
+
import { z as z19 } from "zod";
|
|
11955
|
+
var inputSchema19 = {
|
|
11956
|
+
id: z19.string().min(1, "id is required").describe("The Vectros folder id to delete.")
|
|
10788
11957
|
};
|
|
10789
11958
|
var folderDelete = ({ client, log }) => ({
|
|
10790
11959
|
name: "folder_delete",
|
|
10791
11960
|
title: "Delete a folder",
|
|
10792
|
-
description:
|
|
10793
|
-
inputSchema:
|
|
11961
|
+
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.',
|
|
11962
|
+
inputSchema: inputSchema19,
|
|
11963
|
+
// Deletes. Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11964
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11965
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10794
11966
|
handler: async (args) => {
|
|
10795
11967
|
const id = args.id;
|
|
10796
11968
|
try {
|
|
@@ -10806,14 +11978,16 @@ var folderDelete = ({ client, log }) => ({
|
|
|
10806
11978
|
var folder_delete_default = folderDelete;
|
|
10807
11979
|
|
|
10808
11980
|
// src/tools/current_identity.ts
|
|
10809
|
-
var
|
|
11981
|
+
var inputSchema20 = {
|
|
10810
11982
|
// No args — current_identity describes the current credential.
|
|
10811
11983
|
};
|
|
10812
11984
|
var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
10813
11985
|
name: "current_identity",
|
|
10814
11986
|
title: "Current identity (tenant + principal scope)",
|
|
10815
11987
|
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.",
|
|
10816
|
-
inputSchema:
|
|
11988
|
+
inputSchema: inputSchema20,
|
|
11989
|
+
// A pure read (/v1/ping) — never creates, modifies, or deletes anything server-side.
|
|
11990
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10817
11991
|
handler: async () => {
|
|
10818
11992
|
try {
|
|
10819
11993
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -10829,7 +12003,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
|
10829
12003
|
var current_identity_default = currentIdentity;
|
|
10830
12004
|
|
|
10831
12005
|
// src/tools/document_ingest.ts
|
|
10832
|
-
import { z as
|
|
12006
|
+
import { z as z20 } from "zod";
|
|
10833
12007
|
import { readFile, realpath } from "fs/promises";
|
|
10834
12008
|
import { basename, extname, resolve, relative, isAbsolute } from "path";
|
|
10835
12009
|
var IngestPathError = class extends Error {
|
|
@@ -10904,37 +12078,37 @@ function inferMimeType(filePath) {
|
|
|
10904
12078
|
const ext = extname(filePath).toLowerCase();
|
|
10905
12079
|
return EXT_TO_MIME[ext] ?? "application/octet-stream";
|
|
10906
12080
|
}
|
|
10907
|
-
var
|
|
10908
|
-
title:
|
|
10909
|
-
indexMode:
|
|
12081
|
+
var inputSchema21 = {
|
|
12082
|
+
title: z20.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
|
|
12083
|
+
indexMode: z20.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
10910
12084
|
"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."
|
|
10911
12085
|
),
|
|
10912
|
-
externalId:
|
|
12086
|
+
externalId: z20.string().optional().describe(
|
|
10913
12087
|
'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.'
|
|
10914
12088
|
),
|
|
10915
|
-
upsert:
|
|
12089
|
+
upsert: z20.boolean().optional().describe(
|
|
10916
12090
|
"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)."
|
|
10917
12091
|
),
|
|
10918
|
-
schemaId:
|
|
12092
|
+
schemaId: z20.string().optional().describe(
|
|
10919
12093
|
"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."
|
|
10920
12094
|
),
|
|
10921
|
-
payload:
|
|
12095
|
+
payload: z20.record(z20.string(), z20.unknown()).optional().describe(
|
|
10922
12096
|
"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."
|
|
10923
12097
|
),
|
|
10924
12098
|
// Inline text mode (mutually exclusive with filePath):
|
|
10925
|
-
text:
|
|
10926
|
-
storeText:
|
|
12099
|
+
text: z20.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
|
|
12100
|
+
storeText: z20.boolean().optional().describe(
|
|
10927
12101
|
"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."
|
|
10928
12102
|
),
|
|
10929
12103
|
// File upload mode (mutually exclusive with text; stdio-transport-only):
|
|
10930
|
-
filePath:
|
|
12104
|
+
filePath: z20.string().min(1).optional().describe(
|
|
10931
12105
|
"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."
|
|
10932
12106
|
),
|
|
10933
|
-
fileType:
|
|
12107
|
+
fileType: z20.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
|
|
10934
12108
|
// Common (both modes):
|
|
10935
|
-
folderId:
|
|
10936
|
-
userId:
|
|
10937
|
-
scopes:
|
|
12109
|
+
folderId: z20.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
12110
|
+
userId: z20.string().optional().describe("Owning user ID. Optional."),
|
|
12111
|
+
scopes: z20.array(z20.string()).optional().describe(
|
|
10938
12112
|
"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."
|
|
10939
12113
|
)
|
|
10940
12114
|
};
|
|
@@ -10942,7 +12116,17 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10942
12116
|
name: "document_ingest",
|
|
10943
12117
|
title: "Ingest a new document (text body or file upload)",
|
|
10944
12118
|
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`.",
|
|
10945
|
-
inputSchema:
|
|
12119
|
+
inputSchema: inputSchema21,
|
|
12120
|
+
// Creates by default, idempotent ONLY when the caller supplies `externalId` (optional,
|
|
12121
|
+
// per the doc comment above) — re-ingest then returns the existing document rather than
|
|
12122
|
+
// duplicating it. `externalId` is not required, so annotated for the less-safe default
|
|
12123
|
+
// (omit it, and every call creates a new document), same standard applied to
|
|
12124
|
+
// record_create/record_batch_write's identical optional-externalId shape. `upsert:true`
|
|
12125
|
+
// is a further, real, named capability of this tool that OVERWRITES an existing
|
|
12126
|
+
// document's content and re-indexes it — that path is destructive to the prior body, so
|
|
12127
|
+
// this is flagged destructive rather than claiming create-only safety a caller can
|
|
12128
|
+
// invoke past.
|
|
12129
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
10946
12130
|
handler: async (args) => {
|
|
10947
12131
|
const title = args.title;
|
|
10948
12132
|
const text = args.text;
|
|
@@ -11053,7 +12237,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11053
12237
|
}
|
|
11054
12238
|
const putRes = await fetch(uploadUrl, {
|
|
11055
12239
|
method: "PUT",
|
|
11056
|
-
headers: { "Content-Type": fileType },
|
|
12240
|
+
headers: { "Content-Type": fileType, ...presignedUploadHeaders(upload) },
|
|
11057
12241
|
body: bytes
|
|
11058
12242
|
});
|
|
11059
12243
|
if (!putRes.ok) {
|
|
@@ -11092,31 +12276,38 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11092
12276
|
}
|
|
11093
12277
|
});
|
|
11094
12278
|
var document_ingest_default = documentIngest;
|
|
12279
|
+
function presignedUploadHeaders(response) {
|
|
12280
|
+
if (typeof response !== "object" || response === null) return {};
|
|
12281
|
+
const { requiredHeaderName, requiredHeaderValue } = response;
|
|
12282
|
+
if (typeof requiredHeaderName !== "string" || requiredHeaderName === "") return {};
|
|
12283
|
+
if (typeof requiredHeaderValue !== "string") return {};
|
|
12284
|
+
return { [requiredHeaderName]: requiredHeaderValue };
|
|
12285
|
+
}
|
|
11095
12286
|
|
|
11096
12287
|
// src/tools/lookup_principal.ts
|
|
11097
|
-
import { z as
|
|
12288
|
+
import { z as z21 } from "zod";
|
|
11098
12289
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
11099
12290
|
var MCP_MAX_LIMIT5 = 100;
|
|
11100
|
-
var
|
|
11101
|
-
kind:
|
|
12291
|
+
var inputSchema22 = {
|
|
12292
|
+
kind: z21.string().describe(
|
|
11102
12293
|
'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.'
|
|
11103
12294
|
),
|
|
11104
|
-
externalId:
|
|
12295
|
+
externalId: z21.string().optional().describe(
|
|
11105
12296
|
"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."
|
|
11106
12297
|
),
|
|
11107
|
-
contextId:
|
|
12298
|
+
contextId: z21.string().optional().describe(
|
|
11108
12299
|
"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."
|
|
11109
12300
|
),
|
|
11110
12301
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
11111
|
-
type:
|
|
11112
|
-
field:
|
|
11113
|
-
value:
|
|
11114
|
-
from:
|
|
11115
|
-
to:
|
|
11116
|
-
prefix:
|
|
11117
|
-
order:
|
|
11118
|
-
startFrom:
|
|
11119
|
-
limit:
|
|
12302
|
+
type: z21.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
|
|
12303
|
+
field: z21.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
|
|
12304
|
+
value: z21.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
|
|
12305
|
+
from: z21.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
|
|
12306
|
+
to: z21.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
12307
|
+
prefix: z21.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
12308
|
+
order: z21.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
|
|
12309
|
+
startFrom: z21.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
12310
|
+
limit: z21.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
|
|
11120
12311
|
`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\`.`
|
|
11121
12312
|
)
|
|
11122
12313
|
};
|
|
@@ -11124,7 +12315,9 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11124
12315
|
name: "lookup_principal",
|
|
11125
12316
|
title: "Look up a user identity or a namespaced identity entity",
|
|
11126
12317
|
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.",
|
|
11127
|
-
inputSchema:
|
|
12318
|
+
inputSchema: inputSchema22,
|
|
12319
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
12320
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
11128
12321
|
handler: async (args) => {
|
|
11129
12322
|
const kind = args.kind;
|
|
11130
12323
|
const isUser = kind === "user";
|
|
@@ -11198,17 +12391,19 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11198
12391
|
var lookup_principal_default = lookupPrincipal;
|
|
11199
12392
|
|
|
11200
12393
|
// src/tools/version_history.ts
|
|
11201
|
-
import { z as
|
|
11202
|
-
var
|
|
11203
|
-
resourceType:
|
|
11204
|
-
id:
|
|
11205
|
-
startFrom:
|
|
12394
|
+
import { z as z22 } from "zod";
|
|
12395
|
+
var inputSchema23 = {
|
|
12396
|
+
resourceType: z22.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
|
|
12397
|
+
id: z22.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
|
|
12398
|
+
startFrom: z22.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
|
|
11206
12399
|
};
|
|
11207
12400
|
var versionHistory = ({ client, log }) => ({
|
|
11208
12401
|
name: "version_history",
|
|
11209
12402
|
title: "Version history (record or document)",
|
|
11210
12403
|
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.",
|
|
11211
|
-
inputSchema:
|
|
12404
|
+
inputSchema: inputSchema23,
|
|
12405
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
12406
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
11212
12407
|
handler: async (args) => {
|
|
11213
12408
|
const resourceType = args.resourceType;
|
|
11214
12409
|
const id = args.id;
|
|
@@ -11237,6 +12432,7 @@ var TOOL_NAMES = [
|
|
|
11237
12432
|
"record_get",
|
|
11238
12433
|
"record_batch_get",
|
|
11239
12434
|
"record_create",
|
|
12435
|
+
"record_batch_write",
|
|
11240
12436
|
"record_update",
|
|
11241
12437
|
"record_delete",
|
|
11242
12438
|
"rag_ask",
|
|
@@ -11263,6 +12459,7 @@ var ALL_TOOL_FACTORIES = {
|
|
|
11263
12459
|
record_get: record_get_default,
|
|
11264
12460
|
record_batch_get: record_batch_get_default,
|
|
11265
12461
|
record_create: record_create_default,
|
|
12462
|
+
record_batch_write: record_batch_write_default,
|
|
11266
12463
|
record_update: record_update_default,
|
|
11267
12464
|
record_delete: record_delete_default,
|
|
11268
12465
|
rag_ask: rag_ask_default,
|
|
@@ -11322,7 +12519,7 @@ var ALL_RESOURCE_FACTORIES = {
|
|
|
11322
12519
|
};
|
|
11323
12520
|
|
|
11324
12521
|
// src/zod-to-json-schema.ts
|
|
11325
|
-
import { z as
|
|
12522
|
+
import { z as z23 } from "zod";
|
|
11326
12523
|
function zodShapeToJsonSchema(shape) {
|
|
11327
12524
|
const properties = {};
|
|
11328
12525
|
const required = [];
|
|
@@ -11337,40 +12534,40 @@ function zodShapeToJsonSchema(shape) {
|
|
|
11337
12534
|
function zodTypeToJsonSchema(schema) {
|
|
11338
12535
|
const description = schema.description;
|
|
11339
12536
|
let current = schema;
|
|
11340
|
-
while (current instanceof
|
|
12537
|
+
while (current instanceof z23.ZodOptional || current instanceof z23.ZodDefault || current instanceof z23.ZodNullable) {
|
|
11341
12538
|
current = current._def.innerType;
|
|
11342
12539
|
}
|
|
11343
12540
|
const base = description ? { description } : {};
|
|
11344
|
-
if (current instanceof
|
|
12541
|
+
if (current instanceof z23.ZodString) {
|
|
11345
12542
|
return { ...base, type: "string" };
|
|
11346
12543
|
}
|
|
11347
|
-
if (current instanceof
|
|
12544
|
+
if (current instanceof z23.ZodNumber) {
|
|
11348
12545
|
return { ...base, type: "number" };
|
|
11349
12546
|
}
|
|
11350
|
-
if (current instanceof
|
|
12547
|
+
if (current instanceof z23.ZodBoolean) {
|
|
11351
12548
|
return { ...base, type: "boolean" };
|
|
11352
12549
|
}
|
|
11353
|
-
if (current instanceof
|
|
12550
|
+
if (current instanceof z23.ZodEnum) {
|
|
11354
12551
|
return {
|
|
11355
12552
|
...base,
|
|
11356
12553
|
type: "string",
|
|
11357
12554
|
enum: current.options
|
|
11358
12555
|
};
|
|
11359
12556
|
}
|
|
11360
|
-
if (current instanceof
|
|
12557
|
+
if (current instanceof z23.ZodArray) {
|
|
11361
12558
|
return {
|
|
11362
12559
|
...base,
|
|
11363
12560
|
type: "array",
|
|
11364
12561
|
items: zodTypeToJsonSchema(current.element)
|
|
11365
12562
|
};
|
|
11366
12563
|
}
|
|
11367
|
-
if (current instanceof
|
|
12564
|
+
if (current instanceof z23.ZodObject) {
|
|
11368
12565
|
return {
|
|
11369
12566
|
...base,
|
|
11370
12567
|
...zodShapeToJsonSchema(current.shape)
|
|
11371
12568
|
};
|
|
11372
12569
|
}
|
|
11373
|
-
if (current instanceof
|
|
12570
|
+
if (current instanceof z23.ZodRecord) {
|
|
11374
12571
|
const valueType = current._def.valueType;
|
|
11375
12572
|
return {
|
|
11376
12573
|
...base,
|
|
@@ -11484,7 +12681,12 @@ var VectrosMCPServer = class {
|
|
|
11484
12681
|
// MCP client (a well-behaved client rejects an unknown key before the call).
|
|
11485
12682
|
// The server enforces it too (z.object(...).strict() below) so a raw JSON-RPC
|
|
11486
12683
|
// call that skips client validation is still rejected — belt and suspenders.
|
|
11487
|
-
inputSchema: { ...zodShapeToJsonSchema(t.inputSchema), additionalProperties: false }
|
|
12684
|
+
inputSchema: { ...zodShapeToJsonSchema(t.inputSchema), additionalProperties: false },
|
|
12685
|
+
// Forwarded from the tool's own definition, not hand-copied here: adding an
|
|
12686
|
+
// annotation to a tool factory does nothing for a client unless it also reaches
|
|
12687
|
+
// this emitted list — the actual `tools/list` response a host reads, not the
|
|
12688
|
+
// source that builds it.
|
|
12689
|
+
...t.annotations ? { annotations: t.annotations } : {}
|
|
11488
12690
|
}))
|
|
11489
12691
|
})
|
|
11490
12692
|
);
|
|
@@ -11494,7 +12696,7 @@ var VectrosMCPServer = class {
|
|
|
11494
12696
|
if (!tool) {
|
|
11495
12697
|
result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
|
|
11496
12698
|
} else {
|
|
11497
|
-
const parsed =
|
|
12699
|
+
const parsed = z24.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
|
|
11498
12700
|
if (!parsed.success) {
|
|
11499
12701
|
result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
|
|
11500
12702
|
} else {
|