@@ -201,13 +201,13 @@ def create_tool_search(index: ToolIndex) -> StackOneTool:
201201 '(e.g., "tools for managing employees", "create time off request")'
202202 ),
203203 },
204- "limit " : {
204+ "top_k " : {
205205 "type" : "number" ,
206206 "description" : "Maximum number of tools to return (default: 5)" ,
207207 "default" : 5 ,
208208 "nullable" : True ,
209209 },
210- "minScore " : {
210+ "min_score " : {
211211 "type" : "number" ,
212212 "description" : "Minimum relevance score (0-1) to filter results (default: 0.0)" ,
213213 "default" : 0.0 ,
@@ -225,11 +225,11 @@ def execute_filter(arguments: str | JsonDict | None = None) -> JsonDict:
225225 kwargs = arguments or {}
226226
227227 query = kwargs .get ("query" , "" )
228- limit = int (kwargs ["limit " ]) if kwargs .get ("limit " ) is not None else 5
229- min_score = float (kwargs ["minScore " ]) if kwargs .get ("minScore " ) is not None else 0.0
228+ top_k = int (kwargs ["top_k " ]) if kwargs .get ("top_k " ) is not None else 5
229+ min_score = float (kwargs ["min_score " ]) if kwargs .get ("min_score " ) is not None else 0.0
230230
231231 # Search for tools
232- results = index .search (query , limit , min_score )
232+ results = index .search (query , top_k , min_score )
233233
234234 # Format results
235235 tools_data = [
@@ -310,13 +310,13 @@ def create_semantic_tool_search(
310310 '(e.g., "onboard a new team member", "request vacation days")'
311311 ),
312312 },
313- "limit " : {
313+ "top_k " : {
314314 "type" : "number" ,
315315 "description" : "Maximum number of tools to return (default: 5)" ,
316316 "default" : 5 ,
317317 "nullable" : True ,
318318 },
319- "minSimilarity " : {
319+ "min_similarity " : {
320320 "type" : "number" ,
321321 "description" : (
322322 "Minimum similarity score (0-1) to filter results. "
@@ -340,8 +340,8 @@ def execute_search(arguments: str | JsonDict | None = None) -> JsonDict:
340340 kwargs = arguments or {}
341341
342342 query = kwargs .get ("query" , "" )
343- limit = int (kwargs ["limit " ]) if kwargs .get ("limit " ) is not None else 5
344- min_similarity = float (kwargs ["minSimilarity " ]) if kwargs .get ("minSimilarity " ) is not None else None
343+ top_k = int (kwargs ["top_k " ]) if kwargs .get ("top_k " ) is not None else 5
344+ min_similarity = float (kwargs ["min_similarity " ]) if kwargs .get ("min_similarity " ) is not None else None
345345 connector = kwargs .get ("connector" )
346346
347347 all_results : list [SemanticSearchResult ] = []
@@ -361,7 +361,7 @@ def execute_search(arguments: str | JsonDict | None = None) -> JsonDict:
361361 semantic_client .search ,
362362 query = query ,
363363 connector = c ,
364- top_k = limit ,
364+ top_k = top_k ,
365365 min_similarity = min_similarity ,
366366 ): c
367367 for c in connectors_to_search
@@ -377,12 +377,12 @@ def execute_search(arguments: str | JsonDict | None = None) -> JsonDict:
377377 response = semantic_client .search (
378378 query = query ,
379379 connector = connector ,
380- top_k = limit ,
380+ top_k = top_k ,
381381 min_similarity = min_similarity ,
382382 )
383383 all_results = list (response .results )
384384
385- # Sort by score, deduplicate, apply limit
385+ # Sort by score, deduplicate, apply top_k
386386 all_results .sort (key = lambda r : r .similarity_score , reverse = True )
387387 seen : set [str ] = set ()
388388 tools_data : list [dict [str , object ]] = []
@@ -399,7 +399,7 @@ def execute_search(arguments: str | JsonDict | None = None) -> JsonDict:
399399 }
400400 )
401401
402- return {"tools" : tools_data [:limit ]}
402+ return {"tools" : tools_data [:top_k ]}
403403
404404 execute_config = ExecuteConfig (
405405 name = name ,
0 commit comments