@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.js CHANGED
@@ -2863,7 +2863,7 @@ var AuthClient = class {
2863
2863
  );
2864
2864
  }
2865
2865
  /**
2866
- * 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.
2866
+ * 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.
2867
2867
  *
2868
2868
  * @param {Vectros.CreateAccessProfileRequest} request
2869
2869
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3964,7 +3964,7 @@ var AuthClient = class {
3964
3964
  );
3965
3965
  }
3966
3966
  /**
3967
- * 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.
3967
+ * 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.
3968
3968
  *
3969
3969
  * @param {Vectros.GetUsageRequest} request
3970
3970
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4027,7 +4027,7 @@ var AuthClient = class {
4027
4027
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
4028
4028
  }
4029
4029
  /**
4030
- * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
4030
+ * 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.
4031
4031
  *
4032
4032
  * @param {Vectros.GetIssuerRequest} request
4033
4033
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4085,13 +4085,14 @@ var AuthClient = class {
4085
4085
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4086
4086
  }
4087
4087
  /**
4088
- * 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.
4088
+ * 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.
4089
4089
  *
4090
4090
  * @param {Vectros.DeleteIssuerRequest} request
4091
4091
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4092
4092
  *
4093
4093
  * @throws {@link Vectros.ForbiddenError}
4094
4094
  * @throws {@link Vectros.NotFoundError}
4095
+ * @throws {@link Vectros.ConflictError}
4095
4096
  * @throws {@link Vectros.TooManyRequestsError}
4096
4097
  *
4097
4098
  * @example
@@ -4133,6 +4134,8 @@ var AuthClient = class {
4133
4134
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4134
4135
  case 404:
4135
4136
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4137
+ case 409:
4138
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4136
4139
  case 429:
4137
4140
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4138
4141
  default:
@@ -4151,7 +4154,7 @@ var AuthClient = class {
4151
4154
  );
4152
4155
  }
4153
4156
  /**
4154
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4157
+ * 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.
4155
4158
  *
4156
4159
  * @param {Vectros.ListIssuersRequest} request
4157
4160
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4208,7 +4211,7 @@ var AuthClient = class {
4208
4211
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4209
4212
  }
4210
4213
  /**
4211
- * 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.
4214
+ * 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`.
4212
4215
  *
4213
4216
  * @param {Vectros.IssuerRequest} request
4214
4217
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4319,7 +4322,7 @@ var AuthClient = class {
4319
4322
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4320
4323
  }
4321
4324
  /**
4322
- * 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.
4325
+ * 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.
4323
4326
  *
4324
4327
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4325
4328
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4598,7 +4601,7 @@ var AuthClient = class {
4598
4601
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4599
4602
  }
4600
4603
  /**
4601
- * 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.
4604
+ * 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.
4602
4605
  *
4603
4606
  * @param {Vectros.TokenExchangeRequest} request
4604
4607
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6140,6 +6143,7 @@ var IdentityClient = class {
6140
6143
  * @example
6141
6144
  * await client.identity.listEntities({
6142
6145
  * namespace: "team",
6146
+ * contextId: "myapp",
6143
6147
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6144
6148
  * })
6145
6149
  */
