@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/cli.js
CHANGED
|
@@ -60,6 +60,7 @@ __export(api_exports, {
|
|
|
60
60
|
FieldDef: () => FieldDef,
|
|
61
61
|
FileUploadRequest: () => FileUploadRequest,
|
|
62
62
|
ForbiddenError: () => ForbiddenError,
|
|
63
|
+
GatewayTimeoutError: () => GatewayTimeoutError,
|
|
63
64
|
IdentityLookupRequest: () => IdentityLookupRequest,
|
|
64
65
|
IndexFailure: () => IndexFailure,
|
|
65
66
|
InternalServerError: () => InternalServerError,
|
|
@@ -84,9 +85,12 @@ __export(api_exports, {
|
|
|
84
85
|
SearchRequest: () => SearchRequest,
|
|
85
86
|
SearchResult: () => SearchResult,
|
|
86
87
|
SearchResultsEvent: () => SearchResultsEvent,
|
|
88
|
+
ServiceUnavailableError: () => ServiceUnavailableError,
|
|
87
89
|
TooManyRequestsError: () => TooManyRequestsError,
|
|
90
|
+
TriggerFailureResponse: () => TriggerFailureResponse,
|
|
88
91
|
TruncationWarningEvent: () => TruncationWarningEvent,
|
|
89
92
|
UnauthorizedError: () => UnauthorizedError,
|
|
93
|
+
UnprocessableEntityError: () => UnprocessableEntityError,
|
|
90
94
|
UserExistsResponse: () => UserExistsResponse,
|
|
91
95
|
UserRequest: () => UserRequest,
|
|
92
96
|
UserResponse: () => UserResponse,
|
|
@@ -98,7 +102,9 @@ __export(api_exports, {
|
|
|
98
102
|
inference: () => inference_exports,
|
|
99
103
|
records: () => records_exports,
|
|
100
104
|
schemas: () => schemas_exports,
|
|
101
|
-
|
|
105
|
+
scripts: () => scripts_exports,
|
|
106
|
+
search: () => search_exports,
|
|
107
|
+
triggers: () => triggers_exports
|
|
102
108
|
});
|
|
103
109
|
var toJson = (value, replacer, space) => {
|
|
104
110
|
return JSON.stringify(value, replacer, space);
|
|
@@ -218,6 +224,21 @@ var ForbiddenError = class extends VectrosError {
|
|
|
218
224
|
this.name = this.constructor.name;
|
|
219
225
|
}
|
|
220
226
|
};
|
|
227
|
+
var GatewayTimeoutError = class extends VectrosError {
|
|
228
|
+
constructor(body, rawResponse) {
|
|
229
|
+
super({
|
|
230
|
+
message: "GatewayTimeoutError",
|
|
231
|
+
statusCode: 504,
|
|
232
|
+
body,
|
|
233
|
+
rawResponse
|
|
234
|
+
});
|
|
235
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
236
|
+
if (Error.captureStackTrace) {
|
|
237
|
+
Error.captureStackTrace(this, this.constructor);
|
|
238
|
+
}
|
|
239
|
+
this.name = this.constructor.name;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
221
242
|
var InternalServerError = class extends VectrosError {
|
|
222
243
|
constructor(body, rawResponse) {
|
|
223
244
|
super({
|
|
@@ -278,6 +299,21 @@ var PaymentRequiredError = class extends VectrosError {
|
|
|
278
299
|
this.name = this.constructor.name;
|
|
279
300
|
}
|
|
280
301
|
};
|
|
302
|
+
var ServiceUnavailableError = class extends VectrosError {
|
|
303
|
+
constructor(body, rawResponse) {
|
|
304
|
+
super({
|
|
305
|
+
message: "ServiceUnavailableError",
|
|
306
|
+
statusCode: 503,
|
|
307
|
+
body,
|
|
308
|
+
rawResponse
|
|
309
|
+
});
|
|
310
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
311
|
+
if (Error.captureStackTrace) {
|
|
312
|
+
Error.captureStackTrace(this, this.constructor);
|
|
313
|
+
}
|
|
314
|
+
this.name = this.constructor.name;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
281
317
|
var TooManyRequestsError = class extends VectrosError {
|
|
282
318
|
constructor(body, rawResponse) {
|
|
283
319
|
super({
|
|
@@ -308,6 +344,21 @@ var UnauthorizedError = class extends VectrosError {
|
|
|
308
344
|
this.name = this.constructor.name;
|
|
309
345
|
}
|
|
310
346
|
};
|
|
347
|
+
var UnprocessableEntityError = class extends VectrosError {
|
|
348
|
+
constructor(body, rawResponse) {
|
|
349
|
+
super({
|
|
350
|
+
message: "UnprocessableEntityError",
|
|
351
|
+
statusCode: 422,
|
|
352
|
+
body,
|
|
353
|
+
rawResponse
|
|
354
|
+
});
|
|
355
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
356
|
+
if (Error.captureStackTrace) {
|
|
357
|
+
Error.captureStackTrace(this, this.constructor);
|
|
358
|
+
}
|
|
359
|
+
this.name = this.constructor.name;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
311
362
|
var auth_exports = {};
|
|
312
363
|
var ErasureRequest;
|
|
313
364
|
((ErasureRequest2) => {
|
|
@@ -397,6 +448,7 @@ var LookupRecordsRequestOrder = {
|
|
|
397
448
|
Desc: "desc"
|
|
398
449
|
};
|
|
399
450
|
var schemas_exports = {};
|
|
451
|
+
var scripts_exports = {};
|
|
400
452
|
var SearchRequest;
|
|
401
453
|
((SearchRequest2) => {
|
|
402
454
|
SearchRequest2.Mode = {
|
|
@@ -422,6 +474,7 @@ var search_exports = {};
|
|
|
422
474
|
__export(search_exports, {
|
|
423
475
|
SearchRequest: () => SearchRequest
|
|
424
476
|
});
|
|
477
|
+
var triggers_exports = {};
|
|
425
478
|
var AccessProfileRequest;
|
|
426
479
|
((AccessProfileRequest2) => {
|
|
427
480
|
AccessProfileRequest2.Status = {
|
|
@@ -451,7 +504,9 @@ var BatchWriteResult;
|
|
|
451
504
|
Created: "created",
|
|
452
505
|
Updated: "updated",
|
|
453
506
|
Conflict: "conflict",
|
|
454
|
-
Invalid: "invalid"
|
|
507
|
+
Invalid: "invalid",
|
|
508
|
+
Forbidden: "forbidden",
|
|
509
|
+
NotCommitted: "not_committed"
|
|
455
510
|
};
|
|
456
511
|
})(BatchWriteResult || (BatchWriteResult = {}));
|
|
457
512
|
var ChatMessage;
|
|
@@ -755,13 +810,23 @@ var SearchResultsEvent;
|
|
|
755
810
|
SearchResults: "search_results"
|
|
756
811
|
};
|
|
757
812
|
})(SearchResultsEvent || (SearchResultsEvent = {}));
|
|
813
|
+
var TriggerFailureResponse;
|
|
814
|
+
((TriggerFailureResponse2) => {
|
|
815
|
+
TriggerFailureResponse2.Event = {
|
|
816
|
+
Create: "CREATE",
|
|
817
|
+
Update: "UPDATE",
|
|
818
|
+
Delete: "DELETE"
|
|
819
|
+
};
|
|
820
|
+
})(TriggerFailureResponse || (TriggerFailureResponse = {}));
|
|
758
821
|
var TruncationWarningEvent;
|
|
759
822
|
((TruncationWarningEvent2) => {
|
|
760
823
|
TruncationWarningEvent2.Event = {
|
|
761
824
|
TruncationWarning: "truncation_warning"
|
|
762
825
|
};
|
|
763
826
|
TruncationWarningEvent2.Reason = {
|
|
764
|
-
ContextWindowBudget: "context_window_budget"
|
|
827
|
+
ContextWindowBudget: "context_window_budget",
|
|
828
|
+
NoGroundableContent: "no_groundable_content",
|
|
829
|
+
ContextWindowBudgetAndNoContent: "context_window_budget_and_no_content"
|
|
765
830
|
};
|
|
766
831
|
})(TruncationWarningEvent || (TruncationWarningEvent = {}));
|
|
767
832
|
var UserExistsResponse;
|
|
@@ -776,8 +841,7 @@ var UserRequest;
|
|
|
776
841
|
((UserRequest2) => {
|
|
777
842
|
UserRequest2.Status = {
|
|
778
843
|
Active: "ACTIVE",
|
|
779
|
-
Suspended: "SUSPENDED"
|
|
780
|
-
Pending: "PENDING"
|
|
844
|
+
Suspended: "SUSPENDED"
|
|
781
845
|
};
|
|
782
846
|
UserRequest2.Type = {
|
|
783
847
|
Human: "HUMAN",
|
|
@@ -2245,6 +2309,16 @@ function mergeHeaders(...headersArray) {
|
|
|
2245
2309
|
}
|
|
2246
2310
|
return result;
|
|
2247
2311
|
}
|
|
2312
|
+
function mergeOnlyDefinedHeaders(...headersArray) {
|
|
2313
|
+
const result = {};
|
|
2314
|
+
for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
|
|
2315
|
+
const insensitiveKey = key.toLowerCase();
|
|
2316
|
+
if (value != null) {
|
|
2317
|
+
result[insensitiveKey] = value;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
return result;
|
|
2321
|
+
}
|
|
2248
2322
|
function normalizeClientOptions(options) {
|
|
2249
2323
|
const headers = mergeHeaders(
|
|
2250
2324
|
{
|
|
@@ -2515,7 +2589,7 @@ var AuthClient = class {
|
|
|
2515
2589
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
|
|
2516
2590
|
}
|
|
2517
2591
|
/**
|
|
2518
|
-
* 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.
|
|
2592
|
+
* 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.
|
|
2519
2593
|
*
|
|
2520
2594
|
* @param {Vectros.CreateScopedKeyRequest} request
|
|
2521
2595
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2523,6 +2597,7 @@ var AuthClient = class {
|
|
|
2523
2597
|
* @throws {@link Vectros.BadRequestError}
|
|
2524
2598
|
* @throws {@link Vectros.ForbiddenError}
|
|
2525
2599
|
* @throws {@link Vectros.NotFoundError}
|
|
2600
|
+
* @throws {@link Vectros.ConflictError}
|
|
2526
2601
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
2527
2602
|
*
|
|
2528
2603
|
* @example
|
|
@@ -2571,6 +2646,8 @@ var AuthClient = class {
|
|
|
2571
2646
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2572
2647
|
case 404:
|
|
2573
2648
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
2649
|
+
case 409:
|
|
2650
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
2574
2651
|
case 429:
|
|
2575
2652
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
2576
2653
|
default:
|
|
@@ -2982,7 +3059,7 @@ var AuthClient = class {
|
|
|
2982
3059
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts");
|
|
2983
3060
|
}
|
|
2984
3061
|
/**
|
|
2985
|
-
* 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.
|
|
3062
|
+
* 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.
|
|
2986
3063
|
*
|
|
2987
3064
|
* @param {Vectros.CreateAppContextRequest} request
|
|
2988
3065
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3348,6 +3425,7 @@ var AuthClient = class {
|
|
|
3348
3425
|
*
|
|
3349
3426
|
* @throws {@link Vectros.ForbiddenError}
|
|
3350
3427
|
* @throws {@link Vectros.NotFoundError}
|
|
3428
|
+
* @throws {@link Vectros.ConflictError}
|
|
3351
3429
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
3352
3430
|
*
|
|
3353
3431
|
* @example
|
|
@@ -3390,6 +3468,8 @@ var AuthClient = class {
|
|
|
3390
3468
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
3391
3469
|
case 404:
|
|
3392
3470
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
3471
|
+
case 409:
|
|
3472
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
3393
3473
|
case 429:
|
|
3394
3474
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
3395
3475
|
default:
|
|
@@ -3466,7 +3546,7 @@ var AuthClient = class {
|
|
|
3466
3546
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts/{contextId}");
|
|
3467
3547
|
}
|
|
3468
3548
|
/**
|
|
3469
|
-
* Updates the name and/or
|
|
3549
|
+
* 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.
|
|
3470
3550
|
*
|
|
3471
3551
|
* @param {Vectros.UpdateAppContextRequest} request
|
|
3472
3552
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3534,7 +3614,7 @@ var AuthClient = class {
|
|
|
3534
3614
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/app-contexts/{contextId}");
|
|
3535
3615
|
}
|
|
3536
3616
|
/**
|
|
3537
|
-
* Permanently deletes an app context and everything in it — every record, document, folder, schema, role,
|
|
3617
|
+
* 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.
|
|
3538
3618
|
*
|
|
3539
3619
|
* @param {Vectros.DeleteAppContextRequest} request
|
|
3540
3620
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3948,7 +4028,7 @@ var AuthClient = class {
|
|
|
3948
4028
|
);
|
|
3949
4029
|
}
|
|
3950
4030
|
/**
|
|
3951
|
-
* Returns full usage detail for the requested calendar month, broken down by category (search, documents, and
|
|
4031
|
+
* 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`.
|
|
3952
4032
|
*
|
|
3953
4033
|
* @param {Vectros.GetUsageRequest} request
|
|
3954
4034
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4069,7 +4149,7 @@ var AuthClient = class {
|
|
|
4069
4149
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
|
|
4070
4150
|
}
|
|
4071
4151
|
/**
|
|
4072
|
-
* 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.
|
|
4152
|
+
* 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.
|
|
4073
4153
|
*
|
|
4074
4154
|
* @param {Vectros.IssuerUpdateRequest} request
|
|
4075
4155
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4136,7 +4216,7 @@ var AuthClient = class {
|
|
|
4136
4216
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/auth/issuers/{issuerId}");
|
|
4137
4217
|
}
|
|
4138
4218
|
/**
|
|
4139
|
-
* 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.
|
|
4219
|
+
* 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.
|
|
4140
4220
|
*
|
|
4141
4221
|
* @param {Vectros.DeleteIssuerRequest} request
|
|
4142
4222
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4262,7 +4342,7 @@ var AuthClient = class {
|
|
|
4262
4342
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
|
|
4263
4343
|
}
|
|
4264
4344
|
/**
|
|
4265
|
-
* 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`.
|
|
4345
|
+
* 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.
|
|
4266
4346
|
*
|
|
4267
4347
|
* @param {Vectros.IssuerRequest} request
|
|
4268
4348
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5760,7 +5840,7 @@ var DocumentsClient = class {
|
|
|
5760
5840
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents/{id}/versions");
|
|
5761
5841
|
}
|
|
5762
5842
|
/**
|
|
5763
|
-
* 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
|
|
5843
|
+
* 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.
|
|
5764
5844
|
*
|
|
5765
5845
|
* @param {Vectros.FileUploadRequest} request
|
|
5766
5846
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6082,7 +6162,7 @@ var FoldersClient = class {
|
|
|
6082
6162
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/folders/{id}");
|
|
6083
6163
|
}
|
|
6084
6164
|
/**
|
|
6085
|
-
* Permanently deletes a folder. The folder must be empty
|
|
6165
|
+
* Permanently deletes a folder. The folder must be empty — it must contain no documents, no records, and no sub-folders — and must not be protected. Your context's root folder is protected and cannot be deleted. Requires the `folders:d` scope.
|
|
6086
6166
|
*
|
|
6087
6167
|
* @param {Vectros.DeleteFolderRequest} request
|
|
6088
6168
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -6491,11 +6571,12 @@ var IdentityClient = class {
|
|
|
6491
6571
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6492
6572
|
}
|
|
6493
6573
|
/**
|
|
6494
|
-
* Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Requires the `entities:u:<namespace>` scope.
|
|
6574
|
+
* Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Supplying a different `externalId` re-points the entity's identifier; it must still be unused in this namespace and app context. Requires the `entities:u:<namespace>` scope.
|
|
6495
6575
|
*
|
|
6496
6576
|
* @param {Vectros.UpdateEntityRequest} request
|
|
6497
6577
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6498
6578
|
*
|
|
6579
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6499
6580
|
* @throws {@link Vectros.NotFoundError}
|
|
6500
6581
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6501
6582
|
*
|
|
@@ -6545,6 +6626,8 @@ var IdentityClient = class {
|
|
|
6545
6626
|
}
|
|
6546
6627
|
if (_response.error.reason === "status-code") {
|
|
6547
6628
|
switch (_response.error.statusCode) {
|
|
6629
|
+
case 400:
|
|
6630
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6548
6631
|
case 404:
|
|
6549
6632
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6550
6633
|
case 429:
|
|
@@ -7523,7 +7606,7 @@ var IdentityClient = class {
|
|
|
7523
7606
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/exists-by-email");
|
|
7524
7607
|
}
|
|
7525
7608
|
/**
|
|
7526
|
-
* Returns the audit trail of changes to a user, most recent first. Identity history is always recorded
|
|
7609
|
+
* 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.
|
|
7527
7610
|
*
|
|
7528
7611
|
* @param {Vectros.GetUserVersionsRequest} request
|
|
7529
7612
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -7769,7 +7852,7 @@ var InferenceClient = class {
|
|
|
7769
7852
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/documents/{id}/ask");
|
|
7770
7853
|
}
|
|
7771
7854
|
/**
|
|
7772
|
-
* Runs hybrid search over your indexed content, then streams a model answer grounded in the top results. The SSE stream emits a `search_results` event first (carrying the matched results and their metadata), an optional `truncation_warning` if
|
|
7855
|
+
* Runs hybrid search over your indexed content, then streams a model answer grounded in the top results. The SSE stream emits a `search_results` event first (carrying the matched results and their metadata), an optional `truncation_warning` if some retrieved results were dropped before the prompt was built — either because they didn't fit the model's context window or because a result had no groundable text to include — then `content_delta` chunks, and finally a terminal `done` event. Requires the `inference:r` scope.
|
|
7773
7856
|
*/
|
|
7774
7857
|
ragInference(request, requestOptions) {
|
|
7775
7858
|
return HttpResponsePromise.fromPromise(this.__ragInference(request, requestOptions));
|
|
@@ -7964,14 +8047,18 @@ var RecordsClient = class {
|
|
|
7964
8047
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup/batch");
|
|
7965
8048
|
}
|
|
7966
8049
|
/**
|
|
7967
|
-
*
|
|
8050
|
+
* 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.
|
|
8051
|
+
*
|
|
8052
|
+
* `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.
|
|
8053
|
+
*
|
|
8054
|
+
* The response is HTTP 200 whenever the batch was processed at all — including when every item failed — so always inspect `results` rather than relying on the status code. Match each result to the item you sent using its `index`. Requires the `records:c` scope.
|
|
7968
8055
|
*
|
|
7969
8056
|
* @param {Vectros.BatchWriteRequest} request
|
|
7970
8057
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
7971
8058
|
*
|
|
8059
|
+
* @throws {@link Vectros.BadRequestError}
|
|
7972
8060
|
* @throws {@link Vectros.ForbiddenError}
|
|
7973
8061
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
7974
|
-
* @throws {@link Vectros.NotImplementedError}
|
|
7975
8062
|
*
|
|
7976
8063
|
* @example
|
|
7977
8064
|
* await client.records.batchWriteRecords()
|
|
@@ -7980,6 +8067,11 @@ var RecordsClient = class {
|
|
|
7980
8067
|
return HttpResponsePromise.fromPromise(this.__batchWriteRecords(request, requestOptions));
|
|
7981
8068
|
}
|
|
7982
8069
|
async __batchWriteRecords(request = {}, requestOptions) {
|
|
8070
|
+
const { upsert, allowClear, ..._body } = request;
|
|
8071
|
+
const _queryParams = {
|
|
8072
|
+
upsert,
|
|
8073
|
+
allowClear
|
|
8074
|
+
};
|
|
7983
8075
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7984
8076
|
const _headers = mergeHeaders(
|
|
7985
8077
|
_authRequest.headers,
|
|
@@ -7994,9 +8086,9 @@ var RecordsClient = class {
|
|
|
7994
8086
|
method: "POST",
|
|
7995
8087
|
headers: _headers,
|
|
7996
8088
|
contentType: "application/json",
|
|
7997
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
8089
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
7998
8090
|
requestType: "json",
|
|
7999
|
-
body:
|
|
8091
|
+
body: _body,
|
|
8000
8092
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
8001
8093
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
8002
8094
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -8008,12 +8100,12 @@ var RecordsClient = class {
|
|
|
8008
8100
|
}
|
|
8009
8101
|
if (_response.error.reason === "status-code") {
|
|
8010
8102
|
switch (_response.error.statusCode) {
|
|
8103
|
+
case 400:
|
|
8104
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
8011
8105
|
case 403:
|
|
8012
8106
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8013
8107
|
case 429:
|
|
8014
8108
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8015
|
-
case 501:
|
|
8016
|
-
throw new NotImplementedError(_response.error.body, _response.rawResponse);
|
|
8017
8109
|
default:
|
|
8018
8110
|
throw new VectrosError({
|
|
8019
8111
|
statusCode: _response.error.statusCode,
|
|
@@ -8584,7 +8676,7 @@ var RecordsClient = class {
|
|
|
8584
8676
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/lookup");
|
|
8585
8677
|
}
|
|
8586
8678
|
/**
|
|
8587
|
-
* 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.
|
|
8679
|
+
* 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.
|
|
8588
8680
|
*
|
|
8589
8681
|
* @param {Vectros.GetRecordTombstoneRequest} request
|
|
8590
8682
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8916,7 +9008,7 @@ var SchemasClient = class {
|
|
|
8916
9008
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}");
|
|
8917
9009
|
}
|
|
8918
9010
|
/**
|
|
8919
|
-
* Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Requires the `schemas:u` scope.
|
|
9011
|
+
* Updates a record schema. Fields you omit are preserved; `typeName` is immutable and cannot be changed. Collection fields (`fields`, `lookupFields`, `renderHints`, `capabilities`) are replaced in full when supplied. Because `capabilities` is replaced in full, omitting `triggersEnabled` clears it — the request is refused with 409 if that would disable triggers while trigger rules still fire off this schema, so delete those rules first. Requires the `schemas:u` scope.
|
|
8920
9012
|
*
|
|
8921
9013
|
* @param {Vectros.UpdateSchemaRequest} request
|
|
8922
9014
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8924,6 +9016,7 @@ var SchemasClient = class {
|
|
|
8924
9016
|
* @throws {@link Vectros.BadRequestError}
|
|
8925
9017
|
* @throws {@link Vectros.ForbiddenError}
|
|
8926
9018
|
* @throws {@link Vectros.NotFoundError}
|
|
9019
|
+
* @throws {@link Vectros.ConflictError}
|
|
8927
9020
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
8928
9021
|
*
|
|
8929
9022
|
* @example
|
|
@@ -8975,6 +9068,8 @@ var SchemasClient = class {
|
|
|
8975
9068
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
8976
9069
|
case 404:
|
|
8977
9070
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9071
|
+
case 409:
|
|
9072
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
8978
9073
|
case 429:
|
|
8979
9074
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
8980
9075
|
default:
|
|
@@ -8988,7 +9083,7 @@ var SchemasClient = class {
|
|
|
8988
9083
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/schemas/{id}");
|
|
8989
9084
|
}
|
|
8990
9085
|
/**
|
|
8991
|
-
* Permanently deletes a record schema. The request is refused with 409 if records of this type still exist — delete those records first, since every record must reference a live schema. A lineage base (a schema other schemas declare `basedOn`) also cannot be deleted while any such variant still exists — delete the variant schema(s) first. Requires the `schemas:d` scope.
|
|
9086
|
+
* 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.
|
|
8992
9087
|
*
|
|
8993
9088
|
* @param {Vectros.DeleteSchemaRequest} request
|
|
8994
9089
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -9110,46 +9205,70 @@ var SchemasClient = class {
|
|
|
9110
9205
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/schemas/{id}/versions");
|
|
9111
9206
|
}
|
|
9112
9207
|
};
|
|
9113
|
-
var
|
|
9208
|
+
var ScriptsClient = class {
|
|
9114
9209
|
constructor(options) {
|
|
9115
9210
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
9116
9211
|
}
|
|
9117
9212
|
/**
|
|
9118
|
-
* Runs a
|
|
9213
|
+
* Runs a script you previously pushed to `POST /v1/scripts`, under your own credential, and returns what it returned. Every write the script makes is buffered and committed as ONE transaction after the script finishes: either all of them land or none do, and the response is sent only after they have committed — so everything in `result` is committed state or the script's own computation over it. On any failure the body is the standard error envelope and nothing the script staged is committed: its rows are written only when the transaction commits, and a document body or a large payload is DECIDED at that point and WRITTEN to storage only after the commit, so an aborted execution leaves nothing behind. The one residual sits after a successful commit, outside this response: if storing a body fails then, the row exists and the body does not until the platform's repair lands — so a `200` guarantees the rows, and a document's text should be read before it is relied on.
|
|
9119
9214
|
*
|
|
9120
|
-
*
|
|
9121
|
-
*
|
|
9215
|
+
* **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.
|
|
9216
|
+
*
|
|
9217
|
+
* **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.
|
|
9218
|
+
*
|
|
9219
|
+
* **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`).
|
|
9220
|
+
*
|
|
9221
|
+
* **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()`.
|
|
9222
|
+
*
|
|
9223
|
+
* **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.
|
|
9224
|
+
*
|
|
9225
|
+
* @param {Vectros.ScriptExecuteRequest} request
|
|
9226
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9122
9227
|
*
|
|
9123
9228
|
* @throws {@link Vectros.BadRequestError}
|
|
9229
|
+
* @throws {@link Vectros.PaymentRequiredError}
|
|
9124
9230
|
* @throws {@link Vectros.ForbiddenError}
|
|
9231
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9232
|
+
* @throws {@link Vectros.ConflictError}
|
|
9233
|
+
* @throws {@link Vectros.ContentTooLargeError}
|
|
9234
|
+
* @throws {@link Vectros.UnprocessableEntityError}
|
|
9125
9235
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
9236
|
+
* @throws {@link Vectros.InternalServerError}
|
|
9237
|
+
* @throws {@link Vectros.ServiceUnavailableError}
|
|
9238
|
+
* @throws {@link Vectros.GatewayTimeoutError}
|
|
9126
9239
|
*
|
|
9127
9240
|
* @example
|
|
9128
|
-
* await client.
|
|
9129
|
-
*
|
|
9241
|
+
* await client.scripts.executeScript({
|
|
9242
|
+
* "Idempotency-Key": "order-8412-attempt",
|
|
9243
|
+
* scriptRef: {
|
|
9244
|
+
* name: "notify-assignee",
|
|
9245
|
+
* version: "3"
|
|
9246
|
+
* }
|
|
9130
9247
|
* })
|
|
9131
9248
|
*/
|
|
9132
|
-
|
|
9133
|
-
return HttpResponsePromise.fromPromise(this.
|
|
9249
|
+
executeScript(request, requestOptions) {
|
|
9250
|
+
return HttpResponsePromise.fromPromise(this.__executeScript(request, requestOptions));
|
|
9134
9251
|
}
|
|
9135
|
-
async
|
|
9252
|
+
async __executeScript(request, requestOptions) {
|
|
9253
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
9136
9254
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9137
9255
|
const _headers = mergeHeaders(
|
|
9138
9256
|
_authRequest.headers,
|
|
9139
9257
|
this._options?.headers,
|
|
9258
|
+
mergeOnlyDefinedHeaders({ "Idempotency-Key": idempotencyKey }),
|
|
9140
9259
|
requestOptions?.headers
|
|
9141
9260
|
);
|
|
9142
9261
|
const _response = await fetcher({
|
|
9143
9262
|
url: url_exports.join(
|
|
9144
9263
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9145
|
-
"v1/
|
|
9264
|
+
"v1/scripts/execute"
|
|
9146
9265
|
),
|
|
9147
9266
|
method: "POST",
|
|
9148
9267
|
headers: _headers,
|
|
9149
9268
|
contentType: "application/json",
|
|
9150
9269
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9151
9270
|
requestType: "json",
|
|
9152
|
-
body:
|
|
9271
|
+
body: _body,
|
|
9153
9272
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9154
9273
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9155
9274
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -9163,10 +9282,26 @@ var SearchClient = class {
|
|
|
9163
9282
|
switch (_response.error.statusCode) {
|
|
9164
9283
|
case 400:
|
|
9165
9284
|
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9285
|
+
case 402:
|
|
9286
|
+
throw new PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
9166
9287
|
case 403:
|
|
9167
9288
|
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9289
|
+
case 404:
|
|
9290
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9291
|
+
case 409:
|
|
9292
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9293
|
+
case 413:
|
|
9294
|
+
throw new ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
9295
|
+
case 422:
|
|
9296
|
+
throw new UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
9168
9297
|
case 429:
|
|
9169
9298
|
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9299
|
+
case 500:
|
|
9300
|
+
throw new InternalServerError(_response.error.body, _response.rawResponse);
|
|
9301
|
+
case 503:
|
|
9302
|
+
throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
9303
|
+
case 504:
|
|
9304
|
+
throw new GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
9170
9305
|
default:
|
|
9171
9306
|
throw new VectrosError({
|
|
9172
9307
|
statusCode: _response.error.statusCode,
|
|
@@ -9175,102 +9310,880 @@ var SearchClient = class {
|
|
|
9175
9310
|
});
|
|
9176
9311
|
}
|
|
9177
9312
|
}
|
|
9178
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
9179
|
-
}
|
|
9180
|
-
};
|
|
9181
|
-
var VectrosClient = class {
|
|
9182
|
-
constructor(options) {
|
|
9183
|
-
this._options = normalizeClientOptionsWithAuth(options);
|
|
9184
|
-
}
|
|
9185
|
-
get auth() {
|
|
9186
|
-
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
9187
|
-
}
|
|
9188
|
-
get documents() {
|
|
9189
|
-
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
9190
|
-
}
|
|
9191
|
-
get identity() {
|
|
9192
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
9193
|
-
}
|
|
9194
|
-
get compliance() {
|
|
9195
|
-
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
9196
|
-
}
|
|
9197
|
-
get folders() {
|
|
9198
|
-
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
9199
|
-
}
|
|
9200
|
-
get inference() {
|
|
9201
|
-
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
9202
|
-
}
|
|
9203
|
-
get records() {
|
|
9204
|
-
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
9205
|
-
}
|
|
9206
|
-
get schemas() {
|
|
9207
|
-
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
9208
|
-
}
|
|
9209
|
-
get search() {
|
|
9210
|
-
return this._search ?? (this._search = new SearchClient(this._options));
|
|
9313
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts/execute");
|
|
9211
9314
|
}
|
|
9212
9315
|
/**
|
|
9213
|
-
*
|
|
9214
|
-
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
9215
|
-
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
9316
|
+
* 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.
|
|
9216
9317
|
*
|
|
9217
|
-
* @param {
|
|
9218
|
-
* @param {
|
|
9219
|
-
*
|
|
9220
|
-
* @
|
|
9318
|
+
* @param {Vectros.ListScriptsRequest} request
|
|
9319
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9320
|
+
*
|
|
9321
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9322
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9323
|
+
*
|
|
9324
|
+
* @example
|
|
9325
|
+
* await client.scripts.listScripts({
|
|
9326
|
+
* name: "notify-assignee",
|
|
9327
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9328
|
+
* })
|
|
9221
9329
|
*/
|
|
9222
|
-
|
|
9223
|
-
return
|
|
9224
|
-
input,
|
|
9225
|
-
init,
|
|
9226
|
-
{
|
|
9227
|
-
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
9228
|
-
headers: this._options.headers,
|
|
9229
|
-
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
9230
|
-
maxRetries: this._options.maxRetries,
|
|
9231
|
-
fetch: this._options.fetch,
|
|
9232
|
-
logging: this._options.logging,
|
|
9233
|
-
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
9234
|
-
},
|
|
9235
|
-
requestOptions
|
|
9236
|
-
);
|
|
9237
|
-
}
|
|
9238
|
-
};
|
|
9239
|
-
var logging;
|
|
9240
|
-
((logging2) => {
|
|
9241
|
-
logging2.LogLevel = LogLevel;
|
|
9242
|
-
logging2.ConsoleLogger = ConsoleLogger;
|
|
9243
|
-
})(logging || (logging = {}));
|
|
9244
|
-
|
|
9245
|
-
// src/server.ts
|
|
9246
|
-
var import_types3 = require("@modelcontextprotocol/sdk/types.js");
|
|
9247
|
-
var import_zod23 = require("zod");
|
|
9248
|
-
|
|
9249
|
-
// src/auth.ts
|
|
9250
|
-
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
9251
|
-
var InvalidApiKeyError = class extends Error {
|
|
9252
|
-
constructor(reason) {
|
|
9253
|
-
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
9254
|
-
this.name = "InvalidApiKeyError";
|
|
9330
|
+
listScripts(request = {}, requestOptions) {
|
|
9331
|
+
return HttpResponsePromise.fromPromise(this.__listScripts(request, requestOptions));
|
|
9255
9332
|
}
|
|
9256
|
-
}
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9333
|
+
async __listScripts(request = {}, requestOptions) {
|
|
9334
|
+
const { name, startFrom, limit, includeSource, latest } = request;
|
|
9335
|
+
const _queryParams = {
|
|
9336
|
+
name,
|
|
9337
|
+
startFrom,
|
|
9338
|
+
limit,
|
|
9339
|
+
includeSource,
|
|
9340
|
+
latest
|
|
9341
|
+
};
|
|
9342
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9343
|
+
const _headers = mergeHeaders(
|
|
9344
|
+
_authRequest.headers,
|
|
9345
|
+
this._options?.headers,
|
|
9346
|
+
requestOptions?.headers
|
|
9261
9347
|
);
|
|
9348
|
+
const _response = await fetcher({
|
|
9349
|
+
url: url_exports.join(
|
|
9350
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9351
|
+
"v1/scripts"
|
|
9352
|
+
),
|
|
9353
|
+
method: "GET",
|
|
9354
|
+
headers: _headers,
|
|
9355
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9356
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9357
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9358
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9359
|
+
fetchFn: this._options?.fetch,
|
|
9360
|
+
logging: this._options.logging
|
|
9361
|
+
});
|
|
9362
|
+
if (_response.ok) {
|
|
9363
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9364
|
+
}
|
|
9365
|
+
if (_response.error.reason === "status-code") {
|
|
9366
|
+
switch (_response.error.statusCode) {
|
|
9367
|
+
case 400:
|
|
9368
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9369
|
+
case 404:
|
|
9370
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9371
|
+
default:
|
|
9372
|
+
throw new VectrosError({
|
|
9373
|
+
statusCode: _response.error.statusCode,
|
|
9374
|
+
body: _response.error.body,
|
|
9375
|
+
rawResponse: _response.rawResponse
|
|
9376
|
+
});
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts");
|
|
9262
9380
|
}
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9381
|
+
/**
|
|
9382
|
+
* 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.
|
|
9383
|
+
*
|
|
9384
|
+
* @param {Vectros.ScriptRequest} request
|
|
9385
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9386
|
+
*
|
|
9387
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9388
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9389
|
+
* @throws {@link Vectros.ConflictError}
|
|
9390
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9391
|
+
*
|
|
9392
|
+
* @example
|
|
9393
|
+
* await client.scripts.createScript({
|
|
9394
|
+
* name: "notify-assignee",
|
|
9395
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9396
|
+
* })
|
|
9397
|
+
*/
|
|
9398
|
+
createScript(request, requestOptions) {
|
|
9399
|
+
return HttpResponsePromise.fromPromise(this.__createScript(request, requestOptions));
|
|
9268
9400
|
}
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9401
|
+
async __createScript(request, requestOptions) {
|
|
9402
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9403
|
+
const _headers = mergeHeaders(
|
|
9404
|
+
_authRequest.headers,
|
|
9405
|
+
this._options?.headers,
|
|
9406
|
+
requestOptions?.headers
|
|
9407
|
+
);
|
|
9408
|
+
const _response = await fetcher({
|
|
9409
|
+
url: url_exports.join(
|
|
9410
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9411
|
+
"v1/scripts"
|
|
9412
|
+
),
|
|
9413
|
+
method: "POST",
|
|
9414
|
+
headers: _headers,
|
|
9415
|
+
contentType: "application/json",
|
|
9416
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9417
|
+
requestType: "json",
|
|
9418
|
+
body: request,
|
|
9419
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9420
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9421
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9422
|
+
fetchFn: this._options?.fetch,
|
|
9423
|
+
logging: this._options.logging
|
|
9424
|
+
});
|
|
9425
|
+
if (_response.ok) {
|
|
9426
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9427
|
+
}
|
|
9428
|
+
if (_response.error.reason === "status-code") {
|
|
9429
|
+
switch (_response.error.statusCode) {
|
|
9430
|
+
case 400:
|
|
9431
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9432
|
+
case 403:
|
|
9433
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9434
|
+
case 409:
|
|
9435
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9436
|
+
case 429:
|
|
9437
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9438
|
+
default:
|
|
9439
|
+
throw new VectrosError({
|
|
9440
|
+
statusCode: _response.error.statusCode,
|
|
9441
|
+
body: _response.error.body,
|
|
9442
|
+
rawResponse: _response.rawResponse
|
|
9443
|
+
});
|
|
9444
|
+
}
|
|
9445
|
+
}
|
|
9446
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/scripts");
|
|
9447
|
+
}
|
|
9448
|
+
/**
|
|
9449
|
+
* Retrieves a single script version by its ID. Requires the `scripts:r` scope.
|
|
9450
|
+
*
|
|
9451
|
+
* @param {Vectros.GetScriptRequest} request
|
|
9452
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9453
|
+
*
|
|
9454
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9455
|
+
*
|
|
9456
|
+
* @example
|
|
9457
|
+
* await client.scripts.getScript({
|
|
9458
|
+
* id: "id"
|
|
9459
|
+
* })
|
|
9460
|
+
*/
|
|
9461
|
+
getScript(request, requestOptions) {
|
|
9462
|
+
return HttpResponsePromise.fromPromise(this.__getScript(request, requestOptions));
|
|
9463
|
+
}
|
|
9464
|
+
async __getScript(request, requestOptions) {
|
|
9465
|
+
const { id } = request;
|
|
9466
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9467
|
+
const _headers = mergeHeaders(
|
|
9468
|
+
_authRequest.headers,
|
|
9469
|
+
this._options?.headers,
|
|
9470
|
+
requestOptions?.headers
|
|
9471
|
+
);
|
|
9472
|
+
const _response = await fetcher({
|
|
9473
|
+
url: url_exports.join(
|
|
9474
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9475
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9476
|
+
),
|
|
9477
|
+
method: "GET",
|
|
9478
|
+
headers: _headers,
|
|
9479
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9480
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9481
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9482
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9483
|
+
fetchFn: this._options?.fetch,
|
|
9484
|
+
logging: this._options.logging
|
|
9485
|
+
});
|
|
9486
|
+
if (_response.ok) {
|
|
9487
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9488
|
+
}
|
|
9489
|
+
if (_response.error.reason === "status-code") {
|
|
9490
|
+
switch (_response.error.statusCode) {
|
|
9491
|
+
case 404:
|
|
9492
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9493
|
+
default:
|
|
9494
|
+
throw new VectrosError({
|
|
9495
|
+
statusCode: _response.error.statusCode,
|
|
9496
|
+
body: _response.error.body,
|
|
9497
|
+
rawResponse: _response.rawResponse
|
|
9498
|
+
});
|
|
9499
|
+
}
|
|
9500
|
+
}
|
|
9501
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/scripts/{id}");
|
|
9502
|
+
}
|
|
9503
|
+
/**
|
|
9504
|
+
* 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.
|
|
9505
|
+
*
|
|
9506
|
+
* @param {Vectros.UpdateScriptRequest} request
|
|
9507
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9508
|
+
*
|
|
9509
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9510
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9511
|
+
*
|
|
9512
|
+
* @example
|
|
9513
|
+
* await client.scripts.updateScript({
|
|
9514
|
+
* id: "id",
|
|
9515
|
+
* body: {
|
|
9516
|
+
* name: "notify-assignee",
|
|
9517
|
+
* source: "export default function(input) { return { ok: true }; }"
|
|
9518
|
+
* }
|
|
9519
|
+
* })
|
|
9520
|
+
*/
|
|
9521
|
+
updateScript(request, requestOptions) {
|
|
9522
|
+
return HttpResponsePromise.fromPromise(this.__updateScript(request, requestOptions));
|
|
9523
|
+
}
|
|
9524
|
+
async __updateScript(request, requestOptions) {
|
|
9525
|
+
const { id, body: _body } = request;
|
|
9526
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9527
|
+
const _headers = mergeHeaders(
|
|
9528
|
+
_authRequest.headers,
|
|
9529
|
+
this._options?.headers,
|
|
9530
|
+
requestOptions?.headers
|
|
9531
|
+
);
|
|
9532
|
+
const _response = await fetcher({
|
|
9533
|
+
url: url_exports.join(
|
|
9534
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9535
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9536
|
+
),
|
|
9537
|
+
method: "PUT",
|
|
9538
|
+
headers: _headers,
|
|
9539
|
+
contentType: "application/json",
|
|
9540
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9541
|
+
requestType: "json",
|
|
9542
|
+
body: _body,
|
|
9543
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9544
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9545
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9546
|
+
fetchFn: this._options?.fetch,
|
|
9547
|
+
logging: this._options.logging
|
|
9548
|
+
});
|
|
9549
|
+
if (_response.ok) {
|
|
9550
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9551
|
+
}
|
|
9552
|
+
if (_response.error.reason === "status-code") {
|
|
9553
|
+
switch (_response.error.statusCode) {
|
|
9554
|
+
case 400:
|
|
9555
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9556
|
+
case 429:
|
|
9557
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9558
|
+
default:
|
|
9559
|
+
throw new VectrosError({
|
|
9560
|
+
statusCode: _response.error.statusCode,
|
|
9561
|
+
body: _response.error.body,
|
|
9562
|
+
rawResponse: _response.rawResponse
|
|
9563
|
+
});
|
|
9564
|
+
}
|
|
9565
|
+
}
|
|
9566
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/scripts/{id}");
|
|
9567
|
+
}
|
|
9568
|
+
/**
|
|
9569
|
+
* 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.
|
|
9570
|
+
*
|
|
9571
|
+
* @param {Vectros.DeleteScriptRequest} request
|
|
9572
|
+
* @param {ScriptsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9573
|
+
*
|
|
9574
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9575
|
+
* @throws {@link Vectros.ConflictError}
|
|
9576
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9577
|
+
*
|
|
9578
|
+
* @example
|
|
9579
|
+
* await client.scripts.deleteScript({
|
|
9580
|
+
* id: "id"
|
|
9581
|
+
* })
|
|
9582
|
+
*/
|
|
9583
|
+
deleteScript(request, requestOptions) {
|
|
9584
|
+
return HttpResponsePromise.fromPromise(this.__deleteScript(request, requestOptions));
|
|
9585
|
+
}
|
|
9586
|
+
async __deleteScript(request, requestOptions) {
|
|
9587
|
+
const { id } = request;
|
|
9588
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9589
|
+
const _headers = mergeHeaders(
|
|
9590
|
+
_authRequest.headers,
|
|
9591
|
+
this._options?.headers,
|
|
9592
|
+
requestOptions?.headers
|
|
9593
|
+
);
|
|
9594
|
+
const _response = await fetcher({
|
|
9595
|
+
url: url_exports.join(
|
|
9596
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9597
|
+
`v1/scripts/${url_exports.encodePathParam(id)}`
|
|
9598
|
+
),
|
|
9599
|
+
method: "DELETE",
|
|
9600
|
+
headers: _headers,
|
|
9601
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9602
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9603
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9604
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9605
|
+
fetchFn: this._options?.fetch,
|
|
9606
|
+
logging: this._options.logging
|
|
9607
|
+
});
|
|
9608
|
+
if (_response.ok) {
|
|
9609
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
9610
|
+
}
|
|
9611
|
+
if (_response.error.reason === "status-code") {
|
|
9612
|
+
switch (_response.error.statusCode) {
|
|
9613
|
+
case 404:
|
|
9614
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9615
|
+
case 409:
|
|
9616
|
+
throw new ConflictError(_response.error.body, _response.rawResponse);
|
|
9617
|
+
case 429:
|
|
9618
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9619
|
+
default:
|
|
9620
|
+
throw new VectrosError({
|
|
9621
|
+
statusCode: _response.error.statusCode,
|
|
9622
|
+
body: _response.error.body,
|
|
9623
|
+
rawResponse: _response.rawResponse
|
|
9624
|
+
});
|
|
9625
|
+
}
|
|
9626
|
+
}
|
|
9627
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/scripts/{id}");
|
|
9628
|
+
}
|
|
9629
|
+
};
|
|
9630
|
+
var SearchClient = class {
|
|
9631
|
+
constructor(options) {
|
|
9632
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9633
|
+
}
|
|
9634
|
+
/**
|
|
9635
|
+
* 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.
|
|
9636
|
+
*
|
|
9637
|
+
* @param {Vectros.SearchRequest} request
|
|
9638
|
+
* @param {SearchClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9639
|
+
*
|
|
9640
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9641
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9642
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9643
|
+
*
|
|
9644
|
+
* @example
|
|
9645
|
+
* await client.search.content({
|
|
9646
|
+
* query: "patient intake form diabetes"
|
|
9647
|
+
* })
|
|
9648
|
+
*/
|
|
9649
|
+
content(request, requestOptions) {
|
|
9650
|
+
return HttpResponsePromise.fromPromise(this.__content(request, requestOptions));
|
|
9651
|
+
}
|
|
9652
|
+
async __content(request, requestOptions) {
|
|
9653
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9654
|
+
const _headers = mergeHeaders(
|
|
9655
|
+
_authRequest.headers,
|
|
9656
|
+
this._options?.headers,
|
|
9657
|
+
requestOptions?.headers
|
|
9658
|
+
);
|
|
9659
|
+
const _response = await fetcher({
|
|
9660
|
+
url: url_exports.join(
|
|
9661
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9662
|
+
"v1/search"
|
|
9663
|
+
),
|
|
9664
|
+
method: "POST",
|
|
9665
|
+
headers: _headers,
|
|
9666
|
+
contentType: "application/json",
|
|
9667
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9668
|
+
requestType: "json",
|
|
9669
|
+
body: request,
|
|
9670
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9671
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9672
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9673
|
+
fetchFn: this._options?.fetch,
|
|
9674
|
+
logging: this._options.logging
|
|
9675
|
+
});
|
|
9676
|
+
if (_response.ok) {
|
|
9677
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9678
|
+
}
|
|
9679
|
+
if (_response.error.reason === "status-code") {
|
|
9680
|
+
switch (_response.error.statusCode) {
|
|
9681
|
+
case 400:
|
|
9682
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9683
|
+
case 403:
|
|
9684
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9685
|
+
case 429:
|
|
9686
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9687
|
+
default:
|
|
9688
|
+
throw new VectrosError({
|
|
9689
|
+
statusCode: _response.error.statusCode,
|
|
9690
|
+
body: _response.error.body,
|
|
9691
|
+
rawResponse: _response.rawResponse
|
|
9692
|
+
});
|
|
9693
|
+
}
|
|
9694
|
+
}
|
|
9695
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/search");
|
|
9696
|
+
}
|
|
9697
|
+
};
|
|
9698
|
+
var TriggersClient = class {
|
|
9699
|
+
constructor(options) {
|
|
9700
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
9701
|
+
}
|
|
9702
|
+
/**
|
|
9703
|
+
* 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.
|
|
9704
|
+
*
|
|
9705
|
+
* 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.
|
|
9706
|
+
*
|
|
9707
|
+
* `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.
|
|
9708
|
+
*
|
|
9709
|
+
* Scoped to your account and app context, derived from your token — never from input. Requires the `triggers:r` scope.
|
|
9710
|
+
*
|
|
9711
|
+
* @param {Vectros.ListTriggerFailuresRequest} request
|
|
9712
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9713
|
+
*
|
|
9714
|
+
* @example
|
|
9715
|
+
* await client.triggers.listTriggerFailures({
|
|
9716
|
+
* ruleId: "3b1c9f2e7a5d8410f6c2e9a1b7d4038f5e6a91c2d7f0b3a4586c9e2f1d0a7b3c",
|
|
9717
|
+
* category: "SCRIPT_ERROR",
|
|
9718
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9719
|
+
* })
|
|
9720
|
+
*/
|
|
9721
|
+
listTriggerFailures(request = {}, requestOptions) {
|
|
9722
|
+
return HttpResponsePromise.fromPromise(this.__listTriggerFailures(request, requestOptions));
|
|
9723
|
+
}
|
|
9724
|
+
async __listTriggerFailures(request = {}, requestOptions) {
|
|
9725
|
+
const { ruleId, category, retryable, from: from_, to, startFrom, limit } = request;
|
|
9726
|
+
const _queryParams = {
|
|
9727
|
+
ruleId,
|
|
9728
|
+
category,
|
|
9729
|
+
retryable,
|
|
9730
|
+
from: from_,
|
|
9731
|
+
to,
|
|
9732
|
+
startFrom,
|
|
9733
|
+
limit
|
|
9734
|
+
};
|
|
9735
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9736
|
+
const _headers = mergeHeaders(
|
|
9737
|
+
_authRequest.headers,
|
|
9738
|
+
this._options?.headers,
|
|
9739
|
+
requestOptions?.headers
|
|
9740
|
+
);
|
|
9741
|
+
const _response = await fetcher({
|
|
9742
|
+
url: url_exports.join(
|
|
9743
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9744
|
+
"v1/trigger-failures"
|
|
9745
|
+
),
|
|
9746
|
+
method: "GET",
|
|
9747
|
+
headers: _headers,
|
|
9748
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9749
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9750
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9751
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9752
|
+
fetchFn: this._options?.fetch,
|
|
9753
|
+
logging: this._options.logging
|
|
9754
|
+
});
|
|
9755
|
+
if (_response.ok) {
|
|
9756
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9757
|
+
}
|
|
9758
|
+
if (_response.error.reason === "status-code") {
|
|
9759
|
+
throw new VectrosError({
|
|
9760
|
+
statusCode: _response.error.statusCode,
|
|
9761
|
+
body: _response.error.body,
|
|
9762
|
+
rawResponse: _response.rawResponse
|
|
9763
|
+
});
|
|
9764
|
+
}
|
|
9765
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/trigger-failures");
|
|
9766
|
+
}
|
|
9767
|
+
/**
|
|
9768
|
+
* 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.
|
|
9769
|
+
*
|
|
9770
|
+
* @param {Vectros.ListTriggersRequest} request
|
|
9771
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9772
|
+
*
|
|
9773
|
+
* @example
|
|
9774
|
+
* await client.triggers.listTriggers({
|
|
9775
|
+
* startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
|
|
9776
|
+
* })
|
|
9777
|
+
*/
|
|
9778
|
+
listTriggers(request = {}, requestOptions) {
|
|
9779
|
+
return HttpResponsePromise.fromPromise(this.__listTriggers(request, requestOptions));
|
|
9780
|
+
}
|
|
9781
|
+
async __listTriggers(request = {}, requestOptions) {
|
|
9782
|
+
const { startFrom, limit } = request;
|
|
9783
|
+
const _queryParams = {
|
|
9784
|
+
startFrom,
|
|
9785
|
+
limit
|
|
9786
|
+
};
|
|
9787
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9788
|
+
const _headers = mergeHeaders(
|
|
9789
|
+
_authRequest.headers,
|
|
9790
|
+
this._options?.headers,
|
|
9791
|
+
requestOptions?.headers
|
|
9792
|
+
);
|
|
9793
|
+
const _response = await fetcher({
|
|
9794
|
+
url: url_exports.join(
|
|
9795
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9796
|
+
"v1/triggers"
|
|
9797
|
+
),
|
|
9798
|
+
method: "GET",
|
|
9799
|
+
headers: _headers,
|
|
9800
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9801
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9802
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9803
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9804
|
+
fetchFn: this._options?.fetch,
|
|
9805
|
+
logging: this._options.logging
|
|
9806
|
+
});
|
|
9807
|
+
if (_response.ok) {
|
|
9808
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9809
|
+
}
|
|
9810
|
+
if (_response.error.reason === "status-code") {
|
|
9811
|
+
throw new VectrosError({
|
|
9812
|
+
statusCode: _response.error.statusCode,
|
|
9813
|
+
body: _response.error.body,
|
|
9814
|
+
rawResponse: _response.rawResponse
|
|
9815
|
+
});
|
|
9816
|
+
}
|
|
9817
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers");
|
|
9818
|
+
}
|
|
9819
|
+
/**
|
|
9820
|
+
* 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).
|
|
9821
|
+
*
|
|
9822
|
+
* @param {Vectros.CreateTriggerRequest} request
|
|
9823
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9824
|
+
*
|
|
9825
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9826
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9827
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9828
|
+
*
|
|
9829
|
+
* @example
|
|
9830
|
+
* await client.triggers.createTrigger({
|
|
9831
|
+
* body: {
|
|
9832
|
+
* name: "on-intake-create",
|
|
9833
|
+
* firingSource: {
|
|
9834
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9835
|
+
* event: "CREATE"
|
|
9836
|
+
* },
|
|
9837
|
+
* scriptRef: {
|
|
9838
|
+
* name: "notify-assignee",
|
|
9839
|
+
* version: "3"
|
|
9840
|
+
* }
|
|
9841
|
+
* }
|
|
9842
|
+
* })
|
|
9843
|
+
*/
|
|
9844
|
+
createTrigger(request, requestOptions) {
|
|
9845
|
+
return HttpResponsePromise.fromPromise(this.__createTrigger(request, requestOptions));
|
|
9846
|
+
}
|
|
9847
|
+
async __createTrigger(request, requestOptions) {
|
|
9848
|
+
const { upsert, body: _body } = request;
|
|
9849
|
+
const _queryParams = {
|
|
9850
|
+
upsert
|
|
9851
|
+
};
|
|
9852
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9853
|
+
const _headers = mergeHeaders(
|
|
9854
|
+
_authRequest.headers,
|
|
9855
|
+
this._options?.headers,
|
|
9856
|
+
requestOptions?.headers
|
|
9857
|
+
);
|
|
9858
|
+
const _response = await fetcher({
|
|
9859
|
+
url: url_exports.join(
|
|
9860
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9861
|
+
"v1/triggers"
|
|
9862
|
+
),
|
|
9863
|
+
method: "POST",
|
|
9864
|
+
headers: _headers,
|
|
9865
|
+
contentType: "application/json",
|
|
9866
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
9867
|
+
requestType: "json",
|
|
9868
|
+
body: _body,
|
|
9869
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9870
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9871
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9872
|
+
fetchFn: this._options?.fetch,
|
|
9873
|
+
logging: this._options.logging
|
|
9874
|
+
});
|
|
9875
|
+
if (_response.ok) {
|
|
9876
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9877
|
+
}
|
|
9878
|
+
if (_response.error.reason === "status-code") {
|
|
9879
|
+
switch (_response.error.statusCode) {
|
|
9880
|
+
case 400:
|
|
9881
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
9882
|
+
case 403:
|
|
9883
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
9884
|
+
case 429:
|
|
9885
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
9886
|
+
default:
|
|
9887
|
+
throw new VectrosError({
|
|
9888
|
+
statusCode: _response.error.statusCode,
|
|
9889
|
+
body: _response.error.body,
|
|
9890
|
+
rawResponse: _response.rawResponse
|
|
9891
|
+
});
|
|
9892
|
+
}
|
|
9893
|
+
}
|
|
9894
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/triggers");
|
|
9895
|
+
}
|
|
9896
|
+
/**
|
|
9897
|
+
* Retrieves a single trigger rule by its ID. Requires the `triggers:r` scope.
|
|
9898
|
+
*
|
|
9899
|
+
* @param {Vectros.GetTriggerRequest} request
|
|
9900
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9901
|
+
*
|
|
9902
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9903
|
+
*
|
|
9904
|
+
* @example
|
|
9905
|
+
* await client.triggers.getTrigger({
|
|
9906
|
+
* id: "id"
|
|
9907
|
+
* })
|
|
9908
|
+
*/
|
|
9909
|
+
getTrigger(request, requestOptions) {
|
|
9910
|
+
return HttpResponsePromise.fromPromise(this.__getTrigger(request, requestOptions));
|
|
9911
|
+
}
|
|
9912
|
+
async __getTrigger(request, requestOptions) {
|
|
9913
|
+
const { id } = request;
|
|
9914
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9915
|
+
const _headers = mergeHeaders(
|
|
9916
|
+
_authRequest.headers,
|
|
9917
|
+
this._options?.headers,
|
|
9918
|
+
requestOptions?.headers
|
|
9919
|
+
);
|
|
9920
|
+
const _response = await fetcher({
|
|
9921
|
+
url: url_exports.join(
|
|
9922
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9923
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9924
|
+
),
|
|
9925
|
+
method: "GET",
|
|
9926
|
+
headers: _headers,
|
|
9927
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9928
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
9929
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
9930
|
+
abortSignal: requestOptions?.abortSignal,
|
|
9931
|
+
fetchFn: this._options?.fetch,
|
|
9932
|
+
logging: this._options.logging
|
|
9933
|
+
});
|
|
9934
|
+
if (_response.ok) {
|
|
9935
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
9936
|
+
}
|
|
9937
|
+
if (_response.error.reason === "status-code") {
|
|
9938
|
+
switch (_response.error.statusCode) {
|
|
9939
|
+
case 404:
|
|
9940
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
9941
|
+
default:
|
|
9942
|
+
throw new VectrosError({
|
|
9943
|
+
statusCode: _response.error.statusCode,
|
|
9944
|
+
body: _response.error.body,
|
|
9945
|
+
rawResponse: _response.rawResponse
|
|
9946
|
+
});
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/triggers/{id}");
|
|
9950
|
+
}
|
|
9951
|
+
/**
|
|
9952
|
+
* 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.
|
|
9953
|
+
*
|
|
9954
|
+
* @param {Vectros.UpdateTriggerRequest} request
|
|
9955
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
9956
|
+
*
|
|
9957
|
+
* @throws {@link Vectros.BadRequestError}
|
|
9958
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
9959
|
+
* @throws {@link Vectros.NotFoundError}
|
|
9960
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
9961
|
+
*
|
|
9962
|
+
* @example
|
|
9963
|
+
* await client.triggers.updateTrigger({
|
|
9964
|
+
* id: "id",
|
|
9965
|
+
* body: {
|
|
9966
|
+
* name: "on-intake-create",
|
|
9967
|
+
* firingSource: {
|
|
9968
|
+
* schemaId: "sch_9f8e7d6c",
|
|
9969
|
+
* event: "CREATE"
|
|
9970
|
+
* },
|
|
9971
|
+
* scriptRef: {
|
|
9972
|
+
* name: "notify-assignee",
|
|
9973
|
+
* version: "3"
|
|
9974
|
+
* }
|
|
9975
|
+
* }
|
|
9976
|
+
* })
|
|
9977
|
+
*/
|
|
9978
|
+
updateTrigger(request, requestOptions) {
|
|
9979
|
+
return HttpResponsePromise.fromPromise(this.__updateTrigger(request, requestOptions));
|
|
9980
|
+
}
|
|
9981
|
+
async __updateTrigger(request, requestOptions) {
|
|
9982
|
+
const { id, body: _body } = request;
|
|
9983
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
9984
|
+
const _headers = mergeHeaders(
|
|
9985
|
+
_authRequest.headers,
|
|
9986
|
+
this._options?.headers,
|
|
9987
|
+
requestOptions?.headers
|
|
9988
|
+
);
|
|
9989
|
+
const _response = await fetcher({
|
|
9990
|
+
url: url_exports.join(
|
|
9991
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
9992
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
9993
|
+
),
|
|
9994
|
+
method: "PUT",
|
|
9995
|
+
headers: _headers,
|
|
9996
|
+
contentType: "application/json",
|
|
9997
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
9998
|
+
requestType: "json",
|
|
9999
|
+
body: _body,
|
|
10000
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
10001
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10002
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10003
|
+
fetchFn: this._options?.fetch,
|
|
10004
|
+
logging: this._options.logging
|
|
10005
|
+
});
|
|
10006
|
+
if (_response.ok) {
|
|
10007
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
10008
|
+
}
|
|
10009
|
+
if (_response.error.reason === "status-code") {
|
|
10010
|
+
switch (_response.error.statusCode) {
|
|
10011
|
+
case 400:
|
|
10012
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
10013
|
+
case 403:
|
|
10014
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
10015
|
+
case 404:
|
|
10016
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10017
|
+
case 429:
|
|
10018
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10019
|
+
default:
|
|
10020
|
+
throw new VectrosError({
|
|
10021
|
+
statusCode: _response.error.statusCode,
|
|
10022
|
+
body: _response.error.body,
|
|
10023
|
+
rawResponse: _response.rawResponse
|
|
10024
|
+
});
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10027
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/triggers/{id}");
|
|
10028
|
+
}
|
|
10029
|
+
/**
|
|
10030
|
+
* Permanently deletes one trigger rule by ID. Requires the `triggers:d` scope.
|
|
10031
|
+
*
|
|
10032
|
+
* @param {Vectros.DeleteTriggerRequest} request
|
|
10033
|
+
* @param {TriggersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
10034
|
+
*
|
|
10035
|
+
* @throws {@link Vectros.NotFoundError}
|
|
10036
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
10037
|
+
*
|
|
10038
|
+
* @example
|
|
10039
|
+
* await client.triggers.deleteTrigger({
|
|
10040
|
+
* id: "id"
|
|
10041
|
+
* })
|
|
10042
|
+
*/
|
|
10043
|
+
deleteTrigger(request, requestOptions) {
|
|
10044
|
+
return HttpResponsePromise.fromPromise(this.__deleteTrigger(request, requestOptions));
|
|
10045
|
+
}
|
|
10046
|
+
async __deleteTrigger(request, requestOptions) {
|
|
10047
|
+
const { id } = request;
|
|
10048
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
10049
|
+
const _headers = mergeHeaders(
|
|
10050
|
+
_authRequest.headers,
|
|
10051
|
+
this._options?.headers,
|
|
10052
|
+
requestOptions?.headers
|
|
10053
|
+
);
|
|
10054
|
+
const _response = await fetcher({
|
|
10055
|
+
url: url_exports.join(
|
|
10056
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
10057
|
+
`v1/triggers/${url_exports.encodePathParam(id)}`
|
|
10058
|
+
),
|
|
10059
|
+
method: "DELETE",
|
|
10060
|
+
headers: _headers,
|
|
10061
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
10062
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
10063
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
10064
|
+
abortSignal: requestOptions?.abortSignal,
|
|
10065
|
+
fetchFn: this._options?.fetch,
|
|
10066
|
+
logging: this._options.logging
|
|
10067
|
+
});
|
|
10068
|
+
if (_response.ok) {
|
|
10069
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
10070
|
+
}
|
|
10071
|
+
if (_response.error.reason === "status-code") {
|
|
10072
|
+
switch (_response.error.statusCode) {
|
|
10073
|
+
case 404:
|
|
10074
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
10075
|
+
case 429:
|
|
10076
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
10077
|
+
default:
|
|
10078
|
+
throw new VectrosError({
|
|
10079
|
+
statusCode: _response.error.statusCode,
|
|
10080
|
+
body: _response.error.body,
|
|
10081
|
+
rawResponse: _response.rawResponse
|
|
10082
|
+
});
|
|
10083
|
+
}
|
|
10084
|
+
}
|
|
10085
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/triggers/{id}");
|
|
10086
|
+
}
|
|
10087
|
+
};
|
|
10088
|
+
var VectrosClient = class {
|
|
10089
|
+
constructor(options) {
|
|
10090
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
10091
|
+
}
|
|
10092
|
+
get auth() {
|
|
10093
|
+
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
10094
|
+
}
|
|
10095
|
+
get documents() {
|
|
10096
|
+
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
10097
|
+
}
|
|
10098
|
+
get identity() {
|
|
10099
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
10100
|
+
}
|
|
10101
|
+
get compliance() {
|
|
10102
|
+
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
10103
|
+
}
|
|
10104
|
+
get folders() {
|
|
10105
|
+
return this._folders ?? (this._folders = new FoldersClient(this._options));
|
|
10106
|
+
}
|
|
10107
|
+
get inference() {
|
|
10108
|
+
return this._inference ?? (this._inference = new InferenceClient(this._options));
|
|
10109
|
+
}
|
|
10110
|
+
get records() {
|
|
10111
|
+
return this._records ?? (this._records = new RecordsClient(this._options));
|
|
10112
|
+
}
|
|
10113
|
+
get schemas() {
|
|
10114
|
+
return this._schemas ?? (this._schemas = new SchemasClient(this._options));
|
|
10115
|
+
}
|
|
10116
|
+
get scripts() {
|
|
10117
|
+
return this._scripts ?? (this._scripts = new ScriptsClient(this._options));
|
|
10118
|
+
}
|
|
10119
|
+
get search() {
|
|
10120
|
+
return this._search ?? (this._search = new SearchClient(this._options));
|
|
10121
|
+
}
|
|
10122
|
+
get triggers() {
|
|
10123
|
+
return this._triggers ?? (this._triggers = new TriggersClient(this._options));
|
|
10124
|
+
}
|
|
10125
|
+
/**
|
|
10126
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
10127
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
10128
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
10129
|
+
*
|
|
10130
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
10131
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
10132
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
10133
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
10134
|
+
*/
|
|
10135
|
+
async fetch(input, init, requestOptions) {
|
|
10136
|
+
return makePassthroughRequest(
|
|
10137
|
+
input,
|
|
10138
|
+
init,
|
|
10139
|
+
{
|
|
10140
|
+
baseUrl: this._options.baseUrl ?? this._options.environment,
|
|
10141
|
+
headers: this._options.headers,
|
|
10142
|
+
timeoutInSeconds: this._options.timeoutInSeconds,
|
|
10143
|
+
maxRetries: this._options.maxRetries,
|
|
10144
|
+
fetch: this._options.fetch,
|
|
10145
|
+
logging: this._options.logging,
|
|
10146
|
+
getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers
|
|
10147
|
+
},
|
|
10148
|
+
requestOptions
|
|
10149
|
+
);
|
|
10150
|
+
}
|
|
10151
|
+
};
|
|
10152
|
+
var logging;
|
|
10153
|
+
((logging2) => {
|
|
10154
|
+
logging2.LogLevel = LogLevel;
|
|
10155
|
+
logging2.ConsoleLogger = ConsoleLogger;
|
|
10156
|
+
})(logging || (logging = {}));
|
|
10157
|
+
|
|
10158
|
+
// src/server.ts
|
|
10159
|
+
var import_types3 = require("@modelcontextprotocol/sdk/types.js");
|
|
10160
|
+
var import_zod24 = require("zod");
|
|
10161
|
+
|
|
10162
|
+
// src/auth.ts
|
|
10163
|
+
var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
|
|
10164
|
+
var InvalidApiKeyError = class extends Error {
|
|
10165
|
+
constructor(reason) {
|
|
10166
|
+
super(`Invalid VECTROS_API_KEY: ${reason}`);
|
|
10167
|
+
this.name = "InvalidApiKeyError";
|
|
10168
|
+
}
|
|
10169
|
+
};
|
|
10170
|
+
function parseApiKey(raw) {
|
|
10171
|
+
if (!raw || raw.trim().length === 0) {
|
|
10172
|
+
throw new InvalidApiKeyError(
|
|
10173
|
+
"env var is missing or empty. Set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_... or ssk_test_...)."
|
|
10174
|
+
);
|
|
10175
|
+
}
|
|
10176
|
+
const match = raw.match(KEY_RE);
|
|
10177
|
+
if (!match) {
|
|
10178
|
+
throw new InvalidApiKeyError(
|
|
10179
|
+
`key must start with sk_, ssk_, or st_ followed by "live_" or "test_". Got prefix "${raw.slice(0, 12)}...".`
|
|
10180
|
+
);
|
|
10181
|
+
}
|
|
10182
|
+
return {
|
|
10183
|
+
prefix: match[1],
|
|
10184
|
+
env: match[2],
|
|
10185
|
+
raw
|
|
10186
|
+
};
|
|
9274
10187
|
}
|
|
9275
10188
|
function warnOnSuboptimalKey(key, log) {
|
|
9276
10189
|
if (key.prefix === "sk") {
|
|
@@ -9288,8 +10201,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
9288
10201
|
|
|
9289
10202
|
// src/build-info.ts
|
|
9290
10203
|
var BUILD_INFO = {
|
|
9291
|
-
mcpServer: true ? "0.
|
|
9292
|
-
sdk: true ? "0.
|
|
10204
|
+
mcpServer: true ? "0.17.1" : "dev",
|
|
10205
|
+
sdk: true ? "0.44.0" : "dev"
|
|
9293
10206
|
};
|
|
9294
10207
|
function formatBuildInfo() {
|
|
9295
10208
|
return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
|
|
@@ -9600,11 +10513,18 @@ var inputSchema = {
|
|
|
9600
10513
|
// Ownership.
|
|
9601
10514
|
userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9602
10515
|
scope: import_zod.z.string().optional().describe(
|
|
9603
|
-
'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.'
|
|
10516
|
+
'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.'
|
|
10517
|
+
),
|
|
10518
|
+
scopeFilters: import_zod.z.array(import_zod.z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
10519
|
+
'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.'
|
|
9604
10520
|
),
|
|
9605
10521
|
// Date window.
|
|
9606
|
-
createdAfter: import_zod.z.string().optional().describe(
|
|
9607
|
-
|
|
10522
|
+
createdAfter: import_zod.z.string().optional().describe(
|
|
10523
|
+
"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."
|
|
10524
|
+
),
|
|
10525
|
+
createdBefore: import_zod.z.string().optional().describe(
|
|
10526
|
+
"Restrict to content CREATED at/before this ISO 8601 UTC timestamp \u2014 same creation-time basis, and the same first-index allowance, as createdAfter."
|
|
10527
|
+
),
|
|
9608
10528
|
// Relevance tuning.
|
|
9609
10529
|
minSimilarity: import_zod.z.number().min(0).max(1).optional().describe("Minimum semantic similarity (0.0\u20131.0); results below are excluded."),
|
|
9610
10530
|
minTextRelevance: import_zod.z.number().min(0).max(1).optional().describe("Minimum relative keyword (BM25) relevance (0.0\u20131.0); the keyword-leg analogue of minSimilarity."),
|
|
@@ -9619,11 +10539,21 @@ var inputSchema = {
|
|
|
9619
10539
|
var hybridSearch = ({ client, log }) => ({
|
|
9620
10540
|
name: "hybrid_search",
|
|
9621
10541
|
title: "Hybrid search",
|
|
9622
|
-
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
|
|
10542
|
+
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).',
|
|
9623
10543
|
inputSchema,
|
|
10544
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10545
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9624
10546
|
handler: async (args) => {
|
|
9625
10547
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
9626
10548
|
const mode = args.mode ?? "HYBRID";
|
|
10549
|
+
if (args.scope !== void 0 && args.scopeFilters !== void 0) {
|
|
10550
|
+
return toolError(
|
|
10551
|
+
"hybrid_search",
|
|
10552
|
+
new Error(
|
|
10553
|
+
"'scope' and 'scopeFilters' are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
10554
|
+
)
|
|
10555
|
+
);
|
|
10556
|
+
}
|
|
9627
10557
|
try {
|
|
9628
10558
|
const result = await client.search.content({
|
|
9629
10559
|
query: args.query,
|
|
@@ -9638,6 +10568,7 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9638
10568
|
filters: args.filters,
|
|
9639
10569
|
userId: args.userId,
|
|
9640
10570
|
scope: args.scope,
|
|
10571
|
+
scopeFilters: args.scopeFilters,
|
|
9641
10572
|
createdAfter: args.createdAfter,
|
|
9642
10573
|
createdBefore: args.createdBefore,
|
|
9643
10574
|
minSimilarity: args.minSimilarity,
|
|
@@ -9716,7 +10647,9 @@ async function drainPages(fetchPage) {
|
|
|
9716
10647
|
var MCP_DEFAULT_LIMIT2 = 3;
|
|
9717
10648
|
var MCP_MAX_LIMIT2 = 100;
|
|
9718
10649
|
var inputSchema2 = {
|
|
9719
|
-
type: import_zod2.z.string().min(1, "type
|
|
10650
|
+
type: import_zod2.z.string().min(1, "type must be non-empty when supplied").optional().describe(
|
|
10651
|
+
'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.'
|
|
10652
|
+
),
|
|
9720
10653
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | values | from+to | prefix.
|
|
9721
10654
|
field: import_zod2.z.string().optional().describe(
|
|
9722
10655
|
'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.'
|
|
@@ -9738,6 +10671,12 @@ var inputSchema2 = {
|
|
|
9738
10671
|
"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."
|
|
9739
10672
|
),
|
|
9740
10673
|
// List-mode args:
|
|
10674
|
+
folderId: import_zod2.z.string().optional().describe(
|
|
10675
|
+
"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."
|
|
10676
|
+
),
|
|
10677
|
+
recent: import_zod2.z.boolean().optional().describe(
|
|
10678
|
+
"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."
|
|
10679
|
+
),
|
|
9741
10680
|
userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9742
10681
|
scope: import_zod2.z.string().optional().describe(
|
|
9743
10682
|
'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.'
|
|
@@ -9750,11 +10689,15 @@ var inputSchema2 = {
|
|
|
9750
10689
|
var recordQuery = ({ client, log }) => ({
|
|
9751
10690
|
name: "record_query",
|
|
9752
10691
|
title: "Record query (list or lookup)",
|
|
9753
|
-
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
|
|
10692
|
+
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.",
|
|
9754
10693
|
inputSchema: inputSchema2,
|
|
10694
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10695
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9755
10696
|
handler: async (args) => {
|
|
9756
10697
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
9757
10698
|
const type = args.type;
|
|
10699
|
+
const folderId = args.folderId;
|
|
10700
|
+
const recent = args.recent;
|
|
9758
10701
|
const field = args.field;
|
|
9759
10702
|
const value = args.value;
|
|
9760
10703
|
const values = args.values;
|
|
@@ -9772,6 +10715,48 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9772
10715
|
)
|
|
9773
10716
|
);
|
|
9774
10717
|
}
|
|
10718
|
+
if (field && (folderId !== void 0 || recent !== void 0)) {
|
|
10719
|
+
return toolError(
|
|
10720
|
+
"record_query",
|
|
10721
|
+
new Error(
|
|
10722
|
+
"'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."
|
|
10723
|
+
)
|
|
10724
|
+
);
|
|
10725
|
+
}
|
|
10726
|
+
if (field && !type) {
|
|
10727
|
+
return toolError(
|
|
10728
|
+
"record_query",
|
|
10729
|
+
new Error(
|
|
10730
|
+
"a lookup ('field') is always within one record type \u2014 pass 'type'. To read across types, use list mode with 'folderId' or 'recent'."
|
|
10731
|
+
)
|
|
10732
|
+
);
|
|
10733
|
+
}
|
|
10734
|
+
if (!field) {
|
|
10735
|
+
if (recent && (type !== void 0 || folderId !== void 0)) {
|
|
10736
|
+
return toolError(
|
|
10737
|
+
"record_query",
|
|
10738
|
+
new Error(
|
|
10739
|
+
"'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."
|
|
10740
|
+
)
|
|
10741
|
+
);
|
|
10742
|
+
}
|
|
10743
|
+
if (recent && (args.userId !== void 0 || args.scope !== void 0)) {
|
|
10744
|
+
return toolError(
|
|
10745
|
+
"record_query",
|
|
10746
|
+
new Error(
|
|
10747
|
+
"'recent' ignores the owner filters \u2014 'userId'/'scope' would be silently dropped. List by 'type' or 'folderId' to filter by owner."
|
|
10748
|
+
)
|
|
10749
|
+
);
|
|
10750
|
+
}
|
|
10751
|
+
if (!recent && type === void 0 && folderId === void 0) {
|
|
10752
|
+
return toolError(
|
|
10753
|
+
"record_query",
|
|
10754
|
+
new Error(
|
|
10755
|
+
"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."
|
|
10756
|
+
)
|
|
10757
|
+
);
|
|
10758
|
+
}
|
|
10759
|
+
}
|
|
9775
10760
|
try {
|
|
9776
10761
|
let page;
|
|
9777
10762
|
if (field) {
|
|
@@ -9835,6 +10820,7 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9835
10820
|
}
|
|
9836
10821
|
}
|
|
9837
10822
|
page = await client.records.lookupRecordsByBody({
|
|
10823
|
+
// Non-null: the `field && !type` guard above returns before reaching lookup mode.
|
|
9838
10824
|
type,
|
|
9839
10825
|
field: normalizedField,
|
|
9840
10826
|
value,
|
|
@@ -9855,13 +10841,22 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9855
10841
|
} else {
|
|
9856
10842
|
page = await client.records.listRecords({
|
|
9857
10843
|
type,
|
|
10844
|
+
folderId,
|
|
10845
|
+
...recent ? { recent: "true" } : {},
|
|
9858
10846
|
userId: args.userId,
|
|
9859
10847
|
scope: args.scope,
|
|
9860
10848
|
startFrom,
|
|
9861
10849
|
limit
|
|
9862
10850
|
});
|
|
9863
10851
|
log.debug(
|
|
9864
|
-
{
|
|
10852
|
+
{
|
|
10853
|
+
tool: "record_query",
|
|
10854
|
+
mode: recent ? "list:recent" : folderId ? "list:folder" : "list:type",
|
|
10855
|
+
type,
|
|
10856
|
+
folderId,
|
|
10857
|
+
limit,
|
|
10858
|
+
returned: pageItems(page).length
|
|
10859
|
+
},
|
|
9865
10860
|
"record_query list ok"
|
|
9866
10861
|
);
|
|
9867
10862
|
}
|
|
@@ -9943,6 +10938,8 @@ var recordGet = ({ client, log }) => ({
|
|
|
9943
10938
|
title: "Get a record by id or externalId",
|
|
9944
10939
|
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.",
|
|
9945
10940
|
inputSchema: inputSchema3,
|
|
10941
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10942
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9946
10943
|
handler: async (args) => {
|
|
9947
10944
|
const id = args.id;
|
|
9948
10945
|
const externalId = args.externalId;
|
|
@@ -9988,6 +10985,8 @@ var recordBatchGet = ({ client, log }) => ({
|
|
|
9988
10985
|
title: "Get multiple records by id in one call",
|
|
9989
10986
|
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.",
|
|
9990
10987
|
inputSchema: inputSchema4,
|
|
10988
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
10989
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
9991
10990
|
handler: async (args) => {
|
|
9992
10991
|
const ids = args.ids;
|
|
9993
10992
|
try {
|
|
@@ -10038,7 +11037,7 @@ var inputSchema5 = {
|
|
|
10038
11037
|
folderId: import_zod5.z.string().optional().describe("Group this record into a folder."),
|
|
10039
11038
|
userId: import_zod5.z.string().optional().describe("Owning user id."),
|
|
10040
11039
|
scopes: import_zod5.z.array(import_zod5.z.string()).optional().describe(
|
|
10041
|
-
'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
|
|
11040
|
+
'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.'
|
|
10042
11041
|
)
|
|
10043
11042
|
};
|
|
10044
11043
|
var recordCreate = ({ client, log }) => ({
|
|
@@ -10046,6 +11045,13 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10046
11045
|
title: "Create a record",
|
|
10047
11046
|
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).",
|
|
10048
11047
|
inputSchema: inputSchema5,
|
|
11048
|
+
// Creates, never modifies or deletes an existing record. Idempotent ONLY when the caller
|
|
11049
|
+
// supplies `externalId` (optional, per the doc comment above) — re-creating with the same
|
|
11050
|
+
// one returns the existing record rather than duplicating it. `externalId` is not required,
|
|
11051
|
+
// so annotated for the less-safe default (omit it, and a retry creates a second record),
|
|
11052
|
+
// not the safer opt-in — same standard applied to record_batch_write, which has the
|
|
11053
|
+
// identical optional-externalId shape.
|
|
11054
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10049
11055
|
handler: async (args) => {
|
|
10050
11056
|
const type = args.type;
|
|
10051
11057
|
try {
|
|
@@ -10071,19 +11077,110 @@ var recordCreate = ({ client, log }) => ({
|
|
|
10071
11077
|
});
|
|
10072
11078
|
var record_create_default = recordCreate;
|
|
10073
11079
|
|
|
10074
|
-
// src/tools/
|
|
11080
|
+
// src/tools/record_batch_write.ts
|
|
10075
11081
|
var import_zod6 = require("zod");
|
|
10076
|
-
var
|
|
10077
|
-
|
|
11082
|
+
var MCP_MAX_ITEMS = 50;
|
|
11083
|
+
var itemSchema = import_zod6.z.strictObject({
|
|
11084
|
+
type: import_zod6.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
|
|
11085
|
+
fields: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).describe(
|
|
11086
|
+
"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)."
|
|
11087
|
+
),
|
|
10078
11088
|
externalId: import_zod6.z.string().optional().describe(
|
|
11089
|
+
'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.'
|
|
11090
|
+
),
|
|
11091
|
+
indexMode: import_zod6.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
11092
|
+
"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."
|
|
11093
|
+
),
|
|
11094
|
+
status: import_zod6.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
11095
|
+
folderId: import_zod6.z.string().optional().describe("Group this record into a folder."),
|
|
11096
|
+
userId: import_zod6.z.string().optional().describe("Owning user id."),
|
|
11097
|
+
scopes: import_zod6.z.array(import_zod6.z.string()).optional().describe(
|
|
11098
|
+
"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."
|
|
11099
|
+
)
|
|
11100
|
+
});
|
|
11101
|
+
var inputSchema6 = {
|
|
11102
|
+
items: import_zod6.z.array(itemSchema).min(1).max(MCP_MAX_ITEMS).describe(
|
|
11103
|
+
`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.`
|
|
11104
|
+
),
|
|
11105
|
+
atomicity: import_zod6.z.enum(["best_effort", "all_or_nothing"]).optional().describe(
|
|
11106
|
+
'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).'
|
|
11107
|
+
),
|
|
11108
|
+
upsert: import_zod6.z.boolean().optional().describe(
|
|
11109
|
+
"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."
|
|
11110
|
+
),
|
|
11111
|
+
allowClear: import_zod6.z.boolean().optional().describe(
|
|
11112
|
+
"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."
|
|
11113
|
+
)
|
|
11114
|
+
};
|
|
11115
|
+
var recordBatchWrite = ({ client, log }) => ({
|
|
11116
|
+
name: "record_batch_write",
|
|
11117
|
+
title: "Create or upsert multiple records in one call",
|
|
11118
|
+
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).',
|
|
11119
|
+
inputSchema: inputSchema6,
|
|
11120
|
+
// Creates by default, and can overwrite existing records as a FULL replacement when
|
|
11121
|
+
// `upsert:true` is passed (destructive to whatever fields the old version carried and
|
|
11122
|
+
// this call omits). Idempotent ONLY when every item supplies `externalId` (optional,
|
|
11123
|
+
// per its own field doc above) — re-submitting then converges, with or without
|
|
11124
|
+
// `upsert:true`. `externalId` is not required, so annotated for the less-safe default:
|
|
11125
|
+
// an item with no `externalId` at all has no dedup key, and a resubmit creates a second
|
|
11126
|
+
// record for it regardless of `upsert`. Same standard applied to record_create/
|
|
11127
|
+
// document_ingest's identical optional-externalId shape.
|
|
11128
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
11129
|
+
handler: async (args) => {
|
|
11130
|
+
const items = args.items;
|
|
11131
|
+
const atomicity = args.atomicity;
|
|
11132
|
+
try {
|
|
11133
|
+
const body = {
|
|
11134
|
+
items: items.map((item) => ({
|
|
11135
|
+
typeName: item.type,
|
|
11136
|
+
payload: item.fields,
|
|
11137
|
+
externalId: item.externalId,
|
|
11138
|
+
indexMode: item.indexMode,
|
|
11139
|
+
status: item.status,
|
|
11140
|
+
folderId: item.folderId,
|
|
11141
|
+
userId: item.userId,
|
|
11142
|
+
scopes: item.scopes
|
|
11143
|
+
})),
|
|
11144
|
+
atomicity,
|
|
11145
|
+
upsert: args.upsert,
|
|
11146
|
+
allowClear: args.allowClear
|
|
11147
|
+
};
|
|
11148
|
+
const response = await client.records.batchWriteRecords(body, { maxRetries: 0 });
|
|
11149
|
+
log.debug(
|
|
11150
|
+
{
|
|
11151
|
+
tool: "record_batch_write",
|
|
11152
|
+
submitted: items.length,
|
|
11153
|
+
atomicity: atomicity ?? "best_effort",
|
|
11154
|
+
succeeded: response.succeeded,
|
|
11155
|
+
failed: response.failed
|
|
11156
|
+
},
|
|
11157
|
+
"record_batch_write ok"
|
|
11158
|
+
);
|
|
11159
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
11160
|
+
} catch (err) {
|
|
11161
|
+
log.warn(
|
|
11162
|
+
{ tool: "record_batch_write", itemCount: items?.length, err: String(err) },
|
|
11163
|
+
"record_batch_write failed"
|
|
11164
|
+
);
|
|
11165
|
+
return toolError("record_batch_write", err);
|
|
11166
|
+
}
|
|
11167
|
+
}
|
|
11168
|
+
});
|
|
11169
|
+
var record_batch_write_default = recordBatchWrite;
|
|
11170
|
+
|
|
11171
|
+
// src/tools/record_update.ts
|
|
11172
|
+
var import_zod7 = require("zod");
|
|
11173
|
+
var inputSchema7 = {
|
|
11174
|
+
id: import_zod7.z.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
|
|
11175
|
+
externalId: import_zod7.z.string().optional().describe(
|
|
10079
11176
|
"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."
|
|
10080
11177
|
),
|
|
10081
|
-
type:
|
|
10082
|
-
fields:
|
|
11178
|
+
type: import_zod7.z.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11179
|
+
fields: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).describe(
|
|
10083
11180
|
"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."
|
|
10084
11181
|
),
|
|
10085
|
-
status:
|
|
10086
|
-
expectedVersion:
|
|
11182
|
+
status: import_zod7.z.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
|
|
11183
|
+
expectedVersion: import_zod7.z.number().int().optional().describe(
|
|
10087
11184
|
"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."
|
|
10088
11185
|
)
|
|
10089
11186
|
};
|
|
@@ -10091,7 +11188,11 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10091
11188
|
name: "record_update",
|
|
10092
11189
|
title: "Update a record by id or externalId",
|
|
10093
11190
|
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.",
|
|
10094
|
-
inputSchema:
|
|
11191
|
+
inputSchema: inputSchema7,
|
|
11192
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11193
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11194
|
+
// same state, so it is idempotent.
|
|
11195
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10095
11196
|
handler: async (args) => {
|
|
10096
11197
|
const id = args.id;
|
|
10097
11198
|
const externalId = args.externalId;
|
|
@@ -10117,15 +11218,19 @@ var recordUpdate = ({ client, log }) => ({
|
|
|
10117
11218
|
var record_update_default = recordUpdate;
|
|
10118
11219
|
|
|
10119
11220
|
// src/tools/record_delete.ts
|
|
10120
|
-
var
|
|
10121
|
-
var
|
|
10122
|
-
id:
|
|
11221
|
+
var import_zod8 = require("zod");
|
|
11222
|
+
var inputSchema8 = {
|
|
11223
|
+
id: import_zod8.z.string().min(1, "id is required").describe("The Vectros record id to delete.")
|
|
10123
11224
|
};
|
|
10124
11225
|
var recordDelete = ({ client, log }) => ({
|
|
10125
11226
|
name: "record_delete",
|
|
10126
11227
|
title: "Delete a record",
|
|
10127
11228
|
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.",
|
|
10128
|
-
inputSchema:
|
|
11229
|
+
inputSchema: inputSchema8,
|
|
11230
|
+
// Deletes (leaves a tombstone server-side, but the record is gone from every normal
|
|
11231
|
+
// read path). Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11232
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11233
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10129
11234
|
handler: async (args) => {
|
|
10130
11235
|
const id = args.id;
|
|
10131
11236
|
try {
|
|
@@ -10141,49 +11246,72 @@ var recordDelete = ({ client, log }) => ({
|
|
|
10141
11246
|
var record_delete_default = recordDelete;
|
|
10142
11247
|
|
|
10143
11248
|
// src/tools/rag_ask.ts
|
|
10144
|
-
var
|
|
11249
|
+
var import_zod9 = require("zod");
|
|
10145
11250
|
var SEARCH_MCP_DEFAULT_LIMIT = 5;
|
|
10146
11251
|
var SEARCH_MCP_MAX_LIMIT = 50;
|
|
10147
|
-
var
|
|
10148
|
-
query:
|
|
10149
|
-
instructions:
|
|
11252
|
+
var inputSchema9 = {
|
|
11253
|
+
query: import_zod9.z.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
|
|
11254
|
+
instructions: import_zod9.z.string().optional().describe(
|
|
10150
11255
|
'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.'
|
|
10151
11256
|
),
|
|
10152
|
-
model:
|
|
11257
|
+
model: import_zod9.z.string().optional().describe(
|
|
10153
11258
|
"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."
|
|
10154
11259
|
),
|
|
10155
|
-
search:
|
|
10156
|
-
mode:
|
|
10157
|
-
limit:
|
|
11260
|
+
search: import_zod9.z.object({
|
|
11261
|
+
mode: import_zod9.z.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
|
|
11262
|
+
limit: import_zod9.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
10158
11263
|
`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.`
|
|
10159
11264
|
),
|
|
10160
11265
|
// Retrieval scoping — parity with hybrid_search so an agent can ground the
|
|
10161
11266
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
10162
11267
|
// whole-tenant corpus.
|
|
10163
|
-
userId:
|
|
10164
|
-
scope:
|
|
10165
|
-
'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.'
|
|
11268
|
+
userId: import_zod9.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
11269
|
+
scope: import_zod9.z.string().optional().describe(
|
|
11270
|
+
'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.'
|
|
10166
11271
|
),
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
11272
|
+
scopeFilters: import_zod9.z.array(import_zod9.z.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
|
|
11273
|
+
'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`.'
|
|
11274
|
+
),
|
|
11275
|
+
folderId: import_zod9.z.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
11276
|
+
rootFolderId: import_zod9.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
11277
|
+
typeName: import_zod9.z.string().optional().describe("Restrict record retrieval to this schema type."),
|
|
11278
|
+
contentTypes: import_zod9.z.array(import_zod9.z.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
|
|
11279
|
+
filters: import_zod9.z.record(import_zod9.z.unknown()).optional().describe(
|
|
10172
11280
|
'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"}.'
|
|
10173
11281
|
),
|
|
10174
|
-
createdAfter:
|
|
10175
|
-
|
|
10176
|
-
|
|
11282
|
+
createdAfter: import_zod9.z.string().optional().describe(
|
|
11283
|
+
"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."
|
|
11284
|
+
),
|
|
11285
|
+
createdBefore: import_zod9.z.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
|
|
11286
|
+
requireComplete: import_zod9.z.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
|
|
10177
11287
|
}).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
|
|
10178
|
-
maxTokens:
|
|
10179
|
-
temperature:
|
|
11288
|
+
maxTokens: import_zod9.z.number().int().min(1).optional().describe("Max output tokens."),
|
|
11289
|
+
temperature: import_zod9.z.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
|
|
10180
11290
|
};
|
|
10181
11291
|
var ragAsk = ({ client, log }) => ({
|
|
10182
11292
|
name: "rag_ask",
|
|
10183
11293
|
title: "RAG ask (corpus-wide)",
|
|
10184
|
-
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.",
|
|
10185
|
-
inputSchema:
|
|
11294
|
+
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.",
|
|
11295
|
+
inputSchema: inputSchema9,
|
|
11296
|
+
// NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
|
|
11297
|
+
// balance before generation starts, then debits it on completion — a real financial side
|
|
11298
|
+
// effect that can trigger a configured auto-recharge against the tenant's card.
|
|
11299
|
+
// `readOnlyHint:true` would let a host
|
|
11300
|
+
// skip a confirmation prompt on a call with real, unbounded-under-retry spend; ordinary reads
|
|
11301
|
+
// that merely meter usage stay `readOnlyHint:true` (hybrid_search has no inference-cost leg),
|
|
11302
|
+
// but a call that can debit a balance and possibly charge a card is a different class. Not
|
|
11303
|
+
// idempotent either: every repeat charges again, and generation is non-deterministic.
|
|
11304
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10186
11305
|
handler: async (args, extra) => {
|
|
11306
|
+
const rawSearch = args.search ?? {};
|
|
11307
|
+
if (rawSearch.scope !== void 0 && rawSearch.scopeFilters !== void 0) {
|
|
11308
|
+
return toolError(
|
|
11309
|
+
"rag_ask",
|
|
11310
|
+
new Error(
|
|
11311
|
+
"search.scope and search.scopeFilters are mutually exclusive \u2014 pass 'scope' for a single ownership dimension, or 'scopeFilters' for more than one, not both."
|
|
11312
|
+
)
|
|
11313
|
+
);
|
|
11314
|
+
}
|
|
10187
11315
|
try {
|
|
10188
11316
|
const searchArg = args.search ?? {};
|
|
10189
11317
|
const search = {
|
|
@@ -10191,6 +11319,7 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10191
11319
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
10192
11320
|
userId: searchArg.userId,
|
|
10193
11321
|
scope: searchArg.scope,
|
|
11322
|
+
scopeFilters: searchArg.scopeFilters,
|
|
10194
11323
|
folderId: searchArg.folderId,
|
|
10195
11324
|
rootFolderId: searchArg.rootFolderId,
|
|
10196
11325
|
typeName: searchArg.typeName,
|
|
@@ -10258,20 +11387,29 @@ var ragAsk = ({ client, log }) => ({
|
|
|
10258
11387
|
var rag_ask_default = ragAsk;
|
|
10259
11388
|
|
|
10260
11389
|
// src/tools/document_ask.ts
|
|
10261
|
-
var
|
|
10262
|
-
var
|
|
10263
|
-
documentId:
|
|
10264
|
-
prompt:
|
|
10265
|
-
model:
|
|
11390
|
+
var import_zod10 = require("zod");
|
|
11391
|
+
var inputSchema10 = {
|
|
11392
|
+
documentId: import_zod10.z.string().min(1, "documentId is required").describe("ID of the document to ask against."),
|
|
11393
|
+
prompt: import_zod10.z.string().min(1, "prompt is required").describe("Question to ask about the document."),
|
|
11394
|
+
model: import_zod10.z.string().optional().describe(
|
|
10266
11395
|
"Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
10267
11396
|
),
|
|
10268
|
-
maxTokens:
|
|
11397
|
+
maxTokens: import_zod10.z.number().int().min(1).optional().describe("Max output tokens.")
|
|
10269
11398
|
};
|
|
10270
11399
|
var documentAsk = ({ client, log }) => ({
|
|
10271
11400
|
name: "document_ask",
|
|
10272
11401
|
title: "Document ask (single-document)",
|
|
10273
11402
|
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.",
|
|
10274
|
-
inputSchema:
|
|
11403
|
+
inputSchema: inputSchema10,
|
|
11404
|
+
// NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
|
|
11405
|
+
// balance before generation starts, then debits it on completion — a real financial side
|
|
11406
|
+
// effect that can trigger a configured auto-recharge against the tenant's card.
|
|
11407
|
+
// `readOnlyHint:true` would let a host
|
|
11408
|
+
// skip a confirmation prompt on a call with real, unbounded-under-retry spend; ordinary reads
|
|
11409
|
+
// that merely meter usage stay `readOnlyHint:true` (hybrid_search has no inference-cost leg),
|
|
11410
|
+
// but a call that can debit a balance and possibly charge a card is a different class. Not
|
|
11411
|
+
// idempotent either: every repeat charges again, and generation is non-deterministic.
|
|
11412
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10275
11413
|
handler: async (args, extra) => {
|
|
10276
11414
|
try {
|
|
10277
11415
|
const stream = await client.inference.documentAsk({
|
|
@@ -10330,18 +11468,18 @@ var documentAsk = ({ client, log }) => ({
|
|
|
10330
11468
|
var document_ask_default = documentAsk;
|
|
10331
11469
|
|
|
10332
11470
|
// src/tools/list_schemas.ts
|
|
10333
|
-
var
|
|
10334
|
-
var
|
|
10335
|
-
userId:
|
|
11471
|
+
var import_zod11 = require("zod");
|
|
11472
|
+
var inputSchema11 = {
|
|
11473
|
+
userId: import_zod11.z.string().optional().describe(
|
|
10336
11474
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
10337
11475
|
),
|
|
10338
|
-
scope:
|
|
11476
|
+
scope: import_zod11.z.string().optional().describe(
|
|
10339
11477
|
'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.'
|
|
10340
11478
|
),
|
|
10341
|
-
surface:
|
|
11479
|
+
surface: import_zod11.z.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
10342
11480
|
"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."
|
|
10343
11481
|
),
|
|
10344
|
-
recordType:
|
|
11482
|
+
recordType: import_zod11.z.string().optional().describe(
|
|
10345
11483
|
'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.'
|
|
10346
11484
|
)
|
|
10347
11485
|
};
|
|
@@ -10349,7 +11487,9 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10349
11487
|
name: "list_schemas",
|
|
10350
11488
|
title: "List record schemas",
|
|
10351
11489
|
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.',
|
|
10352
|
-
inputSchema:
|
|
11490
|
+
inputSchema: inputSchema11,
|
|
11491
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11492
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10353
11493
|
handler: async (args) => {
|
|
10354
11494
|
const userId = args.userId;
|
|
10355
11495
|
const scope = args.scope;
|
|
@@ -10375,18 +11515,18 @@ var listSchemas = ({ client, log }) => ({
|
|
|
10375
11515
|
var list_schemas_default = listSchemas;
|
|
10376
11516
|
|
|
10377
11517
|
// src/tools/document_get.ts
|
|
10378
|
-
var
|
|
11518
|
+
var import_zod12 = require("zod");
|
|
10379
11519
|
var MAX_TEXT_CHARS = 32e3;
|
|
10380
|
-
var
|
|
10381
|
-
documentId:
|
|
10382
|
-
externalId:
|
|
11520
|
+
var inputSchema12 = {
|
|
11521
|
+
documentId: import_zod12.z.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
|
|
11522
|
+
externalId: import_zod12.z.string().optional().describe(
|
|
10383
11523
|
"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."
|
|
10384
11524
|
),
|
|
10385
|
-
type:
|
|
10386
|
-
includeText:
|
|
11525
|
+
type: import_zod12.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11526
|
+
includeText: import_zod12.z.boolean().optional().describe(
|
|
10387
11527
|
"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."
|
|
10388
11528
|
),
|
|
10389
|
-
includeDownloadUrl:
|
|
11529
|
+
includeDownloadUrl: import_zod12.z.boolean().optional().describe(
|
|
10390
11530
|
"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."
|
|
10391
11531
|
)
|
|
10392
11532
|
};
|
|
@@ -10403,7 +11543,9 @@ var documentGet = ({ client, log }) => ({
|
|
|
10403
11543
|
name: "document_get",
|
|
10404
11544
|
title: "Get document metadata (and optionally text)",
|
|
10405
11545
|
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.",
|
|
10406
|
-
inputSchema:
|
|
11546
|
+
inputSchema: inputSchema12,
|
|
11547
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11548
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10407
11549
|
handler: async (args) => {
|
|
10408
11550
|
const documentId = args.documentId;
|
|
10409
11551
|
const externalId = args.externalId;
|
|
@@ -10468,28 +11610,28 @@ var documentGet = ({ client, log }) => ({
|
|
|
10468
11610
|
var document_get_default = documentGet;
|
|
10469
11611
|
|
|
10470
11612
|
// src/tools/document_query.ts
|
|
10471
|
-
var
|
|
11613
|
+
var import_zod13 = require("zod");
|
|
10472
11614
|
var MCP_DEFAULT_LIMIT3 = 3;
|
|
10473
11615
|
var MCP_MAX_LIMIT3 = 100;
|
|
10474
|
-
var
|
|
11616
|
+
var inputSchema13 = {
|
|
10475
11617
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
10476
|
-
field:
|
|
10477
|
-
value:
|
|
10478
|
-
from:
|
|
10479
|
-
to:
|
|
10480
|
-
prefix:
|
|
10481
|
-
order:
|
|
11618
|
+
field: import_zod13.z.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
|
|
11619
|
+
value: import_zod13.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
|
|
11620
|
+
from: import_zod13.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
|
|
11621
|
+
to: import_zod13.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
11622
|
+
prefix: import_zod13.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
11623
|
+
order: import_zod13.z.enum(["asc", "desc"]).optional().describe(
|
|
10482
11624
|
"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."
|
|
10483
11625
|
),
|
|
10484
|
-
type:
|
|
11626
|
+
type: import_zod13.z.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
|
|
10485
11627
|
// List-mode args:
|
|
10486
|
-
folderId:
|
|
10487
|
-
userId:
|
|
10488
|
-
scope:
|
|
11628
|
+
folderId: import_zod13.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
11629
|
+
userId: import_zod13.z.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
11630
|
+
scope: import_zod13.z.string().optional().describe(
|
|
10489
11631
|
'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.'
|
|
10490
11632
|
),
|
|
10491
|
-
startFrom:
|
|
10492
|
-
limit:
|
|
11633
|
+
startFrom: import_zod13.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
11634
|
+
limit: import_zod13.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
10493
11635
|
`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.`
|
|
10494
11636
|
)
|
|
10495
11637
|
};
|
|
@@ -10497,7 +11639,9 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10497
11639
|
name: "document_query",
|
|
10498
11640
|
title: "Document query (list or lookup)",
|
|
10499
11641
|
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.",
|
|
10500
|
-
inputSchema:
|
|
11642
|
+
inputSchema: inputSchema13,
|
|
11643
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11644
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10501
11645
|
handler: async (args) => {
|
|
10502
11646
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
10503
11647
|
const field = args.field;
|
|
@@ -10577,29 +11721,29 @@ var documentQuery = ({ client, log }) => ({
|
|
|
10577
11721
|
var document_query_default = documentQuery;
|
|
10578
11722
|
|
|
10579
11723
|
// src/tools/document_update.ts
|
|
10580
|
-
var
|
|
10581
|
-
var
|
|
10582
|
-
documentId:
|
|
10583
|
-
externalId:
|
|
11724
|
+
var import_zod14 = require("zod");
|
|
11725
|
+
var inputSchema14 = {
|
|
11726
|
+
documentId: import_zod14.z.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
|
|
11727
|
+
externalId: import_zod14.z.string().optional().describe(
|
|
10584
11728
|
"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."
|
|
10585
11729
|
),
|
|
10586
|
-
type:
|
|
10587
|
-
title:
|
|
10588
|
-
fields:
|
|
11730
|
+
type: import_zod14.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
|
|
11731
|
+
title: import_zod14.z.string().optional().describe("New title. Omit to keep the current title."),
|
|
11732
|
+
fields: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.unknown()).optional().describe(
|
|
10589
11733
|
"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."
|
|
10590
11734
|
),
|
|
10591
|
-
text:
|
|
11735
|
+
text: import_zod14.z.string().optional().describe(
|
|
10592
11736
|
"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."
|
|
10593
11737
|
),
|
|
10594
|
-
folderId:
|
|
10595
|
-
status:
|
|
11738
|
+
folderId: import_zod14.z.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
|
|
11739
|
+
status: import_zod14.z.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
|
|
10596
11740
|
"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."
|
|
10597
11741
|
),
|
|
10598
|
-
userId:
|
|
10599
|
-
scopes:
|
|
11742
|
+
userId: import_zod14.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11743
|
+
scopes: import_zod14.z.array(import_zod14.z.string()).optional().describe(
|
|
10600
11744
|
'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).'
|
|
10601
11745
|
),
|
|
10602
|
-
expectedVersion:
|
|
11746
|
+
expectedVersion: import_zod14.z.number().int().optional().describe(
|
|
10603
11747
|
"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."
|
|
10604
11748
|
)
|
|
10605
11749
|
};
|
|
@@ -10607,7 +11751,11 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10607
11751
|
name: "document_update",
|
|
10608
11752
|
title: "Update a document",
|
|
10609
11753
|
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.',
|
|
10610
|
-
inputSchema:
|
|
11754
|
+
inputSchema: inputSchema14,
|
|
11755
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11756
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11757
|
+
// same state, so it is idempotent.
|
|
11758
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10611
11759
|
handler: async (args) => {
|
|
10612
11760
|
const documentId = args.documentId;
|
|
10613
11761
|
const externalId = args.externalId;
|
|
@@ -10647,15 +11795,18 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
10647
11795
|
var document_update_default = documentUpdate;
|
|
10648
11796
|
|
|
10649
11797
|
// src/tools/document_delete.ts
|
|
10650
|
-
var
|
|
10651
|
-
var
|
|
10652
|
-
documentId:
|
|
11798
|
+
var import_zod15 = require("zod");
|
|
11799
|
+
var inputSchema15 = {
|
|
11800
|
+
documentId: import_zod15.z.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
|
|
10653
11801
|
};
|
|
10654
11802
|
var documentDelete = ({ client, log }) => ({
|
|
10655
11803
|
name: "document_delete",
|
|
10656
11804
|
title: "Delete a document",
|
|
10657
11805
|
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).',
|
|
10658
|
-
inputSchema:
|
|
11806
|
+
inputSchema: inputSchema15,
|
|
11807
|
+
// Deletes. Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11808
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11809
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10659
11810
|
handler: async (args) => {
|
|
10660
11811
|
const documentId = args.documentId;
|
|
10661
11812
|
try {
|
|
@@ -10673,18 +11824,18 @@ var documentDelete = ({ client, log }) => ({
|
|
|
10673
11824
|
var document_delete_default = documentDelete;
|
|
10674
11825
|
|
|
10675
11826
|
// src/tools/folder_query.ts
|
|
10676
|
-
var
|
|
11827
|
+
var import_zod16 = require("zod");
|
|
10677
11828
|
var MCP_DEFAULT_LIMIT4 = 10;
|
|
10678
11829
|
var MCP_MAX_LIMIT4 = 100;
|
|
10679
|
-
var
|
|
10680
|
-
id:
|
|
10681
|
-
parentId:
|
|
10682
|
-
userId:
|
|
10683
|
-
scope:
|
|
11830
|
+
var inputSchema16 = {
|
|
11831
|
+
id: import_zod16.z.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
11832
|
+
parentId: import_zod16.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
11833
|
+
userId: import_zod16.z.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
11834
|
+
scope: import_zod16.z.string().optional().describe(
|
|
10684
11835
|
'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.'
|
|
10685
11836
|
),
|
|
10686
|
-
startFrom:
|
|
10687
|
-
limit:
|
|
11837
|
+
startFrom: import_zod16.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
11838
|
+
limit: import_zod16.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
10688
11839
|
`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\`.`
|
|
10689
11840
|
)
|
|
10690
11841
|
};
|
|
@@ -10692,7 +11843,9 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10692
11843
|
name: "folder_query",
|
|
10693
11844
|
title: "Folder query (list or get)",
|
|
10694
11845
|
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.",
|
|
10695
|
-
inputSchema:
|
|
11846
|
+
inputSchema: inputSchema16,
|
|
11847
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
11848
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10696
11849
|
handler: async (args) => {
|
|
10697
11850
|
const id = args.id;
|
|
10698
11851
|
try {
|
|
@@ -10722,22 +11875,34 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10722
11875
|
var folder_query_default = folderQuery;
|
|
10723
11876
|
|
|
10724
11877
|
// src/tools/folder_create.ts
|
|
10725
|
-
var
|
|
10726
|
-
var
|
|
10727
|
-
name:
|
|
10728
|
-
description:
|
|
10729
|
-
parentId:
|
|
10730
|
-
slug:
|
|
10731
|
-
|
|
10732
|
-
|
|
11878
|
+
var import_zod17 = require("zod");
|
|
11879
|
+
var inputSchema17 = {
|
|
11880
|
+
name: import_zod17.z.string().min(1, "name is required").describe("Folder display name."),
|
|
11881
|
+
description: import_zod17.z.string().optional().describe("Optional description of the folder's purpose."),
|
|
11882
|
+
parentId: import_zod17.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
11883
|
+
slug: import_zod17.z.string().optional().describe(
|
|
11884
|
+
"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."
|
|
11885
|
+
),
|
|
11886
|
+
userId: import_zod17.z.string().optional().describe("Owning user (Vectros UUID)."),
|
|
11887
|
+
scopes: import_zod17.z.array(import_zod17.z.string()).optional().describe(
|
|
10733
11888
|
'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.'
|
|
10734
11889
|
)
|
|
10735
11890
|
};
|
|
10736
11891
|
var folderCreate = ({ client, log }) => ({
|
|
10737
11892
|
name: "folder_create",
|
|
10738
11893
|
title: "Create a folder",
|
|
10739
|
-
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).",
|
|
10740
|
-
inputSchema:
|
|
11894
|
+
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).",
|
|
11895
|
+
inputSchema: inputSchema17,
|
|
11896
|
+
// Idempotent ONLY when the caller supplies `slug` explicitly (see the doc comment above): an
|
|
11897
|
+
// omitted slug is derived through a collision-probing suffix loop that returns only a
|
|
11898
|
+
// freshly-proved-free value, so the idempotency check running after that derivation can never
|
|
11899
|
+
// match on the default path. `slug` is optional, so this is annotated for the less-safe default —
|
|
11900
|
+
// the same standard applied to record_create/document_ingest/record_batch_write's identical
|
|
11901
|
+
// optional-dedupe-key shape. (A prior version of this annotation claimed unconditional
|
|
11902
|
+
// idempotency, reasoning that the derived slug made this tool "genuinely structurally different"
|
|
11903
|
+
// from the optional-externalId tools — that reasoning was wrong: the derivation is unconditional,
|
|
11904
|
+
// but it is unconditionally NON-colliding by construction, which is the opposite property.)
|
|
11905
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
|
|
10741
11906
|
handler: async (args) => {
|
|
10742
11907
|
try {
|
|
10743
11908
|
const folder = await client.folders.createFolder({
|
|
@@ -10761,16 +11926,16 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10761
11926
|
var folder_create_default = folderCreate;
|
|
10762
11927
|
|
|
10763
11928
|
// src/tools/folder_update.ts
|
|
10764
|
-
var
|
|
10765
|
-
var
|
|
10766
|
-
id:
|
|
10767
|
-
name:
|
|
10768
|
-
description:
|
|
10769
|
-
userId:
|
|
10770
|
-
scopes:
|
|
11929
|
+
var import_zod18 = require("zod");
|
|
11930
|
+
var inputSchema18 = {
|
|
11931
|
+
id: import_zod18.z.string().min(1, "id is required").describe("The Vectros folder id to update."),
|
|
11932
|
+
name: import_zod18.z.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
11933
|
+
description: import_zod18.z.string().optional().describe("New description. Omit to leave unchanged."),
|
|
11934
|
+
userId: import_zod18.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
11935
|
+
scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
|
|
10771
11936
|
'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).'
|
|
10772
11937
|
),
|
|
10773
|
-
expectedVersion:
|
|
11938
|
+
expectedVersion: import_zod18.z.number().int().optional().describe(
|
|
10774
11939
|
"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."
|
|
10775
11940
|
)
|
|
10776
11941
|
};
|
|
@@ -10778,7 +11943,11 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10778
11943
|
name: "folder_update",
|
|
10779
11944
|
title: "Update a folder",
|
|
10780
11945
|
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.",
|
|
10781
|
-
inputSchema:
|
|
11946
|
+
inputSchema: inputSchema18,
|
|
11947
|
+
// A JSON Merge Patch — overwrites the fields it names, so it can destroy a prior field
|
|
11948
|
+
// value the caller did not mean to lose. Re-applying the same patch converges to the
|
|
11949
|
+
// same state, so it is idempotent.
|
|
11950
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10782
11951
|
handler: async (args) => {
|
|
10783
11952
|
const id = args.id;
|
|
10784
11953
|
const name = args.name;
|
|
@@ -10805,15 +11974,18 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10805
11974
|
var folder_update_default = folderUpdate;
|
|
10806
11975
|
|
|
10807
11976
|
// src/tools/folder_delete.ts
|
|
10808
|
-
var
|
|
10809
|
-
var
|
|
10810
|
-
id:
|
|
11977
|
+
var import_zod19 = require("zod");
|
|
11978
|
+
var inputSchema19 = {
|
|
11979
|
+
id: import_zod19.z.string().min(1, "id is required").describe("The Vectros folder id to delete.")
|
|
10811
11980
|
};
|
|
10812
11981
|
var folderDelete = ({ client, log }) => ({
|
|
10813
11982
|
name: "folder_delete",
|
|
10814
11983
|
title: "Delete a folder",
|
|
10815
|
-
description:
|
|
10816
|
-
inputSchema:
|
|
11984
|
+
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.',
|
|
11985
|
+
inputSchema: inputSchema19,
|
|
11986
|
+
// Deletes. Idempotent in the standard REST sense: the end state ("this id no longer
|
|
11987
|
+
// resolves") is the same whether this is the first delete or a repeat of one.
|
|
11988
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
|
|
10817
11989
|
handler: async (args) => {
|
|
10818
11990
|
const id = args.id;
|
|
10819
11991
|
try {
|
|
@@ -10829,14 +12001,16 @@ var folderDelete = ({ client, log }) => ({
|
|
|
10829
12001
|
var folder_delete_default = folderDelete;
|
|
10830
12002
|
|
|
10831
12003
|
// src/tools/current_identity.ts
|
|
10832
|
-
var
|
|
12004
|
+
var inputSchema20 = {
|
|
10833
12005
|
// No args — current_identity describes the current credential.
|
|
10834
12006
|
};
|
|
10835
12007
|
var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
10836
12008
|
name: "current_identity",
|
|
10837
12009
|
title: "Current identity (tenant + principal scope)",
|
|
10838
12010
|
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.",
|
|
10839
|
-
inputSchema:
|
|
12011
|
+
inputSchema: inputSchema20,
|
|
12012
|
+
// A pure read (/v1/ping) — never creates, modifies, or deletes anything server-side.
|
|
12013
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
10840
12014
|
handler: async () => {
|
|
10841
12015
|
try {
|
|
10842
12016
|
const identity = await resolveIdentity({ log, apiKey, environment });
|
|
@@ -10852,7 +12026,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
|
|
|
10852
12026
|
var current_identity_default = currentIdentity;
|
|
10853
12027
|
|
|
10854
12028
|
// src/tools/document_ingest.ts
|
|
10855
|
-
var
|
|
12029
|
+
var import_zod20 = require("zod");
|
|
10856
12030
|
var import_promises = require("fs/promises");
|
|
10857
12031
|
var import_node_path = require("path");
|
|
10858
12032
|
var IngestPathError = class extends Error {
|
|
@@ -10927,37 +12101,37 @@ function inferMimeType(filePath) {
|
|
|
10927
12101
|
const ext = (0, import_node_path.extname)(filePath).toLowerCase();
|
|
10928
12102
|
return EXT_TO_MIME[ext] ?? "application/octet-stream";
|
|
10929
12103
|
}
|
|
10930
|
-
var
|
|
10931
|
-
title:
|
|
10932
|
-
indexMode:
|
|
12104
|
+
var inputSchema21 = {
|
|
12105
|
+
title: import_zod20.z.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
|
|
12106
|
+
indexMode: import_zod20.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
|
|
10933
12107
|
"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."
|
|
10934
12108
|
),
|
|
10935
|
-
externalId:
|
|
12109
|
+
externalId: import_zod20.z.string().optional().describe(
|
|
10936
12110
|
'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.'
|
|
10937
12111
|
),
|
|
10938
|
-
upsert:
|
|
12112
|
+
upsert: import_zod20.z.boolean().optional().describe(
|
|
10939
12113
|
"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)."
|
|
10940
12114
|
),
|
|
10941
|
-
schemaId:
|
|
12115
|
+
schemaId: import_zod20.z.string().optional().describe(
|
|
10942
12116
|
"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."
|
|
10943
12117
|
),
|
|
10944
|
-
payload:
|
|
12118
|
+
payload: import_zod20.z.record(import_zod20.z.string(), import_zod20.z.unknown()).optional().describe(
|
|
10945
12119
|
"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."
|
|
10946
12120
|
),
|
|
10947
12121
|
// Inline text mode (mutually exclusive with filePath):
|
|
10948
|
-
text:
|
|
10949
|
-
storeText:
|
|
12122
|
+
text: import_zod20.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
|
|
12123
|
+
storeText: import_zod20.z.boolean().optional().describe(
|
|
10950
12124
|
"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."
|
|
10951
12125
|
),
|
|
10952
12126
|
// File upload mode (mutually exclusive with text; stdio-transport-only):
|
|
10953
|
-
filePath:
|
|
12127
|
+
filePath: import_zod20.z.string().min(1).optional().describe(
|
|
10954
12128
|
"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."
|
|
10955
12129
|
),
|
|
10956
|
-
fileType:
|
|
12130
|
+
fileType: import_zod20.z.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
|
|
10957
12131
|
// Common (both modes):
|
|
10958
|
-
folderId:
|
|
10959
|
-
userId:
|
|
10960
|
-
scopes:
|
|
12132
|
+
folderId: import_zod20.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
12133
|
+
userId: import_zod20.z.string().optional().describe("Owning user ID. Optional."),
|
|
12134
|
+
scopes: import_zod20.z.array(import_zod20.z.string()).optional().describe(
|
|
10961
12135
|
"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."
|
|
10962
12136
|
)
|
|
10963
12137
|
};
|
|
@@ -10965,7 +12139,17 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10965
12139
|
name: "document_ingest",
|
|
10966
12140
|
title: "Ingest a new document (text body or file upload)",
|
|
10967
12141
|
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`.",
|
|
10968
|
-
inputSchema:
|
|
12142
|
+
inputSchema: inputSchema21,
|
|
12143
|
+
// Creates by default, idempotent ONLY when the caller supplies `externalId` (optional,
|
|
12144
|
+
// per the doc comment above) — re-ingest then returns the existing document rather than
|
|
12145
|
+
// duplicating it. `externalId` is not required, so annotated for the less-safe default
|
|
12146
|
+
// (omit it, and every call creates a new document), same standard applied to
|
|
12147
|
+
// record_create/record_batch_write's identical optional-externalId shape. `upsert:true`
|
|
12148
|
+
// is a further, real, named capability of this tool that OVERWRITES an existing
|
|
12149
|
+
// document's content and re-indexes it — that path is destructive to the prior body, so
|
|
12150
|
+
// this is flagged destructive rather than claiming create-only safety a caller can
|
|
12151
|
+
// invoke past.
|
|
12152
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },
|
|
10969
12153
|
handler: async (args) => {
|
|
10970
12154
|
const title = args.title;
|
|
10971
12155
|
const text = args.text;
|
|
@@ -11076,7 +12260,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11076
12260
|
}
|
|
11077
12261
|
const putRes = await fetch(uploadUrl, {
|
|
11078
12262
|
method: "PUT",
|
|
11079
|
-
headers: { "Content-Type": fileType },
|
|
12263
|
+
headers: { "Content-Type": fileType, ...presignedUploadHeaders(upload) },
|
|
11080
12264
|
body: bytes
|
|
11081
12265
|
});
|
|
11082
12266
|
if (!putRes.ok) {
|
|
@@ -11115,31 +12299,38 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
11115
12299
|
}
|
|
11116
12300
|
});
|
|
11117
12301
|
var document_ingest_default = documentIngest;
|
|
12302
|
+
function presignedUploadHeaders(response) {
|
|
12303
|
+
if (typeof response !== "object" || response === null) return {};
|
|
12304
|
+
const { requiredHeaderName, requiredHeaderValue } = response;
|
|
12305
|
+
if (typeof requiredHeaderName !== "string" || requiredHeaderName === "") return {};
|
|
12306
|
+
if (typeof requiredHeaderValue !== "string") return {};
|
|
12307
|
+
return { [requiredHeaderName]: requiredHeaderValue };
|
|
12308
|
+
}
|
|
11118
12309
|
|
|
11119
12310
|
// src/tools/lookup_principal.ts
|
|
11120
|
-
var
|
|
12311
|
+
var import_zod21 = require("zod");
|
|
11121
12312
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
11122
12313
|
var MCP_MAX_LIMIT5 = 100;
|
|
11123
|
-
var
|
|
11124
|
-
kind:
|
|
12314
|
+
var inputSchema22 = {
|
|
12315
|
+
kind: import_zod21.z.string().describe(
|
|
11125
12316
|
'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.'
|
|
11126
12317
|
),
|
|
11127
|
-
externalId:
|
|
12318
|
+
externalId: import_zod21.z.string().optional().describe(
|
|
11128
12319
|
"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."
|
|
11129
12320
|
),
|
|
11130
|
-
contextId:
|
|
12321
|
+
contextId: import_zod21.z.string().optional().describe(
|
|
11131
12322
|
"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."
|
|
11132
12323
|
),
|
|
11133
12324
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
11134
|
-
type:
|
|
11135
|
-
field:
|
|
11136
|
-
value:
|
|
11137
|
-
from:
|
|
11138
|
-
to:
|
|
11139
|
-
prefix:
|
|
11140
|
-
order:
|
|
11141
|
-
startFrom:
|
|
11142
|
-
limit:
|
|
12325
|
+
type: import_zod21.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
|
|
12326
|
+
field: import_zod21.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
|
|
12327
|
+
value: import_zod21.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
|
|
12328
|
+
from: import_zod21.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
|
|
12329
|
+
to: import_zod21.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
12330
|
+
prefix: import_zod21.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
12331
|
+
order: import_zod21.z.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
|
|
12332
|
+
startFrom: import_zod21.z.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
12333
|
+
limit: import_zod21.z.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
|
|
11143
12334
|
`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\`.`
|
|
11144
12335
|
)
|
|
11145
12336
|
};
|
|
@@ -11147,7 +12338,9 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11147
12338
|
name: "lookup_principal",
|
|
11148
12339
|
title: "Look up a user identity or a namespaced identity entity",
|
|
11149
12340
|
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.",
|
|
11150
|
-
inputSchema:
|
|
12341
|
+
inputSchema: inputSchema22,
|
|
12342
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
12343
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
11151
12344
|
handler: async (args) => {
|
|
11152
12345
|
const kind = args.kind;
|
|
11153
12346
|
const isUser = kind === "user";
|
|
@@ -11221,17 +12414,19 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
11221
12414
|
var lookup_principal_default = lookupPrincipal;
|
|
11222
12415
|
|
|
11223
12416
|
// src/tools/version_history.ts
|
|
11224
|
-
var
|
|
11225
|
-
var
|
|
11226
|
-
resourceType:
|
|
11227
|
-
id:
|
|
11228
|
-
startFrom:
|
|
12417
|
+
var import_zod22 = require("zod");
|
|
12418
|
+
var inputSchema23 = {
|
|
12419
|
+
resourceType: import_zod22.z.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
|
|
12420
|
+
id: import_zod22.z.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
|
|
12421
|
+
startFrom: import_zod22.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
|
|
11229
12422
|
};
|
|
11230
12423
|
var versionHistory = ({ client, log }) => ({
|
|
11231
12424
|
name: "version_history",
|
|
11232
12425
|
title: "Version history (record or document)",
|
|
11233
12426
|
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.",
|
|
11234
|
-
inputSchema:
|
|
12427
|
+
inputSchema: inputSchema23,
|
|
12428
|
+
// A pure read — never creates, modifies, or deletes anything server-side.
|
|
12429
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
|
|
11235
12430
|
handler: async (args) => {
|
|
11236
12431
|
const resourceType = args.resourceType;
|
|
11237
12432
|
const id = args.id;
|
|
@@ -11260,6 +12455,7 @@ var TOOL_NAMES = [
|
|
|
11260
12455
|
"record_get",
|
|
11261
12456
|
"record_batch_get",
|
|
11262
12457
|
"record_create",
|
|
12458
|
+
"record_batch_write",
|
|
11263
12459
|
"record_update",
|
|
11264
12460
|
"record_delete",
|
|
11265
12461
|
"rag_ask",
|
|
@@ -11286,6 +12482,7 @@ var ALL_TOOL_FACTORIES = {
|
|
|
11286
12482
|
record_get: record_get_default,
|
|
11287
12483
|
record_batch_get: record_batch_get_default,
|
|
11288
12484
|
record_create: record_create_default,
|
|
12485
|
+
record_batch_write: record_batch_write_default,
|
|
11289
12486
|
record_update: record_update_default,
|
|
11290
12487
|
record_delete: record_delete_default,
|
|
11291
12488
|
rag_ask: rag_ask_default,
|
|
@@ -11345,7 +12542,7 @@ var ALL_RESOURCE_FACTORIES = {
|
|
|
11345
12542
|
};
|
|
11346
12543
|
|
|
11347
12544
|
// src/zod-to-json-schema.ts
|
|
11348
|
-
var
|
|
12545
|
+
var import_zod23 = require("zod");
|
|
11349
12546
|
function zodShapeToJsonSchema(shape) {
|
|
11350
12547
|
const properties = {};
|
|
11351
12548
|
const required = [];
|
|
@@ -11360,40 +12557,40 @@ function zodShapeToJsonSchema(shape) {
|
|
|
11360
12557
|
function zodTypeToJsonSchema(schema) {
|
|
11361
12558
|
const description = schema.description;
|
|
11362
12559
|
let current = schema;
|
|
11363
|
-
while (current instanceof
|
|
12560
|
+
while (current instanceof import_zod23.z.ZodOptional || current instanceof import_zod23.z.ZodDefault || current instanceof import_zod23.z.ZodNullable) {
|
|
11364
12561
|
current = current._def.innerType;
|
|
11365
12562
|
}
|
|
11366
12563
|
const base = description ? { description } : {};
|
|
11367
|
-
if (current instanceof
|
|
12564
|
+
if (current instanceof import_zod23.z.ZodString) {
|
|
11368
12565
|
return { ...base, type: "string" };
|
|
11369
12566
|
}
|
|
11370
|
-
if (current instanceof
|
|
12567
|
+
if (current instanceof import_zod23.z.ZodNumber) {
|
|
11371
12568
|
return { ...base, type: "number" };
|
|
11372
12569
|
}
|
|
11373
|
-
if (current instanceof
|
|
12570
|
+
if (current instanceof import_zod23.z.ZodBoolean) {
|
|
11374
12571
|
return { ...base, type: "boolean" };
|
|
11375
12572
|
}
|
|
11376
|
-
if (current instanceof
|
|
12573
|
+
if (current instanceof import_zod23.z.ZodEnum) {
|
|
11377
12574
|
return {
|
|
11378
12575
|
...base,
|
|
11379
12576
|
type: "string",
|
|
11380
12577
|
enum: current.options
|
|
11381
12578
|
};
|
|
11382
12579
|
}
|
|
11383
|
-
if (current instanceof
|
|
12580
|
+
if (current instanceof import_zod23.z.ZodArray) {
|
|
11384
12581
|
return {
|
|
11385
12582
|
...base,
|
|
11386
12583
|
type: "array",
|
|
11387
12584
|
items: zodTypeToJsonSchema(current.element)
|
|
11388
12585
|
};
|
|
11389
12586
|
}
|
|
11390
|
-
if (current instanceof
|
|
12587
|
+
if (current instanceof import_zod23.z.ZodObject) {
|
|
11391
12588
|
return {
|
|
11392
12589
|
...base,
|
|
11393
12590
|
...zodShapeToJsonSchema(current.shape)
|
|
11394
12591
|
};
|
|
11395
12592
|
}
|
|
11396
|
-
if (current instanceof
|
|
12593
|
+
if (current instanceof import_zod23.z.ZodRecord) {
|
|
11397
12594
|
const valueType = current._def.valueType;
|
|
11398
12595
|
return {
|
|
11399
12596
|
...base,
|
|
@@ -11507,7 +12704,12 @@ var VectrosMCPServer = class {
|
|
|
11507
12704
|
// MCP client (a well-behaved client rejects an unknown key before the call).
|
|
11508
12705
|
// The server enforces it too (z.object(...).strict() below) so a raw JSON-RPC
|
|
11509
12706
|
// call that skips client validation is still rejected — belt and suspenders.
|
|
11510
|
-
inputSchema: { ...zodShapeToJsonSchema(t.inputSchema), additionalProperties: false }
|
|
12707
|
+
inputSchema: { ...zodShapeToJsonSchema(t.inputSchema), additionalProperties: false },
|
|
12708
|
+
// Forwarded from the tool's own definition, not hand-copied here: adding an
|
|
12709
|
+
// annotation to a tool factory does nothing for a client unless it also reaches
|
|
12710
|
+
// this emitted list — the actual `tools/list` response a host reads, not the
|
|
12711
|
+
// source that builds it.
|
|
12712
|
+
...t.annotations ? { annotations: t.annotations } : {}
|
|
11511
12713
|
}))
|
|
11512
12714
|
})
|
|
11513
12715
|
);
|
|
@@ -11517,7 +12719,7 @@ var VectrosMCPServer = class {
|
|
|
11517
12719
|
if (!tool) {
|
|
11518
12720
|
result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
|
|
11519
12721
|
} else {
|
|
11520
|
-
const parsed =
|
|
12722
|
+
const parsed = import_zod24.z.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
|
|
11521
12723
|
if (!parsed.success) {
|
|
11522
12724
|
result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
|
|
11523
12725
|
} else {
|
|
@@ -11791,7 +12993,8 @@ async function main() {
|
|
|
11791
12993
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
11792
12994
|
process.stdout.write(`${formatBuildInfo()}
|
|
11793
12995
|
`);
|
|
11794
|
-
process.
|
|
12996
|
+
process.exitCode = 0;
|
|
12997
|
+
return;
|
|
11795
12998
|
}
|
|
11796
12999
|
const log = createLogger2();
|
|
11797
13000
|
const resolved = await resolveApiKey();
|
|
@@ -11800,7 +13003,8 @@ async function main() {
|
|
|
11800
13003
|
if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
|
|
11801
13004
|
if (!apiKey) {
|
|
11802
13005
|
log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
|
|
11803
|
-
process.
|
|
13006
|
+
process.exitCode = 1;
|
|
13007
|
+
return;
|
|
11804
13008
|
}
|
|
11805
13009
|
const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
|
|
11806
13010
|
if (apiBaseUrl !== void 0) {
|
|
@@ -11812,7 +13016,8 @@ async function main() {
|
|
|
11812
13016
|
} else {
|
|
11813
13017
|
log.fatal({ err: String(err) }, "invalid VECTROS_API_BASE_URL");
|
|
11814
13018
|
}
|
|
11815
|
-
process.
|
|
13019
|
+
process.exitCode = 1;
|
|
13020
|
+
return;
|
|
11816
13021
|
}
|
|
11817
13022
|
}
|
|
11818
13023
|
let tools;
|
|
@@ -11820,7 +13025,8 @@ async function main() {
|
|
|
11820
13025
|
tools = parseToolsEnv(process.env.VECTROS_MCP_TOOLS);
|
|
11821
13026
|
} catch (err) {
|
|
11822
13027
|
log.fatal({ err: String(err) }, "invalid VECTROS_MCP_TOOLS");
|
|
11823
|
-
process.
|
|
13028
|
+
process.exitCode = 1;
|
|
13029
|
+
return;
|
|
11824
13030
|
}
|
|
11825
13031
|
const skipFlag = (process.env.VECTROS_MCP_SKIP_PING_VALIDATION ?? "").toLowerCase();
|
|
11826
13032
|
const validateOnStart = !(skipFlag === "1" || skipFlag === "true");
|
|
@@ -11839,9 +13045,21 @@ async function main() {
|
|
|
11839
13045
|
} else {
|
|
11840
13046
|
log.fatal({ err: String(err) }, "startup failed");
|
|
11841
13047
|
}
|
|
11842
|
-
process.
|
|
13048
|
+
process.exitCode = 1;
|
|
13049
|
+
return;
|
|
11843
13050
|
}
|
|
11844
13051
|
const transport = createStdioTransport();
|
|
13052
|
+
try {
|
|
13053
|
+
await server.connect(transport);
|
|
13054
|
+
log.info(
|
|
13055
|
+
{ version: BUILD_INFO.mcpServer, sdk: BUILD_INFO.sdk },
|
|
13056
|
+
"vectros-mcp-server listening on stdio"
|
|
13057
|
+
);
|
|
13058
|
+
} catch (err) {
|
|
13059
|
+
log.fatal({ err: String(err) }, "failed to connect transport");
|
|
13060
|
+
process.exitCode = 2;
|
|
13061
|
+
return;
|
|
13062
|
+
}
|
|
11845
13063
|
const shutdown = async (signal) => {
|
|
11846
13064
|
log.info({ signal }, "shutdown requested");
|
|
11847
13065
|
try {
|
|
@@ -11853,16 +13071,6 @@ async function main() {
|
|
|
11853
13071
|
};
|
|
11854
13072
|
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
11855
13073
|
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
11856
|
-
try {
|
|
11857
|
-
await server.connect(transport);
|
|
11858
|
-
log.info(
|
|
11859
|
-
{ version: BUILD_INFO.mcpServer, sdk: BUILD_INFO.sdk },
|
|
11860
|
-
"vectros-mcp-server listening on stdio"
|
|
11861
|
-
);
|
|
11862
|
-
} catch (err) {
|
|
11863
|
-
log.fatal({ err: String(err) }, "failed to connect transport");
|
|
11864
|
-
process.exit(2);
|
|
11865
|
-
}
|
|
11866
13074
|
}
|
|
11867
13075
|
main().catch((err) => {
|
|
11868
13076
|
process.stderr.write(`fatal: ${err instanceof Error ? err.stack : String(err)}
|