@vectros-ai/mcp-server 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -57,7 +57,6 @@ __export2(api_exports, {
57
57
  BatchWriteRequest: () => BatchWriteRequest,
58
58
  BatchWriteResult: () => BatchWriteResult,
59
59
  ChatMessage: () => ChatMessage,
60
- ClientRequest: () => ClientRequest,
61
60
  ConflictError: () => ConflictError,
62
61
  ContentDeltaEvent: () => ContentDeltaEvent,
63
62
  ContentTooLargeError: () => ContentTooLargeError,
@@ -66,6 +65,7 @@ __export2(api_exports, {
66
65
  DocumentRequest: () => DocumentRequest,
67
66
  DocumentResponse: () => DocumentResponse,
68
67
  DoneEvent: () => DoneEvent,
68
+ EntityRequest: () => EntityRequest,
69
69
  ErasureCertificate: () => ErasureCertificate,
70
70
  ErasureRequest: () => ErasureRequest,
71
71
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -77,16 +77,15 @@ __export2(api_exports, {
77
77
  FileUploadRequest: () => FileUploadRequest,
78
78
  ForbiddenError: () => ForbiddenError,
79
79
  IdentityLookupRequest: () => IdentityLookupRequest,
80
+ IndexFailure: () => IndexFailure,
80
81
  InternalServerError: () => InternalServerError,
81
- ListClientsRequestOrder: () => ListClientsRequestOrder,
82
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
82
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
83
83
  ListUsersRequestOrder: () => ListUsersRequestOrder,
84
84
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
85
85
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
86
86
  ModelDataVersionResponse: () => ModelDataVersionResponse,
87
87
  NotFoundError: () => NotFoundError,
88
88
  NotImplementedError: () => NotImplementedError,
89
- OrgRequest: () => OrgRequest,
90
89
  PaymentRequiredError: () => PaymentRequiredError,
91
90
  PingResponse: () => PingResponse,
92
91
  RagSearch: () => RagSearch,
@@ -327,11 +326,6 @@ var UnauthorizedError = class extends VectrosError {
327
326
  var auth_exports = {};
328
327
  var ErasureRequest;
329
328
  ((ErasureRequest2) => {
330
- ErasureRequest2.SubjectType = {
331
- User: "user",
332
- Client: "client",
333
- Org: "org"
334
- };
335
329
  ErasureRequest2.AuditDisposition = {
336
330
  RetainRedacted: "retain-redacted",
337
331
  Purge: "purge"
@@ -343,11 +337,6 @@ var ExportRequest;
343
337
  Tenant: "tenant",
344
338
  Subject: "subject"
345
339
  };
346
- ExportRequest2.SubjectType = {
347
- User: "user",
348
- Client: "client",
349
- Org: "org"
350
- };
351
340
  ExportRequest2.Format = {
352
341
  Ndjson: "ndjson"
353
342
  };
@@ -386,15 +375,10 @@ var LookupDocumentsRequestOrder = {
386
375
  var folders_exports = {};
387
376
  var identity_exports = {};
388
377
  __export2(identity_exports, {
389
- ListClientsRequestOrder: () => ListClientsRequestOrder,
390
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
378
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
391
379
  ListUsersRequestOrder: () => ListUsersRequestOrder
392
380
  });
393
- var ListClientsRequestOrder = {
394
- Asc: "asc",
395
- Desc: "desc"
396
- };
397
- var ListOrgsRequestOrder = {
381
+ var ListEntitiesRequestOrder = {
398
382
  Asc: "asc",
399
383
  Desc: "desc"
400
384
  };
@@ -493,13 +477,6 @@ var ChatMessage;
493
477
  Assistant: "assistant"
494
478
  };
495
479
  })(ChatMessage || (ChatMessage = {}));
496
- var ClientRequest;
497
- ((ClientRequest2) => {
498
- ClientRequest2.Status = {
499
- Active: "ACTIVE",
500
- Suspended: "SUSPENDED"
501
- };
502
- })(ClientRequest || (ClientRequest = {}));
503
480
  var ContentDeltaEvent;
504
481
  ((ContentDeltaEvent2) => {
505
482
  ContentDeltaEvent2.Event = {
@@ -554,6 +531,13 @@ var DoneEvent;
554
531
  Done: "done"
555
532
  };
556
533
  })(DoneEvent || (DoneEvent = {}));
534
+ var EntityRequest;
535
+ ((EntityRequest2) => {
536
+ EntityRequest2.Status = {
537
+ Active: "ACTIVE",
538
+ Suspended: "SUSPENDED"
539
+ };
540
+ })(EntityRequest || (EntityRequest = {}));
557
541
  var ErasureCertificate;
558
542
  ((ErasureCertificate2) => {
559
543
  ErasureCertificate2.AuditDisposition = {
@@ -569,11 +553,6 @@ var ErasureRequestResponse;
569
553
  Completed: "completed",
570
554
  Failed: "failed"
571
555
  };
572
- ErasureRequestResponse2.SubjectType = {
573
- User: "user",
574
- Client: "client",
575
- Org: "org"
576
- };
577
556
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
578
557
  var ErrorEvent;
579
558
  ((ErrorEvent2) => {
@@ -599,11 +578,6 @@ var ExportRequestResponse;
599
578
  Tenant: "tenant",
600
579
  Subject: "subject"
601
580
  };
602
- ExportRequestResponse2.SubjectType = {
603
- User: "user",
604
- Client: "client",
605
- Org: "org"
606
- };
607
581
  })(ExportRequestResponse || (ExportRequestResponse = {}));
608
582
  var FieldDef;
609
583
  ((FieldDef2) => {
@@ -617,13 +591,6 @@ var FieldDef;
617
591
  Object: "object",
618
592
  Reference: "reference"
619
593
  };
620
- FieldDef2.TargetSurface = {
621
- Record: "record",
622
- Document: "document",
623
- User: "user",
624
- Org: "org",
625
- Client: "client"
626
- };
627
594
  })(FieldDef || (FieldDef = {}));
628
595
  var IdentityLookupRequest;
629
596
  ((IdentityLookupRequest2) => {
@@ -632,6 +599,17 @@ var IdentityLookupRequest;
632
599
  Desc: "desc"
633
600
  };
634
601
  })(IdentityLookupRequest || (IdentityLookupRequest = {}));
602
+ var IndexFailure;
603
+ ((IndexFailure2) => {
604
+ IndexFailure2.Code = {
605
+ SourceUnavailable: "SOURCE_UNAVAILABLE",
606
+ TextIndexFailed: "TEXT_INDEX_FAILED",
607
+ EmbeddingFailed: "EMBEDDING_FAILED",
608
+ IndexingFailed: "INDEXING_FAILED",
609
+ VectorLimitExceeded: "VECTOR_LIMIT_EXCEEDED",
610
+ Internal: "INTERNAL"
611
+ };
612
+ })(IndexFailure || (IndexFailure = {}));
635
613
  var ModelDataVersionResponse;
636
614
  ((ModelDataVersionResponse2) => {
637
615
  ModelDataVersionResponse2.ChangeType = {
@@ -640,13 +618,6 @@ var ModelDataVersionResponse;
640
618
  Delete: "DELETE"
641
619
  };
642
620
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
643
- var OrgRequest;
644
- ((OrgRequest2) => {
645
- OrgRequest2.Status = {
646
- Active: "ACTIVE",
647
- Suspended: "SUSPENDED"
648
- };
649
- })(OrgRequest || (OrgRequest = {}));
650
621
  var PingResponse;
651
622
  ((PingResponse2) => {
652
623
  PingResponse2.Environment = {
@@ -676,11 +647,6 @@ var RagSearch;
676
647
  })(RagSearch || (RagSearch = {}));
677
648
  var ReadAccessLogResponse;
678
649
  ((ReadAccessLogResponse2) => {
679
- ReadAccessLogResponse2.SubjectType = {
680
- User: "user",
681
- Client: "client",
682
- Org: "org"
683
- };
684
650
  ReadAccessLogResponse2.Action = {
685
651
  Read: "read",
686
652
  List: "list",
@@ -750,8 +716,7 @@ var SchemaRequest;
750
716
  Record: "record",
751
717
  Document: "document",
752
718
  User: "user",
753
- Org: "org",
754
- Client: "client"
719
+ Entity: "entity"
755
720
  };
756
721
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
757
722
  })(SchemaRequest || (SchemaRequest = {}));
@@ -774,8 +739,7 @@ var SchemaResponse;
774
739
  Record: "record",
775
740
  Document: "document",
776
741
  User: "user",
777
- Org: "org",
778
- Client: "client"
742
+ Entity: "entity"
779
743
  };
780
744
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
781
745
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2416,7 +2380,7 @@ var AuthClient = class {
2416
2380
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2417
2381
  }
2418
2382
  /**
2419
- * 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.
2383
+ * 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.
2420
2384
  *
2421
2385
  * @param {Vectros.GetAccessLogRequest} request
2422
2386
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2429,7 +2393,6 @@ var AuthClient = class {
2429
2393
  * subjectType: "user",
2430
2394
  * subjectId: "user_abc123",
2431
2395
  * contextId: "ctx_intake",
2432
- * clientId: "client_xyz789",
2433
2396
  * action: "read",
2434
2397
  * callerKeyId: "key_abc123",
2435
2398
  * resourceType: "intake_form",
@@ -2444,7 +2407,6 @@ var AuthClient = class {
2444
2407
  subjectType,
2445
2408
  subjectId,
2446
2409
  contextId,
2447
- clientId,
2448
2410
  from: from_,
2449
2411
  to,
2450
2412
  action,
@@ -2459,7 +2421,6 @@ var AuthClient = class {
2459
2421
  subjectType,
2460
2422
  subjectId,
2461
2423
  contextId,
2462
- clientId,
2463
2424
  from: from_,
2464
2425
  to,
2465
2426
  action,
@@ -2893,7 +2854,7 @@ var AuthClient = class {
2893
2854
  );
2894
2855
  }
2895
2856
  /**
2896
- * 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.
2857
+ * 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.
2897
2858
  *
2898
2859
  * @param {Vectros.CreateAccessProfileRequest} request
2899
2860
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4165,7 +4126,7 @@ var AuthClient = class {
4165
4126
  );
4166
4127
  }
4167
4128
  /**
4168
- * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user, organization, or client. Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4129
+ * Creates a short-lived JWT bearer token restricted to specific actions and, optionally, to a particular user or identity entity (in any namespace). Use this to hand a narrowly-scoped credential to a browser or downstream service so it never sees your root API key. Only callable with a root API key (`sk_*`).
4169
4130
  *
4170
4131
  * @param {Vectros.TokenRequest} request
4171
4132
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4183,7 +4144,7 @@ var AuthClient = class {
4183
4144
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4184
4145
  * },
4185
4146
  * dataScope: {
4186
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4147
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4187
4148
  * }
4188
4149
  * },
4189
4150
  * expiresInSeconds: 3600
@@ -4382,7 +4343,7 @@ var ComplianceClient = class {
4382
4343
  this._options = normalizeClientOptionsWithAuth(options);
4383
4344
  }
4384
4345
  /**
4385
- * Submits a right-to-erasure request for a single end-subject (a user, client, or organization). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4346
+ * Submits a right-to-erasure request for a single end-subject (a user, or an identity entity in any namespace). Erasure removes exactly the data the subject solely owns across the declared contexts, plus the subject's identity and lookup rows. It never touches another account's data and never cascades into another subject's data. The request is asynchronous: it returns 202 with a `requestId`; poll `GET /v1/erasure-requests/{id}` until the job completes to obtain the completion certificate. Requires a root API key — a scoped credential is rejected with 403.
4386
4347
  *
4387
4348
  * @param {Vectros.ErasureRequest} request
4388
4349
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4633,7 +4594,7 @@ var DocumentsClient = class {
4633
4594
  this._options = normalizeClientOptionsWithAuth(options);
4634
4595
  }
4635
4596
  /**
4636
- * Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId`, `orgId`, `clientId`, or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
4597
+ * 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.
4637
4598
  *
4638
4599
  * @param {Vectros.ListDocumentsRequest} request
4639
4600
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4641,8 +4602,6 @@ var DocumentsClient = class {
4641
4602
  * @example
4642
4603
  * await client.documents.listDocuments({
4643
4604
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4644
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4645
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4646
4605
  * scope: "group:eng-team",
4647
4606
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4648
4607
  * startFrom: "doc_prev123"
@@ -4652,11 +4611,9 @@ var DocumentsClient = class {
4652
4611
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4653
4612
  }
4654
4613
  async __listDocuments(request = {}, requestOptions) {
4655
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4614
+ const { userId, scope, folderId, startFrom, limit } = request;
4656
4615
  const _queryParams = {
4657
4616
  userId,
4658
- orgId,
4659
- clientId,
4660
4617
  scope,
4661
4618
  folderId,
4662
4619
  startFrom,
@@ -5389,7 +5346,7 @@ var FoldersClient = class {
5389
5346
  this._options = normalizeClientOptionsWithAuth(options);
5390
5347
  }
5391
5348
  /**
5392
- * 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.
5349
+ * 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.
5393
5350
  *
5394
5351
  * @param {Vectros.ListFoldersRequest} request
5395
5352
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5397,9 +5354,8 @@ var FoldersClient = class {
5397
5354
  * @example
5398
5355
  * await client.folders.listFolders({
5399
5356
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5400
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5401
5357
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5402
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5358
+ * scope: "group:eng-team",
5403
5359
  * startFrom: "fld_prev123"
5404
5360
  * })
5405
5361
  */
@@ -5407,12 +5363,11 @@ var FoldersClient = class {
5407
5363
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5408
5364
  }
5409
5365
  async __listFolders(request = {}, requestOptions) {
5410
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5366
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5411
5367
  const _queryParams = {
5412
5368
  parentFolderId,
5413
- orgId,
5414
5369
  userId,
5415
- clientId,
5370
+ scope,
5416
5371
  startFrom,
5417
5372
  limit
5418
5373
  };
@@ -5698,7 +5653,7 @@ var FoldersClient = class {
5698
5653
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5699
5654
  }
5700
5655
  /**
5701
- * 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.
5656
+ * 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.
5702
5657
  *
5703
5658
  * @param {Vectros.PatchFolderRequest} request
5704
5659
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5831,54 +5786,48 @@ var IdentityClient = class {
5831
5786
  this._options = normalizeClientOptionsWithAuth(options);
5832
5787
  }
5833
5788
  /**
5834
- * 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.
5789
+ * 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.
5835
5790
  *
5836
- * @param {Vectros.ListClientsRequest} request
5791
+ * @param {Vectros.ListEntitiesRequest} request
5837
5792
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5838
5793
  *
5839
5794
  * @example
5840
- * await client.identity.listClients({
5841
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5842
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5843
- * externalId: "patient_789",
5844
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5845
- * type: "client_v1",
5846
- * field: "industry",
5847
- * value: "healthcare",
5848
- * prefix: "health"
5795
+ * await client.identity.listEntities({
5796
+ * namespace: "team"
5849
5797
  * })
5850
5798
  */
5851
- listClients(request = {}, requestOptions) {
5852
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5799
+ listEntities(request, requestOptions) {
5800
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5853
5801
  }
5854
- async __listClients(request = {}, requestOptions) {
5802
+ async __listEntities(request, requestOptions) {
5855
5803
  const {
5856
- orgId,
5804
+ namespace,
5857
5805
  userId,
5858
5806
  externalId,
5859
- startFrom,
5860
- limit,
5807
+ scope,
5861
5808
  type: type_,
5862
5809
  field,
5863
5810
  value,
5864
5811
  from: from_,
5865
5812
  to,
5866
5813
  prefix,
5867
- order
5814
+ order,
5815
+ startFrom,
5816
+ limit
5868
5817
  } = request;
5869
5818
  const _queryParams = {
5870
- orgId,
5871
5819
  userId,
5872
5820
  externalId,
5873
- startFrom,
5874
- limit,
5821
+ scope,
5875
5822
  type: type_,
5876
5823
  field,
5877
5824
  value,
5878
5825
  from: from_,
5879
5826
  to,
5880
5827
  prefix,
5881
- order: order != null ? order : void 0
5828
+ order: order != null ? order : void 0,
5829
+ startFrom,
5830
+ limit
5882
5831
  };
5883
5832
  const _authRequest = await this._options.authProvider.getAuthRequest();
5884
5833
  const _headers = mergeHeaders(
@@ -5889,7 +5838,7 @@ var IdentityClient = class {
5889
5838
  const _response = await fetcher({
5890
5839
  url: url_exports.join(
5891
5840
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5892
- "v1/clients"
5841
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5893
5842
  ),
5894
5843
  method: "GET",
5895
5844
  headers: _headers,
@@ -5910,12 +5859,12 @@ var IdentityClient = class {
5910
5859
  rawResponse: _response.rawResponse
5911
5860
  });
5912
5861
  }
5913
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5862
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5914
5863
  }
5915
5864
  /**
5916
- * 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.
5865
+ * 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.
5917
5866
  *
5918
- * @param {Vectros.CreateClientRequest} request
5867
+ * @param {Vectros.CreateEntityRequest} request
5919
5868
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5920
5869
  *
5921
5870
  * @throws {@link Vectros.BadRequestError}
@@ -5923,17 +5872,18 @@ var IdentityClient = class {
5923
5872
  * @throws {@link Vectros.TooManyRequestsError}
5924
5873
  *
5925
5874
  * @example
5926
- * await client.identity.createClient({
5875
+ * await client.identity.createEntity({
5876
+ * namespace: "team",
5927
5877
  * body: {
5928
- * externalId: "patient_789"
5878
+ * externalId: "team_eng_platform"
5929
5879
  * }
5930
5880
  * })
5931
5881
  */
5932
- createClient(request, requestOptions) {
5933
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5882
+ createEntity(request, requestOptions) {
5883
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5934
5884
  }
5935
- async __createClient(request, requestOptions) {
5936
- const { upsert, body: _body } = request;
5885
+ async __createEntity(request, requestOptions) {
5886
+ const { namespace, upsert, body: _body } = request;
5937
5887
  const _queryParams = {
5938
5888
  upsert
5939
5889
  };
@@ -5946,7 +5896,7 @@ var IdentityClient = class {
5946
5896
  const _response = await fetcher({
5947
5897
  url: url_exports.join(
5948
5898
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5949
- "v1/clients"
5899
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5950
5900
  ),
5951
5901
  method: "POST",
5952
5902
  headers: _headers,
@@ -5979,26 +5929,27 @@ var IdentityClient = class {
5979
5929
  });
5980
5930
  }
5981
5931
  }
5982
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5932
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5983
5933
  }
5984
5934
  /**
5985
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5935
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5986
5936
  *
5987
- * @param {Vectros.GetClientRequest} request
5937
+ * @param {Vectros.GetEntityRequest} request
5988
5938
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5989
5939
  *
5990
5940
  * @throws {@link Vectros.NotFoundError}
5991
5941
  *
5992
5942
  * @example
5993
- * await client.identity.getClient({
5994
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5943
+ * await client.identity.getEntity({
5944
+ * namespace: "team",
5945
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5995
5946
  * })
5996
5947
  */
5997
- getClient(request, requestOptions) {
5998
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5948
+ getEntity(request, requestOptions) {
5949
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5999
5950
  }
6000
- async __getClient(request, requestOptions) {
6001
- const { id } = request;
5951
+ async __getEntity(request, requestOptions) {
5952
+ const { namespace, id } = request;
6002
5953
  const _authRequest = await this._options.authProvider.getAuthRequest();
6003
5954
  const _headers = mergeHeaders(
6004
5955
  _authRequest.headers,
@@ -6008,7 +5959,7 @@ var IdentityClient = class {
6008
5959
  const _response = await fetcher({
6009
5960
  url: url_exports.join(
6010
5961
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6011
- `v1/clients/${url_exports.encodePathParam(id)}`
5962
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6012
5963
  ),
6013
5964
  method: "GET",
6014
5965
  headers: _headers,
@@ -6034,30 +5985,31 @@ var IdentityClient = class {
6034
5985
  });
6035
5986
  }
6036
5987
  }
6037
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5988
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
6038
5989
  }
6039
5990
  /**
6040
- * 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.
5991
+ * 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.
6041
5992
  *
6042
- * @param {Vectros.UpdateClientRequest} request
5993
+ * @param {Vectros.UpdateEntityRequest} request
6043
5994
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6044
5995
  *
6045
5996
  * @throws {@link Vectros.NotFoundError}
6046
5997
  * @throws {@link Vectros.TooManyRequestsError}
6047
5998
  *
6048
5999
  * @example
6049
- * await client.identity.updateClient({
6000
+ * await client.identity.updateEntity({
6001
+ * namespace: "team",
6050
6002
  * id: "id",
6051
6003
  * body: {
6052
- * externalId: "patient_789"
6004
+ * externalId: "team_eng_platform"
6053
6005
  * }
6054
6006
  * })
6055
6007
  */
6056
- updateClient(request, requestOptions) {
6057
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
6008
+ updateEntity(request, requestOptions) {
6009
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6058
6010
  }
6059
- async __updateClient(request, requestOptions) {
6060
- const { id, body: _body } = request;
6011
+ async __updateEntity(request, requestOptions) {
6012
+ const { namespace, id, body: _body } = request;
6061
6013
  const _authRequest = await this._options.authProvider.getAuthRequest();
6062
6014
  const _headers = mergeHeaders(
6063
6015
  _authRequest.headers,
@@ -6067,7 +6019,7 @@ var IdentityClient = class {
6067
6019
  const _response = await fetcher({
6068
6020
  url: url_exports.join(
6069
6021
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6070
- `v1/clients/${url_exports.encodePathParam(id)}`
6022
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6071
6023
  ),
6072
6024
  method: "PUT",
6073
6025
  headers: _headers,
@@ -6098,27 +6050,28 @@ var IdentityClient = class {
6098
6050
  });
6099
6051
  }
6100
6052
  }
6101
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6053
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6102
6054
  }
6103
6055
  /**
6104
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6056
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6105
6057
  *
6106
- * @param {Vectros.DeleteClientRequest} request
6058
+ * @param {Vectros.DeleteEntityRequest} request
6107
6059
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6108
6060
  *
6109
6061
  * @throws {@link Vectros.NotFoundError}
6110
6062
  * @throws {@link Vectros.TooManyRequestsError}
6111
6063
  *
6112
6064
  * @example
6113
- * await client.identity.deleteClient({
6065
+ * await client.identity.deleteEntity({
6066
+ * namespace: "team",
6114
6067
  * id: "id"
6115
6068
  * })
6116
6069
  */
6117
- deleteClient(request, requestOptions) {
6118
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6070
+ deleteEntity(request, requestOptions) {
6071
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6119
6072
  }
6120
- async __deleteClient(request, requestOptions) {
6121
- const { id } = request;
6073
+ async __deleteEntity(request, requestOptions) {
6074
+ const { namespace, id } = request;
6122
6075
  const _authRequest = await this._options.authProvider.getAuthRequest();
6123
6076
  const _headers = mergeHeaders(
6124
6077
  _authRequest.headers,
@@ -6128,7 +6081,7 @@ var IdentityClient = class {
6128
6081
  const _response = await fetcher({
6129
6082
  url: url_exports.join(
6130
6083
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6131
- `v1/clients/${url_exports.encodePathParam(id)}`
6084
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6132
6085
  ),
6133
6086
  method: "DELETE",
6134
6087
  headers: _headers,
@@ -6156,27 +6109,36 @@ var IdentityClient = class {
6156
6109
  });
6157
6110
  }
6158
6111
  }
6159
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6112
+ return handleNonStatusCodeError(
6113
+ _response.error,
6114
+ _response.rawResponse,
6115
+ "DELETE",
6116
+ "/v1/entities/{namespace}/{id}"
6117
+ );
6160
6118
  }
6161
6119
  /**
6162
- * 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.
6120
+ * 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.
6163
6121
  *
6164
- * @param {Vectros.IdentityLookupRequest} request
6122
+ * @param {Vectros.LookupEntitiesRequest} request
6165
6123
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6166
6124
  *
6167
6125
  * @throws {@link Vectros.BadRequestError}
6168
6126
  * @throws {@link Vectros.TooManyRequestsError}
6169
6127
  *
6170
6128
  * @example
6171
- * await client.identity.lookupClients({
6172
- * type: "person_v1",
6173
- * field: "ssn"
6129
+ * await client.identity.lookupEntities({
6130
+ * namespace: "team",
6131
+ * body: {
6132
+ * type: "person_v1",
6133
+ * field: "ssn"
6134
+ * }
6174
6135
  * })
6175
6136
  */
6176
- lookupClients(request, requestOptions) {
6177
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6137
+ lookupEntities(request, requestOptions) {
6138
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6178
6139
  }
6179
- async __lookupClients(request, requestOptions) {
6140
+ async __lookupEntities(request, requestOptions) {
6141
+ const { namespace, body: _body } = request;
6180
6142
  const _authRequest = await this._options.authProvider.getAuthRequest();
6181
6143
  const _headers = mergeHeaders(
6182
6144
  _authRequest.headers,
@@ -6186,14 +6148,14 @@ var IdentityClient = class {
6186
6148
  const _response = await fetcher({
6187
6149
  url: url_exports.join(
6188
6150
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6189
- "v1/clients/lookup"
6151
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6190
6152
  ),
6191
6153
  method: "POST",
6192
6154
  headers: _headers,
6193
6155
  contentType: "application/json",
6194
6156
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6195
6157
  requestType: "json",
6196
- body: request,
6158
+ body: _body,
6197
6159
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6198
6160
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6199
6161
  abortSignal: requestOptions?.abortSignal,
@@ -6217,26 +6179,32 @@ var IdentityClient = class {
6217
6179
  });
6218
6180
  }
6219
6181
  }
6220
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6182
+ return handleNonStatusCodeError(
6183
+ _response.error,
6184
+ _response.rawResponse,
6185
+ "POST",
6186
+ "/v1/entities/{namespace}/lookup"
6187
+ );
6221
6188
  }
6222
6189
  /**
6223
- * 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.
6190
+ * 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.
6224
6191
  *
6225
- * @param {Vectros.GetClientVersionsRequest} request
6192
+ * @param {Vectros.GetEntityVersionsRequest} request
6226
6193
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6227
6194
  *
6228
6195
  * @throws {@link Vectros.NotFoundError}
6229
6196
  *
6230
6197
  * @example
6231
- * await client.identity.getClientVersions({
6198
+ * await client.identity.getEntityVersions({
6199
+ * namespace: "team",
6232
6200
  * id: "id"
6233
6201
  * })
6234
6202
  */
6235
- getClientVersions(request, requestOptions) {
6236
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6203
+ getEntityVersions(request, requestOptions) {
6204
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6237
6205
  }
6238
- async __getClientVersions(request, requestOptions) {
6239
- const { id, startFrom } = request;
6206
+ async __getEntityVersions(request, requestOptions) {
6207
+ const { namespace, id, startFrom } = request;
6240
6208
  const _queryParams = {
6241
6209
  startFrom
6242
6210
  };
@@ -6249,7 +6217,7 @@ var IdentityClient = class {
6249
6217
  const _response = await fetcher({
6250
6218
  url: url_exports.join(
6251
6219
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6252
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6220
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6253
6221
  ),
6254
6222
  method: "GET",
6255
6223
  headers: _headers,
@@ -6275,174 +6243,31 @@ var IdentityClient = class {
6275
6243
  });
6276
6244
  }
6277
6245
  }
6278
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6279
- }
6280
- /**
6281
- * 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.
6282
- *
6283
- * @param {Vectros.ListOrgsRequest} request
6284
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6285
- *
6286
- * @example
6287
- * await client.identity.listOrgs({
6288
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6289
- * externalId: "clinic_001",
6290
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6291
- * type: "org_v1",
6292
- * field: "region",
6293
- * value: "us-east",
6294
- * prefix: "us-"
6295
- * })
6296
- */
6297
- listOrgs(request = {}, requestOptions) {
6298
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6299
- }
6300
- async __listOrgs(request = {}, requestOptions) {
6301
- const {
6302
- userId,
6303
- externalId,
6304
- startFrom,
6305
- limit,
6306
- type: type_,
6307
- field,
6308
- value,
6309
- from: from_,
6310
- to,
6311
- prefix,
6312
- order
6313
- } = request;
6314
- const _queryParams = {
6315
- userId,
6316
- externalId,
6317
- startFrom,
6318
- limit,
6319
- type: type_,
6320
- field,
6321
- value,
6322
- from: from_,
6323
- to,
6324
- prefix,
6325
- order: order != null ? order : void 0
6326
- };
6327
- const _authRequest = await this._options.authProvider.getAuthRequest();
6328
- const _headers = mergeHeaders(
6329
- _authRequest.headers,
6330
- this._options?.headers,
6331
- requestOptions?.headers
6332
- );
6333
- const _response = await fetcher({
6334
- url: url_exports.join(
6335
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6336
- "v1/orgs"
6337
- ),
6338
- method: "GET",
6339
- headers: _headers,
6340
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6341
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6342
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6343
- abortSignal: requestOptions?.abortSignal,
6344
- fetchFn: this._options?.fetch,
6345
- logging: this._options.logging
6346
- });
6347
- if (_response.ok) {
6348
- return { data: _response.body, rawResponse: _response.rawResponse };
6349
- }
6350
- if (_response.error.reason === "status-code") {
6351
- throw new VectrosError({
6352
- statusCode: _response.error.statusCode,
6353
- body: _response.error.body,
6354
- rawResponse: _response.rawResponse
6355
- });
6356
- }
6357
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6358
- }
6359
- /**
6360
- * 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.
6361
- *
6362
- * @param {Vectros.CreateOrgRequest} request
6363
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6364
- *
6365
- * @throws {@link Vectros.BadRequestError}
6366
- * @throws {@link Vectros.ForbiddenError}
6367
- * @throws {@link Vectros.TooManyRequestsError}
6368
- *
6369
- * @example
6370
- * await client.identity.createOrg({
6371
- * body: {
6372
- * externalId: "clinic_001"
6373
- * }
6374
- * })
6375
- */
6376
- createOrg(request, requestOptions) {
6377
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6378
- }
6379
- async __createOrg(request, requestOptions) {
6380
- const { upsert, body: _body } = request;
6381
- const _queryParams = {
6382
- upsert
6383
- };
6384
- const _authRequest = await this._options.authProvider.getAuthRequest();
6385
- const _headers = mergeHeaders(
6386
- _authRequest.headers,
6387
- this._options?.headers,
6388
- requestOptions?.headers
6246
+ return handleNonStatusCodeError(
6247
+ _response.error,
6248
+ _response.rawResponse,
6249
+ "GET",
6250
+ "/v1/entities/{namespace}/{id}/versions"
6389
6251
  );
6390
- const _response = await fetcher({
6391
- url: url_exports.join(
6392
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6393
- "v1/orgs"
6394
- ),
6395
- method: "POST",
6396
- headers: _headers,
6397
- contentType: "application/json",
6398
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6399
- requestType: "json",
6400
- body: _body,
6401
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6402
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6403
- abortSignal: requestOptions?.abortSignal,
6404
- fetchFn: this._options?.fetch,
6405
- logging: this._options.logging
6406
- });
6407
- if (_response.ok) {
6408
- return { data: _response.body, rawResponse: _response.rawResponse };
6409
- }
6410
- if (_response.error.reason === "status-code") {
6411
- switch (_response.error.statusCode) {
6412
- case 400:
6413
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6414
- case 403:
6415
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6416
- case 429:
6417
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6418
- default:
6419
- throw new VectrosError({
6420
- statusCode: _response.error.statusCode,
6421
- body: _response.error.body,
6422
- rawResponse: _response.rawResponse
6423
- });
6424
- }
6425
- }
6426
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6427
6252
  }
6428
6253
  /**
6429
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6254
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6430
6255
  *
6431
- * @param {Vectros.GetOrgRequest} request
6256
+ * @param {Vectros.GetNamespaceRequest} request
6432
6257
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6433
6258
  *
6434
6259
  * @throws {@link Vectros.NotFoundError}
6435
6260
  *
6436
6261
  * @example
6437
- * await client.identity.getOrg({
6438
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6262
+ * await client.identity.getNamespace({
6263
+ * namespace: "team"
6439
6264
  * })
6440
6265
  */
6441
- getOrg(request, requestOptions) {
6442
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6266
+ getNamespace(request, requestOptions) {
6267
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6443
6268
  }
6444
- async __getOrg(request, requestOptions) {
6445
- const { id } = request;
6269
+ async __getNamespace(request, requestOptions) {
6270
+ const { namespace } = request;
6446
6271
  const _authRequest = await this._options.authProvider.getAuthRequest();
6447
6272
  const _headers = mergeHeaders(
6448
6273
  _authRequest.headers,
@@ -6452,7 +6277,7 @@ var IdentityClient = class {
6452
6277
  const _response = await fetcher({
6453
6278
  url: url_exports.join(
6454
6279
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6455
- `v1/orgs/${url_exports.encodePathParam(id)}`
6280
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6456
6281
  ),
6457
6282
  method: "GET",
6458
6283
  headers: _headers,
@@ -6478,30 +6303,31 @@ var IdentityClient = class {
6478
6303
  });
6479
6304
  }
6480
6305
  }
6481
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6306
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6482
6307
  }
6483
6308
  /**
6484
- * 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.
6309
+ * 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.
6485
6310
  *
6486
- * @param {Vectros.UpdateOrgRequest} request
6311
+ * @param {Vectros.UpdateNamespaceRequest} request
6487
6312
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6488
6313
  *
6314
+ * @throws {@link Vectros.ForbiddenError}
6489
6315
  * @throws {@link Vectros.NotFoundError}
6490
6316
  * @throws {@link Vectros.TooManyRequestsError}
6491
6317
  *
6492
6318
  * @example
6493
- * await client.identity.updateOrg({
6494
- * id: "id",
6319
+ * await client.identity.updateNamespace({
6320
+ * namespace: "team",
6495
6321
  * body: {
6496
- * externalId: "clinic_001"
6322
+ * namespace: "team"
6497
6323
  * }
6498
6324
  * })
6499
6325
  */
6500
- updateOrg(request, requestOptions) {
6501
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6326
+ updateNamespace(request, requestOptions) {
6327
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6502
6328
  }
6503
- async __updateOrg(request, requestOptions) {
6504
- const { id, body: _body } = request;
6329
+ async __updateNamespace(request, requestOptions) {
6330
+ const { namespace, body: _body } = request;
6505
6331
  const _authRequest = await this._options.authProvider.getAuthRequest();
6506
6332
  const _headers = mergeHeaders(
6507
6333
  _authRequest.headers,
@@ -6511,7 +6337,7 @@ var IdentityClient = class {
6511
6337
  const _response = await fetcher({
6512
6338
  url: url_exports.join(
6513
6339
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6514
- `v1/orgs/${url_exports.encodePathParam(id)}`
6340
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6515
6341
  ),
6516
6342
  method: "PUT",
6517
6343
  headers: _headers,
@@ -6530,6 +6356,8 @@ var IdentityClient = class {
6530
6356
  }
6531
6357
  if (_response.error.reason === "status-code") {
6532
6358
  switch (_response.error.statusCode) {
6359
+ case 403:
6360
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6533
6361
  case 404:
6534
6362
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6535
6363
  case 429:
@@ -6542,27 +6370,28 @@ var IdentityClient = class {
6542
6370
  });
6543
6371
  }
6544
6372
  }
6545
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6373
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6546
6374
  }
6547
6375
  /**
6548
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6376
+ * 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.
6549
6377
  *
6550
- * @param {Vectros.DeleteOrgRequest} request
6378
+ * @param {Vectros.DeleteNamespaceRequest} request
6551
6379
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6552
6380
  *
6381
+ * @throws {@link Vectros.ForbiddenError}
6553
6382
  * @throws {@link Vectros.NotFoundError}
6554
6383
  * @throws {@link Vectros.TooManyRequestsError}
6555
6384
  *
6556
6385
  * @example
6557
- * await client.identity.deleteOrg({
6558
- * id: "id"
6386
+ * await client.identity.deleteNamespace({
6387
+ * namespace: "team"
6559
6388
  * })
6560
6389
  */
6561
- deleteOrg(request, requestOptions) {
6562
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6390
+ deleteNamespace(request, requestOptions) {
6391
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6563
6392
  }
6564
- async __deleteOrg(request, requestOptions) {
6565
- const { id } = request;
6393
+ async __deleteNamespace(request, requestOptions) {
6394
+ const { namespace } = request;
6566
6395
  const _authRequest = await this._options.authProvider.getAuthRequest();
6567
6396
  const _headers = mergeHeaders(
6568
6397
  _authRequest.headers,
@@ -6572,7 +6401,7 @@ var IdentityClient = class {
6572
6401
  const _response = await fetcher({
6573
6402
  url: url_exports.join(
6574
6403
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6575
- `v1/orgs/${url_exports.encodePathParam(id)}`
6404
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6576
6405
  ),
6577
6406
  method: "DELETE",
6578
6407
  headers: _headers,
@@ -6588,6 +6417,8 @@ var IdentityClient = class {
6588
6417
  }
6589
6418
  if (_response.error.reason === "status-code") {
6590
6419
  switch (_response.error.statusCode) {
6420
+ case 403:
6421
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6591
6422
  case 404:
6592
6423
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6593
6424
  case 429:
@@ -6600,27 +6431,26 @@ var IdentityClient = class {
6600
6431
  });
6601
6432
  }
6602
6433
  }
6603
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6434
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6604
6435
  }
6605
6436
  /**
6606
- * 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.
6437
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6607
6438
  *
6608
- * @param {Vectros.IdentityLookupRequest} request
6439
+ * @param {Vectros.ListNamespacesRequest} request
6609
6440
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6610
6441
  *
6611
- * @throws {@link Vectros.BadRequestError}
6612
- * @throws {@link Vectros.TooManyRequestsError}
6613
- *
6614
6442
  * @example
6615
- * await client.identity.lookupOrgs({
6616
- * type: "person_v1",
6617
- * field: "ssn"
6618
- * })
6443
+ * await client.identity.listNamespaces()
6619
6444
  */
6620
- lookupOrgs(request, requestOptions) {
6621
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6445
+ listNamespaces(request = {}, requestOptions) {
6446
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6622
6447
  }
6623
- async __lookupOrgs(request, requestOptions) {
6448
+ async __listNamespaces(request = {}, requestOptions) {
6449
+ const { startFrom, limit } = request;
6450
+ const _queryParams = {
6451
+ startFrom,
6452
+ limit
6453
+ };
6624
6454
  const _authRequest = await this._options.authProvider.getAuthRequest();
6625
6455
  const _headers = mergeHeaders(
6626
6456
  _authRequest.headers,
@@ -6630,14 +6460,11 @@ var IdentityClient = class {
6630
6460
  const _response = await fetcher({
6631
6461
  url: url_exports.join(
6632
6462
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6633
- "v1/orgs/lookup"
6463
+ "v1/namespaces"
6634
6464
  ),
6635
- method: "POST",
6465
+ method: "GET",
6636
6466
  headers: _headers,
6637
- contentType: "application/json",
6638
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6639
- requestType: "json",
6640
- body: request,
6467
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6641
6468
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6642
6469
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6643
6470
  abortSignal: requestOptions?.abortSignal,
@@ -6648,42 +6475,33 @@ var IdentityClient = class {
6648
6475
  return { data: _response.body, rawResponse: _response.rawResponse };
6649
6476
  }
6650
6477
  if (_response.error.reason === "status-code") {
6651
- switch (_response.error.statusCode) {
6652
- case 400:
6653
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6654
- case 429:
6655
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6656
- default:
6657
- throw new VectrosError({
6658
- statusCode: _response.error.statusCode,
6659
- body: _response.error.body,
6660
- rawResponse: _response.rawResponse
6661
- });
6662
- }
6478
+ throw new VectrosError({
6479
+ statusCode: _response.error.statusCode,
6480
+ body: _response.error.body,
6481
+ rawResponse: _response.rawResponse
6482
+ });
6663
6483
  }
6664
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6484
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6665
6485
  }
6666
6486
  /**
6667
- * 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.
6487
+ * 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.
6668
6488
  *
6669
- * @param {Vectros.GetOrgVersionsRequest} request
6489
+ * @param {Vectros.NamespaceRequest} request
6670
6490
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6671
6491
  *
6672
- * @throws {@link Vectros.NotFoundError}
6492
+ * @throws {@link Vectros.BadRequestError}
6493
+ * @throws {@link Vectros.ForbiddenError}
6494
+ * @throws {@link Vectros.TooManyRequestsError}
6673
6495
  *
6674
6496
  * @example
6675
- * await client.identity.getOrgVersions({
6676
- * id: "id"
6497
+ * await client.identity.registerNamespace({
6498
+ * namespace: "team"
6677
6499
  * })
6678
6500
  */
6679
- getOrgVersions(request, requestOptions) {
6680
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6501
+ registerNamespace(request, requestOptions) {
6502
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6681
6503
  }
6682
- async __getOrgVersions(request, requestOptions) {
6683
- const { id, startFrom } = request;
6684
- const _queryParams = {
6685
- startFrom
6686
- };
6504
+ async __registerNamespace(request, requestOptions) {
6687
6505
  const _authRequest = await this._options.authProvider.getAuthRequest();
6688
6506
  const _headers = mergeHeaders(
6689
6507
  _authRequest.headers,
@@ -6693,11 +6511,14 @@ var IdentityClient = class {
6693
6511
  const _response = await fetcher({
6694
6512
  url: url_exports.join(
6695
6513
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6696
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6514
+ "v1/namespaces"
6697
6515
  ),
6698
- method: "GET",
6516
+ method: "POST",
6699
6517
  headers: _headers,
6700
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6518
+ contentType: "application/json",
6519
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6520
+ requestType: "json",
6521
+ body: request,
6701
6522
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6702
6523
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6703
6524
  abortSignal: requestOptions?.abortSignal,
@@ -6709,8 +6530,12 @@ var IdentityClient = class {
6709
6530
  }
6710
6531
  if (_response.error.reason === "status-code") {
6711
6532
  switch (_response.error.statusCode) {
6712
- case 404:
6713
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6533
+ case 400:
6534
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6535
+ case 403:
6536
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6537
+ case 429:
6538
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6714
6539
  default:
6715
6540
  throw new VectrosError({
6716
6541
  statusCode: _response.error.statusCode,
@@ -6719,7 +6544,7 @@ var IdentityClient = class {
6719
6544
  });
6720
6545
  }
6721
6546
  }
6722
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6547
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6723
6548
  }
6724
6549
  /**
6725
6550
  * 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.
@@ -7596,7 +7421,7 @@ var RecordsClient = class {
7596
7421
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7597
7422
  }
7598
7423
  /**
7599
- * 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`, `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.
7424
+ * 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.
7600
7425
  *
7601
7426
  * @param {Vectros.ListRecordsRequest} request
7602
7427
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7606,8 +7431,6 @@ var RecordsClient = class {
7606
7431
  * type: "intake_form",
7607
7432
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7608
7433
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7609
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7610
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7611
7434
  * scope: "group:eng-team",
7612
7435
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7613
7436
  * })
@@ -7616,24 +7439,11 @@ var RecordsClient = class {
7616
7439
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7617
7440
  }
7618
7441
  async __listRecords(request = {}, requestOptions) {
7619
- const {
7620
- type: type_,
7621
- folderId,
7622
- userId,
7623
- orgId,
7624
- clientId,
7625
- scope,
7626
- startFrom,
7627
- limit,
7628
- includePayload,
7629
- recent
7630
- } = request;
7442
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7631
7443
  const _queryParams = {
7632
7444
  type: type_,
7633
7445
  folderId,
7634
7446
  userId,
7635
- orgId,
7636
- clientId,
7637
7447
  scope,
7638
7448
  startFrom,
7639
7449
  limit,
@@ -7933,7 +7743,7 @@ var RecordsClient = class {
7933
7743
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7934
7744
  }
7935
7745
  /**
7936
- * 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.
7746
+ * 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.
7937
7747
  *
7938
7748
  * @param {Vectros.PatchRecordRequest} request
7939
7749
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8259,7 +8069,7 @@ var SchemasClient = class {
8259
8069
  this._options = normalizeClientOptionsWithAuth(options);
8260
8070
  }
8261
8071
  /**
8262
- * 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.
8072
+ * 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.
8263
8073
  *
8264
8074
  * @param {Vectros.ListSchemasRequest} request
8265
8075
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8267,7 +8077,7 @@ var SchemasClient = class {
8267
8077
  * @example
8268
8078
  * await client.schemas.listSchemas({
8269
8079
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8270
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8080
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8271
8081
  * surface: "document",
8272
8082
  * recordType: "intake_form",
8273
8083
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8277,10 +8087,10 @@ var SchemasClient = class {
8277
8087
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8278
8088
  }
8279
8089
  async __listSchemas(request = {}, requestOptions) {
8280
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8090
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8281
8091
  const _queryParams = {
8282
8092
  userId,
8283
- orgId,
8093
+ scope,
8284
8094
  surface,
8285
8095
  recordType,
8286
8096
  startFrom,
@@ -8726,12 +8536,12 @@ var VectrosClient = class {
8726
8536
  get auth() {
8727
8537
  return this._auth ?? (this._auth = new AuthClient(this._options));
8728
8538
  }
8729
- get identity() {
8730
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8731
- }
8732
8539
  get documents() {
8733
8540
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8734
8541
  }
8542
+ get identity() {
8543
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8544
+ }
8735
8545
  get compliance() {
8736
8546
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8737
8547
  }
@@ -8829,8 +8639,8 @@ function warnOnSuboptimalKey(key, log) {
8829
8639
 
8830
8640
  // src/build-info.ts
8831
8641
  var BUILD_INFO = {
8832
- mcpServer: true ? "0.9.0" : "dev",
8833
- sdk: true ? "0.34.0" : "dev"
8642
+ mcpServer: true ? "0.11.0" : "dev",
8643
+ sdk: true ? "0.36.0" : "dev"
8834
8644
  };
8835
8645
 
8836
8646
  // src/log.ts
@@ -9034,31 +8844,45 @@ async function consumeStream(stream, onProgress) {
9034
8844
  }
9035
8845
 
9036
8846
  // src/tools/errors.ts
8847
+ function asErrorBody(body) {
8848
+ if (body && typeof body === "object") return body;
8849
+ return void 0;
8850
+ }
9037
8851
  function toolError(toolName, err, docPointer) {
9038
8852
  let summary = `${toolName} failed`;
9039
8853
  let detail = String(err);
8854
+ let errorCode;
8855
+ let requestId;
9040
8856
  if (err instanceof StreamError) {
9041
8857
  summary = `${toolName} stream error`;
9042
8858
  detail = err.message;
9043
8859
  } else if (err instanceof Error) {
9044
8860
  const e = err;
9045
8861
  detail = e.message;
8862
+ const body = asErrorBody(e.body);
8863
+ if (body) {
8864
+ if (typeof body.message === "string" && body.message.trim().length > 0) detail = body.message;
8865
+ if (typeof body.errorCode === "string" && body.errorCode.length > 0) errorCode = body.errorCode;
8866
+ if (typeof body.requestId === "string" && body.requestId.length > 0) requestId = body.requestId;
8867
+ }
9046
8868
  if (e.statusCode) {
9047
- summary = `${toolName} failed: HTTP ${e.statusCode}`;
8869
+ summary = `${toolName} failed: HTTP ${e.statusCode}${errorCode ? ` (${errorCode})` : ""}`;
9048
8870
  } else if (e.name && e.name !== "Error") {
9049
8871
  summary = `${toolName} failed: ${e.name}`;
9050
8872
  }
9051
8873
  }
9052
- const pointer = docPointer ? `
8874
+ const trailer = (errorCode ? `
8875
+ errorCode: ${errorCode}` : "") + (requestId ? `
8876
+ requestId: ${requestId}` : "") + (docPointer ? `
9053
8877
 
9054
- See: ${docPointer}` : "";
8878
+ See: ${docPointer}` : "");
9055
8879
  return {
9056
8880
  isError: true,
9057
8881
  content: [
9058
8882
  {
9059
8883
  type: "text",
9060
8884
  text: `${summary}
9061
- ${detail}${pointer}`
8885
+ ${detail}${trailer}`
9062
8886
  }
9063
8887
  ]
9064
8888
  };
@@ -9115,10 +8939,8 @@ var inputSchema = {
9115
8939
  ),
9116
8940
  // Ownership.
9117
8941
  userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9118
- orgId: import_zod.z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9119
- clientId: import_zod.z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9120
8942
  scope: import_zod.z.string().optional().describe(
9121
- 'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
8943
+ '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.'
9122
8944
  ),
9123
8945
  // Date window.
9124
8946
  createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9137,7 +8959,7 @@ var inputSchema = {
9137
8959
  var hybridSearch = ({ client, log }) => ({
9138
8960
  name: "hybrid_search",
9139
8961
  title: "Hybrid search",
9140
- 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/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). 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\".",
8962
+ 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 (BM25) leg matched nothing (all textScores 0) \u2014 typically the default PHRASE mode finding no contiguous match for a long natural-language query. Loosen the keyword leg: shorten the query to its key terms, or set textMode "AND" (all terms, higher precision) or "OR" (any term, broad recall).',
9141
8963
  inputSchema,
9142
8964
  handler: async (args) => {
9143
8965
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9155,8 +8977,6 @@ var hybridSearch = ({ client, log }) => ({
9155
8977
  typeName: args.typeName,
9156
8978
  filters: args.filters,
9157
8979
  userId: args.userId,
9158
- orgId: args.orgId,
9159
- clientId: args.clientId,
9160
8980
  scope: args.scope,
9161
8981
  createdAfter: args.createdAfter,
9162
8982
  createdBefore: args.createdBefore,
@@ -9241,10 +9061,8 @@ var inputSchema2 = {
9241
9061
  ),
9242
9062
  // List-mode args:
9243
9063
  userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
9244
- orgId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this org."),
9245
- clientId: import_zod2.z.string().optional().describe("List mode: scope to records associated with this client."),
9246
9064
  scope: import_zod2.z.string().optional().describe(
9247
- 'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9065
+ '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.'
9248
9066
  ),
9249
9067
  startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9250
9068
  limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9254,7 +9072,7 @@ var inputSchema2 = {
9254
9072
  var recordQuery = ({ client, log }) => ({
9255
9073
  name: "record_query",
9256
9074
  title: "Record query (list or lookup)",
9257
- 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 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.",
9075
+ 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.",
9258
9076
  inputSchema: inputSchema2,
9259
9077
  handler: async (args) => {
9260
9078
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9308,8 +9126,6 @@ var recordQuery = ({ client, log }) => ({
9308
9126
  page = await client.records.listRecords({
9309
9127
  type,
9310
9128
  userId: args.userId,
9311
- orgId: args.orgId,
9312
- clientId: args.clientId,
9313
9129
  scope: args.scope,
9314
9130
  startFrom,
9315
9131
  limit
@@ -9395,7 +9211,7 @@ var inputSchema3 = {
9395
9211
  var recordGet = ({ client, log }) => ({
9396
9212
  name: "record_get",
9397
9213
  title: "Get a record by id or externalId",
9398
- description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window.",
9214
+ description: "Fetch a single structured record, including the full payload. Select it EITHER by its Vectros `id` (e.g. from record_query / hybrid_search) OR by your own `externalId` + `type` \u2014 the same key you passed to record_create, resolved for you (no manual record_query lookup needed). Very large payloads are truncated to protect the agent context window. The response carries the record's processing `indexStatus`; when it is FAILED an `indexFailure.code` explains whether the content is still searchable (e.g. VECTOR_LIMIT_EXCEEDED keeps keyword search vs INDEXING_FAILED = not findable at all) \u2014 branch on the `code`, not the message.",
9399
9215
  inputSchema: inputSchema3,
9400
9216
  handler: async (args) => {
9401
9217
  const id = args.id;
@@ -9433,7 +9249,7 @@ var import_zod4 = require("zod");
9433
9249
  var inputSchema4 = {
9434
9250
  type: import_zod4.z.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9435
9251
  fields: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).describe(
9436
- "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values."
9252
+ "The record payload \u2014 a JSON object of field\u2192value, validated against the type schema. Call list_schemas to learn required fields, types, and enum values. Every number must fall within the signed 64-bit range (a value outside it, or with >38 significant digits, is refused with a 400 naming the field) \u2014 send a larger whole number (e.g. a big external id) as a STRING, which stores it exactly and supports exact-match lookup."
9437
9253
  ),
9438
9254
  externalId: import_zod4.z.string().optional().describe(
9439
9255
  "Stable caller-supplied id. Immutable; unique per type. Re-creating with the same externalId returns the existing record (idempotent) \u2014 use it to make creates safely retryable."
@@ -9444,16 +9260,14 @@ var inputSchema4 = {
9444
9260
  status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9445
9261
  folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
9446
9262
  userId: import_zod4.z.string().optional().describe("Owning user id."),
9447
- orgId: import_zod4.z.string().optional().describe("Owning organization id."),
9448
- clientId: import_zod4.z.string().optional().describe("Associated client id."),
9449
9263
  scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
9450
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9264
+ '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.'
9451
9265
  )
9452
9266
  };
9453
9267
  var recordCreate = ({ client, log }) => ({
9454
9268
  name: "record_create",
9455
9269
  title: "Create a record",
9456
- description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c.",
9270
+ description: "Create a structured record of a given type. Provide `type` and `fields` (the payload, validated against the type schema \u2014 call list_schemas first to learn required fields and enums). Idempotent by `externalId`. Requires the key to allow records:c (and records:r to receive the existing record on a collision).",
9457
9271
  inputSchema: inputSchema4,
9458
9272
  handler: async (args) => {
9459
9273
  const type = args.type;
@@ -9467,8 +9281,6 @@ var recordCreate = ({ client, log }) => ({
9467
9281
  status: args.status,
9468
9282
  folderId: args.folderId,
9469
9283
  userId: args.userId,
9470
- orgId: args.orgId,
9471
- clientId: args.clientId,
9472
9284
  scopes: args.scopes
9473
9285
  }
9474
9286
  });
@@ -9572,10 +9384,8 @@ var inputSchema7 = {
9572
9384
  // answer on a specific owner / folder / type / metadata subset, not just the
9573
9385
  // whole-tenant corpus.
9574
9386
  userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9575
- orgId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9576
- clientId: import_zod7.z.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9577
9387
  scope: import_zod7.z.string().optional().describe(
9578
- 'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9388
+ '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.'
9579
9389
  ),
9580
9390
  folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
9581
9391
  rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9603,8 +9413,6 @@ var ragAsk = ({ client, log }) => ({
9603
9413
  mode: searchArg.mode ?? "HYBRID",
9604
9414
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9605
9415
  userId: searchArg.userId,
9606
- orgId: searchArg.orgId,
9607
- clientId: searchArg.clientId,
9608
9416
  scope: searchArg.scope,
9609
9417
  folderId: searchArg.folderId,
9610
9418
  rootFolderId: searchArg.rootFolderId,
@@ -9750,32 +9558,32 @@ var inputSchema9 = {
9750
9558
  userId: import_zod9.z.string().optional().describe(
9751
9559
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9752
9560
  ),
9753
- orgId: import_zod9.z.string().optional().describe(
9754
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9561
+ scope: import_zod9.z.string().optional().describe(
9562
+ '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.'
9755
9563
  ),
9756
- surface: import_zod9.z.enum(["record", "document", "user", "org", "client"]).optional().describe(
9757
- "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."
9564
+ surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
9565
+ "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."
9758
9566
  ),
9759
9567
  recordType: import_zod9.z.string().optional().describe(
9760
- '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.'
9568
+ '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.'
9761
9569
  )
9762
9570
  };
9763
9571
  var listSchemas = ({ client, log }) => ({
9764
9572
  name: "list_schemas",
9765
9573
  title: "List record schemas",
9766
- 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/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.',
9574
+ 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.',
9767
9575
  inputSchema: inputSchema9,
9768
9576
  handler: async (args) => {
9769
9577
  const userId = args.userId;
9770
- const orgId = args.orgId;
9578
+ const scope = args.scope;
9771
9579
  const surface = args.surface;
9772
9580
  const recordType = args.recordType;
9773
9581
  try {
9774
9582
  const schemas = await drainPages(
9775
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9583
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9776
9584
  );
9777
9585
  log.debug(
9778
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9586
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9779
9587
  "list_schemas ok"
9780
9588
  );
9781
9589
  return {
@@ -9817,7 +9625,7 @@ function isNotAvailable(err) {
9817
9625
  var documentGet = ({ client, log }) => ({
9818
9626
  name: "document_get",
9819
9627
  title: "Get document metadata (and optionally text)",
9820
- description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`.",
9628
+ description: "Fetch metadata for a single document \u2014 select it by its Vectros `documentId` OR by your own `externalId` + `type` (resolved for you). Pass `includeText: true` to also fetch the text body (capped at ~8K tokens; `truncated: true` flag if cut). Text is available for every text-ingested document and for file-ingested documents unless they were uploaded with `storeText: false` (extracted text discarded after indexing) \u2014 then `textAvailable: false` is set; the original file is still retrievable via `includeDownloadUrl`. Pass `includeDownloadUrl: true` to also get a short-lived presigned `downloadUrl` for the original file (file-backed documents only). Returns the full document metadata, including its lifecycle `status` (ACTIVE, or ARCHIVED when soft-retracted from search \u2014 restorable via document_update) and its processing `indexStatus`. When `indexStatus` is FAILED the response also carries `indexFailure` with a machine-readable `code` telling you whether the content is still findable \u2014 e.g. TEXT_INDEX_FAILED / VECTOR_LIMIT_EXCEEDED (one leg still serves it) vs INDEXING_FAILED (not findable by search at all). Branch on `code`, not on the message.",
9821
9629
  inputSchema: inputSchema10,
9822
9630
  handler: async (args) => {
9823
9631
  const documentId = args.documentId;
@@ -9900,10 +9708,8 @@ var inputSchema11 = {
9900
9708
  // List-mode args:
9901
9709
  folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9902
9710
  userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
9903
- orgId: import_zod11.z.string().optional().describe("List mode: scope to documents belonging to this org."),
9904
- clientId: import_zod11.z.string().optional().describe("List mode: scope to documents associated with this client."),
9905
9711
  scope: import_zod11.z.string().optional().describe(
9906
- 'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `scope=org:<id>`/`scope=client:<id>` are equivalent to the orgId/clientId filters.'
9712
+ '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.'
9907
9713
  ),
9908
9714
  startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9909
9715
  limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9913,7 +9719,7 @@ var inputSchema11 = {
9913
9719
  var documentQuery = ({ client, log }) => ({
9914
9720
  name: "document_query",
9915
9721
  title: "Document query (list or lookup)",
9916
- 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`/`scope`.\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.",
9722
+ 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.",
9917
9723
  inputSchema: inputSchema11,
9918
9724
  handler: async (args) => {
9919
9725
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9973,8 +9779,6 @@ var documentQuery = ({ client, log }) => ({
9973
9779
  page = await client.documents.listDocuments({
9974
9780
  folderId: args.folderId,
9975
9781
  userId: args.userId,
9976
- orgId: args.orgId,
9977
- clientId: args.clientId,
9978
9782
  scope: args.scope,
9979
9783
  startFrom,
9980
9784
  limit
@@ -10015,8 +9819,9 @@ var inputSchema12 = {
10015
9819
  "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."
10016
9820
  ),
10017
9821
  userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10018
- orgId: import_zod12.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10019
- clientId: import_zod12.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9822
+ scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
9823
+ '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).'
9824
+ ),
10020
9825
  expectedVersion: import_zod12.z.number().int().optional().describe(
10021
9826
  "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."
10022
9827
  )
@@ -10036,8 +9841,7 @@ var documentUpdate = ({ client, log }) => ({
10036
9841
  const folderId = args.folderId;
10037
9842
  const status = args.status;
10038
9843
  const userId = args.userId;
10039
- const orgId = args.orgId;
10040
- const clientId = args.clientId;
9844
+ const scopes = args.scopes;
10041
9845
  const expectedVersion = args.expectedVersion;
10042
9846
  try {
10043
9847
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10049,8 +9853,7 @@ var documentUpdate = ({ client, log }) => ({
10049
9853
  if (folderId !== void 0) body.folderId = folderId;
10050
9854
  if (status !== void 0) body.status = status;
10051
9855
  if (userId !== void 0) body.userId = userId;
10052
- if (orgId !== void 0) body.orgId = orgId;
10053
- if (clientId !== void 0) body.clientId = clientId;
9856
+ if (scopes !== void 0) body.scopes = scopes;
10054
9857
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10055
9858
  const updated = await client.documents.patchDocument({
10056
9859
  id: resolved.id,
@@ -10100,8 +9903,9 @@ var inputSchema14 = {
10100
9903
  id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
10101
9904
  parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10102
9905
  userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
10103
- orgId: import_zod14.z.string().optional().describe("List mode: scope to folders belonging to this org."),
10104
- clientId: import_zod14.z.string().optional().describe("List mode: scope to folders associated with this client."),
9906
+ scope: import_zod14.z.string().optional().describe(
9907
+ '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.'
9908
+ ),
10105
9909
  startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10106
9910
  limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10107
9911
  `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\`.`
@@ -10110,7 +9914,7 @@ var inputSchema14 = {
10110
9914
  var folderQuery = ({ client, log }) => ({
10111
9915
  name: "folder_query",
10112
9916
  title: "Folder query (list or get)",
10113
- 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 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.",
9917
+ 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.",
10114
9918
  inputSchema: inputSchema14,
10115
9919
  handler: async (args) => {
10116
9920
  const id = args.id;
@@ -10124,8 +9928,7 @@ var folderQuery = ({ client, log }) => ({
10124
9928
  const page = await client.folders.listFolders({
10125
9929
  parentFolderId: args.parentId,
10126
9930
  userId: args.userId,
10127
- orgId: args.orgId,
10128
- clientId: args.clientId,
9931
+ scope: args.scope,
10129
9932
  startFrom: args.startFrom,
10130
9933
  limit
10131
9934
  });
@@ -10149,16 +9952,14 @@ var inputSchema15 = {
10149
9952
  parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10150
9953
  slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10151
9954
  userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
10152
- orgId: import_zod15.z.string().optional().describe("Owning org (Vectros UUID)."),
10153
- clientId: import_zod15.z.string().optional().describe("Associated client (Vectros UUID)."),
10154
9955
  scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
10155
- 'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields.'
9956
+ '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.'
10156
9957
  )
10157
9958
  };
10158
9959
  var folderCreate = ({ client, log }) => ({
10159
9960
  name: "folder_create",
10160
9961
  title: "Create a folder",
10161
- description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c.",
9962
+ description: "Create a folder to organize documents and records. Pass `parentId` to nest it (create-only \u2014 folders cannot be moved later). Idempotent by `slug` within the parent. Requires the key to allow folders:c (and folders:r to receive the existing folder on a collision).",
10162
9963
  inputSchema: inputSchema15,
10163
9964
  handler: async (args) => {
10164
9965
  try {
@@ -10169,8 +9970,6 @@ var folderCreate = ({ client, log }) => ({
10169
9970
  parentFolderId: args.parentId,
10170
9971
  slug: args.slug,
10171
9972
  userId: args.userId,
10172
- orgId: args.orgId,
10173
- clientId: args.clientId,
10174
9973
  scopes: args.scopes
10175
9974
  }
10176
9975
  });
@@ -10191,8 +9990,9 @@ var inputSchema16 = {
10191
9990
  name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
10192
9991
  description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
10193
9992
  userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10194
- orgId: import_zod16.z.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10195
- clientId: import_zod16.z.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9993
+ scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
9994
+ '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).'
9995
+ ),
10196
9996
  expectedVersion: import_zod16.z.number().int().optional().describe(
10197
9997
  "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."
10198
9998
  )
@@ -10207,16 +10007,14 @@ var folderUpdate = ({ client, log }) => ({
10207
10007
  const name = args.name;
10208
10008
  const description = args.description;
10209
10009
  const userId = args.userId;
10210
- const orgId = args.orgId;
10211
- const clientId = args.clientId;
10010
+ const scopes = args.scopes;
10212
10011
  const expectedVersion = args.expectedVersion;
10213
10012
  try {
10214
10013
  const body = {};
10215
10014
  if (name !== void 0) body.name = name;
10216
10015
  if (description !== void 0) body.description = description;
10217
10016
  if (userId !== void 0) body.userId = userId;
10218
- if (orgId !== void 0) body.orgId = orgId;
10219
- if (clientId !== void 0) body.clientId = clientId;
10017
+ if (scopes !== void 0) body.scopes = scopes;
10220
10018
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10221
10019
  const updated = await client.folders.patchFolder({ id, body });
10222
10020
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10260,7 +10058,7 @@ var inputSchema18 = {
10260
10058
  var currentIdentity = ({ log, apiKey, environment }) => ({
10261
10059
  name: "current_identity",
10262
10060
  title: "Current identity (tenant + principal scope)",
10263
- description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, and (for scoped keys) allowedActions + dataScope. Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood. Backend may still be rolling out the extended /v1/ping response shape \u2014 until then this tool returns a minimal shape; richer fields appear automatically as backend ships.",
10061
+ description: "Describe the credential the MCP server is operating under. Returns tenantId, environment (staging|production), principalType (root_key|scoped_key|token), principalKeyId, principalLabel, and (for scoped credentials) allowedActions plus dataScope \u2014 the credential's reach as { userId, scopes[] }, where each scope is a `namespace:value` string (e.g. \"org:<uuid>\"). Use this when the user asks 'what can you do here?' or 'what tenant am I in?'. Calls GET /v1/ping under the hood.",
10264
10062
  inputSchema: inputSchema18,
10265
10063
  handler: async () => {
10266
10064
  try {
@@ -10358,7 +10156,7 @@ var inputSchema19 = {
10358
10156
  "Index strategy. HYBRID (BM25 + dense, default; best for general retrieval), SEMANTIC (dense only; concept-driven queries), TEXT (BM25 only; exact-match / keyword), NONE (store-only / archival \u2014 retrievable by id and structured-field lookup but never in search results). Omit to inherit the bound schema's default."
10359
10157
  ),
10360
10158
  externalId: import_zod18.z.string().optional().describe(
10361
- "Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create."
10159
+ 'Stable caller-supplied id. Immutable; unique per type within your context. Re-ingesting with the same externalId returns the existing document (idempotent) instead of creating a duplicate \u2014 use it to make ingests safely retryable and as the key other records reference. Mirrors record_create. Receiving the existing document back is a read of it and needs documents:r in addition to documents:c; a create-only key gets an "already exists" error instead of the document.'
10362
10160
  ),
10363
10161
  upsert: import_zod18.z.boolean().optional().describe(
10364
10162
  "When true, re-ingesting an existing externalId OVERWRITES that document and re-indexes the new body (text mode) / re-uploads and re-indexes the new file (file mode), instead of returning the existing one unchanged. This is the curation/re-sync primitive: edit a source, re-ingest with upsert:true, and the search index reflects the new content. Requires the documents:u scope. IMPORTANT: pass the SAME schemaId (and type) you used originally \u2014 externalId is unique WITHIN a type, so omitting schemaId resolves in the untyped namespace and mints a duplicate instead of updating. The response `created` flag confirms which happened (created:true = a new document was minted)."
@@ -10367,12 +10165,12 @@ var inputSchema19 = {
10367
10165
  "Bind this document to a record schema. When set, `payload` is validated against the schema and its lookup fields become directly queryable via document_query (records parity). Resolve a schema id from its type via list_schemas. Omit for an untyped document."
10368
10166
  ),
10369
10167
  payload: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.unknown()).optional().describe(
10370
- "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata."
10168
+ "The document's structured data \u2014 a flat key/value object. With `schemaId`, declared fields are validated and lookup fields indexed; undeclared keys pass through as free-form and are searchable via the hybrid_search `filters` param. Without a schema it is stored as free-form metadata. Every number must fall within the signed 64-bit range \u2014 send a larger whole number as a STRING (stored exactly, exact-match lookup), else the ingest is refused with a 400 naming the field."
10371
10169
  ),
10372
10170
  // Inline text mode (mutually exclusive with filePath):
10373
10171
  text: import_zod18.z.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10374
10172
  storeText: import_zod18.z.boolean().optional().describe(
10375
- "Whether the document's text is retained after indexing (default true). Applies to BOTH modes and is fixed at ingest time. Text mode: the ingested body is always retained (this flag is effectively always true \u2014 the body is the document). File mode: true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards the extracted text once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable."
10173
+ "FILE MODE ONLY. Whether the uploaded file's EXTRACTED text is retained after indexing (default true), fixed at ingest. true keeps the extracted text retrievable via document_get(includeText:true) and usable by document_ask; false discards it once indexing completes \u2014 search still works and the original file remains downloadable, but includeText returns textAvailable:false and document_ask is unavailable. NOT accepted with `text`: a text-ingested body is the document itself and is ALWAYS retained, so the backend has no storeText knob on the text path \u2014 passing it with `text` is rejected rather than silently ignored."
10376
10174
  ),
10377
10175
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10378
10176
  filePath: import_zod18.z.string().min(1).optional().describe(
@@ -10382,16 +10180,14 @@ var inputSchema19 = {
10382
10180
  // Common (both modes):
10383
10181
  folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10384
10182
  userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
10385
- orgId: import_zod18.z.string().optional().describe("Owning org ID. Optional."),
10386
- clientId: import_zod18.z.string().optional().describe("Owning client ID. Optional."),
10387
10183
  scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
10388
- "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). 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. `org:`/`client:` entries are equivalent to the orgId/clientId fields. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
10184
+ "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."
10389
10185
  )
10390
10186
  };
10391
10187
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10392
10188
  name: "document_ingest",
10393
10189
  title: "Ingest a new document (text body or file upload)",
10394
- description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText defaults to true and is fixed at ingest: in file mode, false discards the extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained.",
10190
+ description: "Create a new document in your Vectros tenant. Two modes:\n \u2022 Text mode: pass `text` (string body). Single-call. Use for crawled content, notes, generated text.\n \u2022 File mode: pass `filePath` (local path on the MCP server's host machine). STDIO-TRANSPORT ONLY \u2014 rejected on HTTP transport. MCP server reads the bytes, requests a presigned upload URL, and PUTs them. Returns when the upload is accepted (indexStatus: PENDING_INDEX); poll with `document_get` until indexStatus is INDEXED.\nEither `text` or `filePath` must be present; both is an error. Idempotent by `externalId` (re-ingest returns the existing document, not a duplicate \u2014 requires documents:r in addition to documents:c, since being handed the existing document is a read of it). To UPDATE an existing document instead \u2014 re-index an edited body \u2014 pass `upsert:true` with the same `externalId` (and the same `schemaId`); this is the re-sync primitive for keeping a knowledge base current. Pass `schemaId` + `payload` for a typed, lookup-queryable document (records parity). indexMode defaults to HYBRID for untyped documents (omit to inherit a bound schema's default). storeText is a FILE-MODE knob (default true): false discards the uploaded file's extracted text after indexing (search + file download keep working; text retrieval and document_ask do not). Text-mode bodies are always retained, so storeText is not accepted with `text`.",
10395
10191
  inputSchema: inputSchema19,
10396
10192
  handler: async (args) => {
10397
10193
  const title = args.title;
@@ -10428,14 +10224,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10428
10224
  )
10429
10225
  );
10430
10226
  }
10227
+ if (text && args.storeText !== void 0) {
10228
+ return toolError(
10229
+ "document_ingest",
10230
+ new Error(
10231
+ "`storeText` is not supported with `text` \u2014 a text-ingested body is the document itself and is always retained; the text path has no storeText control. Omit it (text mode), or use `filePath` mode where storeText:false discards the uploaded file's extracted text after indexing."
10232
+ )
10233
+ );
10234
+ }
10431
10235
  const common = {
10432
10236
  folderId: args.folderId,
10433
10237
  payload: args.payload,
10434
10238
  schemaId,
10435
10239
  externalId: args.externalId,
10436
- userId: args.userId,
10437
- orgId: args.orgId,
10438
- clientId: args.clientId
10240
+ userId: args.userId
10439
10241
  };
10440
10242
  try {
10441
10243
  if (text) {
@@ -10542,7 +10344,9 @@ var import_zod19 = require("zod");
10542
10344
  var MCP_DEFAULT_LIMIT5 = 10;
10543
10345
  var MCP_MAX_LIMIT5 = 100;
10544
10346
  var inputSchema20 = {
10545
- kind: import_zod19.z.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10347
+ kind: import_zod19.z.string().describe(
10348
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10349
+ ),
10546
10350
  externalId: import_zod19.z.string().optional().describe(
10547
10351
  "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."
10548
10352
  ),
@@ -10561,11 +10365,12 @@ var inputSchema20 = {
10561
10365
  };
10562
10366
  var lookupPrincipal = ({ client, log }) => ({
10563
10367
  name: "lookup_principal",
10564
- title: "Look up a user / org / client identity",
10565
- 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 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.",
10368
+ title: "Look up a user identity or a namespaced identity entity",
10369
+ 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.",
10566
10370
  inputSchema: inputSchema20,
10567
10371
  handler: async (args) => {
10568
10372
  const kind = args.kind;
10373
+ const isUser = kind === "user";
10569
10374
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10570
10375
  const externalId = args.externalId;
10571
10376
  const type = args.type;
@@ -10579,13 +10384,7 @@ var lookupPrincipal = ({ client, log }) => ({
10579
10384
  try {
10580
10385
  let page;
10581
10386
  if (externalId !== void 0) {
10582
- if (kind === "user") {
10583
- page = await client.identity.listUsers({ externalId, limit });
10584
- } else if (kind === "org") {
10585
- page = await client.identity.listOrgs({ externalId, limit });
10586
- } else {
10587
- page = await client.identity.listClients({ externalId, limit });
10588
- }
10387
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10589
10388
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10590
10389
  } else if (field !== void 0) {
10591
10390
  const hasEquality = value !== void 0;
@@ -10614,13 +10413,7 @@ var lookupPrincipal = ({ client, log }) => ({
10614
10413
  );
10615
10414
  }
10616
10415
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10617
- if (kind === "user") {
10618
- page = await client.identity.lookupUsers(req);
10619
- } else if (kind === "org") {
10620
- page = await client.identity.lookupOrgs(req);
10621
- } else {
10622
- page = await client.identity.lookupClients(req);
10623
- }
10416
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10624
10417
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10625
10418
  } else {
10626
10419
  return toolError(
@@ -10743,7 +10536,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10743
10536
  name: "identity",
10744
10537
  uri: "vectros://identity",
10745
10538
  title: "Current identity (tenant + principal scope)",
10746
- description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, environment, principalType, principalKeyId, and (for scoped keys) allowedActions + dataScope. Until backend ships the extended /v1/ping response, returns a minimal derived shape; richer fields appear automatically as backend rolls out.",
10539
+ description: "The tenant + principal scope the MCP server is authenticated as. Returns the same payload as the `current_identity` tool: status, tenantId, environment, principalType, principalKeyId, principalLabel, and (for scoped credentials) allowedActions + dataScope ({ userId, scopes[] }). The /v1/ping backing call ships this extended shape today.",
10747
10540
  mimeType: "application/json",
10748
10541
  read: async () => {
10749
10542
  const identity = await resolveIdentity({ log, apiKey, environment });