@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.js CHANGED
@@ -2515,7 +2515,7 @@ var AuthClient = class {
2515
2515
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/admin/keys/scoped");
2516
2516
  }
2517
2517
  /**
2518
- * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. A root API key (`sk_`) is exempt from both bounds.
2518
+ * Creates a scoped API key (an `ssk_*` secret) that inherits its permissions from an existing access profile in your account. The call is idempotent on the combination of tenant, context, user, and key name: re-issuing the same request returns the existing key WITHOUT re-disclosing its raw secret. The raw key is returned ONLY in this response — store it securely, as it cannot be retrieved again. Requires the `keys:c` scope. If you use a scoped credential, `keys:c` alone is not sufficient: because the minted key is durably bound to the profile you name, the profile's effective scopes may not exceed your own, and you may only mint against a profile whose `identityOverrides` values your own identity holds. Minting a key bound to your OWN principal needs nothing further; minting one bound to a DIFFERENT principal additionally requires the `delegate-mint` capability (`granted_capabilities`) on your credential — without it the request is refused. A root API key (`sk_`) is exempt from all three bounds.
2519
2519
  *
2520
2520
  * @param {Vectros.CreateScopedKeyRequest} request
2521
2521
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2847,7 +2847,7 @@ var AuthClient = class {
2847
2847
  );
2848
2848
  }
2849
2849
  /**
2850
- * 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.
2850
+ * 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.
2851
2851
  *
2852
2852
  * @param {Vectros.CreateAccessProfileRequest} request
2853
2853
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3948,7 +3948,7 @@ var AuthClient = class {
3948
3948
  );
3949
3949
  }
3950
3950
  /**
3951
- * 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.
3951
+ * 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.
3952
3952
  *
3953
3953
  * @param {Vectros.GetUsageRequest} request
3954
3954
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4011,7 +4011,7 @@ var AuthClient = class {
4011
4011
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
4012
4012
  }
4013
4013
  /**
4014
- * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
4014
+ * 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.
4015
4015
  *
4016
4016
  * @param {Vectros.GetIssuerRequest} request
4017
4017
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4069,13 +4069,81 @@ var AuthClient = class {
4069
4069
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4070
4070
  }
4071
4071
  /**
4072
- * 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.
4072
+ * Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `status` (`active`/`suspended` — a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
4073
+ *
4074
+ * @param {Vectros.IssuerUpdateRequest} request
4075
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4076
+ *
4077
+ * @throws {@link Vectros.BadRequestError}
4078
+ * @throws {@link Vectros.ForbiddenError}
4079
+ * @throws {@link Vectros.NotFoundError}
4080
+ * @throws {@link Vectros.TooManyRequestsError}
4081
+ *
4082
+ * @example
4083
+ * await client.auth.updateIssuer({
4084
+ * issuerId: "auth0-prod"
4085
+ * })
4086
+ */
4087
+ updateIssuer(request, requestOptions) {
4088
+ return HttpResponsePromise.fromPromise(this.__updateIssuer(request, requestOptions));
4089
+ }
4090
+ async __updateIssuer(request, requestOptions) {
4091
+ const { issuerId, ..._body } = request;
4092
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4093
+ const _headers = mergeHeaders(
4094
+ _authRequest.headers,
4095
+ this._options?.headers,
4096
+ requestOptions?.headers
4097
+ );
4098
+ const _response = await fetcher({
4099
+ url: url_exports.join(
4100
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4101
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}`
4102
+ ),
4103
+ method: "PUT",
4104
+ headers: _headers,
4105
+ contentType: "application/json",
4106
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4107
+ requestType: "json",
4108
+ body: _body,
4109
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4110
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4111
+ abortSignal: requestOptions?.abortSignal,
4112
+ fetchFn: this._options?.fetch,
4113
+ logging: this._options.logging
4114
+ });
4115
+ if (_response.ok) {
4116
+ return { data: _response.body, rawResponse: _response.rawResponse };
4117
+ }
4118
+ if (_response.error.reason === "status-code") {
4119
+ switch (_response.error.statusCode) {
4120
+ case 400:
4121
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4122
+ case 403:
4123
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4124
+ case 404:
4125
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4126
+ case 429:
4127
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4128
+ default:
4129
+ throw new VectrosError({
4130
+ statusCode: _response.error.statusCode,
4131
+ body: _response.error.body,
4132
+ rawResponse: _response.rawResponse
4133
+ });
4134
+ }
4135
+ }
4136
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/auth/issuers/{issuerId}");
4137
+ }
4138
+ /**
4139
+ * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned. 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.
4073
4140
  *
4074
4141
  * @param {Vectros.DeleteIssuerRequest} request
4075
4142
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4076
4143
  *
4077
4144
  * @throws {@link Vectros.ForbiddenError}
4078
4145
  * @throws {@link Vectros.NotFoundError}
4146
+ * @throws {@link Vectros.ConflictError}
4079
4147
  * @throws {@link Vectros.TooManyRequestsError}
4080
4148
  *
4081
4149
  * @example
@@ -4117,6 +4185,8 @@ var AuthClient = class {
4117
4185
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4118
4186
  case 404:
4119
4187
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4188
+ case 409:
4189
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4120
4190
  case 429:
4121
4191
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4122
4192
  default:
@@ -4135,7 +4205,7 @@ var AuthClient = class {
4135
4205
  );
4136
4206
  }
4137
4207
  /**
4138
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4208
+ * 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.
4139
4209
  *
4140
4210
  * @param {Vectros.ListIssuersRequest} request
4141
4211
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4192,7 +4262,7 @@ var AuthClient = class {
4192
4262
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4193
4263
  }
4194
4264
  /**
4195
- * 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.
4265
+ * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`.
4196
4266
  *
4197
4267
  * @param {Vectros.IssuerRequest} request
4198
4268
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4303,7 +4373,7 @@ var AuthClient = class {
4303
4373
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4304
4374
  }
4305
4375
  /**
4306
- * 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.
4376
+ * 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.
4307
4377
  *
4308
4378
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4309
4379
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4377,6 +4447,7 @@ var AuthClient = class {
4377
4447
  *
4378
4448
  * @throws {@link Vectros.BadRequestError}
4379
4449
  * @throws {@link Vectros.ForbiddenError}
4450
+ * @throws {@link Vectros.NotFoundError}
4380
4451
  * @throws {@link Vectros.TooManyRequestsError}
4381
4452
  *
4382
4453
  * @example
@@ -4430,6 +4501,8 @@ var AuthClient = class {
4430
4501
  throw new BadRequestError(_response.error.body, _response.rawResponse);
4431
4502
  case 403:
4432
4503
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4504
+ case 404:
4505
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4433
4506
  case 429:
4434
4507
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4435
4508
  default:
@@ -4582,7 +4655,84 @@ var AuthClient = class {
4582
4655
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4583
4656
  }
4584
4657
  /**
4585
- * 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.
4658
+ * 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).
4659
+ *
4660
+ * **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.
4661
+ *
4662
+ * **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.
4663
+ *
4664
+ * **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.
4665
+ *
4666
+ * 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.
4667
+ *
4668
+ * @param {Record<string, unknown>} request
4669
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4670
+ *
4671
+ * @throws {@link Vectros.BadRequestError}
4672
+ * @throws {@link Vectros.UnauthorizedError}
4673
+ * @throws {@link Vectros.ForbiddenError}
4674
+ * @throws {@link Vectros.ConflictError}
4675
+ * @throws {@link Vectros.TooManyRequestsError}
4676
+ *
4677
+ * @example
4678
+ * await client.auth.assumeToken({
4679
+ * "scope:org": "orgB"
4680
+ * })
4681
+ */
4682
+ assumeToken(request, requestOptions) {
4683
+ return HttpResponsePromise.fromPromise(this.__assumeToken(request, requestOptions));
4684
+ }
4685
+ async __assumeToken(request, requestOptions) {
4686
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4687
+ const _headers = mergeHeaders(
4688
+ _authRequest.headers,
4689
+ this._options?.headers,
4690
+ requestOptions?.headers
4691
+ );
4692
+ const _response = await fetcher({
4693
+ url: url_exports.join(
4694
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4695
+ "v1/auth/token/assume"
4696
+ ),
4697
+ method: "POST",
4698
+ headers: _headers,
4699
+ contentType: "application/json",
4700
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4701
+ requestType: "json",
4702
+ body: request,
4703
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4704
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4705
+ abortSignal: requestOptions?.abortSignal,
4706
+ fetchFn: this._options?.fetch,
4707
+ logging: this._options.logging
4708
+ });
4709
+ if (_response.ok) {
4710
+ return { data: _response.body, rawResponse: _response.rawResponse };
4711
+ }
4712
+ if (_response.error.reason === "status-code") {
4713
+ switch (_response.error.statusCode) {
4714
+ case 400:
4715
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4716
+ case 401:
4717
+ throw new UnauthorizedError(_response.error.body, _response.rawResponse);
4718
+ case 403:
4719
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4720
+ case 409:
4721
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4722
+ case 429:
4723
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4724
+ default:
4725
+ throw new VectrosError({
4726
+ statusCode: _response.error.statusCode,
4727
+ body: _response.error.body,
4728
+ rawResponse: _response.rawResponse
4729
+ });
4730
+ }
4731
+ }
4732
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/token/assume");
4733
+ }
4734
+ /**
4735
+ * 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.
4586
4736
  *
4587
4737
  * @param {Vectros.TokenExchangeRequest} request
4588
4738
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4658,9 +4808,9 @@ var ComplianceClient = class {
4658
4808
  * @param {Vectros.ErasureRequest} request
4659
4809
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
4660
4810
  *
4811
+ * @throws {@link Vectros.BadRequestError}
4661
4812
  * @throws {@link Vectros.ForbiddenError}
4662
4813
  * @throws {@link Vectros.TooManyRequestsError}
4663
- * @throws {@link Vectros.NotImplementedError}
4664
4814
  *
4665
4815
  * @example
4666
4816
  * await client.compliance.createErasureRequest({
@@ -4699,12 +4849,12 @@ var ComplianceClient = class {
4699
4849
  }
4700
4850
  if (_response.error.reason === "status-code") {
4701
4851
  switch (_response.error.statusCode) {
4852
+ case 400:
4853
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4702
4854
  case 403:
4703
4855
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4704
4856
  case 429:
4705
4857
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4706
- case 501:
4707
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
4708
4858
  default:
4709
4859
  throw new VectrosError({
4710
4860
  statusCode: _response.error.statusCode,
@@ -4723,7 +4873,6 @@ var ComplianceClient = class {
4723
4873
  *
4724
4874
  * @throws {@link Vectros.ForbiddenError}
4725
4875
  * @throws {@link Vectros.NotFoundError}
4726
- * @throws {@link Vectros.NotImplementedError}
4727
4876
  *
4728
4877
  * @example
4729
4878
  * await client.compliance.getErasureRequest({
@@ -4764,8 +4913,6 @@ var ComplianceClient = class {
4764
4913
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4765
4914
  case 404:
4766
4915
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4767
- case 501:
4768
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
4769
4916
  default:
4770
4917
  throw new VectrosError({
4771
4918
  statusCode: _response.error.statusCode,
@@ -6124,6 +6271,7 @@ var IdentityClient = class {
6124
6271
  * @example
6125
6272
  * await client.identity.listEntities({
6126
6273
  * namespace: "team",
6274
+ * contextId: "myapp",
6127
6275
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6128
6276
  * })
6129
6277
  */
@@ -6133,6 +6281,7 @@ var IdentityClient = class {
6133
6281
  async __listEntities(request, requestOptions) {
6134
6282
  const {
6135
6283
  namespace,
6284
+ contextId,
6136
6285
  userId,
6137
6286
  externalId,
6138
6287
  scope,
@@ -6147,6 +6296,7 @@ var IdentityClient = class {
6147
6296
  limit
6148
6297
  } = request;
6149
6298
  const _queryParams = {
6299
+ contextId,
6150
6300
  userId,
6151
6301
  externalId,
6152
6302
  scope,
@@ -6205,6 +6355,7 @@ var IdentityClient = class {
6205
6355
  * @example
6206
6356
  * await client.identity.createEntity({
6207
6357
  * namespace: "team",
6358
+ * contextId: "myapp",
6208
6359
  * body: {
6209
6360
  * externalId: "team_eng_platform"
6210
6361
  * }
@@ -6214,9 +6365,10 @@ var IdentityClient = class {
6214
6365
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6215
6366
  }
6216
6367
  async __createEntity(request, requestOptions) {
6217
- const { namespace, upsert, body: _body } = request;
6368
+ const { namespace, upsert, contextId, body: _body } = request;
6218
6369
  const _queryParams = {
6219
- upsert
6370
+ upsert,
6371
+ contextId
6220
6372
  };
6221
6373
  const _authRequest = await this._options.authProvider.getAuthRequest();
6222
6374
  const _headers = mergeHeaders(
@@ -6273,14 +6425,18 @@ var IdentityClient = class {
6273
6425
  * @example
6274
6426
  * await client.identity.getEntity({
6275
6427
  * namespace: "team",
6276
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6428
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6429
+ * contextId: "myapp"
6277
6430
  * })
6278
6431
  */
6279
6432
  getEntity(request, requestOptions) {
6280
6433
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6281
6434
  }
6282
6435
  async __getEntity(request, requestOptions) {
6283
- const { namespace, id } = request;
6436
+ const { namespace, id, contextId } = request;
6437
+ const _queryParams = {
6438
+ contextId
6439
+ };
6284
6440
  const _authRequest = await this._options.authProvider.getAuthRequest();
6285
6441
  const _headers = mergeHeaders(
6286
6442
  _authRequest.headers,
@@ -6294,7 +6450,7 @@ var IdentityClient = class {
6294
6450
  ),
6295
6451
  method: "GET",
6296
6452
  headers: _headers,
6297
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6453
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6298
6454
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6299
6455
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6300
6456
  abortSignal: requestOptions?.abortSignal,
@@ -6331,6 +6487,7 @@ var IdentityClient = class {
6331
6487
  * await client.identity.updateEntity({
6332
6488
  * namespace: "team",
6333
6489
  * id: "id",
6490
+ * contextId: "myapp",
6334
6491
  * body: {
6335
6492
  * externalId: "team_eng_platform"
6336
6493
  * }
@@ -6340,7 +6497,10 @@ var IdentityClient = class {
6340
6497
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6341
6498
  }
6342
6499
  async __updateEntity(request, requestOptions) {
6343
- const { namespace, id, body: _body } = request;
6500
+ const { namespace, id, contextId, body: _body } = request;
6501
+ const _queryParams = {
6502
+ contextId
6503
+ };
6344
6504
  const _authRequest = await this._options.authProvider.getAuthRequest();
6345
6505
  const _headers = mergeHeaders(
6346
6506
  _authRequest.headers,
@@ -6355,7 +6515,7 @@ var IdentityClient = class {
6355
6515
  method: "PUT",
6356
6516
  headers: _headers,
6357
6517
  contentType: "application/json",
6358
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6518
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6359
6519
  requestType: "json",
6360
6520
  body: _body,
6361
6521
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6395,14 +6555,18 @@ var IdentityClient = class {
6395
6555
  * @example
6396
6556
  * await client.identity.deleteEntity({
6397
6557
  * namespace: "team",
6398
- * id: "id"
6558
+ * id: "id",
6559
+ * contextId: "myapp"
6399
6560
  * })
6400
6561
  */
6401
6562
  deleteEntity(request, requestOptions) {
6402
6563
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6403
6564
  }
6404
6565
  async __deleteEntity(request, requestOptions) {
6405
- const { namespace, id } = request;
6566
+ const { namespace, id, contextId } = request;
6567
+ const _queryParams = {
6568
+ contextId
6569
+ };
6406
6570
  const _authRequest = await this._options.authProvider.getAuthRequest();
6407
6571
  const _headers = mergeHeaders(
6408
6572
  _authRequest.headers,
@@ -6416,7 +6580,7 @@ var IdentityClient = class {
6416
6580
  ),
6417
6581
  method: "DELETE",
6418
6582
  headers: _headers,
6419
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6583
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6420
6584
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6421
6585
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6422
6586
  abortSignal: requestOptions?.abortSignal,
@@ -6459,6 +6623,7 @@ var IdentityClient = class {
6459
6623
  * @example
6460
6624
  * await client.identity.lookupEntities({
6461
6625
  * namespace: "team",
6626
+ * contextId: "myapp",
6462
6627
  * body: {
6463
6628
  * type: "person_v1",
6464
6629
  * field: "ssn"
@@ -6469,7 +6634,10 @@ var IdentityClient = class {
6469
6634
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6470
6635
  }
6471
6636
  async __lookupEntities(request, requestOptions) {
6472
- const { namespace, body: _body } = request;
6637
+ const { namespace, contextId, body: _body } = request;
6638
+ const _queryParams = {
6639
+ contextId
6640
+ };
6473
6641
  const _authRequest = await this._options.authProvider.getAuthRequest();
6474
6642
  const _headers = mergeHeaders(
6475
6643
  _authRequest.headers,
@@ -6484,7 +6652,7 @@ var IdentityClient = class {
6484
6652
  method: "POST",
6485
6653
  headers: _headers,
6486
6654
  contentType: "application/json",
6487
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6655
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6488
6656
  requestType: "json",
6489
6657
  body: _body,
6490
6658
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6528,15 +6696,17 @@ var IdentityClient = class {
6528
6696
  * @example
6529
6697
  * await client.identity.getEntityVersions({
6530
6698
  * namespace: "team",
6531
- * id: "id"
6699
+ * id: "id",
6700
+ * contextId: "myapp"
6532
6701
  * })
6533
6702
  */
6534
6703
  getEntityVersions(request, requestOptions) {
6535
6704
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6536
6705
  }
6537
6706
  async __getEntityVersions(request, requestOptions) {
6538
- const { namespace, id, startFrom } = request;
6707
+ const { namespace, id, contextId, startFrom } = request;
6539
6708
  const _queryParams = {
6709
+ contextId,
6540
6710
  startFrom
6541
6711
  };
6542
6712
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6582,7 +6752,7 @@ var IdentityClient = class {
6582
6752
  );
6583
6753
  }
6584
6754
  /**
6585
- * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6755
+ * Retrieves a single scope-namespace registration by name.
6586
6756
  *
6587
6757
  * @param {Vectros.GetNamespaceRequest} request
6588
6758
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6598,7 +6768,10 @@ var IdentityClient = class {
6598
6768
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6599
6769
  }
6600
6770
  async __getNamespace(request, requestOptions) {
6601
- const { namespace } = request;
6771
+ const { namespace, contextId } = request;
6772
+ const _queryParams = {
6773
+ contextId
6774
+ };
6602
6775
  const _authRequest = await this._options.authProvider.getAuthRequest();
6603
6776
  const _headers = mergeHeaders(
6604
6777
  _authRequest.headers,
@@ -6612,7 +6785,7 @@ var IdentityClient = class {
6612
6785
  ),
6613
6786
  method: "GET",
6614
6787
  headers: _headers,
6615
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6788
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6616
6789
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6617
6790
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6618
6791
  abortSignal: requestOptions?.abortSignal,
@@ -6637,7 +6810,7 @@ var IdentityClient = class {
6637
6810
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6638
6811
  }
6639
6812
  /**
6640
- * 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.
6813
+ * 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.
6641
6814
  *
6642
6815
  * @param {Vectros.UpdateNamespaceRequest} request
6643
6816
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6659,7 +6832,10 @@ var IdentityClient = class {
6659
6832
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6660
6833
  }
6661
6834
  async __updateNamespace(request, requestOptions) {
6662
- const { namespace, body: _body } = request;
6835
+ const { namespace, contextId, body: _body } = request;
6836
+ const _queryParams = {
6837
+ contextId
6838
+ };
6663
6839
  const _authRequest = await this._options.authProvider.getAuthRequest();
6664
6840
  const _headers = mergeHeaders(
6665
6841
  _authRequest.headers,
@@ -6674,7 +6850,7 @@ var IdentityClient = class {
6674
6850
  method: "PUT",
6675
6851
  headers: _headers,
6676
6852
  contentType: "application/json",
6677
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6853
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6678
6854
  requestType: "json",
6679
6855
  body: _body,
6680
6856
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6705,7 +6881,7 @@ var IdentityClient = class {
6705
6881
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6706
6882
  }
6707
6883
  /**
6708
- * 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.
6884
+ * 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.
6709
6885
  *
6710
6886
  * @param {Vectros.DeleteNamespaceRequest} request
6711
6887
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6723,7 +6899,10 @@ var IdentityClient = class {
6723
6899
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6724
6900
  }
6725
6901
  async __deleteNamespace(request, requestOptions) {
6726
- const { namespace } = request;
6902
+ const { namespace, contextId } = request;
6903
+ const _queryParams = {
6904
+ contextId
6905
+ };
6727
6906
  const _authRequest = await this._options.authProvider.getAuthRequest();
6728
6907
  const _headers = mergeHeaders(
6729
6908
  _authRequest.headers,
@@ -6737,7 +6916,7 @@ var IdentityClient = class {
6737
6916
  ),
6738
6917
  method: "DELETE",
6739
6918
  headers: _headers,
6740
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6919
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6741
6920
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6742
6921
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6743
6922
  abortSignal: requestOptions?.abortSignal,
@@ -6766,7 +6945,7 @@ var IdentityClient = class {
6766
6945
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6767
6946
  }
6768
6947
  /**
6769
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6948
+ * Returns the scope namespaces registered in your account. Returns a `{data, nextCursor}` envelope.
6770
6949
  *
6771
6950
  * @param {Vectros.ListNamespacesRequest} request
6772
6951
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6778,10 +6957,11 @@ var IdentityClient = class {
6778
6957
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6779
6958
  }
6780
6959
  async __listNamespaces(request = {}, requestOptions) {
6781
- const { startFrom, limit } = request;
6960
+ const { startFrom, limit, contextId } = request;
6782
6961
  const _queryParams = {
6783
6962
  startFrom,
6784
- limit
6963
+ limit,
6964
+ contextId
6785
6965
  };
6786
6966
  const _authRequest = await this._options.authProvider.getAuthRequest();
6787
6967
  const _headers = mergeHeaders(
@@ -6816,9 +6996,9 @@ var IdentityClient = class {
6816
6996
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6817
6997
  }
6818
6998
  /**
6819
- * 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.
6999
+ * 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.
6820
7000
  *
6821
- * @param {Vectros.NamespaceRequest} request
7001
+ * @param {Vectros.RegisterNamespaceRequest} request
6822
7002
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6823
7003
  *
6824
7004
  * @throws {@link Vectros.BadRequestError}
@@ -6827,14 +7007,20 @@ var IdentityClient = class {
6827
7007
  *
6828
7008
  * @example
6829
7009
  * await client.identity.registerNamespace({
6830
- * namespace: "team",
6831
- * specificityRank: 1500
7010
+ * body: {
7011
+ * namespace: "team",
7012
+ * specificityRank: 1500
7013
+ * }
6832
7014
  * })
6833
7015
  */
6834
7016
  registerNamespace(request, requestOptions) {
6835
7017
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6836
7018
  }
6837
7019
  async __registerNamespace(request, requestOptions) {
7020
+ const { contextId, body: _body } = request;
7021
+ const _queryParams = {
7022
+ contextId
7023
+ };
6838
7024
  const _authRequest = await this._options.authProvider.getAuthRequest();
6839
7025
  const _headers = mergeHeaders(
6840
7026
  _authRequest.headers,
@@ -6849,9 +7035,9 @@ var IdentityClient = class {
6849
7035
  method: "POST",
6850
7036
  headers: _headers,
6851
7037
  contentType: "application/json",
6852
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
7038
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6853
7039
  requestType: "json",
6854
- body: request,
7040
+ body: _body,
6855
7041
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6856
7042
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6857
7043
  abortSignal: requestOptions?.abortSignal,
@@ -6880,7 +7066,7 @@ var IdentityClient = class {
6880
7066
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6881
7067
  }
6882
7068
  /**
6883
- * 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.
7069
+ * 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.
6884
7070
  *
6885
7071
  * @param {Vectros.ListUsersRequest} request
6886
7072
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6945,7 +7131,7 @@ var IdentityClient = class {
6945
7131
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users");
6946
7132
  }
6947
7133
  /**
6948
- * 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.
7134
+ * 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`.
6949
7135
  *
6950
7136
  * @param {Vectros.CreateUserRequest} request
6951
7137
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7069,7 +7255,7 @@ var IdentityClient = class {
7069
7255
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/users/{id}");
7070
7256
  }
7071
7257
  /**
7072
- * 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.
7258
+ * 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.
7073
7259
  *
7074
7260
  * @param {Vectros.UpdateUserRequest} request
7075
7261
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7136,12 +7322,13 @@ var IdentityClient = class {
7136
7322
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7137
7323
  }
7138
7324
  /**
7139
- * 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.
7325
+ * 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.
7140
7326
  *
7141
7327
  * @param {Vectros.DeleteUserRequest} request
7142
7328
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7143
7329
  *
7144
7330
  * @throws {@link Vectros.NotFoundError}
7331
+ * @throws {@link Vectros.ConflictError}
7145
7332
  * @throws {@link Vectros.TooManyRequestsError}
7146
7333
  *
7147
7334
  * @example
@@ -7181,6 +7368,8 @@ var IdentityClient = class {
7181
7368
  switch (_response.error.statusCode) {
7182
7369
  case 404:
7183
7370
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7371
+ case 409:
7372
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7184
7373
  case 429:
7185
7374
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7186
7375
  default:
@@ -7194,7 +7383,7 @@ var IdentityClient = class {
7194
7383
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/users/{id}");
7195
7384
  }
7196
7385
  /**
7197
- * 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.
7386
+ * 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.
7198
7387
  *
7199
7388
  * @param {Vectros.IdentityLookupRequest} request
7200
7389
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7637,14 +7826,14 @@ var RecordsClient = class {
7637
7826
  this._options = normalizeClientOptionsWithAuth(options);
7638
7827
  }
7639
7828
  /**
7640
- * 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.
7829
+ * 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).
7641
7830
  *
7642
7831
  * @param {Vectros.BatchGetRequest} request
7643
7832
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
7644
7833
  *
7834
+ * @throws {@link Vectros.BadRequestError}
7645
7835
  * @throws {@link Vectros.ForbiddenError}
7646
7836
  * @throws {@link Vectros.TooManyRequestsError}
7647
- * @throws {@link Vectros.NotImplementedError}
7648
7837
  *
7649
7838
  * @example
7650
7839
  * await client.records.batchGetRecords()
@@ -7681,12 +7870,12 @@ var RecordsClient = class {
7681
7870
  }
7682
7871
  if (_response.error.reason === "status-code") {
7683
7872
  switch (_response.error.statusCode) {
7873
+ case 400:
7874
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
7684
7875
  case 403:
7685
7876
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
7686
7877
  case 429:
7687
7878
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7688
- case 501:
7689
- throw new NotImplementedError(_response.error.body, _response.rawResponse);
7690
7879
  default:
7691
7880
  throw new VectrosError({
7692
7881
  statusCode: _response.error.statusCode,
@@ -8500,7 +8689,7 @@ var SchemasClient = class {
8500
8689
  this._options = normalizeClientOptionsWithAuth(options);
8501
8690
  }
8502
8691
  /**
8503
- * 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.
8692
+ * 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.
8504
8693
  *
8505
8694
  * @param {Vectros.ListSchemasRequest} request
8506
8695
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8788,6 +8977,7 @@ var SchemasClient = class {
8788
8977
  * @param {Vectros.DeleteSchemaRequest} request
8789
8978
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
8790
8979
  *
8980
+ * @throws {@link Vectros.ForbiddenError}
8791
8981
  * @throws {@link Vectros.NotFoundError}
8792
8982
  * @throws {@link Vectros.ConflictError}
8793
8983
  * @throws {@link Vectros.TooManyRequestsError}
@@ -8827,6 +9017,8 @@ var SchemasClient = class {
8827
9017
  }
8828
9018
  if (_response.error.reason === "status-code") {
8829
9019
  switch (_response.error.statusCode) {
9020
+ case 403:
9021
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
8830
9022
  case 404:
8831
9023
  throw new NotFoundError(_response.error.body, _response.rawResponse);
8832
9024
  case 409:
@@ -9036,7 +9228,7 @@ var logging;
9036
9228
 
9037
9229
  // src/server.ts
9038
9230
  var import_types3 = require("@modelcontextprotocol/sdk/types.js");
9039
- var import_zod22 = require("zod");
9231
+ var import_zod23 = require("zod");
9040
9232
 
9041
9233
  // src/auth.ts
9042
9234
  var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
@@ -9080,8 +9272,8 @@ function warnOnSuboptimalKey(key, log) {
9080
9272
 
9081
9273
  // src/build-info.ts
9082
9274
  var BUILD_INFO = {
9083
- mcpServer: true ? "0.14.0" : "dev",
9084
- sdk: true ? "0.39.0" : "dev"
9275
+ mcpServer: true ? "0.16.0" : "dev",
9276
+ sdk: true ? "0.41.0" : "dev"
9085
9277
  };
9086
9278
  function formatBuildInfo() {
9087
9279
  return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
@@ -9392,7 +9584,7 @@ var inputSchema = {
9392
9584
  // Ownership.
9393
9585
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9394
9586
  scope: import_zod.z.string().optional().describe(
9395
- '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.'
9587
+ '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.'
9396
9588
  ),
9397
9589
  // Date window.
9398
9590
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9532,7 +9724,7 @@ var inputSchema2 = {
9532
9724
  // List-mode args:
9533
9725
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9534
9726
  scope: import_zod2.z.string().optional().describe(
9535
- '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.'
9727
+ '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.'
9536
9728
  ),
9537
9729
  startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9538
9730
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9766,31 +9958,78 @@ var recordGet = ({ client, log }) => ({
9766
9958
  });
9767
9959
  var record_get_default = recordGet;
9768
9960
 
9769
- // src/tools/record_create.ts
9961
+ // src/tools/record_batch_get.ts
9770
9962
  var import_zod4 = require("zod");
9963
+ var MAX_PAYLOAD_CHARS2 = 32e3;
9964
+ var MCP_MAX_IDS = 100;
9771
9965
  var inputSchema4 = {
9772
- type: import_zod4.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9773
- fields: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).describe(
9966
+ ids: import_zod4.z.array(import_zod4.z.string()).min(1).max(MCP_MAX_IDS).describe(
9967
+ `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.`
9968
+ )
9969
+ };
9970
+ var recordBatchGet = ({ client, log }) => ({
9971
+ name: "record_batch_get",
9972
+ title: "Get multiple records by id in one call",
9973
+ 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.",
9974
+ inputSchema: inputSchema4,
9975
+ handler: async (args) => {
9976
+ const ids = args.ids;
9977
+ try {
9978
+ const response = await client.records.batchGetRecords({ ids });
9979
+ const records = response.data ?? [];
9980
+ const data = records.map((record) => {
9981
+ const item = { ...record };
9982
+ if (record.payload !== void 0) {
9983
+ const json = JSON.stringify(record.payload);
9984
+ if (json.length > MAX_PAYLOAD_CHARS2) {
9985
+ delete item.payload;
9986
+ item.payloadPreview = json.slice(0, MAX_PAYLOAD_CHARS2);
9987
+ item.payloadTruncated = true;
9988
+ item.payloadTotalChars = json.length;
9989
+ }
9990
+ }
9991
+ return item;
9992
+ });
9993
+ const returnedIds = new Set(records.map((r) => r.id));
9994
+ const missingIds = ids.filter((id) => !returnedIds.has(id));
9995
+ log.debug(
9996
+ { tool: "record_batch_get", requested: ids.length, returned: data.length, missing: missingIds.length },
9997
+ "record_batch_get ok"
9998
+ );
9999
+ return { content: [{ type: "text", text: JSON.stringify({ data, missingIds }, null, 2) }] };
10000
+ } catch (err) {
10001
+ log.warn({ tool: "record_batch_get", idsCount: ids?.length, err: String(err) }, "record_batch_get failed");
10002
+ return toolError("record_batch_get", err);
10003
+ }
10004
+ }
10005
+ });
10006
+ var record_batch_get_default = recordBatchGet;
10007
+
10008
+ // src/tools/record_create.ts
10009
+ var import_zod5 = require("zod");
10010
+ var inputSchema5 = {
10011
+ type: import_zod5.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
10012
+ fields: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).describe(
9774
10013
  "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."
9775
10014
  ),
9776
- externalId: import_zod4.z.string().optional().describe(
10015
+ externalId: import_zod5.z.string().optional().describe(
9777
10016
  "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."
9778
10017
  ),
9779
- indexMode: import_zod4.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
10018
+ indexMode: import_zod5.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
9780
10019
  "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."
9781
10020
  ),
9782
- status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9783
- folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9784
- userId: import_zod4.z.string().optional().describe("Owning user id."),
9785
- scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
9786
- '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.'
10021
+ status: import_zod5.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
10022
+ folderId: import_zod5.z.string().optional().describe("Group this record into a folder."),
10023
+ userId: import_zod5.z.string().optional().describe("Owning user id."),
10024
+ scopes: import_zod5.z.array(import_zod5.z.string()).optional().describe(
10025
+ '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.'
9787
10026
  )
9788
10027
  };
9789
10028
  var recordCreate = ({ client, log }) => ({
9790
10029
  name: "record_create",
9791
10030
  title: "Create a record",
9792
10031
  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).",
9793
- inputSchema: inputSchema4,
10032
+ inputSchema: inputSchema5,
9794
10033
  handler: async (args) => {
9795
10034
  const type = args.type;
9796
10035
  try {
@@ -9817,18 +10056,18 @@ var recordCreate = ({ client, log }) => ({
9817
10056
  var record_create_default = recordCreate;
9818
10057
 
9819
10058
  // src/tools/record_update.ts
9820
- var import_zod5 = require("zod");
9821
- var inputSchema5 = {
9822
- id: import_zod5.z.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
9823
- externalId: import_zod5.z.string().optional().describe(
10059
+ var import_zod6 = require("zod");
10060
+ var inputSchema6 = {
10061
+ id: import_zod6.z.string().optional().describe("The Vectros record id to update. Provide this OR externalId+type."),
10062
+ externalId: import_zod6.z.string().optional().describe(
9824
10063
  "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."
9825
10064
  ),
9826
- type: import_zod5.z.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
9827
- fields: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown()).describe(
10065
+ type: import_zod6.z.string().optional().describe("Record type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10066
+ fields: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).describe(
9828
10067
  "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."
9829
10068
  ),
9830
- status: import_zod5.z.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
9831
- expectedVersion: import_zod5.z.number().int().optional().describe(
10069
+ status: import_zod6.z.string().optional().describe("Set the record lifecycle status (e.g. ARCHIVED) \u2014 archive/workflow without physical deletion."),
10070
+ expectedVersion: import_zod6.z.number().int().optional().describe(
9832
10071
  "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."
9833
10072
  )
9834
10073
  };
@@ -9836,7 +10075,7 @@ var recordUpdate = ({ client, log }) => ({
9836
10075
  name: "record_update",
9837
10076
  title: "Update a record by id or externalId",
9838
10077
  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.",
9839
- inputSchema: inputSchema5,
10078
+ inputSchema: inputSchema6,
9840
10079
  handler: async (args) => {
9841
10080
  const id = args.id;
9842
10081
  const externalId = args.externalId;
@@ -9862,15 +10101,15 @@ var recordUpdate = ({ client, log }) => ({
9862
10101
  var record_update_default = recordUpdate;
9863
10102
 
9864
10103
  // src/tools/record_delete.ts
9865
- var import_zod6 = require("zod");
9866
- var inputSchema6 = {
9867
- id: import_zod6.z.string().min(1, "id is required").describe("The Vectros record id to delete.")
10104
+ var import_zod7 = require("zod");
10105
+ var inputSchema7 = {
10106
+ id: import_zod7.z.string().min(1, "id is required").describe("The Vectros record id to delete.")
9868
10107
  };
9869
10108
  var recordDelete = ({ client, log }) => ({
9870
10109
  name: "record_delete",
9871
10110
  title: "Delete a record",
9872
10111
  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.",
9873
- inputSchema: inputSchema6,
10112
+ inputSchema: inputSchema7,
9874
10113
  handler: async (args) => {
9875
10114
  const id = args.id;
9876
10115
  try {
@@ -9886,48 +10125,48 @@ var recordDelete = ({ client, log }) => ({
9886
10125
  var record_delete_default = recordDelete;
9887
10126
 
9888
10127
  // src/tools/rag_ask.ts
9889
- var import_zod7 = require("zod");
10128
+ var import_zod8 = require("zod");
9890
10129
  var SEARCH_MCP_DEFAULT_LIMIT = 5;
9891
10130
  var SEARCH_MCP_MAX_LIMIT = 50;
9892
- var inputSchema7 = {
9893
- query: import_zod7.z.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
9894
- instructions: import_zod7.z.string().optional().describe(
10131
+ var inputSchema8 = {
10132
+ query: import_zod8.z.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
10133
+ instructions: import_zod8.z.string().optional().describe(
9895
10134
  '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.'
9896
10135
  ),
9897
- model: import_zod7.z.string().optional().describe(
10136
+ model: import_zod8.z.string().optional().describe(
9898
10137
  "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."
9899
10138
  ),
9900
- search: import_zod7.z.object({
9901
- mode: import_zod7.z.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
9902
- limit: import_zod7.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
10139
+ search: import_zod8.z.object({
10140
+ mode: import_zod8.z.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
10141
+ limit: import_zod8.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
9903
10142
  `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.`
9904
10143
  ),
9905
10144
  // Retrieval scoping — parity with hybrid_search so an agent can ground the
9906
10145
  // answer on a specific owner / folder / type / metadata subset, not just the
9907
10146
  // whole-tenant corpus.
9908
- userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9909
- scope: import_zod7.z.string().optional().describe(
9910
- '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.'
10147
+ userId: import_zod8.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
10148
+ scope: import_zod8.z.string().optional().describe(
10149
+ '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.'
9911
10150
  ),
9912
- folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9913
- rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
9914
- typeName: import_zod7.z.string().optional().describe("Restrict record retrieval to this schema type."),
9915
- contentTypes: import_zod7.z.array(import_zod7.z.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
9916
- filters: import_zod7.z.record(import_zod7.z.unknown()).optional().describe(
10151
+ folderId: import_zod8.z.string().optional().describe("Restrict retrieval to this exact folder."),
10152
+ rootFolderId: import_zod8.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
10153
+ typeName: import_zod8.z.string().optional().describe("Restrict record retrieval to this schema type."),
10154
+ contentTypes: import_zod8.z.array(import_zod8.z.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
10155
+ filters: import_zod8.z.record(import_zod8.z.unknown()).optional().describe(
9917
10156
  '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"}.'
9918
10157
  ),
9919
- createdAfter: import_zod7.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
9920
- createdBefore: import_zod7.z.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
9921
- requireComplete: import_zod7.z.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
10158
+ createdAfter: import_zod8.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
10159
+ createdBefore: import_zod8.z.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
10160
+ requireComplete: import_zod8.z.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
9922
10161
  }).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
9923
- maxTokens: import_zod7.z.number().int().min(1).optional().describe("Max output tokens."),
9924
- temperature: import_zod7.z.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
10162
+ maxTokens: import_zod8.z.number().int().min(1).optional().describe("Max output tokens."),
10163
+ temperature: import_zod8.z.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
9925
10164
  };
9926
10165
  var ragAsk = ({ client, log }) => ({
9927
10166
  name: "rag_ask",
9928
10167
  title: "RAG ask (corpus-wide)",
9929
10168
  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.",
9930
- inputSchema: inputSchema7,
10169
+ inputSchema: inputSchema8,
9931
10170
  handler: async (args, extra) => {
9932
10171
  try {
9933
10172
  const searchArg = args.search ?? {};
@@ -10003,20 +10242,20 @@ var ragAsk = ({ client, log }) => ({
10003
10242
  var rag_ask_default = ragAsk;
10004
10243
 
10005
10244
  // src/tools/document_ask.ts
10006
- var import_zod8 = require("zod");
10007
- var inputSchema8 = {
10008
- documentId: import_zod8.z.string().min(1, "documentId is required").describe("ID of the document to ask against."),
10009
- prompt: import_zod8.z.string().min(1, "prompt is required").describe("Question to ask about the document."),
10010
- model: import_zod8.z.string().optional().describe(
10245
+ var import_zod9 = require("zod");
10246
+ var inputSchema9 = {
10247
+ documentId: import_zod9.z.string().min(1, "documentId is required").describe("ID of the document to ask against."),
10248
+ prompt: import_zod9.z.string().min(1, "prompt is required").describe("Question to ask about the document."),
10249
+ model: import_zod9.z.string().optional().describe(
10011
10250
  "Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
10012
10251
  ),
10013
- maxTokens: import_zod8.z.number().int().min(1).optional().describe("Max output tokens.")
10252
+ maxTokens: import_zod9.z.number().int().min(1).optional().describe("Max output tokens.")
10014
10253
  };
10015
10254
  var documentAsk = ({ client, log }) => ({
10016
10255
  name: "document_ask",
10017
10256
  title: "Document ask (single-document)",
10018
10257
  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.",
10019
- inputSchema: inputSchema8,
10258
+ inputSchema: inputSchema9,
10020
10259
  handler: async (args, extra) => {
10021
10260
  try {
10022
10261
  const stream = await client.inference.documentAsk({
@@ -10075,18 +10314,18 @@ var documentAsk = ({ client, log }) => ({
10075
10314
  var document_ask_default = documentAsk;
10076
10315
 
10077
10316
  // src/tools/list_schemas.ts
10078
- var import_zod9 = require("zod");
10079
- var inputSchema9 = {
10080
- userId: import_zod9.z.string().optional().describe(
10317
+ var import_zod10 = require("zod");
10318
+ var inputSchema10 = {
10319
+ userId: import_zod10.z.string().optional().describe(
10081
10320
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10082
10321
  ),
10083
- scope: import_zod9.z.string().optional().describe(
10084
- '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.'
10322
+ scope: import_zod10.z.string().optional().describe(
10323
+ '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.'
10085
10324
  ),
10086
- surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
10325
+ surface: import_zod10.z.enum(["record", "document", "user", "entity"]).optional().describe(
10087
10326
  "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."
10088
10327
  ),
10089
- recordType: import_zod9.z.string().optional().describe(
10328
+ recordType: import_zod10.z.string().optional().describe(
10090
10329
  '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.'
10091
10330
  )
10092
10331
  };
@@ -10094,7 +10333,7 @@ var listSchemas = ({ client, log }) => ({
10094
10333
  name: "list_schemas",
10095
10334
  title: "List record schemas",
10096
10335
  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.',
10097
- inputSchema: inputSchema9,
10336
+ inputSchema: inputSchema10,
10098
10337
  handler: async (args) => {
10099
10338
  const userId = args.userId;
10100
10339
  const scope = args.scope;
@@ -10120,18 +10359,18 @@ var listSchemas = ({ client, log }) => ({
10120
10359
  var list_schemas_default = listSchemas;
10121
10360
 
10122
10361
  // src/tools/document_get.ts
10123
- var import_zod10 = require("zod");
10362
+ var import_zod11 = require("zod");
10124
10363
  var MAX_TEXT_CHARS = 32e3;
10125
- var inputSchema10 = {
10126
- documentId: import_zod10.z.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
10127
- externalId: import_zod10.z.string().optional().describe(
10364
+ var inputSchema11 = {
10365
+ documentId: import_zod11.z.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
10366
+ externalId: import_zod11.z.string().optional().describe(
10128
10367
  "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."
10129
10368
  ),
10130
- type: import_zod10.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10131
- includeText: import_zod10.z.boolean().optional().describe(
10369
+ type: import_zod11.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10370
+ includeText: import_zod11.z.boolean().optional().describe(
10132
10371
  "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."
10133
10372
  ),
10134
- includeDownloadUrl: import_zod10.z.boolean().optional().describe(
10373
+ includeDownloadUrl: import_zod11.z.boolean().optional().describe(
10135
10374
  "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."
10136
10375
  )
10137
10376
  };
@@ -10148,7 +10387,7 @@ var documentGet = ({ client, log }) => ({
10148
10387
  name: "document_get",
10149
10388
  title: "Get document metadata (and optionally text)",
10150
10389
  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.",
10151
- inputSchema: inputSchema10,
10390
+ inputSchema: inputSchema11,
10152
10391
  handler: async (args) => {
10153
10392
  const documentId = args.documentId;
10154
10393
  const externalId = args.externalId;
@@ -10213,28 +10452,28 @@ var documentGet = ({ client, log }) => ({
10213
10452
  var document_get_default = documentGet;
10214
10453
 
10215
10454
  // src/tools/document_query.ts
10216
- var import_zod11 = require("zod");
10455
+ var import_zod12 = require("zod");
10217
10456
  var MCP_DEFAULT_LIMIT3 = 3;
10218
10457
  var MCP_MAX_LIMIT3 = 100;
10219
- var inputSchema11 = {
10458
+ var inputSchema12 = {
10220
10459
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10221
- field: import_zod11.z.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
10222
- value: import_zod11.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
10223
- from: import_zod11.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
10224
- to: import_zod11.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10225
- prefix: import_zod11.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10226
- order: import_zod11.z.enum(["asc", "desc"]).optional().describe(
10460
+ field: import_zod12.z.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
10461
+ value: import_zod12.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
10462
+ from: import_zod12.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
10463
+ to: import_zod12.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10464
+ prefix: import_zod12.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10465
+ order: import_zod12.z.enum(["asc", "desc"]).optional().describe(
10227
10466
  "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."
10228
10467
  ),
10229
- type: import_zod11.z.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
10468
+ type: import_zod12.z.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
10230
10469
  // List-mode args:
10231
- folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10232
- userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
10233
- scope: import_zod11.z.string().optional().describe(
10234
- '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.'
10470
+ folderId: import_zod12.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10471
+ userId: import_zod12.z.string().optional().describe("List mode: scope to documents owned by this user."),
10472
+ scope: import_zod12.z.string().optional().describe(
10473
+ '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.'
10235
10474
  ),
10236
- startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10237
- limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
10475
+ startFrom: import_zod12.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10476
+ limit: import_zod12.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
10238
10477
  `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.`
10239
10478
  )
10240
10479
  };
@@ -10242,7 +10481,7 @@ var documentQuery = ({ client, log }) => ({
10242
10481
  name: "document_query",
10243
10482
  title: "Document query (list or lookup)",
10244
10483
  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.",
10245
- inputSchema: inputSchema11,
10484
+ inputSchema: inputSchema12,
10246
10485
  handler: async (args) => {
10247
10486
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
10248
10487
  const field = args.field;
@@ -10322,29 +10561,29 @@ var documentQuery = ({ client, log }) => ({
10322
10561
  var document_query_default = documentQuery;
10323
10562
 
10324
10563
  // src/tools/document_update.ts
10325
- var import_zod12 = require("zod");
10326
- var inputSchema12 = {
10327
- documentId: import_zod12.z.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
10328
- externalId: import_zod12.z.string().optional().describe(
10564
+ var import_zod13 = require("zod");
10565
+ var inputSchema13 = {
10566
+ documentId: import_zod13.z.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
10567
+ externalId: import_zod13.z.string().optional().describe(
10329
10568
  "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."
10330
10569
  ),
10331
- type: import_zod12.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10332
- title: import_zod12.z.string().optional().describe("New title. Omit to keep the current title."),
10333
- fields: import_zod12.z.record(import_zod12.z.string(), import_zod12.z.unknown()).optional().describe(
10570
+ type: import_zod13.z.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
10571
+ title: import_zod13.z.string().optional().describe("New title. Omit to keep the current title."),
10572
+ fields: import_zod13.z.record(import_zod13.z.string(), import_zod13.z.unknown()).optional().describe(
10334
10573
  "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."
10335
10574
  ),
10336
- text: import_zod12.z.string().optional().describe(
10575
+ text: import_zod13.z.string().optional().describe(
10337
10576
  "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."
10338
10577
  ),
10339
- folderId: import_zod12.z.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
10340
- status: import_zod12.z.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
10578
+ folderId: import_zod13.z.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
10579
+ status: import_zod13.z.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
10341
10580
  "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."
10342
10581
  ),
10343
- userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10344
- scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
10345
- '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).'
10582
+ userId: import_zod13.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10583
+ scopes: import_zod13.z.array(import_zod13.z.string()).optional().describe(
10584
+ '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).'
10346
10585
  ),
10347
- expectedVersion: import_zod12.z.number().int().optional().describe(
10586
+ expectedVersion: import_zod13.z.number().int().optional().describe(
10348
10587
  "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."
10349
10588
  )
10350
10589
  };
@@ -10352,7 +10591,7 @@ var documentUpdate = ({ client, log }) => ({
10352
10591
  name: "document_update",
10353
10592
  title: "Update a document",
10354
10593
  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.',
10355
- inputSchema: inputSchema12,
10594
+ inputSchema: inputSchema13,
10356
10595
  handler: async (args) => {
10357
10596
  const documentId = args.documentId;
10358
10597
  const externalId = args.externalId;
@@ -10392,15 +10631,15 @@ var documentUpdate = ({ client, log }) => ({
10392
10631
  var document_update_default = documentUpdate;
10393
10632
 
10394
10633
  // src/tools/document_delete.ts
10395
- var import_zod13 = require("zod");
10396
- var inputSchema13 = {
10397
- documentId: import_zod13.z.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
10634
+ var import_zod14 = require("zod");
10635
+ var inputSchema14 = {
10636
+ documentId: import_zod14.z.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
10398
10637
  };
10399
10638
  var documentDelete = ({ client, log }) => ({
10400
10639
  name: "document_delete",
10401
10640
  title: "Delete a document",
10402
10641
  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).',
10403
- inputSchema: inputSchema13,
10642
+ inputSchema: inputSchema14,
10404
10643
  handler: async (args) => {
10405
10644
  const documentId = args.documentId;
10406
10645
  try {
@@ -10418,18 +10657,18 @@ var documentDelete = ({ client, log }) => ({
10418
10657
  var document_delete_default = documentDelete;
10419
10658
 
10420
10659
  // src/tools/folder_query.ts
10421
- var import_zod14 = require("zod");
10660
+ var import_zod15 = require("zod");
10422
10661
  var MCP_DEFAULT_LIMIT4 = 10;
10423
10662
  var MCP_MAX_LIMIT4 = 100;
10424
- var inputSchema14 = {
10425
- id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
10426
- parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10427
- userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10428
- scope: import_zod14.z.string().optional().describe(
10429
- '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.'
10663
+ var inputSchema15 = {
10664
+ id: import_zod15.z.string().optional().describe("Get mode: fetch this single folder by id."),
10665
+ parentId: import_zod15.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10666
+ userId: import_zod15.z.string().optional().describe("List mode: scope to folders owned by this user."),
10667
+ scope: import_zod15.z.string().optional().describe(
10668
+ '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.'
10430
10669
  ),
10431
- startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10432
- limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10670
+ startFrom: import_zod15.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10671
+ limit: import_zod15.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10433
10672
  `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\`.`
10434
10673
  )
10435
10674
  };
@@ -10437,7 +10676,7 @@ var folderQuery = ({ client, log }) => ({
10437
10676
  name: "folder_query",
10438
10677
  title: "Folder query (list or get)",
10439
10678
  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.",
10440
- inputSchema: inputSchema14,
10679
+ inputSchema: inputSchema15,
10441
10680
  handler: async (args) => {
10442
10681
  const id = args.id;
10443
10682
  try {
@@ -10467,22 +10706,22 @@ var folderQuery = ({ client, log }) => ({
10467
10706
  var folder_query_default = folderQuery;
10468
10707
 
10469
10708
  // src/tools/folder_create.ts
10470
- var import_zod15 = require("zod");
10471
- var inputSchema15 = {
10472
- name: import_zod15.z.string().min(1, "name is required").describe("Folder display name."),
10473
- description: import_zod15.z.string().optional().describe("Optional description of the folder's purpose."),
10474
- parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10475
- slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10476
- userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10477
- scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
10478
- '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.'
10709
+ var import_zod16 = require("zod");
10710
+ var inputSchema16 = {
10711
+ name: import_zod16.z.string().min(1, "name is required").describe("Folder display name."),
10712
+ description: import_zod16.z.string().optional().describe("Optional description of the folder's purpose."),
10713
+ parentId: import_zod16.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10714
+ slug: import_zod16.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10715
+ userId: import_zod16.z.string().optional().describe("Owning user (Vectros UUID)."),
10716
+ scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
10717
+ '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.'
10479
10718
  )
10480
10719
  };
10481
10720
  var folderCreate = ({ client, log }) => ({
10482
10721
  name: "folder_create",
10483
10722
  title: "Create a folder",
10484
10723
  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).",
10485
- inputSchema: inputSchema15,
10724
+ inputSchema: inputSchema16,
10486
10725
  handler: async (args) => {
10487
10726
  try {
10488
10727
  const folder = await client.folders.createFolder({
@@ -10506,16 +10745,16 @@ var folderCreate = ({ client, log }) => ({
10506
10745
  var folder_create_default = folderCreate;
10507
10746
 
10508
10747
  // src/tools/folder_update.ts
10509
- var import_zod16 = require("zod");
10510
- var inputSchema16 = {
10511
- id: import_zod16.z.string().min(1, "id is required").describe("The Vectros folder id to update."),
10512
- name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
10513
- description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10514
- userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10515
- scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
10516
- '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).'
10748
+ var import_zod17 = require("zod");
10749
+ var inputSchema17 = {
10750
+ id: import_zod17.z.string().min(1, "id is required").describe("The Vectros folder id to update."),
10751
+ name: import_zod17.z.string().optional().describe("New folder name. Omit to keep the current name."),
10752
+ description: import_zod17.z.string().optional().describe("New description. Omit to leave unchanged."),
10753
+ userId: import_zod17.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10754
+ scopes: import_zod17.z.array(import_zod17.z.string()).optional().describe(
10755
+ '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).'
10517
10756
  ),
10518
- expectedVersion: import_zod16.z.number().int().optional().describe(
10757
+ expectedVersion: import_zod17.z.number().int().optional().describe(
10519
10758
  "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."
10520
10759
  )
10521
10760
  };
@@ -10523,7 +10762,7 @@ var folderUpdate = ({ client, log }) => ({
10523
10762
  name: "folder_update",
10524
10763
  title: "Update a folder",
10525
10764
  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.",
10526
- inputSchema: inputSchema16,
10765
+ inputSchema: inputSchema17,
10527
10766
  handler: async (args) => {
10528
10767
  const id = args.id;
10529
10768
  const name = args.name;
@@ -10550,15 +10789,15 @@ var folderUpdate = ({ client, log }) => ({
10550
10789
  var folder_update_default = folderUpdate;
10551
10790
 
10552
10791
  // src/tools/folder_delete.ts
10553
- var import_zod17 = require("zod");
10554
- var inputSchema17 = {
10555
- id: import_zod17.z.string().min(1, "id is required").describe("The Vectros folder id to delete.")
10792
+ var import_zod18 = require("zod");
10793
+ var inputSchema18 = {
10794
+ id: import_zod18.z.string().min(1, "id is required").describe("The Vectros folder id to delete.")
10556
10795
  };
10557
10796
  var folderDelete = ({ client, log }) => ({
10558
10797
  name: "folder_delete",
10559
10798
  title: "Delete a folder",
10560
10799
  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.",
10561
- inputSchema: inputSchema17,
10800
+ inputSchema: inputSchema18,
10562
10801
  handler: async (args) => {
10563
10802
  const id = args.id;
10564
10803
  try {
@@ -10574,14 +10813,14 @@ var folderDelete = ({ client, log }) => ({
10574
10813
  var folder_delete_default = folderDelete;
10575
10814
 
10576
10815
  // src/tools/current_identity.ts
10577
- var inputSchema18 = {
10816
+ var inputSchema19 = {
10578
10817
  // No args — current_identity describes the current credential.
10579
10818
  };
10580
10819
  var currentIdentity = ({ log, apiKey, environment }) => ({
10581
10820
  name: "current_identity",
10582
10821
  title: "Current identity (tenant + principal scope)",
10583
- 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.",
10584
- inputSchema: inputSchema18,
10822
+ 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.",
10823
+ inputSchema: inputSchema19,
10585
10824
  handler: async () => {
10586
10825
  try {
10587
10826
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -10597,7 +10836,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
10597
10836
  var current_identity_default = currentIdentity;
10598
10837
 
10599
10838
  // src/tools/document_ingest.ts
10600
- var import_zod18 = require("zod");
10839
+ var import_zod19 = require("zod");
10601
10840
  var import_promises = require("fs/promises");
10602
10841
  var import_node_path = require("path");
10603
10842
  var IngestPathError = class extends Error {
@@ -10672,45 +10911,45 @@ function inferMimeType(filePath) {
10672
10911
  const ext = (0, import_node_path.extname)(filePath).toLowerCase();
10673
10912
  return EXT_TO_MIME[ext] ?? "application/octet-stream";
10674
10913
  }
10675
- var inputSchema19 = {
10676
- title: import_zod18.z.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
10677
- indexMode: import_zod18.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
10914
+ var inputSchema20 = {
10915
+ title: import_zod19.z.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
10916
+ indexMode: import_zod19.z.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
10678
10917
  "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."
10679
10918
  ),
10680
- externalId: import_zod18.z.string().optional().describe(
10919
+ externalId: import_zod19.z.string().optional().describe(
10681
10920
  '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.'
10682
10921
  ),
10683
- upsert: import_zod18.z.boolean().optional().describe(
10922
+ upsert: import_zod19.z.boolean().optional().describe(
10684
10923
  "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)."
10685
10924
  ),
10686
- schemaId: import_zod18.z.string().optional().describe(
10925
+ schemaId: import_zod19.z.string().optional().describe(
10687
10926
  "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."
10688
10927
  ),
10689
- payload: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.unknown()).optional().describe(
10928
+ payload: import_zod19.z.record(import_zod19.z.string(), import_zod19.z.unknown()).optional().describe(
10690
10929
  "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."
10691
10930
  ),
10692
10931
  // Inline text mode (mutually exclusive with filePath):
10693
- text: import_zod18.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10694
- storeText: import_zod18.z.boolean().optional().describe(
10932
+ text: import_zod19.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10933
+ storeText: import_zod19.z.boolean().optional().describe(
10695
10934
  "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."
10696
10935
  ),
10697
10936
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10698
- filePath: import_zod18.z.string().min(1).optional().describe(
10937
+ filePath: import_zod19.z.string().min(1).optional().describe(
10699
10938
  "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."
10700
10939
  ),
10701
- fileType: import_zod18.z.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
10940
+ fileType: import_zod19.z.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
10702
10941
  // Common (both modes):
10703
- folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10704
- userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10705
- scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
10706
- "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."
10942
+ folderId: import_zod19.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10943
+ userId: import_zod19.z.string().optional().describe("Owning user ID. Optional."),
10944
+ scopes: import_zod19.z.array(import_zod19.z.string()).optional().describe(
10945
+ "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."
10707
10946
  )
10708
10947
  };
10709
10948
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10710
10949
  name: "document_ingest",
10711
10950
  title: "Ingest a new document (text body or file upload)",
10712
10951
  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`.",
10713
- inputSchema: inputSchema19,
10952
+ inputSchema: inputSchema20,
10714
10953
  handler: async (args) => {
10715
10954
  const title = args.title;
10716
10955
  const text = args.text;
@@ -10862,39 +11101,43 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10862
11101
  var document_ingest_default = documentIngest;
10863
11102
 
10864
11103
  // src/tools/lookup_principal.ts
10865
- var import_zod19 = require("zod");
11104
+ var import_zod20 = require("zod");
10866
11105
  var MCP_DEFAULT_LIMIT5 = 10;
10867
11106
  var MCP_MAX_LIMIT5 = 100;
10868
- var inputSchema20 = {
10869
- kind: import_zod19.z.string().describe(
10870
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
11107
+ var inputSchema21 = {
11108
+ kind: import_zod20.z.string().describe(
11109
+ '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.'
10871
11110
  ),
10872
- externalId: import_zod19.z.string().optional().describe(
11111
+ externalId: import_zod20.z.string().optional().describe(
10873
11112
  "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."
10874
11113
  ),
11114
+ contextId: import_zod20.z.string().optional().describe(
11115
+ "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."
11116
+ ),
10875
11117
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10876
- type: import_zod19.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10877
- field: import_zod19.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
10878
- value: import_zod19.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
10879
- from: import_zod19.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
10880
- to: import_zod19.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10881
- prefix: import_zod19.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10882
- order: import_zod19.z.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
10883
- startFrom: import_zod19.z.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10884
- limit: import_zod19.z.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
11118
+ type: import_zod20.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
11119
+ field: import_zod20.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
11120
+ value: import_zod20.z.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
11121
+ from: import_zod20.z.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
11122
+ to: import_zod20.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
11123
+ prefix: import_zod20.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
11124
+ order: import_zod20.z.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
11125
+ startFrom: import_zod20.z.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
11126
+ limit: import_zod20.z.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
10885
11127
  `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\`.`
10886
11128
  )
10887
11129
  };
10888
11130
  var lookupPrincipal = ({ client, log }) => ({
10889
11131
  name: "lookup_principal",
10890
11132
  title: "Look up a user identity or a namespaced identity entity",
10891
- 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.",
10892
- inputSchema: inputSchema20,
11133
+ 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.",
11134
+ inputSchema: inputSchema21,
10893
11135
  handler: async (args) => {
10894
11136
  const kind = args.kind;
10895
11137
  const isUser = kind === "user";
10896
11138
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10897
11139
  const externalId = args.externalId;
11140
+ const contextId = args.contextId;
10898
11141
  const type = args.type;
10899
11142
  const field = args.field;
10900
11143
  const value = args.value;
@@ -10903,11 +11146,18 @@ var lookupPrincipal = ({ client, log }) => ({
10903
11146
  const prefix = args.prefix;
10904
11147
  const order = args.order;
10905
11148
  const startFrom = args.startFrom;
11149
+ if (contextId !== void 0 && isUser) {
11150
+ return toolError(
11151
+ "lookup_principal",
11152
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
11153
+ );
11154
+ }
11155
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10906
11156
  try {
10907
11157
  let page;
10908
11158
  if (externalId !== void 0) {
10909
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10910
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
11159
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
11160
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10911
11161
  } else if (field !== void 0) {
10912
11162
  const hasEquality = value !== void 0;
10913
11163
  const hasRange = from !== void 0 || to !== void 0;
@@ -10935,8 +11185,8 @@ var lookupPrincipal = ({ client, log }) => ({
10935
11185
  );
10936
11186
  }
10937
11187
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10938
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10939
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
11188
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
11189
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10940
11190
  } else {
10941
11191
  return toolError(
10942
11192
  "lookup_principal",
@@ -10947,7 +11197,7 @@ var lookupPrincipal = ({ client, log }) => ({
10947
11197
  const nextCursor = page.nextCursor ?? null;
10948
11198
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10949
11199
  } catch (err) {
10950
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
11200
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10951
11201
  return toolError("lookup_principal", err);
10952
11202
  }
10953
11203
  }
@@ -10955,17 +11205,17 @@ var lookupPrincipal = ({ client, log }) => ({
10955
11205
  var lookup_principal_default = lookupPrincipal;
10956
11206
 
10957
11207
  // src/tools/version_history.ts
10958
- var import_zod20 = require("zod");
10959
- var inputSchema21 = {
10960
- resourceType: import_zod20.z.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
10961
- id: import_zod20.z.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
10962
- startFrom: import_zod20.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
11208
+ var import_zod21 = require("zod");
11209
+ var inputSchema22 = {
11210
+ resourceType: import_zod21.z.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
11211
+ id: import_zod21.z.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
11212
+ startFrom: import_zod21.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
10963
11213
  };
10964
11214
  var versionHistory = ({ client, log }) => ({
10965
11215
  name: "version_history",
10966
11216
  title: "Version history (record or document)",
10967
11217
  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.",
10968
- inputSchema: inputSchema21,
11218
+ inputSchema: inputSchema22,
10969
11219
  handler: async (args) => {
10970
11220
  const resourceType = args.resourceType;
10971
11221
  const id = args.id;
@@ -10992,6 +11242,7 @@ var TOOL_NAMES = [
10992
11242
  "hybrid_search",
10993
11243
  "record_query",
10994
11244
  "record_get",
11245
+ "record_batch_get",
10995
11246
  "record_create",
10996
11247
  "record_update",
10997
11248
  "record_delete",
@@ -11017,6 +11268,7 @@ var ALL_TOOL_FACTORIES = {
11017
11268
  hybrid_search: hybrid_search_default,
11018
11269
  record_query: record_query_default,
11019
11270
  record_get: record_get_default,
11271
+ record_batch_get: record_batch_get_default,
11020
11272
  record_create: record_create_default,
11021
11273
  record_update: record_update_default,
11022
11274
  record_delete: record_delete_default,
@@ -11058,7 +11310,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11058
11310
  name: "identity",
11059
11311
  uri: "vectros://identity",
11060
11312
  title: "Current identity (tenant + principal scope)",
11061
- 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.",
11313
+ 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.",
11062
11314
  mimeType: "application/json",
11063
11315
  read: async () => {
11064
11316
  const identity = await resolveIdentity({ log, apiKey, environment });
@@ -11077,7 +11329,7 @@ var ALL_RESOURCE_FACTORIES = {
11077
11329
  };
11078
11330
 
11079
11331
  // src/zod-to-json-schema.ts
11080
- var import_zod21 = require("zod");
11332
+ var import_zod22 = require("zod");
11081
11333
  function zodShapeToJsonSchema(shape) {
11082
11334
  const properties = {};
11083
11335
  const required = [];
@@ -11092,40 +11344,40 @@ function zodShapeToJsonSchema(shape) {
11092
11344
  function zodTypeToJsonSchema(schema) {
11093
11345
  const description = schema.description;
11094
11346
  let current = schema;
11095
- while (current instanceof import_zod21.z.ZodOptional || current instanceof import_zod21.z.ZodDefault || current instanceof import_zod21.z.ZodNullable) {
11347
+ while (current instanceof import_zod22.z.ZodOptional || current instanceof import_zod22.z.ZodDefault || current instanceof import_zod22.z.ZodNullable) {
11096
11348
  current = current._def.innerType;
11097
11349
  }
11098
11350
  const base = description ? { description } : {};
11099
- if (current instanceof import_zod21.z.ZodString) {
11351
+ if (current instanceof import_zod22.z.ZodString) {
11100
11352
  return { ...base, type: "string" };
11101
11353
  }
11102
- if (current instanceof import_zod21.z.ZodNumber) {
11354
+ if (current instanceof import_zod22.z.ZodNumber) {
11103
11355
  return { ...base, type: "number" };
11104
11356
  }
11105
- if (current instanceof import_zod21.z.ZodBoolean) {
11357
+ if (current instanceof import_zod22.z.ZodBoolean) {
11106
11358
  return { ...base, type: "boolean" };
11107
11359
  }
11108
- if (current instanceof import_zod21.z.ZodEnum) {
11360
+ if (current instanceof import_zod22.z.ZodEnum) {
11109
11361
  return {
11110
11362
  ...base,
11111
11363
  type: "string",
11112
11364
  enum: current.options
11113
11365
  };
11114
11366
  }
11115
- if (current instanceof import_zod21.z.ZodArray) {
11367
+ if (current instanceof import_zod22.z.ZodArray) {
11116
11368
  return {
11117
11369
  ...base,
11118
11370
  type: "array",
11119
11371
  items: zodTypeToJsonSchema(current.element)
11120
11372
  };
11121
11373
  }
11122
- if (current instanceof import_zod21.z.ZodObject) {
11374
+ if (current instanceof import_zod22.z.ZodObject) {
11123
11375
  return {
11124
11376
  ...base,
11125
11377
  ...zodShapeToJsonSchema(current.shape)
11126
11378
  };
11127
11379
  }
11128
- if (current instanceof import_zod21.z.ZodRecord) {
11380
+ if (current instanceof import_zod22.z.ZodRecord) {
11129
11381
  const valueType = current._def.valueType;
11130
11382
  return {
11131
11383
  ...base,
@@ -11249,7 +11501,7 @@ var VectrosMCPServer = class {
11249
11501
  if (!tool) {
11250
11502
  result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
11251
11503
  } else {
11252
- const parsed = import_zod22.z.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
11504
+ const parsed = import_zod23.z.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
11253
11505
  if (!parsed.success) {
11254
11506
  result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
11255
11507
  } else {