@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.mjs CHANGED
@@ -16,7 +16,6 @@ __export(api_exports, {
16
16
  BatchWriteRequest: () => BatchWriteRequest,
17
17
  BatchWriteResult: () => BatchWriteResult,
18
18
  ChatMessage: () => ChatMessage,
19
- ClientRequest: () => ClientRequest,
20
19
  ConflictError: () => ConflictError,
21
20
  ContentDeltaEvent: () => ContentDeltaEvent,
22
21
  ContentTooLargeError: () => ContentTooLargeError,
@@ -25,6 +24,7 @@ __export(api_exports, {
25
24
  DocumentRequest: () => DocumentRequest,
26
25
  DocumentResponse: () => DocumentResponse,
27
26
  DoneEvent: () => DoneEvent,
27
+ EntityRequest: () => EntityRequest,
28
28
  ErasureCertificate: () => ErasureCertificate,
29
29
  ErasureRequest: () => ErasureRequest,
30
30
  ErasureRequestResponse: () => ErasureRequestResponse,
@@ -36,16 +36,15 @@ __export(api_exports, {
36
36
  FileUploadRequest: () => FileUploadRequest,
37
37
  ForbiddenError: () => ForbiddenError,
38
38
  IdentityLookupRequest: () => IdentityLookupRequest,
39
+ IndexFailure: () => IndexFailure,
39
40
  InternalServerError: () => InternalServerError,
40
- ListClientsRequestOrder: () => ListClientsRequestOrder,
41
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
41
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
42
42
  ListUsersRequestOrder: () => ListUsersRequestOrder,
43
43
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
44
44
  LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
45
45
  ModelDataVersionResponse: () => ModelDataVersionResponse,
46
46
  NotFoundError: () => NotFoundError,
47
47
  NotImplementedError: () => NotImplementedError,
48
- OrgRequest: () => OrgRequest,
49
48
  PaymentRequiredError: () => PaymentRequiredError,
50
49
  PingResponse: () => PingResponse,
51
50
  RagSearch: () => RagSearch,
@@ -286,11 +285,6 @@ var UnauthorizedError = class extends VectrosError {
286
285
  var auth_exports = {};
287
286
  var ErasureRequest;
288
287
  ((ErasureRequest2) => {
289
- ErasureRequest2.SubjectType = {
290
- User: "user",
291
- Client: "client",
292
- Org: "org"
293
- };
294
288
  ErasureRequest2.AuditDisposition = {
295
289
  RetainRedacted: "retain-redacted",
296
290
  Purge: "purge"
@@ -302,11 +296,6 @@ var ExportRequest;
302
296
  Tenant: "tenant",
303
297
  Subject: "subject"
304
298
  };
305
- ExportRequest2.SubjectType = {
306
- User: "user",
307
- Client: "client",
308
- Org: "org"
309
- };
310
299
  ExportRequest2.Format = {
311
300
  Ndjson: "ndjson"
312
301
  };
@@ -345,15 +334,10 @@ var LookupDocumentsRequestOrder = {
345
334
  var folders_exports = {};
346
335
  var identity_exports = {};
347
336
  __export(identity_exports, {
348
- ListClientsRequestOrder: () => ListClientsRequestOrder,
349
- ListOrgsRequestOrder: () => ListOrgsRequestOrder,
337
+ ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
350
338
  ListUsersRequestOrder: () => ListUsersRequestOrder
351
339
  });
352
- var ListClientsRequestOrder = {
353
- Asc: "asc",
354
- Desc: "desc"
355
- };
356
- var ListOrgsRequestOrder = {
340
+ var ListEntitiesRequestOrder = {
357
341
  Asc: "asc",
358
342
  Desc: "desc"
359
343
  };
@@ -452,13 +436,6 @@ var ChatMessage;
452
436
  Assistant: "assistant"
453
437
  };
454
438
  })(ChatMessage || (ChatMessage = {}));
455
- var ClientRequest;
456
- ((ClientRequest2) => {
457
- ClientRequest2.Status = {
458
- Active: "ACTIVE",
459
- Suspended: "SUSPENDED"
460
- };
461
- })(ClientRequest || (ClientRequest = {}));
462
439
  var ContentDeltaEvent;
463
440
  ((ContentDeltaEvent2) => {
464
441
  ContentDeltaEvent2.Event = {
@@ -513,6 +490,13 @@ var DoneEvent;
513
490
  Done: "done"
514
491
  };
515
492
  })(DoneEvent || (DoneEvent = {}));
493
+ var EntityRequest;
494
+ ((EntityRequest2) => {
495
+ EntityRequest2.Status = {
496
+ Active: "ACTIVE",
497
+ Suspended: "SUSPENDED"
498
+ };
499
+ })(EntityRequest || (EntityRequest = {}));
516
500
  var ErasureCertificate;
517
501
  ((ErasureCertificate2) => {
518
502
  ErasureCertificate2.AuditDisposition = {
@@ -528,11 +512,6 @@ var ErasureRequestResponse;
528
512
  Completed: "completed",
529
513
  Failed: "failed"
530
514
  };
531
- ErasureRequestResponse2.SubjectType = {
532
- User: "user",
533
- Client: "client",
534
- Org: "org"
535
- };
536
515
  })(ErasureRequestResponse || (ErasureRequestResponse = {}));
537
516
  var ErrorEvent;
538
517
  ((ErrorEvent2) => {
@@ -558,11 +537,6 @@ var ExportRequestResponse;
558
537
  Tenant: "tenant",
559
538
  Subject: "subject"
560
539
  };
561
- ExportRequestResponse2.SubjectType = {
562
- User: "user",
563
- Client: "client",
564
- Org: "org"
565
- };
566
540
  })(ExportRequestResponse || (ExportRequestResponse = {}));
567
541
  var FieldDef;
568
542
  ((FieldDef2) => {
@@ -576,13 +550,6 @@ var FieldDef;
576
550
  Object: "object",
577
551
  Reference: "reference"
578
552
  };
579
- FieldDef2.TargetSurface = {
580
- Record: "record",
581
- Document: "document",
582
- User: "user",
583
- Org: "org",
584
- Client: "client"
585
- };
586
553
  })(FieldDef || (FieldDef = {}));
587
554
  var IdentityLookupRequest;
588
555
  ((IdentityLookupRequest2) => {
@@ -591,6 +558,17 @@ var IdentityLookupRequest;
591
558
  Desc: "desc"
592
559
  };
593
560
  })(IdentityLookupRequest || (IdentityLookupRequest = {}));
561
+ var IndexFailure;
562
+ ((IndexFailure2) => {
563
+ IndexFailure2.Code = {
564
+ SourceUnavailable: "SOURCE_UNAVAILABLE",
565
+ TextIndexFailed: "TEXT_INDEX_FAILED",
566
+ EmbeddingFailed: "EMBEDDING_FAILED",
567
+ IndexingFailed: "INDEXING_FAILED",
568
+ VectorLimitExceeded: "VECTOR_LIMIT_EXCEEDED",
569
+ Internal: "INTERNAL"
570
+ };
571
+ })(IndexFailure || (IndexFailure = {}));
594
572
  var ModelDataVersionResponse;
595
573
  ((ModelDataVersionResponse2) => {
596
574
  ModelDataVersionResponse2.ChangeType = {
@@ -599,13 +577,6 @@ var ModelDataVersionResponse;
599
577
  Delete: "DELETE"
600
578
  };
601
579
  })(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
602
- var OrgRequest;
603
- ((OrgRequest2) => {
604
- OrgRequest2.Status = {
605
- Active: "ACTIVE",
606
- Suspended: "SUSPENDED"
607
- };
608
- })(OrgRequest || (OrgRequest = {}));
609
580
  var PingResponse;
610
581
  ((PingResponse2) => {
611
582
  PingResponse2.Environment = {
@@ -635,11 +606,6 @@ var RagSearch;
635
606
  })(RagSearch || (RagSearch = {}));
636
607
  var ReadAccessLogResponse;
637
608
  ((ReadAccessLogResponse2) => {
638
- ReadAccessLogResponse2.SubjectType = {
639
- User: "user",
640
- Client: "client",
641
- Org: "org"
642
- };
643
609
  ReadAccessLogResponse2.Action = {
644
610
  Read: "read",
645
611
  List: "list",
@@ -709,8 +675,7 @@ var SchemaRequest;
709
675
  Record: "record",
710
676
  Document: "document",
711
677
  User: "user",
712
- Org: "org",
713
- Client: "client"
678
+ Entity: "entity"
714
679
  };
715
680
  })(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
716
681
  })(SchemaRequest || (SchemaRequest = {}));
@@ -733,8 +698,7 @@ var SchemaResponse;
733
698
  Record: "record",
734
699
  Document: "document",
735
700
  User: "user",
736
- Org: "org",
737
- Client: "client"
701
+ Entity: "entity"
738
702
  };
739
703
  })(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
740
704
  })(SchemaResponse || (SchemaResponse = {}));
@@ -2375,7 +2339,7 @@ var AuthClient = class {
2375
2339
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
2376
2340
  }
2377
2341
  /**
2378
- * 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.
2342
+ * 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.
2379
2343
  *
2380
2344
  * @param {Vectros.GetAccessLogRequest} request
2381
2345
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -2388,7 +2352,6 @@ var AuthClient = class {
2388
2352
  * subjectType: "user",
2389
2353
  * subjectId: "user_abc123",
2390
2354
  * contextId: "ctx_intake",
2391
- * clientId: "client_xyz789",
2392
2355
  * action: "read",
2393
2356
  * callerKeyId: "key_abc123",
2394
2357
  * resourceType: "intake_form",
@@ -2403,7 +2366,6 @@ var AuthClient = class {
2403
2366
  subjectType,
2404
2367
  subjectId,
2405
2368
  contextId,
2406
- clientId,
2407
2369
  from: from_,
2408
2370
  to,
2409
2371
  action,
@@ -2418,7 +2380,6 @@ var AuthClient = class {
2418
2380
  subjectType,
2419
2381
  subjectId,
2420
2382
  contextId,
2421
- clientId,
2422
2383
  from: from_,
2423
2384
  to,
2424
2385
  action,
@@ -2852,7 +2813,7 @@ var AuthClient = class {
2852
2813
  );
2853
2814
  }
2854
2815
  /**
2855
- * 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.
2816
+ * 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.
2856
2817
  *
2857
2818
  * @param {Vectros.CreateAccessProfileRequest} request
2858
2819
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4124,7 +4085,7 @@ var AuthClient = class {
4124
4085
  );
4125
4086
  }
4126
4087
  /**
4127
- * 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_*`).
4088
+ * 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_*`).
4128
4089
  *
4129
4090
  * @param {Vectros.TokenRequest} request
4130
4091
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4142,7 +4103,7 @@ var AuthClient = class {
4142
4103
  * "userId": "550e8400-e29b-41d4-a716-446655440000"
4143
4104
  * },
4144
4105
  * dataScope: {
4145
- * "orgId": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4106
+ * "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
4146
4107
  * }
4147
4108
  * },
4148
4109
  * expiresInSeconds: 3600
@@ -4341,7 +4302,7 @@ var ComplianceClient = class {
4341
4302
  this._options = normalizeClientOptionsWithAuth(options);
4342
4303
  }
4343
4304
  /**
4344
- * 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.
4305
+ * 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.
4345
4306
  *
4346
4307
  * @param {Vectros.ErasureRequest} request
4347
4308
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4592,7 +4553,7 @@ var DocumentsClient = class {
4592
4553
  this._options = normalizeClientOptionsWithAuth(options);
4593
4554
  }
4594
4555
  /**
4595
- * 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.
4556
+ * 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.
4596
4557
  *
4597
4558
  * @param {Vectros.ListDocumentsRequest} request
4598
4559
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4600,8 +4561,6 @@ var DocumentsClient = class {
4600
4561
  * @example
4601
4562
  * await client.documents.listDocuments({
4602
4563
  * userId: "550e8400-e29b-41d4-a716-446655440000",
4603
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
4604
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4605
4564
  * scope: "group:eng-team",
4606
4565
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
4607
4566
  * startFrom: "doc_prev123"
@@ -4611,11 +4570,9 @@ var DocumentsClient = class {
4611
4570
  return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
4612
4571
  }
4613
4572
  async __listDocuments(request = {}, requestOptions) {
4614
- const { userId, orgId, clientId, scope, folderId, startFrom, limit } = request;
4573
+ const { userId, scope, folderId, startFrom, limit } = request;
4615
4574
  const _queryParams = {
4616
4575
  userId,
4617
- orgId,
4618
- clientId,
4619
4576
  scope,
4620
4577
  folderId,
4621
4578
  startFrom,
@@ -5348,7 +5305,7 @@ var FoldersClient = class {
5348
5305
  this._options = normalizeClientOptionsWithAuth(options);
5349
5306
  }
5350
5307
  /**
5351
- * 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.
5308
+ * 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.
5352
5309
  *
5353
5310
  * @param {Vectros.ListFoldersRequest} request
5354
5311
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5356,9 +5313,8 @@ var FoldersClient = class {
5356
5313
  * @example
5357
5314
  * await client.folders.listFolders({
5358
5315
  * parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5359
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5360
5316
  * userId: "550e8400-e29b-41d4-a716-446655440000",
5361
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5317
+ * scope: "group:eng-team",
5362
5318
  * startFrom: "fld_prev123"
5363
5319
  * })
5364
5320
  */
@@ -5366,12 +5322,11 @@ var FoldersClient = class {
5366
5322
  return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
5367
5323
  }
5368
5324
  async __listFolders(request = {}, requestOptions) {
5369
- const { parentFolderId, orgId, userId, clientId, startFrom, limit } = request;
5325
+ const { parentFolderId, userId, scope, startFrom, limit } = request;
5370
5326
  const _queryParams = {
5371
5327
  parentFolderId,
5372
- orgId,
5373
5328
  userId,
5374
- clientId,
5329
+ scope,
5375
5330
  startFrom,
5376
5331
  limit
5377
5332
  };
@@ -5657,7 +5612,7 @@ var FoldersClient = class {
5657
5612
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
5658
5613
  }
5659
5614
  /**
5660
- * 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.
5615
+ * 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.
5661
5616
  *
5662
5617
  * @param {Vectros.PatchFolderRequest} request
5663
5618
  * @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5790,54 +5745,48 @@ var IdentityClient = class {
5790
5745
  this._options = normalizeClientOptionsWithAuth(options);
5791
5746
  }
5792
5747
  /**
5793
- * 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.
5748
+ * 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.
5794
5749
  *
5795
- * @param {Vectros.ListClientsRequest} request
5750
+ * @param {Vectros.ListEntitiesRequest} request
5796
5751
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5797
5752
  *
5798
5753
  * @example
5799
- * await client.identity.listClients({
5800
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
5801
- * userId: "550e8400-e29b-41d4-a716-446655440000",
5802
- * externalId: "patient_789",
5803
- * startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
5804
- * type: "client_v1",
5805
- * field: "industry",
5806
- * value: "healthcare",
5807
- * prefix: "health"
5754
+ * await client.identity.listEntities({
5755
+ * namespace: "team"
5808
5756
  * })
5809
5757
  */
5810
- listClients(request = {}, requestOptions) {
5811
- return HttpResponsePromise.fromPromise(this.__listClients(request, requestOptions));
5758
+ listEntities(request, requestOptions) {
5759
+ return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
5812
5760
  }
5813
- async __listClients(request = {}, requestOptions) {
5761
+ async __listEntities(request, requestOptions) {
5814
5762
  const {
5815
- orgId,
5763
+ namespace,
5816
5764
  userId,
5817
5765
  externalId,
5818
- startFrom,
5819
- limit,
5766
+ scope,
5820
5767
  type: type_,
5821
5768
  field,
5822
5769
  value,
5823
5770
  from: from_,
5824
5771
  to,
5825
5772
  prefix,
5826
- order
5773
+ order,
5774
+ startFrom,
5775
+ limit
5827
5776
  } = request;
5828
5777
  const _queryParams = {
5829
- orgId,
5830
5778
  userId,
5831
5779
  externalId,
5832
- startFrom,
5833
- limit,
5780
+ scope,
5834
5781
  type: type_,
5835
5782
  field,
5836
5783
  value,
5837
5784
  from: from_,
5838
5785
  to,
5839
5786
  prefix,
5840
- order: order != null ? order : void 0
5787
+ order: order != null ? order : void 0,
5788
+ startFrom,
5789
+ limit
5841
5790
  };
5842
5791
  const _authRequest = await this._options.authProvider.getAuthRequest();
5843
5792
  const _headers = mergeHeaders(
@@ -5848,7 +5797,7 @@ var IdentityClient = class {
5848
5797
  const _response = await fetcher({
5849
5798
  url: url_exports.join(
5850
5799
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5851
- "v1/clients"
5800
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5852
5801
  ),
5853
5802
  method: "GET",
5854
5803
  headers: _headers,
@@ -5869,12 +5818,12 @@ var IdentityClient = class {
5869
5818
  rawResponse: _response.rawResponse
5870
5819
  });
5871
5820
  }
5872
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients");
5821
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
5873
5822
  }
5874
5823
  /**
5875
- * 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.
5824
+ * 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.
5876
5825
  *
5877
- * @param {Vectros.CreateClientRequest} request
5826
+ * @param {Vectros.CreateEntityRequest} request
5878
5827
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5879
5828
  *
5880
5829
  * @throws {@link Vectros.BadRequestError}
@@ -5882,17 +5831,18 @@ var IdentityClient = class {
5882
5831
  * @throws {@link Vectros.TooManyRequestsError}
5883
5832
  *
5884
5833
  * @example
5885
- * await client.identity.createClient({
5834
+ * await client.identity.createEntity({
5835
+ * namespace: "team",
5886
5836
  * body: {
5887
- * externalId: "patient_789"
5837
+ * externalId: "team_eng_platform"
5888
5838
  * }
5889
5839
  * })
5890
5840
  */
5891
- createClient(request, requestOptions) {
5892
- return HttpResponsePromise.fromPromise(this.__createClient(request, requestOptions));
5841
+ createEntity(request, requestOptions) {
5842
+ return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
5893
5843
  }
5894
- async __createClient(request, requestOptions) {
5895
- const { upsert, body: _body } = request;
5844
+ async __createEntity(request, requestOptions) {
5845
+ const { namespace, upsert, body: _body } = request;
5896
5846
  const _queryParams = {
5897
5847
  upsert
5898
5848
  };
@@ -5905,7 +5855,7 @@ var IdentityClient = class {
5905
5855
  const _response = await fetcher({
5906
5856
  url: url_exports.join(
5907
5857
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5908
- "v1/clients"
5858
+ `v1/entities/${url_exports.encodePathParam(namespace)}`
5909
5859
  ),
5910
5860
  method: "POST",
5911
5861
  headers: _headers,
@@ -5938,26 +5888,27 @@ var IdentityClient = class {
5938
5888
  });
5939
5889
  }
5940
5890
  }
5941
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients");
5891
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
5942
5892
  }
5943
5893
  /**
5944
- * Returns a single client by its Vectros-assigned UUID. Requires the `clients:r` scope.
5894
+ * Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
5945
5895
  *
5946
- * @param {Vectros.GetClientRequest} request
5896
+ * @param {Vectros.GetEntityRequest} request
5947
5897
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
5948
5898
  *
5949
5899
  * @throws {@link Vectros.NotFoundError}
5950
5900
  *
5951
5901
  * @example
5952
- * await client.identity.getClient({
5953
- * id: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
5902
+ * await client.identity.getEntity({
5903
+ * namespace: "team",
5904
+ * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
5954
5905
  * })
5955
5906
  */
5956
- getClient(request, requestOptions) {
5957
- return HttpResponsePromise.fromPromise(this.__getClient(request, requestOptions));
5907
+ getEntity(request, requestOptions) {
5908
+ return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
5958
5909
  }
5959
- async __getClient(request, requestOptions) {
5960
- const { id } = request;
5910
+ async __getEntity(request, requestOptions) {
5911
+ const { namespace, id } = request;
5961
5912
  const _authRequest = await this._options.authProvider.getAuthRequest();
5962
5913
  const _headers = mergeHeaders(
5963
5914
  _authRequest.headers,
@@ -5967,7 +5918,7 @@ var IdentityClient = class {
5967
5918
  const _response = await fetcher({
5968
5919
  url: url_exports.join(
5969
5920
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
5970
- `v1/clients/${url_exports.encodePathParam(id)}`
5921
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
5971
5922
  ),
5972
5923
  method: "GET",
5973
5924
  headers: _headers,
@@ -5993,30 +5944,31 @@ var IdentityClient = class {
5993
5944
  });
5994
5945
  }
5995
5946
  }
5996
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}");
5947
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
5997
5948
  }
5998
5949
  /**
5999
- * 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.
5950
+ * 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.
6000
5951
  *
6001
- * @param {Vectros.UpdateClientRequest} request
5952
+ * @param {Vectros.UpdateEntityRequest} request
6002
5953
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6003
5954
  *
6004
5955
  * @throws {@link Vectros.NotFoundError}
6005
5956
  * @throws {@link Vectros.TooManyRequestsError}
6006
5957
  *
6007
5958
  * @example
6008
- * await client.identity.updateClient({
5959
+ * await client.identity.updateEntity({
5960
+ * namespace: "team",
6009
5961
  * id: "id",
6010
5962
  * body: {
6011
- * externalId: "patient_789"
5963
+ * externalId: "team_eng_platform"
6012
5964
  * }
6013
5965
  * })
6014
5966
  */
6015
- updateClient(request, requestOptions) {
6016
- return HttpResponsePromise.fromPromise(this.__updateClient(request, requestOptions));
5967
+ updateEntity(request, requestOptions) {
5968
+ return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
6017
5969
  }
6018
- async __updateClient(request, requestOptions) {
6019
- const { id, body: _body } = request;
5970
+ async __updateEntity(request, requestOptions) {
5971
+ const { namespace, id, body: _body } = request;
6020
5972
  const _authRequest = await this._options.authProvider.getAuthRequest();
6021
5973
  const _headers = mergeHeaders(
6022
5974
  _authRequest.headers,
@@ -6026,7 +5978,7 @@ var IdentityClient = class {
6026
5978
  const _response = await fetcher({
6027
5979
  url: url_exports.join(
6028
5980
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6029
- `v1/clients/${url_exports.encodePathParam(id)}`
5981
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6030
5982
  ),
6031
5983
  method: "PUT",
6032
5984
  headers: _headers,
@@ -6057,27 +6009,28 @@ var IdentityClient = class {
6057
6009
  });
6058
6010
  }
6059
6011
  }
6060
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/clients/{id}");
6012
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
6061
6013
  }
6062
6014
  /**
6063
- * Permanently deletes the client. This action cannot be undone. Requires the `clients:d` scope.
6015
+ * Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
6064
6016
  *
6065
- * @param {Vectros.DeleteClientRequest} request
6017
+ * @param {Vectros.DeleteEntityRequest} request
6066
6018
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6067
6019
  *
6068
6020
  * @throws {@link Vectros.NotFoundError}
6069
6021
  * @throws {@link Vectros.TooManyRequestsError}
6070
6022
  *
6071
6023
  * @example
6072
- * await client.identity.deleteClient({
6024
+ * await client.identity.deleteEntity({
6025
+ * namespace: "team",
6073
6026
  * id: "id"
6074
6027
  * })
6075
6028
  */
6076
- deleteClient(request, requestOptions) {
6077
- return HttpResponsePromise.fromPromise(this.__deleteClient(request, requestOptions));
6029
+ deleteEntity(request, requestOptions) {
6030
+ return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
6078
6031
  }
6079
- async __deleteClient(request, requestOptions) {
6080
- const { id } = request;
6032
+ async __deleteEntity(request, requestOptions) {
6033
+ const { namespace, id } = request;
6081
6034
  const _authRequest = await this._options.authProvider.getAuthRequest();
6082
6035
  const _headers = mergeHeaders(
6083
6036
  _authRequest.headers,
@@ -6087,7 +6040,7 @@ var IdentityClient = class {
6087
6040
  const _response = await fetcher({
6088
6041
  url: url_exports.join(
6089
6042
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6090
- `v1/clients/${url_exports.encodePathParam(id)}`
6043
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
6091
6044
  ),
6092
6045
  method: "DELETE",
6093
6046
  headers: _headers,
@@ -6115,27 +6068,36 @@ var IdentityClient = class {
6115
6068
  });
6116
6069
  }
6117
6070
  }
6118
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/clients/{id}");
6071
+ return handleNonStatusCodeError(
6072
+ _response.error,
6073
+ _response.rawResponse,
6074
+ "DELETE",
6075
+ "/v1/entities/{namespace}/{id}"
6076
+ );
6119
6077
  }
6120
6078
  /**
6121
- * 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.
6079
+ * 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.
6122
6080
  *
6123
- * @param {Vectros.IdentityLookupRequest} request
6081
+ * @param {Vectros.LookupEntitiesRequest} request
6124
6082
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6125
6083
  *
6126
6084
  * @throws {@link Vectros.BadRequestError}
6127
6085
  * @throws {@link Vectros.TooManyRequestsError}
6128
6086
  *
6129
6087
  * @example
6130
- * await client.identity.lookupClients({
6131
- * type: "person_v1",
6132
- * field: "ssn"
6088
+ * await client.identity.lookupEntities({
6089
+ * namespace: "team",
6090
+ * body: {
6091
+ * type: "person_v1",
6092
+ * field: "ssn"
6093
+ * }
6133
6094
  * })
6134
6095
  */
6135
- lookupClients(request, requestOptions) {
6136
- return HttpResponsePromise.fromPromise(this.__lookupClients(request, requestOptions));
6096
+ lookupEntities(request, requestOptions) {
6097
+ return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
6137
6098
  }
6138
- async __lookupClients(request, requestOptions) {
6099
+ async __lookupEntities(request, requestOptions) {
6100
+ const { namespace, body: _body } = request;
6139
6101
  const _authRequest = await this._options.authProvider.getAuthRequest();
6140
6102
  const _headers = mergeHeaders(
6141
6103
  _authRequest.headers,
@@ -6145,14 +6107,14 @@ var IdentityClient = class {
6145
6107
  const _response = await fetcher({
6146
6108
  url: url_exports.join(
6147
6109
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6148
- "v1/clients/lookup"
6110
+ `v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
6149
6111
  ),
6150
6112
  method: "POST",
6151
6113
  headers: _headers,
6152
6114
  contentType: "application/json",
6153
6115
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6154
6116
  requestType: "json",
6155
- body: request,
6117
+ body: _body,
6156
6118
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6157
6119
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6158
6120
  abortSignal: requestOptions?.abortSignal,
@@ -6176,26 +6138,32 @@ var IdentityClient = class {
6176
6138
  });
6177
6139
  }
6178
6140
  }
6179
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/clients/lookup");
6141
+ return handleNonStatusCodeError(
6142
+ _response.error,
6143
+ _response.rawResponse,
6144
+ "POST",
6145
+ "/v1/entities/{namespace}/lookup"
6146
+ );
6180
6147
  }
6181
6148
  /**
6182
- * 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.
6149
+ * 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.
6183
6150
  *
6184
- * @param {Vectros.GetClientVersionsRequest} request
6151
+ * @param {Vectros.GetEntityVersionsRequest} request
6185
6152
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6186
6153
  *
6187
6154
  * @throws {@link Vectros.NotFoundError}
6188
6155
  *
6189
6156
  * @example
6190
- * await client.identity.getClientVersions({
6157
+ * await client.identity.getEntityVersions({
6158
+ * namespace: "team",
6191
6159
  * id: "id"
6192
6160
  * })
6193
6161
  */
6194
- getClientVersions(request, requestOptions) {
6195
- return HttpResponsePromise.fromPromise(this.__getClientVersions(request, requestOptions));
6162
+ getEntityVersions(request, requestOptions) {
6163
+ return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
6196
6164
  }
6197
- async __getClientVersions(request, requestOptions) {
6198
- const { id, startFrom } = request;
6165
+ async __getEntityVersions(request, requestOptions) {
6166
+ const { namespace, id, startFrom } = request;
6199
6167
  const _queryParams = {
6200
6168
  startFrom
6201
6169
  };
@@ -6208,7 +6176,7 @@ var IdentityClient = class {
6208
6176
  const _response = await fetcher({
6209
6177
  url: url_exports.join(
6210
6178
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6211
- `v1/clients/${url_exports.encodePathParam(id)}/versions`
6179
+ `v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
6212
6180
  ),
6213
6181
  method: "GET",
6214
6182
  headers: _headers,
@@ -6234,174 +6202,31 @@ var IdentityClient = class {
6234
6202
  });
6235
6203
  }
6236
6204
  }
6237
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/clients/{id}/versions");
6238
- }
6239
- /**
6240
- * 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.
6241
- *
6242
- * @param {Vectros.ListOrgsRequest} request
6243
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6244
- *
6245
- * @example
6246
- * await client.identity.listOrgs({
6247
- * userId: "550e8400-e29b-41d4-a716-446655440000",
6248
- * externalId: "clinic_001",
6249
- * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
6250
- * type: "org_v1",
6251
- * field: "region",
6252
- * value: "us-east",
6253
- * prefix: "us-"
6254
- * })
6255
- */
6256
- listOrgs(request = {}, requestOptions) {
6257
- return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
6258
- }
6259
- async __listOrgs(request = {}, requestOptions) {
6260
- const {
6261
- userId,
6262
- externalId,
6263
- startFrom,
6264
- limit,
6265
- type: type_,
6266
- field,
6267
- value,
6268
- from: from_,
6269
- to,
6270
- prefix,
6271
- order
6272
- } = request;
6273
- const _queryParams = {
6274
- userId,
6275
- externalId,
6276
- startFrom,
6277
- limit,
6278
- type: type_,
6279
- field,
6280
- value,
6281
- from: from_,
6282
- to,
6283
- prefix,
6284
- order: order != null ? order : void 0
6285
- };
6286
- const _authRequest = await this._options.authProvider.getAuthRequest();
6287
- const _headers = mergeHeaders(
6288
- _authRequest.headers,
6289
- this._options?.headers,
6290
- requestOptions?.headers
6291
- );
6292
- const _response = await fetcher({
6293
- url: url_exports.join(
6294
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6295
- "v1/orgs"
6296
- ),
6297
- method: "GET",
6298
- headers: _headers,
6299
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6300
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6301
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6302
- abortSignal: requestOptions?.abortSignal,
6303
- fetchFn: this._options?.fetch,
6304
- logging: this._options.logging
6305
- });
6306
- if (_response.ok) {
6307
- return { data: _response.body, rawResponse: _response.rawResponse };
6308
- }
6309
- if (_response.error.reason === "status-code") {
6310
- throw new VectrosError({
6311
- statusCode: _response.error.statusCode,
6312
- body: _response.error.body,
6313
- rawResponse: _response.rawResponse
6314
- });
6315
- }
6316
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
6317
- }
6318
- /**
6319
- * 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.
6320
- *
6321
- * @param {Vectros.CreateOrgRequest} request
6322
- * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6323
- *
6324
- * @throws {@link Vectros.BadRequestError}
6325
- * @throws {@link Vectros.ForbiddenError}
6326
- * @throws {@link Vectros.TooManyRequestsError}
6327
- *
6328
- * @example
6329
- * await client.identity.createOrg({
6330
- * body: {
6331
- * externalId: "clinic_001"
6332
- * }
6333
- * })
6334
- */
6335
- createOrg(request, requestOptions) {
6336
- return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
6337
- }
6338
- async __createOrg(request, requestOptions) {
6339
- const { upsert, body: _body } = request;
6340
- const _queryParams = {
6341
- upsert
6342
- };
6343
- const _authRequest = await this._options.authProvider.getAuthRequest();
6344
- const _headers = mergeHeaders(
6345
- _authRequest.headers,
6346
- this._options?.headers,
6347
- requestOptions?.headers
6205
+ return handleNonStatusCodeError(
6206
+ _response.error,
6207
+ _response.rawResponse,
6208
+ "GET",
6209
+ "/v1/entities/{namespace}/{id}/versions"
6348
6210
  );
6349
- const _response = await fetcher({
6350
- url: url_exports.join(
6351
- await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6352
- "v1/orgs"
6353
- ),
6354
- method: "POST",
6355
- headers: _headers,
6356
- contentType: "application/json",
6357
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6358
- requestType: "json",
6359
- body: _body,
6360
- timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6361
- maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6362
- abortSignal: requestOptions?.abortSignal,
6363
- fetchFn: this._options?.fetch,
6364
- logging: this._options.logging
6365
- });
6366
- if (_response.ok) {
6367
- return { data: _response.body, rawResponse: _response.rawResponse };
6368
- }
6369
- if (_response.error.reason === "status-code") {
6370
- switch (_response.error.statusCode) {
6371
- case 400:
6372
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6373
- case 403:
6374
- throw new ForbiddenError(_response.error.body, _response.rawResponse);
6375
- case 429:
6376
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6377
- default:
6378
- throw new VectrosError({
6379
- statusCode: _response.error.statusCode,
6380
- body: _response.error.body,
6381
- rawResponse: _response.rawResponse
6382
- });
6383
- }
6384
- }
6385
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
6386
6211
  }
6387
6212
  /**
6388
- * Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
6213
+ * Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
6389
6214
  *
6390
- * @param {Vectros.GetOrgRequest} request
6215
+ * @param {Vectros.GetNamespaceRequest} request
6391
6216
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6392
6217
  *
6393
6218
  * @throws {@link Vectros.NotFoundError}
6394
6219
  *
6395
6220
  * @example
6396
- * await client.identity.getOrg({
6397
- * id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
6221
+ * await client.identity.getNamespace({
6222
+ * namespace: "team"
6398
6223
  * })
6399
6224
  */
6400
- getOrg(request, requestOptions) {
6401
- return HttpResponsePromise.fromPromise(this.__getOrg(request, requestOptions));
6225
+ getNamespace(request, requestOptions) {
6226
+ return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
6402
6227
  }
6403
- async __getOrg(request, requestOptions) {
6404
- const { id } = request;
6228
+ async __getNamespace(request, requestOptions) {
6229
+ const { namespace } = request;
6405
6230
  const _authRequest = await this._options.authProvider.getAuthRequest();
6406
6231
  const _headers = mergeHeaders(
6407
6232
  _authRequest.headers,
@@ -6411,7 +6236,7 @@ var IdentityClient = class {
6411
6236
  const _response = await fetcher({
6412
6237
  url: url_exports.join(
6413
6238
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6414
- `v1/orgs/${url_exports.encodePathParam(id)}`
6239
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6415
6240
  ),
6416
6241
  method: "GET",
6417
6242
  headers: _headers,
@@ -6437,30 +6262,31 @@ var IdentityClient = class {
6437
6262
  });
6438
6263
  }
6439
6264
  }
6440
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}");
6265
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
6441
6266
  }
6442
6267
  /**
6443
- * 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.
6268
+ * 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.
6444
6269
  *
6445
- * @param {Vectros.UpdateOrgRequest} request
6270
+ * @param {Vectros.UpdateNamespaceRequest} request
6446
6271
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6447
6272
  *
6273
+ * @throws {@link Vectros.ForbiddenError}
6448
6274
  * @throws {@link Vectros.NotFoundError}
6449
6275
  * @throws {@link Vectros.TooManyRequestsError}
6450
6276
  *
6451
6277
  * @example
6452
- * await client.identity.updateOrg({
6453
- * id: "id",
6278
+ * await client.identity.updateNamespace({
6279
+ * namespace: "team",
6454
6280
  * body: {
6455
- * externalId: "clinic_001"
6281
+ * namespace: "team"
6456
6282
  * }
6457
6283
  * })
6458
6284
  */
6459
- updateOrg(request, requestOptions) {
6460
- return HttpResponsePromise.fromPromise(this.__updateOrg(request, requestOptions));
6285
+ updateNamespace(request, requestOptions) {
6286
+ return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
6461
6287
  }
6462
- async __updateOrg(request, requestOptions) {
6463
- const { id, body: _body } = request;
6288
+ async __updateNamespace(request, requestOptions) {
6289
+ const { namespace, body: _body } = request;
6464
6290
  const _authRequest = await this._options.authProvider.getAuthRequest();
6465
6291
  const _headers = mergeHeaders(
6466
6292
  _authRequest.headers,
@@ -6470,7 +6296,7 @@ var IdentityClient = class {
6470
6296
  const _response = await fetcher({
6471
6297
  url: url_exports.join(
6472
6298
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6473
- `v1/orgs/${url_exports.encodePathParam(id)}`
6299
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6474
6300
  ),
6475
6301
  method: "PUT",
6476
6302
  headers: _headers,
@@ -6489,6 +6315,8 @@ var IdentityClient = class {
6489
6315
  }
6490
6316
  if (_response.error.reason === "status-code") {
6491
6317
  switch (_response.error.statusCode) {
6318
+ case 403:
6319
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6492
6320
  case 404:
6493
6321
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6494
6322
  case 429:
@@ -6501,27 +6329,28 @@ var IdentityClient = class {
6501
6329
  });
6502
6330
  }
6503
6331
  }
6504
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/orgs/{id}");
6332
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
6505
6333
  }
6506
6334
  /**
6507
- * Permanently deletes an organization. This action cannot be undone. Requires the `orgs:d` scope.
6335
+ * 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.
6508
6336
  *
6509
- * @param {Vectros.DeleteOrgRequest} request
6337
+ * @param {Vectros.DeleteNamespaceRequest} request
6510
6338
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6511
6339
  *
6340
+ * @throws {@link Vectros.ForbiddenError}
6512
6341
  * @throws {@link Vectros.NotFoundError}
6513
6342
  * @throws {@link Vectros.TooManyRequestsError}
6514
6343
  *
6515
6344
  * @example
6516
- * await client.identity.deleteOrg({
6517
- * id: "id"
6345
+ * await client.identity.deleteNamespace({
6346
+ * namespace: "team"
6518
6347
  * })
6519
6348
  */
6520
- deleteOrg(request, requestOptions) {
6521
- return HttpResponsePromise.fromPromise(this.__deleteOrg(request, requestOptions));
6349
+ deleteNamespace(request, requestOptions) {
6350
+ return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
6522
6351
  }
6523
- async __deleteOrg(request, requestOptions) {
6524
- const { id } = request;
6352
+ async __deleteNamespace(request, requestOptions) {
6353
+ const { namespace } = request;
6525
6354
  const _authRequest = await this._options.authProvider.getAuthRequest();
6526
6355
  const _headers = mergeHeaders(
6527
6356
  _authRequest.headers,
@@ -6531,7 +6360,7 @@ var IdentityClient = class {
6531
6360
  const _response = await fetcher({
6532
6361
  url: url_exports.join(
6533
6362
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6534
- `v1/orgs/${url_exports.encodePathParam(id)}`
6363
+ `v1/namespaces/${url_exports.encodePathParam(namespace)}`
6535
6364
  ),
6536
6365
  method: "DELETE",
6537
6366
  headers: _headers,
@@ -6547,6 +6376,8 @@ var IdentityClient = class {
6547
6376
  }
6548
6377
  if (_response.error.reason === "status-code") {
6549
6378
  switch (_response.error.statusCode) {
6379
+ case 403:
6380
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6550
6381
  case 404:
6551
6382
  throw new NotFoundError(_response.error.body, _response.rawResponse);
6552
6383
  case 429:
@@ -6559,27 +6390,26 @@ var IdentityClient = class {
6559
6390
  });
6560
6391
  }
6561
6392
  }
6562
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/orgs/{id}");
6393
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
6563
6394
  }
6564
6395
  /**
6565
- * 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.
6396
+ * Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
6566
6397
  *
6567
- * @param {Vectros.IdentityLookupRequest} request
6398
+ * @param {Vectros.ListNamespacesRequest} request
6568
6399
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6569
6400
  *
6570
- * @throws {@link Vectros.BadRequestError}
6571
- * @throws {@link Vectros.TooManyRequestsError}
6572
- *
6573
6401
  * @example
6574
- * await client.identity.lookupOrgs({
6575
- * type: "person_v1",
6576
- * field: "ssn"
6577
- * })
6402
+ * await client.identity.listNamespaces()
6578
6403
  */
6579
- lookupOrgs(request, requestOptions) {
6580
- return HttpResponsePromise.fromPromise(this.__lookupOrgs(request, requestOptions));
6404
+ listNamespaces(request = {}, requestOptions) {
6405
+ return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
6581
6406
  }
6582
- async __lookupOrgs(request, requestOptions) {
6407
+ async __listNamespaces(request = {}, requestOptions) {
6408
+ const { startFrom, limit } = request;
6409
+ const _queryParams = {
6410
+ startFrom,
6411
+ limit
6412
+ };
6583
6413
  const _authRequest = await this._options.authProvider.getAuthRequest();
6584
6414
  const _headers = mergeHeaders(
6585
6415
  _authRequest.headers,
@@ -6589,14 +6419,11 @@ var IdentityClient = class {
6589
6419
  const _response = await fetcher({
6590
6420
  url: url_exports.join(
6591
6421
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6592
- "v1/orgs/lookup"
6422
+ "v1/namespaces"
6593
6423
  ),
6594
- method: "POST",
6424
+ method: "GET",
6595
6425
  headers: _headers,
6596
- contentType: "application/json",
6597
- queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6598
- requestType: "json",
6599
- body: request,
6426
+ queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6600
6427
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6601
6428
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6602
6429
  abortSignal: requestOptions?.abortSignal,
@@ -6607,42 +6434,33 @@ var IdentityClient = class {
6607
6434
  return { data: _response.body, rawResponse: _response.rawResponse };
6608
6435
  }
6609
6436
  if (_response.error.reason === "status-code") {
6610
- switch (_response.error.statusCode) {
6611
- case 400:
6612
- throw new BadRequestError(_response.error.body, _response.rawResponse);
6613
- case 429:
6614
- throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6615
- default:
6616
- throw new VectrosError({
6617
- statusCode: _response.error.statusCode,
6618
- body: _response.error.body,
6619
- rawResponse: _response.rawResponse
6620
- });
6621
- }
6437
+ throw new VectrosError({
6438
+ statusCode: _response.error.statusCode,
6439
+ body: _response.error.body,
6440
+ rawResponse: _response.rawResponse
6441
+ });
6622
6442
  }
6623
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs/lookup");
6443
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
6624
6444
  }
6625
6445
  /**
6626
- * 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.
6446
+ * 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.
6627
6447
  *
6628
- * @param {Vectros.GetOrgVersionsRequest} request
6448
+ * @param {Vectros.NamespaceRequest} request
6629
6449
  * @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
6630
6450
  *
6631
- * @throws {@link Vectros.NotFoundError}
6451
+ * @throws {@link Vectros.BadRequestError}
6452
+ * @throws {@link Vectros.ForbiddenError}
6453
+ * @throws {@link Vectros.TooManyRequestsError}
6632
6454
  *
6633
6455
  * @example
6634
- * await client.identity.getOrgVersions({
6635
- * id: "id"
6456
+ * await client.identity.registerNamespace({
6457
+ * namespace: "team"
6636
6458
  * })
6637
6459
  */
6638
- getOrgVersions(request, requestOptions) {
6639
- return HttpResponsePromise.fromPromise(this.__getOrgVersions(request, requestOptions));
6460
+ registerNamespace(request, requestOptions) {
6461
+ return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
6640
6462
  }
6641
- async __getOrgVersions(request, requestOptions) {
6642
- const { id, startFrom } = request;
6643
- const _queryParams = {
6644
- startFrom
6645
- };
6463
+ async __registerNamespace(request, requestOptions) {
6646
6464
  const _authRequest = await this._options.authProvider.getAuthRequest();
6647
6465
  const _headers = mergeHeaders(
6648
6466
  _authRequest.headers,
@@ -6652,11 +6470,14 @@ var IdentityClient = class {
6652
6470
  const _response = await fetcher({
6653
6471
  url: url_exports.join(
6654
6472
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
6655
- `v1/orgs/${url_exports.encodePathParam(id)}/versions`
6473
+ "v1/namespaces"
6656
6474
  ),
6657
- method: "GET",
6475
+ method: "POST",
6658
6476
  headers: _headers,
6659
- queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
6477
+ contentType: "application/json",
6478
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
6479
+ requestType: "json",
6480
+ body: request,
6660
6481
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
6661
6482
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
6662
6483
  abortSignal: requestOptions?.abortSignal,
@@ -6668,8 +6489,12 @@ var IdentityClient = class {
6668
6489
  }
6669
6490
  if (_response.error.reason === "status-code") {
6670
6491
  switch (_response.error.statusCode) {
6671
- case 404:
6672
- throw new NotFoundError(_response.error.body, _response.rawResponse);
6492
+ case 400:
6493
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
6494
+ case 403:
6495
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
6496
+ case 429:
6497
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
6673
6498
  default:
6674
6499
  throw new VectrosError({
6675
6500
  statusCode: _response.error.statusCode,
@@ -6678,7 +6503,7 @@ var IdentityClient = class {
6678
6503
  });
6679
6504
  }
6680
6505
  }
6681
- return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs/{id}/versions");
6506
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
6682
6507
  }
6683
6508
  /**
6684
6509
  * 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.
@@ -7555,7 +7380,7 @@ var RecordsClient = class {
7555
7380
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
7556
7381
  }
7557
7382
  /**
7558
- * 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.
7383
+ * 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.
7559
7384
  *
7560
7385
  * @param {Vectros.ListRecordsRequest} request
7561
7386
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7565,8 +7390,6 @@ var RecordsClient = class {
7565
7390
  * type: "intake_form",
7566
7391
  * folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7567
7392
  * userId: "550e8400-e29b-41d4-a716-446655440000",
7568
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
7569
- * clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
7570
7393
  * scope: "group:eng-team",
7571
7394
  * startFrom: "550e8400-e29b-41d4-a716-446655440000"
7572
7395
  * })
@@ -7575,24 +7398,11 @@ var RecordsClient = class {
7575
7398
  return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
7576
7399
  }
7577
7400
  async __listRecords(request = {}, requestOptions) {
7578
- const {
7579
- type: type_,
7580
- folderId,
7581
- userId,
7582
- orgId,
7583
- clientId,
7584
- scope,
7585
- startFrom,
7586
- limit,
7587
- includePayload,
7588
- recent
7589
- } = request;
7401
+ const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
7590
7402
  const _queryParams = {
7591
7403
  type: type_,
7592
7404
  folderId,
7593
7405
  userId,
7594
- orgId,
7595
- clientId,
7596
7406
  scope,
7597
7407
  startFrom,
7598
7408
  limit,
@@ -7892,7 +7702,7 @@ var RecordsClient = class {
7892
7702
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
7893
7703
  }
7894
7704
  /**
7895
- * 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.
7705
+ * 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.
7896
7706
  *
7897
7707
  * @param {Vectros.PatchRecordRequest} request
7898
7708
  * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8218,7 +8028,7 @@ var SchemasClient = class {
8218
8028
  this._options = normalizeClientOptionsWithAuth(options);
8219
8029
  }
8220
8030
  /**
8221
- * 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.
8031
+ * 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.
8222
8032
  *
8223
8033
  * @param {Vectros.ListSchemasRequest} request
8224
8034
  * @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -8226,7 +8036,7 @@ var SchemasClient = class {
8226
8036
  * @example
8227
8037
  * await client.schemas.listSchemas({
8228
8038
  * userId: "550e8400-e29b-41d4-a716-446655440000",
8229
- * orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8039
+ * scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
8230
8040
  * surface: "document",
8231
8041
  * recordType: "intake_form",
8232
8042
  * startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
@@ -8236,10 +8046,10 @@ var SchemasClient = class {
8236
8046
  return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
8237
8047
  }
8238
8048
  async __listSchemas(request = {}, requestOptions) {
8239
- const { userId, orgId, surface, recordType, startFrom, limit } = request;
8049
+ const { userId, scope, surface, recordType, startFrom, limit } = request;
8240
8050
  const _queryParams = {
8241
8051
  userId,
8242
- orgId,
8052
+ scope,
8243
8053
  surface,
8244
8054
  recordType,
8245
8055
  startFrom,
@@ -8685,12 +8495,12 @@ var VectrosClient = class {
8685
8495
  get auth() {
8686
8496
  return this._auth ?? (this._auth = new AuthClient(this._options));
8687
8497
  }
8688
- get identity() {
8689
- return this._identity ?? (this._identity = new IdentityClient(this._options));
8690
- }
8691
8498
  get documents() {
8692
8499
  return this._documents ?? (this._documents = new DocumentsClient(this._options));
8693
8500
  }
8501
+ get identity() {
8502
+ return this._identity ?? (this._identity = new IdentityClient(this._options));
8503
+ }
8694
8504
  get compliance() {
8695
8505
  return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
8696
8506
  }
@@ -8793,8 +8603,8 @@ function warnOnSuboptimalKey(key, log) {
8793
8603
 
8794
8604
  // src/build-info.ts
8795
8605
  var BUILD_INFO = {
8796
- mcpServer: true ? "0.9.0" : "dev",
8797
- sdk: true ? "0.34.0" : "dev"
8606
+ mcpServer: true ? "0.11.0" : "dev",
8607
+ sdk: true ? "0.36.0" : "dev"
8798
8608
  };
8799
8609
 
8800
8610
  // src/log.ts
@@ -8998,31 +8808,45 @@ async function consumeStream(stream, onProgress) {
8998
8808
  }
8999
8809
 
9000
8810
  // src/tools/errors.ts
8811
+ function asErrorBody(body) {
8812
+ if (body && typeof body === "object") return body;
8813
+ return void 0;
8814
+ }
9001
8815
  function toolError(toolName, err, docPointer) {
9002
8816
  let summary = `${toolName} failed`;
9003
8817
  let detail = String(err);
8818
+ let errorCode;
8819
+ let requestId;
9004
8820
  if (err instanceof StreamError) {
9005
8821
  summary = `${toolName} stream error`;
9006
8822
  detail = err.message;
9007
8823
  } else if (err instanceof Error) {
9008
8824
  const e = err;
9009
8825
  detail = e.message;
8826
+ const body = asErrorBody(e.body);
8827
+ if (body) {
8828
+ if (typeof body.message === "string" && body.message.trim().length > 0) detail = body.message;
8829
+ if (typeof body.errorCode === "string" && body.errorCode.length > 0) errorCode = body.errorCode;
8830
+ if (typeof body.requestId === "string" && body.requestId.length > 0) requestId = body.requestId;
8831
+ }
9010
8832
  if (e.statusCode) {
9011
- summary = `${toolName} failed: HTTP ${e.statusCode}`;
8833
+ summary = `${toolName} failed: HTTP ${e.statusCode}${errorCode ? ` (${errorCode})` : ""}`;
9012
8834
  } else if (e.name && e.name !== "Error") {
9013
8835
  summary = `${toolName} failed: ${e.name}`;
9014
8836
  }
9015
8837
  }
9016
- const pointer = docPointer ? `
8838
+ const trailer = (errorCode ? `
8839
+ errorCode: ${errorCode}` : "") + (requestId ? `
8840
+ requestId: ${requestId}` : "") + (docPointer ? `
9017
8841
 
9018
- See: ${docPointer}` : "";
8842
+ See: ${docPointer}` : "");
9019
8843
  return {
9020
8844
  isError: true,
9021
8845
  content: [
9022
8846
  {
9023
8847
  type: "text",
9024
8848
  text: `${summary}
9025
- ${detail}${pointer}`
8849
+ ${detail}${trailer}`
9026
8850
  }
9027
8851
  ]
9028
8852
  };
@@ -9079,10 +8903,8 @@ var inputSchema = {
9079
8903
  ),
9080
8904
  // Ownership.
9081
8905
  userId: z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
9082
- orgId: z.string().optional().describe("Restrict to content belonging to this org (Vectros UUID)."),
9083
- clientId: z.string().optional().describe("Restrict to content associated with this client (Vectros UUID)."),
9084
8906
  scope: z.string().optional().describe(
9085
- '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.'
8907
+ '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.'
9086
8908
  ),
9087
8909
  // Date window.
9088
8910
  createdAfter: z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
@@ -9101,7 +8923,7 @@ var inputSchema = {
9101
8923
  var hybridSearch = ({ client, log }) => ({
9102
8924
  name: "hybrid_search",
9103
8925
  title: "Hybrid search",
9104
- 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\".",
8926
+ 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).',
9105
8927
  inputSchema,
9106
8928
  handler: async (args) => {
9107
8929
  const limit = args.limit ?? MCP_DEFAULT_LIMIT;
@@ -9119,8 +8941,6 @@ var hybridSearch = ({ client, log }) => ({
9119
8941
  typeName: args.typeName,
9120
8942
  filters: args.filters,
9121
8943
  userId: args.userId,
9122
- orgId: args.orgId,
9123
- clientId: args.clientId,
9124
8944
  scope: args.scope,
9125
8945
  createdAfter: args.createdAfter,
9126
8946
  createdBefore: args.createdBefore,
@@ -9205,10 +9025,8 @@ var inputSchema2 = {
9205
9025
  ),
9206
9026
  // List-mode args:
9207
9027
  userId: z2.string().optional().describe("List mode: scope to records owned by this user."),
9208
- orgId: z2.string().optional().describe("List mode: scope to records owned by this org."),
9209
- clientId: z2.string().optional().describe("List mode: scope to records associated with this client."),
9210
9028
  scope: z2.string().optional().describe(
9211
- '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.'
9029
+ '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.'
9212
9030
  ),
9213
9031
  startFrom: z2.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9214
9032
  limit: z2.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
@@ -9218,7 +9036,7 @@ var inputSchema2 = {
9218
9036
  var recordQuery = ({ client, log }) => ({
9219
9037
  name: "record_query",
9220
9038
  title: "Record query (list or lookup)",
9221
- 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.",
9039
+ 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.",
9222
9040
  inputSchema: inputSchema2,
9223
9041
  handler: async (args) => {
9224
9042
  const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
@@ -9272,8 +9090,6 @@ var recordQuery = ({ client, log }) => ({
9272
9090
  page = await client.records.listRecords({
9273
9091
  type,
9274
9092
  userId: args.userId,
9275
- orgId: args.orgId,
9276
- clientId: args.clientId,
9277
9093
  scope: args.scope,
9278
9094
  startFrom,
9279
9095
  limit
@@ -9359,7 +9175,7 @@ var inputSchema3 = {
9359
9175
  var recordGet = ({ client, log }) => ({
9360
9176
  name: "record_get",
9361
9177
  title: "Get a record by id or externalId",
9362
- 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.",
9178
+ 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.",
9363
9179
  inputSchema: inputSchema3,
9364
9180
  handler: async (args) => {
9365
9181
  const id = args.id;
@@ -9397,7 +9213,7 @@ import { z as z4 } from "zod";
9397
9213
  var inputSchema4 = {
9398
9214
  type: z4.string().min(1, "type is required").describe('Record type / schema name (e.g. "task"). Must match an existing schema \u2014 see list_schemas.'),
9399
9215
  fields: z4.record(z4.string(), z4.unknown()).describe(
9400
- "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."
9216
+ "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."
9401
9217
  ),
9402
9218
  externalId: z4.string().optional().describe(
9403
9219
  "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."
@@ -9408,16 +9224,14 @@ var inputSchema4 = {
9408
9224
  status: z4.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
9409
9225
  folderId: z4.string().optional().describe("Group this record into a folder."),
9410
9226
  userId: z4.string().optional().describe("Owning user id."),
9411
- orgId: z4.string().optional().describe("Owning organization id."),
9412
- clientId: z4.string().optional().describe("Associated client id."),
9413
9227
  scopes: z4.array(z4.string()).optional().describe(
9414
- '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.'
9228
+ '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.'
9415
9229
  )
9416
9230
  };
9417
9231
  var recordCreate = ({ client, log }) => ({
9418
9232
  name: "record_create",
9419
9233
  title: "Create a record",
9420
- 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.",
9234
+ 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).",
9421
9235
  inputSchema: inputSchema4,
9422
9236
  handler: async (args) => {
9423
9237
  const type = args.type;
@@ -9431,8 +9245,6 @@ var recordCreate = ({ client, log }) => ({
9431
9245
  status: args.status,
9432
9246
  folderId: args.folderId,
9433
9247
  userId: args.userId,
9434
- orgId: args.orgId,
9435
- clientId: args.clientId,
9436
9248
  scopes: args.scopes
9437
9249
  }
9438
9250
  });
@@ -9536,10 +9348,8 @@ var inputSchema7 = {
9536
9348
  // answer on a specific owner / folder / type / metadata subset, not just the
9537
9349
  // whole-tenant corpus.
9538
9350
  userId: z7.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
9539
- orgId: z7.string().optional().describe("Restrict retrieval to content owned by this org (Vectros UUID)."),
9540
- clientId: z7.string().optional().describe("Restrict retrieval to content tagged with this client (Vectros UUID)."),
9541
9351
  scope: z7.string().optional().describe(
9542
- '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.'
9352
+ '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.'
9543
9353
  ),
9544
9354
  folderId: z7.string().optional().describe("Restrict retrieval to this exact folder."),
9545
9355
  rootFolderId: z7.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
@@ -9567,8 +9377,6 @@ var ragAsk = ({ client, log }) => ({
9567
9377
  mode: searchArg.mode ?? "HYBRID",
9568
9378
  limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
9569
9379
  userId: searchArg.userId,
9570
- orgId: searchArg.orgId,
9571
- clientId: searchArg.clientId,
9572
9380
  scope: searchArg.scope,
9573
9381
  folderId: searchArg.folderId,
9574
9382
  rootFolderId: searchArg.rootFolderId,
@@ -9714,32 +9522,32 @@ var inputSchema9 = {
9714
9522
  userId: z9.string().optional().describe(
9715
9523
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
9716
9524
  ),
9717
- orgId: z9.string().optional().describe(
9718
- "Filter to schemas visible to a specific org. Optional; default returns all schemas the credential can see."
9525
+ scope: z9.string().optional().describe(
9526
+ '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.'
9719
9527
  ),
9720
- surface: z9.enum(["record", "document", "user", "org", "client"]).optional().describe(
9721
- "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."
9528
+ surface: z9.enum(["record", "document", "user", "entity"]).optional().describe(
9529
+ "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."
9722
9530
  ),
9723
9531
  recordType: z9.string().optional().describe(
9724
- '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.'
9532
+ '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.'
9725
9533
  )
9726
9534
  };
9727
9535
  var listSchemas = ({ client, log }) => ({
9728
9536
  name: "list_schemas",
9729
9537
  title: "List record schemas",
9730
- 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.',
9538
+ 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.',
9731
9539
  inputSchema: inputSchema9,
9732
9540
  handler: async (args) => {
9733
9541
  const userId = args.userId;
9734
- const orgId = args.orgId;
9542
+ const scope = args.scope;
9735
9543
  const surface = args.surface;
9736
9544
  const recordType = args.recordType;
9737
9545
  try {
9738
9546
  const schemas = await drainPages(
9739
- (startFrom) => client.schemas.listSchemas({ userId, orgId, surface, recordType, startFrom })
9547
+ (startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
9740
9548
  );
9741
9549
  log.debug(
9742
- { tool: "list_schemas", userId, orgId, surface, recordType, returned: schemas.length },
9550
+ { tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
9743
9551
  "list_schemas ok"
9744
9552
  );
9745
9553
  return {
@@ -9781,7 +9589,7 @@ function isNotAvailable(err) {
9781
9589
  var documentGet = ({ client, log }) => ({
9782
9590
  name: "document_get",
9783
9591
  title: "Get document metadata (and optionally text)",
9784
- 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`.",
9592
+ 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.",
9785
9593
  inputSchema: inputSchema10,
9786
9594
  handler: async (args) => {
9787
9595
  const documentId = args.documentId;
@@ -9864,10 +9672,8 @@ var inputSchema11 = {
9864
9672
  // List-mode args:
9865
9673
  folderId: z11.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
9866
9674
  userId: z11.string().optional().describe("List mode: scope to documents owned by this user."),
9867
- orgId: z11.string().optional().describe("List mode: scope to documents belonging to this org."),
9868
- clientId: z11.string().optional().describe("List mode: scope to documents associated with this client."),
9869
9675
  scope: z11.string().optional().describe(
9870
- '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.'
9676
+ '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.'
9871
9677
  ),
9872
9678
  startFrom: z11.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
9873
9679
  limit: z11.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
@@ -9877,7 +9683,7 @@ var inputSchema11 = {
9877
9683
  var documentQuery = ({ client, log }) => ({
9878
9684
  name: "document_query",
9879
9685
  title: "Document query (list or lookup)",
9880
- 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.",
9686
+ 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.",
9881
9687
  inputSchema: inputSchema11,
9882
9688
  handler: async (args) => {
9883
9689
  const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
@@ -9937,8 +9743,6 @@ var documentQuery = ({ client, log }) => ({
9937
9743
  page = await client.documents.listDocuments({
9938
9744
  folderId: args.folderId,
9939
9745
  userId: args.userId,
9940
- orgId: args.orgId,
9941
- clientId: args.clientId,
9942
9746
  scope: args.scope,
9943
9747
  startFrom,
9944
9748
  limit
@@ -9979,8 +9783,9 @@ var inputSchema12 = {
9979
9783
  "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."
9980
9784
  ),
9981
9785
  userId: z12.string().optional().describe("Reassign the owning user (Vectros UUID)."),
9982
- orgId: z12.string().optional().describe("Reassign the owning org (Vectros UUID)."),
9983
- clientId: z12.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9786
+ scopes: z12.array(z12.string()).optional().describe(
9787
+ '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).'
9788
+ ),
9984
9789
  expectedVersion: z12.number().int().optional().describe(
9985
9790
  "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."
9986
9791
  )
@@ -10000,8 +9805,7 @@ var documentUpdate = ({ client, log }) => ({
10000
9805
  const folderId = args.folderId;
10001
9806
  const status = args.status;
10002
9807
  const userId = args.userId;
10003
- const orgId = args.orgId;
10004
- const clientId = args.clientId;
9808
+ const scopes = args.scopes;
10005
9809
  const expectedVersion = args.expectedVersion;
10006
9810
  try {
10007
9811
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
@@ -10013,8 +9817,7 @@ var documentUpdate = ({ client, log }) => ({
10013
9817
  if (folderId !== void 0) body.folderId = folderId;
10014
9818
  if (status !== void 0) body.status = status;
10015
9819
  if (userId !== void 0) body.userId = userId;
10016
- if (orgId !== void 0) body.orgId = orgId;
10017
- if (clientId !== void 0) body.clientId = clientId;
9820
+ if (scopes !== void 0) body.scopes = scopes;
10018
9821
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10019
9822
  const updated = await client.documents.patchDocument({
10020
9823
  id: resolved.id,
@@ -10064,8 +9867,9 @@ var inputSchema14 = {
10064
9867
  id: z14.string().optional().describe("Get mode: fetch this single folder by id."),
10065
9868
  parentId: z14.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
10066
9869
  userId: z14.string().optional().describe("List mode: scope to folders owned by this user."),
10067
- orgId: z14.string().optional().describe("List mode: scope to folders belonging to this org."),
10068
- clientId: z14.string().optional().describe("List mode: scope to folders associated with this client."),
9870
+ scope: z14.string().optional().describe(
9871
+ '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.'
9872
+ ),
10069
9873
  startFrom: z14.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
10070
9874
  limit: z14.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
10071
9875
  `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\`.`
@@ -10074,7 +9878,7 @@ var inputSchema14 = {
10074
9878
  var folderQuery = ({ client, log }) => ({
10075
9879
  name: "folder_query",
10076
9880
  title: "Folder query (list or get)",
10077
- 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.",
9881
+ 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.",
10078
9882
  inputSchema: inputSchema14,
10079
9883
  handler: async (args) => {
10080
9884
  const id = args.id;
@@ -10088,8 +9892,7 @@ var folderQuery = ({ client, log }) => ({
10088
9892
  const page = await client.folders.listFolders({
10089
9893
  parentFolderId: args.parentId,
10090
9894
  userId: args.userId,
10091
- orgId: args.orgId,
10092
- clientId: args.clientId,
9895
+ scope: args.scope,
10093
9896
  startFrom: args.startFrom,
10094
9897
  limit
10095
9898
  });
@@ -10113,16 +9916,14 @@ var inputSchema15 = {
10113
9916
  parentId: z15.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
10114
9917
  slug: z15.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
10115
9918
  userId: z15.string().optional().describe("Owning user (Vectros UUID)."),
10116
- orgId: z15.string().optional().describe("Owning org (Vectros UUID)."),
10117
- clientId: z15.string().optional().describe("Associated client (Vectros UUID)."),
10118
9919
  scopes: z15.array(z15.string()).optional().describe(
10119
- '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.'
9920
+ '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.'
10120
9921
  )
10121
9922
  };
10122
9923
  var folderCreate = ({ client, log }) => ({
10123
9924
  name: "folder_create",
10124
9925
  title: "Create a folder",
10125
- 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.",
9926
+ 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).",
10126
9927
  inputSchema: inputSchema15,
10127
9928
  handler: async (args) => {
10128
9929
  try {
@@ -10133,8 +9934,6 @@ var folderCreate = ({ client, log }) => ({
10133
9934
  parentFolderId: args.parentId,
10134
9935
  slug: args.slug,
10135
9936
  userId: args.userId,
10136
- orgId: args.orgId,
10137
- clientId: args.clientId,
10138
9937
  scopes: args.scopes
10139
9938
  }
10140
9939
  });
@@ -10155,8 +9954,9 @@ var inputSchema16 = {
10155
9954
  name: z16.string().optional().describe("New folder name. Omit to keep the current name."),
10156
9955
  description: z16.string().optional().describe("New description. Omit to leave unchanged."),
10157
9956
  userId: z16.string().optional().describe("Reassign the owning user (Vectros UUID)."),
10158
- orgId: z16.string().optional().describe("Reassign the owning org (Vectros UUID)."),
10159
- clientId: z16.string().optional().describe("Reassign the associated client (Vectros UUID)."),
9957
+ scopes: z16.array(z16.string()).optional().describe(
9958
+ '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).'
9959
+ ),
10160
9960
  expectedVersion: z16.number().int().optional().describe(
10161
9961
  "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."
10162
9962
  )
@@ -10171,16 +9971,14 @@ var folderUpdate = ({ client, log }) => ({
10171
9971
  const name = args.name;
10172
9972
  const description = args.description;
10173
9973
  const userId = args.userId;
10174
- const orgId = args.orgId;
10175
- const clientId = args.clientId;
9974
+ const scopes = args.scopes;
10176
9975
  const expectedVersion = args.expectedVersion;
10177
9976
  try {
10178
9977
  const body = {};
10179
9978
  if (name !== void 0) body.name = name;
10180
9979
  if (description !== void 0) body.description = description;
10181
9980
  if (userId !== void 0) body.userId = userId;
10182
- if (orgId !== void 0) body.orgId = orgId;
10183
- if (clientId !== void 0) body.clientId = clientId;
9981
+ if (scopes !== void 0) body.scopes = scopes;
10184
9982
  if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
10185
9983
  const updated = await client.folders.patchFolder({ id, body });
10186
9984
  log.debug({ tool: "folder_update", id }, "folder_update ok");
@@ -10224,7 +10022,7 @@ var inputSchema18 = {
10224
10022
  var currentIdentity = ({ log, apiKey, environment }) => ({
10225
10023
  name: "current_identity",
10226
10024
  title: "Current identity (tenant + principal scope)",
10227
- 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.",
10025
+ 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.",
10228
10026
  inputSchema: inputSchema18,
10229
10027
  handler: async () => {
10230
10028
  try {
@@ -10322,7 +10120,7 @@ var inputSchema19 = {
10322
10120
  "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."
10323
10121
  ),
10324
10122
  externalId: z18.string().optional().describe(
10325
- "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."
10123
+ '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.'
10326
10124
  ),
10327
10125
  upsert: z18.boolean().optional().describe(
10328
10126
  "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)."
@@ -10331,12 +10129,12 @@ var inputSchema19 = {
10331
10129
  "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."
10332
10130
  ),
10333
10131
  payload: z18.record(z18.string(), z18.unknown()).optional().describe(
10334
- "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."
10132
+ "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."
10335
10133
  ),
10336
10134
  // Inline text mode (mutually exclusive with filePath):
10337
10135
  text: z18.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
10338
10136
  storeText: z18.boolean().optional().describe(
10339
- "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."
10137
+ "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."
10340
10138
  ),
10341
10139
  // File upload mode (mutually exclusive with text; stdio-transport-only):
10342
10140
  filePath: z18.string().min(1).optional().describe(
@@ -10346,16 +10144,14 @@ var inputSchema19 = {
10346
10144
  // Common (both modes):
10347
10145
  folderId: z18.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
10348
10146
  userId: z18.string().optional().describe("Owning user ID. Optional."),
10349
- orgId: z18.string().optional().describe("Owning org ID. Optional."),
10350
- clientId: z18.string().optional().describe("Owning client ID. Optional."),
10351
10147
  scopes: z18.array(z18.string()).optional().describe(
10352
- "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."
10148
+ "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."
10353
10149
  )
10354
10150
  };
10355
10151
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10356
10152
  name: "document_ingest",
10357
10153
  title: "Ingest a new document (text body or file upload)",
10358
- 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.",
10154
+ 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`.",
10359
10155
  inputSchema: inputSchema19,
10360
10156
  handler: async (args) => {
10361
10157
  const title = args.title;
@@ -10392,14 +10188,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
10392
10188
  )
10393
10189
  );
10394
10190
  }
10191
+ if (text && args.storeText !== void 0) {
10192
+ return toolError(
10193
+ "document_ingest",
10194
+ new Error(
10195
+ "`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."
10196
+ )
10197
+ );
10198
+ }
10395
10199
  const common = {
10396
10200
  folderId: args.folderId,
10397
10201
  payload: args.payload,
10398
10202
  schemaId,
10399
10203
  externalId: args.externalId,
10400
- userId: args.userId,
10401
- orgId: args.orgId,
10402
- clientId: args.clientId
10204
+ userId: args.userId
10403
10205
  };
10404
10206
  try {
10405
10207
  if (text) {
@@ -10506,7 +10308,9 @@ import { z as z19 } from "zod";
10506
10308
  var MCP_DEFAULT_LIMIT5 = 10;
10507
10309
  var MCP_MAX_LIMIT5 = 100;
10508
10310
  var inputSchema20 = {
10509
- kind: z19.enum(["user", "org", "client"]).describe("Which principal to look up: a user, an organization, or a client."),
10311
+ kind: z19.string().describe(
10312
+ 'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
10313
+ ),
10510
10314
  externalId: z19.string().optional().describe(
10511
10315
  "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."
10512
10316
  ),
@@ -10525,11 +10329,12 @@ var inputSchema20 = {
10525
10329
  };
10526
10330
  var lookupPrincipal = ({ client, log }) => ({
10527
10331
  name: "lookup_principal",
10528
- title: "Look up a user / org / client identity",
10529
- 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.",
10332
+ title: "Look up a user identity or a namespaced identity entity",
10333
+ 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.",
10530
10334
  inputSchema: inputSchema20,
10531
10335
  handler: async (args) => {
10532
10336
  const kind = args.kind;
10337
+ const isUser = kind === "user";
10533
10338
  const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
10534
10339
  const externalId = args.externalId;
10535
10340
  const type = args.type;
@@ -10543,13 +10348,7 @@ var lookupPrincipal = ({ client, log }) => ({
10543
10348
  try {
10544
10349
  let page;
10545
10350
  if (externalId !== void 0) {
10546
- if (kind === "user") {
10547
- page = await client.identity.listUsers({ externalId, limit });
10548
- } else if (kind === "org") {
10549
- page = await client.identity.listOrgs({ externalId, limit });
10550
- } else {
10551
- page = await client.identity.listClients({ externalId, limit });
10552
- }
10351
+ page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
10553
10352
  log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
10554
10353
  } else if (field !== void 0) {
10555
10354
  const hasEquality = value !== void 0;
@@ -10578,13 +10377,7 @@ var lookupPrincipal = ({ client, log }) => ({
10578
10377
  );
10579
10378
  }
10580
10379
  const req = { type, field, value, from, to, prefix, order, startFrom, limit };
10581
- if (kind === "user") {
10582
- page = await client.identity.lookupUsers(req);
10583
- } else if (kind === "org") {
10584
- page = await client.identity.lookupOrgs(req);
10585
- } else {
10586
- page = await client.identity.lookupClients(req);
10587
- }
10380
+ page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
10588
10381
  log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
10589
10382
  } else {
10590
10383
  return toolError(
@@ -10707,7 +10500,7 @@ var identityResource = ({ log, apiKey, environment }) => ({
10707
10500
  name: "identity",
10708
10501
  uri: "vectros://identity",
10709
10502
  title: "Current identity (tenant + principal scope)",
10710
- 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.",
10503
+ 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.",
10711
10504
  mimeType: "application/json",
10712
10505
  read: async () => {
10713
10506
  const identity = await resolveIdentity({ log, apiKey, environment });