File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { AggregationCursor, FindCursor } from "mongodb";
44import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
55import { OperationType , ToolArgs } from "../../tool.js" ;
66import { DbOperationArgs , MongoDBToolBase } from "../mongodbTool.js" ;
7- import { FindArgs } from "./find.js" ;
7+ import { FindArgs , limitArg } from "./find.js" ;
88import { jsonExportFormat } from "../../../common/exportsManager.js" ;
99import { 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" ) ,
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { ToolArgs, OperationType } from "../../tool.js";
55import { SortDirection } from "mongodb" ;
66import { checkIndexUsage } from "../../../helpers/indexCheck.js" ;
77
8+ export const limitArg = z . number ( ) . optional ( ) . describe ( "The maximum number of documents to return" ) ;
9+
810export 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 > ( ) )
You can’t perform that action at this time.
0 commit comments