@@ -13,9 +13,10 @@ describe("Connect tool", () => {
1313
1414 validateParameters ( connectTool , [
1515 {
16- name : "connectionStringOrClusterName" ,
17- description : "MongoDB connection string (in the mongodb:// or mongodb+srv:// format) or cluster name" ,
18- type : "string" ,
16+ name : "options" ,
17+ description :
18+ "Options for connecting to MongoDB. If not provided, the connection string from the config://connection-string resource will be used. If the user hasn't specified Atlas cluster name or a connection string explicitly and the `config://connection-string` resource is present, always invoke this with no arguments." ,
19+ type : "array" ,
1920 required : false ,
2021 } ,
2122 ] ) ;
@@ -27,15 +28,20 @@ describe("Connect tool", () => {
2728 const response = await integration . mcpClient ( ) . callTool ( { name : "connect" , arguments : { } } ) ;
2829 const content = getResponseContent ( response . content ) ;
2930 expect ( content ) . toContain ( "No connection details provided" ) ;
30- expect ( content ) . toContain ( "mongodb://localhost:27017" ) ;
3131 } ) ;
3232 } ) ;
3333
3434 describe ( "with connection string" , ( ) => {
3535 it ( "connects to the database" , async ( ) => {
3636 const response = await integration . mcpClient ( ) . callTool ( {
3737 name : "connect" ,
38- arguments : { connectionStringOrClusterName : integration . connectionString ( ) } ,
38+ arguments : {
39+ options : [
40+ {
41+ connectionString : integration . connectionString ( ) ,
42+ } ,
43+ ] ,
44+ } ,
3945 } ) ;
4046 const content = getResponseContent ( response . content ) ;
4147 expect ( content ) . toContain ( "Successfully connected" ) ;
@@ -47,7 +53,7 @@ describe("Connect tool", () => {
4753 it ( "returns error message" , async ( ) => {
4854 const response = await integration . mcpClient ( ) . callTool ( {
4955 name : "connect" ,
50- arguments : { connectionStringOrClusterName : "mongodb://localhost:12345" } ,
56+ arguments : { options : [ { connectionString : "mongodb://localhost:12345" } ] } ,
5157 } ) ;
5258 const content = getResponseContent ( response . content ) ;
5359 expect ( content ) . toContain ( "Error running connect" ) ;
@@ -74,7 +80,13 @@ describe("Connect tool", () => {
7480 const newConnectionString = `${ integration . connectionString ( ) } ?appName=foo-bar` ;
7581 const response = await integration . mcpClient ( ) . callTool ( {
7682 name : "connect" ,
77- arguments : { connectionStringOrClusterName : newConnectionString } ,
83+ arguments : {
84+ options : [
85+ {
86+ connectionString : newConnectionString ,
87+ } ,
88+ ] ,
89+ } ,
7890 } ) ;
7991 const content = getResponseContent ( response . content ) ;
8092 expect ( content ) . toContain ( "Successfully connected" ) ;
@@ -85,7 +97,13 @@ describe("Connect tool", () => {
8597 it ( "suggests the config connection string if set" , async ( ) => {
8698 const response = await integration . mcpClient ( ) . callTool ( {
8799 name : "connect" ,
88- arguments : { connectionStringOrClusterName : "mongodb://localhost:12345" } ,
100+ arguments : {
101+ options : [
102+ {
103+ connectionString : "mongodb://localhost:12345" ,
104+ } ,
105+ ] ,
106+ } ,
89107 } ) ;
90108 const content = getResponseContent ( response . content ) ;
91109 expect ( content ) . toContain ( "Failed to connect to MongoDB at 'mongodb://localhost:12345'" ) ;
@@ -98,7 +116,13 @@ describe("Connect tool", () => {
98116 config . connectionString = "mongodb://localhost:12345" ;
99117 const response = await integration . mcpClient ( ) . callTool ( {
100118 name : "connect" ,
101- arguments : { connectionStringOrClusterName : "mongodb://localhost:12345" } ,
119+ arguments : {
120+ options : [
121+ {
122+ connectionString : "mongodb://localhost:12345" ,
123+ } ,
124+ ] ,
125+ } ,
102126 } ) ;
103127
104128 const content = getResponseContent ( response . content ) ;
0 commit comments