@vectros-ai/mcp-server 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli-http.mjs CHANGED
@@ -2492,7 +2492,7 @@ var AuthClient = class {
2492
2492
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
2493
2493
  }
2494
2494
  /**
2495
- * 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. A root API key (`sk_`) is exempt from both bounds.
2495
+ * 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.
2496
2496
  *
2497
2497
  * @param {Vectros.CreateScopedKeyRequest} request
2498
2498
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2824,7 +2824,7 @@ var AuthClient = class {
2824
2824
  );
2825
2825
  }
2826
2826
  /**
2827
- * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile 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 profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2827
+ * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile 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 profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). The `principalId` must name a principal that already exists: a `usr_` principal must be a live user in your tenant, so create the user before granting it a profile. A `usr_` id that names no such user is rejected, and no profile is created. `key_` principals are not checked this way. You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2828
2828
  *
2829
2829
  * @param {Vectros.CreateAccessProfileRequest} request
2830
2830
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3925,7 +3925,7 @@ var AuthClient = class {
3925
3925
  );
3926
3926
  }
3927
3927
  /**
3928
- * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) 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.
3928
+ * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) 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.
3929
3929
  *
3930
3930
  * @param {Vectros.GetUsageRequest} request
3931
3931
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3988,7 +3988,7 @@ var AuthClient = class {
3988
3988
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3989
3989
  }
3990
3990
  /**
3991
- * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
3991
+ * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key sees every context. An ordinary bootstrap credential that didn't specify a context resolves to the `default` app context specifically, not every context — so this call returns 404 for an issuer registered under any other context unless you re-minted the bootstrap token pinned to that context.
3992
3992
  *
3993
3993
  * @param {Vectros.GetIssuerRequest} request
3994
3994
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4046,13 +4046,81 @@ var AuthClient = class {
4046
4046
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4047
4047
  }
4048
4048
  /**
4049
- * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. Unconditional — unlike some other registry deletes on this API, this does not check for or block on any downstream reference. Any user account already created via this issuer (by a prior self-signup or accepted invite) is NOT deleted or modified, but that user can no longer obtain a NEW token this way once you deregister the issuer — every `POST /v1/auth/token/exchange` call against it will 404, with no distinction between an unknown issuer and one you just deregistered. Register a replacement issuer, or restore this one, before your users' current tokens expire if you want their access to continue uninterrupted.
4049
+ * 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.
4050
+ *
4051
+ * @param {Vectros.IssuerUpdateRequest} request
4052
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4053
+ *
4054
+ * @throws {@link Vectros.BadRequestError}
4055
+ * @throws {@link Vectros.ForbiddenError}
4056
+ * @throws {@link Vectros.NotFoundError}
4057
+ * @throws {@link Vectros.TooManyRequestsError}
4058
+ *
4059
+ * @example
4060
+ * await client.auth.updateIssuer({
4061
+ * issuerId: "auth0-prod"
4062
+ * })
4063
+ */
4064
+ updateIssuer(request, requestOptions) {
4065
+ return HttpResponsePromise.fromPromise(this.__updateIssuer(request, requestOptions));
4066
+ }
4067
+ async __updateIssuer(request, requestOptions) {
4068
+ const { issuerId, ..._body } = request;
4069
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4070
+ const _headers = mergeHeaders(
4071
+ _authRequest.headers,
4072
+ this._options?.headers,
4073
+ requestOptions?.headers
4074
+ );
4075
+ const _response = await fetcher({
4076
+ url: url_exports.join(
4077
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4078
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4079
+ ),
4080
+ method: "PUT",
4081
+ headers: _headers,
4082
+ contentType: "application/json",
4083
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4084
+ requestType: "json",
4085
+ body: _body,
4086
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4087
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4088
+ abortSignal: requestOptions?.abortSignal,
4089
+ fetchFn: this._options?.fetch,
4090
+ logging: this._options.logging
4091
+ });
4092
+ if (_response.ok) {
4093
+ return { data: _response.body, rawResponse: _response.rawResponse };
4094
+ }
4095
+ if (_response.error.reason === "status-code") {
4096
+ switch (_response.error.statusCode) {
4097
+ case 400:
4098
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4099
+ case 403:
4100
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4101
+ case 404:
4102
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4103
+ case 429:
4104
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4105
+ default:
4106
+ throw new VectrosError({
4107
+ statusCode: _response.error.statusCode,
4108
+ body: _response.error.body,
4109
+ rawResponse: _response.rawResponse
4110
+ });
4111
+ }
4112
+ }
4113
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/auth/issuers/{issuerId}");
4114
+ }
4115
+ /**
4116
+ * 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. Deactivate the affected users first if you intend to cut off their access, or register a replacement issuer before removing this one. An issuer that has never been used for an exchange (no bound users yet) can always be deregistered.
4050
4117
  *
4051
4118
  * @param {Vectros.DeleteIssuerRequest} request
4052
4119
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4053
4120
  *
4054
4121
  * @throws {@link Vectros.ForbiddenError}
4055
4122
  * @throws {@link Vectros.NotFoundError}
4123
+ * @throws {@link Vectros.ConflictError}
4056
4124
  * @throws {@link Vectros.TooManyRequestsError}
4057
4125
  *
4058
4126
  * @example
@@ -4094,6 +4162,8 @@ var AuthClient = class {
4094
4162
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4095
4163
  case 404:
4096
4164
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4165
+ case 409:
4166
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4097
4167
  case 429:
4098
4168
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4099
4169
  default:
@@ -4112,7 +4182,7 @@ var AuthClient = class {
4112
4182
  );
4113
4183
  }
4114
4184
  /**
4115
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4185
+ * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only the issuers registered in that context; a root API key sees every context. An ordinary bootstrap credential that didn't specify a context resolves to the `default` app context specifically, not every context — so this call returns an empty page for a tenant whose issuers are all registered under a different context unless you re-minted the bootstrap token pinned to that context. Returns a `{data, nextCursor}` envelope.
4116
4186
  *
4117
4187
  * @param {Vectros.ListIssuersRequest} request
4118
4188
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4169,7 +4239,7 @@ var AuthClient = class {
4169
4239
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4170
4240
  }
4171
4241
  /**
4172
- * 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. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant.
4242
+ * 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`.
4173
4243
  *
4174
4244
  * @param {Vectros.IssuerRequest} request
4175
4245
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4280,7 +4350,7 @@ var AuthClient = class {
4280
4350
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4281
4351
  }
4282
4352
  /**
4283
- * Returns the access profiles for the given principal across all of your contexts. Use this to answer questions like "which apps does this user have access to?" — for example, to build a member-access summary. Results are confined to your account. Requires the `profiles:r` scope.
4353
+ * Returns the access profiles for the given principal. Looking up your OWN principal — or holding the `context-directory-read` capability — returns the profiles across ALL of your contexts, letting you answer questions like "which apps does this user have access to?". A context-bound credential looking up a DIFFERENT principal instead sees only that principal's profile in your credential's own context (at most one result), never across contexts it has no authority over. Results are always confined to your account. Requires the `profiles:r` scope.
4284
4354
  *
4285
4355
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4286
4356
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4354,6 +4424,7 @@ var AuthClient = class {
4354
4424
  *
4355
4425
  * @throws {@link Vectros.BadRequestError}
4356
4426
  * @throws {@link Vectros.ForbiddenError}
4427
+ * @throws {@link Vectros.NotFoundError}
4357
4428
  * @throws {@link Vectros.TooManyRequestsError}
4358
4429
  *
4359
4430
  * @example
@@ -4407,6 +4478,8 @@ var AuthClient = class {
4407
4478
  throw new BadRequestError(_response.error.body, _response.rawResponse);
4408
4479
  case 403:
4409
4480
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4481
+ case 404:
4482
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4410
4483
  case 429:
4411
4484
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4412
4485
  default:
@@ -4559,7 +4632,84 @@ var AuthClient = class {
4559
4632
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4560
4633
  }
4561
4634
  /**
4562
- * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4635
+ * Re-mints the presented `st_*` scoped token with one or more `identity.<namespace>` values changed — for a caller whose ROLE explicitly grants assuming those values (an invited hr-admin, a multi-org case-handler) and needs to change which value new writes place records under. The request body names one or more namespaces in canonical `scope:<namespace>` form, e.g. `{"scope:org": "orgB"}` — each value must be a plain literal, never a `${{ ... }}` placeholder. When you name MORE THAN ONE namespace, a single one of your roles must grant all of them together: the combination is never assembled from two different roles, because no role author would have vouched for it. `st_*`-only — a root API key or `ssk_*` scoped API key gets 403; neither needs this (root already has full authority, and an `ssk_*`'s identity shape is not what this resolves against).
4636
+ *
4637
+ * **Only an original token may assume.** A token produced BY this endpoint cannot assume again (403) — every assume starts from the token you exchanged for, so the identity you end up with is always one a single role explicitly granted rather than a combination reached by chaining calls. Keep your original token if you need to switch more than once, or exchange for a new one.
4638
+ *
4639
+ * **Entitlement is checked LIVE, against your roles as they are right now** — not against a copy frozen into your token when it was minted. The requested value must be explicitly granted by a role's `assumable` field for that namespace: a POINT check against the one value requested, and a deliberately separate, explicitly-authored question from what the role's `data_scope` permits reading or writing. Holding broad `data_scope` reach in a namespace does NOT by itself grant assuming any value in it.
4640
+ *
4641
+ * **What is preserved, and what is not.** Every clause of your token that does not reference a requested namespace is preserved verbatim, as are all other claims (`partner_user_id`, `context_id`, mint attribution). Clauses that DO reference a requested namespace are kept only if they come from a role that authorized the new value. A role that does not authorize it loses all of its clauses touching that namespace — including any scoped to the value you already held. Assume into a value one role grants and you keep that role's reach, not the reach of roles that never vouched for it.
4642
+ *
4643
+ * The re-minted token's `exp` is IDENTICAL to the presented token's — this call can never extend a session's life. A fresh, independently-revocable `jti` is stamped on every call, and (except when the presented token predates jti support and has none to chain from) the token also carries a `root_jti` revocation-lineage claim so revoking the token you started from closes every value ever assumed from it. Uses the ordinary Vectros `{"message":...}` error shape, not the OAuth envelope `POST /v1/auth/token/exchange` uses — this endpoint's caller is always Vectros-SDK code already holding a bearer token, never generic OAuth tooling.
4644
+ *
4645
+ * @param {Record<string, unknown>} request
4646
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4647
+ *
4648
+ * @throws {@link Vectros.BadRequestError}
4649
+ * @throws {@link Vectros.UnauthorizedError}
4650
+ * @throws {@link Vectros.ForbiddenError}
4651
+ * @throws {@link Vectros.ConflictError}
4652
+ * @throws {@link Vectros.TooManyRequestsError}
4653
+ *
4654
+ * @example
4655
+ * await client.auth.assumeToken({
4656
+ * "scope:org": "orgB"
4657
+ * })
4658
+ */
4659
+ assumeToken(request, requestOptions) {
4660
+ return HttpResponsePromise.fromPromise(this.__assumeToken(request, requestOptions));
4661
+ }
4662
+ async __assumeToken(request, requestOptions) {
4663
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4664
+ const _headers = mergeHeaders(
4665
+ _authRequest.headers,
4666
+ this._options?.headers,
4667
+ requestOptions?.headers
4668
+ );
4669
+ const _response = await fetcher({
4670
+ url: url_exports.join(
4671
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4672
+ "v1/auth/token/assume"
4673
+ ),
4674
+ method: "POST",
4675
+ headers: _headers,
4676
+ contentType: "application/json",
4677
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4678
+ requestType: "json",
4679
+ body: request,
4680
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4681
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4682
+ abortSignal: requestOptions?.abortSignal,
4683
+ fetchFn: this._options?.fetch,
4684
+ logging: this._options.logging
4685
+ });
4686
+ if (_response.ok) {
4687
+ return { data: _response.body, rawResponse: _response.rawResponse };
4688
+ }
4689
+ if (_response.error.reason === "status-code") {
4690
+ switch (_response.error.statusCode) {
4691
+ case 400:
4692
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4693
+ case 401:
4694
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
4695
+ case 403:
4696
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4697
+ case 409:
4698
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4699
+ case 429:
4700
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4701
+ default:
4702
+ throw new VectrosError({
4703
+ statusCode: _response.error.statusCode,
4704
+ body: _response.error.body,
4705
+ rawResponse: _response.rawResponse
4706
+ });
4707
+ }
4708
+ }
4709
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/assume");
4710
+ }
4711
+ /**
4712
+ * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. If your issuer is registered against more than one app context (each via its own audience), `context_id` selects which one to target; omit it when your token's `aud` claim matches only one registered context — the common case, unaffected by this field. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4563
4713
  *
4564
4714
  * @param {Vectros.TokenExchangeRequest} request
4565
4715
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4635,9 +4785,9 @@ var ComplianceClient = class {
4635
4785
  * @param {Vectros.ErasureRequest} request
4636
4786
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
4637
4787
  *
4788
+ * @throws {@link Vectros.BadRequestError}
4638
4789
  * @throws {@link Vectros.ForbiddenError}
4639
4790
  * @throws {@link Vectros.TooManyRequestsError}
4640
- * @throws {@link Vectros.NotImplementedError}
4641
4791
  *
4642
4792
  * @example
4643
4793
  * await client.compliance.createErasureRequest({
@@ -4676,12 +4826,12 @@ var ComplianceClient = class {
4676
4826
  }
4677
4827
  if (_response.error.reason === "status-code") {
4678
4828
  switch (_response.error.statusCode) {
4829
+ case 400:
4830
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4679
4831
  case 403:
4680
4832
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4681
4833
  case 429:
4682
4834
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4683
- case 501:
4684
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
4685
4835
  default:
4686
4836
  throw new VectrosError({
4687
4837
  statusCode: _response.error.statusCode,
@@ -4700,7 +4850,6 @@ var ComplianceClient = class {
4700
4850
  *
4701
4851
  * @throws {@link Vectros.ForbiddenError}
4702
4852
  * @throws {@link Vectros.NotFoundError}
4703
- * @throws {@link Vectros.NotImplementedError}
4704
4853
  *
4705
4854
  * @example
4706
4855
  * await client.compliance.getErasureRequest({
@@ -4741,8 +4890,6 @@ var ComplianceClient = class {
4741
4890
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4742
4891
  case 404:
4743
4892
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4744
- case 501:
4745
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
4746
4893
  default:
4747
4894
  throw new VectrosError({
4748
4895
  statusCode: _response.error.statusCode,
@@ -6101,6 +6248,7 @@ var IdentityClient = class {
6101
6248
  * @example
6102
6249
  * await client.identity.listEntities({
6103
6250
  * namespace: "team",
6251
+ * contextId: "myapp",
6104
6252
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6105
6253
  * })
6106
6254
  */
