@functional-systems/lambdadb-mcp 0.1.1-dev.6 → 0.1.1-dev.7

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,17 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Pin the LambdaDB TypeScript SDK to 0.6.0, including all 16 text analyzers.
6
+ - Add keyword facets, query omission for match-all, and facet-only `size: 0` to
7
+ `lambdadb_query_collection`. Preserve omitted/null bucket sizes and facet results,
8
+ including automatic document downloads; retain existing search options and refs.
9
+ - Expose facet limits and the `size: 0` condition in MCP JSON Schema and validate
10
+ them through tool calls, SDK HTTP contracts, installed-package tests, and the
11
+ opt-in live suite. Read-only defaults and explicit write opt-in are unchanged.
12
+ - Facets require a supporting server and newly built keyword indexes. Existing
13
+ Collections are not migrated, and existing MCP installations require an update
14
+ to a separately published MCP version containing this change.
15
+
5
16
  ## [0.1.0] - 2026-09-20
6
17
 
7
18
  - Package `@functional-systems/lambdadb-mcp` and the `lambdadb-mcp` executable for npm/npx distribution under Apache-2.0.
package/README.md CHANGED
@@ -95,10 +95,11 @@ Optional write tools:
95
95
 
96
96
  ## API contract and tool inputs
97
97
 
