@vectros-ai/mcp-server 0.14.0 → 0.15.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/index.mjs CHANGED
@@ -2822,7 +2822,7 @@ var AuthClient = class {
2822
2822
  );
2823
2823
  }
2824
2824
  /**
2825
- * 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.
2825
+ * 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.
2826
2826
  *
2827
2827
  * @param {Vectros.CreateAccessProfileRequest} request
2828
2828
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3923,7 +3923,7 @@ var AuthClient = class {
3923
3923
  );
3924
3924
  }
3925
3925
  /**
3926
- * 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.
3926
+ * 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.
3927
3927
  *
3928
3928
  * @param {Vectros.GetUsageRequest} request
3929
3929
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3986,7 +3986,7 @@ var AuthClient = class {
3986
3986
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3987
3987
  }
3988
3988
  /**
3989
- * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
3989
+ * 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.
3990
3990
  *
3991
3991
  * @param {Vectros.GetIssuerRequest} request
3992
3992
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4044,13 +4044,14 @@ var AuthClient = class {
4044
4044
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4045
4045
  }
4046
4046
  /**
4047
- * 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.
4047
+ * 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.
4048
4048
  *
4049
4049
  * @param {Vectros.DeleteIssuerRequest} request
4050
4050
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4051
4051
  *
4052
4052
  * @throws {@link Vectros.ForbiddenError}
4053
4053
  * @throws {@link Vectros.NotFoundError}
4054
+ * @throws {@link Vectros.ConflictError}
4054
4055
  * @throws {@link Vectros.TooManyRequestsError}
4055
4056
  *
4056
4057
  * @example
@@ -4092,6 +4093,8 @@ var AuthClient = class {
4092
4093
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4093
4094
  case 404:
4094
4095
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4096
+ case 409:
4097
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4095
4098
  case 429:
4096
4099
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4097
4100
  default:
@@ -4110,7 +4113,7 @@ var AuthClient = class {
4110
4113
  );
4111
4114
  }
4112
4115
  /**
4113
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4116
+ * 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. Returns a `{data, nextCursor}` envelope.
4114
4117
  *
4115
4118
  * @param {Vectros.ListIssuersRequest} request
4116
4119
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4167,7 +4170,7 @@ var AuthClient = class {
4167
4170
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4168
4171
  }
4169
4172
  /**
4170
- * 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.
4173
+ * 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. 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`.
4171
4174
  *
4172
4175
  * @param {Vectros.IssuerRequest} request
4173
4176
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4278,7 +4281,7 @@ var AuthClient = class {
4278
4281
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4279
4282
  }
4280
4283
  /**
4281
- * 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.
4284
+ * 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.
4282
4285
  *
4283
4286
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4284
4287
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4557,7 +4560,7 @@ var AuthClient = class {
4557
4560
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4558
4561
  }
4559
4562
  /**
4560
- * 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.
4563
+ * 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.
4561
4564
  *
4562
4565
  * @param {Vectros.TokenExchangeRequest} request
4563
4566
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6099,6 +6102,7 @@ var IdentityClient = class {
6099
6102
  * @example
6100
6103
  * await client.identity.listEntities({
6101
6104
  * namespace: "team",
6105
+ * contextId: "myapp",
6102
6106
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6103
6107
  * })
6104
6108
  */
