@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/cli.js CHANGED
@@ -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.
4015
4015
  *
4016
4016
  * @param {Vectros.GetIssuerRequest} request
4017
4017
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4069,13 +4069,14 @@ 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
+ * 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
4073
  *
4074
4074
  * @param {Vectros.DeleteIssuerRequest} request
4075
4075
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4076
4076
  *
4077
4077
  * @throws {@link Vectros.ForbiddenError}
4078
4078
  * @throws {@link Vectros.NotFoundError}
4079
+ * @throws {@link Vectros.ConflictError}
4079
4080
  * @throws {@link Vectros.TooManyRequestsError}
4080
4081
  *
4081
4082
  * @example
@@ -4117,6 +4118,8 @@ var AuthClient = class {
4117
4118
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4118
4119
  case 404:
4119
4120
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4121
+ case 409:
4122
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4120
4123
  case 429:
4121
4124
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4122
4125
  default:
@@ -4135,7 +4138,7 @@ var AuthClient = class {
4135
4138
  );
4136
4139
  }
4137
4140
  /**
4138
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4141
+ * 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.
4139
4142
  *
4140
4143
  * @param {Vectros.ListIssuersRequest} request
4141
4144
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4192,7 +4195,7 @@ var AuthClient = class {
4192
4195
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4193
4196
  }
4194
4197
  /**
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.
4198
+ * 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`.
4196
4199
  *
4197
4200
  * @param {Vectros.IssuerRequest} request
4198
4201
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4303,7 +4306,7 @@ var AuthClient = class {
4303
4306
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4304
4307
  }
4305
4308
  /**
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.
4309
+ * 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
4310
  *
4308
4311
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4309
4312
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4582,7 +4585,7 @@ var AuthClient = class {
4582
4585
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4583
4586
  }
4584
4587
  /**
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.
4588
+ * 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
4589
  *
4587
4590
  * @param {Vectros.TokenExchangeRequest} request
4588
4591
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6124,6 +6127,7 @@ var IdentityClient = class {
6124
6127
  * @example
6125
6128
  * await client.identity.listEntities({
6126
6129
  * namespace: "team",
6130
+ * contextId: "myapp",
6127
6131
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6128
6132
  * })
6129
6133
  */