98
- The LambdaDB SDK is pinned to `@functional-systems/lambdadb@0.5.1`.
99
- The tool contract was checked against LambdaDB develop
100
- [`d1a76659884a9ed09283a0b2e2989897dc799247`](https://github.com/lambdadb/lambdadb/commit/d1a76659884a9ed09283a0b2e2989897dc799247).
101
- This source revision does not establish which API revision is deployed.
98
+ The LambdaDB SDK is pinned to `@functional-systems/lambdadb@0.6.0`, checked against
99
+ the published package and [v0.6.0 release](https://github.com/lambdadb/lambdadb-typescript-client/releases/tag/v0.6.0)
100
+ at [`491d01e`](https://github.com/lambdadb/lambdadb-typescript-client/commit/491d01e0eb54bd135823fab79cbe32396ec03691).
101
+ This dependency update applies to builds containing this change. Publishing the SDK
102
+ alone does not update previously published or installed MCP packages.
102
103
 
103
104
  - Collection creation requires a nonempty `indexConfigs` and accepts `description`,
104
105
  metadata `tags`, `partitionConfig`, and `snapshotRetentionInDays` (1–31).
@@ -106,6 +107,12 @@ This source revision does not establish which API revision is deployed.
106
107
  - Query, Fetch, and List accept `ref: { kind: "branch" | "tag" | "alias", name: "..." }`.
107
108
  Omitting `ref` reads from `main`. `consistentRead: true` is supported only by
108
109
  Query/Fetch with an omitted ref or a direct Branch ref. List has no `consistentRead`.
110
+ - Query may omit `query` for match-all and accepts `facets` for keyword bucket counts
111
+ across all matches. Document `size` is 1–100, or 0 when at least one facet is supplied.
112
+ Up to five facet fields (including dotted paths) are allowed. Each field's options
113
+ accept only `size`: an integer from 1–100, omitted, or `null`. Omitted/null bucket
114
+ size uses the server default of 10; MCP forwards it unchanged. Empty `facets: {}`
115
+ is accepted except with `size: 0`. Facet results survive inline and `docsUrl` responses.
109
116
  - List also accepts `filter`, `fields`, `includeVectors`, and `partitionFilter`.
110
117
  The SDK selects the extended POST endpoint when needed and preserves pagination tokens.
111
118
  - Upsert/Delete accept an optional `branch`; omitting it writes to `main`.
@@ -122,6 +129,67 @@ Query/Fetch/List download top-level document arrays and retain legacy `{ "docs":
122
129
  support without sending the project API key to the download URL. No additional SDK
123
130
  patch is needed for this issue.
124
131
 
132
+ ### Query examples
133
+
134
+ Arguments for `lambdadb_query_collection`, returning only facets across all documents:
135
+
136
+ ```json
137
+ {
138
+ "collectionName": "products",
139
+ "size": 0,
140
+ "facets": { "category": {}, "metadata.brand": { "size": null } }
141
+ }
142
+ ```
143
+
144
+ Return matching documents and facets together:
145
+
146
+ ```json
147
+ {
148
+ "collectionName": "products",
149
+ "query": { "queryString": { "query": "title:coffee" } },
150
+ "size": 10,
151
+ "facets": { "category": { "size": 5 } },
152
+ "fields": { "include": ["id", "title", "category"] }
153
+ }
154
+ ```
155
+
156
+ For match-all documents without facets, use `{ "collectionName": "products", "size": 10 }`.
157
+ MCP returns JSON in its text content, with `docs`, `total`, `took`, and (when returned
158
+ by the service) `facets`, for example `"facets": { "category": { "buckets": [
159
+ { "value": "drinks", "count": 42 } ] } }`. Bucket counts cover all matching
160
+ documents, independently of document `size`; duplicate keyword array values count
161
+ once per document. `total` counts returned documents (0 for facet-only requests),
162
+ not all matching documents. Counts use JavaScript Number and may lose integer precision
163
+ above `Number.MAX_SAFE_INTEGER`.
164
+
165
+ Facets require a supporting server deployment and newly built keyword indexes.
166
+ This MCP update does not migrate existing Collections or indexes. Partial updates,
167
+ segment merging, and old Tags do not upgrade old indexes. If migration is needed,
168
+ plan and authorize reinsertion into a new Collection separately.
169
+
170
+ ### Text analyzers in collection creation
171
+
172
+ With write tools explicitly enabled, `lambdadb_create_collection` accepts:
173
+
174
+ ```json
175
+ {
176
+ "collectionName": "products",
177
+ "indexConfigs": {
178
+ "title": { "type": "text", "analyzers": ["english", "chinese", "french"] },
179
+ "category": { "type": "keyword" },
180
+ "metadata": { "type": "object", "objectIndexConfigs": { "brand": { "type": "keyword" } } }
181
+ }
182
+ }
183
+ ```
184
+
185
+ Supported lowercase names: `standard`, `english`, `korean`, `japanese`, `chinese`,
186
+ `cjk`, `arabic`, `french`, `german`, `hindi`, `indonesian`, `italian`, `portuguese`,
187
+ `russian`, `spanish`, `turkish`. Omitting `analyzers` uses the server default
188
+ `["standard"]`; an empty list is passed through and does not select that default.
189
+ Analyzers run independently without automatic language detection. Lists are sent
190
+ unchanged; avoid duplicate names, which the server rejects. Index configuration
191
+ validation remains in the SDK. Write tools remain disabled by default.
192
+
125
193
  ## Tests
126
194
 
127
195
  ```bash
@@ -134,7 +202,10 @@ npm run test:package
134
202
  client to this server and exercise the installed SDK against a local HTTP fixture.
135
203
  They cover read-only defaults, write opt-in, List/Get response validation, creation
136
204
  HTTP 201, ref/branch forwarding, invalid combinations, pagination, and `docsUrl`
137
- arrays/errors and local environment-file loading. They do not require credentials
205
+ arrays/errors and local environment-file loading. Facet tests validate the published
206
+ MCP JSON Schema and actual tool-to-SDK HTTP path, including match-all, facet-only,
207
+ document+facet, omitted/null/default bucket options, boundaries, invalid requests,
208
+ and all 16 analyzers. They do not require credentials
138
209
  or create remote collections. `test:package` additionally installs the actual
139
210
  tarball in a clean consumer directory and repeats the tool contracts over real
140
211
  stdio, checking version identity, config errors, stdout and process termination.
@@ -152,7 +223,10 @@ LAMBDADB_RUN_LIVE_TESTS=1 LAMBDADB_LIVE_CONFIRM_PROJECT=YOUR_DEV_PROJECT npm run
152
223
 
153
224
  The live test creates one uniquely named temporary collection, checks real HTTP
154
225
  201/202 responses, metadata, pagination, filters, sorting, and Branch/Tag/Alias
155
- reads. It writes two 3 MiB documents to force actual `docsUrl` array downloads
226
+ reads. It also checks all 16 analyzers in collection metadata, match-all, facet-only
227
+ and document+facet results, default/null bucket size, keyword arrays, dotted paths,
228
+ and facet preservation across refs and `docsUrl` downloads. The designated server
229
+ must support these features. It writes two 3 MiB documents to force actual `docsUrl` array downloads
156
230
  through the MCP tools and checks full payload integrity and download credential
157
231
  isolation. It allows up to five minutes for committed visibility, deletes its
158
232
  temporary collection in cleanup, and verifies that the collection is absent.
@@ -2,6 +2,13 @@ import { z } from "zod";
2
2
  import { createLambdaDBClient } from "../lambdadb/client.js";
3
3
  import { formatLambdaDBError } from "../lambdadb/errors.js";
4
4
  import { fieldsSchema, jsonResult, nameSchema, partitionFilterSchema, readOptions, readRefSchema } from "./shared.js";
5
+ const facetsSchema = z.record(z.string(), z.strictObject({
6
+ size: z.number().int().min(1).max(100).nullable().optional()
7
+ .describe("Maximum buckets; omitted or null uses the server default of 10.")
8
+ })).refine((facets) => Object.keys(facets).length <= 5, "At most five facet fields may be requested.")
9
+ // Zod refinements are not represented in JSON Schema without explicit metadata.
10
+ .meta({ maxProperties: 5 })
11
+ .describe("Keyword field names (including dotted paths) mapped to bucket options. Requires newly built keyword indexes on a supporting server.");
5
12
  export function registerReadTools(server, config) {
6
13
  server.registerTool("lambdadb_list_collections", {
7
14
  title: "List Collections",
@@ -46,15 +53,17 @@ export function registerReadTools(server, config) {
46
53
  });
47
54
  server.registerTool("lambdadb_query_collection", {
48
55
  title: "Query Collection",
49
- description: "Run a search query against a collection and return the matching documents.",
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.",
50
57
  annotations: {
51
58
  readOnlyHint: true,
52
59
  openWorldHint: false
53
60
  },
54
61
  inputSchema: z.strictObject({
55
62
  collectionName: nameSchema,
56
- size: z.number().int().min(1).max(100).optional(),
57
- query: z.record(z.string(), z.any()),
63
+ size: z.number().int().min(0).max(100).optional()
64
+ .describe("Documents to return (1–100), or 0 with nonempty facets."),
65
+ query: z.record(z.string(), z.any()).optional().describe("Omit for match-all."),
66
+ facets: facetsSchema.optional(),
58
67
  ref: readRefSchema.optional(),
59
68
  consistentRead: z.boolean().optional().describe("true requires a direct branch ref or omitted ref (main)."),
60
69
  includeVectors: z.boolean().optional(),
@@ -62,12 +71,23 @@ export function registerReadTools(server, config) {
62
71
  sort: z.array(z.record(z.string(), z.string().regex(/^([aA][sS][cC]|[dD][eE][sS][cC])$/))).optional(),
63
72
  fields: fieldsSchema.optional(),
64
73
  partitionFilter: partitionFilterSchema.optional()
74
+ }).superRefine((input, context) => {
75
+ if (input.size === 0 && Object.keys(input.facets ?? {}).length === 0) {
76
+ context.addIssue({ code: "custom", path: ["facets"], message: "size: 0 requires at least one facet." });
77
+ }
78
+ }).meta({
79
+ // Keep the cross-field rule visible to MCP clients as well as tools/call.
80
+ allOf: [{
81
+ if: { properties: { size: { const: 0 } }, required: ["size"] },
82
+ then: { required: ["facets"], properties: { facets: { minProperties: 1 } } }
83
+ }]
65
84
  })
66
- }, async ({ collectionName, size, query, ref, consistentRead, includeVectors, sort, fields, partitionFilter }) => {
85
+ }, async ({ collectionName, size, query, facets, ref, consistentRead, includeVectors, sort, fields, partitionFilter }) => {
67
86
  try {
68
87
  const client = createLambdaDBClient(config);
69
88
  const input = {
70
89
  query,
90
+ facets,
71
91
  size,
72
92
  ...readOptions(ref, consistentRead),
73
93
  includeVectors,
@@ -5,7 +5,7 @@ import { jsonResult, nameSchema, partitionFilterSchema } from "./shared.js";
5
5
  export function registerWriteTools(server, config) {
6
6
  server.registerTool("lambdadb_create_collection", {
7
7
  title: "Create Collection",
8
- description: "Create a new collection in the configured project.",
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
9
  annotations: {
10
10
  openWorldHint: false
11
11
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functional-systems/lambdadb-mcp",
3
- "version": "0.1.1-dev.6",
3
+ "version": "0.1.1-dev.7",
4
4
  "private": false,
5
5
  "description": "MCP server for LambdaDB data plane",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "test:package": "node scripts/test-package.mjs"
23
23
  },
24
24
  "dependencies": {
25
- "@functional-systems/lambdadb": "0.5.1",
25
+ "@functional-systems/lambdadb": "0.6.0",
26
26
  "@modelcontextprotocol/sdk": "1.29.0",
27
27
  "zod": "^4.1.12"
28
28
  },
@@ -60,5 +60,5 @@
60
60
  "access": "public",
61
61
  "registry": "https://registry.npmjs.org"
62
62
  },
63
- "gitHead": "fc5765bec9dd84f239840eab734531a945d8a70c"
63
+ "gitHead": "d1a041ed8497eb8113b616faf87b2702fb5b80c5"
64
64
  }