Skip to content

Commit abd12a3

Browse files
committed
fix: Unknown tool: tencentcloud_search
1 parent f8feee0 commit abd12a3

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

backend/app/services/agent_tools.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,8 @@ async def _execute_tool_direct(
20972097
return await _google_search_tool(arguments, agent_id)
20982098
elif tool_name == "bing_search":
20992099
return await _bing_search_tool(arguments, agent_id)
2100+
elif tool_name == "tencentcloud_search":
2101+
return await _tencentcloud_search_tool(arguments, agent_id)
21002102
elif tool_name == "send_feishu_message":
21012103
return await _send_feishu_message(agent_id, arguments)
21022104
elif tool_name == "send_message_to_agent":
@@ -2265,6 +2267,8 @@ async def execute_tool(
22652267
result = await _google_search_tool(arguments, agent_id)
22662268
elif tool_name == "bing_search":
22672269
result = await _bing_search_tool(arguments, agent_id)
2270+
elif tool_name == "tencentcloud_search":
2271+
result = await _tencentcloud_search_tool(arguments, agent_id)
22682272
elif tool_name == "jina_read":
22692273
result = await _jina_read(arguments)
22702274
elif tool_name == "read_webpage":
@@ -2997,6 +3001,23 @@ async def _bing_search_tool(arguments: dict, agent_id: uuid.UUID | None = None)
29973001
return f"Bing search error: {str(e)[:200]}"
29983002

29993003

3004+
async def _tencentcloud_search_tool(arguments: dict, agent_id: uuid.UUID | None = None) -> str:
3005+
"""Standalone Tencent Cloud WSA Search tool (API keys read from per-tool config)."""
3006+
query = arguments.get("query", "").strip()
3007+
if not query:
3008+
return "Please provide search keywords"
3009+
config = await _get_tool_config(agent_id, "tencentcloud_search") or {}
3010+
secret_id = config.get("secret_id", "").strip()
3011+
secret_key = config.get("secret_key", "").strip()
3012+
if not secret_id or not secret_key:
3013+
return "Tencent Cloud API keys (secret_id, secret_key) are required. Set them in the tool settings."
3014+
max_results = min(arguments.get("max_results", 5), 10)
3015+
try:
3016+
return await _search_tencentcloud(query, secret_id, secret_key, max_results)
3017+
except Exception as e:
3018+
return f"Tencent Cloud search error: {str(e)[:200]}"
3019+
3020+
30003021
async def _send_channel_file(agent_id: uuid.UUID, ws: Path, arguments: dict) -> str:
30013022
"""Send a file to a person or back to the current channel.
30023023

0 commit comments

Comments
 (0)