@digital-science-dsl/dimensions-analytics-mcp 1.4.3 → 1.4.4
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 +6 -0
- package/dist/mcp/tools/search-input.d.ts +1 -1
- package/dist/mcp/tools/search-input.d.ts.map +1 -1
- package/dist/mcp/tools/search-input.js +5 -2
- package/dist/mcp/tools/search-input.js.map +1 -1
- package/package.json +1 -1
- package/src/mcp/tools/search-input.ts +9 -2
- package/test/tools/search.test.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Allow `search_*` tools to omit `query` for filters-only searches. The shared input schema previously required a free-text `query` string even though the description already said it could be omitted and the DSL query builder already supported filter-only searches, causing tool calls with only `filters` to fail validation. Also clarified the `filters` field description with the required `field`/`operator`/`value` shape and supported operators.
|
|
8
|
+
|
|
3
9
|
## 1.4.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -36,7 +36,7 @@ export declare const SHARED_SEARCH_INPUT: {
|
|
|
36
36
|
readonly confirmLargeFetch: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
37
37
|
readonly skip: z.ZodOptional<z.ZodNumber>;
|
|
38
38
|
readonly page: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
readonly query: z.ZodString
|
|
39
|
+
readonly query: z.ZodOptional<z.ZodString>;
|
|
40
40
|
readonly limit: z.ZodDefault<z.ZodNumber>;
|
|
41
41
|
};
|
|
42
42
|
/** Output schema fields for paginated search responses. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/search-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,uEAAuE;AACvE,eAAO,MAAM,uBAAuB;;;CAmB1B,CAAC;AAEX,uDAAuD;AACvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/search-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,uEAAuE;AACvE,eAAO,MAAM,uBAAuB;;;CAmB1B,CAAC;AAEX,uDAAuD;AACvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCtB,CAAC;AAEX,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAuB3B,CAAC"}
|
|
@@ -25,7 +25,8 @@ export const PAGINATION_INPUT_SCHEMA = {
|
|
|
25
25
|
export const SHARED_SEARCH_INPUT = {
|
|
26
26
|
query: z
|
|
27
27
|
.string()
|
|
28
|
-
.
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Free-text search terms. Optional — omit for a filters-only search that relies solely on `filters` and/or the entity-specific convenience filters (e.g. yearFrom/yearTo)."),
|
|
29
30
|
limit: z
|
|
30
31
|
.number()
|
|
31
32
|
.int()
|
|
@@ -41,7 +42,9 @@ export const SHARED_SEARCH_INPUT = {
|
|
|
41
42
|
filters: z
|
|
42
43
|
.array(ExtendedWhereFilterSchema)
|
|
43
44
|
.optional()
|
|
44
|
-
.describe("Additional where-clause filters
|
|
45
|
+
.describe("Additional where-clause filters. Each item needs field, operator, and (except for is_empty/is_not_empty) value, " +
|
|
46
|
+
'e.g. {"field": "researchers.id", "operator": "=", "value": "ur.01343614074.49"}. ' +
|
|
47
|
+
"Supported operators: =, !=, >, <, >=, <=, in, is_empty, is_not_empty."),
|
|
45
48
|
confirmLargeFetch: z
|
|
46
49
|
.boolean()
|
|
47
50
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.js","sourceRoot":"","sources":["../../../src/mcp/tools/search-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9E,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,aAAa,CAAC,SAAS,GAAG,CAAC,CAAC;SAChC,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE,aAAa,CAAC,SAAS,iBAAiB,CACjH;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,aAAa,CAAC,QAAQ,GAAG,CAAC,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CACP,qEAAqE,aAAa,CAAC,QAAQ,GAAG,CAAC,GAAG,CACnG;CACK,CAAC;AAEX,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,
|
|
1
|
+
{"version":3,"file":"search-input.js","sourceRoot":"","sources":["../../../src/mcp/tools/search-input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9E,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,aAAa,CA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E,CAAC,CAAC,MAAM,EAAE;QACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;QAC7B,2BAA2B,EAAE,CAAC,CAAC,MAAM,EAAE;QACvC,0BAA0B,EAAE,CAAC,CAAC,MAAM,EAAE;KACvC,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,sDAAsD,CAAC;IACnE,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oEAAoE,CAAC;IACjF,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kEAAkE,CAAC;CACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -32,7 +32,10 @@ export const PAGINATION_INPUT_SCHEMA = {
|
|
|
32
32
|
export const SHARED_SEARCH_INPUT = {
|
|
33
33
|
query: z
|
|
34
34
|
.string()
|
|
35
|
-
.
|
|
35
|
+
.optional()
|
|
36
|
+
.describe(
|
|
37
|
+
"Free-text search terms. Optional — omit for a filters-only search that relies solely on `filters` and/or the entity-specific convenience filters (e.g. yearFrom/yearTo).",
|
|
38
|
+
),
|
|
36
39
|
limit: z
|
|
37
40
|
.number()
|
|
38
41
|
.int()
|
|
@@ -50,7 +53,11 @@ export const SHARED_SEARCH_INPUT = {
|
|
|
50
53
|
filters: z
|
|
51
54
|
.array(ExtendedWhereFilterSchema)
|
|
52
55
|
.optional()
|
|
53
|
-
.describe(
|
|
56
|
+
.describe(
|
|
57
|
+
"Additional where-clause filters. Each item needs field, operator, and (except for is_empty/is_not_empty) value, " +
|
|
58
|
+
'e.g. {"field": "researchers.id", "operator": "=", "value": "ur.01343614074.49"}. ' +
|
|
59
|
+
"Supported operators: =, !=, >, <, >=, <=, in, is_empty, is_not_empty.",
|
|
60
|
+
),
|
|
54
61
|
confirmLargeFetch: z
|
|
55
62
|
.boolean()
|
|
56
63
|
.optional()
|
|
@@ -407,6 +407,25 @@ describe("search tools", () => {
|
|
|
407
407
|
const dsl = client.rawQuery.mock.calls[0][0] as string;
|
|
408
408
|
expect(dsl).toContain("is empty");
|
|
409
409
|
});
|
|
410
|
+
|
|
411
|
+
it("supports a filters-only search with no query", async () => {
|
|
412
|
+
client.rawQuery.mockResolvedValue(
|
|
413
|
+
apiRows("publications", [{ id: "pub1", title: "Filters-only Paper" }], 1),
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
const result = await callTool(handlers, "search_publications", {
|
|
417
|
+
filters: [{ field: "researchers.id", operator: "=", value: "ur.014403456555.45" }],
|
|
418
|
+
sortBy: "year",
|
|
419
|
+
limit: 100,
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
expect(result.isError).toBeFalsy();
|
|
423
|
+
const dsl = client.rawQuery.mock.calls[0][0] as string;
|
|
424
|
+
expect(dsl).toContain("search publications");
|
|
425
|
+
expect(dsl).not.toContain(" for ");
|
|
426
|
+
expect(dsl).toContain("researchers.id");
|
|
427
|
+
expect(parseToolResult(result).publications).toHaveLength(1);
|
|
428
|
+
});
|
|
410
429
|
});
|
|
411
430
|
|
|
412
431
|
describe("pagination", () => {
|