@@ -6149,6 +6153,7 @@ var IdentityClient = class {
6149
6153
  async __listEntities(request, requestOptions) {
6150
6154
  const {
6151
6155
  namespace,
6156
+ contextId,
6152
6157
  userId,
6153
6158
  externalId,
6154
6159
  scope,
@@ -6163,6 +6168,7 @@ var IdentityClient = class {
6163
6168
  limit
6164
6169
  } = request;
6165
6170
  const _queryParams = {
6171
+ contextId,
6166
6172
  userId,
6167
6173
  externalId,
6168
6174
  scope,
@@ -6221,6 +6227,7 @@ var IdentityClient = class {
6221
6227
  * @example
6222
6228
  * await client.identity.createEntity({
6223
6229
  * namespace: "team",
6230
+ * contextId: "myapp",
6224
6231
  * body: {
6225
6232
  * externalId: "team_eng_platform"
6226
6233
  * }
@@ -6230,9 +6237,10 @@ var IdentityClient = class {
6230
6237
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6231
6238
  }
6232
6239
  async __createEntity(request, requestOptions) {
6233
- const { namespace, upsert, body: _body } = request;
6240
+ const { namespace, upsert, contextId, body: _body } = request;
6234
6241
  const _queryParams = {
6235
- upsert
6242
+ upsert,
6243
+ contextId
6236
6244
  };
6237
6245
  const _authRequest = await this._options.authProvider.getAuthRequest();
6238
6246
  const _headers = mergeHeaders(
@@ -6289,14 +6297,18 @@ var IdentityClient = class {
6289
6297
  * @example
6290
6298
  * await client.identity.getEntity({
6291
6299
  * namespace: "team",
6292
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6300
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6301
+ * contextId: "myapp"
6293
6302
  * })
6294
6303
  */
6295
6304
  getEntity(request, requestOptions) {
6296
6305
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6297
6306
  }
6298
6307
  async __getEntity(request, requestOptions) {
6299
- const { namespace, id } = request;
6308
+ const { namespace, id, contextId } = request;
6309
+ const _queryParams = {
6310
+ contextId
6311
+ };
6300
6312
  const _authRequest = await this._options.authProvider.getAuthRequest();
6301
6313
  const _headers = mergeHeaders(
6302
6314
  _authRequest.headers,
@@ -6310,7 +6322,7 @@ var IdentityClient = class {
6310
6322
  ),
6311
6323
  method: "GET",
6312
6324
  headers: _headers,
6313
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6325
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6314
6326
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6315
6327
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6316
6328
  abortSignal: requestOptions?.abortSignal,
@@ -6347,6 +6359,7 @@ var IdentityClient = class {
6347
6359
  * await client.identity.updateEntity({
6348
6360
  * namespace: "team",
6349
6361
  * id: "id",
6362
+ * contextId: "myapp",
6350
6363
  * body: {
6351
6364
  * externalId: "team_eng_platform"
6352
6365
  * }
@@ -6356,7 +6369,10 @@ var IdentityClient = class {
6356
6369
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6357
6370
  }
6358
6371
  async __updateEntity(request, requestOptions) {
6359
- const { namespace, id, body: _body } = request;
6372
+ const { namespace, id, contextId, body: _body } = request;
6373
+ const _queryParams = {
6374
+ contextId
6375
+ };
6360
6376
  const _authRequest = await this._options.authProvider.getAuthRequest();
6361
6377
  const _headers = mergeHeaders(
6362
6378
  _authRequest.headers,
@@ -6371,7 +6387,7 @@ var IdentityClient = class {
6371
6387
  method: "PUT",
6372
6388
  headers: _headers,
6373
6389
  contentType: "application/json",
6374
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6390
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6375
6391
  requestType: "json",
6376
6392
  body: _body,
6377
6393
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6411,14 +6427,18 @@ var IdentityClient = class {
6411
6427
  * @example
6412
6428
  * await client.identity.deleteEntity({
6413
6429
  * namespace: "team",
6414
- * id: "id"
6430
+ * id: "id",
6431
+ * contextId: "myapp"
6415
6432
  * })
6416
6433
  */
6417
6434
  deleteEntity(request, requestOptions) {
6418
6435
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6419
6436
  }
6420
6437
  async __deleteEntity(request, requestOptions) {
6421
- const { namespace, id } = request;
6438
+ const { namespace, id, contextId } = request;
6439
+ const _queryParams = {
6440
+ contextId
6441
+ };
6422
6442
  const _authRequest = await this._options.authProvider.getAuthRequest();
6423
6443
  const _headers = mergeHeaders(
6424
6444
  _authRequest.headers,
@@ -6432,7 +6452,7 @@ var IdentityClient = class {
6432
6452
  ),
6433
6453
  method: "DELETE",
6434
6454
  headers: _headers,
6435
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6455
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6436
6456
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6437
6457
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6438
6458
  abortSignal: requestOptions?.abortSignal,
@@ -6475,6 +6495,7 @@ var IdentityClient = class {
6475
6495
  * @example
6476
6496
  * await client.identity.lookupEntities({
6477
6497
  * namespace: "team",
6498
+ * contextId: "myapp",
6478
6499
  * body: {
6479
6500
  * type: "person_v1",
6480
6501
  * field: "ssn"
@@ -6485,7 +6506,10 @@ var IdentityClient = class {
6485
6506
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6486
6507
  }
6487
6508
  async __lookupEntities(request, requestOptions) {
6488
- const { namespace, body: _body } = request;
6509
+ const { namespace, contextId, body: _body } = request;
6510
+ const _queryParams = {
6511
+ contextId
6512
+ };
6489
6513
  const _authRequest = await this._options.authProvider.getAuthRequest();
6490
6514
  const _headers = mergeHeaders(
6491
6515
  _authRequest.headers,
@@ -6500,7 +6524,7 @@ var IdentityClient = class {
6500
6524
  method: "POST",
6501
6525
  headers: _headers,
6502
6526
  contentType: "application/json",
6503
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6527
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6504
6528
  requestType: "json",
6505
6529
  body: _body,
6506
6530
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6544,15 +6568,17 @@ var IdentityClient = class {
6544
6568
  * @example
6545
6569
  * await client.identity.getEntityVersions({
6546
6570
  * namespace: "team",
6547
- * id: "id"
6571
+ * id: "id",
6572
+ * contextId: "myapp"
6548
6573
  * })
6549
6574
  */
6550
6575
  getEntityVersions(request, requestOptions) {
6551
6576
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6552
6577
  }
6553
6578
  async __getEntityVersions(request, requestOptions) {
6554
- const { namespace, id, startFrom } = request;
6579
+ const { namespace, id, contextId, startFrom } = request;
6555
6580
  const _queryParams = {
6581
+ contextId,
6556
6582
  startFrom
6557
6583
  };
6558
6584
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6614,7 +6640,10 @@ var IdentityClient = class {
6614
6640
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6615
6641
  }
6616
6642
  async __getNamespace(request, requestOptions) {
6617
- const { namespace } = request;
6643
+ const { namespace, contextId } = request;
6644
+ const _queryParams = {
6645
+ contextId
6646
+ };
6618
6647
  const _authRequest = await this._options.authProvider.getAuthRequest();
6619
6648
  const _headers = mergeHeaders(
6620
6649
  _authRequest.headers,
@@ -6628,7 +6657,7 @@ var IdentityClient = class {
6628
6657
  ),
6629
6658
  method: "GET",
6630
6659
  headers: _headers,
6631
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6660
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6632
6661
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6633
6662
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6634
6663
  abortSignal: requestOptions?.abortSignal,
@@ -6653,7 +6682,7 @@ var IdentityClient = class {
6653
6682
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6654
6683
  }
6655
6684
  /**
6656
- * 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.
6685
+ * 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.
6657
6686
  *
6658
6687
  * @param {Vectros.UpdateNamespaceRequest} request
6659
6688
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6675,7 +6704,10 @@ var IdentityClient = class {
6675
6704
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6676
6705
  }
6677
6706
  async __updateNamespace(request, requestOptions) {
6678
- const { namespace, body: _body } = request;
6707
+ const { namespace, contextId, body: _body } = request;
6708
+ const _queryParams = {
6709
+ contextId
6710
+ };
6679
6711
  const _authRequest = await this._options.authProvider.getAuthRequest();
6680
6712
  const _headers = mergeHeaders(
6681
6713
  _authRequest.headers,
@@ -6690,7 +6722,7 @@ var IdentityClient = class {
6690
6722
  method: "PUT",
6691
6723
  headers: _headers,
6692
6724
  contentType: "application/json",
6693
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6725
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6694
6726
  requestType: "json",
6695
6727
  body: _body,
6696
6728
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6721,7 +6753,7 @@ var IdentityClient = class {
6721
6753
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6722
6754
  }
6723
6755
  /**
6724
- * 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.
6756
+ * 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.
6725
6757
  *
6726
6758
  * @param {Vectros.DeleteNamespaceRequest} request
6727
6759
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6739,7 +6771,10 @@ var IdentityClient = class {
6739
6771
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6740
6772
  }
6741
6773
  async __deleteNamespace(request, requestOptions) {
6742
- const { namespace } = request;
6774
+ const { namespace, contextId } = request;
6775
+ const _queryParams = {
6776
+ contextId
6777
+ };
6743
6778
  const _authRequest = await this._options.authProvider.getAuthRequest();
6744
6779
  const _headers = mergeHeaders(
6745
6780
  _authRequest.headers,
@@ -6753,7 +6788,7 @@ var IdentityClient = class {
6753
6788
  ),
6754
6789
  method: "DELETE",
6755
6790
  headers: _headers,
6756
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6791
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6757
6792
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6758
6793
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6759
6794
  abortSignal: requestOptions?.abortSignal,
@@ -6782,7 +6817,7 @@ var IdentityClient = class {
6782
6817
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6783
6818
  }
6784
6819
  /**
6785
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6820
+ * 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.
6786
6821
  *
6787
6822
  * @param {Vectros.ListNamespacesRequest} request
6788
6823
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6794,10 +6829,11 @@ var IdentityClient = class {
6794
6829
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6795
6830
  }
6796
6831
  async __listNamespaces(request = {}, requestOptions) {
6797
- const { startFrom, limit } = request;
6832
+ const { startFrom, limit, contextId } = request;
6798
6833
  const _queryParams = {
6799
6834
  startFrom,
6800
- limit
6835
+ limit,
6836
+ contextId
6801
6837
  };
6802
6838
  const _authRequest = await this._options.authProvider.getAuthRequest();
6803
6839
  const _headers = mergeHeaders(
@@ -6832,9 +6868,9 @@ var IdentityClient = class {
6832
6868
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6833
6869
  }
6834
6870
  /**
6835
- * 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.
6871
+ * 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.
6836
6872
  *
6837
- * @param {Vectros.NamespaceRequest} request
6873
+ * @param {Vectros.RegisterNamespaceRequest} request
6838
6874
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6839
6875
  *
6840
6876
  * @throws {@link Vectros.BadRequestError}
@@ -6843,14 +6879,20 @@ var IdentityClient = class {
6843
6879
  *
6844
6880
  * @example
6845
6881
  * await client.identity.registerNamespace({
6846
- * namespace: "team",
6847
- * specificityRank: 1500
6882
+ * body: {
6883
+ * namespace: "team",
6884
+ * specificityRank: 1500
6885
+ * }
6848
6886
  * })
6849
6887
  */
6850
6888
  registerNamespace(request, requestOptions) {
6851
6889
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6852
6890
  }
6853
6891
  async __registerNamespace(request, requestOptions) {
6892
+ const { contextId, body: _body } = request;
6893
+ const _queryParams = {
6894
+ contextId
6895
+ };
6854
6896
  const _authRequest = await this._options.authProvider.getAuthRequest();
6855
6897
  const _headers = mergeHeaders(
6856
6898
  _authRequest.headers,
@@ -6865,9 +6907,9 @@ var IdentityClient = class {
6865
6907
  method: "POST",
6866
6908
  headers: _headers,
6867
6909
  contentType: "application/json",
6868
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6910
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6869
6911
  requestType: "json",
6870
- body: request,
6912
+ body: _body,
6871
6913
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6872
6914
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6873
6915
  abortSignal: requestOptions?.abortSignal,
@@ -7152,12 +7194,13 @@ var IdentityClient = class {
7152
7194
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7153
7195
  }
7154
7196
  /**
7155
- * 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.
7197
+ * 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.
7156
7198
  *
7157
7199
  * @param {Vectros.DeleteUserRequest} request
7158
7200
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7159
7201
  *
7160
7202
  * @throws {@link Vectros.NotFoundError}
7203
+ * @throws {@link Vectros.ConflictError}
7161
7204
  * @throws {@link Vectros.TooManyRequestsError}
7162
7205
  *
7163
7206
  * @example
@@ -7197,6 +7240,8 @@ var IdentityClient = class {
7197
7240
  switch (_response.error.statusCode) {
7198
7241
  case 404:
7199
7242
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7243
+ case 409:
7244
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7200
7245
  case 429:
7201
7246
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7202
7247
  default:
@@ -9096,8 +9141,8 @@ function warnOnSuboptimalKey(key, log) {
9096
9141
 
9097
9142
  // src/build-info.ts
9098
9143
  var BUILD_INFO = {
9099
- mcpServer: true ? "0.14.0" : "dev",
9100
- sdk: true ? "0.39.0" : "dev"
9144
+ mcpServer: true ? "0.15.0" : "dev",
9145
+ sdk: true ? "0.40.0" : "dev"
9101
9146
  };
9102
9147
 
9103
9148
  // src/log.ts
@@ -9405,7 +9450,7 @@ var inputSchema = {
9405
9450
  // Ownership.
9406
9451
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9407
9452
  scope: import_zod.z.string().optional().describe(
9408
- '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.'
9453
+ '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.'
9409
9454
  ),
9410
9455
  // Date window.
9411
9456
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9545,7 +9590,7 @@ var inputSchema2 = {
9545
9590
  // List-mode args:
9546
9591
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9547
9592
  scope: import_zod2.z.string().optional().describe(
9548
- '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.'
9593
+ '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.'
9549
9594
  ),
9550
9595
  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."),
9551
9596
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9796,7 +9841,7 @@ var inputSchema4 = {
9796
9841
  folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9797
9842
  userId: import_zod4.z.string().optional().describe("Owning user id."),
9798
9843
  scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
9799
- '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.'
9844
+ '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.'
9800
9845
  )
9801
9846
  };
9802
9847
  var recordCreate = ({ client, log }) => ({
@@ -9920,7 +9965,7 @@ var inputSchema7 = {
9920
9965
  // whole-tenant corpus.
9921
9966
  userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9922
9967
  scope: import_zod7.z.string().optional().describe(
9923
- '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.'
9968
+ '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.'
9924
9969
  ),
9925
9970
  folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9926
9971
  rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -10094,7 +10139,7 @@ var inputSchema9 = {
10094
10139
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10095
10140
  ),
10096
10141
  scope: import_zod9.z.string().optional().describe(
10097
- '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.'
10142
+ '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.'
10098
10143
  ),
10099
10144
  surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
10100
10145
  "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."
@@ -10244,7 +10289,7 @@ var inputSchema11 = {
10244
10289
  folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10245
10290
  userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
10246
10291
  scope: import_zod11.z.string().optional().describe(
10247
- '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.'
10292
+ '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.'
10248
10293
  ),
10249
10294
  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."),
10250
10295
  limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -10355,7 +10400,7 @@ var inputSchema12 = {
10355
10400
  ),
10356
10401
  userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10357
10402
  scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
10358
- '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).'
10403
+ '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).'
10359
10404
  ),
10360
10405
  expectedVersion: import_zod12.z.number().int().optional().describe(
10361
10406
  "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."
@@ -10439,7 +10484,7 @@ var inputSchema14 = {
10439
10484
  parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10440
10485
  userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10441
10486
  scope: import_zod14.z.string().optional().describe(
10442
- '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.'
10487
+ '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.'
10443
10488
  ),
10444
10489
  startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10445
10490
  limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10488,7 +10533,7 @@ var inputSchema15 = {
10488
10533
  slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10489
10534
  userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10490
10535
  scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
10491
- '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.'
10536
+ '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.'
10492
10537
  )
10493
10538
  };
10494
10539
  var folderCreate = ({ client, log }) => ({
@@ -10526,7 +10571,7 @@ var inputSchema16 = {
10526
10571
  description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10527
10572
  userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10528
10573
  scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
10529
- '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).'
10574
+ '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).'
10530
10575
  ),
10531
10576
  expectedVersion: import_zod16.z.number().int().optional().describe(
10532
10577
  "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."
@@ -10593,7 +10638,7 @@ var inputSchema18 = {
10593
10638
  var currentIdentity = ({ log, apiKey, environment }) => ({
10594
10639
  name: "current_identity",
10595
10640
  title: "Current identity (tenant + principal scope)",
10596
- 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.",
10641
+ 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.",
10597
10642
  inputSchema: inputSchema18,
10598
10643
  handler: async () => {
10599
10644
  try {
@@ -10716,7 +10761,7 @@ var inputSchema19 = {
10716
10761
  folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10717
10762
  userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10718
10763
  scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
10719
- "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."
10764
+ "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."
10720
10765
  )
10721
10766
  };
10722
10767
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10880,11 +10925,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10880
10925
  var MCP_MAX_LIMIT5 = 100;
10881
10926
  var inputSchema20 = {
10882
10927
  kind: import_zod19.z.string().describe(
10883
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10928
+ '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.'
10884
10929
  ),
10885
10930
  externalId: import_zod19.z.string().optional().describe(
10886
10931
  "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."
10887
10932
  ),
10933
+ contextId: import_zod19.z.string().optional().describe(
10934
+ "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."
10935
+ ),
10888
10936
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10889
10937
  type: import_zod19.z.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10890
10938
  field: import_zod19.z.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10901,13 +10949,14 @@ var inputSchema20 = {
10901
10949
  var lookupPrincipal = ({ client, log }) => ({
10902
10950
  name: "lookup_principal",
10903
10951
  title: "Look up a user identity or a namespaced identity entity",
10904
- 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.",
10952
+ 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.",
10905
10953
  inputSchema: inputSchema20,
10906
10954
  handler: async (args) => {
10907
10955
  const kind = args.kind;
10908
10956
  const isUser = kind === "user";
10909
10957
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10910
10958
  const externalId = args.externalId;
10959
+ const contextId = args.contextId;
10911
10960
  const type = args.type;
10912
10961
  const field = args.field;
10913
10962
  const value = args.value;
@@ -10916,11 +10965,18 @@ var lookupPrincipal = ({ client, log }) => ({
10916
10965
  const prefix = args.prefix;
10917
10966
  const order = args.order;
10918
10967
  const startFrom = args.startFrom;
10968
+ if (contextId !== void 0 && isUser) {
10969
+ return toolError(
10970
+ "lookup_principal",
10971
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10972
+ );
10973
+ }
10974
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10919
10975
  try {
10920
10976
  let page;
10921
10977
  if (externalId !== void 0) {
10922
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10923
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10978
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10979
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10924
10980
  } else if (field !== void 0) {
10925
10981
  const hasEquality = value !== void 0;
10926
10982
  const hasRange = from !== void 0 || to !== void 0;
@@ -10948,8 +11004,8 @@ var lookupPrincipal = ({ client, log }) => ({
10948
11004
  );
10949
11005
  }
10950
11006
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10951
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10952
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
11007
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
11008
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10953
11009
  } else {
10954
11010
  return toolError(
10955
11011
  "lookup_principal",
@@ -10960,7 +11016,7 @@ var lookupPrincipal = ({ client, log }) => ({
10960
11016
  const nextCursor = page.nextCursor ?? null;
10961
11017
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10962
11018
  } catch (err) {
10963
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
11019
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10964
11020
  return toolError("lookup_principal", err);
10965
11021
  }
10966
11022
  }
@@ -11071,7 +11127,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11071
11127
  name: "identity",
11072
11128
  uri: "vectros://identity",
11073
11129
  title: "Current identity (tenant + principal scope)",
11074
- 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.",
11130
+ 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.",
11075
11131
  mimeType: "application/json",
11076
11132
  read: async () => {
11077
11133
  const identity = await resolveIdentity({ log, apiKey, environment });