@@ -6110,6 +6258,7 @@ var IdentityClient = class {
6110
6258
  async __listEntities(request, requestOptions) {
6111
6259
  const {
6112
6260
  namespace,
6261
+ contextId,
6113
6262
  userId,
6114
6263
  externalId,
6115
6264
  scope,
@@ -6124,6 +6273,7 @@ var IdentityClient = class {
6124
6273
  limit
6125
6274
  } = request;
6126
6275
  const _queryParams = {
6276
+ contextId,
6127
6277
  userId,
6128
6278
  externalId,
6129
6279
  scope,
@@ -6182,6 +6332,7 @@ var IdentityClient = class {
6182
6332
  * @example
6183
6333
  * await client.identity.createEntity({
6184
6334
  * namespace: "team",
6335
+ * contextId: "myapp",
6185
6336
  * body: {
6186
6337
  * externalId: "team_eng_platform"
6187
6338
  * }
@@ -6191,9 +6342,10 @@ var IdentityClient = class {
6191
6342
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6192
6343
  }
6193
6344
  async __createEntity(request, requestOptions) {
6194
- const { namespace, upsert, body: _body } = request;
6345
+ const { namespace, upsert, contextId, body: _body } = request;
6195
6346
  const _queryParams = {
6196
- upsert
6347
+ upsert,
6348
+ contextId
6197
6349
  };
6198
6350
  const _authRequest = await this._options.authProvider.getAuthRequest();
6199
6351
  const _headers = mergeHeaders(
@@ -6250,14 +6402,18 @@ var IdentityClient = class {
6250
6402
  * @example
6251
6403
  * await client.identity.getEntity({
6252
6404
  * namespace: "team",
6253
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6405
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6406
+ * contextId: "myapp"
6254
6407
  * })
6255
6408
  */
6256
6409
  getEntity(request, requestOptions) {
6257
6410
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6258
6411
  }
6259
6412
  async __getEntity(request, requestOptions) {
6260
- const { namespace, id } = request;
6413
+ const { namespace, id, contextId } = request;
6414
+ const _queryParams = {
6415
+ contextId
6416
+ };
6261
6417
  const _authRequest = await this._options.authProvider.getAuthRequest();
6262
6418
  const _headers = mergeHeaders(
6263
6419
  _authRequest.headers,
@@ -6271,7 +6427,7 @@ var IdentityClient = class {
6271
6427
  ),
6272
6428
  method: "GET",
6273
6429
  headers: _headers,
6274
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6430
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6275
6431
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6276
6432
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6277
6433
  abortSignal: requestOptions?.abortSignal,
@@ -6308,6 +6464,7 @@ var IdentityClient = class {
6308
6464
  * await client.identity.updateEntity({
6309
6465
  * namespace: "team",
6310
6466
  * id: "id",
6467
+ * contextId: "myapp",
6311
6468
  * body: {
6312
6469
  * externalId: "team_eng_platform"
6313
6470
  * }
@@ -6317,7 +6474,10 @@ var IdentityClient = class {
6317
6474
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6318
6475
  }
6319
6476
  async __updateEntity(request, requestOptions) {
6320
- const { namespace, id, body: _body } = request;
6477
+ const { namespace, id, contextId, body: _body } = request;
6478
+ const _queryParams = {
6479
+ contextId
6480
+ };
6321
6481
  const _authRequest = await this._options.authProvider.getAuthRequest();
6322
6482
  const _headers = mergeHeaders(
6323
6483
  _authRequest.headers,
@@ -6332,7 +6492,7 @@ var IdentityClient = class {
6332
6492
  method: "PUT",
6333
6493
  headers: _headers,
6334
6494
  contentType: "application/json",
6335
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6495
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6336
6496
  requestType: "json",
6337
6497
  body: _body,
6338
6498
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6372,14 +6532,18 @@ var IdentityClient = class {
6372
6532
  * @example
6373
6533
  * await client.identity.deleteEntity({
6374
6534
  * namespace: "team",
6375
- * id: "id"
6535
+ * id: "id",
6536
+ * contextId: "myapp"
6376
6537
  * })
6377
6538
  */
6378
6539
  deleteEntity(request, requestOptions) {
6379
6540
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6380
6541
  }
6381
6542
  async __deleteEntity(request, requestOptions) {
6382
- const { namespace, id } = request;
6543
+ const { namespace, id, contextId } = request;
6544
+ const _queryParams = {
6545
+ contextId
6546
+ };
6383
6547
  const _authRequest = await this._options.authProvider.getAuthRequest();
6384
6548
  const _headers = mergeHeaders(
6385
6549
  _authRequest.headers,
@@ -6393,7 +6557,7 @@ var IdentityClient = class {
6393
6557
  ),
6394
6558
  method: "DELETE",
6395
6559
  headers: _headers,
6396
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6560
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6397
6561
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6398
6562
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6399
6563
  abortSignal: requestOptions?.abortSignal,
@@ -6436,6 +6600,7 @@ var IdentityClient = class {
6436
6600
  * @example
6437
6601
  * await client.identity.lookupEntities({
6438
6602
  * namespace: "team",
6603
+ * contextId: "myapp",
6439
6604
  * body: {
6440
6605
  * type: "person_v1",
6441
6606
  * field: "ssn"
@@ -6446,7 +6611,10 @@ var IdentityClient = class {
6446
6611
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6447
6612
  }
6448
6613
  async __lookupEntities(request, requestOptions) {
6449
- const { namespace, body: _body } = request;
6614
+ const { namespace, contextId, body: _body } = request;
6615
+ const _queryParams = {
6616
+ contextId
6617
+ };
6450
6618
  const _authRequest = await this._options.authProvider.getAuthRequest();
6451
6619
  const _headers = mergeHeaders(
6452
6620
  _authRequest.headers,
@@ -6461,7 +6629,7 @@ var IdentityClient = class {
6461
6629
  method: "POST",
6462
6630
  headers: _headers,
6463
6631
  contentType: "application/json",
6464
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6632
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6465
6633
  requestType: "json",
6466
6634
  body: _body,
6467
6635
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6505,15 +6673,17 @@ var IdentityClient = class {
6505
6673
  * @example
6506
6674
  * await client.identity.getEntityVersions({
6507
6675
  * namespace: "team",
6508
- * id: "id"
6676
+ * id: "id",
6677
+ * contextId: "myapp"
6509
6678
  * })
6510
6679
  */
6511
6680
  getEntityVersions(request, requestOptions) {
6512
6681
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6513
6682
  }
6514
6683
  async __getEntityVersions(request, requestOptions) {
6515
- const { namespace, id, startFrom } = request;
6684
+ const { namespace, id, contextId, startFrom } = request;
6516
6685
  const _queryParams = {
6686
+ contextId,
6517
6687
  startFrom
6518
6688
  };
6519
6689
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6559,7 +6729,7 @@ var IdentityClient = class {
6559
6729
  );
6560
6730
  }
6561
6731
  /**
6562
- * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6732
+ * Retrieves a single scope-namespace registration by name.
6563
6733
  *
6564
6734
  * @param {Vectros.GetNamespaceRequest} request
6565
6735
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6575,7 +6745,10 @@ var IdentityClient = class {
6575
6745
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6576
6746
  }
6577
6747
  async __getNamespace(request, requestOptions) {
6578
- const { namespace } = request;
6748
+ const { namespace, contextId } = request;
6749
+ const _queryParams = {
6750
+ contextId
6751
+ };
6579
6752
  const _authRequest = await this._options.authProvider.getAuthRequest();
6580
6753
  const _headers = mergeHeaders(
6581
6754
  _authRequest.headers,
@@ -6589,7 +6762,7 @@ var IdentityClient = class {
6589
6762
  ),
6590
6763
  method: "GET",
6591
6764
  headers: _headers,
6592
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6765
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6593
6766
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6594
6767
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6595
6768
  abortSignal: requestOptions?.abortSignal,
@@ -6614,7 +6787,7 @@ var IdentityClient = class {
6614
6787
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6615
6788
  }
6616
6789
  /**
6617
- * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
6790
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name and its `contextId` (which row is selected) are both immutable. Requires a root API key. `org` and `client` are updatable like any other namespace — there is no reserved-built-in exception.
6618
6791
  *
6619
6792
  * @param {Vectros.UpdateNamespaceRequest} request
6620
6793
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6636,7 +6809,10 @@ var IdentityClient = class {
6636
6809
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6637
6810
  }
6638
6811
  async __updateNamespace(request, requestOptions) {
6639
- const { namespace, body: _body } = request;
6812
+ const { namespace, contextId, body: _body } = request;
6813
+ const _queryParams = {
6814
+ contextId
6815
+ };
6640
6816
  const _authRequest = await this._options.authProvider.getAuthRequest();
6641
6817
  const _headers = mergeHeaders(
6642
6818
  _authRequest.headers,
@@ -6651,7 +6827,7 @@ var IdentityClient = class {
6651
6827
  method: "PUT",
6652
6828
  headers: _headers,
6653
6829
  contentType: "application/json",
6654
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6830
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6655
6831
  requestType: "json",
6656
6832
  body: _body,
6657
6833
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6682,7 +6858,7 @@ var IdentityClient = class {
6682
6858
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6683
6859
  }
6684
6860
  /**
6685
- * Deletes a registered scope namespace. Requires a root API key. The reserved built-ins cannot be deleted. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6861
+ * Deletes a registered scope namespace. Requires a root API key. `org` and `client` are deletable like any other namespace — there is no reserved-built-in exception. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6686
6862
  *
6687
6863
  * @param {Vectros.DeleteNamespaceRequest} request
6688
6864
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6700,7 +6876,10 @@ var IdentityClient = class {
6700
6876
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6701
6877
  }
6702
6878
  async __deleteNamespace(request, requestOptions) {
6703
- const { namespace } = request;
6879
+ const { namespace, contextId } = request;
6880
+ const _queryParams = {
6881
+ contextId
6882
+ };
6704
6883
  const _authRequest = await this._options.authProvider.getAuthRequest();
6705
6884
  const _headers = mergeHeaders(
6706
6885
  _authRequest.headers,
@@ -6714,7 +6893,7 @@ var IdentityClient = class {
6714
6893
  ),
6715
6894
  method: "DELETE",
6716
6895
  headers: _headers,
6717
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6896
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6718
6897
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6719
6898
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6720
6899
  abortSignal: requestOptions?.abortSignal,
@@ -6743,7 +6922,7 @@ var IdentityClient = class {
6743
6922
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6744
6923
  }
6745
6924
  /**
6746
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6925
+ * Returns the scope namespaces registered in your account. Returns a `{data, nextCursor}` envelope.
6747
6926
  *
6748
6927
  * @param {Vectros.ListNamespacesRequest} request
6749
6928
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6755,10 +6934,11 @@ var IdentityClient = class {
6755
6934
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6756
6935
  }
6757
6936
  async __listNamespaces(request = {}, requestOptions) {
6758
- const { startFrom, limit } = request;
6937
+ const { startFrom, limit, contextId } = request;
6759
6938
  const _queryParams = {
6760
6939
  startFrom,
6761
- limit
6940
+ limit,
6941
+ contextId
6762
6942
  };
6763
6943
  const _authRequest = await this._options.authProvider.getAuthRequest();
6764
6944
  const _headers = mergeHeaders(
@@ -6793,9 +6973,9 @@ var IdentityClient = class {
6793
6973
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6794
6974
  }
6795
6975
  /**
6796
- * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
6976
+ * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key or one of the CLI bootstrap's two provisioning capabilities — never an ordinary partner-grantable scope. A bootstrap credential's registration is confined to its own app context UNLESS it additionally holds the tenant-wide namespace-provisioning capability and `contextId` is omitted, in which case it may register a TENANT-WIDE namespace (visible to every context). `org` and `client` are reserved names, registered the same way as any other namespace.
6797
6977
  *
6798
- * @param {Vectros.NamespaceRequest} request
6978
+ * @param {Vectros.RegisterNamespaceRequest} request
6799
6979
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6800
6980
  *
6801
6981
  * @throws {@link Vectros.BadRequestError}
@@ -6804,14 +6984,20 @@ var IdentityClient = class {
6804
6984
  *
6805
6985
  * @example
6806
6986
  * await client.identity.registerNamespace({
6807
- * namespace: "team",
6808
- * specificityRank: 1500
6987
+ * body: {
6988
+ * namespace: "team",
6989
+ * specificityRank: 1500
6990
+ * }
6809
6991
  * })
6810
6992
  */
6811
6993
  registerNamespace(request, requestOptions) {
6812
6994
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6813
6995
  }
6814
6996
  async __registerNamespace(request, requestOptions) {
6997
+ const { contextId, body: _body } = request;
6998
+ const _queryParams = {
6999
+ contextId
7000
+ };
6815
7001
  const _authRequest = await this._options.authProvider.getAuthRequest();
6816
7002
  const _headers = mergeHeaders(
6817
7003
  _authRequest.headers,
@@ -6826,9 +7012,9 @@ var IdentityClient = class {
6826
7012
  method: "POST",
6827
7013
  headers: _headers,
6828
7014
  contentType: "application/json",
6829
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
7015
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6830
7016
  requestType: "json",
6831
- body: request,
7017
+ body: _body,
6832
7018
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6833
7019
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6834
7020
  abortSignal: requestOptions?.abortSignal,
@@ -6857,7 +7043,7 @@ var IdentityClient = class {
6857
7043
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6858
7044
  }
6859
7045
  /**
6860
- * Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope.
7046
+ * Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope. A context-confined credential only sees users who hold an access profile in the credential's own app context — others are silently absent from the page, not an error.
6861
7047
  *
6862
7048
  * @param {Vectros.ListUsersRequest} request
6863
7049
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6922,7 +7108,7 @@ var IdentityClient = class {
6922
7108
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users");
6923
7109
  }
6924
7110
  /**
6925
- * Creates a user identity in your account. The operation is idempotent on `externalId`: if a user with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope to create. Being returned the existing user on a collision is a read of that user's data and additionally requires the `users:r` scope — a credential holding `users:c` alone receives a `400` ("already exists") on collision instead of the user.
7111
+ * Creates a user identity in your account. The operation is idempotent on `externalId`: if a user with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing user was returned) tells the two apart. To overwrite an existing user's mutable fields (email, status, payload, schema binding) instead of returning it unchanged, set `?upsert=true` (this also requires the `users:u` scope). Requires the `users:c` scope to create. Being returned the existing user on a collision is a read of that user's data and additionally requires the `users:r` scope — a credential holding `users:c` alone receives a `400` ("already exists") on collision instead of the user. A context-confined credential additionally receives the collision echo (or, with `?upsert=true`, is allowed to overwrite) only when the colliding user holds an access profile in the credential's own app context — a cross-context collision otherwise gets the same uniform `400` instead of the other context's user data. One narrow exception on the plain (non-upsert) echo only: the CLI's no-code bootstrap credential can be echoed a colliding user across app contexts, needed for a blueprint to idempotently re-apply against a service principal it provisioned in a non-default context; this does not extend to `?upsert=true`.
6926
7112
  *
6927
7113
  * @param {Vectros.CreateUserRequest} request
6928
7114
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7046,7 +7232,7 @@ var IdentityClient = class {
7046
7232
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/{id}");
7047
7233
  }
7048
7234
  /**
7049
- * Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation, and `email` cannot be changed while an invitation to that user is still outstanding — revoke the invitation, or invite the new address instead. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. Requires the `users:u` scope.
7235
+ * Updates mutable fields on an existing user (such as email, status, payload, or schema binding). The `type` field is immutable after creation, and `email` cannot be changed while an invitation to that user is still outstanding — revoke the invitation, or invite the new address instead. This endpoint also activates an invited user: a PUT that moves a PENDING user to ACTIVE and carries `inviteToken`, `externalSubject`, and `emailVerifiedAttestation=true` completes the invitation. **`externalSubject` set this way is NOT an authentication binding and does not enable sign-in anywhere** — not the Vectros DevPortal/Admin App/web apps, and not `/v1/auth/token/exchange` either; both are granted only by the invitee authenticating themselves. If the invitee needs dev-portal/web-app access, send them the invitation link and let them accept it directly. If the invitee needs to sign in via token exchange, have them redeem `inviteToken` themselves at `/v1/auth/token/exchange` with their own credential — Vectros verifies it there and computes its own value for this field from the verified credential. The value you send here is stored exactly as-is, with no normalization, and does NOT automatically match or deduplicate against what a later token-exchange sign-in computes for the same real-world identity. Call this endpoint directly only if you run your own backend and want Vectros to record which of your own users a given account corresponds to — treat this field as informational for that purpose, not as a way to pre-authorize sign-in. Requires the `users:u` scope.
7050
7236
  *
7051
7237
  * @param {Vectros.UpdateUserRequest} request
7052
7238
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7113,12 +7299,13 @@ var IdentityClient = class {
7113
7299
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7114
7300
  }
7115
7301
  /**
7116
- * Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope.
7302
+ * Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope. Deleting your account's last OWNER is refused (409) — an account must always retain at least one owner. Called by a context-confined credential, deletion is also refused (409) when the user holds access in an app context other than the caller's own — remove the user from the caller's own context first, or use a credential with cross-context reach.
7117
7303
  *
7118
7304
  * @param {Vectros.DeleteUserRequest} request
7119
7305
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7120
7306
  *
7121
7307
  * @throws {@link Vectros.NotFoundError}
7308
+ * @throws {@link Vectros.ConflictError}
7122
7309
  * @throws {@link Vectros.TooManyRequestsError}
7123
7310
  *
7124
7311
  * @example
@@ -7158,6 +7345,8 @@ var IdentityClient = class {
7158
7345
  switch (_response.error.statusCode) {
7159
7346
  case 404:
7160
7347
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7348
+ case 409:
7349
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7161
7350
  case 429:
7162
7351
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7163
7352
  default:
@@ -7171,7 +7360,7 @@ var IdentityClient = class {
7171
7360
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/users/{id}");
7172
7361
  }
7173
7362
  /**
7174
- * Looks up users by a schema lookup field, with the query criteria carried in the request body rather than the URL. Use this when looking up by a sensitive (blind-indexed) field: the value is blind-indexed server-side and never appears in the URL, request logs, or proxies. The query semantics are identical to the GET /v1/users lookup, which rejects sensitive-field values and directs you here. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope.
7363
+ * Looks up users by a schema lookup field, with the query criteria carried in the request body rather than the URL. Use this when looking up by a sensitive (blind-indexed) field: the value is blind-indexed server-side and never appears in the URL, request logs, or proxies. The query semantics are identical to the GET /v1/users lookup, which rejects sensitive-field values and directs you here. Returns a page in the `{data, nextCursor}` envelope. Requires the `users:r` scope. A context-confined credential only sees users who hold an access profile in the credential's own app context — others are silently absent from the page, not an error.
7175
7364
  *
7176
7365
  * @param {Vectros.IdentityLookupRequest} request
7177
7366
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7614,14 +7803,14 @@ var RecordsClient = class {
7614
7803
  this._options = normalizeClientOptionsWithAuth(options);
7615
7804
  }
7616
7805
  /**
7617
- * Reserved endpoint for fetching multiple records by ID in one call. When available, the response will contain only the records you can see; any IDs that do not exist or are outside your scope are silently omitted (there is no per-ID existence signal), matching the not-found behavior of the single-record GET. It currently returns 501 (not implemented). The documented 200 response schema is the stable shape this endpoint will use once available. Requires the `records:r` scope.
7806
+ * Fetches multiple records by ID in one call (`ids`, maximum 100). The response contains only the records you can access — any id that does not exist, belongs to another account/AppContext, or is outside your token's scope is silently omitted, with no per-id existence signal, matching the not-found behavior of the single-record GET. Payloads are hydrated the same way a by-id GET hydrates them (payloads externalized to object storage are rehydrated for this response). Requires the `records:r` scope (and, for a scoped token, `records:r:<type>` per record type).
7618
7807
  *
7619
7808
  * @param {Vectros.BatchGetRequest} request
7620
7809
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
7621
7810
  *
7811
+ * @throws {@link Vectros.BadRequestError}
7622
7812
  * @throws {@link Vectros.ForbiddenError}
7623
7813
  * @throws {@link Vectros.TooManyRequestsError}
7624
- * @throws {@link Vectros.NotImplementedError}
7625
7814
  *
7626
7815
  * @example
7627
7816
  * await client.records.batchGetRecords()
@@ -7658,12 +7847,12 @@ var RecordsClient = class {
7658
7847
  }
7659
7848
  if (_response.error.reason === "status-code") {
7660
7849
  switch (_response.error.statusCode) {
7850
+ case 400:
7851
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7661
7852
  case 403:
7662
7853
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
7663
7854
  case 429:
7664
7855
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7665
- case 501:
7666
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
7667
7856
  default:
7668
7857
  throw new VectrosError({
7669
7858
  statusCode: _response.error.statusCode,
@@ -8477,7 +8666,7 @@ var SchemasClient = class {
8477
8666
  this._options = normalizeClientOptionsWithAuth(options);
8478
8667
  }
8479
8668
  /**
8480
- * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (`user` or `entity`) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
8669
+ * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by `surface=user` lists your account-wide identity schemas regardless of the calling context (a `user`-surfaced schema always has one tenant-wide home). Filtering by `surface=entity` reads your own app context's entity schemas AND the tenant-wide home together, newest first, through a single cursor — an entity schema may live in either home depending on where its namespace is placed (see `POST /v1/namespaces`). Filtering by `record` or `document` lists within the calling context only. Requires the `schemas:r` scope.
8481
8670
  *
8482
8671
  * @param {Vectros.ListSchemasRequest} request
8483
8672
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8765,6 +8954,7 @@ var SchemasClient = class {
8765
8954
  * @param {Vectros.DeleteSchemaRequest} request
8766
8955
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
8767
8956
  *
8957
+ * @throws {@link Vectros.ForbiddenError}
8768
8958
  * @throws {@link Vectros.NotFoundError}
8769
8959
  * @throws {@link Vectros.ConflictError}
8770
8960
  * @throws {@link Vectros.TooManyRequestsError}
@@ -8804,6 +8994,8 @@ var SchemasClient = class {
8804
8994
  }
8805
8995
  if (_response.error.reason === "status-code") {
8806
8996
  switch (_response.error.statusCode) {
8997
+ case 403:
8998
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
8807
8999
  case 404:
8808
9000
  throw new NotFoundError(_response.error.body, _response.rawResponse);
8809
9001
  case 409:
@@ -9018,7 +9210,7 @@ import {
9018
9210
  ListToolsRequestSchema,
9019
9211
  ReadResourceRequestSchema
9020
9212
  } from "@modelcontextprotocol/sdk/types.js";
9021
- import { z as z22 } from "zod";
9213
+ import { z as z23 } from "zod";
9022
9214
 
9023
9215
  // src/auth.ts
9024
9216
  var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
@@ -9062,8 +9254,8 @@ function warnOnSuboptimalKey(key, log) {
9062
9254
 
9063
9255
  // src/build-info.ts
9064
9256
  var BUILD_INFO = {
9065
- mcpServer: true ? "0.14.0" : "dev",
9066
- sdk: true ? "0.39.0" : "dev"
9257
+ mcpServer: true ? "0.16.0" : "dev",
9258
+ sdk: true ? "0.41.0" : "dev"
9067
9259
  };
9068
9260
 
9069
9261
  // src/log.ts
@@ -9371,7 +9563,7 @@ var inputSchema = {
9371
9563
  // Ownership.
9372
9564
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9373
9565
  scope: z.string().optional().describe(
9374
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
9566
+ '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.'
9375
9567
  ),
9376
9568
  // Date window.
9377
9569
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9511,7 +9703,7 @@ var inputSchema2 = {
9511
9703
  // List-mode args:
9512
9704
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9513
9705
  scope: z2.string().optional().describe(
9514
- '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 built-in namespaces; others are custom scopes you define.'
9706
+ '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.'
9515
9707
  ),
9516
9708
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9517
9709
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9745,31 +9937,78 @@ var recordGet = ({ client, log }) => ({
9745
9937
  });
9746
9938
  var record_get_default = recordGet;
9747
9939
 
9748
- // src/tools/record_create.ts
9940
+ // src/tools/record_batch_get.ts
9749
9941
  import { z as z4 } from "zod";
9942
+ var MAX_PAYLOAD_CHARS2 = 32e3;
9943
+ var MCP_MAX_IDS = 100;
9750
9944
  var inputSchema4 = {
9751
- type: z4.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9752
- fields: z4.record(z4.string(), z4.unknown()).describe(
9945
+ ids: z4.array(z4.string()).min(1).max(MCP_MAX_IDS).describe(
9946
+ `Record ids to fetch in one call (1-${MCP_MAX_IDS}). Any id you cannot access \u2014 nonexistent, wrong account, or outside your token's scope \u2014 is silently omitted from the response (no per-id existence signal); compare against the response's \`missingIds\` to see which requested ids came back empty.`
9947
+ )
9948
+ };
9949
+ var recordBatchGet = ({ client, log }) => ({
9950
+ name: "record_batch_get",
9951
+ title: "Get multiple records by id in one call",
9952
+ 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.",
9953
+ inputSchema: inputSchema4,
9954
+ handler: async (args) => {
9955
+ const ids = args.ids;
9956
+ try {
9957
+ const response = await client.records.batchGetRecords({ ids });
9958
+ const records = response.data ?? [];
9959
+ const data = records.map((record) => {
9960
+ const item = { ...record };
9961
+ if (record.payload !== void 0) {
9962
+ const json = JSON.stringify(record.payload);
9963
+ if (json.length > MAX_PAYLOAD_CHARS2) {
9964
+ delete item.payload;
9965
+ item.payloadPreview = json.slice(0, MAX_PAYLOAD_CHARS2);
9966
+ item.payloadTruncated = true;
9967
+ item.payloadTotalChars = json.length;
9968
+ }
9969
+ }
9970
+ return item;
9971
+ });
9972
+ const returnedIds = new Set(records.map((r) => r.id));
9973
+ const missingIds = ids.filter((id) => !returnedIds.has(id));
9974
+ log.debug(
9975
+ { tool: "record_batch_get", requested: ids.length, returned: data.length, missing: missingIds.length },
9976
+ "record_batch_get ok"
9977
+ );
9978
+ return { content: [{ type: "text", text: JSON.stringify({ data, missingIds }, null, 2) }] };
9979
+ } catch (err) {
9980
+ log.warn({ tool: "record_batch_get", idsCount: ids?.length, err: String(err) }, "record_batch_get failed");
9981
+ return toolError("record_batch_get", err);
9982
+ }
9983
+ }
9984
+ });
9985
+ var record_batch_get_default = recordBatchGet;
9986
+
9987
+ // src/tools/record_create.ts
9988
+ import { z as z5 } from "zod";
9989
+ var inputSchema5 = {
9990
+ type: z5.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9991
+ fields: z5.record(z5.string(), z5.unknown()).describe(
9753
9992
  "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values. Every number must fall within the signed 64-bit range (a value outside it, or with >38 significant digits, is refused with a 400 naming the field) \u2014 send a larger whole number (e.g. a big external id) as a STRING, which stores it exactly and supports exact-match lookup."
9754
9993
  ),
9755
- externalId: z4.string().optional().describe(
9994
+ externalId: z5.string().optional().describe(
9756
9995
  "Stable caller-supplied id. Immutable; unique per type. Re-creating with the same externalId returns the existing record (idempotent) \u2014 use it to make creates safely retryable."
9757
9996
  ),
9758
- indexMode: z4.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
9997
+ indexMode: z5.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
9759
9998
  "Search-index strategy for this record, set at create only (immutable after). HYBRID (BM25 + dense), SEMANTIC (dense only), TEXT (BM25 only), NONE (store-only \u2014 never appears in hybrid_search/rag_ask; still retrievable by id and structured-field lookup). Omit to inherit the type schema's default; if the schema default is NONE and you want this record searchable, set it here \u2014 it cannot be changed later."
9760
9999
  ),
9761
- status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9762
- folderId: z4.string().optional().describe("Group this record into a folder."),
9763
- userId: z4.string().optional().describe("Owning user id."),
9764
- scopes: z4.array(z4.string()).optional().describe(
9765
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
10000
+ status: z5.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
10001
+ folderId: z5.string().optional().describe("Group this record into a folder."),
10002
+ userId: z5.string().optional().describe("Owning user id."),
10003
+ scopes: z5.array(z5.string()).optional().describe(
10004
+ '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 values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
9766
10005
  )
9767
10006
  };
9768
10007
  var recordCreate = ({ client, log }) => ({
9769
10008
  name: "record_create",
9770
10009
  title: "Create a record",
9771
10010
  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).",
9772
- inputSchema: inputSchema4,
10011
+ inputSchema: inputSchema5,
9773
10012
  handler: async (args) => {
9774
10013
  const type = args.type;
9775
10014
  try {
@@ -9796,18 +10035,18 @@ var recordCreate = ({ client, log }) => ({
9796
10035
  var record_create_default = recordCreate;
9797
10036
 
9798
10037
  // src/tools/record_update.ts
9799
- import { z as z5 } from "zod";
9800
- var inputSchema5 = {
9801
- id: z5.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
9802
- externalId: z5.string().optional().describe(
10038
+ import { z as z6 } from "zod";
10039
+ var inputSchema6 = {
10040
+ id: z6.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
10041
+ externalId: z6.string().optional().describe(
9803
10042
  "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."
9804
10043
  ),
9805
- type: z5.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
9806
- fields: z5.record(z5.string(), z5.unknown()).describe(
10044
+ type: z6.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10045
+ fields: z6.record(z6.string(), z6.unknown()).describe(
9807
10046
  "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."
9808
10047
  ),
9809
- status: z5.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
9810
- expectedVersion: z5.number().int().optional().describe(
10048
+ status: z6.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
10049
+ expectedVersion: z6.number().int().optional().describe(
9811
10050
  "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."
9812
10051
  )
9813
10052
  };
@@ -9815,7 +10054,7 @@ var recordUpdate = ({ client, log }) => ({
9815
10054
  name: "record_update",
9816
10055
  title: "Update a record by id or externalId",
9817
10056
  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.",
9818
- inputSchema: inputSchema5,
10057
+ inputSchema: inputSchema6,
9819
10058
  handler: async (args) => {
9820
10059
  const id = args.id;
9821
10060
  const externalId = args.externalId;
@@ -9841,15 +10080,15 @@ var recordUpdate = ({ client, log }) => ({
9841
10080
  var record_update_default = recordUpdate;
9842
10081
 
9843
10082
  // src/tools/record_delete.ts
9844
- import { z as z6 } from "zod";
9845
- var inputSchema6 = {
9846
- id: z6.string().min(1, "id is required").describe("The Vectros record id to delete.")
10083
+ import { z as z7 } from "zod";
10084
+ var inputSchema7 = {
10085
+ id: z7.string().min(1, "id is required").describe("The Vectros record id to delete.")
9847
10086
  };
9848
10087
  var recordDelete = ({ client, log }) => ({
9849
10088
  name: "record_delete",
9850
10089
  title: "Delete a record",
9851
10090
  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.",
9852
- inputSchema: inputSchema6,
10091
+ inputSchema: inputSchema7,
9853
10092
  handler: async (args) => {
9854
10093
  const id = args.id;
9855
10094
  try {
@@ -9865,48 +10104,48 @@ var recordDelete = ({ client, log }) => ({
9865
10104
  var record_delete_default = recordDelete;
9866
10105
 
9867
10106
  // src/tools/rag_ask.ts
9868
- import { z as z7 } from "zod";
10107
+ import { z as z8 } from "zod";
9869
10108
  var SEARCH_MCP_DEFAULT_LIMIT = 5;
9870
10109
  var SEARCH_MCP_MAX_LIMIT = 50;
9871
- var inputSchema7 = {
9872
- query: z7.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
9873
- instructions: z7.string().optional().describe(
10110
+ var inputSchema8 = {
10111
+ query: z8.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
10112
+ instructions: z8.string().optional().describe(
9874
10113
  '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.'
9875
10114
  ),
9876
- model: z7.string().optional().describe(
10115
+ model: z8.string().optional().describe(
9877
10116
  "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."
9878
10117
  ),
9879
- search: z7.object({
9880
- mode: z7.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
9881
- limit: z7.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
10118
+ search: z8.object({
10119
+ mode: z8.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
10120
+ limit: z8.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
9882
10121
  `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.`
9883
10122
  ),
9884
10123
  // Retrieval scoping — parity with hybrid_search so an agent can ground the
9885
10124
  // answer on a specific owner / folder / type / metadata subset, not just the
9886
10125
  // whole-tenant corpus.
9887
- userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9888
- scope: z7.string().optional().describe(
9889
- '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 built-in namespaces; others are custom scopes you define.'
10126
+ userId: z8.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
10127
+ scope: z8.string().optional().describe(
10128
+ '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.'
9890
10129
  ),
9891
- folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9892
- rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
9893
- typeName: z7.string().optional().describe("Restrict record retrieval to this schema type."),
9894
- contentTypes: z7.array(z7.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
9895
- filters: z7.record(z7.unknown()).optional().describe(
10130
+ folderId: z8.string().optional().describe("Restrict retrieval to this exact folder."),
10131
+ rootFolderId: z8.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
10132
+ typeName: z8.string().optional().describe("Restrict record retrieval to this schema type."),
10133
+ contentTypes: z8.array(z8.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
10134
+ filters: z8.record(z8.unknown()).optional().describe(
9896
10135
  '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"}.'
9897
10136
  ),
9898
- createdAfter: z7.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
9899
- createdBefore: z7.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
9900
- requireComplete: z7.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
10137
+ createdAfter: z8.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
10138
+ createdBefore: z8.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
10139
+ requireComplete: z8.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
9901
10140
  }).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
9902
- maxTokens: z7.number().int().min(1).optional().describe("Max output tokens."),
9903
- temperature: z7.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
10141
+ maxTokens: z8.number().int().min(1).optional().describe("Max output tokens."),
10142
+ temperature: z8.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
9904
10143
  };
9905
10144
  var ragAsk = ({ client, log }) => ({
9906
10145
  name: "rag_ask",
9907
10146
  title: "RAG ask (corpus-wide)",
9908
10147
  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.",
9909
- inputSchema: inputSchema7,
10148
+ inputSchema: inputSchema8,
9910
10149
  handler: async (args, extra) => {
9911
10150
  try {
9912
10151
  const searchArg = args.search ?? {};
@@ -9982,20 +10221,20 @@ var ragAsk = ({ client, log }) => ({
9982
10221
  var rag_ask_default = ragAsk;
9983
10222
 
9984
10223
  // src/tools/document_ask.ts
9985
- import { z as z8 } from "zod";
9986
- var inputSchema8 = {
9987
- documentId: z8.string().min(1, "documentId is required").describe("ID of the document to ask against."),
9988
- prompt: z8.string().min(1, "prompt is required").describe("Question to ask about the document."),
9989
- model: z8.string().optional().describe(
10224
+ import { z as z9 } from "zod";
10225
+ var inputSchema9 = {
10226
+ documentId: z9.string().min(1, "documentId is required").describe("ID of the document to ask against."),
10227
+ prompt: z9.string().min(1, "prompt is required").describe("Question to ask about the document."),
10228
+ model: z9.string().optional().describe(
9990
10229
  "Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
9991
10230
  ),
9992
- maxTokens: z8.number().int().min(1).optional().describe("Max output tokens.")
10231
+ maxTokens: z9.number().int().min(1).optional().describe("Max output tokens.")
9993
10232
  };
9994
10233
  var documentAsk = ({ client, log }) => ({
9995
10234
  name: "document_ask",
9996
10235
  title: "Document ask (single-document)",
9997
10236
  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.",
9998
- inputSchema: inputSchema8,
10237
+ inputSchema: inputSchema9,
9999
10238
  handler: async (args, extra) => {
10000
10239
  try {
10001
10240
  const stream = await client.inference.documentAsk({
@@ -10054,18 +10293,18 @@ var documentAsk = ({ client, log }) => ({
10054
10293
  var document_ask_default = documentAsk;
10055
10294
 
10056
10295
  // src/tools/list_schemas.ts
10057
- import { z as z9 } from "zod";
10058
- var inputSchema9 = {
10059
- userId: z9.string().optional().describe(
10296
+ import { z as z10 } from "zod";
10297
+ var inputSchema10 = {
10298
+ userId: z10.string().optional().describe(
10060
10299
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10061
10300
  ),
10062
- scope: z9.string().optional().describe(
10063
- 'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces. Optional; default returns all schemas the credential can see.'
10301
+ scope: z10.string().optional().describe(
10302
+ '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.'
10064
10303
  ),
10065
- surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
10304
+ surface: z10.enum(["record", "document", "user", "entity"]).optional().describe(
10066
10305
  "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."
10067
10306
  ),
10068
- recordType: z9.string().optional().describe(
10307
+ recordType: z10.string().optional().describe(
10069
10308
  '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.'
10070
10309
  )
10071
10310
  };
@@ -10073,7 +10312,7 @@ var listSchemas = ({ client, log }) => ({
10073
10312
  name: "list_schemas",
10074
10313
  title: "List record schemas",
10075
10314
  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.',
10076
- inputSchema: inputSchema9,
10315
+ inputSchema: inputSchema10,
10077
10316
  handler: async (args) => {
10078
10317
  const userId = args.userId;
10079
10318
  const scope = args.scope;
@@ -10099,18 +10338,18 @@ var listSchemas = ({ client, log }) => ({
10099
10338
  var list_schemas_default = listSchemas;
10100
10339
 
10101
10340
  // src/tools/document_get.ts
10102
- import { z as z10 } from "zod";
10341
+ import { z as z11 } from "zod";
10103
10342
  var MAX_TEXT_CHARS = 32e3;
10104
- var inputSchema10 = {
10105
- documentId: z10.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
10106
- externalId: z10.string().optional().describe(
10343
+ var inputSchema11 = {
10344
+ documentId: z11.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
10345
+ externalId: z11.string().optional().describe(
10107
10346
  "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."
10108
10347
  ),
10109
- type: z10.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10110
- includeText: z10.boolean().optional().describe(
10348
+ type: z11.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10349
+ includeText: z11.boolean().optional().describe(
10111
10350
  "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."
10112
10351
  ),
10113
- includeDownloadUrl: z10.boolean().optional().describe(
10352
+ includeDownloadUrl: z11.boolean().optional().describe(
10114
10353
  "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."
10115
10354
  )
10116
10355
  };
@@ -10127,7 +10366,7 @@ var documentGet = ({ client, log }) => ({
10127
10366
  name: "document_get",
10128
10367
  title: "Get document metadata (and optionally text)",
10129
10368
  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.",
10130
- inputSchema: inputSchema10,
10369
+ inputSchema: inputSchema11,
10131
10370
  handler: async (args) => {
10132
10371
  const documentId = args.documentId;
10133
10372
  const externalId = args.externalId;
@@ -10192,28 +10431,28 @@ var documentGet = ({ client, log }) => ({
10192
10431
  var document_get_default = documentGet;
10193
10432
 
10194
10433
  // src/tools/document_query.ts
10195
- import { z as z11 } from "zod";
10434
+ import { z as z12 } from "zod";
10196
10435
  var MCP_DEFAULT_LIMIT3 = 3;
10197
10436
  var MCP_MAX_LIMIT3 = 100;
10198
- var inputSchema11 = {
10437
+ var inputSchema12 = {
10199
10438
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10200
- field: z11.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
10201
- value: z11.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
10202
- from: z11.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
10203
- to: z11.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10204
- prefix: z11.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10205
- order: z11.enum(["asc", "desc"]).optional().describe(
10439
+ field: z12.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
10440
+ value: z12.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
10441
+ from: z12.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
10442
+ to: z12.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10443
+ prefix: z12.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10444
+ order: z12.enum(["asc", "desc"]).optional().describe(
10206
10445
  "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."
10207
10446
  ),
10208
- type: z11.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
10447
+ type: z12.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
10209
10448
  // List-mode args:
10210
- folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10211
- userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
10212
- scope: z11.string().optional().describe(
10213
- '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 built-in namespaces; others are custom scopes you define.'
10449
+ folderId: z12.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10450
+ userId: z12.string().optional().describe("List mode: scope to documents owned by this user."),
10451
+ scope: z12.string().optional().describe(
10452
+ '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.'
10214
10453
  ),
10215
- startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10216
- limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
10454
+ startFrom: z12.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10455
+ limit: z12.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
10217
10456
  `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.`
10218
10457
  )
10219
10458
  };
@@ -10221,7 +10460,7 @@ var documentQuery = ({ client, log }) => ({
10221
10460
  name: "document_query",
10222
10461
  title: "Document query (list or lookup)",
10223
10462
  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.",
10224
- inputSchema: inputSchema11,
10463
+ inputSchema: inputSchema12,
10225
10464
  handler: async (args) => {
10226
10465
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
10227
10466
  const field = args.field;
@@ -10301,29 +10540,29 @@ var documentQuery = ({ client, log }) => ({
10301
10540
  var document_query_default = documentQuery;
10302
10541
 
10303
10542
  // src/tools/document_update.ts
10304
- import { z as z12 } from "zod";
10305
- var inputSchema12 = {
10306
- documentId: z12.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
10307
- externalId: z12.string().optional().describe(
10543
+ import { z as z13 } from "zod";
10544
+ var inputSchema13 = {
10545
+ documentId: z13.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
10546
+ externalId: z13.string().optional().describe(
10308
10547
  "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."
10309
10548
  ),
10310
- type: z12.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10311
- title: z12.string().optional().describe("New title. Omit to keep the current title."),
10312
- fields: z12.record(z12.string(), z12.unknown()).optional().describe(
10549
+ type: z13.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10550
+ title: z13.string().optional().describe("New title. Omit to keep the current title."),
10551
+ fields: z13.record(z13.string(), z13.unknown()).optional().describe(
10313
10552
  "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."
10314
10553
  ),
10315
- text: z12.string().optional().describe(
10554
+ text: z13.string().optional().describe(
10316
10555
  "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."
10317
10556
  ),
10318
- folderId: z12.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
10319
- status: z12.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
10557
+ folderId: z13.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
10558
+ status: z13.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
10320
10559
  "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."
10321
10560
  ),
10322
- userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10323
- scopes: z12.array(z12.string()).optional().describe(
10324
- '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 built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
10561
+ userId: z13.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10562
+ scopes: z13.array(z13.string()).optional().describe(
10563
+ '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).'
10325
10564
  ),
10326
- expectedVersion: z12.number().int().optional().describe(
10565
+ expectedVersion: z13.number().int().optional().describe(
10327
10566
  "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."
10328
10567
  )
10329
10568
  };
@@ -10331,7 +10570,7 @@ var documentUpdate = ({ client, log }) => ({
10331
10570
  name: "document_update",
10332
10571
  title: "Update a document",
10333
10572
  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.',
10334
- inputSchema: inputSchema12,
10573
+ inputSchema: inputSchema13,
10335
10574
  handler: async (args) => {
10336
10575
  const documentId = args.documentId;
10337
10576
  const externalId = args.externalId;
@@ -10371,15 +10610,15 @@ var documentUpdate = ({ client, log }) => ({
10371
10610
  var document_update_default = documentUpdate;
10372
10611
 
10373
10612
  // src/tools/document_delete.ts
10374
- import { z as z13 } from "zod";
10375
- var inputSchema13 = {
10376
- documentId: z13.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
10613
+ import { z as z14 } from "zod";
10614
+ var inputSchema14 = {
10615
+ documentId: z14.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
10377
10616
  };
10378
10617
  var documentDelete = ({ client, log }) => ({
10379
10618
  name: "document_delete",
10380
10619
  title: "Delete a document",
10381
10620
  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).',
10382
- inputSchema: inputSchema13,
10621
+ inputSchema: inputSchema14,
10383
10622
  handler: async (args) => {
10384
10623
  const documentId = args.documentId;
10385
10624
  try {
@@ -10397,18 +10636,18 @@ var documentDelete = ({ client, log }) => ({
10397
10636
  var document_delete_default = documentDelete;
10398
10637
 
10399
10638
  // src/tools/folder_query.ts
10400
- import { z as z14 } from "zod";
10639
+ import { z as z15 } from "zod";
10401
10640
  var MCP_DEFAULT_LIMIT4 = 10;
10402
10641
  var MCP_MAX_LIMIT4 = 100;
10403
- var inputSchema14 = {
10404
- id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10405
- parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10406
- userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10407
- scope: z14.string().optional().describe(
10408
- '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 built-in namespaces; others are custom scopes you define.'
10642
+ var inputSchema15 = {
10643
+ id: z15.string().optional().describe("Get mode: fetch this single folder by id."),
10644
+ parentId: z15.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10645
+ userId: z15.string().optional().describe("List mode: scope to folders owned by this user."),
10646
+ scope: z15.string().optional().describe(
10647
+ '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.'
10409
10648
  ),
10410
- startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10411
- limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10649
+ startFrom: z15.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10650
+ limit: z15.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10412
10651
  `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\`.`
10413
10652
  )
10414
10653
  };
@@ -10416,7 +10655,7 @@ var folderQuery = ({ client, log }) => ({
10416
10655
  name: "folder_query",
10417
10656
  title: "Folder query (list or get)",
10418
10657
  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.",
10419
- inputSchema: inputSchema14,
10658
+ inputSchema: inputSchema15,
10420
10659
  handler: async (args) => {
10421
10660
  const id = args.id;
10422
10661
  try {
@@ -10446,22 +10685,22 @@ var folderQuery = ({ client, log }) => ({
10446
10685
  var folder_query_default = folderQuery;
10447
10686
 
10448
10687
  // src/tools/folder_create.ts
10449
- import { z as z15 } from "zod";
10450
- var inputSchema15 = {
10451
- name: z15.string().min(1, "name is required").describe("Folder display name."),
10452
- description: z15.string().optional().describe("Optional description of the folder's purpose."),
10453
- parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10454
- slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10455
- userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10456
- scopes: z15.array(z15.string()).optional().describe(
10457
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. 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.'
10688
+ import { z as z16 } from "zod";
10689
+ var inputSchema16 = {
10690
+ name: z16.string().min(1, "name is required").describe("Folder display name."),
10691
+ description: z16.string().optional().describe("Optional description of the folder's purpose."),
10692
+ parentId: z16.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10693
+ slug: z16.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10694
+ userId: z16.string().optional().describe("Owning user (Vectros UUID)."),
10695
+ scopes: z16.array(z16.string()).optional().describe(
10696
+ '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.'
10458
10697
  )
10459
10698
  };
10460
10699
  var folderCreate = ({ client, log }) => ({
10461
10700
  name: "folder_create",
10462
10701
  title: "Create a folder",
10463
10702
  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).",
10464
- inputSchema: inputSchema15,
10703
+ inputSchema: inputSchema16,
10465
10704
  handler: async (args) => {
10466
10705
  try {
10467
10706
  const folder = await client.folders.createFolder({
@@ -10485,16 +10724,16 @@ var folderCreate = ({ client, log }) => ({
10485
10724
  var folder_create_default = folderCreate;
10486
10725
 
10487
10726
  // src/tools/folder_update.ts
10488
- import { z as z16 } from "zod";
10489
- var inputSchema16 = {
10490
- id: z16.string().min(1, "id is required").describe("The Vectros folder id to update."),
10491
- name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10492
- description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10493
- userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10494
- scopes: z16.array(z16.string()).optional().describe(
10495
- '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 built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
10727
+ import { z as z17 } from "zod";
10728
+ var inputSchema17 = {
10729
+ id: z17.string().min(1, "id is required").describe("The Vectros folder id to update."),
10730
+ name: z17.string().optional().describe("New folder name. Omit to keep the current name."),
10731
+ description: z17.string().optional().describe("New description. Omit to leave unchanged."),
10732
+ userId: z17.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10733
+ scopes: z17.array(z17.string()).optional().describe(
10734
+ '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).'
10496
10735
  ),
10497
- expectedVersion: z16.number().int().optional().describe(
10736
+ expectedVersion: z17.number().int().optional().describe(
10498
10737
  "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."
10499
10738
  )
10500
10739
  };
@@ -10502,7 +10741,7 @@ var folderUpdate = ({ client, log }) => ({
10502
10741
  name: "folder_update",
10503
10742
  title: "Update a folder",
10504
10743
  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.",
10505
- inputSchema: inputSchema16,
10744
+ inputSchema: inputSchema17,
10506
10745
  handler: async (args) => {
10507
10746
  const id = args.id;
10508
10747
  const name = args.name;
@@ -10529,15 +10768,15 @@ var folderUpdate = ({ client, log }) => ({
10529
10768
  var folder_update_default = folderUpdate;
10530
10769
 
10531
10770
  // src/tools/folder_delete.ts
10532
- import { z as z17 } from "zod";
10533
- var inputSchema17 = {
10534
- id: z17.string().min(1, "id is required").describe("The Vectros folder id to delete.")
10771
+ import { z as z18 } from "zod";
10772
+ var inputSchema18 = {
10773
+ id: z18.string().min(1, "id is required").describe("The Vectros folder id to delete.")
10535
10774
  };
10536
10775
  var folderDelete = ({ client, log }) => ({
10537
10776
  name: "folder_delete",
10538
10777
  title: "Delete a folder",
10539
10778
  description: "Permanently delete a folder by id. 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.",
10540
- inputSchema: inputSchema17,
10779
+ inputSchema: inputSchema18,
10541
10780
  handler: async (args) => {
10542
10781
  const id = args.id;
10543
10782
  try {
@@ -10553,14 +10792,14 @@ var folderDelete = ({ client, log }) => ({
10553
10792
  var folder_delete_default = folderDelete;
10554
10793
 
10555
10794
  // src/tools/current_identity.ts
10556
- var inputSchema18 = {
10795
+ var inputSchema19 = {
10557
10796
  // No args — current_identity describes the current credential.
10558
10797
  };
10559
10798
  var currentIdentity = ({ log, apiKey, environment }) => ({
10560
10799
  name: "current_identity",
10561
10800
  title: "Current identity (tenant + principal scope)",
10562
- 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 reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). 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.",
10563
- inputSchema: inputSchema18,
10801
+ description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's verb+ownership reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry as of API 0.40.0 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.",
10802
+ inputSchema: inputSchema19,
10564
10803
  handler: async () => {
10565
10804
  try {
10566
10805
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -10576,7 +10815,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
10576
10815
  var current_identity_default = currentIdentity;
10577
10816
 
10578
10817
  // src/tools/document_ingest.ts
10579
- import { z as z18 } from "zod";
10818
+ import { z as z19 } from "zod";
10580
10819
  import { readFile, realpath } from "fs/promises";
10581
10820
  import { basename, extname, resolve, relative, isAbsolute } from "path";
10582
10821
  var IngestPathError = class extends Error {
@@ -10651,45 +10890,45 @@ function inferMimeType(filePath) {
10651
10890
  const ext = extname(filePath).toLowerCase();
10652
10891
  return EXT_TO_MIME[ext] ?? "application/octet-stream";
10653
10892
  }
10654
- var inputSchema19 = {
10655
- title: z18.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
10656
- indexMode: z18.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
10893
+ var inputSchema20 = {
10894
+ title: z19.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
10895
+ indexMode: z19.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
10657
10896
  "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."
10658
10897
  ),
10659
- externalId: z18.string().optional().describe(
10898
+ externalId: z19.string().optional().describe(
10660
10899
  '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.'
10661
10900
  ),
10662
- upsert: z18.boolean().optional().describe(
10901
+ upsert: z19.boolean().optional().describe(
10663
10902
  "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)."
10664
10903
  ),
10665
- schemaId: z18.string().optional().describe(
10904
+ schemaId: z19.string().optional().describe(
10666
10905
  "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."
10667
10906
  ),
10668
- payload: z18.record(z18.string(), z18.unknown()).optional().describe(
10907
+ payload: z19.record(z19.string(), z19.unknown()).optional().describe(
10669
10908
  "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."
10670
10909
  ),
10671
10910
  // Inline text mode (mutually exclusive with filePath):
10672
- text: z18.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10673
- storeText: z18.boolean().optional().describe(
10911
+ text: z19.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10912
+ storeText: z19.boolean().optional().describe(
10674
10913
  "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."
10675
10914
  ),
10676
10915
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10677
- filePath: z18.string().min(1).optional().describe(
10916
+ filePath: z19.string().min(1).optional().describe(
10678
10917
  "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."
10679
10918
  ),
10680
- fileType: z18.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
10919
+ fileType: z19.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
10681
10920
  // Common (both modes):
10682
- folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10683
- userId: z18.string().optional().describe("Owning user ID. Optional."),
10684
- scopes: z18.array(z18.string()).optional().describe(
10685
- "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are built-in namespaces; others are custom scopes you define. 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."
10921
+ folderId: z19.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10922
+ userId: z19.string().optional().describe("Owning user ID. Optional."),
10923
+ scopes: z19.array(z19.string()).optional().describe(
10924
+ "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."
10686
10925
  )
10687
10926
  };
10688
10927
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10689
10928
  name: "document_ingest",
10690
10929
  title: "Ingest a new document (text body or file upload)",
10691
10930
  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`.",
10692
- inputSchema: inputSchema19,
10931
+ inputSchema: inputSchema20,
10693
10932
  handler: async (args) => {
10694
10933
  const title = args.title;
10695
10934
  const text = args.text;
@@ -10841,39 +11080,43 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10841
11080
  var document_ingest_default = documentIngest;
10842
11081
 
10843
11082
  // src/tools/lookup_principal.ts
10844
- import { z as z19 } from "zod";
11083
+ import { z as z20 } from "zod";
10845
11084
  var MCP_DEFAULT_LIMIT5 = 10;
10846
11085
  var MCP_MAX_LIMIT5 = 100;
10847
- var inputSchema20 = {
10848
- kind: z19.string().describe(
10849
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
11086
+ var inputSchema21 = {
11087
+ kind: z20.string().describe(
11088
+ '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.'
10850
11089
  ),
10851
- externalId: z19.string().optional().describe(
11090
+ externalId: z20.string().optional().describe(
10852
11091
  "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."
10853
11092
  ),
11093
+ contextId: z20.string().optional().describe(
11094
+ "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."
11095
+ ),
10854
11096
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10855
- type: z19.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10856
- field: z19.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
10857
- value: z19.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
10858
- from: z19.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
10859
- to: z19.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10860
- prefix: z19.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10861
- order: z19.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
10862
- startFrom: z19.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10863
- limit: z19.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
11097
+ type: z20.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
11098
+ field: z20.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
11099
+ value: z20.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
11100
+ from: z20.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
11101
+ to: z20.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
11102
+ prefix: z20.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
11103
+ order: z20.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
11104
+ startFrom: z20.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
11105
+ limit: z20.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
10864
11106
  `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\`.`
10865
11107
  )
10866
11108
  };
10867
11109
  var lookupPrincipal = ({ client, log }) => ({
10868
11110
  name: "lookup_principal",
10869
11111
  title: "Look up a user identity or a namespaced identity entity",
10870
- 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.) 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.",
10871
- inputSchema: inputSchema20,
11112
+ 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.",
11113
+ inputSchema: inputSchema21,
10872
11114
  handler: async (args) => {
10873
11115
  const kind = args.kind;
10874
11116
  const isUser = kind === "user";
10875
11117
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10876
11118
  const externalId = args.externalId;
11119
+ const contextId = args.contextId;
10877
11120
  const type = args.type;
10878
11121
  const field = args.field;
10879
11122
  const value = args.value;
@@ -10882,11 +11125,18 @@ var lookupPrincipal = ({ client, log }) => ({
10882
11125
  const prefix = args.prefix;
10883
11126
  const order = args.order;
10884
11127
  const startFrom = args.startFrom;
11128
+ if (contextId !== void 0 && isUser) {
11129
+ return toolError(
11130
+ "lookup_principal",
11131
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
11132
+ );
11133
+ }
11134
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10885
11135
  try {
10886
11136
  let page;
10887
11137
  if (externalId !== void 0) {
10888
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10889
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
11138
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
11139
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10890
11140
  } else if (field !== void 0) {
10891
11141
  const hasEquality = value !== void 0;
10892
11142
  const hasRange = from !== void 0 || to !== void 0;
@@ -10914,8 +11164,8 @@ var lookupPrincipal = ({ client, log }) => ({
10914
11164
  );
10915
11165
  }
10916
11166
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10917
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10918
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
11167
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
11168
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10919
11169
  } else {
10920
11170
  return toolError(
10921
11171
  "lookup_principal",
@@ -10926,7 +11176,7 @@ var lookupPrincipal = ({ client, log }) => ({
10926
11176
  const nextCursor = page.nextCursor ?? null;
10927
11177
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10928
11178
  } catch (err) {
10929
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
11179
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10930
11180
  return toolError("lookup_principal", err);
10931
11181
  }
10932
11182
  }
@@ -10934,17 +11184,17 @@ var lookupPrincipal = ({ client, log }) => ({
10934
11184
  var lookup_principal_default = lookupPrincipal;
10935
11185
 
10936
11186
  // src/tools/version_history.ts
10937
- import { z as z20 } from "zod";
10938
- var inputSchema21 = {
10939
- resourceType: z20.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
10940
- id: z20.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
10941
- startFrom: z20.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
11187
+ import { z as z21 } from "zod";
11188
+ var inputSchema22 = {
11189
+ resourceType: z21.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
11190
+ id: z21.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
11191
+ startFrom: z21.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
10942
11192
  };
10943
11193
  var versionHistory = ({ client, log }) => ({
10944
11194
  name: "version_history",
10945
11195
  title: "Version history (record or document)",
10946
11196
  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.",
10947
- inputSchema: inputSchema21,
11197
+ inputSchema: inputSchema22,
10948
11198
  handler: async (args) => {
10949
11199
  const resourceType = args.resourceType;
10950
11200
  const id = args.id;
@@ -10971,6 +11221,7 @@ var TOOL_NAMES = [
10971
11221
  "hybrid_search",
10972
11222
  "record_query",
10973
11223
  "record_get",
11224
+ "record_batch_get",
10974
11225
  "record_create",
10975
11226
  "record_update",
10976
11227
  "record_delete",
@@ -10996,6 +11247,7 @@ var ALL_TOOL_FACTORIES = {
10996
11247
  hybrid_search: hybrid_search_default,
10997
11248
  record_query: record_query_default,
10998
11249
  record_get: record_get_default,
11250
+ record_batch_get: record_batch_get_default,
10999
11251
  record_create: record_create_default,
11000
11252
  record_update: record_update_default,
11001
11253
  record_delete: record_delete_default,
@@ -11037,7 +11289,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11037
11289
  name: "identity",
11038
11290
  uri: "vectros://identity",
11039
11291
  title: "Current identity (tenant + principal scope)",
11040
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }), plus mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
11292
+ description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). Note: this does not yet include granted_capabilities (member-lifecycle / forensic-read / context-directory-read / delegate-mint) \u2014 a separate reach dimension a scope clause can carry as of API 0.40.0 that /v1/ping does not report yet, so allowedActions+dataScope may understate a credential's true reach. Also reports mcpServerVersion and sdkVersion (this build's own version and the bundled @vectros-ai/sdk version). The /v1/ping backing call ships the extended shape today; the version fields are always client-derived.",
11041
11293
  mimeType: "application/json",
11042
11294
  read: async () => {
11043
11295
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -11056,7 +11308,7 @@ var ALL_RESOURCE_FACTORIES = {
11056
11308
  };
11057
11309
 
11058
11310
  // src/zod-to-json-schema.ts
11059
- import { z as z21 } from "zod";
11311
+ import { z as z22 } from "zod";
11060
11312
  function zodShapeToJsonSchema(shape) {
11061
11313
  const properties = {};
11062
11314
  const required = [];
@@ -11071,40 +11323,40 @@ function zodShapeToJsonSchema(shape) {
11071
11323
  function zodTypeToJsonSchema(schema) {
11072
11324
  const description = schema.description;
11073
11325
  let current = schema;
11074
- while (current instanceof z21.ZodOptional || current instanceof z21.ZodDefault || current instanceof z21.ZodNullable) {
11326
+ while (current instanceof z22.ZodOptional || current instanceof z22.ZodDefault || current instanceof z22.ZodNullable) {
11075
11327
  current = current._def.innerType;
11076
11328
  }
11077
11329
  const base = description ? { description } : {};
11078
- if (current instanceof z21.ZodString) {
11330
+ if (current instanceof z22.ZodString) {
11079
11331
  return { ...base, type: "string" };
11080
11332
  }
11081
- if (current instanceof z21.ZodNumber) {
11333
+ if (current instanceof z22.ZodNumber) {
11082
11334
  return { ...base, type: "number" };
11083
11335
  }
11084
- if (current instanceof z21.ZodBoolean) {
11336
+ if (current instanceof z22.ZodBoolean) {
11085
11337
  return { ...base, type: "boolean" };
11086
11338
  }
11087
- if (current instanceof z21.ZodEnum) {
11339
+ if (current instanceof z22.ZodEnum) {
11088
11340
  return {
11089
11341
  ...base,
11090
11342
  type: "string",
11091
11343
  enum: current.options
11092
11344
  };
11093
11345
  }
11094
- if (current instanceof z21.ZodArray) {
11346
+ if (current instanceof z22.ZodArray) {
11095
11347
  return {
11096
11348
  ...base,
11097
11349
  type: "array",
11098
11350
  items: zodTypeToJsonSchema(current.element)
11099
11351
  };
11100
11352
  }
11101
- if (current instanceof z21.ZodObject) {
11353
+ if (current instanceof z22.ZodObject) {
11102
11354
  return {
11103
11355
  ...base,
11104
11356
  ...zodShapeToJsonSchema(current.shape)
11105
11357
  };
11106
11358
  }
11107
- if (current instanceof z21.ZodRecord) {
11359
+ if (current instanceof z22.ZodRecord) {
11108
11360
  const valueType = current._def.valueType;
11109
11361
  return {
11110
11362
  ...base,
@@ -11228,7 +11480,7 @@ var VectrosMCPServer = class {
11228
11480
  if (!tool) {
11229
11481
  result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
11230
11482
  } else {
11231
- const parsed = z22.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
11483
+ const parsed = z23.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
11232
11484
  if (!parsed.success) {
11233
11485
  result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
11234
11486
  } else {