@@ -80,13 +80,13 @@ func createEngineResource(accountName, engineName string) mcp.ResourceContents {
8080
8181func TestNewConnect (t * testing.T ) {
8282 mock := & MockResourceFetcher {}
83- connectTool := tools .NewConnect (mock , mock , mock , validProof )
83+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
8484 assert .NotNil (t , connectTool )
8585}
8686
8787func TestConnect_Tool (t * testing.T ) {
8888 mock := & MockResourceFetcher {}
89- connectTool := tools .NewConnect (mock , mock , mock , validProof )
89+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
9090
9191 tool := connectTool .Tool ()
9292 assert .Equal (t , "firebolt_connect" , tool .Name )
@@ -131,7 +131,7 @@ func TestConnect_Handler_Success(t *testing.T) {
131131 }
132132
133133 // Create the tool
134- connectTool := tools .NewConnect (mock , mock , mock , validProof )
134+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
135135
136136 // Execute the handler
137137 request := mcp.CallToolRequest {}
@@ -199,7 +199,7 @@ func TestConnect_Handler_AccountFetchFailure(t *testing.T) {
199199 },
200200 }
201201
202- connectTool := tools .NewConnect (mock , mock , mock , validProof )
202+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
203203 request := mcp.CallToolRequest {}
204204 request .Params .Arguments = map [string ]any {
205205 "docs_proof" : validProof ,
@@ -225,7 +225,7 @@ func TestConnect_Handler_InvalidAccountResource(t *testing.T) {
225225 },
226226 }
227227
228- connectTool := tools .NewConnect (mock , mock , mock , validProof )
228+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
229229 request := mcp.CallToolRequest {}
230230 request .Params .Arguments = map [string ]any {
231231 "docs_proof" : validProof ,
@@ -251,7 +251,7 @@ func TestConnect_Handler_InvalidAccountJSON(t *testing.T) {
251251 },
252252 }
253253
254- connectTool := tools .NewConnect (mock , mock , mock , validProof )
254+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
255255 request := mcp.CallToolRequest {}
256256 request .Params .Arguments = map [string ]any {
257257 "docs_proof" : validProof ,
@@ -273,7 +273,7 @@ func TestConnect_Handler_DatabasesFetchFailure(t *testing.T) {
273273 },
274274 }
275275
276- connectTool := tools .NewConnect (mock , mock , mock , validProof )
276+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
277277 request := mcp.CallToolRequest {}
278278 request .Params .Arguments = map [string ]any {
279279 "docs_proof" : validProof ,
@@ -298,7 +298,7 @@ func TestConnect_Handler_EnginesFetchFailure(t *testing.T) {
298298 },
299299 }
300300
301- connectTool := tools .NewConnect (mock , mock , mock , validProof )
301+ connectTool := tools .NewConnect (mock , mock , mock , validProof , false )
302302 request := mcp.CallToolRequest {}
303303 request .Params .Arguments = map [string ]any {
304304 "docs_proof" : validProof ,
@@ -309,3 +309,73 @@ func TestConnect_Handler_EnginesFetchFailure(t *testing.T) {
309309 assert .Contains (t , err .Error (), "failed to discover engine resources" )
310310 assert .Nil (t , result )
311311}
312+
313+ func TestConnect_Handler_DisableResources (t * testing.T ) {
314+ // Create test data
315+ accounts := []string {"account1" }
316+ databases := map [string ][]string {
317+ "account1" : {"db1" },
318+ }
319+ engines := map [string ][]string {
320+ "account1" : {"engine1" },
321+ }
322+
323+ // Create mock fetcher
324+ mock := & MockResourceFetcher {
325+ AccountsFunc : func (ctx context.Context , accountName string ) ([]mcp.ResourceContents , error ) {
326+ var resources []mcp.ResourceContents
327+ for _ , acc := range accounts {
328+ resources = append (resources , createAccountResource (acc ))
329+ }
330+ return resources , nil
331+ },
332+ DatabasesFunc : func (ctx context.Context , accountName , databaseName string ) ([]mcp.ResourceContents , error ) {
333+ var resources []mcp.ResourceContents
334+ for _ , db := range databases [accountName ] {
335+ resources = append (resources , createDatabaseResource (accountName , db ))
336+ }
337+ return resources , nil
338+ },
339+ EnginesFunc : func (ctx context.Context , accountName , engineName string ) ([]mcp.ResourceContents , error ) {
340+ var resources []mcp.ResourceContents
341+ for _ , eng := range engines [accountName ] {
342+ resources = append (resources , createEngineResource (accountName , eng ))
343+ }
344+ return resources , nil
345+ },
346+ }
347+
348+ // Create the tool with disableResources set to true
349+ connectTool := tools .NewConnect (mock , mock , mock , validProof , true )
350+
351+ // Execute the handler
352+ request := mcp.CallToolRequest {}
353+ request .Params .Arguments = map [string ]any {
354+ "docs_proof" : validProof ,
355+ }
356+ result , err := connectTool .Handler (t .Context (), request )
357+
358+ // Assertions
359+ require .NoError (t , err )
360+ require .NotNil (t , result )
361+ assert .False (t , result .IsError )
362+
363+ // Calculate expected total resources
364+ expectedCount := len (accounts ) // accounts
365+ for _ , dbs := range databases {
366+ expectedCount += len (dbs ) // databases
367+ }
368+ for _ , engs := range engines {
369+ expectedCount += len (engs ) // engines
370+ }
371+
372+ // Check if we got the expected number of resources
373+ assert .Len (t , result .Content , expectedCount )
374+
375+ // Verify the content contains text content instead of embedded resources
376+ for _ , content := range result .Content {
377+ textContent , ok := content .(mcp.TextContent )
378+ require .True (t , ok , "Expected TextContent when disableResources is true" )
379+ assert .NotEmpty (t , textContent .Text )
380+ }
381+ }
0 commit comments