99
1010from mcp .server .fastmcp import Context
1111
12- from tools .query import run_cluster_query
12+ from tools .query import run_sql_plus_plus_query
1313from utils .constants import MCP_SERVER_NAME
1414
1515logger = logging .getLogger (f"{ MCP_SERVER_NAME } .tools.index" )
1616
1717
18- def get_index_advisor_recommendations (ctx : Context , query : str ) -> dict [str , Any ]:
18+ def get_index_advisor_recommendations (
19+ ctx : Context , bucket_name : str , scope_name : str , query : str
20+ ) -> dict [str , Any ]:
1921 """Get index recommendations from Couchbase Index Advisor for a given SQL++ query.
2022
2123 The Index Advisor analyzes the query and provides recommendations for optimal indexes.
2224 This tool works with SELECT, UPDATE, DELETE, or MERGE queries.
23- The query should contain fully qualified keyspace (e.g., bucket. scope.collection) .
25+ The queries will be run on the specified scope in the specified bucket .
2426
2527 Returns a dictionary with:
2628 - current_used_indexes: Array of currently used indexes (if any)
@@ -38,7 +40,9 @@ def get_index_advisor_recommendations(ctx: Context, query: str) -> dict[str, Any
3840 logger .info ("Running Index Advisor for the provided query" )
3941
4042 # Execute the ADVISOR function at cluster level using run_cluster_query
41- advisor_results = run_cluster_query (ctx , advisor_query )
43+ advisor_results = run_sql_plus_plus_query (
44+ ctx , bucket_name , scope_name , advisor_query
45+ )
4246
4347 if not advisor_results :
4448 return {
0 commit comments