Skip to content

Commit 04c4e9f

Browse files
chore: remove default from limit arg in find target
1 parent df9927a commit 04c4e9f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/tools/mongodb/read/export.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AggregationCursor, FindCursor } from "mongodb";
44
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
55
import { OperationType, ToolArgs } from "../../tool.js";
66
import { DbOperationArgs, MongoDBToolBase } from "../mongodbTool.js";
7-
import { FindArgs } from "./find.js";
7+
import { FindArgs, limitArg } from "./find.js";
88
import { jsonExportFormat } from "../../../common/exportsManager.js";
99
import { AggregateArgs } from "./aggregate.js";
1010

@@ -19,7 +19,10 @@ export class ExportTool extends MongoDBToolBase {
1919
z.discriminatedUnion("name", [
2020
z.object({
2121
name: z.literal("find"),
22-
arguments: z.object(FindArgs),
22+
arguments: z.object({
23+
...FindArgs,
24+
limit: limitArg,
25+
}),
2326
}),
2427
z.object({
2528
name: z.literal("aggregate"),

src/tools/mongodb/read/find.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { ToolArgs, OperationType } from "../../tool.js";
55
import { SortDirection } from "mongodb";
66
import { checkIndexUsage } from "../../../helpers/indexCheck.js";
77

8+
export const limitArg = z.number().optional().describe("The maximum number of documents to return");
9+
810
export const FindArgs = {
911
filter: z
1012
.object({})
@@ -16,7 +18,7 @@ export const FindArgs = {
1618
.passthrough()
1719
.optional()
1820
.describe("The projection, matching the syntax of the projection argument of db.collection.find()"),
19-
limit: z.number().optional().default(10).describe("The maximum number of documents to return"),
21+
limit: limitArg.default(10),
2022
sort: z
2123
.object({})
2224
.catchall(z.custom<SortDirection>())

0 commit comments

Comments
 (0)