@functional-systems/lambdadb-mcp 0.1.2-dev.8 → 0.1.2-dev.9

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Pin the LambdaDB TypeScript SDK to 0.7.0 and expose all 49 fixed lowercase
6
+ analyzer presets in collection-tool guidance; preserve analyzer serialization.
7
+ - Add optional per-query managed reranking to the MCP schema and SDK request path,
8
+ preserving omission/null, distinct sizes, custom criteria, envelope scores and
9
+ status metadata, including document downloads. Retain SDK validation and errors.
10
+ - Extend local and installed-package contracts for analyzer expansion and reranking;
11
+ update the opt-in live analyzer check without claiming live feature verification.
12
+ - Add a separate opt-in managed-reranking live suite for real default/custom
13
+ inference, empty candidates, omitted/null behavior and docsUrl envelope
14
+ preservation, with owned-resource cleanup and no fixed relevance expectations.
15
+ - Native SDK usage is unchanged; no Qdrant mapping exists in this server. Supporting
16
+ backend deployment/model availability remains required. No package is published
17
+ and existing MCP installations require a separately released update.
18
+
5
19
  ## [0.1.1] - 2026-09-29
6
20
 
7
21
  - Pin the LambdaDB TypeScript SDK to 0.6.0, including all 16 text analyzers.
package/README.md CHANGED
@@ -101,9 +101,8 @@ Optional write tools:
101
101
 
102
102
  ## API contract and tool inputs
103
103
 
