@vectros-ai/mcp-server 0.17.1 → 0.18.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
@@ -21,6 +21,7 @@ __export(api_exports, {
21
21
  ContentTooLargeError: () => ContentTooLargeError,
22
22
  DocumentContextEvent: () => DocumentContextEvent,
23
23
  DocumentLookupRequest: () => DocumentLookupRequest,
24
+ DocumentPatchRequest: () => DocumentPatchRequest,
24
25
  DocumentRequest: () => DocumentRequest,
25
26
  DocumentResponse: () => DocumentResponse,
26
27
  DoneEvent: () => DoneEvent,
@@ -364,6 +365,13 @@ var DocumentLookupRequest;
364
365
  Desc: "desc"
365
366
  };
366
367
  })(DocumentLookupRequest || (DocumentLookupRequest = {}));
368
+ var DocumentPatchRequest;
369
+ ((DocumentPatchRequest2) => {
370
+ DocumentPatchRequest2.Status = {
371
+ Active: "ACTIVE",
372
+ Archived: "ARCHIVED"
373
+ };
374
+ })(DocumentPatchRequest || (DocumentPatchRequest = {}));
367
375
  var FileUploadRequest;
368
376
  ((FileUploadRequest2) => {
369
377
  FileUploadRequest2.IndexMode = {
@@ -376,6 +384,7 @@ var FileUploadRequest;
376
384
  var documents_exports = {};
377
385
  __export(documents_exports, {
378
386
  DocumentLookupRequest: () => DocumentLookupRequest,
387
+ DocumentPatchRequest: () => DocumentPatchRequest,
379
388
  FileUploadRequest: () => FileUploadRequest,
380
389
  LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder
381
390
  });
@@ -3040,6 +3049,7 @@ var AuthClient = class {
3040
3049
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
3041
3050
  *
3042
3051
  * @throws {@link Vectros.BadRequestError}
3052
+ * @throws {@link Vectros.PaymentRequiredError}
3043
3053
  * @throws {@link Vectros.ForbiddenError}
3044
3054
  * @throws {@link Vectros.TooManyRequestsError}
3045
3055
  *
@@ -3089,6 +3099,8 @@ var AuthClient = class {
3089
3099
  switch (_response.error.statusCode) {
3090
3100
  case 400:
3091
3101
  throw new BadRequestError(_response.error.body, _response.rawResponse);
3102
+ case 402:
3103
+ throw new PaymentRequiredError(_response.error.body, _response.rawResponse);
3092
3104
  case 403:
3093
3105
  throw new ForbiddenError(_response.error.body, _response.rawResponse);
3094
3106
  case 429:
@@ -3521,7 +3533,7 @@ var AuthClient = class {
3521
3533
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/app-contexts/{contextId}");
3522
3534
  }
3523
3535
  /**
3524
- * Updates the name, description, and/or companyName of an app context. This is a partial update: any field you omit (or send as null) keeps its existing value. The `contextId` is immutable and is taken from the URL path, so any `contextId` in the request body is ignored. Requires the `app-contexts:u` scope.
3536
+ * Updates an app context. This is a partial update: any field you omit (or send as null) keeps its existing value. The `contextId` is immutable and is taken from the URL path, so any `contextId` in the request body is ignored. Patchable fields: `name`, `description`, `companyName`; the per-principal metering trio (`meteringAxis`, `principalBurstLimit`, `principalUsageCap` — only takes effect for a partner with the corresponding account-level feature enabled); `readAccessLogDefault` (the PHI read-access-logging context default); and `identityProjectionClaims` (requires the platform provisioning capability on top of the ordinary scope below — see its own field description). Requires the `app-contexts:u` scope.
3525
3537
  *
3526
3538
  * @param {Vectros.UpdateAppContextRequest} request
3527
3539
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4124,7 +4136,7 @@ var AuthClient = class {
4124
4136
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers/{issuerId}");
4125
4137
  }
4126
4138
  /**
4127
- * Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `userinfoUri`, `capturedClaims`, `restrictedToDomain` (a new non-blank value must already be a VERIFIED domain for your account; an empty string clears it back to domain-less; see `IssuerUpdateRequest.restrictedToDomain` for the full semantics), `status` (`active`/`suspended` — a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. **`subClaim` is identity-determining, not merely cosmetic**: it names which verified JWT claim is read as the federated user's identifier, so changing it on an issuer that already has bound users would silently re-identify (or, under self-signup, orphan) every one of them — changing it is therefore refused once any user has bound through this issuer, the same guard `DELETE` already applies, and is only free before the first real login. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
4139
+ * Updates the mutable fields of a registered issuer: `subClaim`, `emailClaim`, `userinfoUri`, `capturedClaims`, `restrictedToDomain` (a new non-blank value must already be a VERIFIED domain for your account; an empty string clears it back to domain-less; see `IssuerUpdateRequest.restrictedToDomain` for the full semantics), `status` (`active`/`suspended` — a registration awaiting verification (`pending_verification`) accepts no status change until it is verified; a suspended issuer's tokens are rejected identically to an unregistered issuer at exchange time), and `selfSignupPolicies`. Fields omitted from the body are left unchanged (partial update). `issuer`, `jwksUri`, `audience`, and `contextId` are trust-anchor / routing-pin fields and are immutable via this route — supplying a value that differs from the current registration is rejected with 400; supplying the current value back is a no-op. Rotating a trust anchor requires deleting and re-registering the issuer, which is itself refused while any user is bound through it. **`subClaim` is identity-determining, not merely cosmetic**: it names which verified JWT claim is read as the federated user's identifier, so changing it on an issuer that already has bound users would silently re-identify (or, under self-signup, orphan) every one of them — changing it is therefore refused once any user has bound through this issuer, the same guard `DELETE` already applies, and is only free before the first real login. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only update an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId. A root API key may update any issuer.
4128
4140
  *
4129
4141
  * @param {Vectros.IssuerUpdateRequest} request
4130
4142
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4317,7 +4329,7 @@ var AuthClient = class {
4317
4329
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/issuers");
4318
4330
  }
4319
4331
  /**
4320
- * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. Idempotent by `issuerId` within your tenant; the `(issuer, audience)` pair must not already be registered by a different issuerId/tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`. Optionally name `restrictedToDomain` to scope this registration's (issuer, audience) uniqueness to a specific VERIFIED domain rather than the bare pair — see that field's own description for the full contract, including why it does NOT protect a shared/consumer-IdP registration with no company-domain population.
4332
+ * Registers a trusted third-party IdP issuer that BYO-IdP token exchange (`POST /v1/auth/token/exchange`) may accept a `subject_token` from. Requires a root API key or the CLI bootstrap's provisioning capability — never an ordinary partner-grantable scope. A credential authorized only via the provisioning capability may register only against the app context it is bound to; naming a different one returns 403. A root API key is unaffected and may register against any of its contexts. A registration without `restrictedToDomain` is created `pending_verification` with a one-time challenge (`verificationClaim`, `verificationNonce`, `verificationExpiresAt`) and accepts no token until you prove you control the issuer with `POST /v1/auth/issuers/{issuerId}/verify`; it claims no `(issuer, audience)` pair until then, so registering never reveals whether another tenant holds one. A registration scoped to an already-verified domain with `restrictedToDomain` is `active` at once. Idempotent by `issuerId` within your tenant. If `issuerId` collides with a registration owned by a different app context than the one you're confined to, the request fails with 400 rather than returning that context's configuration. An app context may have at most one active issuer — deregister the existing one first if you need to replace it. One issuer MAY serve several contexts today, each via its own registration row with a distinct `audience`. Optionally name `restrictedToDomain` to scope this registration's (issuer, audience) uniqueness to a specific VERIFIED domain rather than the bare pair — see that field's own description. A domain-scoped registration proves control of the DOMAIN, not of the issuer itself: it routes only tokens carrying that domain's `hd` claim.
4321
4333
  *
4322
4334
  * @param {Vectros.IssuerRequest} request
4323
4335
  * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4383,6 +4395,82 @@ var AuthClient = class {
4383
4395
  }
4384
4396
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/auth/issuers");
4385
4397
  }
4398
+ /**
4399
+ * Proves you administer the IdP application a `pending_verification` registration names, activating it. A registration created without `restrictedToDomain` accepts no tokens until this succeeds. Configure your IdP, with an admin-controlled rule (an Auth0 Action, an Okta inline hook, an Entra claims-mapping policy, a Keycloak protocol mapper), to add the registration's `verificationClaim` to the tokens it issues, set to its `verificationNonce`; sign in once; and send that token here. The `jwksUri` you registered must be exactly the `jwks_uri` your issuer's OpenID Connect discovery document (`<issuer>/.well-known/openid-configuration`) publishes, and the token must verify against that key set — an issuer that publishes no discovery document cannot be verified this way. The token is checked and discarded; it is never stored. The `(issuer, audience)` pair is claimed at this moment, so a pair another registration already holds is refused with 400. A challenge expires 7 days after registration; an expired registration cannot be verified — delete it and register again. Requires a root API key or the bootstrap's provisioning capability, gated identically to every other operation on this surface. A credential confined to one app context may only verify an issuer registered in that context; naming one registered in another context returns 404, identically to a nonexistent issuerId.
4400
+ *
4401
+ * @param {Vectros.IssuerVerifyRequest} request
4402
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
4403
+ *
4404
+ * @throws {@link Vectros.BadRequestError}
4405
+ * @throws {@link Vectros.ForbiddenError}
4406
+ * @throws {@link Vectros.NotFoundError}
4407
+ * @throws {@link Vectros.ConflictError}
4408
+ * @throws {@link Vectros.TooManyRequestsError}
4409
+ *
4410
+ * @example
4411
+ * await client.auth.verifyIssuer({
4412
+ * issuerId: "auth0-prod",
4413
+ * token: "token"
4414
+ * })
4415
+ */
4416
+ verifyIssuer(request, requestOptions) {
4417
+ return HttpResponsePromise.fromPromise(this.__verifyIssuer(request, requestOptions));
4418
+ }
4419
+ async __verifyIssuer(request, requestOptions) {
4420
+ const { issuerId, ..._body } = request;
4421
+ const _authRequest = await this._options.authProvider.getAuthRequest();
4422
+ const _headers = mergeHeaders(
4423
+ _authRequest.headers,
4424
+ this._options?.headers,
4425
+ requestOptions?.headers
4426
+ );
4427
+ const _response = await fetcher({
4428
+ url: url_exports.join(
4429
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
4430
+ `v1/auth/issuers/${url_exports.encodePathParam(issuerId)}/verify`
4431
+ ),
4432
+ method: "POST",
4433
+ headers: _headers,
4434
+ contentType: "application/json",
4435
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
4436
+ requestType: "json",
4437
+ body: _body,
4438
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
4439
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
4440
+ abortSignal: requestOptions?.abortSignal,
4441
+ fetchFn: this._options?.fetch,
4442
+ logging: this._options.logging
4443
+ });
4444
+ if (_response.ok) {
4445
+ return { data: _response.body, rawResponse: _response.rawResponse };
4446
+ }
4447
+ if (_response.error.reason === "status-code") {
4448
+ switch (_response.error.statusCode) {
4449
+ case 400:
4450
+ throw new BadRequestError(_response.error.body, _response.rawResponse);
4451
+ case 403:
4452
+ throw new ForbiddenError(_response.error.body, _response.rawResponse);
4453
+ case 404:
4454
+ throw new NotFoundError(_response.error.body, _response.rawResponse);
4455
+ case 409:
4456
+ throw new ConflictError(_response.error.body, _response.rawResponse);
4457
+ case 429:
4458
+ throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
4459
+ default:
4460
+ throw new VectrosError({
4461
+ statusCode: _response.error.statusCode,
4462
+ body: _response.error.body,
4463
+ rawResponse: _response.rawResponse
4464
+ });
4465
+ }
4466
+ }
4467
+ return handleNonStatusCodeError(
4468
+ _response.error,
4469
+ _response.rawResponse,
4470
+ "POST",
4471
+ "/v1/auth/issuers/{issuerId}/verify"
4472
+ );
4473
+ }
4386
4474
  /**
4387
4475
  * Returns the identity bound to your credential — your account, principal type, key id, and scope details — so you can confirm who you are authenticated as and that the credential is valid. MCP clients use this to render "signed in as ..." in a chat UI without a separate identity endpoint.
4388
4476
  *
@@ -4858,7 +4946,7 @@ var ComplianceClient = class {
4858
4946
  this._options = normalizeClientOptionsWithAuth(options);
4859
4947
  }
4860
4948
  /**
4861
- * 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.
4949
+ * 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 its identity and lookup rows when all contexts are covered. 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.
4862
4950
  *
4863
4951
  * @param {Vectros.ErasureRequest} request
4864
4952
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4921,7 +5009,7 @@ var ComplianceClient = class {
4921
5009
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/erasure-requests");
4922
5010
  }
4923
5011
  /**
4924
- * Polls an erasure request by id. While the job is still running this returns its status only; once it completes, the response also includes the verifiable completion certificate (which contexts were swept, per-context deletion counts, and reports of dangling references and shared rows that were left intact). Requires a root API key.
5012
+ * Polls an erasure request by id. While the job is still running this returns its status only; once it completes, the response also includes the verifiable completion certificate (which contexts were swept, per-context deletion counts, whether the identity was kept, and reports of dangling references and shared rows left intact). Requires a root API key.
4925
5013
  *
4926
5014
  * @param {Vectros.GetErasureRequestRequest} request
4927
5015
  * @param {ComplianceClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5164,7 +5252,7 @@ var DocumentsClient = class {
5164
5252
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents");
5165
5253
  }
5166
5254
  /**
5167
- * Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply an `externalId` to make the create idempotent — if a document with the same `externalId` already exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set `?upsert=true` (this also requires the `documents:u` scope). Requires the `documents:c` scope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires the `documents:r` scope — a credential holding `documents:c` alone receives a `400` ("already exists") on collision instead of the document.
5255
+ * Creates a document from a raw text string and queues it for asynchronous indexing so it becomes searchable. Optionally supply an `externalId` to make the create idempotent — if a document with the same `externalId` already exists in your context, that existing document is returned unchanged instead of a duplicate being created. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing document was returned) tells the two apart. To overwrite an existing document's content instead of returning it unchanged, set `?upsert=true` (this also requires the `documents:u` scope). Requires the `documents:c` scope to create. Being returned the existing document on a collision is a read of that document's data and additionally requires the `documents:r` scope — a credential holding `documents:c` alone receives a `400` ("already exists") on collision instead of the document. Supplying `externalId` WITHOUT `schemaId` is refused (`400`) unless you also pass `confirmUntyped=true` — externalId uniqueness is scoped per schema, so omitting `schemaId` by mistake would otherwise silently create a separate untyped document instead of targeting the typed one you likely meant.
5168
5256
  *
5169
5257
  * @param {Vectros.IngestDocumentRequest} request
5170
5258
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5184,10 +5272,11 @@ var DocumentsClient = class {
5184
5272
  return HttpResponsePromise.fromPromise(this.__ingestDocument(request, requestOptions));
5185
5273
  }
5186
5274
  async __ingestDocument(request, requestOptions) {
5187
- const { upsert, allowClear, body: _body } = request;
5275
+ const { upsert, allowClear, confirmUntyped, body: _body } = request;
5188
5276
  const _queryParams = {
5189
5277
  upsert,
5190
- allowClear
5278
+ allowClear,
5279
+ confirmUntyped
5191
5280
  };
5192
5281
  const _authRequest = await this._options.authProvider.getAuthRequest();
5193
5282
  const _headers = mergeHeaders(
@@ -5422,7 +5511,7 @@ var DocumentsClient = class {
5422
5511
  /**
5423
5512
  * Partially updates a document using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged: keys you send overwrite existing values (recursing into nested objects), a key set to `null` is deleted, and keys you omit are preserved — unlike PUT, which replaces the whole payload. Top-level fields (`title`, `folderId`, `schemaId`, ownership) are set when present and left unchanged when omitted; sending a top-level field as `null` is rejected. Supplying `text` re-ingests the document body (same as PUT). `indexMode`, `externalId`, and `storeText` (text retention is fixed at ingest) are immutable and rejected if present. The merged result is validated against the bound schema. Pass `expectedVersion` for optimistic concurrency (409 on conflict). Requires the `documents:u` scope.
5424
5513
  *
5425
- * @param {Vectros.PatchDocumentRequest} request
5514
+ * @param {Vectros.DocumentPatchRequest} request
5426
5515
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
5427
5516
  *
5428
5517
  * @throws {@link Vectros.BadRequestError}
@@ -5433,17 +5522,14 @@ var DocumentsClient = class {
5433
5522
  *
5434
5523
  * @example
5435
5524
  * await client.documents.patchDocument({
5436
- * id: "id",
5437
- * body: {
5438
- * title: "Patient Intake Form \u2014 Jane Doe"
5439
- * }
5525
+ * id: "id"
5440
5526
  * })
5441
5527
  */
5442
5528
  patchDocument(request, requestOptions) {
5443
5529
  return HttpResponsePromise.fromPromise(this.__patchDocument(request, requestOptions));
5444
5530
  }
5445
5531
  async __patchDocument(request, requestOptions) {
5446
- const { id, body: _body } = request;
5532
+ const { id, ..._body } = request;
5447
5533
  const _authRequest = await this._options.authProvider.getAuthRequest();
5448
5534
  const _headers = mergeHeaders(
5449
5535
  _authRequest.headers,
@@ -5815,7 +5901,7 @@ var DocumentsClient = class {
5815
5901
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents/{id}/versions");
5816
5902
  }
5817
5903
  /**
5818
- * Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly to `uploadUrl`; the document is then automatically queued for text extraction and asynchronous indexing. Supplying an `externalId` makes this idempotent — re-initiating an upload with the same `externalId` re-issues a fresh presigned URL for the SAME existing document, targeting a newly-staged object rather than the document's current one — your PUT lands there first, and the document only adopts it once the upload is validated (so a re-upload inherently replaces the file body) rather than creating a duplicate. The response's `created` field (and the HTTP status — 201 when a new document was minted, 200 when an existing one was matched) tells the two apart. With `?upsert=true`, the submitted `payload`/`title` are also applied to the matched document (file-body divergence cannot be diffed at upload-init — the bytes have not arrived yet — so the re-upload itself replaces the body). Creating a NEW document requires the `documents:c` scope. Re-uploading over an EXISTING document overwrites (and re-indexes) its body, so it is an update: it requires the `documents:u` scope (as does `?upsert=true` for the metadata). **Your PUT to `uploadUrl` MUST include the header named in the response's `requiredHeaderName`, set to `requiredHeaderValue` exactly.** It is a signed part of the presigned request — the PUT never reaches this service either way, so neither failure uses this API's JSON error shape. Omitting it, or sending a different value, invalidates the request's signature and S3 rejects it with a 403 `SignatureDoesNotMatch`. Sending it correctly makes the URL single-use: `requiredHeaderName` is always `If-None-Match` and `requiredHeaderValue` is always `*` — a create, a recovery upload for a document whose earlier file is missing, and a re-upload ALL target a freshly-minted, never-written key, so the same S3 conditional-write precondition applies uniformly (S3's own documented conditional-write behavior): a replay after the object already exists (from your own completed PUT, or anyone else's) fails with `412 Precondition Failed`; a replay after the object was deleted and never re-created finds an absent key again and can succeed — single-use is a property of the object's existence, not a one-time token. **Either precondition can also fail with `409 Conflict` if your PUT genuinely races a concurrent delete on the same object.** Whichever of `412` or `409` you receive, the remedy is the same: call this endpoint again for a fresh URL rather than retrying the same PUT — a fresh call always targets a new key, so it is never subject to whatever raced the previous one.
5904
+ * Starts a file-based document by returning a short-lived presigned S3 PUT URL. Upload the file bytes directly to `uploadUrl`; the document is then automatically queued for text extraction and asynchronous indexing. Supplying an `externalId` makes this idempotent — re-initiating an upload with the same `externalId` re-issues a fresh presigned URL for the SAME existing document, targeting a newly-staged object rather than the document's current one — your PUT lands there first, and the document only adopts it once the upload is validated (so a re-upload inherently replaces the file body) rather than creating a duplicate. The response's `created` field (and the HTTP status — 201 when a new document was minted, 200 when an existing one was matched) tells the two apart. With `?upsert=true`, the submitted `payload`/`title` are also applied to the matched document (file-body divergence cannot be diffed at upload-init — the bytes have not arrived yet — so the re-upload itself replaces the body). Creating a NEW document requires the `documents:c` scope. Re-uploading over an EXISTING document overwrites (and re-indexes) its body, so it is an update: it requires the `documents:u` scope (as does `?upsert=true` for the metadata). **Your PUT to `uploadUrl` MUST include the header named in the response's `requiredHeaderName`, set to `requiredHeaderValue` exactly.** It is a signed part of the presigned request — the PUT never reaches this service either way, so neither failure uses this API's JSON error shape. Omitting it, or sending a different value, invalidates the request's signature and S3 rejects it with a 403 `SignatureDoesNotMatch`. Sending it correctly makes the URL single-use: `requiredHeaderName` is always `If-None-Match` and `requiredHeaderValue` is always `*` — a create, a recovery upload for a document whose earlier file is missing, and a re-upload ALL target a freshly-minted, never-written key, so the same S3 conditional-write precondition applies uniformly (S3's own documented conditional-write behavior): a replay after the object already exists (from your own completed PUT, or anyone else's) fails with `412 Precondition Failed`; a replay after the object was deleted and never re-created finds an absent key again and can succeed — single-use is a property of the object's existence, not a one-time token. **Either precondition can also fail with `409 Conflict` if your PUT genuinely races a concurrent delete on the same object.** Whichever of `412` or `409` you receive, the remedy is the same: call this endpoint again for a fresh URL rather than retrying the same PUT — a fresh call always targets a new key, so it is never subject to whatever raced the previous one. Supplying `externalId` WITHOUT `schemaId` is refused (`400`) unless you also pass `confirmUntyped=true` — externalId uniqueness is scoped per schema, so omitting `schemaId` by mistake would otherwise silently create a separate untyped document instead of targeting the typed one you likely meant.
5819
5905
  *
5820
5906
  * @param {Vectros.FileUploadRequest} request
5821
5907
  * @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -5834,9 +5920,10 @@ var DocumentsClient = class {
5834
5920
  return HttpResponsePromise.fromPromise(this.__uploadDocument(request, requestOptions));
5835
5921
  }
5836
5922
  async __uploadDocument(request, requestOptions) {
5837
- const { upsert, ..._body } = request;
5923
+ const { upsert, confirmUntyped, ..._body } = request;
5838
5924
  const _queryParams = {
5839
- upsert
5925
+ upsert,
5926
+ confirmUntyped
5840
5927
  };
5841
5928
  const _authRequest = await this._options.authProvider.getAuthRequest();
5842
5929
  const _headers = mergeHeaders(
@@ -10137,7 +10224,7 @@ import {
10137
10224
  ListToolsRequestSchema,
10138
10225
  ReadResourceRequestSchema
10139
10226
  } from "@modelcontextprotocol/sdk/types.js";
10140
- import { z as z24 } from "zod";
10227
+ import { z as z25 } from "zod";
10141
10228
 
10142
10229
  // src/auth.ts
10143
10230
  var KEY_RE = /^(sk|ssk|st)_(live|test)_/;
@@ -10181,8 +10268,8 @@ function warnOnSuboptimalKey(key, log) {
10181
10268
 
10182
10269
  // src/build-info.ts
10183
10270
  var BUILD_INFO = {
10184
- mcpServer: true ? "0.17.1" : "dev",
10185
- sdk: true ? "0.44.0" : "dev"
10271
+ mcpServer: true ? "0.18.0" : "dev",
10272
+ sdk: true ? "0.46.0" : "dev"
10186
10273
  };
10187
10274
 
10188
10275
  // src/log.ts
@@ -10474,7 +10561,7 @@ var inputSchema = {
10474
10561
  "Keyword-match precision for the BM25 leg (TEXT/HYBRID modes). OR = any term (broad recall), AND = all terms (higher precision), PHRASE = contiguous phrase. Default: PHRASE (slop 3) in HYBRID, OR in TEXT. (The advanced raw-query COMPLEX mode is intentionally not exposed here.)"
10475
10562
  ),
10476
10563
  limit: z.number().int().min(1).max(MCP_MAX_LIMIT).optional().describe(
10477
- `Max hits per page. Defaults to a low ${MCP_DEFAULT_LIMIT} to protect the agent context window; raise up to ${MCP_MAX_LIMIT} (the most a single search returns) in one call when you can accept the larger result, or page with \`offset\` instead.`
10564
+ `Max hits per page. Defaults to a low ${MCP_DEFAULT_LIMIT} to protect the agent context window; raise up to ${MCP_MAX_LIMIT} (this tool's ceiling) in one call when you can accept the larger result, or page with \`offset\` instead.`
10478
10565
  ),
10479
10566
  offset: z.number().int().min(0).max(200).optional().describe("Skip the first N hits \u2014 for pagination (0\u2013200)."),
10480
10567
  folderId: z.string().optional().describe("Scope to content in this EXACT folder (Vectros folder id)."),
@@ -11223,52 +11310,61 @@ var recordDelete = ({ client, log }) => ({
11223
11310
  var record_delete_default = recordDelete;
11224
11311
 
11225
11312
  // src/tools/rag_ask.ts
11313
+ import { z as z10 } from "zod";
11314
+
11315
+ // src/tools/provider-alias.ts
11226
11316
  import { z as z9 } from "zod";
11317
+ var providerAliasInput = z9.string().min(1, "providerAlias must be non-empty when supplied").optional().describe(
11318
+ "Route THIS call through your own model provider instead of the platform-hosted default, by the alias of a provider config your account has activated. It works only after your account has set up that provider and signed the platform's risk-acceptance waiver; without both, the platform refuses the call with a 403, which is returned to you as written. A call served by your own provider leaves the platform-hosted Bedrock path, and Vectros's AWS BAA boundary. Omit it (the default) to use the platform-hosted path. When set, `model` names the model on your provider's own id space, and falls back to that provider config's default model when omitted."
11319
+ );
11320
+
11321
+ // src/tools/rag_ask.ts
11227
11322
  var SEARCH_MCP_DEFAULT_LIMIT = 5;
11228
11323
  var SEARCH_MCP_MAX_LIMIT = 50;
11229
11324
  var inputSchema9 = {
11230
- query: z9.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
11231
- instructions: z9.string().optional().describe(
11325
+ query: z10.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
11326
+ instructions: z10.string().optional().describe(
11232
11327
  'System prompt that overrides the default for the generation step \u2014 e.g. "answer only from the provided context, cite sources, be concise". Default: a generic answer-from-context instruction.'
11233
11328
  ),
11234
- model: z9.string().optional().describe(
11235
- "Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-5, claude-opus-4-8). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
11329
+ model: z10.string().optional().describe(
11330
+ "Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-5, claude-opus-5-5). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach. When `providerAlias` is set, this instead names the model on that provider's own id space."
11236
11331
  ),
11237
- search: z9.object({
11238
- mode: z9.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
11239
- limit: z9.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
11240
- `Passages to retrieve before generating (the grounding-corpus size). Default ${SEARCH_MCP_DEFAULT_LIMIT}; raise up to ${SEARCH_MCP_MAX_LIMIT} (the RAG search API max) for a broader corpus when the extra grounding is worth the larger prompt.`
11332
+ providerAlias: providerAliasInput,
11333
+ search: z10.object({
11334
+ mode: z10.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
11335
+ limit: z10.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
11336
+ `Passages to retrieve before generating (the grounding-corpus size). Default ${SEARCH_MCP_DEFAULT_LIMIT}; raise up to ${SEARCH_MCP_MAX_LIMIT} (this tool's ceiling) for a broader corpus when the extra grounding is worth the larger prompt.`
11241
11337
  ),
11242
11338
  // Retrieval scoping — parity with hybrid_search so an agent can ground the
11243
11339
  // answer on a specific owner / folder / type / metadata subset, not just the
11244
11340
  // whole-tenant corpus.
11245
- userId: z9.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
11246
- scope: z9.string().optional().describe(
11341
+ userId: z10.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
11342
+ scope: z10.string().optional().describe(
11247
11343
  'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. Mutually exclusive with `scopeFilters` \u2014 use this for ONE dimension.'
11248
11344
  ),
11249
- scopeFilters: z9.array(z9.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
11345
+ scopeFilters: z10.array(z10.string()).min(1, "scopeFilters must name at least one dimension when supplied").optional().describe(
11250
11346
  'Restrict retrieval to content matching ALL of these scope values \u2014 one per namespace \u2014 for a credential whose access spans more than one ownership dimension. e.g. ["org:<uuid>", "client:<uuid>"] grounds the answer on one specific client WITHIN one specific org, which `scope` alone cannot express. Naming the same namespace twice is rejected. Mutually exclusive with `scope`.'
11251
11347
  ),
11252
- folderId: z9.string().optional().describe("Restrict retrieval to this exact folder."),
11253
- rootFolderId: z9.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
11254
- typeName: z9.string().optional().describe("Restrict record retrieval to this schema type."),
11255
- contentTypes: z9.array(z9.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
11256
- filters: z9.record(z9.unknown()).optional().describe(
11348
+ folderId: z10.string().optional().describe("Restrict retrieval to this exact folder."),
11349
+ rootFolderId: z10.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
11350
+ typeName: z10.string().optional().describe("Restrict record retrieval to this schema type."),
11351
+ contentTypes: z10.array(z10.enum(["documents", "records"])).optional().describe('Narrow retrieval to content types. ["documents"] or ["records"]; omit for both.'),
11352
+ filters: z10.record(z10.unknown()).optional().describe(
11257
11353
  'Field-level metadata filters (AND-combined). Value = scalar (equality), array (OR-set), or operator map ($eq/$ne/$gt/$gte/$lt/$lte, $in/$nin). e.g. {"status":"open"}.'
11258
11354
  ),
11259
- createdAfter: z9.string().optional().describe(
11355
+ createdAfter: z10.string().optional().describe(
11260
11356
  "Restrict retrieval to content CREATED at/after this ISO 8601 UTC timestamp \u2014 the item's own creation time, which does not move when it is re-indexed. An item matched on its FIRST index may be checked against its index time instead, a bounded clock-skew allowance."
11261
11357
  ),
11262
- createdBefore: z9.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
11263
- requireComplete: z9.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
11358
+ createdBefore: z10.string().optional().describe("Same creation-time basis as createdAfter, bounding at/before this ISO 8601 UTC value."),
11359
+ requireComplete: z10.boolean().optional().describe("Fail closed (503) on a degraded search backend instead of grounding on partial results. Default false.")
11264
11360
  }).optional().describe("Retrieval params + scoping. Default mode HYBRID, limit " + SEARCH_MCP_DEFAULT_LIMIT + "."),
11265
- maxTokens: z9.number().int().min(1).optional().describe("Max output tokens."),
11266
- temperature: z9.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
11361
+ maxTokens: z10.number().int().min(1).optional().describe("Max output tokens."),
11362
+ temperature: z10.number().min(0).max(1).optional().describe("Sampling temperature (0.0\u20131.0). Default 0.3 \u2014 lower favors deterministic, retrieval-grounded answers.")
11267
11363
  };
11268
11364
  var ragAsk = ({ client, log }) => ({
11269
11365
  name: "rag_ask",
11270
11366
  title: "RAG ask (corpus-wide)",
11271
- description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership \u2014 `scope` for one ownership dimension or `scopeFilters` for several at once, e.g. one client within one org \u2014 folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
11367
+ description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership \u2014 `scope` for one ownership dimension or `scopeFilters` for several at once, e.g. one client within one org \u2014 folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Calls without `providerAlias` are served by platform-hosted AWS Bedrock. A call that sets `providerAlias` goes to your own model provider, outside Vectros's AWS BAA boundary.",
11272
11368
  inputSchema: inputSchema9,
11273
11369
  // NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
11274
11370
  // balance before generation starts, then debits it on completion — a real financial side
@@ -11310,6 +11406,7 @@ var ragAsk = ({ client, log }) => ({
11310
11406
  query: args.query,
11311
11407
  instructions: args.instructions,
11312
11408
  model: args.model,
11409
+ providerAlias: args.providerAlias,
11313
11410
  search,
11314
11411
  maxTokens: args.maxTokens,
11315
11412
  temperature: args.temperature
@@ -11364,19 +11461,20 @@ var ragAsk = ({ client, log }) => ({
11364
11461
  var rag_ask_default = ragAsk;
11365
11462
 
11366
11463
  // src/tools/document_ask.ts
11367
- import { z as z10 } from "zod";
11464
+ import { z as z11 } from "zod";
11368
11465
  var inputSchema10 = {
11369
- documentId: z10.string().min(1, "documentId is required").describe("ID of the document to ask against."),
11370
- prompt: z10.string().min(1, "prompt is required").describe("Question to ask about the document."),
11371
- model: z10.string().optional().describe(
11372
- "Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
11466
+ documentId: z11.string().min(1, "documentId is required").describe("ID of the document to ask against."),
11467
+ prompt: z11.string().min(1, "prompt is required").describe("Question to ask about the document."),
11468
+ model: z11.string().optional().describe(
11469
+ "Inference model alias. Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach. When `providerAlias` is set, this instead names the model on that provider's own id space."
11373
11470
  ),
11374
- maxTokens: z10.number().int().min(1).optional().describe("Max output tokens.")
11471
+ providerAlias: providerAliasInput,
11472
+ maxTokens: z11.number().int().min(1).optional().describe("Max output tokens.")
11375
11473
  };
11376
11474
  var documentAsk = ({ client, log }) => ({
11377
11475
  name: "document_ask",
11378
11476
  title: "Document ask (single-document)",
11379
- description: "Ask a question against a single indexed document. Returns a grounded answer with the document context that informed it. For documents exceeding the input-token cap, the API returns a structured 413 with `estimatedTokens` and `limitTokens`. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
11477
+ description: "Ask a question against a single indexed document. Returns a grounded answer with the document context that informed it. For documents exceeding the input-token cap, the API returns a structured 413 with `estimatedTokens` and `limitTokens`. Calls without `providerAlias` are served by platform-hosted AWS Bedrock. A call that sets `providerAlias` goes to your own model provider, outside Vectros's AWS BAA boundary.",
11380
11478
  inputSchema: inputSchema10,
11381
11479
  // NOT a pure read: this call reserves an atomic hold against the caller's prepaid inference
11382
11480
  // balance before generation starts, then debits it on completion — a real financial side
@@ -11393,6 +11491,7 @@ var documentAsk = ({ client, log }) => ({
11393
11491
  id: args.documentId,
11394
11492
  prompt: args.prompt,
11395
11493
  model: args.model,
11494
+ providerAlias: args.providerAlias,
11396
11495
  maxTokens: args.maxTokens
11397
11496
  });
11398
11497
  const progressToken = extra._meta?.progressToken;
@@ -11445,18 +11544,18 @@ var documentAsk = ({ client, log }) => ({
11445
11544
  var document_ask_default = documentAsk;
11446
11545
 
11447
11546
  // src/tools/list_schemas.ts
11448
- import { z as z11 } from "zod";
11547
+ import { z as z12 } from "zod";
11449
11548
  var inputSchema11 = {
11450
- userId: z11.string().optional().describe(
11549
+ userId: z12.string().optional().describe(
11451
11550
  "Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
11452
11551
  ),
11453
- scope: z11.string().optional().describe(
11552
+ scope: z12.string().optional().describe(
11454
11553
  'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other. Optional; default returns all schemas the credential can see.'
11455
11554
  ),
11456
- surface: z11.enum(["record", "document", "user", "entity"]).optional().describe(
11555
+ surface: z12.enum(["record", "document", "user", "entity"]).optional().describe(
11457
11556
  "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."
11458
11557
  ),
11459
- recordType: z11.string().optional().describe(
11558
+ recordType: z12.string().optional().describe(
11460
11559
  '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.'
11461
11560
  )
11462
11561
  };
@@ -11492,19 +11591,19 @@ var listSchemas = ({ client, log }) => ({
11492
11591
  var list_schemas_default = listSchemas;
11493
11592
 
11494
11593
  // src/tools/document_get.ts
11495
- import { z as z12 } from "zod";
11594
+ import { z as z13 } from "zod";
11496
11595
  var MAX_TEXT_CHARS = 32e3;
11497
11596
  var inputSchema12 = {
11498
- documentId: z12.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
11499
- externalId: z12.string().optional().describe(
11597
+ documentId: z13.string().optional().describe("The document ID returned by document_ingest or hybrid_search. Provide this OR externalId+type."),
11598
+ externalId: z13.string().optional().describe(
11500
11599
  "Your caller-owned externalId \u2014 an alternative selector to `documentId` (requires `type`). Fetches the document you ingested under that externalId without a manual lookup first."
11501
11600
  ),
11502
- type: z12.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
11503
- includeText: z12.boolean().optional().describe(
11601
+ type: z13.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
11602
+ includeText: z13.boolean().optional().describe(
11504
11603
  "If true, fetch and include the document text (capped at ~8K tokens, truncated: true flag if cut). Default false \u2014 metadata only. For larger documents, prefer `document_ask` over dumping text into context."
11505
11604
  ),
11506
- includeDownloadUrl: z12.boolean().optional().describe(
11507
- "If true, also return a short-lived presigned `downloadUrl` for the original file (file-backed documents only \u2014 the way to retrieve the raw bytes of a document ingested via file mode). Default false. Unavailable for text-only documents \u2014 `downloadAvailable: false` is set instead."
11605
+ includeDownloadUrl: z13.boolean().optional().describe(
11606
+ "If true, also return a short-lived presigned `downloadUrl` for the original file (file-backed documents only \u2014 the way to retrieve the raw bytes of a document ingested via file mode). Default false. Unavailable for text-only documents \u2014 `downloadAvailable: false` is set instead. `downloadExpires` is an upper bound, not a guarantee: if the file behind this document is replaced (a document_ingest upsert) after this URL is minted, the URL can stop working before that time. Request a fresh one after any re-ingest rather than reusing one you already hold."
11508
11607
  )
11509
11608
  };
11510
11609
  function truncateText(text) {
@@ -11587,28 +11686,28 @@ var documentGet = ({ client, log }) => ({
11587
11686
  var document_get_default = documentGet;
11588
11687
 
11589
11688
  // src/tools/document_query.ts
11590
- import { z as z13 } from "zod";
11689
+ import { z as z14 } from "zod";
11591
11690
  var MCP_DEFAULT_LIMIT3 = 3;
11592
11691
  var MCP_MAX_LIMIT3 = 100;
11593
11692
  var inputSchema13 = {
11594
11693
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
11595
- field: z13.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
11596
- value: z13.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
11597
- from: z13.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
11598
- to: z13.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
11599
- prefix: z13.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
11600
- order: z13.enum(["asc", "desc"]).optional().describe(
11694
+ field: z14.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
11695
+ value: z14.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields too."),
11696
+ from: z14.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Range-enabled, non-sensitive fields only."),
11697
+ to: z14.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
11698
+ prefix: z14.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
11699
+ order: z14.enum(["asc", "desc"]).optional().describe(
11601
11700
  "Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc` \u2014 use `desc` with a range/prefix lookup to get the most-recent / highest values first (e.g. latest-N). Ignored in list mode."
11602
11701
  ),
11603
- type: z13.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
11702
+ type: z14.string().optional().describe("Lookup mode: the document type (the bound schema's type). Required with `field`."),
11604
11703
  // List-mode args:
11605
- folderId: z13.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
11606
- userId: z13.string().optional().describe("List mode: scope to documents owned by this user."),
11607
- scope: z13.string().optional().describe(
11704
+ folderId: z14.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
11705
+ userId: z14.string().optional().describe("List mode: scope to documents owned by this user."),
11706
+ scope: z14.string().optional().describe(
11608
11707
  'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
11609
11708
  ),
11610
- startFrom: z13.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
11611
- limit: z13.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
11709
+ startFrom: z14.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
11710
+ limit: z14.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
11612
11711
  `Max documents per page. Defaults to a low ${MCP_DEFAULT_LIMIT3} to protect the agent context window; raise up to ${MCP_MAX_LIMIT3} (the documents API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
11613
11712
  )
11614
11713
  };
@@ -11698,29 +11797,29 @@ var documentQuery = ({ client, log }) => ({
11698
11797
  var document_query_default = documentQuery;
11699
11798
 
11700
11799
  // src/tools/document_update.ts
11701
- import { z as z14 } from "zod";
11800
+ import { z as z15 } from "zod";
11702
11801
  var inputSchema14 = {
11703
- documentId: z14.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
11704
- externalId: z14.string().optional().describe(
11802
+ documentId: z15.string().optional().describe("The Vectros document id to update. Provide this OR externalId+type."),
11803
+ externalId: z15.string().optional().describe(
11705
11804
  "Your caller-owned externalId \u2014 an alternative selector to `documentId` (requires `type`). Updates the document you ingested under that externalId without a manual lookup first."
11706
11805
  ),
11707
- type: z14.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
11708
- title: z14.string().optional().describe("New title. Omit to keep the current title."),
11709
- fields: z14.record(z14.string(), z14.unknown()).optional().describe(
11806
+ type: z15.string().optional().describe("Document type \u2014 REQUIRED when selecting by `externalId` (externalId is unique within a type)."),
11807
+ title: z15.string().optional().describe("New title. Omit to keep the current title."),
11808
+ fields: z15.record(z15.string(), z15.unknown()).optional().describe(
11710
11809
  "Typed-payload field\u2192value changes DEEP-MERGED into the existing payload (a field set to `null` is deleted; unspecified fields preserved). Omit to leave the payload unchanged."
11711
11810
  ),
11712
- text: z14.string().optional().describe(
11811
+ text: z15.string().optional().describe(
11713
11812
  "New raw text body. Supplying it re-ingests the document body and re-queues it for indexing, so the search index reflects the edit (text-ingested documents only \u2014 not file-backed ones). Omit to leave the stored text unchanged. This is the in-place alternative to re-ingesting with upsert:true."
11714
11813
  ),
11715
- folderId: z14.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
11716
- status: z14.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
11814
+ folderId: z15.string().optional().describe("Move the document into this folder (cannot be cleared once set)."),
11815
+ status: z15.enum(["ACTIVE", "ARCHIVED"]).optional().describe(
11717
11816
  "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."
11718
11817
  ),
11719
- userId: z14.string().optional().describe("Reassign the owning user (Vectros UUID)."),
11720
- scopes: z14.array(z14.string()).optional().describe(
11818
+ userId: z15.string().optional().describe("Reassign the owning user (Vectros UUID)."),
11819
+ scopes: z15.array(z15.string()).optional().describe(
11721
11820
  'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
11722
11821
  ),
11723
- expectedVersion: z14.number().int().optional().describe(
11822
+ expectedVersion: z15.number().int().optional().describe(
11724
11823
  "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."
11725
11824
  )
11726
11825
  };
@@ -11748,18 +11847,18 @@ var documentUpdate = ({ client, log }) => ({
11748
11847
  try {
11749
11848
  const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
11750
11849
  if ("error" in resolved) return toolError("document_update", new Error(resolved.error));
11751
- const body = {};
11752
- if (title !== void 0) body.title = title;
11753
- if (fields !== void 0) body.payload = fields;
11754
- if (text !== void 0) body.text = text;
11755
- if (folderId !== void 0) body.folderId = folderId;
11756
- if (status !== void 0) body.status = status;
11757
- if (userId !== void 0) body.userId = userId;
11758
- if (scopes !== void 0) body.scopes = scopes;
11759
- if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
11850
+ const patch = {};
11851
+ if (title !== void 0) patch.title = title;
11852
+ if (fields !== void 0) patch.payload = fields;
11853
+ if (text !== void 0) patch.text = text;
11854
+ if (folderId !== void 0) patch.folderId = folderId;
11855
+ if (status !== void 0) patch.status = status;
11856
+ if (userId !== void 0) patch.userId = userId;
11857
+ if (scopes !== void 0) patch.scopes = scopes;
11858
+ if (expectedVersion !== void 0) patch.expectedVersion = expectedVersion;
11760
11859
  const updated = await client.documents.patchDocument({
11761
11860
  id: resolved.id,
11762
- body
11861
+ ...patch
11763
11862
  });
11764
11863
  log.debug({ tool: "document_update", documentId: resolved.id, externalId }, "document_update ok");
11765
11864
  return { content: [{ type: "text", text: JSON.stringify(updated, null, 2) }] };
@@ -11772,9 +11871,9 @@ var documentUpdate = ({ client, log }) => ({
11772
11871
  var document_update_default = documentUpdate;
11773
11872
 
11774
11873
  // src/tools/document_delete.ts
11775
- import { z as z15 } from "zod";
11874
+ import { z as z16 } from "zod";
11776
11875
  var inputSchema15 = {
11777
- documentId: z15.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
11876
+ documentId: z16.string().min(1, "documentId is required").describe("The Vectros document id to delete.")
11778
11877
  };
11779
11878
  var documentDelete = ({ client, log }) => ({
11780
11879
  name: "document_delete",
@@ -11801,18 +11900,18 @@ var documentDelete = ({ client, log }) => ({
11801
11900
  var document_delete_default = documentDelete;
11802
11901
 
11803
11902
  // src/tools/folder_query.ts
11804
- import { z as z16 } from "zod";
11903
+ import { z as z17 } from "zod";
11805
11904
  var MCP_DEFAULT_LIMIT4 = 10;
11806
11905
  var MCP_MAX_LIMIT4 = 100;
11807
11906
  var inputSchema16 = {
11808
- id: z16.string().optional().describe("Get mode: fetch this single folder by id."),
11809
- parentId: z16.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
11810
- userId: z16.string().optional().describe("List mode: scope to folders owned by this user."),
11811
- scope: z16.string().optional().describe(
11907
+ id: z17.string().optional().describe("Get mode: fetch this single folder by id."),
11908
+ parentId: z17.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
11909
+ userId: z17.string().optional().describe("List mode: scope to folders owned by this user."),
11910
+ scope: z17.string().optional().describe(
11812
11911
  'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself.'
11813
11912
  ),
11814
- startFrom: z16.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
11815
- limit: z16.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
11913
+ startFrom: z17.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
11914
+ limit: z17.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
11816
11915
  `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\`.`
11817
11916
  )
11818
11917
  };
@@ -11852,16 +11951,16 @@ var folderQuery = ({ client, log }) => ({
11852
11951
  var folder_query_default = folderQuery;
11853
11952
 
11854
11953
  // src/tools/folder_create.ts
11855
- import { z as z17 } from "zod";
11954
+ import { z as z18 } from "zod";
11856
11955
  var inputSchema17 = {
11857
- name: z17.string().min(1, "name is required").describe("Folder display name."),
11858
- description: z17.string().optional().describe("Optional description of the folder's purpose."),
11859
- parentId: z17.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
11860
- slug: z17.string().optional().describe(
11956
+ name: z18.string().min(1, "name is required").describe("Folder display name."),
11957
+ description: z18.string().optional().describe("Optional description of the folder's purpose."),
11958
+ parentId: z18.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
11959
+ slug: z18.string().optional().describe(
11861
11960
  "Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. SUPPLY THIS to make a retry safe \u2014 if omitted, a derived slug is only ever a freshly-proved-free one, so a redelivered call creates a new sibling folder every time rather than matching the first."
11862
11961
  ),
11863
- userId: z17.string().optional().describe("Owning user (Vectros UUID)."),
11864
- scopes: z17.array(z17.string()).optional().describe(
11962
+ userId: z18.string().optional().describe("Owning user (Vectros UUID)."),
11963
+ scopes: z18.array(z18.string()).optional().describe(
11865
11964
  'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
11866
11965
  )
11867
11966
  };
@@ -11903,16 +12002,16 @@ var folderCreate = ({ client, log }) => ({
11903
12002
  var folder_create_default = folderCreate;
11904
12003
 
11905
12004
  // src/tools/folder_update.ts
11906
- import { z as z18 } from "zod";
12005
+ import { z as z19 } from "zod";
11907
12006
  var inputSchema18 = {
11908
- id: z18.string().min(1, "id is required").describe("The Vectros folder id to update."),
11909
- name: z18.string().optional().describe("New folder name. Omit to keep the current name."),
11910
- description: z18.string().optional().describe("New description. Omit to leave unchanged."),
11911
- userId: z18.string().optional().describe("Reassign the owning user (Vectros UUID)."),
11912
- scopes: z18.array(z18.string()).optional().describe(
12007
+ id: z19.string().min(1, "id is required").describe("The Vectros folder id to update."),
12008
+ name: z19.string().optional().describe("New folder name. Omit to keep the current name."),
12009
+ description: z19.string().optional().describe("New description. Omit to leave unchanged."),
12010
+ userId: z19.string().optional().describe("Reassign the owning user (Vectros UUID)."),
12011
+ scopes: z19.array(z19.string()).optional().describe(
11913
12012
  'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are reserved namespace names, registered like any other. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
11914
12013
  ),
11915
- expectedVersion: z18.number().int().optional().describe(
12014
+ expectedVersion: z19.number().int().optional().describe(
11916
12015
  "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."
11917
12016
  )
11918
12017
  };
@@ -11951,9 +12050,9 @@ var folderUpdate = ({ client, log }) => ({
11951
12050
  var folder_update_default = folderUpdate;
11952
12051
 
11953
12052
  // src/tools/folder_delete.ts
11954
- import { z as z19 } from "zod";
12053
+ import { z as z20 } from "zod";
11955
12054
  var inputSchema19 = {
11956
- id: z19.string().min(1, "id is required").describe("The Vectros folder id to delete.")
12055
+ id: z20.string().min(1, "id is required").describe("The Vectros folder id to delete.")
11957
12056
  };
11958
12057
  var folderDelete = ({ client, log }) => ({
11959
12058
  name: "folder_delete",
@@ -12003,7 +12102,7 @@ var currentIdentity = ({ log, apiKey, environment }) => ({
12003
12102
  var current_identity_default = currentIdentity;
12004
12103
 
12005
12104
  // src/tools/document_ingest.ts
12006
- import { z as z20 } from "zod";
12105
+ import { z as z21 } from "zod";
12007
12106
  import { readFile, realpath } from "fs/promises";
12008
12107
  import { basename, extname, resolve, relative, isAbsolute } from "path";
12009
12108
  var IngestPathError = class extends Error {
@@ -12079,43 +12178,46 @@ function inferMimeType(filePath) {
12079
12178
  return EXT_TO_MIME[ext] ?? "application/octet-stream";
12080
12179
  }
12081
12180
  var inputSchema21 = {
12082
- title: z20.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
12083
- indexMode: z20.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
12181
+ title: z21.string().min(1, "title is required").describe("Human-readable document title \u2014 appears in search results and the UI."),
12182
+ indexMode: z21.enum(["HYBRID", "SEMANTIC", "TEXT", "NONE"]).optional().describe(
12084
12183
  "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."
12085
12184
  ),
12086
- externalId: z20.string().optional().describe(
12087
- '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.'
12185
+ externalId: z21.string().optional().describe(
12186
+ '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. Pass `schemaId` with it: an externalId with no `schemaId` is refused (400) unless `confirmUntyped` is true.'
12187
+ ),
12188
+ upsert: z21.boolean().optional().describe(
12189
+ "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. Omitting schemaId is refused (400) unless `confirmUntyped` is true, and with it the call targets the UNTYPED namespace, so it mints or updates an untyped document and never touches the typed one. The response `created` flag confirms which happened (created:true = a new document was minted)."
12088
12190
  ),
12089
- upsert: z20.boolean().optional().describe(
12090
- "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)."
12191
+ schemaId: z21.string().optional().describe(
12192
+ "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 (an untyped document that also carries an `externalId` needs `confirmUntyped`)."
12091
12193
  ),
12092
- schemaId: z20.string().optional().describe(
12093
- "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."
12194
+ confirmUntyped: z21.boolean().optional().describe(
12195
+ "Set true to confirm that an UNTYPED document is what you intend when you pass `externalId` without `schemaId`. Without it the platform refuses that combination (400): externalId is unique per schema, so a forgotten `schemaId` would otherwise quietly create a separate untyped copy instead of reaching the typed document you meant. Do not set it just to get past that error \u2014 check that the document really is untyped first. Ignored when `schemaId` is given or `externalId` is omitted."
12094
12196
  ),
12095
- payload: z20.record(z20.string(), z20.unknown()).optional().describe(
12197
+ payload: z21.record(z21.string(), z21.unknown()).optional().describe(
12096
12198
  "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."
12097
12199
  ),
12098
12200
  // Inline text mode (mutually exclusive with filePath):
12099
- text: z20.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
12100
- storeText: z20.boolean().optional().describe(
12201
+ text: z21.string().min(1).optional().describe("Text body to ingest inline. Mutually exclusive with filePath. Either text or filePath is required."),
12202
+ storeText: z21.boolean().optional().describe(
12101
12203
  "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."
12102
12204
  ),
12103
12205
  // File upload mode (mutually exclusive with text; stdio-transport-only):
12104
- filePath: z20.string().min(1).optional().describe(
12206
+ filePath: z21.string().min(1).optional().describe(
12105
12207
  "Local filesystem path to upload. Mutually exclusive with text. STDIO TRANSPORT ONLY \u2014 rejected on HTTP transport (remote MCP servers can't read your filesystem; use text mode or call the SDK's uploadDocument directly). Must resolve INSIDE the configured ingest root (VECTROS_MCP_INGEST_ROOT, else the server's working directory); paths that escape it (traversal/absolute/symlink) or match a sensitive pattern are rejected."
12106
12208
  ),
12107
- fileType: z20.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
12209
+ fileType: z21.string().optional().describe('MIME type of the file (e.g. "application/pdf"). Inferred from filePath extension if omitted.'),
12108
12210
  // Common (both modes):
12109
- folderId: z20.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
12110
- userId: z20.string().optional().describe("Owning user ID. Optional."),
12111
- scopes: z20.array(z20.string()).optional().describe(
12211
+ folderId: z21.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
12212
+ userId: z21.string().optional().describe("Owning user ID. Optional."),
12213
+ scopes: z21.array(z21.string()).optional().describe(
12112
12214
  "TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are reserved namespace names, registered like any other; others are namespaces you registered yourself. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
12113
12215
  )
12114
12216
  };
12115
12217
  var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12116
12218
  name: "document_ingest",
12117
12219
  title: "Ingest a new document (text body or file upload)",
12118
- 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`.",
12220
+ 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 `document_get` until indexStatus is INDEXED. EXCEPTION \u2014 re-ingesting file mode against an externalId that already has a document (response `created:false`): the file body is replaced by ANY such re-ingest, whether or not `upsert` was set (`upsert` there only additionally applies `payload`/`title` to the matched document). The document keeps serving the OLD file's bytes until the new one is adopted, and indexStatus already reads INDEXED left over from that old file, so polling it returns immediately without waiting for the new content. Poll `document_get` and watch `fileItemId` instead \u2014 once it differs from the value it held before this call, the new file has been adopted. Re-request any download URL after that: one minted before adoption can stop working even within its stated `downloadExpires`.\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; in FILE MODE a re-ingest against an existing externalId needs documents:u). TEXT MODE: without `upsert`, the existing document's content is genuinely unchanged. FILE MODE: as noted above, a re-ingest against an existing externalId always replaces the file body regardless of `upsert` \u2014 only the `payload`/`title` metadata overwrite is gated by 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). An `externalId` with no `schemaId` is refused (400) unless you also pass `confirmUntyped:true` to confirm that an untyped document is intended. 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`.",
12119
12221
  inputSchema: inputSchema21,
12120
12222
  // Creates by default, idempotent ONLY when the caller supplies `externalId` (optional,
12121
12223
  // per the doc comment above) — re-ingest then returns the existing document rather than
@@ -12133,6 +12235,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12133
12235
  const filePath = args.filePath;
12134
12236
  const schemaId = args.schemaId;
12135
12237
  const upsert = args.upsert;
12238
+ const confirmUntyped = args.confirmUntyped;
12136
12239
  const indexMode = args.indexMode ?? (schemaId ? void 0 : "HYBRID");
12137
12240
  if (!text && !filePath) {
12138
12241
  return toolError(
@@ -12181,6 +12284,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12181
12284
  if (text) {
12182
12285
  const result = await client.documents.ingestDocument({
12183
12286
  upsert,
12287
+ confirmUntyped,
12184
12288
  body: {
12185
12289
  title,
12186
12290
  text,
@@ -12221,6 +12325,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12221
12325
  const storeTextFile = args.storeText ?? true;
12222
12326
  const upload = await client.documents.uploadDocument({
12223
12327
  upsert,
12328
+ confirmUntyped,
12224
12329
  fileName,
12225
12330
  fileType,
12226
12331
  indexMode,
@@ -12253,6 +12358,8 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12253
12358
  { tool: "document_ingest", mode: "file", id: docId, fileName, fileType, bytes: bytes.length },
12254
12359
  "document_ingest file ok"
12255
12360
  );
12361
+ const uploadCreated = upload?.created;
12362
+ const note = uploadCreated === false ? "File replaced: this re-ingest matched an existing externalId, which always replaces that document's file body (upsert or not \u2014 upsert only additionally applies payload/title to it). The next document_get call may already show indexStatus: INDEXED \u2014 that is left over from the PREVIOUS file, not confirmation the new one is ready, and the document keeps serving the old file's bytes until adoption completes. Poll document_get(id) and watch fileItemId instead: once it differs from the value it held before this call, the new file has been adopted. Any download URL already held for this document was minted for the old file and can stop working before its stated downloadExpires once adoption happens \u2014 request a fresh one after fileItemId changes." : "File uploaded; indexing is asynchronous. Poll document_get(id) until indexStatus is INDEXED.";
12256
12363
  return {
12257
12364
  content: [
12258
12365
  {
@@ -12261,7 +12368,7 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
12261
12368
  {
12262
12369
  ...upload,
12263
12370
  indexStatus: "PENDING_INDEX",
12264
- _note: "File uploaded; indexing is asynchronous. Poll document_get(id) until indexStatus is INDEXED."
12371
+ _note: note
12265
12372
  },
12266
12373
  null,
12267
12374
  2
@@ -12285,29 +12392,29 @@ function presignedUploadHeaders(response) {
12285
12392
  }
12286
12393
 
12287
12394
  // src/tools/lookup_principal.ts
12288
- import { z as z21 } from "zod";
12395
+ import { z as z22 } from "zod";
12289
12396
  var MCP_DEFAULT_LIMIT5 = 10;
12290
12397
  var MCP_MAX_LIMIT5 = 100;
12291
12398
  var inputSchema22 = {
12292
- kind: z21.string().describe(
12399
+ kind: z22.string().describe(
12293
12400
  'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (reserved, registered like any other), or a namespace you registered.'
12294
12401
  ),
12295
- externalId: z21.string().optional().describe(
12402
+ externalId: z22.string().optional().describe(
12296
12403
  "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."
12297
12404
  ),
12298
- contextId: z21.string().optional().describe(
12405
+ contextId: z22.string().optional().describe(
12299
12406
  "Entity kinds only (not `user`, which is always tenant-wide): the app context to look up entities in, for a namespace registered as context-owned rather than tenant-wide. A context-confined credential's own context is used automatically without this; supply it to name a context explicitly (required for an unconfined/root credential to reach a context-owned namespace). Rejected if the namespace turns out to be tenant-wide."
12300
12407
  ),
12301
12408
  // Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
12302
- type: z21.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
12303
- field: z21.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
12304
- value: z21.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
12305
- from: z21.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
12306
- to: z21.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
12307
- prefix: z21.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
12308
- order: z21.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
12309
- startFrom: z21.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
12310
- limit: z21.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
12409
+ type: z22.string().optional().describe('Lookup mode: the identity schema\'s record type (e.g. "person_v1"). Required with `field`.'),
12410
+ field: z22.string().optional().describe('Lookup mode: name of the schema-declared lookup field to query by (e.g. "email").'),
12411
+ value: z22.string().optional().describe("Lookup mode (equality): exact-match value for `field`. Works on sensitive fields."),
12412
+ from: z22.string().optional().describe("Lookup mode (range): inclusive lower bound; requires `to`. Non-sensitive fields only."),
12413
+ to: z22.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
12414
+ prefix: z22.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
12415
+ order: z22.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
12416
+ startFrom: z22.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
12417
+ limit: z22.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
12311
12418
  `Max principals per page. Defaults to ${MCP_DEFAULT_LIMIT5}; raise up to ${MCP_MAX_LIMIT5} (the principals API max) in one call when you can accept the payload, or page with \`startFrom\`.`
12312
12419
  )
12313
12420
  };
@@ -12391,11 +12498,11 @@ var lookupPrincipal = ({ client, log }) => ({
12391
12498
  var lookup_principal_default = lookupPrincipal;
12392
12499
 
12393
12500
  // src/tools/version_history.ts
12394
- import { z as z22 } from "zod";
12501
+ import { z as z23 } from "zod";
12395
12502
  var inputSchema23 = {
12396
- resourceType: z22.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
12397
- id: z22.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
12398
- startFrom: z22.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
12503
+ resourceType: z23.enum(["record", "document"]).describe("Which kind of entity the id refers to: a record or a document."),
12504
+ id: z23.string().min(1, "id is required").describe("The Vectros id of the record or document whose history you want."),
12505
+ startFrom: z23.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch older entries.")
12399
12506
  };
12400
12507
  var versionHistory = ({ client, log }) => ({
12401
12508
  name: "version_history",
@@ -12519,7 +12626,7 @@ var ALL_RESOURCE_FACTORIES = {
12519
12626
  };
12520
12627
 
12521
12628
  // src/zod-to-json-schema.ts
12522
- import { z as z23 } from "zod";
12629
+ import { z as z24 } from "zod";
12523
12630
  function zodShapeToJsonSchema(shape) {
12524
12631
  const properties = {};
12525
12632
  const required = [];
@@ -12534,40 +12641,40 @@ function zodShapeToJsonSchema(shape) {
12534
12641
  function zodTypeToJsonSchema(schema) {
12535
12642
  const description = schema.description;
12536
12643
  let current = schema;
12537
- while (current instanceof z23.ZodOptional || current instanceof z23.ZodDefault || current instanceof z23.ZodNullable) {
12644
+ while (current instanceof z24.ZodOptional || current instanceof z24.ZodDefault || current instanceof z24.ZodNullable) {
12538
12645
  current = current._def.innerType;
12539
12646
  }
12540
12647
  const base = description ? { description } : {};
12541
- if (current instanceof z23.ZodString) {
12648
+ if (current instanceof z24.ZodString) {
12542
12649
  return { ...base, type: "string" };
12543
12650
  }
12544
- if (current instanceof z23.ZodNumber) {
12651
+ if (current instanceof z24.ZodNumber) {
12545
12652
  return { ...base, type: "number" };
12546
12653
  }
12547
- if (current instanceof z23.ZodBoolean) {
12654
+ if (current instanceof z24.ZodBoolean) {
12548
12655
  return { ...base, type: "boolean" };
12549
12656
  }
12550
- if (current instanceof z23.ZodEnum) {
12657
+ if (current instanceof z24.ZodEnum) {
12551
12658
  return {
12552
12659
  ...base,
12553
12660
  type: "string",
12554
12661
  enum: current.options
12555
12662
  };
12556
12663
  }
12557
- if (current instanceof z23.ZodArray) {
12664
+ if (current instanceof z24.ZodArray) {
12558
12665
  return {
12559
12666
  ...base,
12560
12667
  type: "array",
12561
12668
  items: zodTypeToJsonSchema(current.element)
12562
12669
  };
12563
12670
  }
12564
- if (current instanceof z23.ZodObject) {
12671
+ if (current instanceof z24.ZodObject) {
12565
12672
  return {
12566
12673
  ...base,
12567
12674
  ...zodShapeToJsonSchema(current.shape)
12568
12675
  };
12569
12676
  }
12570
- if (current instanceof z23.ZodRecord) {
12677
+ if (current instanceof z24.ZodRecord) {
12571
12678
  const valueType = current._def.valueType;
12572
12679
  return {
12573
12680
  ...base,
@@ -12696,7 +12803,7 @@ var VectrosMCPServer = class {
12696
12803
  if (!tool) {
12697
12804
  result = toolError(req.params.name ?? "unknown", new Error("No such tool."));
12698
12805
  } else {
12699
- const parsed = z24.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
12806
+ const parsed = z25.object(tool.inputSchema).strict().safeParse(req.params.arguments ?? {});
12700
12807
  if (!parsed.success) {
12701
12808
  result = toolError(tool.name, new Error(formatArgError(tool, parsed.error)));
12702
12809
  } else {