Skip to content

Commit 90372d3

Browse files
fix: enhance tools parameter handling in agent retrieval
2 parents 5d56125 + 5743e6e commit 90372d3

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

backend/agent/api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,19 @@ async def get_agents(
13841384
filtered_agents = []
13851385
tools_filter = []
13861386
if tools:
1387-
tools_filter = [tool.strip() for tool in tools.split(',') if tool.strip()]
1387+
# Handle case where tools might be passed as dict instead of string
1388+
if isinstance(tools, str):
1389+
tools_filter = [tool.strip() for tool in tools.split(',') if tool.strip()]
1390+
elif isinstance(tools, dict):
1391+
# If tools is a dict, log the issue and skip filtering
1392+
logger.warning(f"Received tools parameter as dict instead of string: {tools}")
1393+
tools_filter = []
1394+
elif isinstance(tools, list):
1395+
# If tools is a list, use it directly
1396+
tools_filter = [str(tool).strip() for tool in tools if str(tool).strip()]
1397+
else:
1398+
logger.warning(f"Unexpected tools parameter type: {type(tools)}, value: {tools}")
1399+
tools_filter = []
13881400

13891401
for agent in agents_data:
13901402
# Get version data if available and extract configuration

frontend/src/components/agents/mcp/custom-mcp-dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const API_URL = process.env.NEXT_PUBLIC_BACKEND_URL || '';
1515
interface CustomMCPDialogProps {
1616
open: boolean;
1717
onOpenChange: (open: boolean) => void;
18-
onSave: (config: CustomMCPConfiguration) => Promise<void>;
18+
onSave: (config: CustomMCPConfiguration) => void;
1919
}
2020

2121
interface CustomMCPConfiguration {
@@ -145,7 +145,7 @@ export const CustomMCPDialog: React.FC<CustomMCPDialogProps> = ({
145145
try {
146146
let configToSave: any = { url: configText.trim() };
147147

148-
await onSave({
148+
onSave({
149149
name: serverName,
150150
type: serverType,
151151
config: configToSave,

0 commit comments

Comments
 (0)