@@ -6133,6 +6137,7 @@ var IdentityClient = class {
6133
6137
  async __listEntities(request, requestOptions) {
6134
6138
  const {
6135
6139
  namespace,
6140
+ contextId,
6136
6141
  userId,
6137
6142
  externalId,
6138
6143
  scope,
@@ -6147,6 +6152,7 @@ var IdentityClient = class {
6147
6152
  limit
6148
6153
  } = request;
6149
6154
  const _queryParams = {
6155
+ contextId,
6150
6156
  userId,
6151
6157
  externalId,
6152
6158
  scope,
@@ -6205,6 +6211,7 @@ var IdentityClient = class {
6205
6211
  * @example
6206
6212
  * await client.identity.createEntity({
6207
6213
  * namespace: "team",
6214
+ * contextId: "myapp",
6208
6215
  * body: {
6209
6216
  * externalId: "team_eng_platform"
6210
6217
  * }
@@ -6214,9 +6221,10 @@ var IdentityClient = class {
6214
6221
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6215
6222
  }
6216
6223
  async __createEntity(request, requestOptions) {
6217
- const { namespace, upsert, body: _body } = request;
6224
+ const { namespace, upsert, contextId, body: _body } = request;
6218
6225
  const _queryParams = {
6219
- upsert
6226
+ upsert,
6227
+ contextId
6220
6228
  };
6221
6229
  const _authRequest = await this._options.authProvider.getAuthRequest();
6222
6230
  const _headers = mergeHeaders(
@@ -6273,14 +6281,18 @@ var IdentityClient = class {
6273
6281
  * @example
6274
6282
  * await client.identity.getEntity({
6275
6283
  * namespace: "team",
6276
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6284
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6285
+ * contextId: "myapp"
6277
6286
  * })
6278
6287
  */
6279
6288
  getEntity(request, requestOptions) {
6280
6289
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6281
6290
  }
6282
6291
  async __getEntity(request, requestOptions) {
6283
- const { namespace, id } = request;
6292
+ const { namespace, id, contextId } = request;
6293
+ const _queryParams = {
6294
+ contextId
6295
+ };
6284
6296
  const _authRequest = await this._options.authProvider.getAuthRequest();
6285
6297
  const _headers = mergeHeaders(
6286
6298
  _authRequest.headers,
@@ -6294,7 +6306,7 @@ var IdentityClient = class {
6294
6306
  ),
6295
6307
  method: "GET",
6296
6308
  headers: _headers,
6297
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6309
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6298
6310
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6299
6311
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6300
6312
  abortSignal: requestOptions?.abortSignal,
@@ -6331,6 +6343,7 @@ var IdentityClient = class {
6331
6343
  * await client.identity.updateEntity({
6332
6344
  * namespace: "team",
6333
6345
  * id: "id",
6346
+ * contextId: "myapp",
6334
6347
  * body: {
6335
6348
  * externalId: "team_eng_platform"
6336
6349
  * }
@@ -6340,7 +6353,10 @@ var IdentityClient = class {
6340
6353
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6341
6354
  }
6342
6355
  async __updateEntity(request, requestOptions) {
6343
- const { namespace, id, body: _body } = request;
6356
+ const { namespace, id, contextId, body: _body } = request;
6357
+ const _queryParams = {
6358
+ contextId
6359
+ };
6344
6360
  const _authRequest = await this._options.authProvider.getAuthRequest();
6345
6361
  const _headers = mergeHeaders(
6346
6362
  _authRequest.headers,
@@ -6355,7 +6371,7 @@ var IdentityClient = class {
6355
6371
  method: "PUT",
6356
6372
  headers: _headers,
6357
6373
  contentType: "application/json",
6358
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6374
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6359
6375
  requestType: "json",
6360
6376
  body: _body,
6361
6377
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6395,14 +6411,18 @@ var IdentityClient = class {
6395
6411
  * @example
6396
6412
  * await client.identity.deleteEntity({
6397
6413
  * namespace: "team",
6398
- * id: "id"
6414
+ * id: "id",
6415
+ * contextId: "myapp"
6399
6416
  * })
6400
6417
  */
6401
6418
  deleteEntity(request, requestOptions) {
6402
6419
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6403
6420
  }
6404
6421
  async __deleteEntity(request, requestOptions) {
6405
- const { namespace, id } = request;
6422
+ const { namespace, id, contextId } = request;
6423
+ const _queryParams = {
6424
+ contextId
6425
+ };
6406
6426
  const _authRequest = await this._options.authProvider.getAuthRequest();
6407
6427
  const _headers = mergeHeaders(
6408
6428
  _authRequest.headers,
@@ -6416,7 +6436,7 @@ var IdentityClient = class {
6416
6436
  ),
6417
6437
  method: "DELETE",
6418
6438
  headers: _headers,
6419
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6439
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6420
6440
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6421
6441
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6422
6442
  abortSignal: requestOptions?.abortSignal,
@@ -6459,6 +6479,7 @@ var IdentityClient = class {
6459
6479
  * @example
6460
6480
  * await client.identity.lookupEntities({
6461
6481
  * namespace: "team",
6482
+ * contextId: "myapp",
6462
6483
  * body: {
6463
6484
  * type: "person_v1",
6464
6485
  * field: "ssn"
@@ -6469,7 +6490,10 @@ var IdentityClient = class {
6469
6490
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6470
6491
  }
6471
6492
  async __lookupEntities(request, requestOptions) {
6472
- const { namespace, body: _body } = request;
6493
+ const { namespace, contextId, body: _body } = request;
6494
+ const _queryParams = {
6495
+ contextId
6496
+ };
6473
6497
  const _authRequest = await this._options.authProvider.getAuthRequest();
6474
6498
  const _headers = mergeHeaders(
6475
6499
  _authRequest.headers,
@@ -6484,7 +6508,7 @@ var IdentityClient = class {
6484
6508
  method: "POST",
6485
6509
  headers: _headers,
6486
6510
  contentType: "application/json",
6487
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6511
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6488
6512
  requestType: "json",
6489
6513
  body: _body,
6490
6514
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6528,15 +6552,17 @@ var IdentityClient = class {
6528
6552
  * @example
6529
6553
  * await client.identity.getEntityVersions({
6530
6554
  * namespace: "team",
6531
- * id: "id"
6555
+ * id: "id",
6556
+ * contextId: "myapp"
6532
6557
  * })
6533
6558
  */
6534
6559
  getEntityVersions(request, requestOptions) {
6535
6560
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6536
6561
  }
6537
6562
  async __getEntityVersions(request, requestOptions) {
6538
- const { namespace, id, startFrom } = request;
6563
+ const { namespace, id, contextId, startFrom } = request;
6539
6564
  const _queryParams = {
6565
+ contextId,
6540
6566
  startFrom
6541
6567
  };
6542
6568
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6598,7 +6624,10 @@ var IdentityClient = class {
6598
6624
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6599
6625
  }
6600
6626
  async __getNamespace(request, requestOptions) {
6601
- const { namespace } = request;
6627
+ const { namespace, contextId } = request;
6628
+ const _queryParams = {
6629
+ contextId
6630
+ };
6602
6631
  const _authRequest = await this._options.authProvider.getAuthRequest();
6603
6632
  const _headers = mergeHeaders(
6604
6633
  _authRequest.headers,
@@ -6612,7 +6641,7 @@ var IdentityClient = class {
6612
6641
  ),
6613
6642
  method: "GET",
6614
6643
  headers: _headers,
6615
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6644
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6616
6645
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6617
6646
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6618
6647
  abortSignal: requestOptions?.abortSignal,
@@ -6637,7 +6666,7 @@ var IdentityClient = class {
6637
6666
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6638
6667
  }
6639
6668
  /**
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.
6669
+ * 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
6670
  *
6642
6671
  * @param {Vectros.UpdateNamespaceRequest} request
6643
6672
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6659,7 +6688,10 @@ var IdentityClient = class {
6659
6688
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6660
6689
  }
6661
6690
  async __updateNamespace(request, requestOptions) {
6662
- const { namespace, body: _body } = request;
6691
+ const { namespace, contextId, body: _body } = request;
6692
+ const _queryParams = {
6693
+ contextId
6694
+ };
6663
6695
  const _authRequest = await this._options.authProvider.getAuthRequest();
6664
6696
  const _headers = mergeHeaders(
6665
6697
  _authRequest.headers,
@@ -6674,7 +6706,7 @@ var IdentityClient = class {
6674
6706
  method: "PUT",
6675
6707
  headers: _headers,
6676
6708
  contentType: "application/json",
6677
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6709
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6678
6710
  requestType: "json",
6679
6711
  body: _body,
6680
6712
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6705,7 +6737,7 @@ var IdentityClient = class {
6705
6737
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6706
6738
  }
6707
6739
  /**
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.
6740
+ * 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
6741
  *
6710
6742
  * @param {Vectros.DeleteNamespaceRequest} request
6711
6743
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6723,7 +6755,10 @@ var IdentityClient = class {
6723
6755
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6724
6756
  }
6725
6757
  async __deleteNamespace(request, requestOptions) {
6726
- const { namespace } = request;
6758
+ const { namespace, contextId } = request;
6759
+ const _queryParams = {
6760
+ contextId
6761
+ };
6727
6762
  const _authRequest = await this._options.authProvider.getAuthRequest();
6728
6763
  const _headers = mergeHeaders(
6729
6764
  _authRequest.headers,
@@ -6737,7 +6772,7 @@ var IdentityClient = class {
6737
6772
  ),
6738
6773
  method: "DELETE",
6739
6774
  headers: _headers,
6740
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6775
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6741
6776
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6742
6777
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6743
6778
  abortSignal: requestOptions?.abortSignal,
@@ -6766,7 +6801,7 @@ var IdentityClient = class {
6766
6801
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6767
6802
  }
6768
6803
  /**
6769
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6804
+ * 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.
6770
6805
  *
6771
6806
  * @param {Vectros.ListNamespacesRequest} request
6772
6807
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6778,10 +6813,11 @@ var IdentityClient = class {
6778
6813
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6779
6814
  }
6780
6815
  async __listNamespaces(request = {}, requestOptions) {
6781
- const { startFrom, limit } = request;
6816
+ const { startFrom, limit, contextId } = request;
6782
6817
  const _queryParams = {
6783
6818
  startFrom,
6784
- limit
6819
+ limit,
6820
+ contextId
6785
6821
  };
6786
6822
  const _authRequest = await this._options.authProvider.getAuthRequest();
6787
6823
  const _headers = mergeHeaders(
@@ -6816,9 +6852,9 @@ var IdentityClient = class {
6816
6852
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6817
6853
  }
6818
6854
  /**
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.
6855
+ * 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.
6820
6856
  *
6821
- * @param {Vectros.NamespaceRequest} request
6857
+ * @param {Vectros.RegisterNamespaceRequest} request
6822
6858
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6823
6859
  *
6824
6860
  * @throws {@link Vectros.BadRequestError}
@@ -6827,14 +6863,20 @@ var IdentityClient = class {
6827
6863
  *
6828
6864
  * @example
6829
6865
  * await client.identity.registerNamespace({
6830
- * namespace: "team",
6831
- * specificityRank: 1500
6866
+ * body: {
6867
+ * namespace: "team",
6868
+ * specificityRank: 1500
6869
+ * }
6832
6870
  * })
6833
6871
  */
6834
6872
  registerNamespace(request, requestOptions) {
6835
6873
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6836
6874
  }
6837
6875
  async __registerNamespace(request, requestOptions) {
6876
+ const { contextId, body: _body } = request;
6877
+ const _queryParams = {
6878
+ contextId
6879
+ };
6838
6880
  const _authRequest = await this._options.authProvider.getAuthRequest();
6839
6881
  const _headers = mergeHeaders(
6840
6882
  _authRequest.headers,
@@ -6849,9 +6891,9 @@ var IdentityClient = class {
6849
6891
  method: "POST",
6850
6892
  headers: _headers,
6851
6893
  contentType: "application/json",
6852
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6894
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6853
6895
  requestType: "json",
6854
- body: request,
6896
+ body: _body,
6855
6897
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6856
6898
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6857
6899
  abortSignal: requestOptions?.abortSignal,
@@ -7136,12 +7178,13 @@ var IdentityClient = class {
7136
7178
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7137
7179
  }
7138
7180
  /**
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.
7181
+ * 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.
7140
7182
  *
7141
7183
  * @param {Vectros.DeleteUserRequest} request
7142
7184
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7143
7185
  *
7144
7186
  * @throws {@link Vectros.NotFoundError}
7187
+ * @throws {@link Vectros.ConflictError}
7145
7188
  * @throws {@link Vectros.TooManyRequestsError}
7146
7189
  *
7147
7190
  * @example
@@ -7181,6 +7224,8 @@ var IdentityClient = class {
7181
7224
  switch (_response.error.statusCode) {
7182
7225
  case 404:
7183
7226
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7227
+ case 409:
7228
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7184
7229
  case 429:
7185
7230
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7186
7231
  default:
@@ -9080,8 +9125,8 @@ function warnOnSuboptimalKey(key, log) {
9080
9125
 
9081
9126
  // src/build-info.ts
9082
9127
  var BUILD_INFO = {
9083
- mcpServer: true ? "0.14.0" : "dev",
9084
- sdk: true ? "0.39.0" : "dev"
9128
+ mcpServer: true ? "0.15.0" : "dev",
9129
+ sdk: true ? "0.40.0" : "dev"
9085
9130
  };
9086
9131
  function formatBuildInfo() {
9087
9132
  return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
@@ -9392,7 +9437,7 @@ var inputSchema = {
9392
9437
  // Ownership.
9393
9438
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9394
9439
  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.'
9440
+ '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
9441
  ),
9397
9442
  // Date window.
9398
9443
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9532,7 +9577,7 @@ var inputSchema2 = {
9532
9577
  // List-mode args:
9533
9578
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9534
9579
  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.'
9580
+ '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
9581
  ),
9537
9582
  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
9583
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9783,7 +9828,7 @@ var inputSchema4 = {
9783
9828
  folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9784
9829
  userId: import_zod4.z.string().optional().describe("Owning user id."),
9785
9830
  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.'
9831
+ '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
9832
  )
9788
9833
  };
9789
9834
  var recordCreate = ({ client, log }) => ({
@@ -9907,7 +9952,7 @@ var inputSchema7 = {
9907
9952
  // whole-tenant corpus.
9908
9953
  userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9909
9954
  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.'
9955
+ '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
9956
  ),
9912
9957
  folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9913
9958
  rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -10081,7 +10126,7 @@ var inputSchema9 = {
10081
10126
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10082
10127
  ),
10083
10128
  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.'
10129
+ '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
10130
  ),
10086
10131
  surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
10087
10132
  "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."
@@ -10231,7 +10276,7 @@ var inputSchema11 = {
10231
10276
  folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10232
10277
  userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
10233
10278
  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.'
10279
+ '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
10280
  ),
10236
10281
  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
10282
  limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -10342,7 +10387,7 @@ var inputSchema12 = {
10342
10387
  ),
10343
10388
  userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10344
10389
  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).'
10390
+ '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
10391
  ),
10347
10392
  expectedVersion: import_zod12.z.number().int().optional().describe(
10348
10393
  "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."
@@ -10426,7 +10471,7 @@ var inputSchema14 = {
10426
10471
  parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10427
10472
  userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10428
10473
  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.'
10474
+ '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
10475
  ),
10431
10476
  startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10432
10477
  limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10475,7 +10520,7 @@ var inputSchema15 = {
10475
10520
  slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10476
10521
  userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10477
10522
  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.'
10523
+ '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
10524
  )
10480
10525
  };
10481
10526
  var folderCreate = ({ client, log }) => ({
@@ -10513,7 +10558,7 @@ var inputSchema16 = {
10513
10558
  description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10514
10559
  userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10515
10560
  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).'
10561
+ '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
10562
  ),
10518
10563
  expectedVersion: import_zod16.z.number().int().optional().describe(
10519
10564
  "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."
@@ -10580,7 +10625,7 @@ var inputSchema18 = {
10580
10625
  var currentIdentity = ({ log, apiKey, environment }) => ({
10581
10626
  name: "current_identity",
10582
10627
  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.",
10628
+ 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.",
10584
10629
  inputSchema: inputSchema18,
10585
10630
  handler: async () => {
10586
10631
  try {
@@ -10703,7 +10748,7 @@ var inputSchema19 = {
10703
10748
  folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10704
10749
  userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10705
10750
  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."
10751
+ "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
10752
  )
10708
10753
  };
10709
10754
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10867,11 +10912,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10867
10912
  var MCP_MAX_LIMIT5 = 100;
10868
10913
  var inputSchema20 = {
10869
10914
  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.'
10915
+ '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
10916
  ),
10872
10917
  externalId: import_zod19.z.string().optional().describe(
10873
10918
  "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
10919
  ),
10920
+ contextId: import_zod19.z.string().optional().describe(
10921
+ "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."
10922
+ ),
10875
10923
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10876
10924
  type: import_zod19.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10877
10925
  field: import_zod19.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10888,13 +10936,14 @@ var inputSchema20 = {
10888
10936
  var lookupPrincipal = ({ client, log }) => ({
10889
10937
  name: "lookup_principal",
10890
10938
  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.",
10939
+ 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.",
10892
10940
  inputSchema: inputSchema20,
10893
10941
  handler: async (args) => {
10894
10942
  const kind = args.kind;
10895
10943
  const isUser = kind === "user";
10896
10944
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10897
10945
  const externalId = args.externalId;
10946
+ const contextId = args.contextId;
10898
10947
  const type = args.type;
10899
10948
  const field = args.field;
10900
10949
  const value = args.value;
@@ -10903,11 +10952,18 @@ var lookupPrincipal = ({ client, log }) => ({
10903
10952
  const prefix = args.prefix;
10904
10953
  const order = args.order;
10905
10954
  const startFrom = args.startFrom;
10955
+ if (contextId !== void 0 && isUser) {
10956
+ return toolError(
10957
+ "lookup_principal",
10958
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10959
+ );
10960
+ }
10961
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10906
10962
  try {
10907
10963
  let page;
10908
10964
  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");
10965
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10966
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10911
10967
  } else if (field !== void 0) {
10912
10968
  const hasEquality = value !== void 0;
10913
10969
  const hasRange = from !== void 0 || to !== void 0;
@@ -10935,8 +10991,8 @@ var lookupPrincipal = ({ client, log }) => ({
10935
10991
  );
10936
10992
  }
10937
10993
  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");
10994
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
10995
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10940
10996
  } else {
10941
10997
  return toolError(
10942
10998
  "lookup_principal",
@@ -10947,7 +11003,7 @@ var lookupPrincipal = ({ client, log }) => ({
10947
11003
  const nextCursor = page.nextCursor ?? null;
10948
11004
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10949
11005
  } catch (err) {
10950
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
11006
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10951
11007
  return toolError("lookup_principal", err);
10952
11008
  }
10953
11009
  }
@@ -11058,7 +11114,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11058
11114
  name: "identity",
11059
11115
  uri: "vectros://identity",
11060
11116
  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.",
11117
+ 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
11118
  mimeType: "application/json",
11063
11119
  read: async () => {
11064
11120
  const identity = await resolveIdentity({ log, apiKey, environment });