@@ -6108,6 +6112,7 @@ var IdentityClient = class {
6108
6112
  async __listEntities(request, requestOptions) {
6109
6113
  const {
6110
6114
  namespace,
6115
+ contextId,
6111
6116
  userId,
6112
6117
  externalId,
6113
6118
  scope,
@@ -6122,6 +6127,7 @@ var IdentityClient = class {
6122
6127
  limit
6123
6128
  } = request;
6124
6129
  const _queryParams = {
6130
+ contextId,
6125
6131
  userId,
6126
6132
  externalId,
6127
6133
  scope,
@@ -6180,6 +6186,7 @@ var IdentityClient = class {
6180
6186
  * @example
6181
6187
  * await client.identity.createEntity({
6182
6188
  * namespace: "team",
6189
+ * contextId: "myapp",
6183
6190
  * body: {
6184
6191
  * externalId: "team_eng_platform"
6185
6192
  * }
@@ -6189,9 +6196,10 @@ var IdentityClient = class {
6189
6196
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6190
6197
  }
6191
6198
  async __createEntity(request, requestOptions) {
6192
- const { namespace, upsert, body: _body } = request;
6199
+ const { namespace, upsert, contextId, body: _body } = request;
6193
6200
  const _queryParams = {
6194
- upsert
6201
+ upsert,
6202
+ contextId
6195
6203
  };
6196
6204
  const _authRequest = await this._options.authProvider.getAuthRequest();
6197
6205
  const _headers = mergeHeaders(
@@ -6248,14 +6256,18 @@ var IdentityClient = class {
6248
6256
  * @example
6249
6257
  * await client.identity.getEntity({
6250
6258
  * namespace: "team",
6251
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6259
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6260
+ * contextId: "myapp"
6252
6261
  * })
6253
6262
  */
6254
6263
  getEntity(request, requestOptions) {
6255
6264
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6256
6265
  }
6257
6266
  async __getEntity(request, requestOptions) {
6258
- const { namespace, id } = request;
6267
+ const { namespace, id, contextId } = request;
6268
+ const _queryParams = {
6269
+ contextId
6270
+ };
6259
6271
  const _authRequest = await this._options.authProvider.getAuthRequest();
6260
6272
  const _headers = mergeHeaders(
6261
6273
  _authRequest.headers,
@@ -6269,7 +6281,7 @@ var IdentityClient = class {
6269
6281
  ),
6270
6282
  method: "GET",
6271
6283
  headers: _headers,
6272
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6284
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6273
6285
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6274
6286
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6275
6287
  abortSignal: requestOptions?.abortSignal,
@@ -6306,6 +6318,7 @@ var IdentityClient = class {
6306
6318
  * await client.identity.updateEntity({
6307
6319
  * namespace: "team",
6308
6320
  * id: "id",
6321
+ * contextId: "myapp",
6309
6322
  * body: {
6310
6323
  * externalId: "team_eng_platform"
6311
6324
  * }
@@ -6315,7 +6328,10 @@ var IdentityClient = class {
6315
6328
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6316
6329
  }
6317
6330
  async __updateEntity(request, requestOptions) {
6318
- const { namespace, id, body: _body } = request;
6331
+ const { namespace, id, contextId, body: _body } = request;
6332
+ const _queryParams = {
6333
+ contextId
6334
+ };
6319
6335
  const _authRequest = await this._options.authProvider.getAuthRequest();
6320
6336
  const _headers = mergeHeaders(
6321
6337
  _authRequest.headers,
@@ -6330,7 +6346,7 @@ var IdentityClient = class {
6330
6346
  method: "PUT",
6331
6347
  headers: _headers,
6332
6348
  contentType: "application/json",
6333
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6349
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6334
6350
  requestType: "json",
6335
6351
  body: _body,
6336
6352
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6370,14 +6386,18 @@ var IdentityClient = class {
6370
6386
  * @example
6371
6387
  * await client.identity.deleteEntity({
6372
6388
  * namespace: "team",
6373
- * id: "id"
6389
+ * id: "id",
6390
+ * contextId: "myapp"
6374
6391
  * })
6375
6392
  */
6376
6393
  deleteEntity(request, requestOptions) {
6377
6394
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6378
6395
  }
6379
6396
  async __deleteEntity(request, requestOptions) {
6380
- const { namespace, id } = request;
6397
+ const { namespace, id, contextId } = request;
6398
+ const _queryParams = {
6399
+ contextId
6400
+ };
6381
6401
  const _authRequest = await this._options.authProvider.getAuthRequest();
6382
6402
  const _headers = mergeHeaders(
6383
6403
  _authRequest.headers,
@@ -6391,7 +6411,7 @@ var IdentityClient = class {
6391
6411
  ),
6392
6412
  method: "DELETE",
6393
6413
  headers: _headers,
6394
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6395
6415
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6396
6416
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6397
6417
  abortSignal: requestOptions?.abortSignal,
@@ -6434,6 +6454,7 @@ var IdentityClient = class {
6434
6454
  * @example
6435
6455
  * await client.identity.lookupEntities({
6436
6456
  * namespace: "team",
6457
+ * contextId: "myapp",
6437
6458
  * body: {
6438
6459
  * type: "person_v1",
6439
6460
  * field: "ssn"
@@ -6444,7 +6465,10 @@ var IdentityClient = class {
6444
6465
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6445
6466
  }
6446
6467
  async __lookupEntities(request, requestOptions) {
6447
- const { namespace, body: _body } = request;
6468
+ const { namespace, contextId, body: _body } = request;
6469
+ const _queryParams = {
6470
+ contextId
6471
+ };
6448
6472
  const _authRequest = await this._options.authProvider.getAuthRequest();
6449
6473
  const _headers = mergeHeaders(
6450
6474
  _authRequest.headers,
@@ -6459,7 +6483,7 @@ var IdentityClient = class {
6459
6483
  method: "POST",
6460
6484
  headers: _headers,
6461
6485
  contentType: "application/json",
6462
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6486
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6463
6487
  requestType: "json",
6464
6488
  body: _body,
6465
6489
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6503,15 +6527,17 @@ var IdentityClient = class {
6503
6527
  * @example
6504
6528
  * await client.identity.getEntityVersions({
6505
6529
  * namespace: "team",
6506
- * id: "id"
6530
+ * id: "id",
6531
+ * contextId: "myapp"
6507
6532
  * })
6508
6533
  */
6509
6534
  getEntityVersions(request, requestOptions) {
6510
6535
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6511
6536
  }
6512
6537
  async __getEntityVersions(request, requestOptions) {
6513
- const { namespace, id, startFrom } = request;
6538
+ const { namespace, id, contextId, startFrom } = request;
6514
6539
  const _queryParams = {
6540
+ contextId,
6515
6541
  startFrom
6516
6542
  };
6517
6543
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6573,7 +6599,10 @@ var IdentityClient = class {
6573
6599
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6574
6600
  }
6575
6601
  async __getNamespace(request, requestOptions) {
6576
- const { namespace } = request;
6602
+ const { namespace, contextId } = request;
6603
+ const _queryParams = {
6604
+ contextId
6605
+ };
6577
6606
  const _authRequest = await this._options.authProvider.getAuthRequest();
6578
6607
  const _headers = mergeHeaders(
6579
6608
  _authRequest.headers,
@@ -6587,7 +6616,7 @@ var IdentityClient = class {
6587
6616
  ),
6588
6617
  method: "GET",
6589
6618
  headers: _headers,
6590
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6619
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6591
6620
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6592
6621
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6593
6622
  abortSignal: requestOptions?.abortSignal,
@@ -6612,7 +6641,7 @@ var IdentityClient = class {
6612
6641
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6613
6642
  }
6614
6643
  /**
6615
- * 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.
6644
+ * 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.
6616
6645
  *
6617
6646
  * @param {Vectros.UpdateNamespaceRequest} request
6618
6647
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6634,7 +6663,10 @@ var IdentityClient = class {
6634
6663
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6635
6664
  }
6636
6665
  async __updateNamespace(request, requestOptions) {
6637
- const { namespace, body: _body } = request;
6666
+ const { namespace, contextId, body: _body } = request;
6667
+ const _queryParams = {
6668
+ contextId
6669
+ };
6638
6670
  const _authRequest = await this._options.authProvider.getAuthRequest();
6639
6671
  const _headers = mergeHeaders(
6640
6672
  _authRequest.headers,
@@ -6649,7 +6681,7 @@ var IdentityClient = class {
6649
6681
  method: "PUT",
6650
6682
  headers: _headers,
6651
6683
  contentType: "application/json",
6652
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6684
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6653
6685
  requestType: "json",
6654
6686
  body: _body,
6655
6687
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6680,7 +6712,7 @@ var IdentityClient = class {
6680
6712
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6681
6713
  }
6682
6714
  /**
6683
- * 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.
6715
+ * 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.
6684
6716
  *
6685
6717
  * @param {Vectros.DeleteNamespaceRequest} request
6686
6718
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6698,7 +6730,10 @@ var IdentityClient = class {
6698
6730
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6699
6731
  }
6700
6732
  async __deleteNamespace(request, requestOptions) {
6701
- const { namespace } = request;
6733
+ const { namespace, contextId } = request;
6734
+ const _queryParams = {
6735
+ contextId
6736
+ };
6702
6737
  const _authRequest = await this._options.authProvider.getAuthRequest();
6703
6738
  const _headers = mergeHeaders(
6704
6739
  _authRequest.headers,
@@ -6712,7 +6747,7 @@ var IdentityClient = class {
6712
6747
  ),
6713
6748
  method: "DELETE",
6714
6749
  headers: _headers,
6715
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6750
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6716
6751
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6717
6752
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6718
6753
  abortSignal: requestOptions?.abortSignal,
@@ -6741,7 +6776,7 @@ var IdentityClient = class {
6741
6776
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6742
6777
  }
6743
6778
  /**
6744
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6779
+ * Returns the scope namespaces in your account, including `org` and `client`, which are provisioned for you when the account is created. Returns a `{data, nextCursor}` envelope.
6745
6780
  *
6746
6781
  * @param {Vectros.ListNamespacesRequest} request
6747
6782
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6753,10 +6788,11 @@ var IdentityClient = class {
6753
6788
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6754
6789
  }
6755
6790
  async __listNamespaces(request = {}, requestOptions) {
6756
- const { startFrom, limit } = request;
6791
+ const { startFrom, limit, contextId } = request;
6757
6792
  const _queryParams = {
6758
6793
  startFrom,
6759
- limit
6794
+ limit,
6795
+ contextId
6760
6796
  };
6761
6797
  const _authRequest = await this._options.authProvider.getAuthRequest();
6762
6798
  const _headers = mergeHeaders(
@@ -6791,9 +6827,9 @@ var IdentityClient = class {
6791
6827
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6792
6828
  }
6793
6829
  /**
6794
- * 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.
6830
+ * 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 the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. `org` and `client` are provisioned when your account is created, so registering either returns the already-registered error.
6795
6831
  *
6796
- * @param {Vectros.NamespaceRequest} request
6832
+ * @param {Vectros.RegisterNamespaceRequest} request
6797
6833
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6798
6834
  *
6799
6835
  * @throws {@link Vectros.BadRequestError}
@@ -6802,14 +6838,20 @@ var IdentityClient = class {
6802
6838
  *
6803
6839
  * @example
6804
6840
  * await client.identity.registerNamespace({
6805
- * namespace: "team",
6806
- * specificityRank: 1500
6841
+ * body: {
6842
+ * namespace: "team",
6843
+ * specificityRank: 1500
6844
+ * }
6807
6845
  * })
6808
6846
  */
6809
6847
  registerNamespace(request, requestOptions) {
6810
6848
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6811
6849
  }
6812
6850
  async __registerNamespace(request, requestOptions) {
6851
+ const { contextId, body: _body } = request;
6852
+ const _queryParams = {
6853
+ contextId
6854
+ };
6813
6855
  const _authRequest = await this._options.authProvider.getAuthRequest();
6814
6856
  const _headers = mergeHeaders(
6815
6857
  _authRequest.headers,
@@ -6824,9 +6866,9 @@ var IdentityClient = class {
6824
6866
  method: "POST",
6825
6867
  headers: _headers,
6826
6868
  contentType: "application/json",
6827
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6869
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6828
6870
  requestType: "json",
6829
- body: request,
6871
+ body: _body,
6830
6872
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6831
6873
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6832
6874
  abortSignal: requestOptions?.abortSignal,
@@ -7111,12 +7153,13 @@ var IdentityClient = class {
7111
7153
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7112
7154
  }
7113
7155
  /**
7114
- * 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.
7156
+ * 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.
7115
7157
  *
7116
7158
  * @param {Vectros.DeleteUserRequest} request
7117
7159
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7118
7160
  *
7119
7161
  * @throws {@link Vectros.NotFoundError}
7162
+ * @throws {@link Vectros.ConflictError}
7120
7163
  * @throws {@link Vectros.TooManyRequestsError}
7121
7164
  *
7122
7165
  * @example
@@ -7156,6 +7199,8 @@ var IdentityClient = class {
7156
7199
  switch (_response.error.statusCode) {
7157
7200
  case 404:
7158
7201
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7202
+ case 409:
7203
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7159
7204
  case 429:
7160
7205
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7161
7206
  default:
@@ -9060,8 +9105,8 @@ function warnOnSuboptimalKey(key, log) {
9060
9105
 
9061
9106
  // src/build-info.ts
9062
9107
  var BUILD_INFO = {
9063
- mcpServer: true ? "0.14.0" : "dev",
9064
- sdk: true ? "0.39.0" : "dev"
9108
+ mcpServer: true ? "0.15.0" : "dev",
9109
+ sdk: true ? "0.40.0" : "dev"
9065
9110
  };
9066
9111
 
9067
9112
  // src/log.ts
@@ -9369,7 +9414,7 @@ var inputSchema = {
9369
9414
  // Ownership.
9370
9415
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9371
9416
  scope: z.string().optional().describe(
9372
- '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.'
9417
+ '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.'
9373
9418
  ),
9374
9419
  // Date window.
9375
9420
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9509,7 +9554,7 @@ var inputSchema2 = {
9509
9554
  // List-mode args:
9510
9555
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9511
9556
  scope: z2.string().optional().describe(
9512
- '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.'
9557
+ '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.'
9513
9558
  ),
9514
9559
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9515
9560
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9760,7 +9805,7 @@ var inputSchema4 = {
9760
9805
  folderId: z4.string().optional().describe("Group this record into a folder."),
9761
9806
  userId: z4.string().optional().describe("Owning user id."),
9762
9807
  scopes: z4.array(z4.string()).optional().describe(
9763
- '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.'
9808
+ '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.'
9764
9809
  )
9765
9810
  };
9766
9811
  var recordCreate = ({ client, log }) => ({
@@ -9884,7 +9929,7 @@ var inputSchema7 = {
9884
9929
  // whole-tenant corpus.
9885
9930
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9886
9931
  scope: z7.string().optional().describe(
9887
- '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.'
9932
+ '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.'
9888
9933
  ),
9889
9934
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9890
9935
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -10058,7 +10103,7 @@ var inputSchema9 = {
10058
10103
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10059
10104
  ),
10060
10105
  scope: z9.string().optional().describe(
10061
- '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.'
10106
+ '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.'
10062
10107
  ),
10063
10108
  surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
10064
10109
  "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."
@@ -10208,7 +10253,7 @@ var inputSchema11 = {
10208
10253
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10209
10254
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
10210
10255
  scope: z11.string().optional().describe(
10211
- '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.'
10256
+ '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.'
10212
10257
  ),
10213
10258
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10214
10259
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -10319,7 +10364,7 @@ var inputSchema12 = {
10319
10364
  ),
10320
10365
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10321
10366
  scopes: z12.array(z12.string()).optional().describe(
10322
- '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).'
10367
+ '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).'
10323
10368
  ),
10324
10369
  expectedVersion: z12.number().int().optional().describe(
10325
10370
  "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."
@@ -10403,7 +10448,7 @@ var inputSchema14 = {
10403
10448
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10404
10449
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10405
10450
  scope: z14.string().optional().describe(
10406
- '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.'
10451
+ '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.'
10407
10452
  ),
10408
10453
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10409
10454
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10452,7 +10497,7 @@ var inputSchema15 = {
10452
10497
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10453
10498
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10454
10499
  scopes: z15.array(z15.string()).optional().describe(
10455
- '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.'
10500
+ '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.'
10456
10501
  )
10457
10502
  };
10458
10503
  var folderCreate = ({ client, log }) => ({
@@ -10490,7 +10535,7 @@ var inputSchema16 = {
10490
10535
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10491
10536
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10492
10537
  scopes: z16.array(z16.string()).optional().describe(
10493
- '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).'
10538
+ '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).'
10494
10539
  ),
10495
10540
  expectedVersion: z16.number().int().optional().describe(
10496
10541
  "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."
@@ -10557,7 +10602,7 @@ var inputSchema18 = {
10557
10602
  var currentIdentity = ({ log, apiKey, environment }) => ({
10558
10603
  name: "current_identity",
10559
10604
  title: "Current identity (tenant + principal scope)",
10560
- 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.",
10605
+ 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.",
10561
10606
  inputSchema: inputSchema18,
10562
10607
  handler: async () => {
10563
10608
  try {
@@ -10680,7 +10725,7 @@ var inputSchema19 = {
10680
10725
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10681
10726
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10682
10727
  scopes: z18.array(z18.string()).optional().describe(
10683
- "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."
10728
+ "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."
10684
10729
  )
10685
10730
  };
10686
10731
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10844,11 +10889,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10844
10889
  var MCP_MAX_LIMIT5 = 100;
10845
10890
  var inputSchema20 = {
10846
10891
  kind: z19.string().describe(
10847
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10892
+ '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.'
10848
10893
  ),
10849
10894
  externalId: z19.string().optional().describe(
10850
10895
  "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."
10851
10896
  ),
10897
+ contextId: z19.string().optional().describe(
10898
+ "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."
10899
+ ),
10852
10900
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10853
10901
  type: z19.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10854
10902
  field: z19.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10865,13 +10913,14 @@ var inputSchema20 = {
10865
10913
  var lookupPrincipal = ({ client, log }) => ({
10866
10914
  name: "lookup_principal",
10867
10915
  title: "Look up a user identity or a namespaced identity entity",
10868
- 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.",
10916
+ 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.",
10869
10917
  inputSchema: inputSchema20,
10870
10918
  handler: async (args) => {
10871
10919
  const kind = args.kind;
10872
10920
  const isUser = kind === "user";
10873
10921
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10874
10922
  const externalId = args.externalId;
10923
+ const contextId = args.contextId;
10875
10924
  const type = args.type;
10876
10925
  const field = args.field;
10877
10926
  const value = args.value;
@@ -10880,11 +10929,18 @@ var lookupPrincipal = ({ client, log }) => ({
10880
10929
  const prefix = args.prefix;
10881
10930
  const order = args.order;
10882
10931
  const startFrom = args.startFrom;
10932
+ if (contextId !== void 0 && isUser) {
10933
+ return toolError(
10934
+ "lookup_principal",
10935
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10936
+ );
10937
+ }
10938
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10883
10939
  try {
10884
10940
  let page;
10885
10941
  if (externalId !== void 0) {
10886
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10887
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10942
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10943
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10888
10944
  } else if (field !== void 0) {
10889
10945
  const hasEquality = value !== void 0;
10890
10946
  const hasRange = from !== void 0 || to !== void 0;
@@ -10912,8 +10968,8 @@ var lookupPrincipal = ({ client, log }) => ({
10912
10968
  );
10913
10969
  }
10914
10970
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10915
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10916
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10971
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
10972
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10917
10973
  } else {
10918
10974
  return toolError(
10919
10975
  "lookup_principal",
@@ -10924,7 +10980,7 @@ var lookupPrincipal = ({ client, log }) => ({
10924
10980
  const nextCursor = page.nextCursor ?? null;
10925
10981
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10926
10982
  } catch (err) {
10927
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
10983
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10928
10984
  return toolError("lookup_principal", err);
10929
10985
  }
10930
10986
  }
@@ -11035,7 +11091,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11035
11091
  name: "identity",
11036
11092
  uri: "vectros://identity",
11037
11093
  title: "Current identity (tenant + principal scope)",
11038
- 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.",
11094
+ 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.",
11039
11095
  mimeType: "application/json",
11040
11096
  read: async () => {
11041
11097
  const identity = await resolveIdentity({ log, apiKey, environment });