@@ -567,9 +567,9 @@ async def edit_web_search_tools(
567567 if provider == "default" :
568568 web_search_t = func_tool_mgr .get_func ("web_search" )
569569 fetch_url_t = func_tool_mgr .get_func ("fetch_url" )
570- if web_search_t :
570+ if web_search_t and web_search_t . active :
571571 tool_set .add_tool (web_search_t )
572- if fetch_url_t :
572+ if fetch_url_t and fetch_url_t . active :
573573 tool_set .add_tool (fetch_url_t )
574574 tool_set .remove_tool ("web_search_tavily" )
575575 tool_set .remove_tool ("tavily_extract_web_page" )
@@ -578,9 +578,9 @@ async def edit_web_search_tools(
578578 elif provider == "tavily" :
579579 web_search_tavily = func_tool_mgr .get_func ("web_search_tavily" )
580580 tavily_extract_web_page = func_tool_mgr .get_func ("tavily_extract_web_page" )
581- if web_search_tavily :
581+ if web_search_tavily and web_search_tavily . active :
582582 tool_set .add_tool (web_search_tavily )
583- if tavily_extract_web_page :
583+ if tavily_extract_web_page and tavily_extract_web_page . active :
584584 tool_set .add_tool (tavily_extract_web_page )
585585 tool_set .remove_tool ("web_search" )
586586 tool_set .remove_tool ("fetch_url" )
@@ -590,9 +590,8 @@ async def edit_web_search_tools(
590590 try :
591591 await self .ensure_baidu_ai_search_mcp (event .unified_msg_origin )
592592 aisearch_tool = func_tool_mgr .get_func ("AIsearch" )
593- if not aisearch_tool :
594- raise ValueError ("Cannot get Baidu AI Search MCP tool." )
595- tool_set .add_tool (aisearch_tool )
593+ if aisearch_tool and aisearch_tool .active :
594+ tool_set .add_tool (aisearch_tool )
596595 tool_set .remove_tool ("web_search" )
597596 tool_set .remove_tool ("fetch_url" )
598597 tool_set .remove_tool ("web_search_tavily" )
@@ -602,7 +601,7 @@ async def edit_web_search_tools(
602601 logger .error (f"Cannot Initialize Baidu AI Search MCP Server: { e } " )
603602 elif provider == "bocha" :
604603 web_search_bocha = func_tool_mgr .get_func ("web_search_bocha" )
605- if web_search_bocha :
604+ if web_search_bocha and web_search_bocha . active :
606605 tool_set .add_tool (web_search_bocha )
607606 tool_set .remove_tool ("web_search" )
608607 tool_set .remove_tool ("fetch_url" )
0 commit comments