104
- The LambdaDB SDK is pinned to `@functional-systems/lambdadb@0.6.0`, checked against
105
- the published package and [v0.6.0 release](https://github.com/lambdadb/lambdadb-typescript-client/releases/tag/v0.6.0)
106
- at [`491d01e`](https://github.com/lambdadb/lambdadb-typescript-client/commit/491d01e0eb54bd135823fab79cbe32396ec03691).
104
+ The LambdaDB SDK is pinned to `@functional-systems/lambdadb@0.7.0`, checked against
105
+ the published package and [v0.7.0 release](https://github.com/lambdadb/lambdadb-typescript-client/releases/tag/v0.7.0).
107
106
  This dependency update applies to builds containing this change. Publishing the SDK
108
107
  alone does not update previously published or installed MCP packages.
109
108
 
@@ -173,6 +172,69 @@ This MCP update does not migrate existing Collections or indexes. Partial update
173
172
  segment merging, and old Tags do not upgrade old indexes. If migration is needed,
174
173
  plan and authorize reinsertion into a new Collection separately.
175
174
 
175
+ ### Optional managed reranking
176
+
177
+ `lambdadb_query_collection` accepts per-query `rerank`; omission or `null`
178
+ preserves existing searches. Collection creation has no rerank setting.
179
+ LambdaDB manages provider credentials; only the existing project API key is needed.
180
+ See the [managed reranking contract](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.7.0/docs/managed-reranking.md).
181
+
182
+ ```json
183
+ {
184
+ "collectionName": "articles",
185
+ "size": 10,
186
+ "query": { "knn": { "field": "bodyEmbedding", "queryText": "Restore a collection", "k": 50 } },
187
+ "fields": { "include": ["id", "title"] },
188
+ "rerank": {
189
+ "provider": "typesafe",
190
+ "model": "jev-1.13.0",
191
+ "queryText": "Restore a collection",
192
+ "fields": ["title", "body"],
193
+ "candidateSize": 50,
194
+ "onFailure": "error"
195
+ }
196
+ }
197
+ ```
198
+
199
+ Provider/model are fixed. `queryText` is required nonblank text, at most 8 KiB
200
+ UTF-8, even with raw vectors. Rerank `fields` selects 1–8 unique stored scalar
201
+ text paths in input order, independently of returned document projection.
202
+ Optional `criteria` replaces the default with 2–10 distinct nonblank descriptions
203
+ ordered from lowest to highest relevance (2 KiB each, 8 KiB total UTF-8).
204
+ Omitted/null criteria uses defaults; text, order, nulls and omission are preserved.
205
+
206
+ Final `size`, vector-leg `knn.k`, and merged `candidateSize` are separate.
207
+ Require `1 <= size <= candidateSize <= 100`; omitted/null candidateSize defaults
208
+ on the server to `max(50, size)`, with final size defaulting to 10. MCP never
209
+ increases `k`. Reranking requires a scoring retrieval query, forbids `sort`,
210
+ match-all and filter-only Boolean requests, and preserves ref/consistentRead
211
+ restrictions. It does not enable vector/hybrid facets; supported lexical facets
212
+ still count all matches. Field types, candidate text and model availability
213
+ remain server validations.
214
+
215
+ Results retain server order, precision and zero. Applied envelope `score` is the
216
+ final evaluation score in [0,1], not a probability; envelope `retrievalScore`
217
+ retains the search score. Top-level `rerank` retains status (`applied`, `skipped`,
218
+ `fallback`), provider/model, optional resolvedModel, counts, stage took, optional
219
+ criteriaVersion and reason. Applied criteriaVersion is `default-relevance-v1`
220
+ or `custom`; `custom` is not a unique rubric identity. `maxScore` retains zero;
221
+ empty results omit it and report skipped/noCandidates with zero counts.
222
+ Without reranking, rerank metadata and retrievalScore are absent. Metadata and
223
+ scores survive `docsUrl` downloads.
224
+
225
+ Omitted/null `onFailure` defaults to `error`. `returnOriginal` applies only to
226
+ provider timeout, rateLimit, unavailable, invalidResponse and credentials failures.
227
+ Fallback retains retrieval order/scores for the first size documents, discards
228
+ partial evaluation scores and omits retrievalScore/criteriaVersion. Invalid
229
+ input/candidates, disabled models, authorization, retrieval/hydration/ref, quota
230
+ and capacity failures remain errors; cancellation or an exhausted deadline does
231
+ not trigger fallback. A hybrid fallback can differ from a separate query with
232
+ a smaller candidate cap. No extra client fallback is implemented.
233
+
234
+ SDK publication and local fixtures do not establish deployment to an endpoint,
235
+ search quality, load/failure coverage or billing readiness. Backend feature/model
236
+ availability and operational verification remain separate dependencies.
237
+
176
238
  ### Text analyzers in collection creation
177
239
 
178
240
  With write tools explicitly enabled, `lambdadb_create_collection` accepts:
@@ -190,12 +252,29 @@ With write tools explicitly enabled, `lambdadb_create_collection` accepts:
190
252
 
191
253
  Supported lowercase names: `standard`, `english`, `korean`, `japanese`, `chinese`,
192
254
  `cjk`, `arabic`, `french`, `german`, `hindi`, `indonesian`, `italian`, `portuguese`,
193
- `russian`, `spanish`, `turkish`. Omitting `analyzers` uses the server default
255
+ `russian`, `spanish`, `turkish`, `armenian`, `basque`, `bengali`, `brazilian`,
256
+ `bulgarian`, `catalan`, `czech`, `danish`, `dutch`, `estonian`, `finnish`, `galician`,
257
+ `greek`, `hungarian`, `irish`, `latvian`, `lithuanian`, `norwegian`, `persian`,
258
+ `romanian`, `serbian`, `sorani`, `swedish`, `thai`, `simple`, `whitespace`, `stop`,
259
+ `keyword`, `pattern`, `fingerprint`, `nepali`, `tamil`, `telugu` (49 total).
260
+ Omitting `analyzers` uses the server default
194
261
  `["standard"]`; an empty list is passed through and does not select that default.
195
262
  Analyzers run independently without automatic language detection. Lists are sent
196
263
  unchanged; avoid duplicate names, which the server rejects. Index configuration
197
264
  validation remains in the SDK. Write tools remain disabled by default.
198
265
 
266
+ These are fixed presets with backend default settings; custom pipelines/options
267
+ are unsupported. The `keyword` analyzer keeps text in one token and is distinct
268
+ from the `keyword` field type used for sorting/facets. Nepali, Tamil and Telugu
269
+ are Lucene extensions, not common Elasticsearch/OpenSearch support. New presets
270
+ require a supporting backend deployment. See the [analyzer contract](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.7.0/docs/models/analyzer.md).
271
+
272
+ This repository uses the native SDK only and has no Qdrant payload-schema mapping.
273
+ The SDK's [Qdrant adapter](https://github.com/lambdadb/lambdadb-typescript-client/blob/v0.7.0/docs/compatibility/qdrant.md)
274
+ now rejects extra schema options with `UnsupportedQdrantFeatureError`. Its mapping
275
+ remains type-only; text omits analyzers for the standard default. Migration callers
276
+ must reject or explicitly resolve unsupported options rather than discard them.
277
+
199
278
  ## Tests
200
279
 
201
280
  ```bash
@@ -211,7 +290,9 @@ HTTP 201, ref/branch forwarding, invalid combinations, pagination, and `docsUrl`
211
290
  arrays/errors and local environment-file loading. Facet tests validate the published
212
291
  MCP JSON Schema and actual tool-to-SDK HTTP path, including match-all, facet-only,
213
292
  document+facet, omitted/null/default bucket options, boundaries, invalid requests,
214
- and all 16 analyzers. They do not require credentials
293
+ and all 49 analyzers. Rerank tests cover JSON Schema, request preservation,
294
+ local bounds/UTF-8 rejection, score envelopes, skipped/fallback results and
295
+ metadata downloads. They do not require credentials
215
296
  or create remote collections. `test:package` additionally installs the actual
216
297
  tarball in a clean consumer directory and repeats the tool contracts over real
217
298
  stdio, checking version identity, config errors, stdout and process termination.
@@ -229,7 +310,7 @@ LAMBDADB_RUN_LIVE_TESTS=1 LAMBDADB_LIVE_CONFIRM_PROJECT=YOUR_DEV_PROJECT npm run
229
310
 
230
311
  The live test creates one uniquely named temporary collection, checks real HTTP
231
312
  201/202 responses, metadata, pagination, filters, sorting, and Branch/Tag/Alias
232
- reads. It also checks all 16 analyzers in collection metadata, match-all, facet-only
313
+ reads. It also checks all 49 analyzers in collection metadata, match-all, facet-only
233
314
  and document+facet results, default/null bucket size, keyword arrays, dotted paths,
234
315
  and facet preservation across refs and `docsUrl` downloads. The designated server
235
316
  must support these features. It writes two 3 MiB documents to force actual `docsUrl` array downloads
@@ -239,6 +320,27 @@ temporary collection in cleanup, and verifies that the collection is absent.
239
320
  Branch/Tag/Alias setup and collection cleanup use the SDK directly because these
240
321
  operations are not exposed as MCP tools. This test is separate from `npm run check`.
241
322
 
323
+ Managed reranking has a separate live suite because it requires an enabled
324
+ `typesafe` / `jev-1.13.0` model and can incur inference cost. Use the same explicitly
325
+ authorized development project and write opt-in, with an additional inference opt-in:
326
+
327
+ ```bash
328
+ LAMBDADB_RUN_LIVE_TESTS=1 LAMBDADB_RUN_LIVE_RERANK_TESTS=1 LAMBDADB_LIVE_CONFIRM_PROJECT=YOUR_DEV_PROJECT npm run test:live:rerank
329
+ ```
330
+
331
+ It creates one temporary collection and two synthetic documents. It verifies
332
+ omitted/null retrieval behavior, applied default and custom criteria, final size
333
+ versus candidate count, envelope evaluation/retrieval scores, inline and actual
334
+ `docsUrl` order/precision/metadata preservation, download credential isolation,
335
+ and empty `skipped` results. Only short stored text is sent for evaluation; the
336
+ large synthetic payload forces document offload without enlarging model input.
337
+ Cleanup deletes the collection and verifies its absence even after a failed check.
338
+ It does not assert fixed model scores or relevance rankings, and a fallback result
339
+ does not pass as applied inference. Provider failures remain fixture tests; this
340
+ suite does not deliberately induce failures or verify search quality, load,
341
+ production deployment or billing readiness. Both live suites are outside default
342
+ checks and credential-free CI.
343
+
242
344
  If the environment file is outside the worktree:
243
345
 
244
346
  ```bash
@@ -9,6 +9,21 @@ const facetsSchema = z.record(z.string(), z.strictObject({
9
9
  // Zod refinements are not represented in JSON Schema without explicit metadata.
10
10
  .meta({ maxProperties: 5 })
11
11
  .describe("Keyword field names (including dotted paths) mapped to bucket options. Requires newly built keyword indexes on a supporting server.");
12
+ // The SDK validates UTF-8 byte budgets, nonblank text, unique paths/criteria,
13
+ // scoring-query requirements and cross-field bounds before sending HTTP.
14
+ const rerankSchema = z.strictObject({
15
+ provider: z.literal("typesafe"),
16
+ model: z.literal("jev-1.13.0"),
17
+ queryText: z.string().min(1).describe("Required nonblank query text, at most 8 KiB UTF-8, including for raw vector queries."),
18
+ fields: z.array(z.string().min(1)).min(1).max(8).meta({ uniqueItems: true })
19
+ .describe("Unique stored scalar text paths in model input order; separate from returned fields projection."),
20
+ candidateSize: z.number().int().min(1).max(100).nullable().optional()
21
+ .describe("Merged candidate cap, at least final size. Omitted/null defaults to max(50, size); never changes knn.k."),
22
+ onFailure: z.enum(["error", "returnOriginal"]).nullable().optional()
23
+ .describe("Omitted/null defaults to error. returnOriginal covers only eligible provider failures."),
24
+ criteria: z.array(z.string().min(1)).min(2).max(10).meta({ uniqueItems: true }).nullable().optional()
25
+ .describe("Distinct nonblank descriptions from lowest to highest relevance, at most 2 KiB each and 8 KiB total UTF-8. Omitted/null uses defaults.")
26
+ }).nullable().optional().describe("Optional per-query managed reranking; requires a scoring query and positive size, forbids sort. LambdaDB manages provider credentials.");
12
27
  export function registerReadTools(server, config) {
13
28
  server.registerTool("lambdadb_list_collections", {
14
29
  title: "List Collections",
@@ -53,7 +68,7 @@ export function registerReadTools(server, config) {
53
68
  });
54
69
  server.registerTool("lambdadb_query_collection", {
55
70
  title: "Query Collection",
56
- description: "Search documents and optionally return keyword facet counts across all matches. Omit query for match-all; size: 0 requires at least one facet and returns only facets. Facets require a supporting server and newly built keyword indexes.",
71
+ description: "Search documents with optional managed reranking and keyword facet counts across all matches. Omit query for match-all; size: 0 requires facets and forbids reranking. Reranking requires a scoring query and forbids sort; it does not enable vector/hybrid facets. Applied envelope score is an evaluation score, retrievalScore preserves search score, and rerank metadata reports status. Features require a supporting server; facets require newly built keyword indexes.",
57
72
  annotations: {
58
73
  readOnlyHint: true,
59
74
  openWorldHint: false
@@ -64,6 +79,7 @@ export function registerReadTools(server, config) {
64
79
  .describe("Documents to return (1–100), or 0 with nonempty facets."),
65
80
  query: z.record(z.string(), z.any()).optional().describe("Omit for match-all."),
66
81
  facets: facetsSchema.optional(),
82
+ rerank: rerankSchema,
67
83
  ref: readRefSchema.optional(),
68
84
  consistentRead: z.boolean().optional().describe("true requires a direct branch ref or omitted ref (main)."),
69
85
  includeVectors: z.boolean().optional(),
@@ -80,14 +96,22 @@ export function registerReadTools(server, config) {
80
96
  allOf: [{
81
97
  if: { properties: { size: { const: 0 } }, required: ["size"] },
82
98
  then: { required: ["facets"], properties: { facets: { minProperties: 1 } } }
99
+ }, {
100
+ if: { properties: { rerank: { type: "object" } }, required: ["rerank"] },
101
+ then: {
102
+ required: ["query"],
103
+ properties: { size: { minimum: 1 } },
104
+ not: { required: ["sort"] }
105
+ }
83
106
  }]
84
107
  })
85
- }, async ({ collectionName, size, query, facets, ref, consistentRead, includeVectors, sort, fields, partitionFilter }) => {
108
+ }, async ({ collectionName, size, query, facets, rerank, ref, consistentRead, includeVectors, sort, fields, partitionFilter }) => {
86
109
  try {
87
110
  const client = createLambdaDBClient(config);
88
111
  const input = {
89
112
  query,
90
113
  facets,
114
+ rerank,
91
115
  size,
92
116
  ...readOptions(ref, consistentRead),
93
117
  includeVectors,
@@ -1,3 +1,4 @@
1
+ import { Analyzer } from "@functional-systems/lambdadb/models";
1
2
  import { z } from "zod";
2
3
  import { createLambdaDBClient } from "../lambdadb/client.js";
3
4
  import { formatLambdaDBError } from "../lambdadb/errors.js";
@@ -5,7 +6,7 @@ import { jsonResult, nameSchema, partitionFilterSchema } from "./shared.js";
5
6
  export function registerWriteTools(server, config) {
6
7
  server.registerTool("lambdadb_create_collection", {
7
8
  title: "Create Collection",
8
- description: "Create a new collection in the configured project. Text index analyzers: standard, english, korean, japanese, chinese, cjk, arabic, french, german, hindi, indonesian, italian, portuguese, russian, spanish, turkish. Keyword indexes built on a supporting server support facets.",
9
+ description: `Create a new collection in the configured project. Fixed lowercase text analyzer presets: ${Object.values(Analyzer).join(", ")}. Omitted analyzers uses standard; custom pipelines/options are unsupported. The keyword text analyzer is distinct from the keyword field type. Keyword indexes built on a supporting server support facets.`,
9
10
  annotations: {
10
11
  openWorldHint: false
11
12
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functional-systems/lambdadb-mcp",
3
- "version": "0.1.2-dev.8",
3
+ "version": "0.1.2-dev.9",
4
4
  "private": false,
5
5
  "description": "MCP server for LambdaDB data plane",
6
6
  "type": "module",
@@ -11,6 +11,7 @@
11
11
  "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json && node -e \"require('node:fs').chmodSync('dist/index.js', 0o755)\"",
12
12
  "check": "npm run check:version && npm run typecheck && npm test",
13
13
  "test": "npm run build && node --test test/*.test.mjs",
14
+ "test:live:rerank": "npm run build && bash ./scripts/with-env.sh --test test/integration/rerank-live.test.mjs",
14
15
  "test:live": "npm run build && bash ./scripts/with-env.sh --test test/integration/live.test.mjs",
15
16
  "dev": "tsx watch src/index.ts",
16
17
  "inspect": "bash ./scripts/inspect.sh",
@@ -22,7 +23,7 @@
22
23
  "test:package": "node scripts/test-package.mjs"
23
24
  },
24
25
  "dependencies": {
25
- "@functional-systems/lambdadb": "0.6.0",
26
+ "@functional-systems/lambdadb": "0.7.0",
26
27
  "@modelcontextprotocol/sdk": "1.29.0",
27
28
  "zod": "^4.1.12"
28
29
  },
@@ -60,5 +61,5 @@
60
61
  "access": "public",
61
62
  "registry": "https://registry.npmjs.org"
62
63
  },
63
- "gitHead": "e706cf744d21ded011853ac6ffb34409e739de36"
64
+ "gitHead": "99896e0279fa7610358e9abafc032dd507b10f40"
64
65
  }