@vectros-ai/mcp-server 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/server.ts
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
 
4
- // ../../node_modules/@vectros-ai/sdk/dist/index.mjs
4
+ // node_modules/@vectros-ai/sdk/dist/index.mjs
5
5
  var __defProp = Object.defineProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
@@ -16,7 +16,6 @@ __export(api_exports, {
16
16
  BatchWriteRequest: () => BatchWriteRequest,
17
17
  BatchWriteResult: () => BatchWriteResult,
18
18
  ChatMessage: () => ChatMessage,
19
- ClientRequest: () => ClientRequest,
20
19
  ConflictError: () => ConflictError,
21
20
  ContentDeltaEvent: () => ContentDeltaEvent,
22
21
  ContentTooLargeError: () => ContentTooLargeError,
@@ -25,6 +24,7 @@ __export(api_exports, {
25
24
  DocumentRequest: () => DocumentRequest,
26
25
  DocumentResponse: () => DocumentResponse,
27
26
  DoneEvent: () => DoneEvent,
27
+ EntityRequest: () => EntityRequest,
28
28
  ErasureCertificate: () => ErasureCertificate,
29
29
  ErasureRequest: () => ErasureRequest,
30
30
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -37,15 +37,13 @@ __export(api_exports, {
37
37
  ForbiddenError: () => ForbiddenError,
38
38
  IdentityLookupRequest: () => IdentityLookupRequest,
39
39
  InternalServerError: () => InternalServerError,
40
- ListClientsRequestOrder: () => ListClientsRequestOrder,
41
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
40
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
42
41
  ListUsersRequestOrder: () => ListUsersRequestOrder,
43
42
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
44
43
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
45
44
  ModelDataVersionResponse: () => ModelDataVersionResponse,
46
45
  NotFoundError: () => NotFoundError,
47
46
  NotImplementedError: () => NotImplementedError,
48
- OrgRequest: () => OrgRequest,
49
47
  PaymentRequiredError: () => PaymentRequiredError,
50
48
  PingResponse: () => PingResponse,
51
49
  RagSearch: () => RagSearch,
@@ -286,11 +284,6 @@ var UnauthorizedError = class extends VectrosError {
286
284
  var auth_exports = {};
287
285
  var ErasureRequest;
288
286
  ((ErasureRequest2) => {
289
- ErasureRequest2.SubjectType = {
290
- User: "user",
291
- Client: "client",
292
- Org: "org"
293
- };
294
287
  ErasureRequest2.AuditDisposition = {
295
288
  RetainRedacted: "retain-redacted",
296
289
  Purge: "purge"
@@ -302,11 +295,6 @@ var ExportRequest;
302
295
  Tenant: "tenant",
303
296
  Subject: "subject"
304
297
  };
305
- ExportRequest2.SubjectType = {
306
- User: "user",
307
- Client: "client",
308
- Org: "org"
309
- };
310
298
  ExportRequest2.Format = {
311
299
  Ndjson: "ndjson"
312
300
  };
@@ -345,15 +333,10 @@ var LookupDocumentsRequestOrder = {
345
333
  var folders_exports = {};
346
334
  var identity_exports = {};
347
335
  __export(identity_exports, {
348
- ListClientsRequestOrder: () => ListClientsRequestOrder,
349
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
336
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
350
337
  ListUsersRequestOrder: () => ListUsersRequestOrder
351
338
  });
352
- var ListClientsRequestOrder = {
353
- Asc: "asc",
354
- Desc: "desc"
355
- };
356
- var ListOrgsRequestOrder = {
339
+ var ListEntitiesRequestOrder = {
357
340
  Asc: "asc",
358
341
  Desc: "desc"
359
342
  };
@@ -452,13 +435,6 @@ var ChatMessage;
452
435
  Assistant: "assistant"
453
436
  };
454
437
  })(ChatMessage || (ChatMessage = {}));
455
- var ClientRequest;
456
- ((ClientRequest2) => {
457
- ClientRequest2.Status = {
458
- Active: "ACTIVE",
459
- Suspended: "SUSPENDED"
460
- };
461
- })(ClientRequest || (ClientRequest = {}));
462
438
  var ContentDeltaEvent;
463
439
  ((ContentDeltaEvent2) => {
464
440
  ContentDeltaEvent2.Event = {
@@ -513,6 +489,13 @@ var DoneEvent;
513
489
  Done: "done"
514
490
  };
515
491
  })(DoneEvent || (DoneEvent = {}));
492
+ var EntityRequest;
493
+ ((EntityRequest2) => {
494
+ EntityRequest2.Status = {
495
+ Active: "ACTIVE",
496
+ Suspended: "SUSPENDED"
497
+ };
498
+ })(EntityRequest || (EntityRequest = {}));
516
499
  var ErasureCertificate;
517
500
  ((ErasureCertificate2) => {
518
501
  ErasureCertificate2.AuditDisposition = {
@@ -528,11 +511,6 @@ var ErasureRequestResponse;
528
511
  Completed: "completed",
529
512
  Failed: "failed"
530
513
  };
531
- ErasureRequestResponse2.SubjectType = {
532
- User: "user",
533
- Client: "client",
534
- Org: "org"
535
- };
536
514
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
537
515
  var ErrorEvent;
538
516
  ((ErrorEvent2) => {
@@ -558,11 +536,6 @@ var ExportRequestResponse;
558
536
  Tenant: "tenant",
559
537
  Subject: "subject"
560
538
  };
561
- ExportRequestResponse2.SubjectType = {
562
- User: "user",
563
- Client: "client",
564
- Org: "org"
565
- };
566
539
  })(ExportRequestResponse || (ExportRequestResponse = {}));
567
540
  var FieldDef;
568
541
  ((FieldDef2) => {
@@ -576,13 +549,6 @@ var FieldDef;
576
549
  Object: "object",
577
550
  Reference: "reference"
578
551
  };
579
- FieldDef2.TargetSurface = {
580
- Record: "record",
581
- Document: "document",
582
- User: "user",
583
- Org: "org",
584
- Client: "client"
585
- };
586
552
  })(FieldDef || (FieldDef = {}));
587
553
  var IdentityLookupRequest;
588
554
  ((IdentityLookupRequest2) => {
@@ -599,13 +565,6 @@ var ModelDataVersionResponse;
599
565
  Delete: "DELETE"
600
566
  };
601
567
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
602
- var OrgRequest;
603
- ((OrgRequest2) => {
604
- OrgRequest2.Status = {
605
- Active: "ACTIVE",
606
- Suspended: "SUSPENDED"
607
- };
608
- })(OrgRequest || (OrgRequest = {}));
609
568
  var PingResponse;
610
569
  ((PingResponse2) => {
611
570
  PingResponse2.Environment = {
@@ -635,11 +594,6 @@ var RagSearch;
635
594
  })(RagSearch || (RagSearch = {}));
636
595
  var ReadAccessLogResponse;
637
596
  ((ReadAccessLogResponse2) => {
638
- ReadAccessLogResponse2.SubjectType = {
639
- User: "user",
640
- Client: "client",
641
- Org: "org"
642
- };
643
597
  ReadAccessLogResponse2.Action = {
644
598
  Read: "read",
645
599
  List: "list",
@@ -650,6 +604,10 @@ var ReadAccessLogResponse;
650
604
  })(ReadAccessLogResponse || (ReadAccessLogResponse = {}));
651
605
  var RecordRequest;
652
606
  ((RecordRequest2) => {
607
+ RecordRequest2.Status = {
608
+ Active: "ACTIVE",
609
+ Archived: "ARCHIVED"
610
+ };
653
611
  RecordRequest2.IndexMode = {
654
612
  Hybrid: "HYBRID",
655
613
  Semantic: "SEMANTIC",
@@ -659,6 +617,10 @@ var RecordRequest;
659
617
  })(RecordRequest || (RecordRequest = {}));
660
618
  var RecordResponse;
661
619
  ((RecordResponse2) => {
620
+ RecordResponse2.Status = {
621
+ Active: "ACTIVE",
622
+ Archived: "ARCHIVED"
623
+ };
662
624
  RecordResponse2.IndexStatus = {
663
625
  PendingIndex: "PENDING_INDEX",
664
626
  Indexed: "INDEXED",
@@ -701,8 +663,7 @@ var SchemaRequest;
701
663
  Record: "record",
702
664
  Document: "document",
703
665
  User: "user",
704
- Org: "org",
705
- Client: "client"
666
+ Entity: "entity"
706
667
  };
707
668
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
708
669
  })(SchemaRequest || (SchemaRequest = {}));
@@ -725,8 +686,7 @@ var SchemaResponse;
725
686
  Record: "record",
726
687
  Document: "document",
727
688
  User: "user",
728
- Org: "org",
729
- Client: "client"
689
+ Entity: "entity"
730
690
  };
731
691
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
732
692
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2367,7 +2327,7 @@ var AuthClient = class {
2367
2327
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2368
2328
  }
2369
2329
  /**
2370
- * Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId`, plus optional `clientId`) within a `contextId` for the primary accounting query; `resourceId` within a `contextId` for 'who read this record'; `callerKeyId` for 'what did this credential read' (account-wide forensic); or `contextId` alone to enumerate a whole context. `from`/`to` bound the time window. Results are scoped to your account, derived from your token — never from input. Requires the `access-log:r` scope.
2330
+ * Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId`) within a `contextId` for the primary accounting query; `resourceId` within a `contextId` for 'who read this record'; `callerKeyId` for 'what did this credential read' (account-wide forensic); or `contextId` alone to enumerate a whole context. `from`/`to` bound the time window. Results are scoped to your account, derived from your token — never from input. Requires the `access-log:r` scope.
2371
2331
  *
2372
2332
  * @param {Vectros.GetAccessLogRequest} request
2373
2333
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2380,7 +2340,6 @@ var AuthClient = class {
2380
2340
  * subjectType: "user",
2381
2341
  * subjectId: "user_abc123",
2382
2342
  * contextId: "ctx_intake",
2383
- * clientId: "client_xyz789",
2384
2343
  * action: "read",
2385
2344
  * callerKeyId: "key_abc123",
2386
2345
  * resourceType: "intake_form",
@@ -2395,7 +2354,6 @@ var AuthClient = class {
2395
2354
  subjectType,
2396
2355
  subjectId,
2397
2356
  contextId,
2398
- clientId,
2399
2357
  from: from_,
2400
2358
  to,
2401
2359
  action,
@@ -2410,7 +2368,6 @@ var AuthClient = class {
2410
2368
  subjectType,
2411
2369
  subjectId,
2412
2370
  contextId,
2413
- clientId,
2414
2371
  from: from_,
2415
2372
  to,
2416
2373
  action,
@@ -2844,7 +2801,7 @@ var AuthClient = class {
2844
2801
  );
2845
2802
  }
2846
2803
  /**
2847
- * 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). 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` may set only `orgId` and `clientId`; 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.
2804
+ * 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). 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.
2848
2805
  *
2849
2806
  * @param {Vectros.CreateAccessProfileRequest} request
2850
2807
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -3133,7 +3090,7 @@ var AuthClient = class {
3133
3090
  * roleId: "engineering-member",
3134
3091
  * name: "Engineering Team Member",
3135
3092
  * scopes: [{
3136
- * allowed_actions: ["read", "write"]
3093
+ * allowed_actions: ["records:cru", "search:r"]
3137
3094
  * }]
3138
3095
  * }
3139
3096
  * })
@@ -3681,7 +3638,7 @@ var AuthClient = class {
3681
3638
  * roleId: "engineering-member",
3682
3639
  * name: "Engineering Team Member",
3683
3640
  * scopes: [{
3684
- * allowed_actions: ["read", "write"]
3641
+ * allowed_actions: ["records:cru", "search:r"]
3685
3642
  * }]
3686
3643
  * }
3687
3644
  * })
@@ -4134,7 +4091,7 @@ var AuthClient = class {
4134
4091
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4135
4092
  * },
4136
4093
  * dataScope: {
4137
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4094
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4138
4095
  * }
4139
4096
  * },
4140
4097
  * expiresInSeconds: 3600
@@ -4584,7 +4541,7 @@ var DocumentsClient = class {
4584
4541
  this._options = normalizeClientOptionsWithAuth(options);
4585
4542
  }
4586
4543
  /**
4587
- * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId`, `orgId`, or `clientId`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4544
+ * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId` or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4588
4545
  *
4589
4546
  * @param {Vectros.ListDocumentsRequest} request
4590
4547
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4592,8 +4549,7 @@ var DocumentsClient = class {
4592
4549
  * @example
4593
4550
  * await client.documents.listDocuments({
4594
4551
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4595
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4596
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4552
+ * scope: "group:eng-team",
4597
4553
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4598
4554
  * startFrom: "doc_prev123"
4599
4555
  * })
@@ -4602,11 +4558,10 @@ var DocumentsClient = class {
4602
4558
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4603
4559
  }
4604
4560
  async __listDocuments(request = {}, requestOptions) {
4605
- const { userId, orgId, clientId, folderId, startFrom, limit } = request;
4561
+ const { userId, scope, folderId, startFrom, limit } = request;
4606
4562
  const _queryParams = {
4607
4563
  userId,
4608
- orgId,
4609
- clientId,
4564
+ scope,
4610
4565
  folderId,
4611
4566
  startFrom,
4612
4567
  limit
@@ -4664,9 +4619,10 @@ var DocumentsClient = class {
4664
4619
  return HttpResponsePromise.fromPromise(this.__ingestDocument(request, requestOptions));
4665
4620
  }
4666
4621
  async __ingestDocument(request, requestOptions) {
4667
- const { upsert, body: _body } = request;
4622
+ const { upsert, allowClear, body: _body } = request;
4668
4623
  const _queryParams = {
4669
- upsert
4624
+ upsert,
4625
+ allowClear
4670
4626
  };
4671
4627
  const _authRequest = await this._options.authProvider.getAuthRequest();
4672
4628
  const _headers = mergeHeaders(
@@ -4790,7 +4746,10 @@ var DocumentsClient = class {
4790
4746
  return HttpResponsePromise.fromPromise(this.__updateDocument(request, requestOptions));
4791
4747
  }
4792
4748
  async __updateDocument(request, requestOptions) {
4793
- const { id, body: _body } = request;
4749
+ const { id, allowClear, body: _body } = request;
4750
+ const _queryParams = {
4751
+ allowClear
4752
+ };
4794
4753
  const _authRequest = await this._options.authProvider.getAuthRequest();
4795
4754
  const _headers = mergeHeaders(
4796
4755
  _authRequest.headers,
@@ -4805,7 +4764,7 @@ var DocumentsClient = class {
4805
4764
  method: "PUT",
4806
4765
  headers: _headers,
4807
4766
  contentType: "application/json",
4808
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4767
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
4809
4768
  requestType: "json",
4810
4769
  body: _body,
4811
4770
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -5334,7 +5293,7 @@ var FoldersClient = class {
5334
5293
  this._options = normalizeClientOptionsWithAuth(options);
5335
5294
  }
5336
5295
  /**
5337
- * Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId`, `orgId`, or `clientId`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
5296
+ * Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId` or `scope`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
5338
5297
  *
5339
5298
  * @param {Vectros.ListFoldersRequest} request
5340
5299
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5342,9 +5301,8 @@ var FoldersClient = class {
5342
5301
  * @example
5343
5302
  * await client.folders.listFolders({
5344
5303
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5345
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5346
5304
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5347
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5305
+ * scope: "group:eng-team",
5348
5306
  * startFrom: "fld_prev123"
5349
5307
  * })
5350
5308
  */
@@ -5352,12 +5310,11 @@ var FoldersClient = class {
5352
5310
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5353
5311
  }
5354
5312
  async __listFolders(request = {}, requestOptions) {
5355
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5313
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5356
5314
  const _queryParams = {
5357
5315
  parentFolderId,
5358
- orgId,
5359
5316
  userId,
5360
- clientId,
5317
+ scope,
5361
5318
  startFrom,
5362
5319
  limit
5363
5320
  };
@@ -5643,7 +5600,7 @@ var FoldersClient = class {
5643
5600
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5644
5601
  }
5645
5602
  /**
5646
- * Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `orgId`, `clientId`) are applied when present and left unchanged when omitted; sending any of these as null is rejected, because clearing a field is not supported in this release (omit it instead). `slug` and `parentFolderId` are immutable — a folder cannot be re-slugged or moved via the API — and the request is rejected if either is present. Pass `expectedVersion` for optimistic concurrency (you get a 409 if the folder changed since you last read it). Requires the `folders:u` scope.
5603
+ * Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `scopes`) are applied when present and left unchanged when omitted; sending any of these as null is rejected, because clearing a field is not supported in this release (omit it instead). `slug` and `parentFolderId` are immutable — a folder cannot be re-slugged or moved via the API — and the request is rejected if either is present. Pass `expectedVersion` for optimistic concurrency (you get a 409 if the folder changed since you last read it). Requires the `folders:u` scope.
5647
5604
  *
5648
5605
  * @param {Vectros.PatchFolderRequest} request
5649
5606
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5776,54 +5733,48 @@ var IdentityClient = class {
5776
5733
  this._options = normalizeClientOptionsWithAuth(options);
5777
5734
  }
5778
5735
  /**
5779
- * Returns a paginated list of clients in your account. Narrow the results with `orgId` or `userId`, or use `externalId` for an exact lookup by your own identifier. For schema-bound clients, you can also query by a schema-declared lookup field using `type`, `field`, and one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `clients:r` scope.
5736
+ * Returns a paginated list of entities in a namespace. Filter by `userId` (entities owned by a user), by `externalId` (exact lookup by your own identifier), or by `scope` (`scope=<namespace>:<value>` — entities that have that value as a parent, e.g. `scope=org:6ba7...`). Naming this namespace's own name in `scope` resolves the entity itself (`scope=team:6ba7...` on `/v1/entities/team` returns that team), since an entity is always in its own scope. `userId` and `scope` can be combined to narrow on both dimensions at once; `externalId` identifies a single entity and cannot be combined with either. Requires the `entities:r:<namespace>` scope.
5780
5737
  *
5781
- * @param {Vectros.ListClientsRequest} request
5738
+ * @param {Vectros.ListEntitiesRequest} request
5782
5739
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5783
5740
  *
5784
5741
  * @example
5785
- * await client.identity.listClients({
5786
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5787
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5788
- * externalId: "patient_789",
5789
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5790
- * type: "client_v1",
5791
- * field: "industry",
5792
- * value: "healthcare",
5793
- * prefix: "health"
5742
+ * await client.identity.listEntities({
5743
+ * namespace: "team"
5794
5744
  * })
5795
5745
  */
5796
- listClients(request = {}, requestOptions) {
5797
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5746
+ listEntities(request, requestOptions) {
5747
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5798
5748
  }
5799
- async __listClients(request = {}, requestOptions) {
5749
+ async __listEntities(request, requestOptions) {
5800
5750
  const {
5801
- orgId,
5751
+ namespace,
5802
5752
  userId,
5803
5753
  externalId,
5804
- startFrom,
5805
- limit,
5754
+ scope,
5806
5755
  type: type_,
5807
5756
  field,
5808
5757
  value,
5809
5758
  from: from_,
5810
5759
  to,
5811
5760
  prefix,
5812
- order
5761
+ order,
5762
+ startFrom,
5763
+ limit
5813
5764
  } = request;
5814
5765
  const _queryParams = {
5815
- orgId,
5816
5766
  userId,
5817
5767
  externalId,
5818
- startFrom,
5819
- limit,
5768
+ scope,
5820
5769
  type: type_,
5821
5770
  field,
5822
5771
  value,
5823
5772
  from: from_,
5824
5773
  to,
5825
5774
  prefix,
5826
- order: order != null ? order : void 0
5775
+ order: order != null ? order : void 0,
5776
+ startFrom,
5777
+ limit
5827
5778
  };
5828
5779
  const _authRequest = await this._options.authProvider.getAuthRequest();
5829
5780
  const _headers = mergeHeaders(
@@ -5834,7 +5785,7 @@ var IdentityClient = class {
5834
5785
  const _response = await fetcher({
5835
5786
  url: url_exports.join(
5836
5787
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5837
- "v1/clients"
5788
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5838
5789
  ),
5839
5790
  method: "GET",
5840
5791
  headers: _headers,
@@ -5855,12 +5806,12 @@ var IdentityClient = class {
5855
5806
  rawResponse: _response.rawResponse
5856
5807
  });
5857
5808
  }
5858
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5809
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5859
5810
  }
5860
5811
  /**
5861
- * Creates a new client identity in your account. This call is idempotent on `externalId`: if a client with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing client was returned) tells the two apart. To overwrite an existing client's content instead of returning it unchanged, set `?upsert=true` (this also requires the `clients:u` scope). Requires the `clients:c` scope.
5812
+ * Creates a new entity in the given namespace. This call is idempotent on `externalId` within the namespace: if an entity with the same `externalId` already exists, the existing record is returned instead of creating a duplicate (`created: false`, HTTP 200). To overwrite an existing entity's content instead of returning it unchanged, set `?upsert=true` (also requires the `entities:u:<namespace>` scope). The namespace must be entity-backed (`org`/`client`, or registered via `POST /v1/namespaces`). Requires the `entities:c:<namespace>` scope.
5862
5813
  *
5863
- * @param {Vectros.CreateClientRequest} request
5814
+ * @param {Vectros.CreateEntityRequest} request
5864
5815
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5865
5816
  *
5866
5817
  * @throws {@link Vectros.BadRequestError}
@@ -5868,17 +5819,18 @@ var IdentityClient = class {
5868
5819
  * @throws {@link Vectros.TooManyRequestsError}
5869
5820
  *
5870
5821
  * @example
5871
- * await client.identity.createClient({
5822
+ * await client.identity.createEntity({
5823
+ * namespace: "team",
5872
5824
  * body: {
5873
- * externalId: "patient_789"
5825
+ * externalId: "team_eng_platform"
5874
5826
  * }
5875
5827
  * })
5876
5828
  */
5877
- createClient(request, requestOptions) {
5878
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5829
+ createEntity(request, requestOptions) {
5830
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5879
5831
  }
5880
- async __createClient(request, requestOptions) {
5881
- const { upsert, body: _body } = request;
5832
+ async __createEntity(request, requestOptions) {
5833
+ const { namespace, upsert, body: _body } = request;
5882
5834
  const _queryParams = {
5883
5835
  upsert
5884
5836
  };
@@ -5891,7 +5843,7 @@ var IdentityClient = class {
5891
5843
  const _response = await fetcher({
5892
5844
  url: url_exports.join(
5893
5845
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5894
- "v1/clients"
5846
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5895
5847
  ),
5896
5848
  method: "POST",
5897
5849
  headers: _headers,
@@ -5924,26 +5876,27 @@ var IdentityClient = class {
5924
5876
  });
5925
5877
  }
5926
5878
  }
5927
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5879
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5928
5880
  }
5929
5881
  /**
5930
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5882
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5931
5883
  *
5932
- * @param {Vectros.GetClientRequest} request
5884
+ * @param {Vectros.GetEntityRequest} request
5933
5885
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5934
5886
  *
5935
5887
  * @throws {@link Vectros.NotFoundError}
5936
5888
  *
5937
5889
  * @example
5938
- * await client.identity.getClient({
5939
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5890
+ * await client.identity.getEntity({
5891
+ * namespace: "team",
5892
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5940
5893
  * })
5941
5894
  */
5942
- getClient(request, requestOptions) {
5943
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5895
+ getEntity(request, requestOptions) {
5896
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5944
5897
  }
5945
- async __getClient(request, requestOptions) {
5946
- const { id } = request;
5898
+ async __getEntity(request, requestOptions) {
5899
+ const { namespace, id } = request;
5947
5900
  const _authRequest = await this._options.authProvider.getAuthRequest();
5948
5901
  const _headers = mergeHeaders(
5949
5902
  _authRequest.headers,
@@ -5953,7 +5906,7 @@ var IdentityClient = class {
5953
5906
  const _response = await fetcher({
5954
5907
  url: url_exports.join(
5955
5908
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5956
- `v1/clients/${url_exports.encodePathParam(id)}`
5909
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5957
5910
  ),
5958
5911
  method: "GET",
5959
5912
  headers: _headers,
@@ -5979,30 +5932,31 @@ var IdentityClient = class {
5979
5932
  });
5980
5933
  }
5981
5934
  }
5982
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5935
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
5983
5936
  }
5984
5937
  /**
5985
- * Updates mutable fields on an existing client. Omitted fields are preserved (a null does not clear a field); when `payload` is supplied it replaces the stored payload in full rather than being deep-merged. Requires the `clients:u` scope.
5938
+ * Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Requires the `entities:u:<namespace>` scope.
5986
5939
  *
5987
- * @param {Vectros.UpdateClientRequest} request
5940
+ * @param {Vectros.UpdateEntityRequest} request
5988
5941
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5989
5942
  *
5990
5943
  * @throws {@link Vectros.NotFoundError}
5991
5944
  * @throws {@link Vectros.TooManyRequestsError}
5992
5945
  *
5993
5946
  * @example
5994
- * await client.identity.updateClient({
5947
+ * await client.identity.updateEntity({
5948
+ * namespace: "team",
5995
5949
  * id: "id",
5996
5950
  * body: {
5997
- * externalId: "patient_789"
5951
+ * externalId: "team_eng_platform"
5998
5952
  * }
5999
5953
  * })
6000
5954
  */
6001
- updateClient(request, requestOptions) {
6002
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5955
+ updateEntity(request, requestOptions) {
5956
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6003
5957
  }
6004
- async __updateClient(request, requestOptions) {
6005
- const { id, body: _body } = request;
5958
+ async __updateEntity(request, requestOptions) {
5959
+ const { namespace, id, body: _body } = request;
6006
5960
  const _authRequest = await this._options.authProvider.getAuthRequest();
6007
5961
  const _headers = mergeHeaders(
6008
5962
  _authRequest.headers,
@@ -6012,7 +5966,7 @@ var IdentityClient = class {
6012
5966
  const _response = await fetcher({
6013
5967
  url: url_exports.join(
6014
5968
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6015
- `v1/clients/${url_exports.encodePathParam(id)}`
5969
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6016
5970
  ),
6017
5971
  method: "PUT",
6018
5972
  headers: _headers,
@@ -6043,27 +5997,28 @@ var IdentityClient = class {
6043
5997
  });
6044
5998
  }
6045
5999
  }
6046
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6000
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6047
6001
  }
6048
6002
  /**
6049
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6003
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6050
6004
  *
6051
- * @param {Vectros.DeleteClientRequest} request
6005
+ * @param {Vectros.DeleteEntityRequest} request
6052
6006
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6053
6007
  *
6054
6008
  * @throws {@link Vectros.NotFoundError}
6055
6009
  * @throws {@link Vectros.TooManyRequestsError}
6056
6010
  *
6057
6011
  * @example
6058
- * await client.identity.deleteClient({
6012
+ * await client.identity.deleteEntity({
6013
+ * namespace: "team",
6059
6014
  * id: "id"
6060
6015
  * })
6061
6016
  */
6062
- deleteClient(request, requestOptions) {
6063
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6017
+ deleteEntity(request, requestOptions) {
6018
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6064
6019
  }
6065
- async __deleteClient(request, requestOptions) {
6066
- const { id } = request;
6020
+ async __deleteEntity(request, requestOptions) {
6021
+ const { namespace, id } = request;
6067
6022
  const _authRequest = await this._options.authProvider.getAuthRequest();
6068
6023
  const _headers = mergeHeaders(
6069
6024
  _authRequest.headers,
@@ -6073,7 +6028,7 @@ var IdentityClient = class {
6073
6028
  const _response = await fetcher({
6074
6029
  url: url_exports.join(
6075
6030
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6076
- `v1/clients/${url_exports.encodePathParam(id)}`
6031
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6077
6032
  ),
6078
6033
  method: "DELETE",
6079
6034
  headers: _headers,
@@ -6101,27 +6056,36 @@ var IdentityClient = class {
6101
6056
  });
6102
6057
  }
6103
6058
  }
6104
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6059
+ return handleNonStatusCodeError(
6060
+ _response.error,
6061
+ _response.rawResponse,
6062
+ "DELETE",
6063
+ "/v1/entities/{namespace}/{id}"
6064
+ );
6105
6065
  }
6106
6066
  /**
6107
- * Body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/clients`. Use this when looking up by a sensitive (blind-indexed) field: the value travels in the request body rather than the URL. The `GET` list rejects a sensitive field's value and directs you here. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6067
+ * Looks up entities in a namespace by a schema-declared field value, with the criteria in the request body instead of the URL. Use this for a sensitive field: the value travels in the body and never appears in the URL. Body equivalent of the `type`/`field`/`value` lookup on `GET /v1/entities/{namespace}`, which rejects sensitive-field values and directs you here. Requires the `entities:r:<namespace>` scope.
6108
6068
  *
6109
- * @param {Vectros.IdentityLookupRequest} request
6069
+ * @param {Vectros.LookupEntitiesRequest} request
6110
6070
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6111
6071
  *
6112
6072
  * @throws {@link Vectros.BadRequestError}
6113
6073
  * @throws {@link Vectros.TooManyRequestsError}
6114
6074
  *
6115
6075
  * @example
6116
- * await client.identity.lookupClients({
6117
- * type: "person_v1",
6118
- * field: "ssn"
6076
+ * await client.identity.lookupEntities({
6077
+ * namespace: "team",
6078
+ * body: {
6079
+ * type: "person_v1",
6080
+ * field: "ssn"
6081
+ * }
6119
6082
  * })
6120
6083
  */
6121
- lookupClients(request, requestOptions) {
6122
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6084
+ lookupEntities(request, requestOptions) {
6085
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6123
6086
  }
6124
- async __lookupClients(request, requestOptions) {
6087
+ async __lookupEntities(request, requestOptions) {
6088
+ const { namespace, body: _body } = request;
6125
6089
  const _authRequest = await this._options.authProvider.getAuthRequest();
6126
6090
  const _headers = mergeHeaders(
6127
6091
  _authRequest.headers,
@@ -6131,14 +6095,14 @@ var IdentityClient = class {
6131
6095
  const _response = await fetcher({
6132
6096
  url: url_exports.join(
6133
6097
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6134
- "v1/clients/lookup"
6098
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6135
6099
  ),
6136
6100
  method: "POST",
6137
6101
  headers: _headers,
6138
6102
  contentType: "application/json",
6139
6103
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6140
6104
  requestType: "json",
6141
- body: request,
6105
+ body: _body,
6142
6106
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6143
6107
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6144
6108
  abortSignal: requestOptions?.abortSignal,
@@ -6162,26 +6126,32 @@ var IdentityClient = class {
6162
6126
  });
6163
6127
  }
6164
6128
  }
6165
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6129
+ return handleNonStatusCodeError(
6130
+ _response.error,
6131
+ _response.rawResponse,
6132
+ "POST",
6133
+ "/v1/entities/{namespace}/lookup"
6134
+ );
6166
6135
  }
6167
6136
  /**
6168
- * Returns the audit trail of changes to a client, newest first. Identity auditing is always on, so this history is always available; sensitive field values are redacted in each version. The response is a `{data, nextCursor}` envelope. Requires the `clients:r` scope.
6137
+ * Returns the audit trail of changes made to an entity, newest first. Sensitive field values are redacted in the history. Requires the `entities:r:<namespace>` scope.
6169
6138
  *
6170
- * @param {Vectros.GetClientVersionsRequest} request
6139
+ * @param {Vectros.GetEntityVersionsRequest} request
6171
6140
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6172
6141
  *
6173
6142
  * @throws {@link Vectros.NotFoundError}
6174
6143
  *
6175
6144
  * @example
6176
- * await client.identity.getClientVersions({
6145
+ * await client.identity.getEntityVersions({
6146
+ * namespace: "team",
6177
6147
  * id: "id"
6178
6148
  * })
6179
6149
  */
6180
- getClientVersions(request, requestOptions) {
6181
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6150
+ getEntityVersions(request, requestOptions) {
6151
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6182
6152
  }
6183
- async __getClientVersions(request, requestOptions) {
6184
- const { id, startFrom } = request;
6153
+ async __getEntityVersions(request, requestOptions) {
6154
+ const { namespace, id, startFrom } = request;
6185
6155
  const _queryParams = {
6186
6156
  startFrom
6187
6157
  };
@@ -6194,7 +6164,7 @@ var IdentityClient = class {
6194
6164
  const _response = await fetcher({
6195
6165
  url: url_exports.join(
6196
6166
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6197
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6167
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6198
6168
  ),
6199
6169
  method: "GET",
6200
6170
  headers: _headers,
@@ -6220,174 +6190,31 @@ var IdentityClient = class {
6220
6190
  });
6221
6191
  }
6222
6192
  }
6223
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6224
- }
6225
- /**
6226
- * Returns a paginated list of organizations in your account. Filter by `userId` to return only the organizations owned by a specific user, or by `externalId` for an exact lookup using your own identifier. You can also query schema-declared lookup fields by supplying `type` and `field` together with one lookup mode (`value` for equality, `from`/`to` for a range, or `prefix`). Requires the `orgs:r` scope.
6227
- *
6228
- * @param {Vectros.ListOrgsRequest} request
6229
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6230
- *
6231
- * @example
6232
- * await client.identity.listOrgs({
6233
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6234
- * externalId: "clinic_001",
6235
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6236
- * type: "org_v1",
6237
- * field: "region",
6238
- * value: "us-east",
6239
- * prefix: "us-"
6240
- * })
6241
- */
6242
- listOrgs(request = {}, requestOptions) {
6243
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6244
- }
6245
- async __listOrgs(request = {}, requestOptions) {
6246
- const {
6247
- userId,
6248
- externalId,
6249
- startFrom,
6250
- limit,
6251
- type: type_,
6252
- field,
6253
- value,
6254
- from: from_,
6255
- to,
6256
- prefix,
6257
- order
6258
- } = request;
6259
- const _queryParams = {
6260
- userId,
6261
- externalId,
6262
- startFrom,
6263
- limit,
6264
- type: type_,
6265
- field,
6266
- value,
6267
- from: from_,
6268
- to,
6269
- prefix,
6270
- order: order != null ? order : void 0
6271
- };
6272
- const _authRequest = await this._options.authProvider.getAuthRequest();
6273
- const _headers = mergeHeaders(
6274
- _authRequest.headers,
6275
- this._options?.headers,
6276
- requestOptions?.headers
6277
- );
6278
- const _response = await fetcher({
6279
- url: url_exports.join(
6280
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6281
- "v1/orgs"
6282
- ),
6283
- method: "GET",
6284
- headers: _headers,
6285
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6286
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6287
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6288
- abortSignal: requestOptions?.abortSignal,
6289
- fetchFn: this._options?.fetch,
6290
- logging: this._options.logging
6291
- });
6292
- if (_response.ok) {
6293
- return { data: _response.body, rawResponse: _response.rawResponse };
6294
- }
6295
- if (_response.error.reason === "status-code") {
6296
- throw new VectrosError({
6297
- statusCode: _response.error.statusCode,
6298
- body: _response.error.body,
6299
- rawResponse: _response.rawResponse
6300
- });
6301
- }
6302
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6303
- }
6304
- /**
6305
- * Creates a new organization in your account. This call is idempotent on `externalId`: if an organization with the same `externalId` already exists, the existing record is returned instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing organization was returned) tells the two apart. To overwrite an existing organization's content instead of returning it unchanged, set `?upsert=true` (this also requires the `orgs:u` scope). Requires the `orgs:c` scope.
6306
- *
6307
- * @param {Vectros.CreateOrgRequest} request
6308
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6309
- *
6310
- * @throws {@link Vectros.BadRequestError}
6311
- * @throws {@link Vectros.ForbiddenError}
6312
- * @throws {@link Vectros.TooManyRequestsError}
6313
- *
6314
- * @example
6315
- * await client.identity.createOrg({
6316
- * body: {
6317
- * externalId: "clinic_001"
6318
- * }
6319
- * })
6320
- */
6321
- createOrg(request, requestOptions) {
6322
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6323
- }
6324
- async __createOrg(request, requestOptions) {
6325
- const { upsert, body: _body } = request;
6326
- const _queryParams = {
6327
- upsert
6328
- };
6329
- const _authRequest = await this._options.authProvider.getAuthRequest();
6330
- const _headers = mergeHeaders(
6331
- _authRequest.headers,
6332
- this._options?.headers,
6333
- requestOptions?.headers
6193
+ return handleNonStatusCodeError(
6194
+ _response.error,
6195
+ _response.rawResponse,
6196
+ "GET",
6197
+ "/v1/entities/{namespace}/{id}/versions"
6334
6198
  );
6335
- const _response = await fetcher({
6336
- url: url_exports.join(
6337
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6338
- "v1/orgs"
6339
- ),
6340
- method: "POST",
6341
- headers: _headers,
6342
- contentType: "application/json",
6343
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6344
- requestType: "json",
6345
- body: _body,
6346
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6347
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6348
- abortSignal: requestOptions?.abortSignal,
6349
- fetchFn: this._options?.fetch,
6350
- logging: this._options.logging
6351
- });
6352
- if (_response.ok) {
6353
- return { data: _response.body, rawResponse: _response.rawResponse };
6354
- }
6355
- if (_response.error.reason === "status-code") {
6356
- switch (_response.error.statusCode) {
6357
- case 400:
6358
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6359
- case 403:
6360
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6361
- case 429:
6362
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6363
- default:
6364
- throw new VectrosError({
6365
- statusCode: _response.error.statusCode,
6366
- body: _response.error.body,
6367
- rawResponse: _response.rawResponse
6368
- });
6369
- }
6370
- }
6371
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6372
6199
  }
6373
6200
  /**
6374
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6201
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6375
6202
  *
6376
- * @param {Vectros.GetOrgRequest} request
6203
+ * @param {Vectros.GetNamespaceRequest} request
6377
6204
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6378
6205
  *
6379
6206
  * @throws {@link Vectros.NotFoundError}
6380
6207
  *
6381
6208
  * @example
6382
- * await client.identity.getOrg({
6383
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6209
+ * await client.identity.getNamespace({
6210
+ * namespace: "team"
6384
6211
  * })
6385
6212
  */
6386
- getOrg(request, requestOptions) {
6387
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6213
+ getNamespace(request, requestOptions) {
6214
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6388
6215
  }
6389
- async __getOrg(request, requestOptions) {
6390
- const { id } = request;
6216
+ async __getNamespace(request, requestOptions) {
6217
+ const { namespace } = request;
6391
6218
  const _authRequest = await this._options.authProvider.getAuthRequest();
6392
6219
  const _headers = mergeHeaders(
6393
6220
  _authRequest.headers,
@@ -6397,7 +6224,7 @@ var IdentityClient = class {
6397
6224
  const _response = await fetcher({
6398
6225
  url: url_exports.join(
6399
6226
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6400
- `v1/orgs/${url_exports.encodePathParam(id)}`
6227
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6401
6228
  ),
6402
6229
  method: "GET",
6403
6230
  headers: _headers,
@@ -6423,30 +6250,31 @@ var IdentityClient = class {
6423
6250
  });
6424
6251
  }
6425
6252
  }
6426
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6253
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6427
6254
  }
6428
6255
  /**
6429
- * Updates the mutable fields of an organization. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied rather than deep-merged. Requires the `orgs:u` scope.
6256
+ * Updates the mutable fields (`entityBacked`, `defaultSchemaId`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
6430
6257
  *
6431
- * @param {Vectros.UpdateOrgRequest} request
6258
+ * @param {Vectros.UpdateNamespaceRequest} request
6432
6259
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6433
6260
  *
6261
+ * @throws {@link Vectros.ForbiddenError}
6434
6262
  * @throws {@link Vectros.NotFoundError}
6435
6263
  * @throws {@link Vectros.TooManyRequestsError}
6436
6264
  *
6437
6265
  * @example
6438
- * await client.identity.updateOrg({
6439
- * id: "id",
6266
+ * await client.identity.updateNamespace({
6267
+ * namespace: "team",
6440
6268
  * body: {
6441
- * externalId: "clinic_001"
6269
+ * namespace: "team"
6442
6270
  * }
6443
6271
  * })
6444
6272
  */
6445
- updateOrg(request, requestOptions) {
6446
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6273
+ updateNamespace(request, requestOptions) {
6274
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6447
6275
  }
6448
- async __updateOrg(request, requestOptions) {
6449
- const { id, body: _body } = request;
6276
+ async __updateNamespace(request, requestOptions) {
6277
+ const { namespace, body: _body } = request;
6450
6278
  const _authRequest = await this._options.authProvider.getAuthRequest();
6451
6279
  const _headers = mergeHeaders(
6452
6280
  _authRequest.headers,
@@ -6456,7 +6284,7 @@ var IdentityClient = class {
6456
6284
  const _response = await fetcher({
6457
6285
  url: url_exports.join(
6458
6286
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6459
- `v1/orgs/${url_exports.encodePathParam(id)}`
6287
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6460
6288
  ),
6461
6289
  method: "PUT",
6462
6290
  headers: _headers,
@@ -6475,6 +6303,8 @@ var IdentityClient = class {
6475
6303
  }
6476
6304
  if (_response.error.reason === "status-code") {
6477
6305
  switch (_response.error.statusCode) {
6306
+ case 403:
6307
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6478
6308
  case 404:
6479
6309
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6480
6310
  case 429:
@@ -6487,27 +6317,28 @@ var IdentityClient = class {
6487
6317
  });
6488
6318
  }
6489
6319
  }
6490
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6320
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6491
6321
  }
6492
6322
  /**
6493
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6323
+ * 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.
6494
6324
  *
6495
- * @param {Vectros.DeleteOrgRequest} request
6325
+ * @param {Vectros.DeleteNamespaceRequest} request
6496
6326
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6497
6327
  *
6328
+ * @throws {@link Vectros.ForbiddenError}
6498
6329
  * @throws {@link Vectros.NotFoundError}
6499
6330
  * @throws {@link Vectros.TooManyRequestsError}
6500
6331
  *
6501
6332
  * @example
6502
- * await client.identity.deleteOrg({
6503
- * id: "id"
6333
+ * await client.identity.deleteNamespace({
6334
+ * namespace: "team"
6504
6335
  * })
6505
6336
  */
6506
- deleteOrg(request, requestOptions) {
6507
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6337
+ deleteNamespace(request, requestOptions) {
6338
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6508
6339
  }
6509
- async __deleteOrg(request, requestOptions) {
6510
- const { id } = request;
6340
+ async __deleteNamespace(request, requestOptions) {
6341
+ const { namespace } = request;
6511
6342
  const _authRequest = await this._options.authProvider.getAuthRequest();
6512
6343
  const _headers = mergeHeaders(
6513
6344
  _authRequest.headers,
@@ -6517,7 +6348,7 @@ var IdentityClient = class {
6517
6348
  const _response = await fetcher({
6518
6349
  url: url_exports.join(
6519
6350
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6520
- `v1/orgs/${url_exports.encodePathParam(id)}`
6351
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6521
6352
  ),
6522
6353
  method: "DELETE",
6523
6354
  headers: _headers,
@@ -6533,6 +6364,8 @@ var IdentityClient = class {
6533
6364
  }
6534
6365
  if (_response.error.reason === "status-code") {
6535
6366
  switch (_response.error.statusCode) {
6367
+ case 403:
6368
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6536
6369
  case 404:
6537
6370
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6538
6371
  case 429:
@@ -6545,27 +6378,26 @@ var IdentityClient = class {
6545
6378
  });
6546
6379
  }
6547
6380
  }
6548
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6381
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6549
6382
  }
6550
6383
  /**
6551
- * Looks up organizations by a schema-declared field value, with the search criteria sent in the request body instead of the URL. Use this when looking up by a sensitive field: the value travels in the body and is never exposed in the URL. This is the body-based equivalent of the `type`/`field`/`value` lookup on `GET /v1/orgs`, which rejects sensitive-field values and directs you here. Returns a `{data, nextCursor}` envelope. Requires the `orgs:r` scope.
6384
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6552
6385
  *
6553
- * @param {Vectros.IdentityLookupRequest} request
6386
+ * @param {Vectros.ListNamespacesRequest} request
6554
6387
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6555
6388
  *
6556
- * @throws {@link Vectros.BadRequestError}
6557
- * @throws {@link Vectros.TooManyRequestsError}
6558
- *
6559
6389
  * @example
6560
- * await client.identity.lookupOrgs({
6561
- * type: "person_v1",
6562
- * field: "ssn"
6563
- * })
6390
+ * await client.identity.listNamespaces()
6564
6391
  */
6565
- lookupOrgs(request, requestOptions) {
6566
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6392
+ listNamespaces(request = {}, requestOptions) {
6393
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6567
6394
  }
6568
- async __lookupOrgs(request, requestOptions) {
6395
+ async __listNamespaces(request = {}, requestOptions) {
6396
+ const { startFrom, limit } = request;
6397
+ const _queryParams = {
6398
+ startFrom,
6399
+ limit
6400
+ };
6569
6401
  const _authRequest = await this._options.authProvider.getAuthRequest();
6570
6402
  const _headers = mergeHeaders(
6571
6403
  _authRequest.headers,
@@ -6575,14 +6407,11 @@ var IdentityClient = class {
6575
6407
  const _response = await fetcher({
6576
6408
  url: url_exports.join(
6577
6409
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6578
- "v1/orgs/lookup"
6410
+ "v1/namespaces"
6579
6411
  ),
6580
- method: "POST",
6412
+ method: "GET",
6581
6413
  headers: _headers,
6582
- contentType: "application/json",
6583
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6584
- requestType: "json",
6585
- body: request,
6414
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6586
6415
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6587
6416
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6588
6417
  abortSignal: requestOptions?.abortSignal,
@@ -6593,42 +6422,33 @@ var IdentityClient = class {
6593
6422
  return { data: _response.body, rawResponse: _response.rawResponse };
6594
6423
  }
6595
6424
  if (_response.error.reason === "status-code") {
6596
- switch (_response.error.statusCode) {
6597
- case 400:
6598
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6599
- case 429:
6600
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6601
- default:
6602
- throw new VectrosError({
6603
- statusCode: _response.error.statusCode,
6604
- body: _response.error.body,
6605
- rawResponse: _response.rawResponse
6606
- });
6607
- }
6425
+ throw new VectrosError({
6426
+ statusCode: _response.error.statusCode,
6427
+ body: _response.error.body,
6428
+ rawResponse: _response.rawResponse
6429
+ });
6608
6430
  }
6609
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6431
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6610
6432
  }
6611
6433
  /**
6612
- * Returns the audit trail of changes made to an organization, newest first. Version history is always recorded for identity entities, and sensitive field values are redacted in the history. Requires the `orgs:r` scope.
6434
+ * Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
6613
6435
  *
6614
- * @param {Vectros.GetOrgVersionsRequest} request
6436
+ * @param {Vectros.NamespaceRequest} request
6615
6437
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6616
6438
  *
6617
- * @throws {@link Vectros.NotFoundError}
6439
+ * @throws {@link Vectros.BadRequestError}
6440
+ * @throws {@link Vectros.ForbiddenError}
6441
+ * @throws {@link Vectros.TooManyRequestsError}
6618
6442
  *
6619
6443
  * @example
6620
- * await client.identity.getOrgVersions({
6621
- * id: "id"
6444
+ * await client.identity.registerNamespace({
6445
+ * namespace: "team"
6622
6446
  * })
6623
6447
  */
6624
- getOrgVersions(request, requestOptions) {
6625
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6448
+ registerNamespace(request, requestOptions) {
6449
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6626
6450
  }
6627
- async __getOrgVersions(request, requestOptions) {
6628
- const { id, startFrom } = request;
6629
- const _queryParams = {
6630
- startFrom
6631
- };
6451
+ async __registerNamespace(request, requestOptions) {
6632
6452
  const _authRequest = await this._options.authProvider.getAuthRequest();
6633
6453
  const _headers = mergeHeaders(
6634
6454
  _authRequest.headers,
@@ -6638,11 +6458,14 @@ var IdentityClient = class {
6638
6458
  const _response = await fetcher({
6639
6459
  url: url_exports.join(
6640
6460
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6641
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6461
+ "v1/namespaces"
6642
6462
  ),
6643
- method: "GET",
6463
+ method: "POST",
6644
6464
  headers: _headers,
6645
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6465
+ contentType: "application/json",
6466
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6467
+ requestType: "json",
6468
+ body: request,
6646
6469
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6647
6470
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6648
6471
  abortSignal: requestOptions?.abortSignal,
@@ -6654,8 +6477,12 @@ var IdentityClient = class {
6654
6477
  }
6655
6478
  if (_response.error.reason === "status-code") {
6656
6479
  switch (_response.error.statusCode) {
6657
- case 404:
6658
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6480
+ case 400:
6481
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6482
+ case 403:
6483
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6484
+ case 429:
6485
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6659
6486
  default:
6660
6487
  throw new VectrosError({
6661
6488
  statusCode: _response.error.statusCode,
@@ -6664,7 +6491,7 @@ var IdentityClient = class {
6664
6491
  });
6665
6492
  }
6666
6493
  }
6667
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6494
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6668
6495
  }
6669
6496
  /**
6670
6497
  * Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope.
@@ -7541,7 +7368,7 @@ var RecordsClient = class {
7541
7368
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7542
7369
  }
7543
7370
  /**
7544
- * Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `orgId`, `clientId`) further narrow the type and folder modes; the `recent` feed is standalone and ignores all filters. Each token only sees the record types it is scoped to read. Requires the `records:r` scope. By default the response returns the indexed projection of each record; set `includePayload=true` to include full payloads.
7371
+ * Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `scope`) further narrow the type and folder modes; the `recent` feed is standalone and ignores all filters. Each token only sees the record types it is scoped to read. Requires the `records:r` scope. By default the response returns the indexed projection of each record; set `includePayload=true` to include full payloads.
7545
7372
  *
7546
7373
  * @param {Vectros.ListRecordsRequest} request
7547
7374
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7551,8 +7378,7 @@ var RecordsClient = class {
7551
7378
  * type: "intake_form",
7552
7379
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7553
7380
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7554
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7555
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7381
+ * scope: "group:eng-team",
7556
7382
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7557
7383
  * })
7558
7384
  */
@@ -7560,13 +7386,12 @@ var RecordsClient = class {
7560
7386
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7561
7387
  }
7562
7388
  async __listRecords(request = {}, requestOptions) {
7563
- const { type: type_, folderId, userId, orgId, clientId, startFrom, limit, includePayload, recent } = request;
7389
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7564
7390
  const _queryParams = {
7565
7391
  type: type_,
7566
7392
  folderId,
7567
7393
  userId,
7568
- orgId,
7569
- clientId,
7394
+ scope,
7570
7395
  startFrom,
7571
7396
  limit,
7572
7397
  includePayload,
@@ -7631,9 +7456,10 @@ var RecordsClient = class {
7631
7456
  return HttpResponsePromise.fromPromise(this.__createRecord(request, requestOptions));
7632
7457
  }
7633
7458
  async __createRecord(request, requestOptions) {
7634
- const { upsert, body: _body } = request;
7459
+ const { upsert, allowClear, body: _body } = request;
7635
7460
  const _queryParams = {
7636
- upsert
7461
+ upsert,
7462
+ allowClear
7637
7463
  };
7638
7464
  const _authRequest = await this._options.authProvider.getAuthRequest();
7639
7465
  const _headers = mergeHeaders(
@@ -7755,7 +7581,10 @@ var RecordsClient = class {
7755
7581
  return HttpResponsePromise.fromPromise(this.__updateRecord(request, requestOptions));
7756
7582
  }
7757
7583
  async __updateRecord(request, requestOptions) {
7758
- const { id, body: _body } = request;
7584
+ const { id, allowClear, body: _body } = request;
7585
+ const _queryParams = {
7586
+ allowClear
7587
+ };
7759
7588
  const _authRequest = await this._options.authProvider.getAuthRequest();
7760
7589
  const _headers = mergeHeaders(
7761
7590
  _authRequest.headers,
@@ -7770,7 +7599,7 @@ var RecordsClient = class {
7770
7599
  method: "PUT",
7771
7600
  headers: _headers,
7772
7601
  contentType: "application/json",
7773
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
7602
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
7774
7603
  requestType: "json",
7775
7604
  body: _body,
7776
7605
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
@@ -7861,7 +7690,7 @@ var RecordsClient = class {
7861
7690
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7862
7691
  }
7863
7692
  /**
7864
- * Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `orgId`, `clientId`) are set when present and left unchanged when omitted; sending a top-level field as null is rejected (clearing a top-level field is not supported in this release — omit it instead). `typeName`, `schemaId`, `externalId`, and `indexMode` are immutable and rejected if present. The merged result is validated against the schema. Pass `expectedVersion` to make the patch conditional (optimistic concurrency, 409 on conflict). Requires the `records:u:<type>` scope.
7693
+ * Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `scopes`) are set when present and left unchanged when omitted; sending a top-level field as null is rejected (clearing a top-level field is not supported in this release — omit it instead). `typeName`, `schemaId`, `externalId`, and `indexMode` are immutable and rejected if present. The merged result is validated against the schema. Pass `expectedVersion` to make the patch conditional (optimistic concurrency, 409 on conflict). Requires the `records:u:<type>` scope.
7865
7694
  *
7866
7695
  * @param {Vectros.PatchRecordRequest} request
7867
7696
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8187,7 +8016,7 @@ var SchemasClient = class {
8187
8016
  this._options = normalizeClientOptionsWithAuth(options);
8188
8017
  }
8189
8018
  /**
8190
- * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `orgId` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (user, org, or client) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
8019
+ * Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (`user` or `entity`) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
8191
8020
  *
8192
8021
  * @param {Vectros.ListSchemasRequest} request
8193
8022
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8195,7 +8024,7 @@ var SchemasClient = class {
8195
8024
  * @example
8196
8025
  * await client.schemas.listSchemas({
8197
8026
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8198
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8027
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8199
8028
  * surface: "document",
8200
8029
  * recordType: "intake_form",
8201
8030
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8205,10 +8034,10 @@ var SchemasClient = class {
8205
8034
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8206
8035
  }
8207
8036
  async __listSchemas(request = {}, requestOptions) {
8208
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8037
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8209
8038
  const _queryParams = {
8210
8039
  userId,
8211
- orgId,
8040
+ scope,
8212
8041
  surface,
8213
8042
  recordType,
8214
8043
  startFrom,
@@ -8654,12 +8483,12 @@ var VectrosClient = class {
8654
8483
  get auth() {
8655
8484
  return this._auth ?? (this._auth = new AuthClient(this._options));
8656
8485
  }
8657
- get identity() {
8658
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8659
- }
8660
8486
  get documents() {
8661
8487
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8662
8488
  }
8489
+ get identity() {
8490
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8491
+ }
8663
8492
  get compliance() {
8664
8493
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8665
8494
  }
@@ -8762,8 +8591,8 @@ function warnOnSuboptimalKey(key, log) {
8762
8591
 
8763
8592
  // src/build-info.ts
8764
8593
  var BUILD_INFO = {
8765
- mcpServer: true ? "0.7.0" : "dev",
8766
- sdk: true ? "0.33.0" : "dev"
8594
+ mcpServer: true ? "0.10.0" : "dev",
8595
+ sdk: true ? "0.35.0" : "dev"
8767
8596
  };
8768
8597
 
8769
8598
  // src/log.ts
@@ -8999,7 +8828,7 @@ ${detail}${pointer}`
8999
8828
 
9000
8829
  // src/tools/hybrid_search.ts
9001
8830
  var MCP_DEFAULT_LIMIT = 3;
9002
- var MCP_MAX_LIMIT = 10;
8831
+ var MCP_MAX_LIMIT = 50;
9003
8832
  var MCP_RESPONSE_CHAR_BUDGET = 24e3;
9004
8833
  var SNIPPET_MAX_CHARS = 160;
9005
8834
  var INTERNAL_METADATA_KEYS = /* @__PURE__ */ new Set(["tenantId", "owner_id", "model_type", "rootFolderId", "folderId"]);
@@ -9033,9 +8862,9 @@ var inputSchema = {
9033
8862
  "Keyword-match precision for the BM25 leg (TEXT/HYBRID modes). OR = any term (broad recall), AND = all terms (higher precision), PHRASE = contiguous phrase. Default: PHRASE (slop 3) in HYBRID, OR in TEXT. (The advanced raw-query COMPLEX mode is intentionally not exposed here.)"
9034
8863
  ),
9035
8864
  limit: z.number().int().min(1).max(MCP_MAX_LIMIT).optional().describe(
9036
- `Max hits to return. MCP-specific cap of ${MCP_MAX_LIMIT} (vs API max of 50) to protect the agent context window. Default 3. Use offset for pagination.`
8865
+ `Max hits per page. Defaults to a low ${MCP_DEFAULT_LIMIT} to protect the agent context window; raise up to ${MCP_MAX_LIMIT} (the most a single search returns) in one call when you can accept the larger result, or page with \`offset\` instead.`
9037
8866
  ),
9038
- offset: z.number().int().min(0).optional().describe("Skip the first N hits \u2014 for pagination."),
8867
+ offset: z.number().int().min(0).max(200).optional().describe("Skip the first N hits \u2014 for pagination (0\u2013200)."),
9039
8868
  folderId: z.string().optional().describe("Scope to content in this EXACT folder (Vectros folder id)."),
9040
8869
  rootFolderId: z.string().optional().describe("Scope to content under this folder AND all its descendants (subtree-root folder id)."),
9041
8870
  // Content narrowing.
@@ -9048,8 +8877,9 @@ var inputSchema = {
9048
8877
  ),
9049
8878
  // Ownership.
9050
8879
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9051
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9052
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
8880
+ scope: z.string().optional().describe(
8881
+ '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.'
8882
+ ),
9053
8883
  // Date window.
9054
8884
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
9055
8885
  createdBefore: z.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
@@ -9067,7 +8897,7 @@ var inputSchema = {
9067
8897
  var hybridSearch = ({ client, log }) => ({
9068
8898
  name: "hybrid_search",
9069
8899
  title: "Hybrid search",
9070
- description: `Search the partner tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to 10 results (default 3) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/orgId/clientId), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:"OR".`,
8900
+ description: "Search your tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/scope), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
9071
8901
  inputSchema,
9072
8902
  handler: async (args) => {
9073
8903
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9085,8 +8915,7 @@ var hybridSearch = ({ client, log }) => ({
9085
8915
  typeName: args.typeName,
9086
8916
  filters: args.filters,
9087
8917
  userId: args.userId,
9088
- orgId: args.orgId,
9089
- clientId: args.clientId,
8918
+ scope: args.scope,
9090
8919
  createdAfter: args.createdAfter,
9091
8920
  createdBefore: args.createdBefore,
9092
8921
  minSimilarity: args.minSimilarity,
@@ -9113,6 +8942,12 @@ var hybridSearch = ({ client, log }) => ({
9113
8942
  envelope.returnedResults = shaped.length;
9114
8943
  text = JSON.stringify(envelope, null, 2);
9115
8944
  }
8945
+ const offset = args.offset ?? 0;
8946
+ const totalResults = result.totalResults;
8947
+ if (typeof totalResults === "number" && offset + shaped.length < totalResults) {
8948
+ envelope.hasMore = true;
8949
+ text = JSON.stringify(envelope, null, 2);
8950
+ }
9116
8951
  log.debug(
9117
8952
  { tool: "hybrid_search", mode, limit, returned: shaped.length, textLegEmpty },
9118
8953
  "hybrid_search ok"
@@ -9148,7 +8983,7 @@ async function drainPages(fetchPage) {
9148
8983
 
9149
8984
  // src/tools/record_query.ts
9150
8985
  var MCP_DEFAULT_LIMIT2 = 3;
9151
- var MCP_MAX_LIMIT2 = 10;
8986
+ var MCP_MAX_LIMIT2 = 100;
9152
8987
  var inputSchema2 = {
9153
8988
  type: z2.string().min(1, "type (record type) is required").describe('Record type / schema name (e.g. "patient", "clinical_note").'),
9154
8989
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
@@ -9164,16 +8999,18 @@ var inputSchema2 = {
9164
8999
  ),
9165
9000
  // List-mode args:
9166
9001
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9167
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9168
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9002
+ scope: z2.string().optional().describe(
9003
+ '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.'
9004
+ ),
9005
+ 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."),
9169
9006
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
9170
- `Max records to return. MCP-specific cap of ${MCP_MAX_LIMIT2} (vs API max of 100) to protect the agent context window. Default 3.`
9007
+ `Max records per page. Defaults to a low ${MCP_DEFAULT_LIMIT2} to protect the agent context window; raise up to ${MCP_MAX_LIMIT2} (the records API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
9171
9008
  )
9172
9009
  };
9173
9010
  var recordQuery = ({ client, log }) => ({
9174
9011
  name: "record_query",
9175
9012
  title: "Record query (list or lookup)",
9176
- description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId`/`orgId`/`clientId`.\nReturns up to 10 records (default 3). Mode is auto-detected from the arguments present.",
9013
+ description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
9177
9014
  inputSchema: inputSchema2,
9178
9015
  handler: async (args) => {
9179
9016
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9183,8 +9020,9 @@ var recordQuery = ({ client, log }) => ({
9183
9020
  const from = args.from;
9184
9021
  const to = args.to;
9185
9022
  const prefix = args.prefix;
9023
+ const startFrom = args.startFrom;
9186
9024
  try {
9187
- let records;
9025
+ let page;
9188
9026
  if (field) {
9189
9027
  const hasEquality = value !== void 0;
9190
9028
  const hasRange = from !== void 0 || to !== void 0;
@@ -9207,7 +9045,7 @@ var recordQuery = ({ client, log }) => ({
9207
9045
  if (hasRange && !(from !== void 0 && to !== void 0)) {
9208
9046
  return toolError("record_query", new Error("range lookup requires both 'from' and 'to'."));
9209
9047
  }
9210
- const page = await client.records.lookupRecordsByBody({
9048
+ page = await client.records.lookupRecordsByBody({
9211
9049
  type,
9212
9050
  field,
9213
9051
  value,
@@ -9215,29 +9053,30 @@ var recordQuery = ({ client, log }) => ({
9215
9053
  to,
9216
9054
  prefix,
9217
9055
  order: args.order,
9056
+ startFrom,
9218
9057
  limit
9219
9058
  });
9220
- records = pageItems(page);
9221
9059
  log.debug(
9222
- { tool: "record_query", mode: "lookup", type, field, returned: records.length },
9060
+ { tool: "record_query", mode: "lookup", type, field, returned: pageItems(page).length },
9223
9061
  "record_query lookup ok"
9224
9062
  );
9225
9063
  } else {
9226
- const page = await client.records.listRecords({
9064
+ page = await client.records.listRecords({
9227
9065
  type,
9228
9066
  userId: args.userId,
9229
- orgId: args.orgId,
9230
- clientId: args.clientId,
9067
+ scope: args.scope,
9068
+ startFrom,
9231
9069
  limit
9232
9070
  });
9233
- records = pageItems(page);
9234
9071
  log.debug(
9235
- { tool: "record_query", mode: "list", type, limit, returned: records.length },
9072
+ { tool: "record_query", mode: "list", type, limit, returned: pageItems(page).length },
9236
9073
  "record_query list ok"
9237
9074
  );
9238
9075
  }
9076
+ const records = pageItems(page);
9077
+ const nextCursor = page.nextCursor ?? null;
9239
9078
  return {
9240
- content: [{ type: "text", text: JSON.stringify(records, null, 2) }]
9079
+ content: [{ type: "text", text: JSON.stringify({ data: records, nextCursor }, null, 2) }]
9241
9080
  };
9242
9081
  } catch (err) {
9243
9082
  log.warn({ tool: "record_query", err: String(err) }, "record_query failed");
@@ -9359,8 +9198,9 @@ var inputSchema4 = {
9359
9198
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9360
9199
  folderId: z4.string().optional().describe("Group this record into a folder."),
9361
9200
  userId: z4.string().optional().describe("Owning user id."),
9362
- orgId: z4.string().optional().describe("Owning organization id."),
9363
- clientId: z4.string().optional().describe("Associated client id.")
9201
+ scopes: z4.array(z4.string()).optional().describe(
9202
+ '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.'
9203
+ )
9364
9204
  };
9365
9205
  var recordCreate = ({ client, log }) => ({
9366
9206
  name: "record_create",
@@ -9379,8 +9219,7 @@ var recordCreate = ({ client, log }) => ({
9379
9219
  status: args.status,
9380
9220
  folderId: args.folderId,
9381
9221
  userId: args.userId,
9382
- orgId: args.orgId,
9383
- clientId: args.clientId
9222
+ scopes: args.scopes
9384
9223
  }
9385
9224
  });
9386
9225
  log.debug({ tool: "record_create", type, id: created.id }, "record_create ok");
@@ -9465,24 +9304,27 @@ var record_delete_default = recordDelete;
9465
9304
  // src/tools/rag_ask.ts
9466
9305
  import { z as z7 } from "zod";
9467
9306
  var SEARCH_MCP_DEFAULT_LIMIT = 5;
9468
- var SEARCH_MCP_MAX_LIMIT = 10;
9307
+ var SEARCH_MCP_MAX_LIMIT = 50;
9469
9308
  var inputSchema7 = {
9470
9309
  query: z7.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
9471
9310
  instructions: z7.string().optional().describe(
9472
9311
  'System prompt that overrides the default for the generation step \u2014 e.g. "answer only from the provided context, cite sources, be concise". Default: a generic answer-from-context instruction.'
9473
9312
  ),
9474
9313
  model: z7.string().optional().describe(
9475
- "Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-4-6, claude-opus-4-8). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
9314
+ "Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-5, claude-opus-4-8). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
9476
9315
  ),
9477
9316
  search: z7.object({
9478
9317
  mode: z7.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
9479
- limit: z7.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(`Passages to retrieve before generating. Default ${SEARCH_MCP_DEFAULT_LIMIT}, max ${SEARCH_MCP_MAX_LIMIT}.`),
9318
+ limit: z7.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
9319
+ `Passages to retrieve before generating (the grounding-corpus size). Default ${SEARCH_MCP_DEFAULT_LIMIT}; raise up to ${SEARCH_MCP_MAX_LIMIT} (the RAG search API max) for a broader corpus when the extra grounding is worth the larger prompt.`
9320
+ ),
9480
9321
  // Retrieval scoping — parity with hybrid_search so an agent can ground the
9481
9322
  // answer on a specific owner / folder / type / metadata subset, not just the
9482
9323
  // whole-tenant corpus.
9483
9324
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9484
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9485
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9325
+ scope: z7.string().optional().describe(
9326
+ '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.'
9327
+ ),
9486
9328
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9487
9329
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
9488
9330
  typeName: z7.string().optional().describe("Restrict record retrieval to this schema type."),
@@ -9500,7 +9342,7 @@ var inputSchema7 = {
9500
9342
  var ragAsk = ({ client, log }) => ({
9501
9343
  name: "rag_ask",
9502
9344
  title: "RAG ask (corpus-wide)",
9503
- description: "Ask a question grounded against the partner tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership, folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
9345
+ description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership, folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
9504
9346
  inputSchema: inputSchema7,
9505
9347
  handler: async (args, extra) => {
9506
9348
  try {
@@ -9509,8 +9351,7 @@ var ragAsk = ({ client, log }) => ({
9509
9351
  mode: searchArg.mode ?? "HYBRID",
9510
9352
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9511
9353
  userId: searchArg.userId,
9512
- orgId: searchArg.orgId,
9513
- clientId: searchArg.clientId,
9354
+ scope: searchArg.scope,
9514
9355
  folderId: searchArg.folderId,
9515
9356
  rootFolderId: searchArg.rootFolderId,
9516
9357
  typeName: searchArg.typeName,
@@ -9655,32 +9496,32 @@ var inputSchema9 = {
9655
9496
  userId: z9.string().optional().describe(
9656
9497
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9657
9498
  ),
9658
- orgId: z9.string().optional().describe(
9659
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9499
+ scope: z9.string().optional().describe(
9500
+ '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.'
9660
9501
  ),
9661
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9662
- "Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. The identity surfaces (user/org/client) are account-wide. Optional."
9502
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9503
+ "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."
9663
9504
  ),
9664
9505
  recordType: z9.string().optional().describe(
9665
- 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|org|client` for an identity schema. Takes precedence over userId/orgId. Optional.'
9506
+ 'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
9666
9507
  )
9667
9508
  };
9668
9509
  var listSchemas = ({ client, log }) => ({
9669
9510
  name: "list_schemas",
9670
9511
  title: "List record schemas",
9671
- description: 'List the structured-record schema catalog for the partner tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/org/client \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`orgId`; default returns everything the credential can see.',
9512
+ description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
9672
9513
  inputSchema: inputSchema9,
9673
9514
  handler: async (args) => {
9674
9515
  const userId = args.userId;
9675
- const orgId = args.orgId;
9516
+ const scope = args.scope;
9676
9517
  const surface = args.surface;
9677
9518
  const recordType = args.recordType;
9678
9519
  try {
9679
9520
  const schemas = await drainPages(
9680
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9521
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9681
9522
  );
9682
9523
  log.debug(
9683
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9524
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9684
9525
  "list_schemas ok"
9685
9526
  );
9686
9527
  return {
@@ -9790,7 +9631,7 @@ var document_get_default = documentGet;
9790
9631
  // src/tools/document_query.ts
9791
9632
  import { z as z11 } from "zod";
9792
9633
  var MCP_DEFAULT_LIMIT3 = 3;
9793
- var MCP_MAX_LIMIT3 = 10;
9634
+ var MCP_MAX_LIMIT3 = 100;
9794
9635
  var inputSchema11 = {
9795
9636
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
9796
9637
  field: z11.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
@@ -9805,16 +9646,18 @@ var inputSchema11 = {
9805
9646
  // List-mode args:
9806
9647
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9807
9648
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9808
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9809
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9649
+ scope: z11.string().optional().describe(
9650
+ '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.'
9651
+ ),
9652
+ 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."),
9810
9653
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
9811
- `Max documents to return. MCP-specific cap of ${MCP_MAX_LIMIT3} (vs API max of 100) to protect the agent context window. Default 3.`
9654
+ `Max documents per page. Defaults to a low ${MCP_DEFAULT_LIMIT3} to protect the agent context window; raise up to ${MCP_MAX_LIMIT3} (the documents API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
9812
9655
  )
9813
9656
  };
9814
9657
  var documentQuery = ({ client, log }) => ({
9815
9658
  name: "document_query",
9816
9659
  title: "Document query (list or lookup)",
9817
- description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`orgId`/`clientId`.\nReturns up to 10 documents (default 3) as a bare array. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9660
+ description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
9818
9661
  inputSchema: inputSchema11,
9819
9662
  handler: async (args) => {
9820
9663
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9824,8 +9667,9 @@ var documentQuery = ({ client, log }) => ({
9824
9667
  const to = args.to;
9825
9668
  const prefix = args.prefix;
9826
9669
  const type = args.type;
9670
+ const startFrom = args.startFrom;
9827
9671
  try {
9828
- let documents;
9672
+ let page;
9829
9673
  if (field) {
9830
9674
  const hasEquality = value !== void 0;
9831
9675
  const hasRange = from !== void 0 || to !== void 0;
@@ -9854,7 +9698,7 @@ var documentQuery = ({ client, log }) => ({
9854
9698
  new Error("lookup requires 'type' (the document's bound schema type) alongside 'field'.")
9855
9699
  );
9856
9700
  }
9857
- const page = await client.documents.lookupDocumentsByBody({
9701
+ page = await client.documents.lookupDocumentsByBody({
9858
9702
  type,
9859
9703
  field,
9860
9704
  value,
@@ -9862,28 +9706,29 @@ var documentQuery = ({ client, log }) => ({
9862
9706
  to,
9863
9707
  prefix,
9864
9708
  order: args.order,
9709
+ startFrom,
9865
9710
  limit
9866
9711
  });
9867
- documents = pageItems(page);
9868
9712
  log.debug(
9869
- { tool: "document_query", mode: "lookup", type, field, returned: documents.length },
9713
+ { tool: "document_query", mode: "lookup", type, field, returned: pageItems(page).length },
9870
9714
  "document_query lookup ok"
9871
9715
  );
9872
9716
  } else {
9873
- const page = await client.documents.listDocuments({
9717
+ page = await client.documents.listDocuments({
9874
9718
  folderId: args.folderId,
9875
9719
  userId: args.userId,
9876
- orgId: args.orgId,
9877
- clientId: args.clientId,
9720
+ scope: args.scope,
9721
+ startFrom,
9878
9722
  limit
9879
9723
  });
9880
- documents = pageItems(page);
9881
9724
  log.debug(
9882
- { tool: "document_query", mode: "list", limit, returned: documents.length },
9725
+ { tool: "document_query", mode: "list", limit, returned: pageItems(page).length },
9883
9726
  "document_query list ok"
9884
9727
  );
9885
9728
  }
9886
- return { content: [{ type: "text", text: JSON.stringify(documents, null, 2) }] };
9729
+ const documents = pageItems(page);
9730
+ const nextCursor = page.nextCursor ?? null;
9731
+ return { content: [{ type: "text", text: JSON.stringify({ data: documents, nextCursor }, null, 2) }] };
9887
9732
  } catch (err) {
9888
9733
  log.warn({ tool: "document_query", err: String(err) }, "document_query failed");
9889
9734
  return toolError("document_query", err);
@@ -9912,8 +9757,9 @@ var inputSchema12 = {
9912
9757
  "Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
9913
9758
  ),
9914
9759
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9915
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9916
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9760
+ scopes: z12.array(z12.string()).optional().describe(
9761
+ '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).'
9762
+ ),
9917
9763
  expectedVersion: z12.number().int().optional().describe(
9918
9764
  "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."
9919
9765
  )
@@ -9933,8 +9779,7 @@ var documentUpdate = ({ client, log }) => ({
9933
9779
  const folderId = args.folderId;
9934
9780
  const status = args.status;
9935
9781
  const userId = args.userId;
9936
- const orgId = args.orgId;
9937
- const clientId = args.clientId;
9782
+ const scopes = args.scopes;
9938
9783
  const expectedVersion = args.expectedVersion;
9939
9784
  try {
9940
9785
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -9946,8 +9791,7 @@ var documentUpdate = ({ client, log }) => ({
9946
9791
  if (folderId !== void 0) body.folderId = folderId;
9947
9792
  if (status !== void 0) body.status = status;
9948
9793
  if (userId !== void 0) body.userId = userId;
9949
- if (orgId !== void 0) body.orgId = orgId;
9950
- if (clientId !== void 0) body.clientId = clientId;
9794
+ if (scopes !== void 0) body.scopes = scopes;
9951
9795
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
9952
9796
  const updated = await client.documents.patchDocument({
9953
9797
  id: resolved.id,
@@ -9992,20 +9836,23 @@ var document_delete_default = documentDelete;
9992
9836
  // src/tools/folder_query.ts
9993
9837
  import { z as z14 } from "zod";
9994
9838
  var MCP_DEFAULT_LIMIT4 = 10;
9995
- var MCP_MAX_LIMIT4 = 50;
9839
+ var MCP_MAX_LIMIT4 = 100;
9996
9840
  var inputSchema14 = {
9997
9841
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
9998
9842
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
9999
9843
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10000
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10001
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9844
+ scope: z14.string().optional().describe(
9845
+ '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.'
9846
+ ),
10002
9847
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10003
- limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(`List mode: max folders to return. MCP cap of ${MCP_MAX_LIMIT4} (vs API 100). Default 10.`)
9848
+ limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
9849
+ `List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
9850
+ )
10004
9851
  };
10005
9852
  var folderQuery = ({ client, log }) => ({
10006
9853
  name: "folder_query",
10007
9854
  title: "Folder query (list or get)",
10008
- description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId`/`orgId`/`clientId`.\nList mode returns `{ data, nextCursor }` (default 10, max 50 per page); pass `nextCursor` back as `startFrom` to page through all folders. Get mode returns the single folder object.",
9855
+ description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
10009
9856
  inputSchema: inputSchema14,
10010
9857
  handler: async (args) => {
10011
9858
  const id = args.id;
@@ -10019,8 +9866,7 @@ var folderQuery = ({ client, log }) => ({
10019
9866
  const page = await client.folders.listFolders({
10020
9867
  parentFolderId: args.parentId,
10021
9868
  userId: args.userId,
10022
- orgId: args.orgId,
10023
- clientId: args.clientId,
9869
+ scope: args.scope,
10024
9870
  startFrom: args.startFrom,
10025
9871
  limit
10026
9872
  });
@@ -10044,8 +9890,9 @@ var inputSchema15 = {
10044
9890
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10045
9891
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10046
9892
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10047
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10048
- clientId: z15.string().optional().describe("Associated client (Vectros UUID).")
9893
+ scopes: z15.array(z15.string()).optional().describe(
9894
+ '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.'
9895
+ )
10049
9896
  };
10050
9897
  var folderCreate = ({ client, log }) => ({
10051
9898
  name: "folder_create",
@@ -10061,8 +9908,7 @@ var folderCreate = ({ client, log }) => ({
10061
9908
  parentFolderId: args.parentId,
10062
9909
  slug: args.slug,
10063
9910
  userId: args.userId,
10064
- orgId: args.orgId,
10065
- clientId: args.clientId
9911
+ scopes: args.scopes
10066
9912
  }
10067
9913
  });
10068
9914
  log.debug({ tool: "folder_create", id: folder.id, name: folder.name }, "folder_create ok");
@@ -10082,8 +9928,9 @@ var inputSchema16 = {
10082
9928
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10083
9929
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10084
9930
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10085
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10086
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9931
+ scopes: z16.array(z16.string()).optional().describe(
9932
+ '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).'
9933
+ ),
10087
9934
  expectedVersion: z16.number().int().optional().describe(
10088
9935
  "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."
10089
9936
  )
@@ -10098,16 +9945,14 @@ var folderUpdate = ({ client, log }) => ({
10098
9945
  const name = args.name;
10099
9946
  const description = args.description;
10100
9947
  const userId = args.userId;
10101
- const orgId = args.orgId;
10102
- const clientId = args.clientId;
9948
+ const scopes = args.scopes;
10103
9949
  const expectedVersion = args.expectedVersion;
10104
9950
  try {
10105
9951
  const body = {};
10106
9952
  if (name !== void 0) body.name = name;
10107
9953
  if (description !== void 0) body.description = description;
10108
9954
  if (userId !== void 0) body.userId = userId;
10109
- if (orgId !== void 0) body.orgId = orgId;
10110
- if (clientId !== void 0) body.clientId = clientId;
9955
+ if (scopes !== void 0) body.scopes = scopes;
10111
9956
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10112
9957
  const updated = await client.folders.patchFolder({ id, body });
10113
9958
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10273,8 +10118,9 @@ var inputSchema19 = {
10273
10118
  // Common (both modes):
10274
10119
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10275
10120
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10276
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10277
- clientId: z18.string().optional().describe("Owning client ID. Optional.")
10121
+ scopes: z18.array(z18.string()).optional().describe(
10122
+ "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."
10123
+ )
10278
10124
  };
10279
10125
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10280
10126
  name: "document_ingest",
@@ -10308,14 +10154,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10308
10154
  )
10309
10155
  );
10310
10156
  }
10157
+ if (filePath && args.scopes !== void 0) {
10158
+ return toolError(
10159
+ "document_ingest",
10160
+ new Error(
10161
+ "`scopes` is not supported with `filePath` \u2014 file uploads do not accept a scope declaration, and silently ignoring it could make an intended-private document team-visible. Use `text` mode to declare scopes, or omit `scopes` (the upload is stamped with the credential's full identity)."
10162
+ )
10163
+ );
10164
+ }
10311
10165
  const common = {
10312
10166
  folderId: args.folderId,
10313
10167
  payload: args.payload,
10314
10168
  schemaId,
10315
10169
  externalId: args.externalId,
10316
- userId: args.userId,
10317
- orgId: args.orgId,
10318
- clientId: args.clientId
10170
+ userId: args.userId
10319
10171
  };
10320
10172
  try {
10321
10173
  if (text) {
@@ -10325,6 +10177,9 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10325
10177
  title,
10326
10178
  text,
10327
10179
  indexMode,
10180
+ // Scope ownership is a TEXT-mode contract only (the upload-init
10181
+ // endpoint has no scopes field — see the gate above).
10182
+ scopes: args.scopes,
10328
10183
  ...common
10329
10184
  }
10330
10185
  });
@@ -10417,9 +10272,11 @@ var document_ingest_default = documentIngest;
10417
10272
  // src/tools/lookup_principal.ts
10418
10273
  import { z as z19 } from "zod";
10419
10274
  var MCP_DEFAULT_LIMIT5 = 10;
10420
- var MCP_MAX_LIMIT5 = 50;
10275
+ var MCP_MAX_LIMIT5 = 100;
10421
10276
  var inputSchema20 = {
10422
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10277
+ kind: z19.string().describe(
10278
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10279
+ ),
10423
10280
  externalId: z19.string().optional().describe(
10424
10281
  "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."
10425
10282
  ),
@@ -10431,15 +10288,19 @@ var inputSchema20 = {
10431
10288
  to: z19.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
10432
10289
  prefix: z19.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
10433
10290
  order: z19.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
10434
- limit: z19.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(`Max principals to return. MCP cap of ${MCP_MAX_LIMIT5} (vs API 100). Default ${MCP_DEFAULT_LIMIT5}.`)
10291
+ startFrom: z19.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10292
+ limit: z19.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
10293
+ `Max principals per page. Defaults to ${MCP_DEFAULT_LIMIT5}; raise up to ${MCP_MAX_LIMIT5} (the principals API max) in one call when you can accept the payload, or page with \`startFrom\`.`
10294
+ )
10435
10295
  };
10436
10296
  var lookupPrincipal = ({ client, log }) => ({
10437
10297
  name: "lookup_principal",
10438
- title: "Look up a user / org / client identity",
10439
- description: "Resolve a user, org, or client identity. 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 up to 50 principals (default 10) as a bare array. Read-only \u2014 does not create or modify identities.",
10298
+ title: "Look up a user identity or a namespaced identity entity",
10299
+ 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.",
10440
10300
  inputSchema: inputSchema20,
10441
10301
  handler: async (args) => {
10442
10302
  const kind = args.kind;
10303
+ const isUser = kind === "user";
10443
10304
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10444
10305
  const externalId = args.externalId;
10445
10306
  const type = args.type;
@@ -10449,16 +10310,11 @@ var lookupPrincipal = ({ client, log }) => ({
10449
10310
  const to = args.to;
10450
10311
  const prefix = args.prefix;
10451
10312
  const order = args.order;
10313
+ const startFrom = args.startFrom;
10452
10314
  try {
10453
10315
  let page;
10454
10316
  if (externalId !== void 0) {
10455
- if (kind === "user") {
10456
- page = await client.identity.listUsers({ externalId, limit });
10457
- } else if (kind === "org") {
10458
- page = await client.identity.listOrgs({ externalId, limit });
10459
- } else {
10460
- page = await client.identity.listClients({ externalId, limit });
10461
- }
10317
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10462
10318
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10463
10319
  } else if (field !== void 0) {
10464
10320
  const hasEquality = value !== void 0;
@@ -10486,14 +10342,8 @@ var lookupPrincipal = ({ client, log }) => ({
10486
10342
  new Error("lookup requires 'type' (the identity schema's record type) alongside 'field'.")
10487
10343
  );
10488
10344
  }
10489
- const req = { type, field, value, from, to, prefix, order, limit };
10490
- if (kind === "user") {
10491
- page = await client.identity.lookupUsers(req);
10492
- } else if (kind === "org") {
10493
- page = await client.identity.lookupOrgs(req);
10494
- } else {
10495
- page = await client.identity.lookupClients(req);
10496
- }
10345
+ const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10346
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10497
10347
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10498
10348
  } else {
10499
10349
  return toolError(
@@ -10502,7 +10352,8 @@ var lookupPrincipal = ({ client, log }) => ({
10502
10352
  );
10503
10353
  }
10504
10354
  const principals = pageItems(page);
10505
- return { content: [{ type: "text", text: JSON.stringify(principals, null, 2) }] };
10355
+ const nextCursor = page.nextCursor ?? null;
10356
+ return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
10506
10357
  } catch (err) {
10507
10358
  log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
10508
10359
  return toolError("lookup_principal", err);