@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.mjs CHANGED
@@ -2824,7 +2824,7 @@ var AuthClient = class {
2824
2824
  );
2825
2825
  }
2826
2826
  /**
2827
- * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2827
+ * Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope, and applies the same `identityOverrides` bounds the update endpoint documents — a scoped credential may not repoint or clear an identity value it does not itself hold). The `principalId` must name a principal that already exists: a `usr_` principal must be a live user in your tenant, so create the user before granting it a profile. A `usr_` id that names no such user is rejected, and no profile is created. `key_` principals are not checked this way. You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
2828
2828
  *
2829
2829
  * @param {Vectros.CreateAccessProfileRequest} request
2830
2830
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3925,7 +3925,7 @@ var AuthClient = class {
3925
3925
  );
3926
3926
  }
3927
3927
  /**
3928
- * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) with per-category credit estimates and a split between your live and test environments. Defaults to the current month when `year` and `month` are omitted. Requires the `billing:r` scope on scoped tokens; API keys always have access.
3928
+ * Returns full usage detail for the requested calendar month, broken down by category (search, documents, and records) with per-category credit estimates and a split between your live and test environments. Defaults to the current month when `year` and `month` are omitted. Requires the `billing:r` scope on scoped tokens; API keys always have access. **A token confined to a single app context sees only that context's usage**: totals, the environment split, and the `contexts` breakdown narrow to it, and the environment your context is not bound to is omitted (`null`), not zeroed. Only a token with cross-context reach sees your full account-wide totals. Two exceptions to the narrowing, since they have no per-context breakdown to narrow to: `reads.calls.used`/`reads.dataOut.bytes` (metered per account, not per context) read as `0` for a confined token rather than a narrowed figure — the corresponding overage-credit charge fields narrow correctly; and `credits.limit` stays your whole plan's ceiling, so `credits.remaining` may overstate the account's true remaining room.
3929
3929
  *
3930
3930
  * @param {Vectros.GetUsageRequest} request
3931
3931
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3988,7 +3988,7 @@ var AuthClient = class {
3988
3988
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/usage");
3989
3989
  }
3990
3990
  /**
3991
- * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability.
3991
+ * Retrieves a single registered issuer by issuerId. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context sees only an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key sees every context.
3992
3992
  *
3993
3993
  * @param {Vectros.GetIssuerRequest} request
3994
3994
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4046,13 +4046,14 @@ var AuthClient = class {
4046
4046
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4047
4047
  }
4048
4048
  /**
4049
- * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. Unconditional — unlike some other registry deletes on this API, this does not check for or block on any downstream reference. Any user account already created via this issuer (by a prior self-signup or accepted invite) is NOT deleted or modified, but that user can no longer obtain a NEW token this way once you deregister the issuer — every `POST /v1/auth/token/exchange` call against it will 404, with no distinction between an unknown issuer and one you just deregistered. Register a replacement issuer, or restore this one, before your users' current tokens expire if you want their access to continue uninterrupted.
4049
+ * Deregisters a trusted third-party IdP issuer. Requires a root API key or the bootstrap's provisioning capability. A credential confined to one app context may only deregister an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may deregister any issuer. Refused if any user account was ever created or matched via this issuer (by a prior self-signup or accepted invite, through `POST /v1/auth/token/exchange`) — that access cannot be silently orphaned. Deactivate the affected users first if you intend to cut off their access, or register a replacement issuer before removing this one. An issuer that has never been used for an exchange (no bound users yet) can always be deregistered.
4050
4050
  *
4051
4051
  * @param {Vectros.DeleteIssuerRequest} request
4052
4052
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4053
4053
  *
4054
4054
  * @throws {@link Vectros.ForbiddenError}
4055
4055
  * @throws {@link Vectros.NotFoundError}
4056
+ * @throws {@link Vectros.ConflictError}
4056
4057
  * @throws {@link Vectros.TooManyRequestsError}
4057
4058
  *
4058
4059
  * @example
@@ -4094,6 +4095,8 @@ var AuthClient = class {
4094
4095
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
4095
4096
  case 404:
4096
4097
  throw new NotFoundError(_response.error.body, _response.rawResponse);
4098
+ case 409:
4099
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4097
4100
  case 429:
4098
4101
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4099
4102
  default:
@@ -4112,7 +4115,7 @@ var AuthClient = class {
4112
4115
  );
4113
4116
  }
4114
4117
  /**
4115
- * Returns the issuers registered in your tenant. Requires a root API key or the bootstrap's provisioning capability. Returns a `{data, nextCursor}` envelope.
4118
+ * 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.
4116
4119
  *
4117
4120
  * @param {Vectros.ListIssuersRequest} request
4118
4121
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4169,7 +4172,7 @@ var AuthClient = class {
4169
4172
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4170
4173
  }
4171
4174
  /**
4172
- * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant.
4175
+ * 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`.
4173
4176
  *
4174
4177
  * @param {Vectros.IssuerRequest} request
4175
4178
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4280,7 +4283,7 @@ var AuthClient = class {
4280
4283
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/ping");
4281
4284
  }
4282
4285
  /**
4283
- * Returns the access profiles for the given principal across all of your contexts. Use this to answer questions like "which apps does this user have access to?" — for example, to build a member-access summary. Results are confined to your account. Requires the `profiles:r` scope.
4286
+ * Returns the access profiles for the given principal. Looking up your OWN principal — or holding the `context-directory-read` capability — returns the profiles across ALL of your contexts, letting you answer questions like "which apps does this user have access to?". A context-bound credential looking up a DIFFERENT principal instead sees only that principal's profile in your credential's own context (at most one result), never across contexts it has no authority over. Results are always confined to your account. Requires the `profiles:r` scope.
4284
4287
  *
4285
4288
  * @param {Vectros.ListProfilesForPrincipalRequest} request
4286
4289
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4559,7 +4562,7 @@ var AuthClient = class {
4559
4562
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/users/invite/resend");
4560
4563
  }
4561
4564
  /**
4562
- * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4565
+ * RFC 8693 OAuth 2.0 Token Exchange. Trades a JWT issued by a third-party identity provider you've registered (`POST /v1/auth/issuers`) for a Vectros `st_*` scoped bearer token — no Vectros credential required to call this endpoint. The exchanged token's scope is resolved entirely server-side from the matched user's access profile; this endpoint accepts no caller-supplied scope, resource, or audience parameter (RFC 8693 §2.1's `resource`/`audience`/`scope` are not used in v1 — the registered `(issuer, audience)` pair alone pins the target tenant and app context). On a first-time login (no existing Vectros identity for this subject), two opt-in binding paths exist: `invite_token` (a `PENDING` sub-user invitation), and — if the registration declares one or more self-signup policies — `signup_type` (a brand-new user is created and bound to the policy's configured role). If `invite_token` is present at all, it is the ONLY path tried — a failed invite never falls through to self-signup. Neither field is required for a subject with an existing identity. If your issuer is registered against more than one app context (each via its own audience), `context_id` selects which one to target; omit it when your token's `aud` claim matches only one registered context — the common case, unaffected by this field. Uses the OAuth-standard error envelope (`{"error":..., "error_description":...}`, RFC 6749 §5.2), NOT this API's usual `{"message":...}` shape — its client is generic OAuth tooling, not the Vectros SDK.
4563
4566
  *
4564
4567
  * @param {Vectros.TokenExchangeRequest} request
4565
4568
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6101,6 +6104,7 @@ var IdentityClient = class {
6101
6104
  * @example
6102
6105
  * await client.identity.listEntities({
6103
6106
  * namespace: "team",
6107
+ * contextId: "myapp",
6104
6108
  * startFrom: "b3BhcXVlLWN1cnNvci1mcm9tLXRoZS1wcmV2aW91cy1wYWdl"
6105
6109
  * })
6106
6110
  */
