You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnkeyValueList ? Object.fromEntries(keyValueList.map(({ key, value })=>[key,value])) : undefined;
14
+
}
15
+
9
16
exportconstFindArgs={
10
17
filter: z
11
-
.record(z.string(),z.unknown())
18
+
.array(
19
+
z.object({
20
+
key: z.string().describe("The name of the field or a MongoDB operator"),
21
+
value: z
22
+
.unknown()
23
+
.refine((val)=>val!==undefined,{message: "Value cannot be undefined."})
24
+
.describe("The filter expression for the key"),
25
+
})
26
+
)
12
27
.optional()
13
-
.describe("The query filter, matching the syntax of the query argument of db.collection.find()"),
28
+
.describe(
29
+
"Array of key-value pairs to filter documents. Each object has 'key' (field name or MongoDB operator) and 'value' (filter criteria)."
30
+
),
14
31
projection: z
15
-
.record(z.string(),z.unknown())
32
+
.array(
33
+
z.object({
34
+
key: z.string().describe("The name of the field to be projected."),
35
+
value: z
36
+
.unknown()
37
+
.refine((val)=>val!==undefined,{message: "Value cannot be undefined."})
38
+
.describe("The projection expression for the projected field."),
39
+
})
40
+
)
16
41
.optional()
17
-
.describe("The projection, matching the syntax of the projection argument of db.collection.find()"),
42
+
.describe(
43
+
"Array of key-value pairs to specify which fields to project (key) and how to project them(value). Each object has 'key' (field name) and 'value' (project expression). "
44
+
),
18
45
limit: z.number().optional().default(10).describe("The maximum number of documents to return"),
19
46
sort: z
20
-
.record(z.string(),z.custom<SortDirection>())
47
+
.array(
48
+
z.object({
49
+
key: z.string().describe("The name of the field to apply the sort on."),
50
+
value: z.custom<SortDirection>().describe("The sort order applied to the field being sorted."),
51
+
})
52
+
)
21
53
.optional()
22
-
.describe("A document, describing the sort order, matching the syntax of the sort argument of cursor.sort()"),
54
+
.describe(
55
+
"Array of key-value pairs to specify sort order. Each object has 'key' (field name) and 'value' (sort order)."
56
+
),
23
57
};
24
58
25
59
exportclassFindToolextendsMongoDBToolBase{
@@ -41,14 +75,29 @@ export class FindTool extends MongoDBToolBase {
0 commit comments