@@ -6110,6 +6114,7 @@ var IdentityClient = class {
6110
6114
  async __listEntities(request, requestOptions) {
6111
6115
  const {
6112
6116
  namespace,
6117
+ contextId,
6113
6118
  userId,
6114
6119
  externalId,
6115
6120
  scope,
@@ -6124,6 +6129,7 @@ var IdentityClient = class {
6124
6129
  limit
6125
6130
  } = request;
6126
6131
  const _queryParams = {
6132
+ contextId,
6127
6133
  userId,
6128
6134
  externalId,
6129
6135
  scope,
@@ -6182,6 +6188,7 @@ var IdentityClient = class {
6182
6188
  * @example
6183
6189
  * await client.identity.createEntity({
6184
6190
  * namespace: "team",
6191
+ * contextId: "myapp",
6185
6192
  * body: {
6186
6193
  * externalId: "team_eng_platform"
6187
6194
  * }
@@ -6191,9 +6198,10 @@ var IdentityClient = class {
6191
6198
  return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
6192
6199
  }
6193
6200
  async __createEntity(request, requestOptions) {
6194
- const { namespace, upsert, body: _body } = request;
6201
+ const { namespace, upsert, contextId, body: _body } = request;
6195
6202
  const _queryParams = {
6196
- upsert
6203
+ upsert,
6204
+ contextId
6197
6205
  };
6198
6206
  const _authRequest = await this._options.authProvider.getAuthRequest();
6199
6207
  const _headers = mergeHeaders(
@@ -6250,14 +6258,18 @@ var IdentityClient = class {
6250
6258
  * @example
6251
6259
  * await client.identity.getEntity({
6252
6260
  * namespace: "team",
6253
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6261
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6262
+ * contextId: "myapp"
6254
6263
  * })
6255
6264
  */
6256
6265
  getEntity(request, requestOptions) {
6257
6266
  return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
6258
6267
  }
6259
6268
  async __getEntity(request, requestOptions) {
6260
- const { namespace, id } = request;
6269
+ const { namespace, id, contextId } = request;
6270
+ const _queryParams = {
6271
+ contextId
6272
+ };
6261
6273
  const _authRequest = await this._options.authProvider.getAuthRequest();
6262
6274
  const _headers = mergeHeaders(
6263
6275
  _authRequest.headers,
@@ -6271,7 +6283,7 @@ var IdentityClient = class {
6271
6283
  ),
6272
6284
  method: "GET",
6273
6285
  headers: _headers,
6274
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6286
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6275
6287
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6276
6288
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6277
6289
  abortSignal: requestOptions?.abortSignal,
@@ -6308,6 +6320,7 @@ var IdentityClient = class {
6308
6320
  * await client.identity.updateEntity({
6309
6321
  * namespace: "team",
6310
6322
  * id: "id",
6323
+ * contextId: "myapp",
6311
6324
  * body: {
6312
6325
  * externalId: "team_eng_platform"
6313
6326
  * }
@@ -6317,7 +6330,10 @@ var IdentityClient = class {
6317
6330
  return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6318
6331
  }
6319
6332
  async __updateEntity(request, requestOptions) {
6320
- const { namespace, id, body: _body } = request;
6333
+ const { namespace, id, contextId, body: _body } = request;
6334
+ const _queryParams = {
6335
+ contextId
6336
+ };
6321
6337
  const _authRequest = await this._options.authProvider.getAuthRequest();
6322
6338
  const _headers = mergeHeaders(
6323
6339
  _authRequest.headers,
@@ -6332,7 +6348,7 @@ var IdentityClient = class {
6332
6348
  method: "PUT",
6333
6349
  headers: _headers,
6334
6350
  contentType: "application/json",
6335
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6351
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6336
6352
  requestType: "json",
6337
6353
  body: _body,
6338
6354
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6372,14 +6388,18 @@ var IdentityClient = class {
6372
6388
  * @example
6373
6389
  * await client.identity.deleteEntity({
6374
6390
  * namespace: "team",
6375
- * id: "id"
6391
+ * id: "id",
6392
+ * contextId: "myapp"
6376
6393
  * })
6377
6394
  */
6378
6395
  deleteEntity(request, requestOptions) {
6379
6396
  return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6380
6397
  }
6381
6398
  async __deleteEntity(request, requestOptions) {
6382
- const { namespace, id } = request;
6399
+ const { namespace, id, contextId } = request;
6400
+ const _queryParams = {
6401
+ contextId
6402
+ };
6383
6403
  const _authRequest = await this._options.authProvider.getAuthRequest();
6384
6404
  const _headers = mergeHeaders(
6385
6405
  _authRequest.headers,
@@ -6393,7 +6413,7 @@ var IdentityClient = class {
6393
6413
  ),
6394
6414
  method: "DELETE",
6395
6415
  headers: _headers,
6396
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6416
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6397
6417
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6398
6418
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6399
6419
  abortSignal: requestOptions?.abortSignal,
@@ -6436,6 +6456,7 @@ var IdentityClient = class {
6436
6456
  * @example
6437
6457
  * await client.identity.lookupEntities({
6438
6458
  * namespace: "team",
6459
+ * contextId: "myapp",
6439
6460
  * body: {
6440
6461
  * type: "person_v1",
6441
6462
  * field: "ssn"
@@ -6446,7 +6467,10 @@ var IdentityClient = class {
6446
6467
  return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6447
6468
  }
6448
6469
  async __lookupEntities(request, requestOptions) {
6449
- const { namespace, body: _body } = request;
6470
+ const { namespace, contextId, body: _body } = request;
6471
+ const _queryParams = {
6472
+ contextId
6473
+ };
6450
6474
  const _authRequest = await this._options.authProvider.getAuthRequest();
6451
6475
  const _headers = mergeHeaders(
6452
6476
  _authRequest.headers,
@@ -6461,7 +6485,7 @@ var IdentityClient = class {
6461
6485
  method: "POST",
6462
6486
  headers: _headers,
6463
6487
  contentType: "application/json",
6464
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6488
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6465
6489
  requestType: "json",
6466
6490
  body: _body,
6467
6491
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6505,15 +6529,17 @@ var IdentityClient = class {
6505
6529
  * @example
6506
6530
  * await client.identity.getEntityVersions({
6507
6531
  * namespace: "team",
6508
- * id: "id"
6532
+ * id: "id",
6533
+ * contextId: "myapp"
6509
6534
  * })
6510
6535
  */
6511
6536
  getEntityVersions(request, requestOptions) {
6512
6537
  return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6513
6538
  }
6514
6539
  async __getEntityVersions(request, requestOptions) {
6515
- const { namespace, id, startFrom } = request;
6540
+ const { namespace, id, contextId, startFrom } = request;
6516
6541
  const _queryParams = {
6542
+ contextId,
6517
6543
  startFrom
6518
6544
  };
6519
6545
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -6575,7 +6601,10 @@ var IdentityClient = class {
6575
6601
  return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6576
6602
  }
6577
6603
  async __getNamespace(request, requestOptions) {
6578
- const { namespace } = request;
6604
+ const { namespace, contextId } = request;
6605
+ const _queryParams = {
6606
+ contextId
6607
+ };
6579
6608
  const _authRequest = await this._options.authProvider.getAuthRequest();
6580
6609
  const _headers = mergeHeaders(
6581
6610
  _authRequest.headers,
@@ -6589,7 +6618,7 @@ var IdentityClient = class {
6589
6618
  ),
6590
6619
  method: "GET",
6591
6620
  headers: _headers,
6592
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6621
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6593
6622
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6594
6623
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6595
6624
  abortSignal: requestOptions?.abortSignal,
@@ -6614,7 +6643,7 @@ var IdentityClient = class {
6614
6643
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6615
6644
  }
6616
6645
  /**
6617
- * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
6646
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`, `specificityRank`) of a registered namespace. The namespace name and its `contextId` (which row is selected) are both immutable. Requires a root API key. `org` and `client` are updatable like any other namespace — there is no reserved-built-in exception.
6618
6647
  *
6619
6648
  * @param {Vectros.UpdateNamespaceRequest} request
6620
6649
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6636,7 +6665,10 @@ var IdentityClient = class {
6636
6665
  return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6637
6666
  }
6638
6667
  async __updateNamespace(request, requestOptions) {
6639
- const { namespace, body: _body } = request;
6668
+ const { namespace, contextId, body: _body } = request;
6669
+ const _queryParams = {
6670
+ contextId
6671
+ };
6640
6672
  const _authRequest = await this._options.authProvider.getAuthRequest();
6641
6673
  const _headers = mergeHeaders(
6642
6674
  _authRequest.headers,
@@ -6651,7 +6683,7 @@ var IdentityClient = class {
6651
6683
  method: "PUT",
6652
6684
  headers: _headers,
6653
6685
  contentType: "application/json",
6654
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6686
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6655
6687
  requestType: "json",
6656
6688
  body: _body,
6657
6689
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -6682,7 +6714,7 @@ var IdentityClient = class {
6682
6714
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6683
6715
  }
6684
6716
  /**
6685
- * Deletes a registered scope namespace. Requires a root API key. The reserved built-ins cannot be deleted. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6717
+ * Deletes a registered scope namespace. Requires a root API key. `org` and `client` are deletable like any other namespace — there is no reserved-built-in exception. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
6686
6718
  *
6687
6719
  * @param {Vectros.DeleteNamespaceRequest} request
6688
6720
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6700,7 +6732,10 @@ var IdentityClient = class {
6700
6732
  return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6701
6733
  }
6702
6734
  async __deleteNamespace(request, requestOptions) {
6703
- const { namespace } = request;
6735
+ const { namespace, contextId } = request;
6736
+ const _queryParams = {
6737
+ contextId
6738
+ };
6704
6739
  const _authRequest = await this._options.authProvider.getAuthRequest();
6705
6740
  const _headers = mergeHeaders(
6706
6741
  _authRequest.headers,
@@ -6714,7 +6749,7 @@ var IdentityClient = class {
6714
6749
  ),
6715
6750
  method: "DELETE",
6716
6751
  headers: _headers,
6717
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6752
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6718
6753
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6719
6754
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6720
6755
  abortSignal: requestOptions?.abortSignal,
@@ -6743,7 +6778,7 @@ var IdentityClient = class {
6743
6778
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6744
6779
  }
6745
6780
  /**
6746
- * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6781
+ * 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.
6747
6782
  *
6748
6783
  * @param {Vectros.ListNamespacesRequest} request
6749
6784
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -6755,10 +6790,11 @@ var IdentityClient = class {
6755
6790
  return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6756
6791
  }
6757
6792
  async __listNamespaces(request = {}, requestOptions) {
6758
- const { startFrom, limit } = request;
6793
+ const { startFrom, limit, contextId } = request;
6759
6794
  const _queryParams = {
6760
6795
  startFrom,
6761
- limit
6796
+ limit,
6797
+ contextId
6762
6798
  };
6763
6799
  const _authRequest = await this._options.authProvider.getAuthRequest();
6764
6800
  const _headers = mergeHeaders(
@@ -6793,9 +6829,9 @@ var IdentityClient = class {
6793
6829
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6794
6830
  }
6795
6831
  /**
6796
- * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Also requires `specificityRank`, an explicit, account-unique position in the specificity order used to break recordType schema-resolution ties. Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
6832
+ * 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.
6797
6833
  *
6798
- * @param {Vectros.NamespaceRequest} request
6834
+ * @param {Vectros.RegisterNamespaceRequest} request
6799
6835
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6800
6836
  *
6801
6837
  * @throws {@link Vectros.BadRequestError}
@@ -6804,14 +6840,20 @@ var IdentityClient = class {
6804
6840
  *
6805
6841
  * @example
6806
6842
  * await client.identity.registerNamespace({
6807
- * namespace: "team",
6808
- * specificityRank: 1500
6843
+ * body: {
6844
+ * namespace: "team",
6845
+ * specificityRank: 1500
6846
+ * }
6809
6847
  * })
6810
6848
  */
6811
6849
  registerNamespace(request, requestOptions) {
6812
6850
  return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6813
6851
  }
6814
6852
  async __registerNamespace(request, requestOptions) {
6853
+ const { contextId, body: _body } = request;
6854
+ const _queryParams = {
6855
+ contextId
6856
+ };
6815
6857
  const _authRequest = await this._options.authProvider.getAuthRequest();
6816
6858
  const _headers = mergeHeaders(
6817
6859
  _authRequest.headers,
@@ -6826,9 +6868,9 @@ var IdentityClient = class {
6826
6868
  method: "POST",
6827
6869
  headers: _headers,
6828
6870
  contentType: "application/json",
6829
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6871
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6830
6872
  requestType: "json",
6831
- body: request,
6873
+ body: _body,
6832
6874
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6833
6875
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6834
6876
  abortSignal: requestOptions?.abortSignal,
@@ -7113,12 +7155,13 @@ var IdentityClient = class {
7113
7155
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/users/{id}");
7114
7156
  }
7115
7157
  /**
7116
- * Permanently deletes a user identity. This cannot be undone. If the user is a pending invitation, the associated access profile created for that invitation is also removed. Requires the `users:d` scope.
7158
+ * 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.
7117
7159
  *
7118
7160
  * @param {Vectros.DeleteUserRequest} request
7119
7161
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
7120
7162
  *
7121
7163
  * @throws {@link Vectros.NotFoundError}
7164
+ * @throws {@link Vectros.ConflictError}
7122
7165
  * @throws {@link Vectros.TooManyRequestsError}
7123
7166
  *
7124
7167
  * @example
@@ -7158,6 +7201,8 @@ var IdentityClient = class {
7158
7201
  switch (_response.error.statusCode) {
7159
7202
  case 404:
7160
7203
  throw new NotFoundError(_response.error.body, _response.rawResponse);
7204
+ case 409:
7205
+ throw new ConflictError(_response.error.body, _response.rawResponse);
7161
7206
  case 429:
7162
7207
  throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
7163
7208
  default:
@@ -9062,8 +9107,8 @@ function warnOnSuboptimalKey(key, log) {
9062
9107
 
9063
9108
  // src/build-info.ts
9064
9109
  var BUILD_INFO = {
9065
- mcpServer: true ? "0.14.0" : "dev",
9066
- sdk: true ? "0.39.0" : "dev"
9110
+ mcpServer: true ? "0.15.0" : "dev",
9111
+ sdk: true ? "0.40.0" : "dev"
9067
9112
  };
9068
9113
  function formatBuildInfo() {
9069
9114
  return `vectros-mcp-server ${BUILD_INFO.mcpServer} (sdk ${BUILD_INFO.sdk})`;
@@ -9374,7 +9419,7 @@ var inputSchema = {
9374
9419
  // Ownership.
9375
9420
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9376
9421
  scope: z.string().optional().describe(
9377
- '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.'
9422
+ '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.'
9378
9423
  ),
9379
9424
  // Date window.
9380
9425
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9514,7 +9559,7 @@ var inputSchema2 = {
9514
9559
  // List-mode args:
9515
9560
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9516
9561
  scope: z2.string().optional().describe(
9517
- '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.'
9562
+ '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.'
9518
9563
  ),
9519
9564
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9520
9565
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9765,7 +9810,7 @@ var inputSchema4 = {
9765
9810
  folderId: z4.string().optional().describe("Group this record into a folder."),
9766
9811
  userId: z4.string().optional().describe("Owning user id."),
9767
9812
  scopes: z4.array(z4.string()).optional().describe(
9768
- '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.'
9813
+ '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.'
9769
9814
  )
9770
9815
  };
9771
9816
  var recordCreate = ({ client, log }) => ({
@@ -9889,7 +9934,7 @@ var inputSchema7 = {
9889
9934
  // whole-tenant corpus.
9890
9935
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9891
9936
  scope: z7.string().optional().describe(
9892
- '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.'
9937
+ '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.'
9893
9938
  ),
9894
9939
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9895
9940
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -10063,7 +10108,7 @@ var inputSchema9 = {
10063
10108
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
10064
10109
  ),
10065
10110
  scope: z9.string().optional().describe(
10066
- '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.'
10111
+ '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.'
10067
10112
  ),
10068
10113
  surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
10069
10114
  "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."
@@ -10213,7 +10258,7 @@ var inputSchema11 = {
10213
10258
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
10214
10259
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
10215
10260
  scope: z11.string().optional().describe(
10216
- '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.'
10261
+ '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.'
10217
10262
  ),
10218
10263
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
10219
10264
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -10324,7 +10369,7 @@ var inputSchema12 = {
10324
10369
  ),
10325
10370
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10326
10371
  scopes: z12.array(z12.string()).optional().describe(
10327
- '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).'
10372
+ '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).'
10328
10373
  ),
10329
10374
  expectedVersion: z12.number().int().optional().describe(
10330
10375
  "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."
@@ -10408,7 +10453,7 @@ var inputSchema14 = {
10408
10453
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10409
10454
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10410
10455
  scope: z14.string().optional().describe(
10411
- '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.'
10456
+ '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.'
10412
10457
  ),
10413
10458
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10414
10459
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
@@ -10457,7 +10502,7 @@ var inputSchema15 = {
10457
10502
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10458
10503
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10459
10504
  scopes: z15.array(z15.string()).optional().describe(
10460
- '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.'
10505
+ '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.'
10461
10506
  )
10462
10507
  };
10463
10508
  var folderCreate = ({ client, log }) => ({
@@ -10495,7 +10540,7 @@ var inputSchema16 = {
10495
10540
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10496
10541
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10497
10542
  scopes: z16.array(z16.string()).optional().describe(
10498
- '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).'
10543
+ '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).'
10499
10544
  ),
10500
10545
  expectedVersion: z16.number().int().optional().describe(
10501
10546
  "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."
@@ -10562,7 +10607,7 @@ var inputSchema18 = {
10562
10607
  var currentIdentity = ({ log, apiKey, environment }) => ({
10563
10608
  name: "current_identity",
10564
10609
  title: "Current identity (tenant + principal scope)",
10565
- 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.",
10610
+ 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.",
10566
10611
  inputSchema: inputSchema18,
10567
10612
  handler: async () => {
10568
10613
  try {
@@ -10685,7 +10730,7 @@ var inputSchema19 = {
10685
10730
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10686
10731
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10687
10732
  scopes: z18.array(z18.string()).optional().describe(
10688
- "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."
10733
+ "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."
10689
10734
  )
10690
10735
  };
10691
10736
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
@@ -10849,11 +10894,14 @@ var MCP_DEFAULT_LIMIT5 = 10;
10849
10894
  var MCP_MAX_LIMIT5 = 100;
10850
10895
  var inputSchema20 = {
10851
10896
  kind: z19.string().describe(
10852
- 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10897
+ '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.'
10853
10898
  ),
10854
10899
  externalId: z19.string().optional().describe(
10855
10900
  "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."
10856
10901
  ),
10902
+ contextId: z19.string().optional().describe(
10903
+ "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."
10904
+ ),
10857
10905
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
10858
10906
  type: z19.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
10859
10907
  field: z19.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
@@ -10870,13 +10918,14 @@ var inputSchema20 = {
10870
10918
  var lookupPrincipal = ({ client, log }) => ({
10871
10919
  name: "lookup_principal",
10872
10920
  title: "Look up a user identity or a namespaced identity entity",
10873
- 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.",
10921
+ 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.",
10874
10922
  inputSchema: inputSchema20,
10875
10923
  handler: async (args) => {
10876
10924
  const kind = args.kind;
10877
10925
  const isUser = kind === "user";
10878
10926
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10879
10927
  const externalId = args.externalId;
10928
+ const contextId = args.contextId;
10880
10929
  const type = args.type;
10881
10930
  const field = args.field;
10882
10931
  const value = args.value;
@@ -10885,11 +10934,18 @@ var lookupPrincipal = ({ client, log }) => ({
10885
10934
  const prefix = args.prefix;
10886
10935
  const order = args.order;
10887
10936
  const startFrom = args.startFrom;
10937
+ if (contextId !== void 0 && isUser) {
10938
+ return toolError(
10939
+ "lookup_principal",
10940
+ new Error("'contextId' does not apply to kind 'user' \u2014 the user surface is always tenant-wide.")
10941
+ );
10942
+ }
10943
+ const contextIdArg = contextId !== void 0 ? { contextId } : {};
10888
10944
  try {
10889
10945
  let page;
10890
10946
  if (externalId !== void 0) {
10891
- page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10892
- log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10947
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, ...contextIdArg, externalId, limit });
10948
+ log.debug({ tool: "lookup_principal", mode: "resolve", kind, contextId }, "lookup_principal resolve ok");
10893
10949
  } else if (field !== void 0) {
10894
10950
  const hasEquality = value !== void 0;
10895
10951
  const hasRange = from !== void 0 || to !== void 0;
@@ -10917,8 +10973,8 @@ var lookupPrincipal = ({ client, log }) => ({
10917
10973
  );
10918
10974
  }
10919
10975
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10920
- page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10921
- log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10976
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, ...contextIdArg, body: req });
10977
+ log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field, contextId }, "lookup_principal lookup ok");
10922
10978
  } else {
10923
10979
  return toolError(
10924
10980
  "lookup_principal",
@@ -10929,7 +10985,7 @@ var lookupPrincipal = ({ client, log }) => ({
10929
10985
  const nextCursor = page.nextCursor ?? null;
10930
10986
  return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10931
10987
  } catch (err) {
10932
- log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
10988
+ log.warn({ tool: "lookup_principal", kind, contextId, err: String(err) }, "lookup_principal failed");
10933
10989
  return toolError("lookup_principal", err);
10934
10990
  }
10935
10991
  }
@@ -11040,7 +11096,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
11040
11096
  name: "identity",
11041
11097
  uri: "vectros://identity",
11042
11098
  title: "Current identity (tenant + principal scope)",
11043
- 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.",
11099
+ 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.",
11044
11100
  mimeType: "application/json",
11045
11101
  read: async () => {
11046
11102
  const identity = await resolveIdentity({ log, apiKey, environment });